@edx/frontend-plugin-advertisements 2.24.2 → 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.
- package/dist/course-exit-upsell/CourseExitUpsell.js +147 -0
- package/dist/course-exit-upsell/CourseExitUpsell.js.map +1 -0
- package/dist/course-exit-upsell/UpgradeFootnote.js +74 -0
- package/dist/course-exit-upsell/UpgradeFootnote.js.map +1 -0
- package/dist/course-exit-upsell/index.js +10 -0
- package/dist/course-exit-upsell/index.js.map +1 -0
- package/dist/course-exit-upsell/messages.js +46 -0
- package/dist/course-exit-upsell/messages.js.map +1 -0
- package/dist/course-exit-upsell/track.js +124 -0
- package/dist/course-exit-upsell/track.js.map +1 -0
- package/dist/data/__factories__/extraOffer.factory.js +15 -0
- package/dist/data/__factories__/extraOffer.factory.js.map +1 -0
- package/dist/data/__factories__/index.js +1 -0
- package/dist/data/__factories__/index.js.map +1 -1
- package/dist/data/lms_api.js +40 -0
- package/dist/data/lms_api.js.map +1 -1
- package/dist/index.js +38 -0
- package/dist/index.js.map +1 -1
- package/dist/subscription-upsell/SubscriptionBenefitsModal.js +145 -0
- package/dist/subscription-upsell/SubscriptionBenefitsModal.js.map +1 -0
- package/dist/subscription-upsell/SubscriptionComparisonModal.js +248 -0
- package/dist/subscription-upsell/SubscriptionComparisonModal.js.map +1 -0
- package/dist/subscription-upsell/SubscriptionComparisonModal.scss +66 -0
- package/dist/subscription-upsell/SubscriptionUpgradeCard.js +193 -0
- package/dist/subscription-upsell/SubscriptionUpgradeCard.js.map +1 -0
- package/dist/subscription-upsell/SubscriptionUpsell.js +186 -0
- package/dist/subscription-upsell/SubscriptionUpsell.js.map +1 -0
- package/dist/subscription-upsell/index.js +61 -0
- package/dist/subscription-upsell/index.js.map +1 -0
- package/dist/subscription-upsell/messages.js +261 -0
- package/dist/subscription-upsell/messages.js.map +1 -0
- package/dist/subscription-upsell/useSubscriptionOffer.js +80 -0
- package/dist/subscription-upsell/useSubscriptionOffer.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
10
|
+
var _frontendPlatform = require("@edx/frontend-platform");
|
|
11
|
+
var _i18n = require("@edx/frontend-platform/i18n");
|
|
12
|
+
var _paragon = require("@openedx/paragon");
|
|
13
|
+
var _icons = require("@openedx/paragon/icons");
|
|
14
|
+
var _certificatePreview = _interopRequireDefault(require("../upgrade-notification/certificate-preview"));
|
|
15
|
+
require("../generic/upsell-bullets/UpsellTable.scss");
|
|
16
|
+
var _SubscriptionUpsell = _interopRequireDefault(require("./SubscriptionUpsell"));
|
|
17
|
+
var _useSubscriptionOffer = _interopRequireDefault(require("./useSubscriptionOffer"));
|
|
18
|
+
var _messages = _interopRequireDefault(require("./messages"));
|
|
19
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
20
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
21
|
+
/* eslint import/no-unresolved: 0 */
|
|
22
|
+
|
|
23
|
+
/** The sidebar card (Figma 3331-33999): certificate preview, Buy vs Subscribe table, buttons. */const SubscriptionUpgradeCard = _ref => {
|
|
24
|
+
let {
|
|
25
|
+
courseId,
|
|
26
|
+
withBorder,
|
|
27
|
+
onSubscribeClick,
|
|
28
|
+
onPurchaseClick,
|
|
29
|
+
onUpgradeEvent,
|
|
30
|
+
onUpgraded
|
|
31
|
+
} = _ref;
|
|
32
|
+
const {
|
|
33
|
+
formatMessage
|
|
34
|
+
} = (0, _i18n.useIntl)();
|
|
35
|
+
const offer = (0, _useSubscriptionOffer.default)(courseId);
|
|
36
|
+
if (!offer || !offer.canPurchase && !offer.canSubscribe && !offer.canUpgradeInPlace) {
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
const {
|
|
40
|
+
coursePrice,
|
|
41
|
+
subscribePrice
|
|
42
|
+
} = offer;
|
|
43
|
+
const included = /*#__PURE__*/(0, _jsxRuntime.jsx)(_paragon.Icon, {
|
|
44
|
+
src: _icons.CheckCircle,
|
|
45
|
+
screenReaderText: formatMessage(_messages.default.includedAlt)
|
|
46
|
+
});
|
|
47
|
+
const notIncluded = /*#__PURE__*/(0, _jsxRuntime.jsx)(_paragon.Icon, {
|
|
48
|
+
src: _icons.CloseSmall,
|
|
49
|
+
screenReaderText: formatMessage(_messages.default.notIncludedAlt)
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
// Columns follow the buttons; a subscriber gets Upgrade now and nothing to compare.
|
|
53
|
+
const showSubscribeColumn = offer.canSubscribe;
|
|
54
|
+
const showBuyColumn = offer.canPurchase;
|
|
55
|
+
const showTable = !offer.canUpgradeInPlace && (showSubscribeColumn || showBuyColumn);
|
|
56
|
+
const rows = [showSubscribeColumn && offer.hasTrial && {
|
|
57
|
+
key: 'free-trial',
|
|
58
|
+
label: formatMessage(_messages.default.featureFreeTrial),
|
|
59
|
+
buy: false
|
|
60
|
+
}, showSubscribeColumn && {
|
|
61
|
+
key: 'change-courses',
|
|
62
|
+
label: formatMessage(_messages.default.featureChangeCourses),
|
|
63
|
+
buy: false
|
|
64
|
+
}, {
|
|
65
|
+
key: 'certificates',
|
|
66
|
+
label: formatMessage(_messages.default.featureCertificates, {
|
|
67
|
+
certificateLink: /*#__PURE__*/(0, _jsxRuntime.jsx)(_paragon.Hyperlink, {
|
|
68
|
+
destination: `${(0, _frontendPlatform.getConfig)().MARKETING_SITE_BASE_URL}/verified-certificate`,
|
|
69
|
+
children: formatMessage(_messages.default.featureCertificatesLink)
|
|
70
|
+
})
|
|
71
|
+
}),
|
|
72
|
+
buy: true
|
|
73
|
+
}, {
|
|
74
|
+
key: 'graded-assignments',
|
|
75
|
+
label: formatMessage(_messages.default.featureGradedAssignments),
|
|
76
|
+
buy: true
|
|
77
|
+
}, {
|
|
78
|
+
key: 'unlimited-access',
|
|
79
|
+
label: formatMessage(_messages.default.featureUnlimitedAccess),
|
|
80
|
+
buy: true
|
|
81
|
+
}].filter(Boolean);
|
|
82
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("section", {
|
|
83
|
+
className: (0, _classnames.default)('upgrade-notification subscription-upgrade-card small', {
|
|
84
|
+
'pgn__card pgn__card-light card mb-4 rounded': withBorder
|
|
85
|
+
}),
|
|
86
|
+
"data-testid": "subscription-upgrade-card",
|
|
87
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("h2", {
|
|
88
|
+
className: "upgrade-notification-header h4 px-4 pt-4 mb-3",
|
|
89
|
+
children: formatMessage(_messages.default.cardHeader)
|
|
90
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_certificatePreview.default, {
|
|
91
|
+
courseId: courseId
|
|
92
|
+
}), showTable && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
93
|
+
className: "px-4 small",
|
|
94
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("h3", {
|
|
95
|
+
className: "mb-4 primary-500",
|
|
96
|
+
children: formatMessage(_messages.default.benefitsHeader)
|
|
97
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("table", {
|
|
98
|
+
className: "w-100 text-center subscription-comparison-table",
|
|
99
|
+
"data-testid": "subscription-card-table",
|
|
100
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("thead", {
|
|
101
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("tr", {
|
|
102
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("th", {
|
|
103
|
+
scope: "col",
|
|
104
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
105
|
+
className: "sr-only",
|
|
106
|
+
children: formatMessage(_messages.default.featureColumn)
|
|
107
|
+
})
|
|
108
|
+
}), showBuyColumn && /*#__PURE__*/(0, _jsxRuntime.jsx)("th", {
|
|
109
|
+
scope: "col",
|
|
110
|
+
className: "audit-cell top-audit-border font-weight-normal",
|
|
111
|
+
"data-testid": "subscription-card-buy-header",
|
|
112
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
113
|
+
className: "center-items flex-column",
|
|
114
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
115
|
+
children: formatMessage(_messages.default.buyColumn)
|
|
116
|
+
}), coursePrice && /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
117
|
+
children: coursePrice
|
|
118
|
+
})]
|
|
119
|
+
})
|
|
120
|
+
}), showSubscribeColumn && /*#__PURE__*/(0, _jsxRuntime.jsx)("th", {
|
|
121
|
+
scope: "col",
|
|
122
|
+
className: "verified-cell top-verified-border",
|
|
123
|
+
"data-testid": "subscription-card-subscribe-header",
|
|
124
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
125
|
+
className: "center-items flex-column",
|
|
126
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
127
|
+
children: formatMessage(_messages.default.subscribeColumn)
|
|
128
|
+
}), subscribePrice && /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
129
|
+
className: "font-weight-normal",
|
|
130
|
+
children: subscribePrice
|
|
131
|
+
})]
|
|
132
|
+
})
|
|
133
|
+
})]
|
|
134
|
+
})
|
|
135
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("tbody", {
|
|
136
|
+
children: rows.map((row, index) => {
|
|
137
|
+
const last = index === rows.length - 1;
|
|
138
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("tr", {
|
|
139
|
+
"data-testid": `subscription-card-row-${row.key}`,
|
|
140
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("th", {
|
|
141
|
+
scope: "row",
|
|
142
|
+
className: (0, _classnames.default)('feature-cell text-left font-weight-normal', {
|
|
143
|
+
'bottom-no-border': last
|
|
144
|
+
}),
|
|
145
|
+
children: row.label
|
|
146
|
+
}), showBuyColumn && /*#__PURE__*/(0, _jsxRuntime.jsx)("td", {
|
|
147
|
+
className: (0, _classnames.default)('audit-cell', {
|
|
148
|
+
'bottom-audit-border': last
|
|
149
|
+
}),
|
|
150
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
151
|
+
className: "center-items",
|
|
152
|
+
children: row.buy ? included : notIncluded
|
|
153
|
+
})
|
|
154
|
+
}), showSubscribeColumn && /*#__PURE__*/(0, _jsxRuntime.jsx)("td", {
|
|
155
|
+
className: (0, _classnames.default)('verified-cell', {
|
|
156
|
+
'bottom-verified-border': last
|
|
157
|
+
}),
|
|
158
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
159
|
+
className: "center-items",
|
|
160
|
+
children: included
|
|
161
|
+
})
|
|
162
|
+
})]
|
|
163
|
+
}, row.key);
|
|
164
|
+
})
|
|
165
|
+
})]
|
|
166
|
+
})]
|
|
167
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_SubscriptionUpsell.default, {
|
|
168
|
+
courseId: courseId,
|
|
169
|
+
className: "px-4 pb-4 pt-3",
|
|
170
|
+
onSubscribeClick: onSubscribeClick,
|
|
171
|
+
onPurchaseClick: onPurchaseClick,
|
|
172
|
+
onUpgradeEvent: onUpgradeEvent,
|
|
173
|
+
onUpgraded: onUpgraded
|
|
174
|
+
})]
|
|
175
|
+
});
|
|
176
|
+
};
|
|
177
|
+
SubscriptionUpgradeCard.propTypes = {
|
|
178
|
+
courseId: _propTypes.default.string.isRequired,
|
|
179
|
+
withBorder: _propTypes.default.bool,
|
|
180
|
+
onSubscribeClick: _propTypes.default.func,
|
|
181
|
+
onPurchaseClick: _propTypes.default.func,
|
|
182
|
+
onUpgradeEvent: _propTypes.default.func,
|
|
183
|
+
onUpgraded: _propTypes.default.func
|
|
184
|
+
};
|
|
185
|
+
SubscriptionUpgradeCard.defaultProps = {
|
|
186
|
+
withBorder: false,
|
|
187
|
+
onSubscribeClick: undefined,
|
|
188
|
+
onPurchaseClick: undefined,
|
|
189
|
+
onUpgradeEvent: undefined,
|
|
190
|
+
onUpgraded: undefined
|
|
191
|
+
};
|
|
192
|
+
var _default = exports.default = SubscriptionUpgradeCard;
|
|
193
|
+
//# sourceMappingURL=SubscriptionUpgradeCard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SubscriptionUpgradeCard.js","names":["_react","_interopRequireDefault","require","_propTypes","_classnames","_frontendPlatform","_i18n","_paragon","_icons","_certificatePreview","_SubscriptionUpsell","_useSubscriptionOffer","_messages","_jsxRuntime","e","__esModule","default","SubscriptionUpgradeCard","_ref","courseId","withBorder","onSubscribeClick","onPurchaseClick","onUpgradeEvent","onUpgraded","formatMessage","useIntl","offer","useSubscriptionOffer","canPurchase","canSubscribe","canUpgradeInPlace","coursePrice","subscribePrice","included","jsx","Icon","src","CheckCircle","screenReaderText","messages","includedAlt","notIncluded","CloseSmall","notIncludedAlt","showSubscribeColumn","showBuyColumn","showTable","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","cardHeader","benefitsHeader","scope","featureColumn","buyColumn","subscribeColumn","map","row","index","last","length","propTypes","PropTypes","string","isRequired","bool","func","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 { Hyperlink, Icon } from '@openedx/paragon';\nimport { CheckCircle, CloseSmall } from '@openedx/paragon/icons';\n\nimport CertificatePreview from '../upgrade-notification/certificate-preview';\nimport '../generic/upsell-bullets/UpsellTable.scss';\nimport SubscriptionUpsell from './SubscriptionUpsell';\nimport useSubscriptionOffer from './useSubscriptionOffer';\nimport messages from './messages';\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}) => {\n const { formatMessage } = useIntl();\n const offer = useSubscriptionOffer(courseId);\n\n if (!offer || (!offer.canPurchase && !offer.canSubscribe && !offer.canUpgradeInPlace)) {\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 data-testid=\"subscription-upgrade-card\"\n >\n <h2 className=\"upgrade-notification-header h4 px-4 pt-4 mb-3\">{formatMessage(messages.cardHeader)}</h2>\n <CertificatePreview courseId={courseId} />\n {showTable && (\n <div className=\"px-4 small\">\n <h3 className=\"mb-4 primary-500\">{formatMessage(messages.benefitsHeader)}</h3>\n <table className=\"w-100 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};\n\nSubscriptionUpgradeCard.defaultProps = {\n withBorder: false,\n onSubscribeClick: undefined,\n onPurchaseClick: undefined,\n onUpgradeEvent: undefined,\n onUpgraded: 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;AACA,IAAAM,MAAA,GAAAN,OAAA;AAEA,IAAAO,mBAAA,GAAAR,sBAAA,CAAAC,OAAA;AACAA,OAAA;AACA,IAAAQ,mBAAA,GAAAT,sBAAA,CAAAC,OAAA;AACA,IAAAS,qBAAA,GAAAV,sBAAA,CAAAC,OAAA;AACA,IAAAU,SAAA,GAAAX,sBAAA,CAAAC,OAAA;AAAkC,IAAAW,WAAA,GAAAX,OAAA;AAAA,SAAAD,uBAAAa,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAblC;;AAeA,iGACA,MAAMG,uBAAuB,GAAGC,IAAA,IAO1B;EAAA,IAP2B;IAC/BC,QAAQ;IACRC,UAAU;IACVC,gBAAgB;IAChBC,eAAe;IACfC,cAAc;IACdC;EACF,CAAC,GAAAN,IAAA;EACC,MAAM;IAAEO;EAAc,CAAC,GAAG,IAAAC,aAAO,EAAC,CAAC;EACnC,MAAMC,KAA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AAA,GAbM2C,GAAG,CAAC3B,GAcT,CAAC;UAET,CAAC;QAAC,CACG,CAAC;MAAA,CACH,CAAC;IAAA,CACL,CACN,eACD,IAAArC,WAAA,CAAAsB,GAAA,EAACzB,mBAAA,CAAAM,OAAkB;MACjBG,QAAQ,EAAEA,QAAS;MACnBiD,SAAS,EAAC,gBAAgB;MAC1B/C,gBAAgB,EAAEA,gBAAiB;MACnCC,eAAe,EAAEA,eAAgB;MACjCC,cAAc,EAAEA,cAAe;MAC/BC,UAAU,EAAEA;IAAW,CACxB,CAAC;EAAA,CACK,CAAC;AAEd,CAAC;AAEDP,uBAAuB,CAACgE,SAAS,GAAG;EAClC9D,QAAQ,EAAE+D,kBAAS,CAACC,MAAM,CAACC,UAAU;EACrChE,UAAU,EAAE8D,kBAAS,CAACG,IAAI;EAC1BhE,gBAAgB,EAAE6D,kBAAS,CAACI,IAAI;EAChChE,eAAe,EAAE4D,kBAAS,CAACI,IAAI;EAC/B/D,cAAc,EAAE2D,kBAAS,CAACI,IAAI;EAC9B9D,UAAU,EAAE0D,kBAAS,CAACI;AACxB,CAAC;AAEDrE,uBAAuB,CAACsE,YAAY,GAAG;EACrCnE,UAAU,EAAE,KAAK;EACjBC,gBAAgB,EAAEmE,SAAS;EAC3BlE,eAAe,EAAEkE,SAAS;EAC1BjE,cAAc,EAAEiE,SAAS;EACzBhE,UAAU,EAAEgE;AACd,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAA1E,OAAA,GAEaC,uBAAuB","ignoreList":[]}
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = exports.UPGRADE_STATE = 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 _logging = require("@edx/frontend-platform/logging");
|
|
11
|
+
var _paragon = require("@openedx/paragon");
|
|
12
|
+
var _lms_api = require("../data/lms_api");
|
|
13
|
+
var _useSubscriptionOffer = _interopRequireDefault(require("./useSubscriptionOffer"));
|
|
14
|
+
var _messages = _interopRequireDefault(require("./messages"));
|
|
15
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
16
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
17
|
+
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); }
|
|
18
|
+
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; }
|
|
19
|
+
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; }
|
|
20
|
+
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; }
|
|
21
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
22
|
+
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 */
|
|
23
|
+
const UPGRADE_STATE = exports.UPGRADE_STATE = {
|
|
24
|
+
IDLE: 'idle',
|
|
25
|
+
LOADING: 'loading',
|
|
26
|
+
PENDING: 'pending',
|
|
27
|
+
NOT_ACTIVE: 'not_active',
|
|
28
|
+
FAILED: 'failed'
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
// Host callbacks (analytics, refresh) must never change the outcome of the upgrade request.
|
|
32
|
+
const safeCall = function (fn) {
|
|
33
|
+
try {
|
|
34
|
+
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
35
|
+
args[_key - 1] = arguments[_key];
|
|
36
|
+
}
|
|
37
|
+
Promise.resolve(fn?.(...args)).catch(_logging.logError);
|
|
38
|
+
} catch (error) {
|
|
39
|
+
(0, _logging.logError)(error);
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
/** Subscribe and Purchase, Purchase only, Upgrade now for subscribers, or the "not included" note. */
|
|
44
|
+
const SubscriptionUpsell = _ref => {
|
|
45
|
+
let {
|
|
46
|
+
courseId,
|
|
47
|
+
onSubscribeClick,
|
|
48
|
+
onPurchaseClick,
|
|
49
|
+
onUpgradeEvent,
|
|
50
|
+
onUpgraded,
|
|
51
|
+
className
|
|
52
|
+
} = _ref;
|
|
53
|
+
const {
|
|
54
|
+
formatMessage
|
|
55
|
+
} = (0, _i18n.useIntl)();
|
|
56
|
+
const offer = (0, _useSubscriptionOffer.default)(courseId);
|
|
57
|
+
// Per course, so a course change reads as idle and a late response cannot touch another course.
|
|
58
|
+
const [upgrades, setUpgrades] = (0, _react.useState)({});
|
|
59
|
+
const inFlight = (0, _react.useRef)(new Set());
|
|
60
|
+
const upgradeState = upgrades[courseId] || UPGRADE_STATE.IDLE;
|
|
61
|
+
const setUpgradeFor = (id, state) => setUpgrades(prev => _objectSpread(_objectSpread({}, prev), {}, {
|
|
62
|
+
[id]: state
|
|
63
|
+
}));
|
|
64
|
+
if (!offer) {
|
|
65
|
+
return null;
|
|
66
|
+
}
|
|
67
|
+
const {
|
|
68
|
+
purchaseUrl,
|
|
69
|
+
canPurchase,
|
|
70
|
+
coursePrice
|
|
71
|
+
} = offer;
|
|
72
|
+
const handleUpgrade = async () => {
|
|
73
|
+
const requestedCourseId = courseId;
|
|
74
|
+
if (inFlight.current.has(requestedCourseId)) {
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
inFlight.current.add(requestedCourseId);
|
|
78
|
+
setUpgradeFor(requestedCourseId, UPGRADE_STATE.LOADING);
|
|
79
|
+
safeCall(onUpgradeEvent, 'started');
|
|
80
|
+
let nextState;
|
|
81
|
+
let result;
|
|
82
|
+
let error;
|
|
83
|
+
try {
|
|
84
|
+
result = await (0, _lms_api.upgradeEnrollmentWithSubscription)(requestedCourseId);
|
|
85
|
+
if (result?.success !== true) {
|
|
86
|
+
throw new _lms_api.SubscriptionUpgradeError('Upgrade was not accepted', {
|
|
87
|
+
code: result?.code,
|
|
88
|
+
status: result?.status
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
nextState = UPGRADE_STATE.PENDING;
|
|
92
|
+
} catch (e) {
|
|
93
|
+
error = e;
|
|
94
|
+
nextState = e.code === 'SUBSCRIPTION_NOT_ACTIVE' ? UPGRADE_STATE.NOT_ACTIVE : UPGRADE_STATE.FAILED;
|
|
95
|
+
}
|
|
96
|
+
inFlight.current.delete(requestedCourseId);
|
|
97
|
+
setUpgradeFor(requestedCourseId, nextState);
|
|
98
|
+
if (error) {
|
|
99
|
+
safeCall(onUpgradeEvent, 'failed', error);
|
|
100
|
+
} else {
|
|
101
|
+
safeCall(onUpgradeEvent, 'succeeded');
|
|
102
|
+
safeCall(onUpgraded, result);
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
if (offer.canUpgradeInPlace) {
|
|
106
|
+
if (upgradeState === UPGRADE_STATE.PENDING) {
|
|
107
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
|
|
108
|
+
className: className,
|
|
109
|
+
role: "status",
|
|
110
|
+
"data-testid": "subscription-upgrade-pending",
|
|
111
|
+
children: formatMessage(_messages.default.upgradePending)
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
115
|
+
className: className,
|
|
116
|
+
children: [upgradeState === UPGRADE_STATE.NOT_ACTIVE && /*#__PURE__*/(0, _jsxRuntime.jsxs)("p", {
|
|
117
|
+
role: "alert",
|
|
118
|
+
"data-testid": "subscription-upgrade-not-active",
|
|
119
|
+
children: [formatMessage(_messages.default.upgradeNotActive), offer.subscribeUrl && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
120
|
+
children: [' ', /*#__PURE__*/(0, _jsxRuntime.jsx)(_paragon.Hyperlink, {
|
|
121
|
+
destination: offer.subscribeUrl,
|
|
122
|
+
children: formatMessage(_messages.default.reactivateSubscription)
|
|
123
|
+
})]
|
|
124
|
+
})]
|
|
125
|
+
}), upgradeState === UPGRADE_STATE.FAILED && /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
|
|
126
|
+
role: "alert",
|
|
127
|
+
"data-testid": "subscription-upgrade-failed",
|
|
128
|
+
children: formatMessage(_messages.default.upgradeFailed)
|
|
129
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_paragon.Button, {
|
|
130
|
+
variant: "brand",
|
|
131
|
+
block: true,
|
|
132
|
+
onClick: handleUpgrade,
|
|
133
|
+
disabled: upgradeState === UPGRADE_STATE.LOADING,
|
|
134
|
+
"data-testid": "subscription-upgrade-now-button",
|
|
135
|
+
children: formatMessage(upgradeState === UPGRADE_STATE.LOADING ? _messages.default.upgrading : _messages.default.upgradeNow)
|
|
136
|
+
})]
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
if (!canPurchase && !offer.canSubscribe && !offer.showNotIncluded) {
|
|
140
|
+
return null;
|
|
141
|
+
}
|
|
142
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
143
|
+
className: className,
|
|
144
|
+
children: [offer.showNotIncluded && /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
|
|
145
|
+
"data-testid": "subscription-not-included",
|
|
146
|
+
children: formatMessage(_messages.default.notIncluded)
|
|
147
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
148
|
+
className: "d-flex",
|
|
149
|
+
children: [canPurchase && /*#__PURE__*/(0, _jsxRuntime.jsx)(_paragon.Button, {
|
|
150
|
+
as: "a",
|
|
151
|
+
href: purchaseUrl,
|
|
152
|
+
variant: offer.canSubscribe ? 'outline-primary' : 'brand',
|
|
153
|
+
onClick: onPurchaseClick,
|
|
154
|
+
"data-testid": "subscription-purchase-button",
|
|
155
|
+
children: coursePrice ? formatMessage(_messages.default.purchase, {
|
|
156
|
+
price: coursePrice
|
|
157
|
+
}) : formatMessage(_messages.default.purchaseNoPrice)
|
|
158
|
+
}), offer.canSubscribe && /*#__PURE__*/(0, _jsxRuntime.jsx)(_paragon.Button, {
|
|
159
|
+
as: "a",
|
|
160
|
+
href: offer.subscribeUrl,
|
|
161
|
+
variant: "brand",
|
|
162
|
+
className: "ml-2",
|
|
163
|
+
onClick: onSubscribeClick,
|
|
164
|
+
"data-testid": "subscription-subscribe-button",
|
|
165
|
+
children: formatMessage(_messages.default.subscribe)
|
|
166
|
+
})]
|
|
167
|
+
})]
|
|
168
|
+
});
|
|
169
|
+
};
|
|
170
|
+
SubscriptionUpsell.propTypes = {
|
|
171
|
+
courseId: _propTypes.default.string.isRequired,
|
|
172
|
+
onSubscribeClick: _propTypes.default.func,
|
|
173
|
+
onPurchaseClick: _propTypes.default.func,
|
|
174
|
+
onUpgradeEvent: _propTypes.default.func,
|
|
175
|
+
onUpgraded: _propTypes.default.func,
|
|
176
|
+
className: _propTypes.default.string
|
|
177
|
+
};
|
|
178
|
+
SubscriptionUpsell.defaultProps = {
|
|
179
|
+
onSubscribeClick: undefined,
|
|
180
|
+
onPurchaseClick: undefined,
|
|
181
|
+
onUpgradeEvent: undefined,
|
|
182
|
+
onUpgraded: undefined,
|
|
183
|
+
className: undefined
|
|
184
|
+
};
|
|
185
|
+
var _default = exports.default = SubscriptionUpsell;
|
|
186
|
+
//# sourceMappingURL=SubscriptionUpsell.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SubscriptionUpsell.js","names":["_react","_interopRequireWildcard","require","_propTypes","_interopRequireDefault","_i18n","_logging","_paragon","_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","UPGRADE_STATE","exports","IDLE","LOADING","PENDING","NOT_ACTIVE","FAILED","safeCall","fn","_len","args","Array","_key","Promise","resolve","catch","logError","error","SubscriptionUpsell","_ref","courseId","onSubscribeClick","onPurchaseClick","onUpgradeEvent","onUpgraded","className","formatMessage","useIntl","offer","useSubscriptionOffer","upgrades","setUpgrades","useState","inFlight","useRef","Set","upgradeState","setUpgradeFor","id","state","prev","purchaseUrl","canPurchase","coursePrice","handleUpgrade","requestedCourseId","current","add","nextState","result","upgradeEnrollmentWithSubscription","success","SubscriptionUpgradeError","code","status","delete","canUpgradeInPlace","jsx","role","children","messages","upgradePending","jsxs","upgradeNotActive","subscribeUrl","Fragment","Hyperlink","destination","reactivateSubscription","upgradeFailed","Button","variant","block","onClick","disabled","upgrading","upgradeNow","canSubscribe","showNotIncluded","notIncluded","as","href","purchase","price","purchaseNoPrice","subscribe","propTypes","PropTypes","string","isRequired","func","defaultProps","undefined","_default"],"sources":["../../src/subscription-upsell/SubscriptionUpsell.jsx"],"sourcesContent":["/* eslint import/no-unresolved: 0 */\nimport React, { useRef, useState } from 'react';\nimport PropTypes from 'prop-types';\nimport { useIntl } from '@edx/frontend-platform/i18n';\nimport { logError } from '@edx/frontend-platform/logging';\nimport { Button, Hyperlink } from '@openedx/paragon';\n\nimport { SubscriptionUpgradeError, upgradeEnrollmentWithSubscription } from '../data/lms_api';\nimport useSubscriptionOffer from './useSubscriptionOffer';\nimport messages from './messages';\n\nexport const UPGRADE_STATE = {\n IDLE: 'idle',\n LOADING: 'loading',\n PENDING: 'pending',\n NOT_ACTIVE: 'not_active',\n FAILED: 'failed',\n};\n\n// Host callbacks (analytics, refresh) must never change the outcome of the upgrade request.\nconst safeCall = (fn, ...args) => {\n try {\n Promise.resolve(fn?.(...args)).catch(logError);\n } catch (error) {\n logError(error);\n }\n};\n\n/** Subscribe and Purchase, Purchase only, Upgrade now for subscribers, or the \"not included\" note. */\nconst SubscriptionUpsell = ({\n courseId,\n onSubscribeClick,\n onPurchaseClick,\n onUpgradeEvent,\n onUpgraded,\n className,\n}) => {\n const { formatMessage } = useIntl();\n const offer = useSubscriptionOffer(courseId);\n // Per course, so a course change reads as idle and a late response cannot touch another course.\n const [upgrades, setUpgrades] = useState({});\n const inFlight = useRef(new Set());\n const upgradeState = upgrades[courseId] || UPGRADE_STATE.IDLE;\n const setUpgradeFor = (id, state) => setUpgrades((prev) => ({ ...prev, [id]: state }));\n\n if (!offer) {\n return null;\n }\n\n const { purchaseUrl, canPurchase, coursePrice } = offer;\n\n const handleUpgrade = async () => {\n const requestedCourseId = courseId;\n if (inFlight.current.has(requestedCourseId)) {\n return;\n }\n inFlight.current.add(requestedCourseId);\n setUpgradeFor(requestedCourseId, UPGRADE_STATE.LOADING);\n safeCall(onUpgradeEvent, 'started');\n let nextState;\n let result;\n let error;\n try {\n result = await upgradeEnrollmentWithSubscription(requestedCourseId);\n if (result?.success !== true) {\n throw new SubscriptionUpgradeError('Upgrade was not accepted', { code: result?.code, status: result?.status });\n }\n nextState = UPGRADE_STATE.PENDING;\n } catch (e) {\n error = e;\n nextState = e.code === 'SUBSCRIPTION_NOT_ACTIVE' ? UPGRADE_STATE.NOT_ACTIVE : UPGRADE_STATE.FAILED;\n }\n inFlight.current.delete(requestedCourseId);\n setUpgradeFor(requestedCourseId, nextState);\n if (error) {\n safeCall(onUpgradeEvent, 'failed', error);\n } else {\n safeCall(onUpgradeEvent, 'succeeded');\n safeCall(onUpgraded, result);\n }\n };\n\n if (offer.canUpgradeInPlace) {\n if (upgradeState === UPGRADE_STATE.PENDING) {\n return <p className={className} role=\"status\" data-testid=\"subscription-upgrade-pending\">{formatMessage(messages.upgradePending)}</p>;\n }\n return (\n <div className={className}>\n {upgradeState === UPGRADE_STATE.NOT_ACTIVE && (\n <p role=\"alert\" data-testid=\"subscription-upgrade-not-active\">\n {formatMessage(messages.upgradeNotActive)}\n {offer.subscribeUrl && (\n <>\n {' '}\n <Hyperlink destination={offer.subscribeUrl}>{formatMessage(messages.reactivateSubscription)}</Hyperlink>\n </>\n )}\n </p>\n )}\n {upgradeState === UPGRADE_STATE.FAILED && (\n <p role=\"alert\" data-testid=\"subscription-upgrade-failed\">{formatMessage(messages.upgradeFailed)}</p>\n )}\n <Button\n variant=\"brand\"\n block\n onClick={handleUpgrade}\n disabled={upgradeState === UPGRADE_STATE.LOADING}\n data-testid=\"subscription-upgrade-now-button\"\n >\n {formatMessage(upgradeState === UPGRADE_STATE.LOADING ? messages.upgrading : messages.upgradeNow)}\n </Button>\n </div>\n );\n }\n\n if (!canPurchase && !offer.canSubscribe && !offer.showNotIncluded) {\n return null;\n }\n\n return (\n <div className={className}>\n {offer.showNotIncluded && (\n <p data-testid=\"subscription-not-included\">{formatMessage(messages.notIncluded)}</p>\n )}\n <div className=\"d-flex\">\n {canPurchase && (\n <Button\n as=\"a\"\n href={purchaseUrl}\n variant={offer.canSubscribe ? 'outline-primary' : 'brand'}\n onClick={onPurchaseClick}\n data-testid=\"subscription-purchase-button\"\n >\n {coursePrice\n ? formatMessage(messages.purchase, { price: coursePrice })\n : formatMessage(messages.purchaseNoPrice)}\n </Button>\n )}\n {offer.canSubscribe && (\n <Button\n as=\"a\"\n href={offer.subscribeUrl}\n variant=\"brand\"\n className=\"ml-2\"\n onClick={onSubscribeClick}\n data-testid=\"subscription-subscribe-button\"\n >\n {formatMessage(messages.subscribe)}\n </Button>\n )}\n </div>\n </div>\n );\n};\n\nSubscriptionUpsell.propTypes = {\n courseId: PropTypes.string.isRequired,\n onSubscribeClick: PropTypes.func,\n onPurchaseClick: PropTypes.func,\n onUpgradeEvent: PropTypes.func,\n onUpgraded: PropTypes.func,\n className: PropTypes.string,\n};\n\nSubscriptionUpsell.defaultProps = {\n onSubscribeClick: undefined,\n onPurchaseClick: undefined,\n onUpgradeEvent: undefined,\n onUpgraded: undefined,\n className: undefined,\n};\n\nexport default SubscriptionUpsell;\n"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AAEA,IAAAM,QAAA,GAAAN,OAAA;AACA,IAAAO,qBAAA,GAAAL,sBAAA,CAAAF,OAAA;AACA,IAAAQ,SAAA,GAAAN,sBAAA,CAAAF,OAAA;AAAkC,IAAAS,WAAA,GAAAT,OAAA;AAAA,SAAAE,uBAAAQ,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KA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C,IAAAC,QAAA,GAAA5F,OAAA,CAAA1C,OAAA,GAEa2D,kBAAkB","ignoreList":[]}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "BENEFITS_MODAL_VARIANT", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _SubscriptionBenefitsModal.BENEFITS_MODAL_VARIANT;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "SUBSCRIPTION_STATUS", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _useSubscriptionOffer.SUBSCRIPTION_STATUS;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, "SubscriptionBenefitsModal", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () {
|
|
21
|
+
return _SubscriptionBenefitsModal.default;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
Object.defineProperty(exports, "SubscriptionComparisonModal", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function () {
|
|
27
|
+
return _SubscriptionComparisonModal.default;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
Object.defineProperty(exports, "SubscriptionUpgradeCard", {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
get: function () {
|
|
33
|
+
return _SubscriptionUpgradeCard.default;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
Object.defineProperty(exports, "SubscriptionUpsell", {
|
|
37
|
+
enumerable: true,
|
|
38
|
+
get: function () {
|
|
39
|
+
return _SubscriptionUpsell.default;
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
Object.defineProperty(exports, "UPGRADE_STATE", {
|
|
43
|
+
enumerable: true,
|
|
44
|
+
get: function () {
|
|
45
|
+
return _SubscriptionUpsell.UPGRADE_STATE;
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
Object.defineProperty(exports, "useSubscriptionOffer", {
|
|
49
|
+
enumerable: true,
|
|
50
|
+
get: function () {
|
|
51
|
+
return _useSubscriptionOffer.default;
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
var _useSubscriptionOffer = _interopRequireWildcard(require("./useSubscriptionOffer"));
|
|
55
|
+
var _SubscriptionUpsell = _interopRequireWildcard(require("./SubscriptionUpsell"));
|
|
56
|
+
var _SubscriptionUpgradeCard = _interopRequireDefault(require("./SubscriptionUpgradeCard"));
|
|
57
|
+
var _SubscriptionBenefitsModal = _interopRequireWildcard(require("./SubscriptionBenefitsModal"));
|
|
58
|
+
var _SubscriptionComparisonModal = _interopRequireDefault(require("./SubscriptionComparisonModal"));
|
|
59
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
60
|
+
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); }
|
|
61
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["_useSubscriptionOffer","_interopRequireWildcard","require","_SubscriptionUpsell","_SubscriptionUpgradeCard","_interopRequireDefault","_SubscriptionBenefitsModal","_SubscriptionComparisonModal","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor"],"sources":["../../src/subscription-upsell/index.jsx"],"sourcesContent":["export { default as useSubscriptionOffer, SUBSCRIPTION_STATUS } from './useSubscriptionOffer';\nexport { default as SubscriptionUpsell, UPGRADE_STATE } from './SubscriptionUpsell';\nexport { default as SubscriptionUpgradeCard } from './SubscriptionUpgradeCard';\nexport { default as SubscriptionBenefitsModal, BENEFITS_MODAL_VARIANT } from './SubscriptionBenefitsModal';\nexport { default as SubscriptionComparisonModal } from './SubscriptionComparisonModal';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,qBAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,mBAAA,GAAAF,uBAAA,CAAAC,OAAA;AACA,IAAAE,wBAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,0BAAA,GAAAL,uBAAA,CAAAC,OAAA;AACA,IAAAK,4BAAA,GAAAF,sBAAA,CAAAH,OAAA;AAAuF,SAAAG,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAP,wBAAAO,CAAA,EAAAG,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAX,uBAAA,YAAAA,CAAAO,CAAA,EAAAG,CAAA,SAAAA,CAAA,IAAAH,CAAA,IAAAA,CAAA,CAAAC,UAAA,SAAAD,CAAA,MAAAO,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAR,OAAA,EAAAF,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAS,CAAA,MAAAF,CAAA,GAAAJ,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAE,CAAA,CAAAI,GAAA,CAAAX,CAAA,UAAAO,CAAA,CAAAK,GAAA,CAAAZ,CAAA,GAAAO,CAAA,CAAAM,GAAA,CAAAb,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