@edx/frontend-plugin-advertisements 2.24.3 → 2.25.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.
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+
3
+ var _rosie = require("rosie");
4
+ // eslint-disable-line import/no-extraneous-dependencies
5
+
6
+ // The `extra_offer` block of the course home metadata API, as the MFE stores it (camel-cased).
7
+ // Shape from edx-subscription's devstack mock, branch abhalsod/LP-1415-devstack-offer-mock.
8
+ // status is the Viax status; isSubscriber and freeTrialEligible are null when it is UNKNOWN;
9
+ // subscribeUrl is null when Subscribe should not be offered.
10
+ _rosie.Factory.define('extraOffer').option('checkoutHost', 'https://checkout.example.com').attr('inCatalog', true).attr('status', 'NOT_SUBSCRIBED').attr('isSubscriber', false).attr('freeTrialEligible', true).attr('subscribeUrl', ['checkoutHost'], host => `${host}/subscribe?course_run_key=course-v1:edX+DemoX+Demo_Course`).attr('price', () => ({
11
+ amount: '39.00',
12
+ currency: 'USD',
13
+ billingPeriod: 'month'
14
+ }));
15
+ //# sourceMappingURL=extraOffer.factory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extraOffer.factory.js","names":["_rosie","require","Factory","define","option","attr","host","amount","currency","billingPeriod"],"sources":["../../../src/data/__factories__/extraOffer.factory.js"],"sourcesContent":["import { Factory } from 'rosie'; // eslint-disable-line import/no-extraneous-dependencies\n\n// The `extra_offer` block of the course home metadata API, as the MFE stores it (camel-cased).\n// Shape from edx-subscription's devstack mock, branch abhalsod/LP-1415-devstack-offer-mock.\n// status is the Viax status; isSubscriber and freeTrialEligible are null when it is UNKNOWN;\n// subscribeUrl is null when Subscribe should not be offered.\nFactory.define('extraOffer')\n .option('checkoutHost', 'https://checkout.example.com')\n .attr('inCatalog', true)\n .attr('status', 'NOT_SUBSCRIBED')\n .attr('isSubscriber', false)\n .attr('freeTrialEligible', true)\n .attr('subscribeUrl', ['checkoutHost'], (host) => `${host}/subscribe?course_run_key=course-v1:edX+DemoX+Demo_Course`)\n .attr('price', () => ({ amount: '39.00', currency: 'USD', billingPeriod: 'month' }));\n"],"mappings":";;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAAiC;;AAEjC;AACA;AACA;AACA;AACAC,cAAO,CAACC,MAAM,CAAC,YAAY,CAAC,CACzBC,MAAM,CAAC,cAAc,EAAE,8BAA8B,CAAC,CACtDC,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,CACvBA,IAAI,CAAC,QAAQ,EAAE,gBAAgB,CAAC,CAChCA,IAAI,CAAC,cAAc,EAAE,KAAK,CAAC,CAC3BA,IAAI,CAAC,mBAAmB,EAAE,IAAI,CAAC,CAC/BA,IAAI,CAAC,cAAc,EAAE,CAAC,cAAc,CAAC,EAAGC,IAAI,IAAK,GAAGA,IAAI,2DAA2D,CAAC,CACpHD,IAAI,CAAC,OAAO,EAAE,OAAO;EAAEE,MAAM,EAAE,OAAO;EAAEC,QAAQ,EAAE,KAAK;EAAEC,aAAa,EAAE;AAAQ,CAAC,CAAC,CAAC","ignoreList":[]}
@@ -5,4 +5,5 @@ require("./experimentalUpgradeNotificationData.factory");
5
5
  require("./courseHomeMeta.factory");
6
6
  require("./coursewareMeta.factory");
7
7
  require("./outline.factory");
8
+ require("./extraOffer.factory");
8
9
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["require"],"sources":["../../../src/data/__factories__/index.js"],"sourcesContent":["import './defaultUpgradeNotificationData.factory';\nimport './experimentalUpgradeNotificationData.factory';\nimport './courseHomeMeta.factory';\nimport './coursewareMeta.factory';\nimport './outline.factory';\n"],"mappings":";;AAAAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["require"],"sources":["../../../src/data/__factories__/index.js"],"sourcesContent":["import './defaultUpgradeNotificationData.factory';\nimport './experimentalUpgradeNotificationData.factory';\nimport './courseHomeMeta.factory';\nimport './coursewareMeta.factory';\nimport './outline.factory';\nimport './extraOffer.factory';\n"],"mappings":";;AAAAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA","ignoreList":[]}
@@ -3,8 +3,10 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ exports.SubscriptionUpgradeError = void 0;
6
7
  exports.fetchOrg = fetchOrg;
7
8
  exports.fetchVerifiedName = fetchVerifiedName;
9
+ exports.upgradeEnrollmentWithSubscription = upgradeEnrollmentWithSubscription;
8
10
  var _frontendPlatform = require("@edx/frontend-platform");
9
11
  var _auth = require("@edx/frontend-platform/auth");
10
12
  async function fetchOrg(org) {
@@ -33,4 +35,42 @@ async function fetchVerifiedName() {
33
35
  }
34
36
  return (0, _frontendPlatform.camelCaseObject)(data);
35
37
  }
38
+ class SubscriptionUpgradeError extends Error {
39
+ constructor(message) {
40
+ let {
41
+ code,
42
+ status
43
+ } = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
44
+ super(message);
45
+ this.name = 'SubscriptionUpgradeError';
46
+ this.code = code;
47
+ this.status = status;
48
+ }
49
+ }
50
+
51
+ /**
52
+ * Upgrade a subscriber's enrollment in place. Resolves with the LMS response, e.g. { success, status: 'PENDING' }.
53
+ * Unlike the fetches above, errors are not swallowed: rejects with SubscriptionUpgradeError (code, status).
54
+ */
55
+ exports.SubscriptionUpgradeError = SubscriptionUpgradeError;
56
+ async function upgradeEnrollmentWithSubscription(courseRunKey) {
57
+ const url = `${(0, _frontendPlatform.getConfig)().LMS_BASE_URL}/api/subscription/enrollment/upgrade/`;
58
+ try {
59
+ const {
60
+ data
61
+ } = await (0, _auth.getAuthenticatedHttpClient)().post(url, {
62
+ courseRunKey
63
+ });
64
+ return (0, _frontendPlatform.camelCaseObject)(data);
65
+ } catch (error) {
66
+ const {
67
+ status,
68
+ data
69
+ } = error.response || {};
70
+ throw new SubscriptionUpgradeError(data?.error || error.message, {
71
+ code: data?.code,
72
+ status
73
+ });
74
+ }
75
+ }
36
76
  //# sourceMappingURL=lms_api.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"lms_api.js","names":["_frontendPlatform","require","_auth","fetchOrg","org","LmsApiUrl","getConfig","LMS_BASE_URL","orgUrl","URL","data","getAuthenticatedHttpClient","get","href","error","camelCaseObject","fetchVerifiedName","verifiedNameUrl"],"sources":["../../src/data/lms_api.js"],"sourcesContent":["import { getConfig, camelCaseObject } from '@edx/frontend-platform';\nimport { getAuthenticatedHttpClient } from '@edx/frontend-platform/auth';\n\nexport async function fetchOrg(org) {\n const LmsApiUrl = getConfig().LMS_BASE_URL;\n const orgUrl = new URL(`${LmsApiUrl}/api/organizations/v0/organizations/${org}/`);\n\n let data;\n try {\n ({ data } = await getAuthenticatedHttpClient().get(orgUrl.href));\n } catch (error) {\n data = null;\n }\n return camelCaseObject(data);\n}\n\nexport async function fetchVerifiedName() {\n const LmsApiUrl = getConfig().LMS_BASE_URL;\n const verifiedNameUrl = new URL(`${LmsApiUrl}/api/edx_name_affirmation/v1/verified_name`);\n let data;\n try {\n ({ data } = await getAuthenticatedHttpClient().get(verifiedNameUrl.href));\n } catch (error) {\n data = null;\n }\n return camelCaseObject(data);\n}\n"],"mappings":";;;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AAEO,eAAeE,QAAQA,CAACC,GAAG,EAAE;EAClC,MAAMC,SAAS,GAAG,IAAAC,2BAAS,EAAC,CAAC,CAACC,YAAY;EAC1C,MAAMC,MAAM,GAAG,IAAIC,GAAG,CAAC,GAAGJ,SAAS,uCAAuCD,GAAG,GAAG,CAAC;EAEjF,IAAIM,IAAI;EACR,IAAI;IACF,CAAC;MAAEA;IAAK,CAAC,GAAG,MAAM,IAAAC,gCAA0B,EAAC,CAAC,CAACC,GAAG,CAACJ,MAAM,CAACK,IAAI,CAAC;EACjE,CAAC,CAAC,OAAOC,KAAK,EAAE;IACdJ,IAAI,GAAG,IAAI;EACb;EACA,OAAO,IAAAK,iCAAe,EAACL,IAAI,CAAC;AAC9B;AAEO,eAAeM,iBAAiBA,CAAA,EAAG;EACxC,MAAMX,SAAS,GAAG,IAAAC,2BAAS,EAAC,CAAC,CAACC,YAAY;EAC1C,MAAMU,eAAe,GAAG,IAAIR,GAAG,CAAC,GAAGJ,SAAS,4CAA4C,CAAC;EACzF,IAAIK,IAAI;EACR,IAAI;IACF,CAAC;MAAEA;IAAK,CAAC,GAAG,MAAM,IAAAC,gCAA0B,EAAC,CAAC,CAACC,GAAG,CAACK,eAAe,CAACJ,IAAI,CAAC;EAC1E,CAAC,CAAC,OAAOC,KAAK,EAAE;IACdJ,IAAI,GAAG,IAAI;EACb;EACA,OAAO,IAAAK,iCAAe,EAACL,IAAI,CAAC;AAC9B","ignoreList":[]}
1
+ {"version":3,"file":"lms_api.js","names":["_frontendPlatform","require","_auth","fetchOrg","org","LmsApiUrl","getConfig","LMS_BASE_URL","orgUrl","URL","data","getAuthenticatedHttpClient","get","href","error","camelCaseObject","fetchVerifiedName","verifiedNameUrl","SubscriptionUpgradeError","Error","constructor","message","code","status","arguments","length","undefined","name","exports","upgradeEnrollmentWithSubscription","courseRunKey","url","post","response"],"sources":["../../src/data/lms_api.js"],"sourcesContent":["import { getConfig, camelCaseObject } from '@edx/frontend-platform';\nimport { getAuthenticatedHttpClient } from '@edx/frontend-platform/auth';\n\nexport async function fetchOrg(org) {\n const LmsApiUrl = getConfig().LMS_BASE_URL;\n const orgUrl = new URL(`${LmsApiUrl}/api/organizations/v0/organizations/${org}/`);\n\n let data;\n try {\n ({ data } = await getAuthenticatedHttpClient().get(orgUrl.href));\n } catch (error) {\n data = null;\n }\n return camelCaseObject(data);\n}\n\nexport async function fetchVerifiedName() {\n const LmsApiUrl = getConfig().LMS_BASE_URL;\n const verifiedNameUrl = new URL(`${LmsApiUrl}/api/edx_name_affirmation/v1/verified_name`);\n let data;\n try {\n ({ data } = await getAuthenticatedHttpClient().get(verifiedNameUrl.href));\n } catch (error) {\n data = null;\n }\n return camelCaseObject(data);\n}\n\nexport class SubscriptionUpgradeError extends Error {\n constructor(message, { code, status } = {}) {\n super(message);\n this.name = 'SubscriptionUpgradeError';\n this.code = code;\n this.status = status;\n }\n}\n\n/**\n * Upgrade a subscriber's enrollment in place. Resolves with the LMS response, e.g. { success, status: 'PENDING' }.\n * Unlike the fetches above, errors are not swallowed: rejects with SubscriptionUpgradeError (code, status).\n */\nexport async function upgradeEnrollmentWithSubscription(courseRunKey) {\n const url = `${getConfig().LMS_BASE_URL}/api/subscription/enrollment/upgrade/`;\n try {\n const { data } = await getAuthenticatedHttpClient().post(url, { courseRunKey });\n return camelCaseObject(data);\n } catch (error) {\n const { status, data } = error.response || {};\n throw new SubscriptionUpgradeError(data?.error || error.message, { code: data?.code, status });\n }\n}\n"],"mappings":";;;;;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AAEO,eAAeE,QAAQA,CAACC,GAAG,EAAE;EAClC,MAAMC,SAAS,GAAG,IAAAC,2BAAS,EAAC,CAAC,CAACC,YAAY;EAC1C,MAAMC,MAAM,GAAG,IAAIC,GAAG,CAAC,GAAGJ,SAAS,uCAAuCD,GAAG,GAAG,CAAC;EAEjF,IAAIM,IAAI;EACR,IAAI;IACF,CAAC;MAAEA;IAAK,CAAC,GAAG,MAAM,IAAAC,gCAA0B,EAAC,CAAC,CAACC,GAAG,CAACJ,MAAM,CAACK,IAAI,CAAC;EACjE,CAAC,CAAC,OAAOC,KAAK,EAAE;IACdJ,IAAI,GAAG,IAAI;EACb;EACA,OAAO,IAAAK,iCAAe,EAACL,IAAI,CAAC;AAC9B;AAEO,eAAeM,iBAAiBA,CAAA,EAAG;EACxC,MAAMX,SAAS,GAAG,IAAAC,2BAAS,EAAC,CAAC,CAACC,YAAY;EAC1C,MAAMU,eAAe,GAAG,IAAIR,GAAG,CAAC,GAAGJ,SAAS,4CAA4C,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,EAAEY,IAAI;MAAEC;IAAO,CAAC,CAAC;EAChG;AACF","ignoreList":[]}
package/dist/index.js CHANGED
@@ -39,6 +39,30 @@ Object.defineProperty(exports, "SectionList", {
39
39
  return _sectionOutline.default;
40
40
  }
41
41
  });
42
+ Object.defineProperty(exports, "SubscriptionBenefitsModal", {
43
+ enumerable: true,
44
+ get: function () {
45
+ return _subscriptionUpsell.SubscriptionBenefitsModal;
46
+ }
47
+ });
48
+ Object.defineProperty(exports, "SubscriptionComparisonModal", {
49
+ enumerable: true,
50
+ get: function () {
51
+ return _subscriptionUpsell.SubscriptionComparisonModal;
52
+ }
53
+ });
54
+ Object.defineProperty(exports, "SubscriptionUpgradeCard", {
55
+ enumerable: true,
56
+ get: function () {
57
+ return _subscriptionUpsell.SubscriptionUpgradeCard;
58
+ }
59
+ });
60
+ Object.defineProperty(exports, "SubscriptionUpsell", {
61
+ enumerable: true,
62
+ get: function () {
63
+ return _subscriptionUpsell.SubscriptionUpsell;
64
+ }
65
+ });
42
66
  Object.defineProperty(exports, "UclWrapper", {
43
67
  enumerable: true,
44
68
  get: function () {
@@ -63,6 +87,12 @@ Object.defineProperty(exports, "UpsellBullets", {
63
87
  return _generic.UpsellBullets;
64
88
  }
65
89
  });
90
+ Object.defineProperty(exports, "useSubscriptionOffer", {
91
+ enumerable: true,
92
+ get: function () {
93
+ return _subscriptionUpsell.useSubscriptionOffer;
94
+ }
95
+ });
66
96
  var _upgradeNotification = _interopRequireDefault(require("./upgrade-notification"));
67
97
  var _paywall = _interopRequireDefault(require("./paywall"));
68
98
  var _upgradeModal = _interopRequireDefault(require("./upgrade-modal"));
@@ -73,6 +103,7 @@ var _generic = require("./generic");
73
103
  var _sectionOutline = _interopRequireDefault(require("./section-outline"));
74
104
  var _dynamicExperienceSlot = _interopRequireDefault(require("./dynamic-experience-slot"));
75
105
  var _uclWrapper = _interopRequireDefault(require("./ucl-wrapper"));
106
+ var _subscriptionUpsell = require("./subscription-upsell");
76
107
  require("./index.scss");
77
108
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
78
109
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_upgradeNotification","_interopRequireDefault","require","_paywall","_upgradeModal","_accessExpirationAlert","_upgradeToCompleteAlert","_courseExitUpsell","_generic","_sectionOutline","_dynamicExperienceSlot","_uclWrapper","e","__esModule","default"],"sources":["../src/index.jsx"],"sourcesContent":["import UpgradeNotification from './upgrade-notification';\nimport LockPaywall from './paywall';\nimport NextUnitButton from './upgrade-modal';\nimport AccessExpirationAlert from './access-expiration-alert';\nimport UpgradeToCompleteAlert from './upgrade-to-complete-alert';\nimport CourseExitUpsell from './course-exit-upsell';\nimport { UpsellBullets } from './generic';\nimport SectionList from './section-outline';\nimport DynamicExperienceSlot from './dynamic-experience-slot';\nimport UclWrapper from './ucl-wrapper';\nimport './index.scss';\n\nexport {\n UpgradeNotification,\n LockPaywall,\n NextUnitButton,\n AccessExpirationAlert,\n UpgradeToCompleteAlert,\n CourseExitUpsell,\n UpsellBullets,\n SectionList,\n DynamicExperienceSlot,\n UclWrapper,\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,oBAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,QAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,aAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,sBAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,uBAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,iBAAA,GAAAN,sBAAA,CAAAC,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AACA,IAAAO,eAAA,GAAAR,sBAAA,CAAAC,OAAA;AACA,IAAAQ,sBAAA,GAAAT,sBAAA,CAAAC,OAAA;AACA,IAAAS,WAAA,GAAAV,sBAAA,CAAAC,OAAA;AACAA,OAAA;AAAsB,SAAAD,uBAAAW,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["_upgradeNotification","_interopRequireDefault","require","_paywall","_upgradeModal","_accessExpirationAlert","_upgradeToCompleteAlert","_courseExitUpsell","_generic","_sectionOutline","_dynamicExperienceSlot","_uclWrapper","_subscriptionUpsell","e","__esModule","default"],"sources":["../src/index.jsx"],"sourcesContent":["import UpgradeNotification from './upgrade-notification';\nimport LockPaywall from './paywall';\nimport NextUnitButton from './upgrade-modal';\nimport AccessExpirationAlert from './access-expiration-alert';\nimport UpgradeToCompleteAlert from './upgrade-to-complete-alert';\nimport CourseExitUpsell from './course-exit-upsell';\nimport { UpsellBullets } from './generic';\nimport SectionList from './section-outline';\nimport DynamicExperienceSlot from './dynamic-experience-slot';\nimport UclWrapper from './ucl-wrapper';\nimport {\n useSubscriptionOffer,\n SubscriptionUpsell,\n SubscriptionUpgradeCard,\n SubscriptionBenefitsModal,\n SubscriptionComparisonModal,\n} from './subscription-upsell';\nimport './index.scss';\n\nexport {\n UpgradeNotification,\n LockPaywall,\n NextUnitButton,\n AccessExpirationAlert,\n UpgradeToCompleteAlert,\n CourseExitUpsell,\n UpsellBullets,\n SectionList,\n DynamicExperienceSlot,\n UclWrapper,\n useSubscriptionOffer,\n SubscriptionUpsell,\n SubscriptionUpgradeCard,\n SubscriptionBenefitsModal,\n SubscriptionComparisonModal,\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,oBAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,QAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,aAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,sBAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,uBAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,iBAAA,GAAAN,sBAAA,CAAAC,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AACA,IAAAO,eAAA,GAAAR,sBAAA,CAAAC,OAAA;AACA,IAAAQ,sBAAA,GAAAT,sBAAA,CAAAC,OAAA;AACA,IAAAS,WAAA,GAAAV,sBAAA,CAAAC,OAAA;AACA,IAAAU,mBAAA,GAAAV,OAAA;AAOAA,OAAA;AAAsB,SAAAD,uBAAAY,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA","ignoreList":[]}
@@ -0,0 +1,145 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = exports.BENEFITS_MODAL_VARIANT = void 0;
7
+ var _react = _interopRequireDefault(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 _icons = require("@openedx/paragon/icons");
12
+ var _useSubscriptionOffer = _interopRequireDefault(require("./useSubscriptionOffer"));
13
+ var _messages = _interopRequireDefault(require("./messages"));
14
+ var _jsxRuntime = require("react/jsx-runtime");
15
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
16
+ /* eslint import/no-unresolved: 0 */
17
+
18
+ const BENEFITS_MODAL_VARIANT = exports.BENEFITS_MODAL_VARIANT = {
19
+ FREE_TRIAL: 'freeTrial',
20
+ LAUNCH: 'launch'
21
+ };
22
+
23
+ /** The benefits pop-up (Figma 3339-7937 free trial, 3482-70647 launch). Nothing opens it yet. */
24
+ const SubscriptionBenefitsModal = _ref => {
25
+ let {
26
+ courseId,
27
+ isOpen,
28
+ onClose,
29
+ variant,
30
+ onSubscribeClick,
31
+ onPurchaseClick
32
+ } = _ref;
33
+ const {
34
+ formatMessage
35
+ } = (0, _i18n.useIntl)();
36
+ const offer = (0, _useSubscriptionOffer.default)(courseId);
37
+ if (!offer || !offer.canSubscribe) {
38
+ return null;
39
+ }
40
+ const {
41
+ hasTrial,
42
+ purchaseUrl,
43
+ canPurchase,
44
+ coursePrice
45
+ } = offer;
46
+ const isFreeTrial = variant === BENEFITS_MODAL_VARIANT.FREE_TRIAL && hasTrial;
47
+ const title = formatMessage(isFreeTrial ? _messages.default.modalTitleFreeTrial : _messages.default.modalTitleLaunch);
48
+ const ctaVariant = isFreeTrial ? 'primary' : 'brand'; // Figma: dark on free trial, brand on launch
49
+
50
+ const benefits = [{
51
+ key: 'certificates',
52
+ title: formatMessage(_messages.default.benefitCertificatesTitle),
53
+ body: formatMessage(_messages.default.benefitCertificatesBody)
54
+ }, {
55
+ key: 'change-course',
56
+ title: formatMessage(_messages.default.benefitChangeCourseTitle),
57
+ body: formatMessage(_messages.default.benefitChangeCourseBody)
58
+ }, hasTrial && {
59
+ key: 'trial',
60
+ title: formatMessage(_messages.default.benefitTrialTitle),
61
+ body: formatMessage(_messages.default.benefitTrialBody)
62
+ }].filter(Boolean);
63
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_paragon.ModalDialog, {
64
+ title: title,
65
+ isOpen: isOpen,
66
+ onClose: onClose,
67
+ size: "lg",
68
+ hasCloseButton: true,
69
+ isFullscreenOnMobile: true,
70
+ isOverflowVisible: false,
71
+ className: "subscription-benefits-modal",
72
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_paragon.ModalDialog.Header, {
73
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
74
+ className: "font-weight-bold mb-2",
75
+ "data-testid": "subscription-modal-brand",
76
+ children: formatMessage(_messages.default.brand)
77
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_paragon.ModalDialog.Title, {
78
+ as: "h2",
79
+ children: title
80
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
81
+ className: "mt-2 mb-0",
82
+ children: formatMessage(_messages.default.modalSubtitle)
83
+ })]
84
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_paragon.ModalDialog.Body, {
85
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)("ul", {
86
+ className: "list-unstyled bg-white rounded p-4 mb-0",
87
+ children: benefits.map(benefit => /*#__PURE__*/(0, _jsxRuntime.jsxs)("li", {
88
+ className: "d-flex mb-3",
89
+ "data-testid": `subscription-modal-benefit-${benefit.key}`,
90
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_paragon.Icon, {
91
+ src: _icons.CheckCircleOutline,
92
+ className: "mr-2 flex-shrink-0"
93
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
94
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
95
+ className: "font-weight-bold",
96
+ children: benefit.title
97
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
98
+ children: benefit.body
99
+ })]
100
+ })]
101
+ }, benefit.key))
102
+ })
103
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_paragon.ModalDialog.Footer, {
104
+ className: "flex-column align-items-end",
105
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_paragon.ActionRow, {
106
+ children: [canPurchase && /*#__PURE__*/(0, _jsxRuntime.jsx)(_paragon.Button, {
107
+ as: "a",
108
+ href: purchaseUrl,
109
+ variant: `outline-${ctaVariant}`,
110
+ onClick: onPurchaseClick,
111
+ "data-testid": "subscription-modal-purchase-button",
112
+ children: coursePrice ? formatMessage(_messages.default.earnCertificateFor, {
113
+ price: coursePrice
114
+ }) : formatMessage(_messages.default.purchaseNoPrice)
115
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_paragon.Button, {
116
+ as: "a",
117
+ href: offer.subscribeUrl,
118
+ variant: ctaVariant,
119
+ onClick: onSubscribeClick,
120
+ "data-testid": "subscription-modal-subscribe-button",
121
+ children: formatMessage(_messages.default.continueToCheckout)
122
+ })]
123
+ }), isFreeTrial && /*#__PURE__*/(0, _jsxRuntime.jsx)("small", {
124
+ className: "mt-1",
125
+ "data-testid": "subscription-modal-cancel-anytime",
126
+ children: formatMessage(_messages.default.cancelAnytime)
127
+ })]
128
+ })]
129
+ });
130
+ };
131
+ SubscriptionBenefitsModal.propTypes = {
132
+ courseId: _propTypes.default.string.isRequired,
133
+ isOpen: _propTypes.default.bool.isRequired,
134
+ onClose: _propTypes.default.func.isRequired,
135
+ variant: _propTypes.default.oneOf(Object.values(BENEFITS_MODAL_VARIANT)),
136
+ onSubscribeClick: _propTypes.default.func,
137
+ onPurchaseClick: _propTypes.default.func
138
+ };
139
+ SubscriptionBenefitsModal.defaultProps = {
140
+ variant: BENEFITS_MODAL_VARIANT.LAUNCH,
141
+ onSubscribeClick: undefined,
142
+ onPurchaseClick: undefined
143
+ };
144
+ var _default = exports.default = SubscriptionBenefitsModal;
145
+ //# sourceMappingURL=SubscriptionBenefitsModal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SubscriptionBenefitsModal.js","names":["_react","_interopRequireDefault","require","_propTypes","_i18n","_paragon","_icons","_useSubscriptionOffer","_messages","_jsxRuntime","e","__esModule","default","BENEFITS_MODAL_VARIANT","exports","FREE_TRIAL","LAUNCH","SubscriptionBenefitsModal","_ref","courseId","isOpen","onClose","variant","onSubscribeClick","onPurchaseClick","formatMessage","useIntl","offer","useSubscriptionOffer","canSubscribe","hasTrial","purchaseUrl","canPurchase","coursePrice","isFreeTrial","title","messages","modalTitleFreeTrial","modalTitleLaunch","ctaVariant","benefits","key","benefitCertificatesTitle","body","benefitCertificatesBody","benefitChangeCourseTitle","benefitChangeCourseBody","benefitTrialTitle","benefitTrialBody","filter","Boolean","jsxs","ModalDialog","size","hasCloseButton","isFullscreenOnMobile","isOverflowVisible","className","children","Header","jsx","brand","Title","as","modalSubtitle","Body","map","benefit","Icon","src","CheckCircleOutline","Footer","ActionRow","Button","href","onClick","earnCertificateFor","price","purchaseNoPrice","subscribeUrl","continueToCheckout","cancelAnytime","propTypes","PropTypes","string","isRequired","bool","func","oneOf","Object","values","defaultProps","undefined","_default"],"sources":["../../src/subscription-upsell/SubscriptionBenefitsModal.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 ActionRow, Button, Icon, ModalDialog,\n} from '@openedx/paragon';\nimport { CheckCircleOutline } from '@openedx/paragon/icons';\n\nimport useSubscriptionOffer from './useSubscriptionOffer';\nimport messages from './messages';\n\nexport const BENEFITS_MODAL_VARIANT = {\n FREE_TRIAL: 'freeTrial',\n LAUNCH: 'launch',\n};\n\n/** The benefits pop-up (Figma 3339-7937 free trial, 3482-70647 launch). Nothing opens it yet. */\nconst SubscriptionBenefitsModal = ({\n courseId,\n isOpen,\n onClose,\n variant,\n onSubscribeClick,\n onPurchaseClick,\n}) => {\n const { formatMessage } = useIntl();\n const offer = useSubscriptionOffer(courseId);\n\n if (!offer || !offer.canSubscribe) {\n return null;\n }\n\n const {\n hasTrial, purchaseUrl, canPurchase, coursePrice,\n } = offer;\n const isFreeTrial = variant === BENEFITS_MODAL_VARIANT.FREE_TRIAL && hasTrial;\n const title = formatMessage(isFreeTrial ? messages.modalTitleFreeTrial : messages.modalTitleLaunch);\n const ctaVariant = isFreeTrial ? 'primary' : 'brand'; // Figma: dark on free trial, brand on launch\n\n const benefits = [\n {\n key: 'certificates',\n title: formatMessage(messages.benefitCertificatesTitle),\n body: formatMessage(messages.benefitCertificatesBody),\n },\n {\n key: 'change-course',\n title: formatMessage(messages.benefitChangeCourseTitle),\n body: formatMessage(messages.benefitChangeCourseBody),\n },\n hasTrial && {\n key: 'trial',\n title: formatMessage(messages.benefitTrialTitle),\n body: formatMessage(messages.benefitTrialBody),\n },\n ].filter(Boolean);\n\n return (\n <ModalDialog\n title={title}\n isOpen={isOpen}\n onClose={onClose}\n size=\"lg\"\n hasCloseButton\n isFullscreenOnMobile\n isOverflowVisible={false}\n className=\"subscription-benefits-modal\"\n >\n <ModalDialog.Header>\n <p className=\"font-weight-bold mb-2\" data-testid=\"subscription-modal-brand\">{formatMessage(messages.brand)}</p>\n <ModalDialog.Title as=\"h2\">{title}</ModalDialog.Title>\n <p className=\"mt-2 mb-0\">{formatMessage(messages.modalSubtitle)}</p>\n </ModalDialog.Header>\n <ModalDialog.Body>\n <ul className=\"list-unstyled bg-white rounded p-4 mb-0\">\n {benefits.map((benefit) => (\n <li key={benefit.key} className=\"d-flex mb-3\" data-testid={`subscription-modal-benefit-${benefit.key}`}>\n <Icon src={CheckCircleOutline} className=\"mr-2 flex-shrink-0\" />\n <div>\n <div className=\"font-weight-bold\">{benefit.title}</div>\n <div>{benefit.body}</div>\n </div>\n </li>\n ))}\n </ul>\n </ModalDialog.Body>\n <ModalDialog.Footer className=\"flex-column align-items-end\">\n <ActionRow>\n {canPurchase && (\n <Button\n as=\"a\"\n href={purchaseUrl}\n variant={`outline-${ctaVariant}`}\n onClick={onPurchaseClick}\n data-testid=\"subscription-modal-purchase-button\"\n >\n {coursePrice\n ? formatMessage(messages.earnCertificateFor, { price: coursePrice })\n : formatMessage(messages.purchaseNoPrice)}\n </Button>\n )}\n <Button\n as=\"a\"\n href={offer.subscribeUrl}\n variant={ctaVariant}\n onClick={onSubscribeClick}\n data-testid=\"subscription-modal-subscribe-button\"\n >\n {formatMessage(messages.continueToCheckout)}\n </Button>\n </ActionRow>\n {isFreeTrial && (\n <small className=\"mt-1\" data-testid=\"subscription-modal-cancel-anytime\">{formatMessage(messages.cancelAnytime)}</small>\n )}\n </ModalDialog.Footer>\n </ModalDialog>\n );\n};\n\nSubscriptionBenefitsModal.propTypes = {\n courseId: PropTypes.string.isRequired,\n isOpen: PropTypes.bool.isRequired,\n onClose: PropTypes.func.isRequired,\n variant: PropTypes.oneOf(Object.values(BENEFITS_MODAL_VARIANT)),\n onSubscribeClick: PropTypes.func,\n onPurchaseClick: PropTypes.func,\n};\n\nSubscriptionBenefitsModal.defaultProps = {\n variant: BENEFITS_MODAL_VARIANT.LAUNCH,\n onSubscribeClick: undefined,\n onPurchaseClick: undefined,\n};\n\nexport default SubscriptionBenefitsModal;\n"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AAGA,IAAAI,MAAA,GAAAJ,OAAA;AAEA,IAAAK,qBAAA,GAAAN,sBAAA,CAAAC,OAAA;AACA,IAAAM,SAAA,GAAAP,sBAAA,CAAAC,OAAA;AAAkC,IAAAO,WAAA,GAAAP,OAAA;AAAA,SAAAD,uBAAAS,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAVlC;;AAYO,MAAMG,sBAAsB,GAAAC,OAAA,CAAAD,sBAAA,GAAG;EACpCE,UAAU,EAAE,WAAW;EACvBC,MAAM,EAAE;AACV,CAAC;;AAED;AACA,MAAMC,yBAAyB,GAAGC,IAAA,IAO5B;EAAA,IAP6B;IACjCC,QAAQ;IACRC,MAAM;IACNC,OAAO;IACPC,OAAO;IACPC,gBAAgB;IAChBC;EACF,CAAC,GAAAN,IAAA;EACC,MAAM;IAAEO;EAAc,CAAC,GAAG,IAAAC,aAAO,EAAC,CAAC;EACnC,MAAMC,KAAK,GAAG,IAAAC,6BAAoB,EAACT,QAAQ,CAAC;EAE5C,IAAI,CAACQ,KAAK,IAAI,CAACA,KAAK,CAACE,YAAY,EAAE;IACjC,OAAO,IAAI;EACb;EAEA,MAAM;IACJC,QAAQ;IAAEC,WAAW;IAAEC,WAAW;IAAEC;EACtC,CAAC,GAAGN,KAAK;EACT,MAAMO,WAAW,GAAGZ,OAAO,KAAKT,sBAA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kBAAS,CAACK,KAAK,CAACC,MAAM,CAACC,MAAM,CAAC7E,sBAAsB,CAAC,CAAC;EAC/DU,gBAAgB,EAAE4D,kBAAS,CAACI,IAAI;EAChC/D,eAAe,EAAE2D,kBAAS,CAACI;AAC7B,CAAC;AAEDtE,yBAAyB,CAAC0E,YAAY,GAAG;EACvCrE,OAAO,EAAET,sBAAsB,CAACG,MAAM;EACtCO,gBAAgB,EAAEqE,SAAS;EAC3BpE,eAAe,EAAEoE;AACnB,CAAC;AAAC,IAAAC,QAAA,GAAA/E,OAAA,CAAAF,OAAA,GAEaK,yBAAyB","ignoreList":[]}
@@ -0,0 +1,248 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _react = _interopRequireWildcard(require("react"));
8
+ var _propTypes = _interopRequireDefault(require("prop-types"));
9
+ var _classnames = _interopRequireDefault(require("classnames"));
10
+ var _i18n = require("@edx/frontend-platform/i18n");
11
+ var _paragon = require("@openedx/paragon");
12
+ var _icons = require("@openedx/paragon/icons");
13
+ var _useSubscriptionOffer = _interopRequireDefault(require("./useSubscriptionOffer"));
14
+ var _messages = _interopRequireDefault(require("./messages"));
15
+ require("./SubscriptionComparisonModal.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
+ /* eslint import/no-unresolved: 0 */
20
+
21
+ const SUBSCRIBE = 'subscribe';
22
+ const BUY = 'buy';
23
+
24
+ /** Subscribe vs Buy course pop-up (Figma 3339-8172); one column at a time on small screens. */
25
+ const SubscriptionComparisonModal = _ref => {
26
+ let {
27
+ courseId,
28
+ isOpen,
29
+ onClose,
30
+ onSubscribeClick,
31
+ onPurchaseClick
32
+ } = _ref;
33
+ const {
34
+ formatMessage
35
+ } = (0, _i18n.useIntl)();
36
+ const offer = (0, _useSubscriptionOffer.default)(courseId);
37
+ const isSmallScreen = (0, _paragon.useWindowSize)().width < _paragon.breakpoints.medium.minWidth;
38
+ const [activePlan, setActivePlan] = (0, _react.useState)(SUBSCRIBE);
39
+ if (!offer || !offer.canSubscribe) {
40
+ return null;
41
+ }
42
+ const {
43
+ hasTrial,
44
+ purchaseUrl,
45
+ canPurchase,
46
+ coursePrice,
47
+ subscribePrice
48
+ } = offer;
49
+ const included = /*#__PURE__*/(0, _jsxRuntime.jsx)(_paragon.Icon, {
50
+ src: _icons.CheckCircle,
51
+ screenReaderText: formatMessage(_messages.default.includedAlt)
52
+ });
53
+ const notIncluded = /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
54
+ className: "sr-only",
55
+ children: formatMessage(_messages.default.notIncludedAlt)
56
+ });
57
+ const cell = value => {
58
+ if (value === true) {
59
+ return included;
60
+ }
61
+ if (value === false) {
62
+ return notIncluded;
63
+ }
64
+ return value || null;
65
+ };
66
+ const subscribePriceCell = subscribePrice && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
67
+ className: "font-weight-bold",
68
+ children: subscribePrice
69
+ });
70
+ const buyPriceCell = coursePrice && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
71
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
72
+ className: "font-weight-bold",
73
+ children: coursePrice
74
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("small", {
75
+ children: formatMessage(_messages.default.oneTimePurchase)
76
+ })]
77
+ });
78
+ const rows = [{
79
+ key: 'price',
80
+ label: formatMessage(_messages.default.rowPrice),
81
+ [SUBSCRIBE]: subscribePriceCell,
82
+ [BUY]: buyPriceCell
83
+ }, {
84
+ key: 'unlimited-access',
85
+ label: formatMessage(_messages.default.featureUnlimitedAccess),
86
+ [SUBSCRIBE]: true,
87
+ [BUY]: true
88
+ }, {
89
+ key: 'certificates',
90
+ label: formatMessage(_messages.default.rowEarnCertificates),
91
+ [SUBSCRIBE]: formatMessage(_messages.default.certificatesUnlimited),
92
+ [BUY]: formatMessage(_messages.default.certificatesOne)
93
+ }, {
94
+ key: 'graded-assignments',
95
+ label: formatMessage(_messages.default.featureGradedAssignments),
96
+ [SUBSCRIBE]: true,
97
+ [BUY]: true
98
+ }, {
99
+ key: 'change-courses',
100
+ label: formatMessage(_messages.default.featureChangeCourses),
101
+ [SUBSCRIBE]: true,
102
+ [BUY]: false
103
+ }, {
104
+ key: 'cancel-anytime',
105
+ label: formatMessage(_messages.default.cancelAnytime),
106
+ [SUBSCRIBE]: true,
107
+ [BUY]: false
108
+ }, hasTrial && {
109
+ key: 'free-trial',
110
+ label: formatMessage(_messages.default.featureFreeTrial),
111
+ [SUBSCRIBE]: true,
112
+ [BUY]: false
113
+ }].filter(Boolean);
114
+ const plans = [{
115
+ key: SUBSCRIBE,
116
+ name: formatMessage(_messages.default.subscribeColumn),
117
+ className: 'plan-subscribe'
118
+ }, canPurchase && {
119
+ key: BUY,
120
+ name: formatMessage(_messages.default.buyCourseColumn),
121
+ className: 'plan-buy'
122
+ }].filter(Boolean);
123
+ // The selected plan can vanish, e.g. Buy was selected and the course lost its purchase link.
124
+ const activeKey = plans.some(plan => plan.key === activePlan) ? activePlan : plans[0].key;
125
+ const visiblePlans = isSmallScreen ? plans.filter(plan => plan.key === activeKey) : plans;
126
+ const activeIndex = plans.findIndex(plan => plan.key === activeKey);
127
+ const showPlanAt = index => setActivePlan(plans[(index + plans.length) % plans.length].key);
128
+ const title = formatMessage(_messages.default.comparisonTitle);
129
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_paragon.ModalDialog, {
130
+ title: title,
131
+ isOpen: isOpen,
132
+ onClose: onClose,
133
+ size: "lg",
134
+ hasCloseButton: true,
135
+ isFullscreenOnMobile: true,
136
+ isOverflowVisible: false,
137
+ className: "subscription-comparison-modal",
138
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_paragon.ModalDialog.Header, {
139
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_paragon.ModalDialog.Title, {
140
+ as: "h2",
141
+ children: title
142
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
143
+ className: "mt-2 mb-0",
144
+ children: formatMessage(_messages.default.comparisonSubtitle)
145
+ })]
146
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_paragon.ModalDialog.Body, {
147
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("table", {
148
+ className: "w-100 text-center subscription-comparison-table",
149
+ "data-testid": "subscription-comparison-table",
150
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("thead", {
151
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("tr", {
152
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("th", {
153
+ scope: "col",
154
+ className: "feature-header",
155
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
156
+ className: "sr-only",
157
+ children: formatMessage(_messages.default.featureColumn)
158
+ })
159
+ }), visiblePlans.map(plan => /*#__PURE__*/(0, _jsxRuntime.jsx)("th", {
160
+ scope: "col",
161
+ className: plan.className,
162
+ "data-testid": `subscription-comparison-header-${plan.key}`,
163
+ children: plan.name
164
+ }, plan.key))]
165
+ })
166
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("tbody", {
167
+ children: rows.map(row => /*#__PURE__*/(0, _jsxRuntime.jsxs)("tr", {
168
+ "data-testid": `subscription-comparison-row-${row.key}`,
169
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("th", {
170
+ scope: "row",
171
+ className: "feature-cell",
172
+ children: row.label
173
+ }), visiblePlans.map(plan => /*#__PURE__*/(0, _jsxRuntime.jsx)("td", {
174
+ className: plan.className,
175
+ "data-testid": `subscription-comparison-cell-${row.key}-${plan.key}`,
176
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
177
+ className: "center-items flex-column",
178
+ children: cell(row[plan.key])
179
+ })
180
+ }, plan.key))]
181
+ }, row.key))
182
+ })]
183
+ }), isSmallScreen && plans.length > 1 && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
184
+ className: "d-flex align-items-center justify-content-center mt-3",
185
+ "data-testid": "subscription-comparison-controls",
186
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_paragon.IconButton, {
187
+ src: _icons.ChevronLeft,
188
+ iconAs: _paragon.Icon,
189
+ alt: formatMessage(_messages.default.previousPlan),
190
+ onClick: () => showPlanAt(activeIndex - 1)
191
+ }), plans.map(plan => /*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
192
+ type: "button",
193
+ className: (0, _classnames.default)('btn btn-link p-1', {
194
+ 'font-weight-bold': plan.key === activeKey
195
+ }),
196
+ "aria-pressed": plan.key === activeKey,
197
+ "aria-label": formatMessage(_messages.default.showPlan, {
198
+ plan: plan.name
199
+ }),
200
+ onClick: () => setActivePlan(plan.key),
201
+ children: plan.key === activeKey ? '●' : '○'
202
+ }, plan.key)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_paragon.IconButton, {
203
+ src: _icons.ChevronRight,
204
+ iconAs: _paragon.Icon,
205
+ alt: formatMessage(_messages.default.nextPlan),
206
+ onClick: () => showPlanAt(activeIndex + 1)
207
+ })]
208
+ })]
209
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_paragon.ModalDialog.Footer, {
210
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_paragon.ActionRow, {
211
+ className: (0, _classnames.default)({
212
+ 'subscription-comparison-actions-stacked': isSmallScreen
213
+ }),
214
+ "data-testid": "subscription-comparison-actions",
215
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_paragon.Button, {
216
+ as: "a",
217
+ href: offer.subscribeUrl,
218
+ variant: "primary",
219
+ onClick: onSubscribeClick,
220
+ "data-testid": "subscription-comparison-subscribe-button",
221
+ children: formatMessage(hasTrial ? _messages.default.startFreeTrial : _messages.default.subscribe)
222
+ }), canPurchase && /*#__PURE__*/(0, _jsxRuntime.jsx)(_paragon.Button, {
223
+ as: "a",
224
+ href: purchaseUrl,
225
+ variant: "outline-primary",
226
+ onClick: onPurchaseClick,
227
+ "data-testid": "subscription-comparison-purchase-button",
228
+ children: coursePrice ? formatMessage(_messages.default.buyFor, {
229
+ price: coursePrice
230
+ }) : formatMessage(_messages.default.purchaseNoPrice)
231
+ })]
232
+ })
233
+ })]
234
+ });
235
+ };
236
+ SubscriptionComparisonModal.propTypes = {
237
+ courseId: _propTypes.default.string.isRequired,
238
+ isOpen: _propTypes.default.bool.isRequired,
239
+ onClose: _propTypes.default.func.isRequired,
240
+ onSubscribeClick: _propTypes.default.func,
241
+ onPurchaseClick: _propTypes.default.func
242
+ };
243
+ SubscriptionComparisonModal.defaultProps = {
244
+ onSubscribeClick: undefined,
245
+ onPurchaseClick: undefined
246
+ };
247
+ var _default = exports.default = SubscriptionComparisonModal;
248
+ //# sourceMappingURL=SubscriptionComparisonModal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SubscriptionComparisonModal.js","names":["_react","_interopRequireWildcard","require","_propTypes","_interopRequireDefault","_classnames","_i18n","_paragon","_icons","_useSubscriptionOffer","_messages","_jsxRuntime","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","SUBSCRIBE","BUY","SubscriptionComparisonModal","_ref","courseId","isOpen","onClose","onSubscribeClick","onPurchaseClick","formatMessage","useIntl","offer","useSubscriptionOffer","isSmallScreen","useWindowSize","width","breakpoints","medium","minWidth","activePlan","setActivePlan","useState","canSubscribe","hasTrial","purchaseUrl","canPurchase","coursePrice","subscribePrice","included","jsx","Icon","src","CheckCircle","screenReaderText","messages","includedAlt","notIncluded","className","children","notIncludedAlt","cell","value","subscribePriceCell","buyPriceCell","jsxs","Fragment","oneTimePurchase","rows","key","label","rowPrice","featureUnlimitedAccess","rowEarnCertificates","certificatesUnlimited","certificatesOne","featureGradedAssignments","featureChangeCourses","cancelAnytime","featureFreeTrial","filter","Boolean","plans","name","subscribeColumn","buyCourseColumn","activeKey","some","plan","visiblePlans","activeIndex","findIndex","showPlanAt","index","length","title","comparisonTitle","ModalDialog","size","hasCloseButton","isFullscreenOnMobile","isOverflowVisible","Header","Title","as","comparisonSubtitle","Body","scope","featureColumn","map","row","IconButton","ChevronLeft","iconAs","alt","previousPlan","onClick","type","classNames","showPlan","ChevronRight","nextPlan","Footer","ActionRow","Button","href","subscribeUrl","variant","startFreeTrial","subscribe","buyFor","price","purchaseNoPrice","propTypes","PropTypes","string","isRequired","bool","func","defaultProps","undefined","_default","exports"],"sources":["../../src/subscription-upsell/SubscriptionComparisonModal.jsx"],"sourcesContent":["/* eslint import/no-unresolved: 0 */\nimport React, { useState } from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\nimport { useIntl } from '@edx/frontend-platform/i18n';\nimport {\n ActionRow, breakpoints, Button, Icon, IconButton, ModalDialog, useWindowSize,\n} from '@openedx/paragon';\nimport { ChevronLeft, ChevronRight, CheckCircle } from '@openedx/paragon/icons';\n\nimport useSubscriptionOffer from './useSubscriptionOffer';\nimport messages from './messages';\nimport './SubscriptionComparisonModal.scss';\n\nconst SUBSCRIBE = 'subscribe';\nconst BUY = 'buy';\n\n/** Subscribe vs Buy course pop-up (Figma 3339-8172); one column at a time on small screens. */\nconst SubscriptionComparisonModal = ({\n courseId,\n isOpen,\n onClose,\n onSubscribeClick,\n onPurchaseClick,\n}) => {\n const { formatMessage } = useIntl();\n const offer = useSubscriptionOffer(courseId);\n const isSmallScreen = useWindowSize().width < breakpoints.medium.minWidth;\n const [activePlan, setActivePlan] = useState(SUBSCRIBE);\n\n if (!offer || !offer.canSubscribe) {\n return null;\n }\n\n const {\n hasTrial, purchaseUrl, canPurchase, coursePrice, subscribePrice,\n } = offer;\n\n const included = <Icon src={CheckCircle} screenReaderText={formatMessage(messages.includedAlt)} />;\n const notIncluded = <span className=\"sr-only\">{formatMessage(messages.notIncludedAlt)}</span>;\n const cell = (value) => {\n if (value === true) { return included; }\n if (value === false) { return notIncluded; }\n return value || null;\n };\n\n const subscribePriceCell = subscribePrice && <div className=\"font-weight-bold\">{subscribePrice}</div>;\n const buyPriceCell = coursePrice && (\n <>\n <div className=\"font-weight-bold\">{coursePrice}</div>\n <small>{formatMessage(messages.oneTimePurchase)}</small>\n </>\n );\n\n const rows = [\n {\n key: 'price', label: formatMessage(messages.rowPrice), [SUBSCRIBE]: subscribePriceCell, [BUY]: buyPriceCell,\n },\n {\n key: 'unlimited-access', label: formatMessage(messages.featureUnlimitedAccess), [SUBSCRIBE]: true, [BUY]: true,\n },\n {\n key: 'certificates',\n label: formatMessage(messages.rowEarnCertificates),\n [SUBSCRIBE]: formatMessage(messages.certificatesUnlimited),\n [BUY]: formatMessage(messages.certificatesOne),\n },\n {\n key: 'graded-assignments', label: formatMessage(messages.featureGradedAssignments), [SUBSCRIBE]: true, [BUY]: true,\n },\n {\n key: 'change-courses', label: formatMessage(messages.featureChangeCourses), [SUBSCRIBE]: true, [BUY]: false,\n },\n {\n key: 'cancel-anytime', label: formatMessage(messages.cancelAnytime), [SUBSCRIBE]: true, [BUY]: false,\n },\n hasTrial && {\n key: 'free-trial', label: formatMessage(messages.featureFreeTrial), [SUBSCRIBE]: true, [BUY]: false,\n },\n ].filter(Boolean);\n\n const plans = [\n { key: SUBSCRIBE, name: formatMessage(messages.subscribeColumn), className: 'plan-subscribe' },\n canPurchase && { key: BUY, name: formatMessage(messages.buyCourseColumn), className: 'plan-buy' },\n ].filter(Boolean);\n // The selected plan can vanish, e.g. Buy was selected and the course lost its purchase link.\n const activeKey = plans.some((plan) => plan.key === activePlan) ? activePlan : plans[0].key;\n const visiblePlans = isSmallScreen ? plans.filter((plan) => plan.key === activeKey) : plans;\n const activeIndex = plans.findIndex((plan) => plan.key === activeKey);\n const showPlanAt = (index) => setActivePlan(plans[(index + plans.length) % plans.length].key);\n\n const title = formatMessage(messages.comparisonTitle);\n\n return (\n <ModalDialog\n title={title}\n isOpen={isOpen}\n onClose={onClose}\n size=\"lg\"\n hasCloseButton\n isFullscreenOnMobile\n isOverflowVisible={false}\n className=\"subscription-comparison-modal\"\n >\n <ModalDialog.Header>\n <ModalDialog.Title as=\"h2\">{title}</ModalDialog.Title>\n <p className=\"mt-2 mb-0\">{formatMessage(messages.comparisonSubtitle)}</p>\n </ModalDialog.Header>\n <ModalDialog.Body>\n <table className=\"w-100 text-center subscription-comparison-table\" data-testid=\"subscription-comparison-table\">\n <thead>\n <tr>\n <th scope=\"col\" className=\"feature-header\"><span className=\"sr-only\">{formatMessage(messages.featureColumn)}</span></th>\n {visiblePlans.map((plan) => (\n <th scope=\"col\" key={plan.key} className={plan.className} data-testid={`subscription-comparison-header-${plan.key}`}>\n {plan.name}\n </th>\n ))}\n </tr>\n </thead>\n <tbody>\n {rows.map((row) => (\n <tr key={row.key} data-testid={`subscription-comparison-row-${row.key}`}>\n <th scope=\"row\" className=\"feature-cell\">{row.label}</th>\n {visiblePlans.map((plan) => (\n <td key={plan.key} className={plan.className} data-testid={`subscription-comparison-cell-${row.key}-${plan.key}`}>\n <div className=\"center-items flex-column\">{cell(row[plan.key])}</div>\n </td>\n ))}\n </tr>\n ))}\n </tbody>\n </table>\n {isSmallScreen && plans.length > 1 && (\n <div className=\"d-flex align-items-center justify-content-center mt-3\" data-testid=\"subscription-comparison-controls\">\n <IconButton\n src={ChevronLeft}\n iconAs={Icon}\n alt={formatMessage(messages.previousPlan)}\n onClick={() => showPlanAt(activeIndex - 1)}\n />\n {plans.map((plan) => (\n <button\n type=\"button\"\n key={plan.key}\n className={classNames('btn btn-link p-1', { 'font-weight-bold': plan.key === activeKey })}\n aria-pressed={plan.key === activeKey}\n aria-label={formatMessage(messages.showPlan, { plan: plan.name })}\n onClick={() => setActivePlan(plan.key)}\n >\n {plan.key === activeKey ? '●' : '○'}\n </button>\n ))}\n <IconButton\n src={ChevronRight}\n iconAs={Icon}\n alt={formatMessage(messages.nextPlan)}\n onClick={() => showPlanAt(activeIndex + 1)}\n />\n </div>\n )}\n </ModalDialog.Body>\n <ModalDialog.Footer>\n <ActionRow\n className={classNames({ 'subscription-comparison-actions-stacked': isSmallScreen })}\n data-testid=\"subscription-comparison-actions\"\n >\n <Button\n as=\"a\"\n href={offer.subscribeUrl}\n variant=\"primary\"\n onClick={onSubscribeClick}\n data-testid=\"subscription-comparison-subscribe-button\"\n >\n {formatMessage(hasTrial ? messages.startFreeTrial : messages.subscribe)}\n </Button>\n {canPurchase && (\n <Button\n as=\"a\"\n href={purchaseUrl}\n variant=\"outline-primary\"\n onClick={onPurchaseClick}\n data-testid=\"subscription-comparison-purchase-button\"\n >\n {coursePrice\n ? formatMessage(messages.buyFor, { price: coursePrice })\n : formatMessage(messages.purchaseNoPrice)}\n </Button>\n )}\n </ActionRow>\n </ModalDialog.Footer>\n </ModalDialog>\n );\n};\n\nSubscriptionComparisonModal.propTypes = {\n courseId: PropTypes.string.isRequired,\n isOpen: PropTypes.bool.isRequired,\n onClose: PropTypes.func.isRequired,\n onSubscribeClick: PropTypes.func,\n onPurchaseClick: PropTypes.func,\n};\n\nSubscriptionComparisonModal.defaultProps = {\n onSubscribeClick: undefined,\n onPurchaseClick: undefined,\n};\n\nexport default SubscriptionComparisonModal;\n"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,WAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,KAAA,GAA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