PluginProbe
Presto Player / 4.5.0
Presto Player v4.5.0
4.5.0 4.4.1 4.4.0 4.3.3 4.3.2 4.3.1 4.3.0 4.2.4 4.2.3 4.2.2 4.2.0 4.2.1 trunk 1.10.0 1.10.1 1.10.2 1.11.0 1.12.0 1.13.0 1.14.0 1.14.1 1.5.10 1.5.11 1.5.12 1.5.13 All 126 releases
presto-player / src / admin / blocks / shared / ProUpgradeModal.js
ProUpgradeModal.js
48 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
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