@edx/frontend-plugin-advertisements 2.31.2 → 2.32.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/paywall/SubscriptionPaywall.js +6 -2
- package/dist/paywall/SubscriptionPaywall.js.map +1 -1
- package/dist/subscription-upsell/SubscriptionUpgradeCard.js +10 -1
- package/dist/subscription-upsell/SubscriptionUpgradeCard.js.map +1 -1
- package/dist/subscription-upsell/SubscriptionUpgradeProgressModal.js +140 -0
- package/dist/subscription-upsell/SubscriptionUpgradeProgressModal.js.map +1 -0
- package/dist/subscription-upsell/SubscriptionUpgradeProgressModal.scss +13 -0
- package/dist/subscription-upsell/SubscriptionUpsell.js +86 -29
- package/dist/subscription-upsell/SubscriptionUpsell.js.map +1 -1
- package/dist/subscription-upsell/messages.js +40 -0
- package/dist/subscription-upsell/messages.js.map +1 -1
- package/dist/subscription-upsell/reloadWhenUpgraded.js +56 -30
- package/dist/subscription-upsell/reloadWhenUpgraded.js.map +1 -1
- package/dist/upgrade-modal/UpgradeModal.js +6 -4
- package/dist/upgrade-modal/UpgradeModal.js.map +1 -1
- package/dist/upgrade-notification/UpgradeNotification.js +8 -2
- package/dist/upgrade-notification/UpgradeNotification.js.map +1 -1
- package/dist/upgrade-to-complete-alert/UpgradeToCompleteAlert.js +7 -1
- package/dist/upgrade-to-complete-alert/UpgradeToCompleteAlert.js.map +1 -1
- package/package.json +1 -1
|
@@ -18,7 +18,10 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
18
18
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
19
19
|
/* eslint import/no-unresolved: 0 */
|
|
20
20
|
|
|
21
|
-
/**
|
|
21
|
+
/**
|
|
22
|
+
* The locked graded content banner (Figma 3484-70965): Subscribe, or Upgrade with your subscription for a
|
|
23
|
+
* subscriber. Its upgraded pop-up's Resume course reloads the unit, which then shows the unlocked content.
|
|
24
|
+
*/const SubscriptionPaywall = _ref => {
|
|
22
25
|
let {
|
|
23
26
|
courseId,
|
|
24
27
|
offer,
|
|
@@ -70,7 +73,8 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
|
|
|
70
73
|
}), offer.canUpgradeInPlace ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_subscriptionUpsell.SubscriptionUpsell, {
|
|
71
74
|
courseId: courseId,
|
|
72
75
|
className: "flex-shrink-0",
|
|
73
|
-
onUpgradeEvent: onUpgradeEvent
|
|
76
|
+
onUpgradeEvent: onUpgradeEvent,
|
|
77
|
+
withUpgradeModal: true
|
|
74
78
|
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_paragon.Button, {
|
|
75
79
|
variant: "primary",
|
|
76
80
|
size: "sm",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SubscriptionPaywall.js","names":["_react","_interopRequireDefault","require","_propTypes","_i18n","_paragon","_icons","_messages","_edX_locked_certificate","_upsellBullets","_subscriptionUpsell","_messages2","_jsxRuntime","e","__esModule","default","SubscriptionPaywall","_ref","courseId","offer","onSubscribeClick","onUpgradeEvent","formatMessage","useIntl","jsx","Alert","variant","icon","Locked","className","children","jsxs","Stack","direction","gap","Heading","as","lockPaywallMessages","Image","src","certificateLocked","alt","width","height","role","style","flex","VerifiedCertBullet","UnlockGradedBullet","FullAccessBullet","canUpgradeInPlace","SubscriptionUpsell","Button","size","href","subscribeUrl","onClick","subscriptionMessages","subscribe","propTypes","PropTypes","string","isRequired","shape","bool","func","defaultProps","undefined","_default","exports"],"sources":["../../src/paywall/SubscriptionPaywall.jsx"],"sourcesContent":["/* eslint import/no-unresolved: 0 */\nimport React from 'react';\nimport PropTypes from 'prop-types';\nimport { useIntl } from '@edx/frontend-platform/i18n';\nimport {\n Alert, Button, Image, Stack,\n} from '@openedx/paragon';\nimport { Locked } from '@openedx/paragon/icons';\nimport lockPaywallMessages from '@src/courseware/course/sequence/lock-paywall/messages';\nimport certificateLocked from '@src/generic/assets/edX_locked_certificate.png';\n\nimport { VerifiedCertBullet, UnlockGradedBullet, FullAccessBullet } from '../generic/upsell-bullets';\nimport { SubscriptionUpsell } from '../subscription-upsell';\nimport subscriptionMessages from '../subscription-upsell/messages';\n\n
|
|
1
|
+
{"version":3,"file":"SubscriptionPaywall.js","names":["_react","_interopRequireDefault","require","_propTypes","_i18n","_paragon","_icons","_messages","_edX_locked_certificate","_upsellBullets","_subscriptionUpsell","_messages2","_jsxRuntime","e","__esModule","default","SubscriptionPaywall","_ref","courseId","offer","onSubscribeClick","onUpgradeEvent","formatMessage","useIntl","jsx","Alert","variant","icon","Locked","className","children","jsxs","Stack","direction","gap","Heading","as","lockPaywallMessages","Image","src","certificateLocked","alt","width","height","role","style","flex","VerifiedCertBullet","UnlockGradedBullet","FullAccessBullet","canUpgradeInPlace","SubscriptionUpsell","withUpgradeModal","Button","size","href","subscribeUrl","onClick","subscriptionMessages","subscribe","propTypes","PropTypes","string","isRequired","shape","bool","func","defaultProps","undefined","_default","exports"],"sources":["../../src/paywall/SubscriptionPaywall.jsx"],"sourcesContent":["/* eslint import/no-unresolved: 0 */\nimport React from 'react';\nimport PropTypes from 'prop-types';\nimport { useIntl } from '@edx/frontend-platform/i18n';\nimport {\n Alert, Button, Image, Stack,\n} from '@openedx/paragon';\nimport { Locked } from '@openedx/paragon/icons';\nimport lockPaywallMessages from '@src/courseware/course/sequence/lock-paywall/messages';\nimport certificateLocked from '@src/generic/assets/edX_locked_certificate.png';\n\nimport { VerifiedCertBullet, UnlockGradedBullet, FullAccessBullet } from '../generic/upsell-bullets';\nimport { SubscriptionUpsell } from '../subscription-upsell';\nimport subscriptionMessages from '../subscription-upsell/messages';\n\n/**\n * The locked graded content banner (Figma 3484-70965): Subscribe, or Upgrade with your subscription for a\n * subscriber. Its upgraded pop-up's Resume course reloads the unit, which then shows the unlocked content.\n */\nconst SubscriptionPaywall = ({\n courseId, offer, onSubscribeClick, onUpgradeEvent,\n}) => {\n const { formatMessage } = useIntl();\n\n return (\n <Alert\n variant=\"light\"\n aria-live=\"off\"\n icon={Locked}\n className=\"bg-light-200 border-0 shadow-sm p-4\"\n data-testid=\"subscription-paywall\"\n >\n {/* The button is not in Alert's actions: elm-theme turns primary buttons there into brand (orange) buttons. */}\n <Stack\n direction=\"horizontal\"\n gap={4}\n className=\"flex-column flex-md-row align-items-start align-items-md-center\"\n >\n <Stack gap={2} className=\"flex-grow-1\">\n <Alert.Heading as=\"h3\" className=\"h6 font-weight-bold text-primary-500 mb-0\">\n {formatMessage(lockPaywallMessages['learn.lockPaywall.title'])}\n </Alert.Heading>\n <p className=\"mb-0\">{formatMessage(lockPaywallMessages['learn.lockPaywall.content'])}</p>\n <Stack direction=\"horizontal\" gap={3} className=\"flex-wrap\">\n <Image\n src={certificateLocked}\n alt={formatMessage(lockPaywallMessages['learn.lockPaywall.example.alt'])}\n width={175}\n height={128}\n />\n {/* Let the bullet text wrap before the whole list drops under the image. */}\n <Stack gap={2} role=\"list\" className=\"align-self-center upsell-bullets\" style={{ flex: '1 1 16rem' }}>\n <VerifiedCertBullet />\n <UnlockGradedBullet />\n <FullAccessBullet />\n </Stack>\n </Stack>\n </Stack>\n {offer.canUpgradeInPlace ? (\n <SubscriptionUpsell courseId={courseId} className=\"flex-shrink-0\" onUpgradeEvent={onUpgradeEvent} withUpgradeModal />\n ) : (\n <Button variant=\"primary\" size=\"sm\" className=\"rounded-pill\" href={offer.subscribeUrl} onClick={onSubscribeClick}>\n {formatMessage(subscriptionMessages.subscribe)}\n </Button>\n )}\n </Stack>\n </Alert>\n );\n};\n\nSubscriptionPaywall.propTypes = {\n courseId: PropTypes.string.isRequired,\n offer: PropTypes.shape({\n canUpgradeInPlace: PropTypes.bool,\n subscribeUrl: PropTypes.string,\n }).isRequired,\n onSubscribeClick: PropTypes.func,\n onUpgradeEvent: PropTypes.func,\n};\n\nSubscriptionPaywall.defaultProps = {\n onSubscribeClick: undefined,\n onUpgradeEvent: undefined,\n};\n\nexport default SubscriptionPaywall;\n"],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ACtB,IAAAtC,WAAA,CAAAY,GAAA,EAACd,mBAAA,CAAAyC,kBAAkB;QAACjC,QAAQ,EAAEA,QAAS;QAACW,SAAS,EAAC,eAAe;QAACR,cAAc,EAAEA,cAAe;QAAC+B,gBAAgB;MAAA,CAAE,CAAC,gBAErH,IAAAxC,WAAA,CAAAY,GAAA,EAACnB,QAAA,CAAAgD,MAAM;QAAC3B,OAAO,EAAC,SAAS;QAAC4B,IAAI,EAAC,IAAI;QAACzB,SAAS,EAAC,cAAc;QAAC0B,IAAI,EAAEpC,KAAK,CAACqC,YAAa;QAACC,OAAO,EAAErC,gBAAiB;QAAAU,QAAA,EAC9GR,aAAa,CAACoC,kBAAoB,CAACC,SAAS;MAAC,CACxC,CACT;IAAA,CACI;EAAC,CACH,CAAC;AAEZ,CAAC;AAED3C,mBAAmB,CAAC4C,SAAS,GAAG;EAC9B1C,QAAQ,EAAE2C,kBAAS,CAACC,MAAM,CAACC,UAAU;EACrC5C,KAAK,EAAE0C,kBAAS,CAACG,KAAK,CAAC;IACrBd,iBAAiB,EAAEW,kBAAS,CAACI,IAAI;IACjCT,YAAY,EAAEK,kBAAS,CAACC;EAC1B,CAAC,CAAC,CAACC,UAAU;EACb3C,gBAAgB,EAAEyC,kBAAS,CAACK,IAAI;EAChC7C,cAAc,EAAEwC,kBAAS,CAACK;AAC5B,CAAC;AAEDlD,mBAAmB,CAACmD,YAAY,GAAG;EACjC/C,gBAAgB,EAAEgD,SAAS;EAC3B/C,cAAc,EAAE+C;AAClB,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAvD,OAAA,GAEaC,mBAAmB","ignoreList":[]}
|
|
@@ -30,6 +30,8 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
|
|
|
30
30
|
onPurchaseClick,
|
|
31
31
|
onUpgradeEvent,
|
|
32
32
|
onUpgraded,
|
|
33
|
+
withUpgradeModal,
|
|
34
|
+
resumeCourseUrl,
|
|
33
35
|
onClose,
|
|
34
36
|
banner
|
|
35
37
|
} = _ref;
|
|
@@ -186,7 +188,9 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
|
|
|
186
188
|
onSubscribeClick: onSubscribeClick,
|
|
187
189
|
onPurchaseClick: onPurchaseClick,
|
|
188
190
|
onUpgradeEvent: onUpgradeEvent,
|
|
189
|
-
onUpgraded: onUpgraded
|
|
191
|
+
onUpgraded: onUpgraded,
|
|
192
|
+
withUpgradeModal: withUpgradeModal,
|
|
193
|
+
resumeCourseUrl: resumeCourseUrl
|
|
190
194
|
})]
|
|
191
195
|
});
|
|
192
196
|
};
|
|
@@ -197,6 +201,9 @@ SubscriptionUpgradeCard.propTypes = {
|
|
|
197
201
|
onPurchaseClick: _propTypes.default.func,
|
|
198
202
|
onUpgradeEvent: _propTypes.default.func,
|
|
199
203
|
onUpgraded: _propTypes.default.func,
|
|
204
|
+
// Passed to SubscriptionUpsell: Upgrade with your subscription and its pop-ups, and where Resume course goes.
|
|
205
|
+
withUpgradeModal: _propTypes.default.bool,
|
|
206
|
+
resumeCourseUrl: _propTypes.default.string,
|
|
200
207
|
// The courseware sidebar widget passes its toggle so the card can close it.
|
|
201
208
|
onClose: _propTypes.default.func,
|
|
202
209
|
// Host content shown under the certificate preview, such as the access expiration countdown.
|
|
@@ -208,6 +215,8 @@ SubscriptionUpgradeCard.defaultProps = {
|
|
|
208
215
|
onPurchaseClick: undefined,
|
|
209
216
|
onUpgradeEvent: undefined,
|
|
210
217
|
onUpgraded: undefined,
|
|
218
|
+
withUpgradeModal: false,
|
|
219
|
+
resumeCourseUrl: null,
|
|
211
220
|
onClose: undefined,
|
|
212
221
|
banner: undefined
|
|
213
222
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SubscriptionUpgradeCard.js","names":["_react","_interopRequireDefault","require","_propTypes","_classnames","_frontendPlatform","_i18n","_paragon","_icons","_certificatePreview","_messages","_SubscriptionUpsell","_useSubscriptionOffer","_messages2","_jsxRuntime","e","__esModule","default","SubscriptionUpgradeCard","_ref","courseId","withBorder","onSubscribeClick","onPurchaseClick","onUpgradeEvent","onUpgraded","onClose","banner","formatMessage","useIntl","offer","useSubscriptionOffer","hasUpsell","coursePrice","subscribePrice","included","jsx","Icon","src","CheckCircle","screenReaderText","messages","includedAlt","notIncluded","CloseSmall","notIncludedAlt","showSubscribeColumn","canSubscribe","showBuyColumn","canPurchase","showTable","canUpgradeInPlace","rows","hasTrial","key","label","featureFreeTrial","buy","featureChangeCourses","featureCertificates","certificateLink","Hyperlink","destination","getConfig","MARKETING_SITE_BASE_URL","children","featureCertificatesLink","featureGradedAssignments","featureUnlimitedAccess","filter","Boolean","jsxs","className","classNames","id","Stack","direction","cardHeader","IconButton","Close","iconAs","size","alt","upgradeNotificationMessages","closeAlt","onClick","benefitsHeader","scope","featureColumn","buyColumn","subscribeColumn","map","row","index","last","length","propTypes","PropTypes","string","isRequired","bool","func","node","defaultProps","undefined","_default","exports"],"sources":["../../src/subscription-upsell/SubscriptionUpgradeCard.jsx"],"sourcesContent":["/* eslint import/no-unresolved: 0 */\nimport React from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\nimport { getConfig } from '@edx/frontend-platform';\nimport { useIntl } from '@edx/frontend-platform/i18n';\nimport {\n Hyperlink, Icon, IconButton, Stack,\n} from '@openedx/paragon';\nimport { CheckCircle, Close, CloseSmall } from '@openedx/paragon/icons';\n\nimport CertificatePreview from '../upgrade-notification/certificate-preview';\nimport upgradeNotificationMessages from '../upgrade-notification/messages';\nimport '../generic/upsell-bullets/UpsellTable.scss';\nimport SubscriptionUpsell from './SubscriptionUpsell';\nimport useSubscriptionOffer from './useSubscriptionOffer';\nimport messages from './messages';\nimport './SubscriptionUpgradeCard.scss';\n\n/** The sidebar card (Figma 3331-33999): certificate preview, Buy vs Subscribe table, buttons. */\nconst SubscriptionUpgradeCard = ({\n courseId,\n withBorder,\n onSubscribeClick,\n onPurchaseClick,\n onUpgradeEvent,\n onUpgraded,\n onClose,\n banner,\n}) => {\n const { formatMessage } = useIntl();\n const offer = useSubscriptionOffer(courseId);\n\n if (!offer?.hasUpsell) {\n return null;\n }\n\n const { coursePrice, subscribePrice } = offer;\n const included = <Icon src={CheckCircle} screenReaderText={formatMessage(messages.includedAlt)} />;\n const notIncluded = <Icon src={CloseSmall} screenReaderText={formatMessage(messages.notIncludedAlt)} />;\n\n // Columns follow the buttons; a subscriber gets Upgrade now and nothing to compare.\n const showSubscribeColumn = offer.canSubscribe;\n const showBuyColumn = offer.canPurchase;\n const showTable = !offer.canUpgradeInPlace && (showSubscribeColumn || showBuyColumn);\n\n const rows = [\n showSubscribeColumn && offer.hasTrial\n && { key: 'free-trial', label: formatMessage(messages.featureFreeTrial), buy: false },\n showSubscribeColumn\n && { key: 'change-courses', label: formatMessage(messages.featureChangeCourses), buy: false },\n {\n key: 'certificates',\n label: formatMessage(messages.featureCertificates, {\n certificateLink: (\n <Hyperlink destination={`${getConfig().MARKETING_SITE_BASE_URL}/verified-certificate`}>\n {formatMessage(messages.featureCertificatesLink)}\n </Hyperlink>\n ),\n }),\n buy: true,\n },\n { key: 'graded-assignments', label: formatMessage(messages.featureGradedAssignments), buy: true },\n { key: 'unlimited-access', label: formatMessage(messages.featureUnlimitedAccess), buy: true },\n ].filter(Boolean);\n\n return (\n <section\n className={classNames('upgrade-notification subscription-upgrade-card small', {\n 'pgn__card pgn__card-light card mb-4 rounded': withBorder,\n })}\n id=\"courseHome-upgradeNotification\"\n data-testid=\"subscription-upgrade-card\"\n >\n <Stack direction=\"horizontal\" className=\"align-items-start px-4 pt-4 mb-3\">\n <h2 className=\"upgrade-notification-header h4 mb-0\">{formatMessage(messages.cardHeader)}</h2>\n {onClose && (\n <IconButton\n className=\"ml-auto\"\n src={Close}\n iconAs={Icon}\n size=\"sm\"\n alt={formatMessage(upgradeNotificationMessages.closeAlt)}\n onClick={onClose}\n />\n )}\n </Stack>\n <CertificatePreview courseId={courseId} />\n {banner}\n {showTable && (\n <div className=\"px-4 small\">\n <h3 className=\"mb-4 primary-500\">{formatMessage(messages.benefitsHeader)}</h3>\n <table className=\"text-center subscription-comparison-table\" data-testid=\"subscription-card-table\">\n <thead>\n <tr>\n <th scope=\"col\"><span className=\"sr-only\">{formatMessage(messages.featureColumn)}</span></th>\n {showBuyColumn && (\n <th scope=\"col\" className=\"audit-cell top-audit-border font-weight-normal\" data-testid=\"subscription-card-buy-header\">\n <div className=\"center-items flex-column\">\n <span>{formatMessage(messages.buyColumn)}</span>\n {coursePrice && <span>{coursePrice}</span>}\n </div>\n </th>\n )}\n {showSubscribeColumn && (\n <th scope=\"col\" className=\"verified-cell top-verified-border\" data-testid=\"subscription-card-subscribe-header\">\n <div className=\"center-items flex-column\">\n <span>{formatMessage(messages.subscribeColumn)}</span>\n {subscribePrice && <span className=\"font-weight-normal\">{subscribePrice}</span>}\n </div>\n </th>\n )}\n </tr>\n </thead>\n <tbody>\n {rows.map((row, index) => {\n const last = index === rows.length - 1;\n return (\n <tr key={row.key} data-testid={`subscription-card-row-${row.key}`}>\n <th scope=\"row\" className={classNames('feature-cell text-left font-weight-normal', { 'bottom-no-border': last })}>\n {row.label}\n </th>\n {showBuyColumn && (\n <td className={classNames('audit-cell', { 'bottom-audit-border': last })}>\n <div className=\"center-items\">{row.buy ? included : notIncluded}</div>\n </td>\n )}\n {showSubscribeColumn && (\n <td className={classNames('verified-cell', { 'bottom-verified-border': last })}>\n <div className=\"center-items\">{included}</div>\n </td>\n )}\n </tr>\n );\n })}\n </tbody>\n </table>\n </div>\n )}\n <SubscriptionUpsell\n courseId={courseId}\n className=\"px-4 pb-4 pt-3\"\n onSubscribeClick={onSubscribeClick}\n onPurchaseClick={onPurchaseClick}\n onUpgradeEvent={onUpgradeEvent}\n onUpgraded={onUpgraded}\n />\n </section>\n );\n};\n\nSubscriptionUpgradeCard.propTypes = {\n courseId: PropTypes.string.isRequired,\n withBorder: PropTypes.bool,\n onSubscribeClick: PropTypes.func,\n onPurchaseClick: PropTypes.func,\n onUpgradeEvent: PropTypes.func,\n onUpgraded: PropTypes.func,\n // The courseware sidebar widget passes its toggle so the card can close it.\n onClose: PropTypes.func,\n // Host content shown under the certificate preview, such as the access expiration countdown.\n banner: PropTypes.node,\n};\n\nSubscriptionUpgradeCard.defaultProps = {\n withBorder: false,\n onSubscribeClick: undefined,\n onPurchaseClick: undefined,\n onUpgradeEvent: undefined,\n onUpgraded: undefined,\n onClose: undefined,\n banner: undefined,\n};\n\nexport default SubscriptionUpgradeCard;\n"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,WAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,iBAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AAGA,IAAAM,MAAA,GAAAN,OAAA;AAEA,IAAAO,mBAAA,GAAAR,sBAAA,CAAAC,OAAA;AACA,IAAAQ,SAAA,GAAAT,sBAAA,CAAAC,OAAA;AACAA,OAAA;AACA,IAAAS,mBAAA,GAAAV,sBAAA,CAAAC,OAAA;AACA,IAAAU,qBAAA,GAAAX,sBAAA,CAAAC,OAAA;AACA,IAAAW,UAAA,GAAAZ,sBAAA,CAAAC,OAAA;AACAA,OAAA;AAAwC,IAAAY,WAAA,GAAAZ,OAAA;AAAA,SAAAD,uBAAAc,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAjBxC;;AAmBA,iGACA,MAAMG,uBAAuB,GAAGC,IAAA,IAS1B;EAAA,IAT2B;IAC/BC,QAAQ;IACRC,UAAU;IACVC,gBAAgB;IAChBC,eAAe;IACfC,cAAc;IACdC,UAAU;IACVC,OAAO;IACPC;EACF,CAAC,GAAAR,IAAA;EACC,MAAM;IAAES;EAAc,CAAC,GAAG,IAAAC,aAAO,EAAC,C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G;EACrClF,UAAU,EAAE,KAAK;EACjBC,gBAAgB,EAAEkF,SAAS;EAC3BjF,eAAe,EAAEiF,SAAS;EAC1BhF,cAAc,EAAEgF,SAAS;EACzB/E,UAAU,EAAE+E,SAAS;EACrB9E,OAAO,EAAE8E,SAAS;EAClB7E,MAAM,EAAE6E;AACV,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAzF,OAAA,GAEaC,uBAAuB","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"SubscriptionUpgradeCard.js","names":["_react","_interopRequireDefault","require","_propTypes","_classnames","_frontendPlatform","_i18n","_paragon","_icons","_certificatePreview","_messages","_SubscriptionUpsell","_useSubscriptionOffer","_messages2","_jsxRuntime","e","__esModule","default","SubscriptionUpgradeCard","_ref","courseId","withBorder","onSubscribeClick","onPurchaseClick","onUpgradeEvent","onUpgraded","withUpgradeModal","resumeCourseUrl","onClose","banner","formatMessage","useIntl","offer","useSubscriptionOffer","hasUpsell","coursePrice","subscribePrice","included","jsx","Icon","src","CheckCircle","screenReaderText","messages","includedAlt","notIncluded","CloseSmall","notIncludedAlt","showSubscribeColumn","canSubscribe","showBuyColumn","canPurchase","showTable","canUpgradeInPlace","rows","hasTrial","key","label","featureFreeTrial","buy","featureChangeCourses","featureCertificates","certificateLink","Hyperlink","destination","getConfig","MARKETING_SITE_BASE_URL","children","featureCertificatesLink","featureGradedAssignments","featureUnlimitedAccess","filter","Boolean","jsxs","className","classNames","id","Stack","direction","cardHeader","IconButton","Close","iconAs","size","alt","upgradeNotificationMessages","closeAlt","onClick","benefitsHeader","scope","featureColumn","buyColumn","subscribeColumn","map","row","index","last","length","propTypes","PropTypes","string","isRequired","bool","func","node","defaultProps","undefined","_default","exports"],"sources":["../../src/subscription-upsell/SubscriptionUpgradeCard.jsx"],"sourcesContent":["/* eslint import/no-unresolved: 0 */\nimport React from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\nimport { getConfig } from '@edx/frontend-platform';\nimport { useIntl } from '@edx/frontend-platform/i18n';\nimport {\n Hyperlink, Icon, IconButton, Stack,\n} from '@openedx/paragon';\nimport { CheckCircle, Close, CloseSmall } from '@openedx/paragon/icons';\n\nimport CertificatePreview from '../upgrade-notification/certificate-preview';\nimport upgradeNotificationMessages from '../upgrade-notification/messages';\nimport '../generic/upsell-bullets/UpsellTable.scss';\nimport SubscriptionUpsell from './SubscriptionUpsell';\nimport useSubscriptionOffer from './useSubscriptionOffer';\nimport messages from './messages';\nimport './SubscriptionUpgradeCard.scss';\n\n/** The sidebar card (Figma 3331-33999): certificate preview, Buy vs Subscribe table, buttons. */\nconst SubscriptionUpgradeCard = ({\n courseId,\n withBorder,\n onSubscribeClick,\n onPurchaseClick,\n onUpgradeEvent,\n onUpgraded,\n withUpgradeModal,\n resumeCourseUrl,\n onClose,\n banner,\n}) => {\n const { formatMessage } = useIntl();\n const offer = useSubscriptionOffer(courseId);\n\n if (!offer?.hasUpsell) {\n return null;\n }\n\n const { coursePrice, subscribePrice } = offer;\n const included = <Icon src={CheckCircle} screenReaderText={formatMessage(messages.includedAlt)} />;\n const notIncluded = <Icon src={CloseSmall} screenReaderText={formatMessage(messages.notIncludedAlt)} />;\n\n // Columns follow the buttons; a subscriber gets Upgrade now and nothing to compare.\n const showSubscribeColumn = offer.canSubscribe;\n const showBuyColumn = offer.canPurchase;\n const showTable = !offer.canUpgradeInPlace && (showSubscribeColumn || showBuyColumn);\n\n const rows = [\n showSubscribeColumn && offer.hasTrial\n && { key: 'free-trial', label: formatMessage(messages.featureFreeTrial), buy: false },\n showSubscribeColumn\n && { key: 'change-courses', label: formatMessage(messages.featureChangeCourses), buy: false },\n {\n key: 'certificates',\n label: formatMessage(messages.featureCertificates, {\n certificateLink: (\n <Hyperlink destination={`${getConfig().MARKETING_SITE_BASE_URL}/verified-certificate`}>\n {formatMessage(messages.featureCertificatesLink)}\n </Hyperlink>\n ),\n }),\n buy: true,\n },\n { key: 'graded-assignments', label: formatMessage(messages.featureGradedAssignments), buy: true },\n { key: 'unlimited-access', label: formatMessage(messages.featureUnlimitedAccess), buy: true },\n ].filter(Boolean);\n\n return (\n <section\n className={classNames('upgrade-notification subscription-upgrade-card small', {\n 'pgn__card pgn__card-light card mb-4 rounded': withBorder,\n })}\n id=\"courseHome-upgradeNotification\"\n data-testid=\"subscription-upgrade-card\"\n >\n <Stack direction=\"horizontal\" className=\"align-items-start px-4 pt-4 mb-3\">\n <h2 className=\"upgrade-notification-header h4 mb-0\">{formatMessage(messages.cardHeader)}</h2>\n {onClose && (\n <IconButton\n className=\"ml-auto\"\n src={Close}\n iconAs={Icon}\n size=\"sm\"\n alt={formatMessage(upgradeNotificationMessages.closeAlt)}\n onClick={onClose}\n />\n )}\n </Stack>\n <CertificatePreview courseId={courseId} />\n {banner}\n {showTable && (\n <div className=\"px-4 small\">\n <h3 className=\"mb-4 primary-500\">{formatMessage(messages.benefitsHeader)}</h3>\n <table className=\"text-center subscription-comparison-table\" data-testid=\"subscription-card-table\">\n <thead>\n <tr>\n <th scope=\"col\"><span className=\"sr-only\">{formatMessage(messages.featureColumn)}</span></th>\n {showBuyColumn && (\n <th scope=\"col\" className=\"audit-cell top-audit-border font-weight-normal\" data-testid=\"subscription-card-buy-header\">\n <div className=\"center-items flex-column\">\n <span>{formatMessage(messages.buyColumn)}</span>\n {coursePrice && <span>{coursePrice}</span>}\n </div>\n </th>\n )}\n {showSubscribeColumn && (\n <th scope=\"col\" className=\"verified-cell top-verified-border\" data-testid=\"subscription-card-subscribe-header\">\n <div className=\"center-items flex-column\">\n <span>{formatMessage(messages.subscribeColumn)}</span>\n {subscribePrice && <span className=\"font-weight-normal\">{subscribePrice}</span>}\n </div>\n </th>\n )}\n </tr>\n </thead>\n <tbody>\n {rows.map((row, index) => {\n const last = index === rows.length - 1;\n return (\n <tr key={row.key} data-testid={`subscription-card-row-${row.key}`}>\n <th scope=\"row\" className={classNames('feature-cell text-left font-weight-normal', { 'bottom-no-border': last })}>\n {row.label}\n </th>\n {showBuyColumn && (\n <td className={classNames('audit-cell', { 'bottom-audit-border': last })}>\n <div className=\"center-items\">{row.buy ? included : notIncluded}</div>\n </td>\n )}\n {showSubscribeColumn && (\n <td className={classNames('verified-cell', { 'bottom-verified-border': last })}>\n <div className=\"center-items\">{included}</div>\n </td>\n )}\n </tr>\n );\n })}\n </tbody>\n </table>\n </div>\n )}\n <SubscriptionUpsell\n courseId={courseId}\n className=\"px-4 pb-4 pt-3\"\n onSubscribeClick={onSubscribeClick}\n onPurchaseClick={onPurchaseClick}\n onUpgradeEvent={onUpgradeEvent}\n onUpgraded={onUpgraded}\n withUpgradeModal={withUpgradeModal}\n resumeCourseUrl={resumeCourseUrl}\n />\n </section>\n );\n};\n\nSubscriptionUpgradeCard.propTypes = {\n courseId: PropTypes.string.isRequired,\n withBorder: PropTypes.bool,\n onSubscribeClick: PropTypes.func,\n onPurchaseClick: PropTypes.func,\n onUpgradeEvent: PropTypes.func,\n onUpgraded: PropTypes.func,\n // Passed to SubscriptionUpsell: Upgrade with your subscription and its pop-ups, and where Resume course goes.\n withUpgradeModal: PropTypes.bool,\n resumeCourseUrl: PropTypes.string,\n // The courseware sidebar widget passes its toggle so the card can close it.\n onClose: PropTypes.func,\n // Host content shown under the certificate preview, such as the access expiration countdown.\n banner: PropTypes.node,\n};\n\nSubscriptionUpgradeCard.defaultProps = {\n withBorder: false,\n onSubscribeClick: undefined,\n onPurchaseClick: undefined,\n onUpgradeEvent: undefined,\n onUpgraded: undefined,\n withUpgradeModal: false,\n resumeCourseUrl: null,\n onClose: undefined,\n banner: undefined,\n};\n\nexport default SubscriptionUpgradeCard;\n"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,WAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,iBAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,G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use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = exports.PROGRESS_STAGE = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
+
var _i18n = require("@edx/frontend-platform/i18n");
|
|
10
|
+
var _paragon = require("@openedx/paragon");
|
|
11
|
+
var _modelStore = require("@src/generic/model-store");
|
|
12
|
+
var _lms_api = require("../data/lms_api");
|
|
13
|
+
var _useSubscriptionOffer = require("./useSubscriptionOffer");
|
|
14
|
+
var _messages = _interopRequireDefault(require("./messages"));
|
|
15
|
+
require("./SubscriptionUpgradeProgressModal.scss");
|
|
16
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
18
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
19
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
20
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
21
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
22
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
23
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /* eslint import/no-unresolved: 0 */
|
|
24
|
+
const PROGRESS_STAGE = exports.PROGRESS_STAGE = {
|
|
25
|
+
UPGRADING: 'upgrading',
|
|
26
|
+
UPGRADED: 'upgraded',
|
|
27
|
+
// Kept mounted after the learner closes it, so the partner name is still there when it reopens.
|
|
28
|
+
CLOSED: 'closed'
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* The pop-ups for a subscriber's Upgrade with your subscription (LP-1540): upgrading while the request
|
|
33
|
+
* and the enrollment poll run, then upgraded once the enrollment is verified. The upgrading one can
|
|
34
|
+
* be closed; the upgrade carries on. Resume course follows resumeUrl (course home); without it, it
|
|
35
|
+
* does what Close does, so in the courseware the learner carries on with the unit they are on.
|
|
36
|
+
*/
|
|
37
|
+
const SubscriptionUpgradeProgressModal = _ref => {
|
|
38
|
+
let {
|
|
39
|
+
courseId,
|
|
40
|
+
stage,
|
|
41
|
+
onClose,
|
|
42
|
+
resumeUrl
|
|
43
|
+
} = _ref;
|
|
44
|
+
const {
|
|
45
|
+
formatMessage
|
|
46
|
+
} = (0, _i18n.useIntl)();
|
|
47
|
+
const {
|
|
48
|
+
org,
|
|
49
|
+
title,
|
|
50
|
+
verifiedMode
|
|
51
|
+
} = (0, _modelStore.useModel)('courseHomeMeta', courseId) || {};
|
|
52
|
+
const [partnerName, setPartnerName] = (0, _react.useState)(null);
|
|
53
|
+
(0, _react.useEffect)(() => {
|
|
54
|
+
let cancelled = false;
|
|
55
|
+
setPartnerName(null);
|
|
56
|
+
if (org) {
|
|
57
|
+
(0, _lms_api.fetchOrg)(org).then(data => {
|
|
58
|
+
if (!cancelled) {
|
|
59
|
+
setPartnerName(data?.name || null);
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
return () => {
|
|
64
|
+
cancelled = true;
|
|
65
|
+
};
|
|
66
|
+
}, [org]);
|
|
67
|
+
const isUpgraded = stage === PROGRESS_STAGE.UPGRADED;
|
|
68
|
+
// The full verified price: the first-purchase discount is not what the subscriber saves.
|
|
69
|
+
const price = (0, _useSubscriptionOffer.formatCoursePrice)(verifiedMode);
|
|
70
|
+
const heading = isUpgraded ? formatMessage(_messages.default.upgradedTitle, {
|
|
71
|
+
courseName: title,
|
|
72
|
+
partnerName: partnerName || org
|
|
73
|
+
}) : formatMessage(_messages.default.upgradingTitle);
|
|
74
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_paragon.ModalDialog, {
|
|
75
|
+
title: heading,
|
|
76
|
+
isOpen: stage !== PROGRESS_STAGE.CLOSED,
|
|
77
|
+
onClose: onClose,
|
|
78
|
+
size: "md",
|
|
79
|
+
hasCloseButton: !isUpgraded,
|
|
80
|
+
isOverflowVisible: false,
|
|
81
|
+
className: "subscription-upgrade-progress-modal",
|
|
82
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_paragon.ModalDialog.Header, {
|
|
83
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_paragon.ModalDialog.Title, {
|
|
84
|
+
as: "h2",
|
|
85
|
+
children: heading
|
|
86
|
+
})
|
|
87
|
+
}), isUpgraded ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
88
|
+
children: [price && /*#__PURE__*/(0, _jsxRuntime.jsx)(_paragon.ModalDialog.Body, {
|
|
89
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
|
|
90
|
+
className: "mb-0",
|
|
91
|
+
"data-testid": "subscription-upgraded-savings",
|
|
92
|
+
children: formatMessage(_messages.default.upgradedSavings, {
|
|
93
|
+
price
|
|
94
|
+
})
|
|
95
|
+
})
|
|
96
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_paragon.ModalDialog.Footer, {
|
|
97
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_paragon.ActionRow, {
|
|
98
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_paragon.Button, {
|
|
99
|
+
variant: "tertiary",
|
|
100
|
+
onClick: onClose,
|
|
101
|
+
"data-testid": "subscription-upgraded-close",
|
|
102
|
+
children: formatMessage(_messages.default.upgradedClose)
|
|
103
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_paragon.Button, _objectSpread(_objectSpread({}, resumeUrl ? {
|
|
104
|
+
as: 'a',
|
|
105
|
+
href: resumeUrl
|
|
106
|
+
} : {
|
|
107
|
+
onClick: onClose
|
|
108
|
+
}), {}, {
|
|
109
|
+
variant: "brand",
|
|
110
|
+
className: "rounded-pill",
|
|
111
|
+
"data-testid": "subscription-upgraded-resume",
|
|
112
|
+
children: formatMessage(_messages.default.upgradedResumeCourse)
|
|
113
|
+
}))]
|
|
114
|
+
})
|
|
115
|
+
})]
|
|
116
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_paragon.ModalDialog.Body, {
|
|
117
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
|
|
118
|
+
"data-testid": "subscription-upgrading-value-prop",
|
|
119
|
+
children: formatMessage(_messages.default.upgradingValueProp)
|
|
120
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
121
|
+
className: "d-flex justify-content-center pb-4",
|
|
122
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_paragon.Spinner, {
|
|
123
|
+
animation: "border",
|
|
124
|
+
screenReaderText: formatMessage(_messages.default.upgradingScreenReader)
|
|
125
|
+
})
|
|
126
|
+
})]
|
|
127
|
+
})]
|
|
128
|
+
});
|
|
129
|
+
};
|
|
130
|
+
SubscriptionUpgradeProgressModal.propTypes = {
|
|
131
|
+
courseId: _propTypes.default.string.isRequired,
|
|
132
|
+
stage: _propTypes.default.oneOf(Object.values(PROGRESS_STAGE)).isRequired,
|
|
133
|
+
onClose: _propTypes.default.func.isRequired,
|
|
134
|
+
resumeUrl: _propTypes.default.string
|
|
135
|
+
};
|
|
136
|
+
SubscriptionUpgradeProgressModal.defaultProps = {
|
|
137
|
+
resumeUrl: null
|
|
138
|
+
};
|
|
139
|
+
var _default = exports.default = SubscriptionUpgradeProgressModal;
|
|
140
|
+
//# sourceMappingURL=SubscriptionUpgradeProgressModal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SubscriptionUpgradeProgressModal.js","names":["_react","_interopRequireWildcard","require","_propTypes","_interopRequireDefault","_i18n","_paragon","_modelStore","_lms_api","_useSubscriptionOffer","_messages","_jsxRuntime","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","ownKeys","keys","getOwnPropertySymbols","filter","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","_toPropertyKey","value","configurable","writable","_toPrimitive","Symbol","toPrimitive","TypeError","String","Number","PROGRESS_STAGE","exports","UPGRADING","UPGRADED","CLOSED","SubscriptionUpgradeProgressModal","_ref","courseId","stage","onClose","resumeUrl","formatMessage","useIntl","org","title","verifiedMode","useModel","partnerName","setPartnerName","useState","useEffect","cancelled","fetchOrg","then","data","name","isUpgraded","price","formatCoursePrice","heading","messages","upgradedTitle","courseName","upgradingTitle","jsxs","ModalDialog","isOpen","size","hasCloseButton","isOverflowVisible","className","children","jsx","Header","Title","as","Fragment","Body","upgradedSavings","Footer","ActionRow","Button","variant","onClick","upgradedClose","href","upgradedResumeCourse","upgradingValueProp","Spinner","animation","screenReaderText","upgradingScreenReader","propTypes","PropTypes","string","isRequired","oneOf","values","func","defaultProps","_default"],"sources":["../../src/subscription-upsell/SubscriptionUpgradeProgressModal.jsx"],"sourcesContent":["/* eslint import/no-unresolved: 0 */\nimport React, { useEffect, useState } from 'react';\nimport PropTypes from 'prop-types';\nimport { useIntl } from '@edx/frontend-platform/i18n';\nimport {\n ActionRow, Button, ModalDialog, Spinner,\n} from '@openedx/paragon';\nimport { useModel } from '@src/generic/model-store';\n\nimport { fetchOrg } from '../data/lms_api';\nimport { formatCoursePrice } from './useSubscriptionOffer';\nimport messages from './messages';\nimport './SubscriptionUpgradeProgressModal.scss';\n\nexport const PROGRESS_STAGE = {\n UPGRADING: 'upgrading',\n UPGRADED: 'upgraded',\n // Kept mounted after the learner closes it, so the partner name is still there when it reopens.\n CLOSED: 'closed',\n};\n\n/**\n * The pop-ups for a subscriber's Upgrade with your subscription (LP-1540): upgrading while the request\n * and the enrollment poll run, then upgraded once the enrollment is verified. The upgrading one can\n * be closed; the upgrade carries on. Resume course follows resumeUrl (course home); without it, it\n * does what Close does, so in the courseware the learner carries on with the unit they are on.\n */\nconst SubscriptionUpgradeProgressModal = ({\n courseId, stage, onClose, resumeUrl,\n}) => {\n const { formatMessage } = useIntl();\n const { org, title, verifiedMode } = useModel('courseHomeMeta', courseId) || {};\n const [partnerName, setPartnerName] = useState(null);\n\n useEffect(() => {\n let cancelled = false;\n setPartnerName(null);\n if (org) {\n fetchOrg(org).then((data) => {\n if (!cancelled) {\n setPartnerName(data?.name || null);\n }\n });\n }\n return () => { cancelled = true; };\n }, [org]);\n\n const isUpgraded = stage === PROGRESS_STAGE.UPGRADED;\n // The full verified price: the first-purchase discount is not what the subscriber saves.\n const price = formatCoursePrice(verifiedMode);\n const heading = isUpgraded\n ? formatMessage(messages.upgradedTitle, { courseName: title, partnerName: partnerName || org })\n : formatMessage(messages.upgradingTitle);\n\n return (\n <ModalDialog\n title={heading}\n isOpen={stage !== PROGRESS_STAGE.CLOSED}\n onClose={onClose}\n size=\"md\"\n hasCloseButton={!isUpgraded}\n isOverflowVisible={false}\n className=\"subscription-upgrade-progress-modal\"\n >\n <ModalDialog.Header>\n <ModalDialog.Title as=\"h2\">{heading}</ModalDialog.Title>\n </ModalDialog.Header>\n {isUpgraded ? (\n <>\n {price && (\n <ModalDialog.Body>\n <p className=\"mb-0\" data-testid=\"subscription-upgraded-savings\">\n {formatMessage(messages.upgradedSavings, { price })}\n </p>\n </ModalDialog.Body>\n )}\n <ModalDialog.Footer>\n <ActionRow>\n <Button variant=\"tertiary\" onClick={onClose} data-testid=\"subscription-upgraded-close\">\n {formatMessage(messages.upgradedClose)}\n </Button>\n <Button\n {...(resumeUrl ? { as: 'a', href: resumeUrl } : { onClick: onClose })}\n variant=\"brand\"\n className=\"rounded-pill\"\n data-testid=\"subscription-upgraded-resume\"\n >\n {formatMessage(messages.upgradedResumeCourse)}\n </Button>\n </ActionRow>\n </ModalDialog.Footer>\n </>\n ) : (\n <ModalDialog.Body>\n <p data-testid=\"subscription-upgrading-value-prop\">{formatMessage(messages.upgradingValueProp)}</p>\n <div className=\"d-flex justify-content-center pb-4\">\n <Spinner animation=\"border\" screenReaderText={formatMessage(messages.upgradingScreenReader)} />\n </div>\n </ModalDialog.Body>\n )}\n </ModalDialog>\n );\n};\n\nSubscriptionUpgradeProgressModal.propTypes = {\n courseId: PropTypes.string.isRequired,\n stage: PropTypes.oneOf(Object.values(PROGRESS_STAGE)).isRequired,\n onClose: PropTypes.func.isRequired,\n resumeUrl: PropTypes.string,\n};\n\nSubscriptionUpgradeProgressModal.defaultProps = {\n resumeUrl: null,\n};\n\nexport default SubscriptionUpgradeProgressModal;\n"],"mappings":";;;;;;AACA,IAAAA,MA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,CAAC,gBAEH,IAAApG,WAAA,CAAA8E,IAAA,EAACnF,QAAA,CAAAoF,WAAW,CAACY,IAAI;MAAAN,QAAA,gBACf,IAAArF,WAAA,CAAAsF,GAAA;QAAG,eAAY,mCAAmC;QAAAD,QAAA,EAAE9B,aAAa,CAACmB,iBAAQ,CAAC2B,kBAAkB;MAAC,CAAI,CAAC,eACnG,IAAArG,WAAA,CAAAsF,GAAA;QAAKF,SAAS,EAAC,oCAAoC;QAAAC,QAAA,eACjD,IAAArF,WAAA,CAAAsF,GAAA,EAAC3F,QAAA,CAAA2G,OAAO;UAACC,SAAS,EAAC,QAAQ;UAACC,gBAAgB,EAAEjD,aAAa,CAACmB,iBAAQ,CAAC+B,qBAAqB;QAAE,CAAE;MAAC,CAC5F,CAAC;IAAA,CACU,CACnB;EAAA,CACU,CAAC;AAElB,CAAC;AAEDxD,gCAAgC,CAACyD,SAAS,GAAG;EAC3CvD,QAAQ,EAAEwD,kBAAS,CAACC,MAAM,CAACC,UAAU;EACrCzD,KAAK,EAAEuD,kBAAS,CAACG,KAAK,CAAC7F,MAAM,CAAC8F,MAAM,CAACnE,cAAc,CAAC,CAAC,CAACiE,UAAU;EAChExD,OAAO,EAAEsD,kBAAS,CAACK,IAAI,CAACH,UAAU;EAClCvD,SAAS,EAAEqD,kBAAS,CAACC;AACvB,CAAC;AAED3D,gCAAgC,CAACgE,YAAY,GAAG;EAC9C3D,SAAS,EAAE;AACb,CAAC;AAAC,IAAA4D,QAAA,GAAArE,OAAA,CAAA1C,OAAA,GAEa8C,gCAAgC","ignoreList":[]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// Upgrading and upgraded pop-ups (LP-1540 mockups): white, rounded, heavy Primary/500 title, grey body.
|
|
2
|
+
.subscription-upgrade-progress-modal.pgn__modal {
|
|
3
|
+
--pgn-size-modal-content-border-radius: 12px;
|
|
4
|
+
|
|
5
|
+
.pgn__modal-title {
|
|
6
|
+
font-weight: 800;
|
|
7
|
+
color: var(--pgn-color-primary-500);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.pgn__modal-body {
|
|
11
|
+
color: var(--pgn-color-gray-700);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -11,7 +11,8 @@ var _logging = require("@edx/frontend-platform/logging");
|
|
|
11
11
|
var _paragon = require("@openedx/paragon");
|
|
12
12
|
var _lms_api = require("../data/lms_api");
|
|
13
13
|
var _messages = _interopRequireDefault(require("../upgrade-notification/messages"));
|
|
14
|
-
var _reloadWhenUpgraded =
|
|
14
|
+
var _reloadWhenUpgraded = _interopRequireWildcard(require("./reloadWhenUpgraded"));
|
|
15
|
+
var _SubscriptionUpgradeProgressModal = _interopRequireWildcard(require("./SubscriptionUpgradeProgressModal"));
|
|
15
16
|
var _useSubscriptionOffer = _interopRequireDefault(require("./useSubscriptionOffer"));
|
|
16
17
|
var _messages2 = _interopRequireDefault(require("./messages"));
|
|
17
18
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
@@ -56,6 +57,8 @@ const SubscriptionUpsell = _ref => {
|
|
|
56
57
|
onPurchaseClick,
|
|
57
58
|
onUpgradeEvent,
|
|
58
59
|
onUpgraded,
|
|
60
|
+
withUpgradeModal,
|
|
61
|
+
resumeCourseUrl,
|
|
59
62
|
className
|
|
60
63
|
} = _ref;
|
|
61
64
|
const {
|
|
@@ -69,6 +72,12 @@ const SubscriptionUpsell = _ref => {
|
|
|
69
72
|
const setUpgradeFor = (id, state) => setUpgrades(prev => _objectSpread(_objectSpread({}, prev), {}, {
|
|
70
73
|
[id]: state
|
|
71
74
|
}));
|
|
75
|
+
// The upgrading/upgraded pop-up, per course like the upgrade. None until the learner clicks.
|
|
76
|
+
const [progress, setProgress] = (0, _react.useState)({});
|
|
77
|
+
const progressStage = progress[courseId] || null;
|
|
78
|
+
const setProgressFor = (id, stage) => setProgress(prev => _objectSpread(_objectSpread({}, prev), {}, {
|
|
79
|
+
[id]: stage
|
|
80
|
+
}));
|
|
72
81
|
// Cancels the reload poll when this component unmounts or shows another course.
|
|
73
82
|
const pollSignal = (0, _react.useRef)(null);
|
|
74
83
|
(0, _react.useEffect)(() => {
|
|
@@ -94,6 +103,9 @@ const SubscriptionUpsell = _ref => {
|
|
|
94
103
|
}
|
|
95
104
|
inFlight.current.add(requestedCourseId);
|
|
96
105
|
setUpgradeFor(requestedCourseId, UPGRADE_STATE.LOADING);
|
|
106
|
+
if (withUpgradeModal) {
|
|
107
|
+
setProgressFor(requestedCourseId, _SubscriptionUpgradeProgressModal.PROGRESS_STAGE.UPGRADING);
|
|
108
|
+
}
|
|
97
109
|
safeCall(onUpgradeEvent, 'started');
|
|
98
110
|
let nextState;
|
|
99
111
|
let result;
|
|
@@ -114,47 +126,82 @@ const SubscriptionUpsell = _ref => {
|
|
|
114
126
|
inFlight.current.delete(requestedCourseId);
|
|
115
127
|
setUpgradeFor(requestedCourseId, nextState);
|
|
116
128
|
if (error) {
|
|
129
|
+
if (withUpgradeModal) {
|
|
130
|
+
// the inline error below the button explains it
|
|
131
|
+
setProgressFor(requestedCourseId, _SubscriptionUpgradeProgressModal.PROGRESS_STAGE.CLOSED);
|
|
132
|
+
}
|
|
117
133
|
safeCall(onUpgradeEvent, 'failed', error);
|
|
118
134
|
} else {
|
|
119
135
|
safeCall(onUpgradeEvent, 'succeeded', result);
|
|
120
|
-
safeCall(onUpgraded || (() => (0, _reloadWhenUpgraded.
|
|
136
|
+
safeCall(onUpgraded || (() => withUpgradeModal ? (0, _reloadWhenUpgraded.waitUntilUpgraded)(requestedCourseId, {
|
|
137
|
+
signal,
|
|
138
|
+
startPath
|
|
139
|
+
}).then(verified => {
|
|
140
|
+
// Upgraded opens even if the learner closed the upgrading pop-up. Without a verified enrollment,
|
|
141
|
+
// or once the poll is cancelled (unmount, another course), the pop-up closes and the pending
|
|
142
|
+
// message stays, so coming back to this course never shows a spinner with no poll behind it.
|
|
143
|
+
const upgraded = verified && !signal?.aborted;
|
|
144
|
+
setProgressFor(requestedCourseId, upgraded ? _SubscriptionUpgradeProgressModal.PROGRESS_STAGE.UPGRADED : _SubscriptionUpgradeProgressModal.PROGRESS_STAGE.CLOSED);
|
|
145
|
+
}) : (0, _reloadWhenUpgraded.default)(requestedCourseId, {
|
|
121
146
|
signal,
|
|
122
147
|
startPath
|
|
123
148
|
})), result);
|
|
124
149
|
}
|
|
125
150
|
};
|
|
151
|
+
|
|
152
|
+
// Closing the upgraded pop-up refreshes the page, which then shows the verified course.
|
|
153
|
+
const closeProgress = () => {
|
|
154
|
+
if (progressStage === _SubscriptionUpgradeProgressModal.PROGRESS_STAGE.UPGRADED) {
|
|
155
|
+
global.location.reload();
|
|
156
|
+
} else {
|
|
157
|
+
setProgressFor(courseId, _SubscriptionUpgradeProgressModal.PROGRESS_STAGE.CLOSED);
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
const progressModal = withUpgradeModal && progressStage && /*#__PURE__*/(0, _jsxRuntime.jsx)(_SubscriptionUpgradeProgressModal.default, {
|
|
161
|
+
courseId: courseId,
|
|
162
|
+
stage: progressStage,
|
|
163
|
+
onClose: closeProgress,
|
|
164
|
+
resumeUrl: resumeCourseUrl
|
|
165
|
+
});
|
|
126
166
|
if (offer.canUpgradeInPlace) {
|
|
167
|
+
const upgradeLabel = withUpgradeModal ? _messages2.default.upgradeWithSubscription : _messages2.default.upgradeNow;
|
|
168
|
+
// The pop-up comes first in both returns, so React keeps the same one from the click to the pending
|
|
169
|
+
// message: no second partner fetch, and focus stays where it was in the dialog.
|
|
127
170
|
if (upgradeState === UPGRADE_STATE.PENDING) {
|
|
128
|
-
return /*#__PURE__*/(0, _jsxRuntime.
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
171
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
172
|
+
children: [progressModal, /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
|
|
173
|
+
className: className,
|
|
174
|
+
role: "status",
|
|
175
|
+
"data-testid": "subscription-upgrade-pending",
|
|
176
|
+
children: formatMessage(_messages2.default.upgradePending)
|
|
177
|
+
})]
|
|
133
178
|
});
|
|
134
179
|
}
|
|
135
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
children: [
|
|
142
|
-
|
|
143
|
-
|
|
180
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
181
|
+
children: [progressModal, /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
182
|
+
className: className,
|
|
183
|
+
children: [upgradeState === UPGRADE_STATE.NOT_ACTIVE && /*#__PURE__*/(0, _jsxRuntime.jsxs)("p", {
|
|
184
|
+
role: "alert",
|
|
185
|
+
"data-testid": "subscription-upgrade-not-active",
|
|
186
|
+
children: [formatMessage(_messages2.default.upgradeNotActive), offer.subscribeUrl && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
187
|
+
children: [' ', /*#__PURE__*/(0, _jsxRuntime.jsx)(_paragon.Hyperlink, {
|
|
188
|
+
destination: offer.subscribeUrl,
|
|
189
|
+
children: formatMessage(_messages2.default.reactivateSubscription)
|
|
190
|
+
})]
|
|
144
191
|
})]
|
|
192
|
+
}), upgradeState === UPGRADE_STATE.FAILED && /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
|
|
193
|
+
role: "alert",
|
|
194
|
+
"data-testid": "subscription-upgrade-failed",
|
|
195
|
+
children: formatMessage(_messages2.default.upgradeFailed)
|
|
196
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_paragon.Button, {
|
|
197
|
+
variant: "primary",
|
|
198
|
+
className: "rounded-pill",
|
|
199
|
+
block: true,
|
|
200
|
+
onClick: handleUpgrade,
|
|
201
|
+
disabled: upgradeState === UPGRADE_STATE.LOADING,
|
|
202
|
+
"data-testid": "subscription-upgrade-now-button",
|
|
203
|
+
children: formatMessage(upgradeState === UPGRADE_STATE.LOADING ? _messages2.default.upgrading : upgradeLabel)
|
|
145
204
|
})]
|
|
146
|
-
}), upgradeState === UPGRADE_STATE.FAILED && /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
|
|
147
|
-
role: "alert",
|
|
148
|
-
"data-testid": "subscription-upgrade-failed",
|
|
149
|
-
children: formatMessage(_messages2.default.upgradeFailed)
|
|
150
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_paragon.Button, {
|
|
151
|
-
variant: "primary",
|
|
152
|
-
className: "rounded-pill",
|
|
153
|
-
block: true,
|
|
154
|
-
onClick: handleUpgrade,
|
|
155
|
-
disabled: upgradeState === UPGRADE_STATE.LOADING,
|
|
156
|
-
"data-testid": "subscription-upgrade-now-button",
|
|
157
|
-
children: formatMessage(upgradeState === UPGRADE_STATE.LOADING ? _messages2.default.upgrading : _messages2.default.upgradeNow)
|
|
158
205
|
})]
|
|
159
206
|
});
|
|
160
207
|
}
|
|
@@ -206,8 +253,16 @@ SubscriptionUpsell.propTypes = {
|
|
|
206
253
|
onSubscribeClick: _propTypes.default.func,
|
|
207
254
|
onPurchaseClick: _propTypes.default.func,
|
|
208
255
|
onUpgradeEvent: _propTypes.default.func,
|
|
209
|
-
// Called after an accepted upgrade. Without it, the page reloads once the LMS has upgraded the
|
|
256
|
+
// Called after an accepted upgrade. Without it, the page reloads once the LMS has upgraded the
|
|
257
|
+
// enrollment, or with withUpgradeModal the upgraded pop-up opens.
|
|
210
258
|
onUpgraded: _propTypes.default.func,
|
|
259
|
+
// LP-1540: Upgrade with your subscription, with the upgrading and upgraded pop-ups. Every placement
|
|
260
|
+
// uses it: the sidebar card (course home and courseware), the Next unit pop-up, the locked content
|
|
261
|
+
// banner and the Dates banner.
|
|
262
|
+
withUpgradeModal: _propTypes.default.bool,
|
|
263
|
+
// Where the upgraded pop-up's Resume course goes (course home and Dates tab). Without it, Resume course
|
|
264
|
+
// reloads the page, so in the courseware the learner carries on with the unit they are on.
|
|
265
|
+
resumeCourseUrl: _propTypes.default.string,
|
|
211
266
|
className: _propTypes.default.string
|
|
212
267
|
};
|
|
213
268
|
SubscriptionUpsell.defaultProps = {
|
|
@@ -215,6 +270,8 @@ SubscriptionUpsell.defaultProps = {
|
|
|
215
270
|
onPurchaseClick: undefined,
|
|
216
271
|
onUpgradeEvent: undefined,
|
|
217
272
|
onUpgraded: undefined,
|
|
273
|
+
withUpgradeModal: false,
|
|
274
|
+
resumeCourseUrl: null,
|
|
218
275
|
className: undefined
|
|
219
276
|
};
|
|
220
277
|
var _default = exports.default = SubscriptionUpsell;
|