MediaProviders
4 days ago
ProvidersPlaceholder
4 days ago
audioPresets
4 days ago
branding
6 months ago
chapters
2 years ago
components
4 days ago
media
4 days ago
overlays
4 days ago
presets
4 days ago
services
4 years ago
settings
1 month ago
styles
1 year ago
tracks
4 days ago
BlockInspectorControls.js
4 days ago
BlockInspectorControls.scss
4 days ago
Editing.js
1 year ago
LinkPlaceholder.js
1 month ago
Player.js
1 month ago
Preview.js
2 years ago
ProUpgradeModal.js
1 month ago
VisibilityEditor.js
6 months ago
audio-placeholder.js
4 days ago
helpers.js
5 years ago
options.js
4 days ago
placeholder.js
4 days ago
ProUpgradeModal.js
48 lines
| 1 | const { Modal, Button } = wp.components; |
| 2 | const { dispatch, useSelect } = wp.data; |
| 3 | import { __ } from "@wordpress/i18n"; |
| 4 | import ProBadge from "@/admin/blocks/shared/components/ProBadge"; |
| 5 | import useUpgradeCTA from "@/admin/dashboard/hooks/useUpgradeCTA"; |
| 6 | |
| 7 | export default function () { |
| 8 | const closeModal = () => { |
| 9 | dispatch("presto-player/player").setProModal(false); |
| 10 | }; |
| 11 | |
| 12 | const open = useSelect((select) => { |
| 13 | return select("presto-player/player").proModal(); |
| 14 | }); |
| 15 | |
| 16 | // Block editor is outside the dashboard SPA — no router history available. |
| 17 | // The hook falls back to a hard navigation for the License Settings href. |
| 18 | const { label, href, isProUnlicensed } = useUpgradeCTA(); |
| 19 | |
| 20 | const body = isProUnlicensed |
| 21 | ? __( |
| 22 | "Activate your Pro license to unlock this feature.", |
| 23 | "presto-player" |
| 24 | ) |
| 25 | : __( |
| 26 | "Get this feature and more with the Pro version of Presto Player!", |
| 27 | "presto-player" |
| 28 | ); |
| 29 | |
| 30 | return open ? ( |
| 31 | <Modal title={__("Pro Feature", "presto-player")} onRequestClose={closeModal}> |
| 32 | <h2> |
| 33 | {__("Unlock Presto Player", "presto-player")} <ProBadge /> |
| 34 | </h2> |
| 35 | <p>{body}</p> |
| 36 | <Button |
| 37 | href={href} |
| 38 | target={isProUnlicensed ? "_self" : "_blank"} |
| 39 | isPrimary |
| 40 | > |
| 41 | {label} |
| 42 | </Button> |
| 43 | </Modal> |
| 44 | ) : ( |
| 45 | "" |
| 46 | ); |
| 47 | } |
| 48 |