@edx/frontend-plugin-advertisements 1.26.8 → 1.27.1
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/data/index.js +6 -0
- package/dist/data/index.js.map +1 -1
- package/dist/data/optimizely.js +10 -1
- package/dist/data/optimizely.js.map +1 -1
- package/dist/upgrade-modal/UpgradeModal.js +1 -1
- package/dist/upgrade-modal/UpgradeModal.js.map +1 -1
- package/dist/upgrade-notification/DefaultUpgradeNotification.js +33 -288
- package/dist/upgrade-notification/DefaultUpgradeNotification.js.map +1 -1
- package/dist/upgrade-notification/ExperimentalUpgradeNotification.js +81 -303
- package/dist/upgrade-notification/ExperimentalUpgradeNotification.js.map +1 -1
- package/dist/upgrade-notification/UpgradeNotification.js +1 -1
- package/dist/upgrade-notification/UpgradeNotification.js.map +1 -1
- package/dist/upgrade-notification/generic/AccessExpirationDateBanner.js +57 -0
- package/dist/upgrade-notification/generic/AccessExpirationDateBanner.js.map +1 -0
- package/dist/upgrade-notification/generic/ExpirationCountdown.js +102 -0
- package/dist/upgrade-notification/generic/ExpirationCountdown.js.map +1 -0
- package/dist/upgrade-notification/generic/PastExpirationCardContent.js +25 -0
- package/dist/upgrade-notification/generic/PastExpirationCardContent.js.map +1 -0
- package/dist/upgrade-notification/generic/PastExpirationDateBanner.js +57 -0
- package/dist/upgrade-notification/generic/PastExpirationDateBanner.js.map +1 -0
- package/dist/upgrade-notification/generic/UpsellFBESoonCardContent.js +81 -0
- package/dist/upgrade-notification/generic/UpsellFBESoonCardContent.js.map +1 -0
- package/dist/upgrade-notification/generic/UpsellFarAwayCardContent.js +30 -0
- package/dist/upgrade-notification/generic/UpsellFarAwayCardContent.js.map +1 -0
- package/dist/upgrade-notification/generic/index.js +49 -0
- package/dist/upgrade-notification/generic/index.js.map +1 -0
- package/dist/upgrade-notification/messages.js +51 -0
- package/dist/upgrade-notification/messages.js.map +1 -0
- package/dist/upsell-bullets/ExperimentalUpsellBullets.js +75 -31
- package/dist/upsell-bullets/ExperimentalUpsellBullets.js.map +1 -1
- package/dist/upsell-bullets/ExperimentalUpsellTable.js +157 -0
- package/dist/upsell-bullets/ExperimentalUpsellTable.js.map +1 -0
- package/dist/upsell-bullets/ExperimentalUpsellTable.scss +61 -0
- package/dist/upsell-bullets/UpsellBullets.js +61 -52
- package/dist/upsell-bullets/UpsellBullets.js.map +1 -1
- package/dist/upsell-bullets/UpsellBullets.scss +0 -5
- package/dist/upsell-bullets/index.js +0 -19
- package/dist/upsell-bullets/index.js.map +1 -1
- package/dist/upsell-bullets/messages.js +66 -0
- package/dist/upsell-bullets/messages.js.map +1 -0
- package/package.json +1 -6
|
@@ -12,13 +12,14 @@ var _analytics = require("@edx/frontend-platform/analytics");
|
|
|
12
12
|
var _paragon = require("@openedx/paragon");
|
|
13
13
|
var _icons = require("@openedx/paragon/icons");
|
|
14
14
|
var _reactSdk = require("@optimizely/react-sdk");
|
|
15
|
-
var _localStorage = require("@src/data/localStorage");
|
|
16
15
|
var _upgradeButton = require("@src/generic/upgrade-button");
|
|
17
|
-
var _messages = _interopRequireDefault(require("@src/generic/messages"));
|
|
18
16
|
var _modelStore = require("@src/generic/model-store");
|
|
19
17
|
var _data = require("../data");
|
|
18
|
+
var _ExperimentalUpsellTable = _interopRequireDefault(require("../upsell-bullets/ExperimentalUpsellTable"));
|
|
19
|
+
var _ExperimentalUpsellBullets = _interopRequireDefault(require("../upsell-bullets/ExperimentalUpsellBullets"));
|
|
20
20
|
var _certificatePreview = _interopRequireDefault(require("./certificate-preview"));
|
|
21
|
-
var
|
|
21
|
+
var _generic = require("./generic");
|
|
22
|
+
var _messages = _interopRequireDefault(require("./messages"));
|
|
22
23
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
23
24
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
24
25
|
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); }
|
|
@@ -28,259 +29,52 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
28
29
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
29
30
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
30
31
|
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
|
|
32
|
-
className: "fa-ul upgrade-notification-ul pt-0",
|
|
33
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_upsellBullets.VerifiedCertBullet, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_upsellBullets.SupportMissionBullet, {})]
|
|
34
|
-
});
|
|
35
|
-
const ExperimentUpsellNoFBECardContent = () => /*#__PURE__*/(0, _jsxRuntime.jsxs)("ul", {
|
|
36
|
-
className: "fa-ul upgrade-notification-ul pt-0",
|
|
37
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_upsellBullets.VerifiedCertBullet, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_upsellBullets.LifetimeAccessBullet, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_upsellBullets.AdditionalToolsBullet, {})]
|
|
38
|
-
});
|
|
39
|
-
const UpsellFBEFarAwayCardContent = () => /*#__PURE__*/(0, _jsxRuntime.jsxs)("ul", {
|
|
40
|
-
className: "fa-ul upgrade-notification-ul",
|
|
41
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_upsellBullets.VerifiedCertBullet, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_upsellBullets.UnlockGradedBullet, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_upsellBullets.FullAccessBullet, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_upsellBullets.SupportMissionBullet, {})]
|
|
42
|
-
});
|
|
43
|
-
const ExperimentUpsellFBEFarAwayCardContent = () => /*#__PURE__*/(0, _jsxRuntime.jsxs)("ul", {
|
|
44
|
-
className: "fa-ul upgrade-notification-ul",
|
|
45
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_upsellBullets.VerifiedCertBullet, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_upsellBullets.LifetimeAccessBullet, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_upsellBullets.GradesAndFeedbackBullet, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_upsellBullets.AdditionalToolsBullet, {})]
|
|
46
|
-
});
|
|
47
|
-
const UpsellFBESoonCardContent = _ref => {
|
|
32
|
+
const getVariation = _ref => {
|
|
48
33
|
let {
|
|
49
|
-
|
|
50
|
-
|
|
34
|
+
isFBE,
|
|
35
|
+
variationKey,
|
|
36
|
+
enabled
|
|
51
37
|
} = _ref;
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_i18n.FormattedMessage, {
|
|
70
|
-
id: "learning.generic.upgradeNotification.expirationVerifiedCert.benefits",
|
|
71
|
-
defaultMessage: "benefits of upgrading"
|
|
72
|
-
})
|
|
73
|
-
});
|
|
74
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
75
|
-
className: "upgrade-notification-text",
|
|
76
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
|
|
77
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_i18n.FormattedMessage, {
|
|
78
|
-
id: "learning.generic.upgradeNotification.expirationAccessLoss",
|
|
79
|
-
defaultMessage: "You will lose all access to this course, {includingAnyProgress}, on {date}.",
|
|
80
|
-
values: {
|
|
81
|
-
includingAnyProgress,
|
|
82
|
-
date
|
|
83
|
-
}
|
|
84
|
-
})
|
|
85
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
|
|
86
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_i18n.FormattedMessage, {
|
|
87
|
-
id: "learning.generic.upgradeNotification.expirationVerifiedCert",
|
|
88
|
-
defaultMessage: "Upgrading your course enables you to pursue a verified certificate and unlocks numerous features. Learn more about the {benefitsOfUpgrading}.",
|
|
89
|
-
values: {
|
|
90
|
-
benefitsOfUpgrading
|
|
91
|
-
}
|
|
92
|
-
})
|
|
93
|
-
})]
|
|
94
|
-
});
|
|
95
|
-
};
|
|
96
|
-
UpsellFBESoonCardContent.propTypes = {
|
|
97
|
-
accessExpirationDate: _propTypes.default.PropTypes.instanceOf(Date).isRequired,
|
|
98
|
-
timezoneFormatArgs: _propTypes.default.shape({
|
|
99
|
-
timeZone: _propTypes.default.string
|
|
100
|
-
})
|
|
101
|
-
};
|
|
102
|
-
UpsellFBESoonCardContent.defaultProps = {
|
|
103
|
-
timezoneFormatArgs: {}
|
|
104
|
-
};
|
|
105
|
-
const PastExpirationCardContent = () => /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
106
|
-
className: "upgrade-notification-text",
|
|
107
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
|
|
108
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_i18n.FormattedMessage, {
|
|
109
|
-
id: "learning.generic.upgradeNotification.pastExpiration.content",
|
|
110
|
-
defaultMessage: "The upgrade deadline for this course passed. To upgrade, enroll in the next available session."
|
|
111
|
-
})
|
|
112
|
-
})
|
|
113
|
-
});
|
|
114
|
-
const ExpirationCountdown = _ref2 => {
|
|
115
|
-
let {
|
|
116
|
-
courseId,
|
|
117
|
-
hoursToExpiration,
|
|
118
|
-
setupgradeNotificationCurrentState,
|
|
119
|
-
type
|
|
120
|
-
} = _ref2;
|
|
121
|
-
let expirationText;
|
|
122
|
-
if (hoursToExpiration >= 24) {
|
|
123
|
-
// More than 1 day left
|
|
124
|
-
// setupgradeNotificationCurrentState is available in NotificationTray (not course home)
|
|
125
|
-
if (setupgradeNotificationCurrentState) {
|
|
126
|
-
if (type === 'access') {
|
|
127
|
-
setupgradeNotificationCurrentState('accessDaysLeft');
|
|
128
|
-
(0, _localStorage.setLocalStorage)(`upgradeNotificationCurrentState.${courseId}`, 'accessDaysLeft');
|
|
129
|
-
}
|
|
130
|
-
if (type === 'offer') {
|
|
131
|
-
setupgradeNotificationCurrentState('FPDdaysLeft');
|
|
132
|
-
(0, _localStorage.setLocalStorage)(`upgradeNotificationCurrentState.${courseId}`, 'FPDdaysLeft');
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
expirationText = /*#__PURE__*/(0, _jsxRuntime.jsx)(_i18n.FormattedMessage, {
|
|
136
|
-
id: "learning.generic.upgradeNotification.expirationDays",
|
|
137
|
-
defaultMessage: `{dayCount, number} {dayCount, plural,
|
|
138
|
-
one {day}
|
|
139
|
-
other {days}} left`,
|
|
140
|
-
values: {
|
|
141
|
-
dayCount: Math.floor(hoursToExpiration / 24)
|
|
142
|
-
}
|
|
143
|
-
});
|
|
144
|
-
} else if (hoursToExpiration >= 1) {
|
|
145
|
-
// More than 1 hour left
|
|
146
|
-
// setupgradeNotificationCurrentState is available in NotificationTray (not course home)
|
|
147
|
-
if (setupgradeNotificationCurrentState) {
|
|
148
|
-
if (type === 'access') {
|
|
149
|
-
setupgradeNotificationCurrentState('accessHoursLeft');
|
|
150
|
-
(0, _localStorage.setLocalStorage)(`upgradeNotificationCurrentState.${courseId}`, 'accessHoursLeft');
|
|
151
|
-
}
|
|
152
|
-
if (type === 'offer') {
|
|
153
|
-
setupgradeNotificationCurrentState('FPDHoursLeft');
|
|
154
|
-
(0, _localStorage.setLocalStorage)(`upgradeNotificationCurrentState.${courseId}`, 'FPDHoursLeft');
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
expirationText = /*#__PURE__*/(0, _jsxRuntime.jsx)(_i18n.FormattedMessage, {
|
|
158
|
-
id: "learning.generic.upgradeNotification.expirationHours",
|
|
159
|
-
defaultMessage: `{hourCount, number} {hourCount, plural,
|
|
160
|
-
one {hour}
|
|
161
|
-
other {hours}} left`,
|
|
162
|
-
values: {
|
|
163
|
-
hourCount: hoursToExpiration
|
|
164
|
-
}
|
|
165
|
-
});
|
|
166
|
-
} else {
|
|
167
|
-
// Less than 1 hour
|
|
168
|
-
// setupgradeNotificationCurrentState is available in NotificationTray (not course home)
|
|
169
|
-
if (setupgradeNotificationCurrentState) {
|
|
170
|
-
if (type === 'access') {
|
|
171
|
-
setupgradeNotificationCurrentState('accessLastHour');
|
|
172
|
-
(0, _localStorage.setLocalStorage)(`upgradeNotificationCurrentState.${courseId}`, 'accessLastHour');
|
|
173
|
-
}
|
|
174
|
-
if (type === 'offer') {
|
|
175
|
-
setupgradeNotificationCurrentState('FPDLastHour');
|
|
176
|
-
(0, _localStorage.setLocalStorage)(`upgradeNotificationCurrentState.${courseId}`, 'FPDLastHour');
|
|
177
|
-
}
|
|
38
|
+
const {
|
|
39
|
+
VARIATIONS
|
|
40
|
+
} = _data.OPTIMIZELY_VTR_SIDEBAR_EXPERIMENT;
|
|
41
|
+
if (enabled) {
|
|
42
|
+
switch (variationKey) {
|
|
43
|
+
case VARIATIONS.TABLE:
|
|
44
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ExperimentalUpsellTable.default, {
|
|
45
|
+
isFBE
|
|
46
|
+
});
|
|
47
|
+
case VARIATIONS.BULLETS:
|
|
48
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ExperimentalUpsellBullets.default, {
|
|
49
|
+
isFBE
|
|
50
|
+
});
|
|
51
|
+
default:
|
|
52
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_generic.UpsellFarAwayCardContent, {
|
|
53
|
+
isFBE
|
|
54
|
+
});
|
|
178
55
|
}
|
|
179
|
-
expirationText = /*#__PURE__*/(0, _jsxRuntime.jsx)(_i18n.FormattedMessage, {
|
|
180
|
-
id: "learning.generic.upgradeNotification.expirationMinutes",
|
|
181
|
-
defaultMessage: "Less than 1 hour left"
|
|
182
|
-
});
|
|
183
|
-
}
|
|
184
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
185
|
-
className: "upsell-warning",
|
|
186
|
-
children: expirationText
|
|
187
|
-
});
|
|
188
|
-
};
|
|
189
|
-
ExpirationCountdown.propTypes = {
|
|
190
|
-
courseId: _propTypes.default.string.isRequired,
|
|
191
|
-
hoursToExpiration: _propTypes.default.number.isRequired,
|
|
192
|
-
setupgradeNotificationCurrentState: _propTypes.default.func,
|
|
193
|
-
type: _propTypes.default.string
|
|
194
|
-
};
|
|
195
|
-
ExpirationCountdown.defaultProps = {
|
|
196
|
-
setupgradeNotificationCurrentState: null,
|
|
197
|
-
type: null
|
|
198
|
-
};
|
|
199
|
-
const AccessExpirationDateBanner = _ref3 => {
|
|
200
|
-
let {
|
|
201
|
-
courseId,
|
|
202
|
-
accessExpirationDate,
|
|
203
|
-
timezoneFormatArgs,
|
|
204
|
-
setupgradeNotificationCurrentState
|
|
205
|
-
} = _ref3;
|
|
206
|
-
if (setupgradeNotificationCurrentState) {
|
|
207
|
-
setupgradeNotificationCurrentState('accessDateView');
|
|
208
|
-
(0, _localStorage.setLocalStorage)(`upgradeNotificationCurrentState.${courseId}`, 'accessDateView');
|
|
209
56
|
}
|
|
210
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
211
|
-
|
|
212
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_i18n.FormattedMessage, {
|
|
213
|
-
id: "learning.generic.upgradeNotification.expiration",
|
|
214
|
-
defaultMessage: "Course access will expire {date}",
|
|
215
|
-
values: {
|
|
216
|
-
date: /*#__PURE__*/(0, _jsxRuntime.jsx)(_i18n.FormattedDate, _objectSpread({
|
|
217
|
-
day: "numeric",
|
|
218
|
-
month: "long",
|
|
219
|
-
value: accessExpirationDate
|
|
220
|
-
}, timezoneFormatArgs), "accessExpireDate")
|
|
221
|
-
}
|
|
222
|
-
})
|
|
57
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_generic.UpsellFarAwayCardContent, {
|
|
58
|
+
isFBE
|
|
223
59
|
});
|
|
224
60
|
};
|
|
225
|
-
|
|
226
|
-
courseId: _propTypes.default.string.isRequired,
|
|
227
|
-
accessExpirationDate: _propTypes.default.PropTypes.instanceOf(Date).isRequired,
|
|
228
|
-
timezoneFormatArgs: _propTypes.default.shape({
|
|
229
|
-
timeZone: _propTypes.default.string
|
|
230
|
-
}),
|
|
231
|
-
setupgradeNotificationCurrentState: _propTypes.default.func
|
|
232
|
-
};
|
|
233
|
-
AccessExpirationDateBanner.defaultProps = {
|
|
234
|
-
timezoneFormatArgs: {},
|
|
235
|
-
setupgradeNotificationCurrentState: null
|
|
236
|
-
};
|
|
237
|
-
const PastExpirationDateBanner = _ref4 => {
|
|
238
|
-
let {
|
|
239
|
-
courseId,
|
|
240
|
-
accessExpirationDate,
|
|
241
|
-
timezoneFormatArgs,
|
|
242
|
-
setupgradeNotificationCurrentState
|
|
243
|
-
} = _ref4;
|
|
244
|
-
if (setupgradeNotificationCurrentState) {
|
|
245
|
-
setupgradeNotificationCurrentState('PastExpirationDate');
|
|
246
|
-
(0, _localStorage.setLocalStorage)(`upgradeNotificationCurrentState.${courseId}`, 'PastExpirationDate');
|
|
247
|
-
}
|
|
248
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
249
|
-
className: "upsell-warning",
|
|
250
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_i18n.FormattedMessage, {
|
|
251
|
-
id: "learning.generic.upgradeNotification.pastExpiration.banner",
|
|
252
|
-
defaultMessage: "Upgrade deadline passed on {date}",
|
|
253
|
-
values: {
|
|
254
|
-
date: /*#__PURE__*/(0, _jsxRuntime.jsx)(_i18n.FormattedDate, _objectSpread({
|
|
255
|
-
day: "numeric",
|
|
256
|
-
month: "long",
|
|
257
|
-
value: accessExpirationDate
|
|
258
|
-
}, timezoneFormatArgs), "accessExpireDate")
|
|
259
|
-
}
|
|
260
|
-
})
|
|
261
|
-
});
|
|
262
|
-
};
|
|
263
|
-
PastExpirationDateBanner.propTypes = {
|
|
264
|
-
courseId: _propTypes.default.string.isRequired,
|
|
265
|
-
accessExpirationDate: _propTypes.default.PropTypes.instanceOf(Date).isRequired,
|
|
266
|
-
timezoneFormatArgs: _propTypes.default.shape({
|
|
267
|
-
timeZone: _propTypes.default.string
|
|
268
|
-
}),
|
|
269
|
-
setupgradeNotificationCurrentState: _propTypes.default.func
|
|
270
|
-
};
|
|
271
|
-
PastExpirationDateBanner.defaultProps = {
|
|
272
|
-
timezoneFormatArgs: {},
|
|
273
|
-
setupgradeNotificationCurrentState: null
|
|
274
|
-
};
|
|
275
|
-
const ExperimentalUpgradeNotification = _ref5 => {
|
|
61
|
+
const ExperimentalUpgradeNotification = _ref2 => {
|
|
276
62
|
let {
|
|
277
63
|
id,
|
|
278
64
|
courseId,
|
|
279
65
|
setNotificationCurrentState,
|
|
280
66
|
toggleSidebar,
|
|
281
67
|
optimizely
|
|
282
|
-
} =
|
|
68
|
+
} = _ref2;
|
|
283
69
|
const pluginLocationId = id;
|
|
70
|
+
const {
|
|
71
|
+
KEY: experimentKey,
|
|
72
|
+
VARIATIONS,
|
|
73
|
+
ACTION
|
|
74
|
+
} = _data.OPTIMIZELY_VTR_SIDEBAR_EXPERIMENT;
|
|
75
|
+
const {
|
|
76
|
+
formatMessage
|
|
77
|
+
} = (0, _i18n.useIntl)();
|
|
284
78
|
const {
|
|
285
79
|
org,
|
|
286
80
|
userTimezone,
|
|
@@ -295,7 +89,6 @@ const ExperimentalUpgradeNotification = _ref5 => {
|
|
|
295
89
|
offer,
|
|
296
90
|
timeOffsetMillis
|
|
297
91
|
} = (0, _modelStore.useModel)('outline', courseId);
|
|
298
|
-
const intl = (0, _i18n.useIntl)();
|
|
299
92
|
const dateNow = Date.now();
|
|
300
93
|
const timezoneFormatArgs = userTimezone ? {
|
|
301
94
|
timeZone: userTimezone
|
|
@@ -303,10 +96,11 @@ const ExperimentalUpgradeNotification = _ref5 => {
|
|
|
303
96
|
const correctedTime = new Date(dateNow + timeOffsetMillis);
|
|
304
97
|
const accessExpirationDate = accessExpiration ? new Date(accessExpiration.expirationDate) : null;
|
|
305
98
|
const pastExpirationDeadline = accessExpiration ? new Date(dateNow) > accessExpirationDate : false;
|
|
306
|
-
const shouldDisplayBorder = pluginLocationId
|
|
99
|
+
const shouldDisplayBorder = pluginLocationId.includes('outline');
|
|
307
100
|
const upsellPageName = pluginLocationId === 'outline_tab_notifications' ? 'course_home' : 'in_course';
|
|
308
101
|
const setupgradeNotificationCurrentState = setNotificationCurrentState;
|
|
309
|
-
const
|
|
102
|
+
const isFBE = !!accessExpiration && !!datesBannerInfo?.contentTypeGatingEnabled;
|
|
103
|
+
const [decision] = (0, _reactSdk.useDecision)(experimentKey);
|
|
310
104
|
const {
|
|
311
105
|
enabled,
|
|
312
106
|
variationKey
|
|
@@ -315,7 +109,7 @@ const ExperimentalUpgradeNotification = _ref5 => {
|
|
|
315
109
|
// Experiment specific properties or data should not be sent to the tracking logs, so break this
|
|
316
110
|
// object out to ensure it is only sent to Segment and not the tracking logs.
|
|
317
111
|
const experimentProperties = {
|
|
318
|
-
experiment_key:
|
|
112
|
+
experiment_key: experimentKey,
|
|
319
113
|
variation_key: variationKey
|
|
320
114
|
};
|
|
321
115
|
const eventProperties = {
|
|
@@ -348,7 +142,7 @@ const ExperimentalUpgradeNotification = _ref5 => {
|
|
|
348
142
|
linkType: 'button',
|
|
349
143
|
pageName: upsellPageName
|
|
350
144
|
}));
|
|
351
|
-
optimizely.track(
|
|
145
|
+
optimizely.track(ACTION);
|
|
352
146
|
};
|
|
353
147
|
const logClickPastExpiration = () => {
|
|
354
148
|
(0, _analytics.sendTrackEvent)('edx.bi.ecommerce.upgrade_notification.past_expiration.button_clicked', _objectSpread(_objectSpread(_objectSpread({}, eventProperties), experimentProperties), {}, {
|
|
@@ -369,78 +163,63 @@ const ExperimentalUpgradeNotification = _ref5 => {
|
|
|
369
163
|
*/
|
|
370
164
|
let upgradeNotificationHeaderText;
|
|
371
165
|
let expirationBanner;
|
|
372
|
-
let upsellMessage
|
|
166
|
+
let upsellMessage = getVariation({
|
|
167
|
+
enabled,
|
|
168
|
+
variationKey,
|
|
169
|
+
isFBE
|
|
170
|
+
});
|
|
373
171
|
let callToActionButton;
|
|
374
172
|
let offerCode;
|
|
375
|
-
if (
|
|
173
|
+
if (isFBE) {
|
|
376
174
|
const hoursToAccessExpiration = Math.floor((accessExpirationDate - correctedTime) / 1000 / 60 / 60);
|
|
377
175
|
if (hoursToAccessExpiration >= 7 * 24) {
|
|
378
176
|
if (offer) {
|
|
379
177
|
// countdown to the first purchase discount if there is one
|
|
380
178
|
const hoursToDiscountExpiration = Math.floor((new Date(offer.expirationDate) - correctedTime) / 1000 / 60 / 60);
|
|
381
|
-
upgradeNotificationHeaderText =
|
|
382
|
-
|
|
383
|
-
defaultMessage: "{percentage}% First-Time Learner Discount",
|
|
384
|
-
values: {
|
|
385
|
-
percentage: offer.percentage
|
|
386
|
-
}
|
|
179
|
+
upgradeNotificationHeaderText = formatMessage(_messages.default.firstTimeLearnerDiscountHeader, {
|
|
180
|
+
percentage: offer.percentage
|
|
387
181
|
});
|
|
388
|
-
expirationBanner = /*#__PURE__*/(0, _jsxRuntime.jsx)(ExpirationCountdown, {
|
|
182
|
+
expirationBanner = /*#__PURE__*/(0, _jsxRuntime.jsx)(_generic.ExpirationCountdown, {
|
|
389
183
|
courseId: courseId,
|
|
390
184
|
hoursToExpiration: hoursToDiscountExpiration,
|
|
391
185
|
setupgradeNotificationCurrentState: setupgradeNotificationCurrentState,
|
|
392
186
|
type: "offer"
|
|
393
187
|
});
|
|
394
188
|
} else {
|
|
395
|
-
upgradeNotificationHeaderText =
|
|
396
|
-
|
|
397
|
-
defaultMessage: "Upgrade your course today"
|
|
398
|
-
});
|
|
399
|
-
expirationBanner = /*#__PURE__*/(0, _jsxRuntime.jsx)(AccessExpirationDateBanner, {
|
|
189
|
+
upgradeNotificationHeaderText = formatMessage(_messages.default.accessExpirationHeader);
|
|
190
|
+
expirationBanner = /*#__PURE__*/(0, _jsxRuntime.jsx)(_generic.AccessExpirationDateBanner, {
|
|
400
191
|
courseId: courseId,
|
|
401
192
|
accessExpirationDate: accessExpirationDate,
|
|
402
193
|
timezoneFormatArgs: timezoneFormatArgs,
|
|
403
194
|
setupgradeNotificationCurrentState: setupgradeNotificationCurrentState
|
|
404
195
|
});
|
|
405
196
|
}
|
|
406
|
-
upsellMessage = variationKey === _data.OPTIMIZELY_VTR_COPY_CHANGE_EXPERIMENT_VARIATION_KEYS.CERTIFICATE_PREVIEW_WITH_COPY && enabled ? /*#__PURE__*/(0, _jsxRuntime.jsx)(ExperimentUpsellFBEFarAwayCardContent, {}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(UpsellFBEFarAwayCardContent, {});
|
|
407
197
|
} else if (hoursToAccessExpiration < 7 * 24 && hoursToAccessExpiration >= 0) {
|
|
408
198
|
// more urgent messaging if there's less than 7 days left to access expiration
|
|
409
|
-
upgradeNotificationHeaderText =
|
|
410
|
-
|
|
411
|
-
defaultMessage: "Course Access Expiration"
|
|
412
|
-
});
|
|
413
|
-
expirationBanner = /*#__PURE__*/(0, _jsxRuntime.jsx)(ExpirationCountdown, {
|
|
199
|
+
upgradeNotificationHeaderText = formatMessage(_messages.default.accessExpirationUrgentHeader);
|
|
200
|
+
expirationBanner = /*#__PURE__*/(0, _jsxRuntime.jsx)(_generic.ExpirationCountdown, {
|
|
414
201
|
courseId: courseId,
|
|
415
202
|
hoursToExpiration: hoursToAccessExpiration,
|
|
416
203
|
setupgradeNotificationCurrentState: setupgradeNotificationCurrentState,
|
|
417
204
|
type: "access"
|
|
418
205
|
});
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
206
|
+
if (variationKey === VARIATIONS.OFF) {
|
|
207
|
+
upsellMessage = /*#__PURE__*/(0, _jsxRuntime.jsx)(_generic.UpsellFBESoonCardContent, {
|
|
208
|
+
accessExpirationDate: accessExpirationDate,
|
|
209
|
+
timezoneFormatArgs: timezoneFormatArgs
|
|
210
|
+
});
|
|
211
|
+
}
|
|
423
212
|
} else {
|
|
424
213
|
// access expiration deadline has passed
|
|
425
|
-
upgradeNotificationHeaderText =
|
|
426
|
-
|
|
427
|
-
defaultMessage: "Course Access Expiration"
|
|
428
|
-
});
|
|
429
|
-
expirationBanner = /*#__PURE__*/(0, _jsxRuntime.jsx)(PastExpirationDateBanner, {
|
|
214
|
+
upgradeNotificationHeaderText = formatMessage(_messages.default.accessExpirationPastHeader);
|
|
215
|
+
expirationBanner = /*#__PURE__*/(0, _jsxRuntime.jsx)(_generic.PastExpirationDateBanner, {
|
|
430
216
|
courseId: courseId,
|
|
431
217
|
accessExpirationDate: accessExpirationDate,
|
|
432
218
|
timezoneFormatArgs: timezoneFormatArgs,
|
|
433
219
|
setupgradeNotificationCurrentState: setupgradeNotificationCurrentState
|
|
434
220
|
});
|
|
435
|
-
upsellMessage = /*#__PURE__*/(0, _jsxRuntime.jsx)(PastExpirationCardContent, {});
|
|
221
|
+
upsellMessage = /*#__PURE__*/(0, _jsxRuntime.jsx)(_generic.PastExpirationCardContent, {});
|
|
436
222
|
}
|
|
437
|
-
} else {
|
|
438
|
-
// FBE is turned off
|
|
439
|
-
upgradeNotificationHeaderText = /*#__PURE__*/(0, _jsxRuntime.jsx)(_i18n.FormattedMessage, {
|
|
440
|
-
id: "learning.generic.upgradeNotification.pursueAverifiedCertificate",
|
|
441
|
-
defaultMessage: "Pursue a verified certificate"
|
|
442
|
-
});
|
|
443
|
-
upsellMessage = variationKey === _data.OPTIMIZELY_VTR_COPY_CHANGE_EXPERIMENT_VARIATION_KEYS.CERTIFICATE_PREVIEW_WITH_COPY && enabled ? /*#__PURE__*/(0, _jsxRuntime.jsx)(ExperimentUpsellNoFBECardContent, {}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(UpsellNoFBECardContent, {});
|
|
444
223
|
}
|
|
445
224
|
if (pastExpirationDeadline) {
|
|
446
225
|
callToActionButton = /*#__PURE__*/(0, _jsxRuntime.jsx)(_paragon.Button, {
|
|
@@ -448,7 +227,7 @@ const ExperimentalUpgradeNotification = _ref5 => {
|
|
|
448
227
|
onClick: logClickPastExpiration,
|
|
449
228
|
href: marketingUrl,
|
|
450
229
|
block: true,
|
|
451
|
-
children:
|
|
230
|
+
children: formatMessage(_messages.default.pastExpirationCallToActionLabel)
|
|
452
231
|
});
|
|
453
232
|
} else {
|
|
454
233
|
callToActionButton = /*#__PURE__*/(0, _jsxRuntime.jsx)(_upgradeButton.UpgradeButton, {
|
|
@@ -462,32 +241,26 @@ const ExperimentalUpgradeNotification = _ref5 => {
|
|
|
462
241
|
// if there's a first purchase discount, message the code at the bottom
|
|
463
242
|
offerCode = /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
464
243
|
className: "text-center discount-info",
|
|
465
|
-
children:
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
className: "font-weight-bold",
|
|
471
|
-
children: offer.code
|
|
472
|
-
})
|
|
473
|
-
}
|
|
244
|
+
children: formatMessage(_messages.default.discountCodeMessage, {
|
|
245
|
+
code: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
246
|
+
className: "font-weight-bold",
|
|
247
|
+
children: offer.code
|
|
248
|
+
})
|
|
474
249
|
})
|
|
475
250
|
});
|
|
476
251
|
}
|
|
477
252
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("section", {
|
|
478
253
|
className: (0, _classnames.default)('upgrade-notification small', {
|
|
479
|
-
'card mb-4': shouldDisplayBorder
|
|
254
|
+
'pgn__card pgn__card-light card mb-4 rounded': shouldDisplayBorder
|
|
480
255
|
}),
|
|
481
256
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
482
257
|
id: "courseHome-upgradeNotification",
|
|
483
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.
|
|
484
|
-
|
|
485
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("h2", {
|
|
486
|
-
className: (0, _classnames.default)('h5 upgrade-notification-header', {
|
|
258
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("h2", {
|
|
259
|
+
className: (0, _classnames.default)('upgrade-notification-header', {
|
|
487
260
|
'd-flex align-items-center mr-2 ml-4 my-1.5 font-size-18': !!toggleSidebar
|
|
488
261
|
}),
|
|
489
262
|
id: "outline-sidebar-upgrade-header",
|
|
490
|
-
children: [
|
|
263
|
+
children: [formatMessage(_messages.default.pursueCertificateMessage), !!toggleSidebar && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
491
264
|
className: "d-inline-flex ml-auto",
|
|
492
265
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_paragon.IconButton, {
|
|
493
266
|
src: _icons.Close,
|
|
@@ -495,9 +268,14 @@ const ExperimentalUpgradeNotification = _ref5 => {
|
|
|
495
268
|
iconAs: _paragon.Icon,
|
|
496
269
|
onClick: toggleSidebar,
|
|
497
270
|
className: "icon-hover",
|
|
498
|
-
alt:
|
|
271
|
+
alt: formatMessage(_messages.default.closeAlt)
|
|
499
272
|
})
|
|
500
273
|
})]
|
|
274
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_certificatePreview.default, {
|
|
275
|
+
courseId: courseId
|
|
276
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("h3", {
|
|
277
|
+
className: "ml-4",
|
|
278
|
+
children: upgradeNotificationHeaderText
|
|
501
279
|
}), expirationBanner, /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
502
280
|
className: "upgrade-notification-message",
|
|
503
281
|
children: upsellMessage
|
|
@@ -520,5 +298,5 @@ ExperimentalUpgradeNotification.defaultProps = {
|
|
|
520
298
|
setNotificationCurrentState: null,
|
|
521
299
|
toggleSidebar: null
|
|
522
300
|
};
|
|
523
|
-
var _default = exports.default = (0,
|
|
301
|
+
var _default = exports.default = (0, _reactSdk.withOptimizely)(ExperimentalUpgradeNotification);
|
|
524
302
|
//# sourceMappingURL=ExperimentalUpgradeNotification.js.map
|