@edx/frontend-plugin-advertisements 2.3.0 → 2.4.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.
Files changed (28) hide show
  1. package/dist/data/index.js +0 -12
  2. package/dist/data/index.js.map +1 -1
  3. package/dist/data/optimizely.js +1 -22
  4. package/dist/data/optimizely.js.map +1 -1
  5. package/dist/paywall/LockPaywall.js +151 -11
  6. package/dist/paywall/LockPaywall.js.map +1 -1
  7. package/dist/upgrade-modal/NextUnitButton.js +2 -2
  8. package/dist/upgrade-modal/NextUnitButton.js.map +1 -1
  9. package/dist/upgrade-modal/{DefaultUpgradeModal.js → UpgradeModal.js} +8 -9
  10. package/dist/upgrade-modal/UpgradeModal.js.map +1 -0
  11. package/dist/upgrade-notification/UpgradeNotification.js +237 -16
  12. package/dist/upgrade-notification/UpgradeNotification.js.map +1 -1
  13. package/package.json +1 -1
  14. package/dist/optimizely/utils.js +0 -45
  15. package/dist/optimizely/utils.js.map +0 -1
  16. package/dist/paywall/DefaultLockPaywall.js +0 -164
  17. package/dist/paywall/DefaultLockPaywall.js.map +0 -1
  18. package/dist/paywall/ExperimentalLockPaywall.js +0 -197
  19. package/dist/paywall/ExperimentalLockPaywall.js.map +0 -1
  20. package/dist/upgrade-modal/DefaultUpgradeModal.js.map +0 -1
  21. package/dist/upgrade-modal/ExperimentalUpgradeModal.js +0 -188
  22. package/dist/upgrade-modal/ExperimentalUpgradeModal.js.map +0 -1
  23. package/dist/upgrade-modal/UpgradeModalWrapper.js +0 -22
  24. package/dist/upgrade-modal/UpgradeModalWrapper.js.map +0 -1
  25. package/dist/upgrade-notification/DefaultUpgradeNotification.js +0 -261
  26. package/dist/upgrade-notification/DefaultUpgradeNotification.js.map +0 -1
  27. package/dist/upgrade-notification/ExperimentalUpgradeNotification.js +0 -309
  28. package/dist/upgrade-notification/ExperimentalUpgradeNotification.js.map +0 -1
@@ -1,261 +0,0 @@
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 _analytics = require("@edx/frontend-platform/analytics");
12
- var _paragon = require("@openedx/paragon");
13
- var _icons = require("@openedx/paragon/icons");
14
- var _upgradeButton = require("@src/generic/upgrade-button");
15
- var _modelStore = require("@src/generic/model-store");
16
- var _certificatePreview = _interopRequireDefault(require("./certificate-preview"));
17
- var _generic = require("../generic");
18
- var _messages = _interopRequireDefault(require("./messages"));
19
- var _utils = _interopRequireDefault(require("./utils"));
20
- var _data = require("../data");
21
- var _cohesion = require("../cohesion");
22
- var _jsxRuntime = require("react/jsx-runtime");
23
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
24
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
25
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
26
- 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; }
27
- 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; }
28
- 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; }
29
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
30
- 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 */
31
- const DefaultUpgradeNotification = _ref => {
32
- let {
33
- id,
34
- courseId,
35
- model,
36
- setNotificationCurrentState,
37
- toggleSidebar
38
- } = _ref;
39
- const pluginLocationId = id;
40
- const {
41
- formatMessage
42
- } = (0, _i18n.useIntl)();
43
- const {
44
- org,
45
- userTimezone,
46
- verifiedMode
47
- } = (0, _modelStore.useModel)('courseHomeMeta', courseId);
48
- const {
49
- marketingUrl,
50
- learningAssistantEnabled
51
- } = (0, _modelStore.useModel)('coursewareMeta', courseId);
52
- const {
53
- accessExpiration,
54
- datesBannerInfo,
55
- offer,
56
- timeOffsetMillis
57
- } = (0, _modelStore.useModel)(model, courseId);
58
- const {
59
- conversion
60
- } = (0, _cohesion.useCohesion)(courseId);
61
- const dateNow = Date.now();
62
- const timezoneFormatArgs = userTimezone ? {
63
- timeZone: userTimezone
64
- } : {};
65
- const correctedTime = new Date(dateNow + timeOffsetMillis);
66
- const accessExpirationDate = accessExpiration ? new Date(accessExpiration.upgradeDeadline) : null;
67
- const pastExpirationDeadline = accessExpiration ? new Date(dateNow) > accessExpirationDate : false;
68
- const shouldDisplayBorder = pluginLocationId.includes('outline');
69
- const upsellPageName = (0, _utils.default)({
70
- id: pluginLocationId
71
- });
72
- const setupgradeNotificationCurrentState = setNotificationCurrentState;
73
- const isFBE = !!accessExpiration && !!datesBannerInfo?.contentTypeGatingEnabled;
74
- const eventProperties = {
75
- org_key: org,
76
- courserun_key: courseId
77
- };
78
- const promotionEventProperties = _objectSpread({
79
- creative: 'sidebarupsell',
80
- name: 'In-Course Verification Prompt',
81
- position: 'sidebar-message',
82
- promotion_id: 'courseware_verified_certificate_upsell'
83
- }, eventProperties);
84
- (0, _react.useEffect)(() => {
85
- (0, _analytics.sendTrackingLogEvent)('edx.bi.course.upgrade.sidebarupsell.displayed', eventProperties);
86
- (0, _analytics.sendTrackEvent)('Promotion Viewed', promotionEventProperties);
87
- // eslint-disable-next-line react-hooks/exhaustive-deps
88
- }, []);
89
- if (!verifiedMode) {
90
- return null;
91
- }
92
- const logUpgradeClick = () => {
93
- (0, _analytics.sendTrackingLogEvent)('edx.bi.course.upgrade.sidebarupsell.clicked', eventProperties);
94
- (0, _analytics.sendTrackingLogEvent)('edx.course.enrollment.upgrade.clicked', _objectSpread(_objectSpread({}, eventProperties), {}, {
95
- location: 'sidebar-message'
96
- }));
97
- (0, _analytics.sendTrackEvent)('Promotion Clicked', promotionEventProperties);
98
- (0, _analytics.sendTrackEvent)('edx.bi.ecommerce.upsell_links_clicked', _objectSpread(_objectSpread({}, eventProperties), {}, {
99
- linkCategory: 'green_upgrade',
100
- linkName: `${upsellPageName}_green`,
101
- linkType: 'button',
102
- pageName: upsellPageName
103
- }));
104
- conversion('Upgraded');
105
- };
106
- const logClickPastExpiration = () => {
107
- (0, _analytics.sendTrackEvent)('edx.bi.ecommerce.upgrade_notification.past_expiration.button_clicked', _objectSpread(_objectSpread({}, eventProperties), {}, {
108
- linkCategory: 'upgrade_notification',
109
- linkName: `${upsellPageName}_course_details`,
110
- linkType: 'button',
111
- pageName: upsellPageName
112
- }));
113
- };
114
-
115
- /*
116
- There are 5 parts that change in the upgrade card:
117
- upgradeNotificationHeaderText
118
- expirationBanner
119
- upsellMessage
120
- callToActionButton
121
- offerCode
122
- */
123
- let upgradeNotificationHeaderText;
124
- let expirationBanner;
125
- let upsellMessage = /*#__PURE__*/(0, _jsxRuntime.jsx)(_generic.UpsellBullets, {
126
- isFBE,
127
- learningAssistantEnabled
128
- });
129
- let callToActionButton;
130
- let offerCode;
131
- if (isFBE) {
132
- const hoursToAccessExpiration = Math.floor((accessExpirationDate - correctedTime) / 1000 / 60 / 60);
133
- if (hoursToAccessExpiration >= 7 * 24) {
134
- if (offer) {
135
- // countdown to the first purchase discount if there is one
136
- const hoursToDiscountExpiration = Math.floor((new Date(offer.expirationDate) - correctedTime) / 1000 / 60 / 60);
137
- upgradeNotificationHeaderText = formatMessage(_messages.default.firstTimeLearnerDiscountHeader, {
138
- percentage: offer.percentage
139
- });
140
- expirationBanner = /*#__PURE__*/(0, _jsxRuntime.jsx)(_generic.ExpirationCountdown, {
141
- courseId: courseId,
142
- hoursToExpiration: hoursToDiscountExpiration,
143
- setupgradeNotificationCurrentState: setupgradeNotificationCurrentState,
144
- type: "offer"
145
- });
146
- } else {
147
- upgradeNotificationHeaderText = formatMessage(_messages.default.accessExpirationHeader);
148
- expirationBanner = /*#__PURE__*/(0, _jsxRuntime.jsx)(_generic.AccessExpirationDateBanner, {
149
- courseId: courseId,
150
- accessExpirationDate: accessExpirationDate,
151
- timezoneFormatArgs: timezoneFormatArgs,
152
- setupgradeNotificationCurrentState: setupgradeNotificationCurrentState
153
- });
154
- }
155
- } else if (hoursToAccessExpiration < 7 * 24 && hoursToAccessExpiration >= 0) {
156
- // more urgent messaging if there's less than 7 days left to access expiration
157
- upgradeNotificationHeaderText = formatMessage(_messages.default.accessExpirationUrgentHeader);
158
- expirationBanner = /*#__PURE__*/(0, _jsxRuntime.jsx)(_generic.ExpirationCountdown, {
159
- courseId: courseId,
160
- hoursToExpiration: hoursToAccessExpiration,
161
- setupgradeNotificationCurrentState: setupgradeNotificationCurrentState,
162
- type: "access"
163
- });
164
- if (upsellPageName !== _data.PAGE_NAMES.PROGRESS) {
165
- upsellMessage = /*#__PURE__*/(0, _jsxRuntime.jsx)(_generic.UpsellFBESoonCardContent, {
166
- accessExpirationDate: accessExpirationDate,
167
- timezoneFormatArgs: timezoneFormatArgs
168
- });
169
- }
170
- } else {
171
- // access expiration deadline has passed
172
- upgradeNotificationHeaderText = formatMessage(_messages.default.accessExpirationPastHeader);
173
- expirationBanner = /*#__PURE__*/(0, _jsxRuntime.jsx)(_generic.PastExpirationDateBanner, {
174
- courseId: courseId,
175
- accessExpirationDate: accessExpirationDate,
176
- timezoneFormatArgs: timezoneFormatArgs,
177
- setupgradeNotificationCurrentState: setupgradeNotificationCurrentState
178
- });
179
- upsellMessage = /*#__PURE__*/(0, _jsxRuntime.jsx)(_generic.PastExpirationCardContent, {});
180
- }
181
- }
182
- if (pastExpirationDeadline) {
183
- callToActionButton = /*#__PURE__*/(0, _jsxRuntime.jsx)(_paragon.Button, {
184
- variant: "primary",
185
- onClick: logClickPastExpiration,
186
- href: marketingUrl,
187
- block: true,
188
- children: formatMessage(_messages.default.pastExpirationCallToActionLabel)
189
- });
190
- } else {
191
- callToActionButton = /*#__PURE__*/(0, _jsxRuntime.jsx)(_upgradeButton.UpgradeButton, {
192
- offer: offer,
193
- onClick: logUpgradeClick,
194
- verifiedMode: verifiedMode,
195
- block: true
196
- });
197
- }
198
- if (offer) {
199
- // if there's a first purchase discount, message the code at the bottom
200
- offerCode = /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
201
- className: "text-center discount-info",
202
- children: formatMessage(_messages.default.discountCodeMessage, {
203
- code: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
204
- className: "font-weight-bold",
205
- children: offer.code
206
- })
207
- })
208
- });
209
- }
210
- return /*#__PURE__*/(0, _jsxRuntime.jsx)("section", {
211
- className: (0, _classnames.default)('upgrade-notification small', {
212
- 'pgn__card pgn__card-light card mb-4 rounded': shouldDisplayBorder
213
- }),
214
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
215
- id: "courseHome-upgradeNotification",
216
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("h2", {
217
- className: (0, _classnames.default)('upgrade-notification-header', {
218
- 'd-flex align-items-center mr-2 ml-4 my-1.5 font-size-18': !!toggleSidebar,
219
- 'm-4': !toggleSidebar
220
- }),
221
- id: "outline-sidebar-upgrade-header",
222
- children: [formatMessage(_messages.default.pursueCertificateMessage), !!toggleSidebar && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
223
- className: "d-inline-flex ml-auto",
224
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_paragon.IconButton, {
225
- src: _icons.Close,
226
- size: "sm",
227
- iconAs: _paragon.Icon,
228
- onClick: toggleSidebar,
229
- className: "icon-hover",
230
- alt: formatMessage(_messages.default.closeAlt)
231
- })
232
- })]
233
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_certificatePreview.default, {
234
- courseId: courseId
235
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("h3", {
236
- className: "ml-4",
237
- children: upgradeNotificationHeaderText
238
- }), expirationBanner, /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
239
- className: "upgrade-notification-message",
240
- children: upsellMessage
241
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
242
- className: "upgrade-notification-button m-4",
243
- children: callToActionButton
244
- }), offerCode]
245
- })
246
- });
247
- };
248
- DefaultUpgradeNotification.propTypes = {
249
- id: _propTypes.default.string.isRequired,
250
- courseId: _propTypes.default.string.isRequired,
251
- model: _propTypes.default.string,
252
- setNotificationCurrentState: _propTypes.default.func,
253
- toggleSidebar: _propTypes.default.func
254
- };
255
- DefaultUpgradeNotification.defaultProps = {
256
- setNotificationCurrentState: null,
257
- toggleSidebar: null,
258
- model: 'outline'
259
- };
260
- var _default = exports.default = DefaultUpgradeNotification;
261
- //# sourceMappingURL=DefaultUpgradeNotification.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"DefaultUpgradeNotification.js","names":["_react","_interopRequireWildcard","require","_propTypes","_interopRequireDefault","_classnames","_i18n","_analytics","_paragon","_icons","_upgradeButton","_modelStore","_certificatePreview","_generic","_messages","_utils","_data","_cohesion","_jsxRuntime","e","__esModule","default","_getRequireWildcardCache","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","ownKeys","keys","getOwnPropertySymbols","o","filter","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","_toPropertyKey","value","configurable","writable","_toPrimitive","Symbol","toPrimitive","TypeError","String","Number","DefaultUpgradeNotification","_ref","id","courseId","model","setNotificationCurrentState","toggleSidebar","pluginLocationId","formatMessage","useIntl","org","userTimezone","verifiedMode","useModel","marketingUrl","learningAssistantEnabled","accessExpiration","datesBannerInfo","offer","timeOffsetMillis","conversion","useCohesion","dateNow","Date","now","timezoneFormatArgs","timeZone","correctedTime","accessExpirationDate","upgradeDeadline","pastExpirationDeadline","shouldDisplayBorder","includes","upsellPageName","getUpsellPageName","setupgradeNotificationCurrentState","isFBE","contentTypeGatingEnabled","eventProperties","org_key","courserun_key","promotionEventProperties","creative","name","position","promotion_id","useEffect","sendTrackingLogEvent","sendTrackEvent","logUpgradeClick","location","linkCategory","linkName","linkType","pageName","logClickPastExpiration","upgradeNotificationHeaderText","expirationBanner","upsellMessage","jsx","UpsellBullets","callToActionButton","offerCode","hoursToAccessExpiration","Math","floor","hoursToDiscountExpiration","expirationDate","messages","firstTimeLearnerDiscountHeader","percentage","ExpirationCountdown","hoursToExpiration","type","accessExpirationHeader","AccessExpirationDateBanner","accessExpirationUrgentHeader","PAGE_NAMES","PROGRESS","UpsellFBESoonCardContent","accessExpirationPastHeader","PastExpirationDateBanner","PastExpirationCardContent","Button","variant","onClick","href","block","children","pastExpirationCallToActionLabel","UpgradeButton","className","discountCodeMessage","code","classNames","jsxs","pursueCertificateMessage","IconButton","src","Close","size","iconAs","Icon","alt","closeAlt","propTypes","PropTypes","string","isRequired","func","defaultProps","_default","exports"],"sources":["../../src/upgrade-notification/DefaultUpgradeNotification.jsx"],"sourcesContent":["/* eslint import/no-unresolved: 0 */\nimport React, { useEffect } from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\nimport { useIntl } from '@edx/frontend-platform/i18n';\nimport { sendTrackEvent, sendTrackingLogEvent } from '@edx/frontend-platform/analytics';\nimport { Button, Icon, IconButton } from '@openedx/paragon';\nimport { Close } from '@openedx/paragon/icons';\n\nimport { UpgradeButton } from '@src/generic/upgrade-button';\nimport { useModel } from '@src/generic/model-store';\n\nimport CertificatePreview from './certificate-preview';\nimport {\n ExpirationCountdown,\n AccessExpirationDateBanner,\n PastExpirationCardContent,\n PastExpirationDateBanner,\n UpsellFBESoonCardContent,\n UpsellBullets,\n} from '../generic';\nimport messages from './messages';\nimport getUpsellPageName from './utils';\nimport { PAGE_NAMES } from '../data';\nimport { useCohesion } from '../cohesion';\n\nconst DefaultUpgradeNotification = ({\n id,\n courseId,\n model,\n setNotificationCurrentState,\n toggleSidebar,\n}) => {\n const pluginLocationId = id;\n const { formatMessage } = useIntl();\n const {\n org,\n userTimezone,\n verifiedMode,\n } = useModel('courseHomeMeta', courseId);\n\n const {\n marketingUrl,\n learningAssistantEnabled,\n } = useModel('coursewareMeta', courseId);\n\n const {\n accessExpiration,\n datesBannerInfo,\n offer,\n timeOffsetMillis,\n } = useModel(model, courseId);\n\n const { conversion } = useCohesion(courseId);\n\n const dateNow = Date.now();\n const timezoneFormatArgs = userTimezone ? { timeZone: userTimezone } : {};\n const correctedTime = new Date(dateNow + timeOffsetMillis);\n const accessExpirationDate = accessExpiration ? new Date(accessExpiration.upgradeDeadline) : null;\n const pastExpirationDeadline = accessExpiration ? new Date(dateNow) > accessExpirationDate : false;\n const shouldDisplayBorder = pluginLocationId.includes('outline');\n const upsellPageName = getUpsellPageName({ id: pluginLocationId });\n const setupgradeNotificationCurrentState = setNotificationCurrentState;\n const isFBE = !!accessExpiration && !!datesBannerInfo?.contentTypeGatingEnabled;\n\n const eventProperties = {\n org_key: org,\n courserun_key: courseId,\n };\n\n const promotionEventProperties = {\n creative: 'sidebarupsell',\n name: 'In-Course Verification Prompt',\n position: 'sidebar-message',\n promotion_id: 'courseware_verified_certificate_upsell',\n ...eventProperties,\n };\n\n useEffect(() => {\n sendTrackingLogEvent('edx.bi.course.upgrade.sidebarupsell.displayed', eventProperties);\n sendTrackEvent('Promotion Viewed', promotionEventProperties);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n if (!verifiedMode) {\n return null;\n }\n\n const logUpgradeClick = () => {\n sendTrackingLogEvent('edx.bi.course.upgrade.sidebarupsell.clicked', eventProperties);\n sendTrackingLogEvent('edx.course.enrollment.upgrade.clicked', {\n ...eventProperties,\n location: 'sidebar-message',\n });\n sendTrackEvent('Promotion Clicked', promotionEventProperties);\n sendTrackEvent('edx.bi.ecommerce.upsell_links_clicked', {\n ...eventProperties,\n linkCategory: 'green_upgrade',\n linkName: `${upsellPageName}_green`,\n linkType: 'button',\n pageName: upsellPageName,\n });\n\n conversion('Upgraded');\n };\n\n const logClickPastExpiration = () => {\n sendTrackEvent('edx.bi.ecommerce.upgrade_notification.past_expiration.button_clicked', {\n ...eventProperties,\n linkCategory: 'upgrade_notification',\n linkName: `${upsellPageName}_course_details`,\n linkType: 'button',\n pageName: upsellPageName,\n });\n };\n\n /*\n There are 5 parts that change in the upgrade card:\n upgradeNotificationHeaderText\n expirationBanner\n upsellMessage\n callToActionButton\n offerCode\n */\n let upgradeNotificationHeaderText;\n let expirationBanner;\n let upsellMessage = <UpsellBullets {...{ isFBE, learningAssistantEnabled }} />;\n let callToActionButton;\n let offerCode;\n\n if (isFBE) {\n const hoursToAccessExpiration = Math.floor((accessExpirationDate - correctedTime) / 1000 / 60 / 60);\n\n if (hoursToAccessExpiration >= (7 * 24)) {\n if (offer) { // countdown to the first purchase discount if there is one\n const hoursToDiscountExpiration = Math.floor((new Date(offer.expirationDate) - correctedTime) / 1000 / 60 / 60);\n upgradeNotificationHeaderText = formatMessage(\n messages.firstTimeLearnerDiscountHeader,\n { percentage: (offer.percentage) },\n );\n expirationBanner = (\n <ExpirationCountdown\n courseId={courseId}\n hoursToExpiration={hoursToDiscountExpiration}\n setupgradeNotificationCurrentState={setupgradeNotificationCurrentState}\n type=\"offer\"\n />\n );\n } else {\n upgradeNotificationHeaderText = formatMessage(messages.accessExpirationHeader);\n expirationBanner = (\n <AccessExpirationDateBanner\n courseId={courseId}\n accessExpirationDate={accessExpirationDate}\n timezoneFormatArgs={timezoneFormatArgs}\n setupgradeNotificationCurrentState={setupgradeNotificationCurrentState}\n />\n );\n }\n } else if (hoursToAccessExpiration < (7 * 24) && hoursToAccessExpiration >= 0) {\n // more urgent messaging if there's less than 7 days left to access expiration\n upgradeNotificationHeaderText = formatMessage(messages.accessExpirationUrgentHeader);\n expirationBanner = (\n <ExpirationCountdown\n courseId={courseId}\n hoursToExpiration={hoursToAccessExpiration}\n setupgradeNotificationCurrentState={setupgradeNotificationCurrentState}\n type=\"access\"\n />\n );\n if (upsellPageName !== PAGE_NAMES.PROGRESS) {\n upsellMessage = (\n <UpsellFBESoonCardContent\n accessExpirationDate={accessExpirationDate}\n timezoneFormatArgs={timezoneFormatArgs}\n />\n );\n }\n } else { // access expiration deadline has passed\n upgradeNotificationHeaderText = formatMessage(messages.accessExpirationPastHeader);\n expirationBanner = (\n <PastExpirationDateBanner\n courseId={courseId}\n accessExpirationDate={accessExpirationDate}\n timezoneFormatArgs={timezoneFormatArgs}\n setupgradeNotificationCurrentState={setupgradeNotificationCurrentState}\n />\n );\n upsellMessage = (\n <PastExpirationCardContent />\n );\n }\n }\n\n if (pastExpirationDeadline) {\n callToActionButton = (\n <Button\n variant=\"primary\"\n onClick={logClickPastExpiration}\n href={marketingUrl}\n block\n >\n {formatMessage(messages.pastExpirationCallToActionLabel)}\n </Button>\n );\n } else {\n callToActionButton = (\n <UpgradeButton\n offer={offer}\n onClick={logUpgradeClick}\n verifiedMode={verifiedMode}\n block\n />\n );\n }\n\n if (offer) { // if there's a first purchase discount, message the code at the bottom\n offerCode = (\n <div className=\"text-center discount-info\">\n {formatMessage(\n messages.discountCodeMessage,\n {\n code: (<span className=\"font-weight-bold\">{offer.code}</span>),\n },\n )}\n </div>\n );\n }\n\n return (\n <section className={classNames('upgrade-notification small', { 'pgn__card pgn__card-light card mb-4 rounded': shouldDisplayBorder })}>\n <div id=\"courseHome-upgradeNotification\">\n <h2\n className={classNames('upgrade-notification-header', {\n 'd-flex align-items-center mr-2 ml-4 my-1.5 font-size-18': !!toggleSidebar,\n 'm-4': !toggleSidebar,\n })}\n id=\"outline-sidebar-upgrade-header\"\n >\n {formatMessage(messages.pursueCertificateMessage)}\n {!!toggleSidebar && (\n <div className=\"d-inline-flex ml-auto\">\n <IconButton\n src={Close}\n size=\"sm\"\n iconAs={Icon}\n onClick={toggleSidebar}\n className=\"icon-hover\"\n alt={formatMessage(messages.closeAlt)}\n />\n </div>\n )}\n </h2>\n <CertificatePreview courseId={courseId} />\n <h3 className=\"ml-4\">\n {upgradeNotificationHeaderText}\n </h3>\n {expirationBanner}\n <div className=\"upgrade-notification-message\">\n {upsellMessage}\n </div>\n <div className=\"upgrade-notification-button m-4\">\n {callToActionButton}\n </div>\n {offerCode}\n </div>\n </section>\n );\n};\n\nDefaultUpgradeNotification.propTypes = {\n id: PropTypes.string.isRequired,\n courseId: PropTypes.string.isRequired,\n model: PropTypes.string,\n setNotificationCurrentState: PropTypes.func,\n toggleSidebar: PropTypes.func,\n};\n\nDefaultUpgradeNotification.defaultProps = {\n setNotificationCurrentState: null,\n toggleSidebar: null,\n model: 'outline',\n};\n\nexport default DefaultUpgradeNotification;\n"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,I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@@
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 _analytics = require("@edx/frontend-platform/analytics");
12
- var _paragon = require("@openedx/paragon");
13
- var _icons = require("@openedx/paragon/icons");
14
- var _reactSdk = require("@optimizely/react-sdk");
15
- var _upgradeButton = require("@src/generic/upgrade-button");
16
- var _modelStore = require("@src/generic/model-store");
17
- var _utils = _interopRequireDefault(require("../optimizely/utils"));
18
- var _data = require("../data");
19
- var _certificatePreview = _interopRequireDefault(require("./certificate-preview"));
20
- var _generic = require("../generic");
21
- var _utils2 = _interopRequireDefault(require("./utils"));
22
- var _messages = _interopRequireDefault(require("./messages"));
23
- var _cohesion = require("../cohesion");
24
- var _jsxRuntime = require("react/jsx-runtime");
25
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
26
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
27
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
28
- 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; }
29
- 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; }
30
- 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; }
31
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
32
- 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); } /* All of this code includes the necessary functions to run and track an A/B experiment
33
- using Optimizely. Please fully read through the code to know where changes
34
- need to be made specifically for a new test.
35
-
36
- As of 2025-01-08, this code is functionally the same as the
37
- DefaultUpgradeNotification.
38
- */ /* eslint import/no-unresolved: 0 */
39
- const ExperimentalUpgradeNotification = _ref => {
40
- let {
41
- id,
42
- courseId,
43
- model,
44
- setNotificationCurrentState,
45
- toggleSidebar,
46
- optimizely
47
- } = _ref;
48
- const pluginLocationId = id;
49
- const {
50
- formatMessage
51
- } = (0, _i18n.useIntl)();
52
- const {
53
- conversion
54
- } = (0, _cohesion.useCohesion)(courseId);
55
-
56
- /*
57
- Update the following line with the new experiment constants.
58
- KEY and ANY_CLICK_ACTION are required and used in the later in the code.
59
- To update the variables, make changes in ../optimizely/utils
60
- */
61
- const {
62
- KEY: experimentKey,
63
- ANY_CLICK_ACTION
64
- } = _data.OPTIMIZELY_AUDIT_TRIAL_EXPERIMENT;
65
- const {
66
- org,
67
- userTimezone,
68
- verifiedMode
69
- } = (0, _modelStore.useModel)('courseHomeMeta', courseId);
70
- const {
71
- marketingUrl,
72
- learningAssistantEnabled
73
- } = (0, _modelStore.useModel)('coursewareMeta', courseId);
74
- const {
75
- accessExpiration,
76
- datesBannerInfo,
77
- offer,
78
- timeOffsetMillis
79
- } = (0, _modelStore.useModel)(model, courseId);
80
- const dateNow = Date.now();
81
- const timezoneFormatArgs = userTimezone ? {
82
- timeZone: userTimezone
83
- } : {};
84
- const correctedTime = new Date(dateNow + timeOffsetMillis);
85
- const accessExpirationDate = accessExpiration ? new Date(accessExpiration.upgradeDeadline) : null;
86
- const pastExpirationDeadline = accessExpiration ? new Date(dateNow) > accessExpirationDate : false;
87
- const shouldDisplayBorder = pluginLocationId.includes('outline');
88
- const upsellPageName = (0, _utils2.default)({
89
- id: pluginLocationId
90
- });
91
- const setupgradeNotificationCurrentState = setNotificationCurrentState;
92
- const isFBE = !!accessExpiration && !!datesBannerInfo?.contentTypeGatingEnabled;
93
- const [decision] = (0, _reactSdk.useDecision)(experimentKey);
94
- const {
95
- enabled,
96
- variationKey
97
- } = decision;
98
-
99
- // Experiment specific properties or data should not be sent to the tracking logs, so break this
100
- // object out to ensure it is only sent to Segment and not the tracking logs.
101
- const experimentProperties = {
102
- experiment_key: experimentKey,
103
- variation_key: variationKey
104
- };
105
- const eventProperties = {
106
- org_key: org,
107
- courserun_key: courseId
108
- };
109
- const promotionEventProperties = _objectSpread(_objectSpread({
110
- creative: 'sidebarupsell',
111
- name: 'In-Course Verification Prompt',
112
- position: 'sidebar-message',
113
- promotion_id: 'courseware_verified_certificate_upsell'
114
- }, eventProperties), experimentProperties);
115
- (0, _react.useEffect)(() => {
116
- (0, _analytics.sendTrackingLogEvent)('edx.bi.course.upgrade.sidebarupsell.displayed', eventProperties);
117
- (0, _analytics.sendTrackEvent)('Promotion Viewed', promotionEventProperties);
118
- // eslint-disable-next-line react-hooks/exhaustive-deps
119
- }, []);
120
- if (!verifiedMode) {
121
- return null;
122
- }
123
- const logUpgradeClick = () => {
124
- (0, _analytics.sendTrackingLogEvent)('edx.bi.course.upgrade.sidebarupsell.clicked', eventProperties);
125
- (0, _analytics.sendTrackingLogEvent)('edx.course.enrollment.upgrade.clicked', _objectSpread(_objectSpread({}, eventProperties), {}, {
126
- location: 'sidebar-message'
127
- }));
128
- (0, _analytics.sendTrackEvent)('Promotion Clicked', promotionEventProperties);
129
- (0, _analytics.sendTrackEvent)('edx.bi.ecommerce.upsell_links_clicked', _objectSpread(_objectSpread(_objectSpread({}, eventProperties), experimentProperties), {}, {
130
- linkCategory: 'green_upgrade',
131
- linkName: `${upsellPageName}_green`,
132
- linkType: 'button',
133
- pageName: upsellPageName
134
- }));
135
- conversion('Upgraded');
136
-
137
- /*
138
- Confirm that the ANY_CLICK_ACTION matches the event key in Optimizely.
139
- Add any additional tracking for Optimizely here.
140
- */
141
- optimizely.track(ANY_CLICK_ACTION);
142
- };
143
- const logClickPastExpiration = () => {
144
- (0, _analytics.sendTrackEvent)('edx.bi.ecommerce.upgrade_notification.past_expiration.button_clicked', _objectSpread(_objectSpread(_objectSpread({}, eventProperties), experimentProperties), {}, {
145
- linkCategory: 'upgrade_notification',
146
- linkName: `${upsellPageName}_course_details`,
147
- linkType: 'button',
148
- pageName: upsellPageName
149
- }));
150
- };
151
-
152
- /*
153
- There are 5 parts that change in the upgrade card:
154
- upgradeNotificationHeaderText
155
- expirationBanner
156
- upsellMessage
157
- callToActionButton
158
- offerCode
159
- */
160
- let upgradeNotificationHeaderText;
161
- let expirationBanner;
162
- let callToActionButton;
163
- let offerCode;
164
-
165
- /*
166
- Update the enabled variation according to your experiment
167
- */
168
- let upsellMessage = (0, _utils.default)({
169
- enabled,
170
- variationKey,
171
- isFBE,
172
- enabledVariation: /*#__PURE__*/(0, _jsxRuntime.jsx)(_generic.UpsellBullets, {
173
- isFBE,
174
- learningAssistantEnabled
175
- })
176
- });
177
- if (isFBE) {
178
- const hoursToAccessExpiration = Math.floor((accessExpirationDate - correctedTime) / 1000 / 60 / 60);
179
- if (hoursToAccessExpiration >= 7 * 24) {
180
- if (offer) {
181
- // countdown to the first purchase discount if there is one
182
- const hoursToDiscountExpiration = Math.floor((new Date(offer.expirationDate) - correctedTime) / 1000 / 60 / 60);
183
- upgradeNotificationHeaderText = formatMessage(_messages.default.firstTimeLearnerDiscountHeader, {
184
- percentage: offer.percentage
185
- });
186
- expirationBanner = /*#__PURE__*/(0, _jsxRuntime.jsx)(_generic.ExpirationCountdown, {
187
- courseId: courseId,
188
- hoursToExpiration: hoursToDiscountExpiration,
189
- setupgradeNotificationCurrentState: setupgradeNotificationCurrentState,
190
- type: "offer"
191
- });
192
- } else {
193
- upgradeNotificationHeaderText = formatMessage(_messages.default.accessExpirationHeader);
194
- expirationBanner = /*#__PURE__*/(0, _jsxRuntime.jsx)(_generic.AccessExpirationDateBanner, {
195
- courseId: courseId,
196
- accessExpirationDate: accessExpirationDate,
197
- timezoneFormatArgs: timezoneFormatArgs,
198
- setupgradeNotificationCurrentState: setupgradeNotificationCurrentState
199
- });
200
- }
201
- } else if (hoursToAccessExpiration < 7 * 24 && hoursToAccessExpiration >= 0) {
202
- // more urgent messaging if there's less than 7 days left to access expiration
203
- upgradeNotificationHeaderText = formatMessage(_messages.default.accessExpirationUrgentHeader);
204
- expirationBanner = /*#__PURE__*/(0, _jsxRuntime.jsx)(_generic.ExpirationCountdown, {
205
- courseId: courseId,
206
- hoursToExpiration: hoursToAccessExpiration,
207
- setupgradeNotificationCurrentState: setupgradeNotificationCurrentState,
208
- type: "access"
209
- });
210
- if (upsellPageName !== _data.PAGE_NAMES.PROGRESS) {
211
- upsellMessage = /*#__PURE__*/(0, _jsxRuntime.jsx)(_generic.UpsellFBESoonCardContent, {
212
- accessExpirationDate: accessExpirationDate,
213
- timezoneFormatArgs: timezoneFormatArgs
214
- });
215
- }
216
- } else {
217
- // access expiration deadline has passed
218
- upgradeNotificationHeaderText = formatMessage(_messages.default.accessExpirationPastHeader);
219
- expirationBanner = /*#__PURE__*/(0, _jsxRuntime.jsx)(_generic.PastExpirationDateBanner, {
220
- courseId: courseId,
221
- accessExpirationDate: accessExpirationDate,
222
- timezoneFormatArgs: timezoneFormatArgs,
223
- setupgradeNotificationCurrentState: setupgradeNotificationCurrentState
224
- });
225
- upsellMessage = /*#__PURE__*/(0, _jsxRuntime.jsx)(_generic.PastExpirationCardContent, {});
226
- }
227
- }
228
- if (pastExpirationDeadline) {
229
- callToActionButton = /*#__PURE__*/(0, _jsxRuntime.jsx)(_paragon.Button, {
230
- variant: "primary",
231
- onClick: logClickPastExpiration,
232
- href: marketingUrl,
233
- block: true,
234
- children: formatMessage(_messages.default.pastExpirationCallToActionLabel)
235
- });
236
- } else {
237
- callToActionButton = /*#__PURE__*/(0, _jsxRuntime.jsx)(_upgradeButton.UpgradeButton, {
238
- offer: offer,
239
- onClick: logUpgradeClick,
240
- verifiedMode: verifiedMode,
241
- block: true
242
- });
243
- }
244
- if (offer) {
245
- // if there's a first purchase discount, message the code at the bottom
246
- offerCode = /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
247
- className: "text-center discount-info",
248
- children: formatMessage(_messages.default.discountCodeMessage, {
249
- code: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
250
- className: "font-weight-bold",
251
- children: offer.code
252
- })
253
- })
254
- });
255
- }
256
- return /*#__PURE__*/(0, _jsxRuntime.jsx)("section", {
257
- className: (0, _classnames.default)('upgrade-notification small', {
258
- 'pgn__card pgn__card-light card mb-4 rounded': shouldDisplayBorder
259
- }),
260
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
261
- id: "courseHome-upgradeNotification",
262
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("h2", {
263
- className: (0, _classnames.default)('upgrade-notification-header', {
264
- 'd-flex align-items-center mr-2 ml-4 my-1.5 font-size-18': !!toggleSidebar,
265
- 'm-4': !toggleSidebar
266
- }),
267
- id: "outline-sidebar-upgrade-header",
268
- children: [formatMessage(_messages.default.pursueCertificateMessage), !!toggleSidebar && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
269
- className: "d-inline-flex ml-auto",
270
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_paragon.IconButton, {
271
- src: _icons.Close,
272
- size: "sm",
273
- iconAs: _paragon.Icon,
274
- onClick: toggleSidebar,
275
- className: "icon-hover",
276
- alt: formatMessage(_messages.default.closeAlt)
277
- })
278
- })]
279
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_certificatePreview.default, {
280
- courseId: courseId
281
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("h3", {
282
- className: "ml-4",
283
- children: upgradeNotificationHeaderText
284
- }), expirationBanner, /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
285
- className: "upgrade-notification-message",
286
- children: upsellMessage
287
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
288
- className: "upgrade-notification-button m-4",
289
- children: callToActionButton
290
- }), offerCode]
291
- })
292
- });
293
- };
294
- ExperimentalUpgradeNotification.propTypes = {
295
- id: _propTypes.default.string.isRequired,
296
- courseId: _propTypes.default.string.isRequired,
297
- model: _propTypes.default.string,
298
- setNotificationCurrentState: _propTypes.default.func,
299
- toggleSidebar: _propTypes.default.func,
300
- /* eslint-disable-next-line react/forbid-prop-types */
301
- optimizely: _propTypes.default.object.isRequired
302
- };
303
- ExperimentalUpgradeNotification.defaultProps = {
304
- setNotificationCurrentState: null,
305
- toggleSidebar: null,
306
- model: 'outline'
307
- };
308
- var _default = exports.default = (0, _reactSdk.withOptimizely)(ExperimentalUpgradeNotification);
309
- //# sourceMappingURL=ExperimentalUpgradeNotification.js.map