@edx/frontend-plugin-advertisements 1.26.8 → 1.27.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/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 +79 -302
- 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,51 @@ 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
|
+
} = _data.OPTIMIZELY_VTR_SIDEBAR_EXPERIMENT;
|
|
74
|
+
const {
|
|
75
|
+
formatMessage
|
|
76
|
+
} = (0, _i18n.useIntl)();
|
|
284
77
|
const {
|
|
285
78
|
org,
|
|
286
79
|
userTimezone,
|
|
@@ -295,7 +88,6 @@ const ExperimentalUpgradeNotification = _ref5 => {
|
|
|
295
88
|
offer,
|
|
296
89
|
timeOffsetMillis
|
|
297
90
|
} = (0, _modelStore.useModel)('outline', courseId);
|
|
298
|
-
const intl = (0, _i18n.useIntl)();
|
|
299
91
|
const dateNow = Date.now();
|
|
300
92
|
const timezoneFormatArgs = userTimezone ? {
|
|
301
93
|
timeZone: userTimezone
|
|
@@ -303,10 +95,11 @@ const ExperimentalUpgradeNotification = _ref5 => {
|
|
|
303
95
|
const correctedTime = new Date(dateNow + timeOffsetMillis);
|
|
304
96
|
const accessExpirationDate = accessExpiration ? new Date(accessExpiration.expirationDate) : null;
|
|
305
97
|
const pastExpirationDeadline = accessExpiration ? new Date(dateNow) > accessExpirationDate : false;
|
|
306
|
-
const shouldDisplayBorder = pluginLocationId
|
|
98
|
+
const shouldDisplayBorder = pluginLocationId.includes('outline');
|
|
307
99
|
const upsellPageName = pluginLocationId === 'outline_tab_notifications' ? 'course_home' : 'in_course';
|
|
308
100
|
const setupgradeNotificationCurrentState = setNotificationCurrentState;
|
|
309
|
-
const
|
|
101
|
+
const isFBE = !!accessExpiration && !!datesBannerInfo?.contentTypeGatingEnabled;
|
|
102
|
+
const [decision] = (0, _reactSdk.useDecision)(experimentKey);
|
|
310
103
|
const {
|
|
311
104
|
enabled,
|
|
312
105
|
variationKey
|
|
@@ -315,7 +108,7 @@ const ExperimentalUpgradeNotification = _ref5 => {
|
|
|
315
108
|
// Experiment specific properties or data should not be sent to the tracking logs, so break this
|
|
316
109
|
// object out to ensure it is only sent to Segment and not the tracking logs.
|
|
317
110
|
const experimentProperties = {
|
|
318
|
-
experiment_key:
|
|
111
|
+
experiment_key: experimentKey,
|
|
319
112
|
variation_key: variationKey
|
|
320
113
|
};
|
|
321
114
|
const eventProperties = {
|
|
@@ -369,78 +162,63 @@ const ExperimentalUpgradeNotification = _ref5 => {
|
|
|
369
162
|
*/
|
|
370
163
|
let upgradeNotificationHeaderText;
|
|
371
164
|
let expirationBanner;
|
|
372
|
-
let upsellMessage
|
|
165
|
+
let upsellMessage = getVariation({
|
|
166
|
+
enabled,
|
|
167
|
+
variationKey,
|
|
168
|
+
isFBE
|
|
169
|
+
});
|
|
373
170
|
let callToActionButton;
|
|
374
171
|
let offerCode;
|
|
375
|
-
if (
|
|
172
|
+
if (isFBE) {
|
|
376
173
|
const hoursToAccessExpiration = Math.floor((accessExpirationDate - correctedTime) / 1000 / 60 / 60);
|
|
377
174
|
if (hoursToAccessExpiration >= 7 * 24) {
|
|
378
175
|
if (offer) {
|
|
379
176
|
// countdown to the first purchase discount if there is one
|
|
380
177
|
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
|
-
}
|
|
178
|
+
upgradeNotificationHeaderText = formatMessage(_messages.default.firstTimeLearnerDiscountHeader, {
|
|
179
|
+
percentage: offer.percentage
|
|
387
180
|
});
|
|
388
|
-
expirationBanner = /*#__PURE__*/(0, _jsxRuntime.jsx)(ExpirationCountdown, {
|
|
181
|
+
expirationBanner = /*#__PURE__*/(0, _jsxRuntime.jsx)(_generic.ExpirationCountdown, {
|
|
389
182
|
courseId: courseId,
|
|
390
183
|
hoursToExpiration: hoursToDiscountExpiration,
|
|
391
184
|
setupgradeNotificationCurrentState: setupgradeNotificationCurrentState,
|
|
392
185
|
type: "offer"
|
|
393
186
|
});
|
|
394
187
|
} else {
|
|
395
|
-
upgradeNotificationHeaderText =
|
|
396
|
-
|
|
397
|
-
defaultMessage: "Upgrade your course today"
|
|
398
|
-
});
|
|
399
|
-
expirationBanner = /*#__PURE__*/(0, _jsxRuntime.jsx)(AccessExpirationDateBanner, {
|
|
188
|
+
upgradeNotificationHeaderText = formatMessage(_messages.default.accessExpirationHeader);
|
|
189
|
+
expirationBanner = /*#__PURE__*/(0, _jsxRuntime.jsx)(_generic.AccessExpirationDateBanner, {
|
|
400
190
|
courseId: courseId,
|
|
401
191
|
accessExpirationDate: accessExpirationDate,
|
|
402
192
|
timezoneFormatArgs: timezoneFormatArgs,
|
|
403
193
|
setupgradeNotificationCurrentState: setupgradeNotificationCurrentState
|
|
404
194
|
});
|
|
405
195
|
}
|
|
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
196
|
} else if (hoursToAccessExpiration < 7 * 24 && hoursToAccessExpiration >= 0) {
|
|
408
197
|
// 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, {
|
|
198
|
+
upgradeNotificationHeaderText = formatMessage(_messages.default.accessExpirationUrgentHeader);
|
|
199
|
+
expirationBanner = /*#__PURE__*/(0, _jsxRuntime.jsx)(_generic.ExpirationCountdown, {
|
|
414
200
|
courseId: courseId,
|
|
415
201
|
hoursToExpiration: hoursToAccessExpiration,
|
|
416
202
|
setupgradeNotificationCurrentState: setupgradeNotificationCurrentState,
|
|
417
203
|
type: "access"
|
|
418
204
|
});
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
205
|
+
if (variationKey === VARIATIONS.OFF) {
|
|
206
|
+
upsellMessage = /*#__PURE__*/(0, _jsxRuntime.jsx)(_generic.UpsellFBESoonCardContent, {
|
|
207
|
+
accessExpirationDate: accessExpirationDate,
|
|
208
|
+
timezoneFormatArgs: timezoneFormatArgs
|
|
209
|
+
});
|
|
210
|
+
}
|
|
423
211
|
} else {
|
|
424
212
|
// access expiration deadline has passed
|
|
425
|
-
upgradeNotificationHeaderText =
|
|
426
|
-
|
|
427
|
-
defaultMessage: "Course Access Expiration"
|
|
428
|
-
});
|
|
429
|
-
expirationBanner = /*#__PURE__*/(0, _jsxRuntime.jsx)(PastExpirationDateBanner, {
|
|
213
|
+
upgradeNotificationHeaderText = formatMessage(_messages.default.accessExpirationPastHeader);
|
|
214
|
+
expirationBanner = /*#__PURE__*/(0, _jsxRuntime.jsx)(_generic.PastExpirationDateBanner, {
|
|
430
215
|
courseId: courseId,
|
|
431
216
|
accessExpirationDate: accessExpirationDate,
|
|
432
217
|
timezoneFormatArgs: timezoneFormatArgs,
|
|
433
218
|
setupgradeNotificationCurrentState: setupgradeNotificationCurrentState
|
|
434
219
|
});
|
|
435
|
-
upsellMessage = /*#__PURE__*/(0, _jsxRuntime.jsx)(PastExpirationCardContent, {});
|
|
220
|
+
upsellMessage = /*#__PURE__*/(0, _jsxRuntime.jsx)(_generic.PastExpirationCardContent, {});
|
|
436
221
|
}
|
|
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
222
|
}
|
|
445
223
|
if (pastExpirationDeadline) {
|
|
446
224
|
callToActionButton = /*#__PURE__*/(0, _jsxRuntime.jsx)(_paragon.Button, {
|
|
@@ -448,7 +226,7 @@ const ExperimentalUpgradeNotification = _ref5 => {
|
|
|
448
226
|
onClick: logClickPastExpiration,
|
|
449
227
|
href: marketingUrl,
|
|
450
228
|
block: true,
|
|
451
|
-
children:
|
|
229
|
+
children: formatMessage(_messages.default.pastExpirationCallToActionLabel)
|
|
452
230
|
});
|
|
453
231
|
} else {
|
|
454
232
|
callToActionButton = /*#__PURE__*/(0, _jsxRuntime.jsx)(_upgradeButton.UpgradeButton, {
|
|
@@ -462,32 +240,26 @@ const ExperimentalUpgradeNotification = _ref5 => {
|
|
|
462
240
|
// if there's a first purchase discount, message the code at the bottom
|
|
463
241
|
offerCode = /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
464
242
|
className: "text-center discount-info",
|
|
465
|
-
children:
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
className: "font-weight-bold",
|
|
471
|
-
children: offer.code
|
|
472
|
-
})
|
|
473
|
-
}
|
|
243
|
+
children: formatMessage(_messages.default.discountCodeMessage, {
|
|
244
|
+
code: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
245
|
+
className: "font-weight-bold",
|
|
246
|
+
children: offer.code
|
|
247
|
+
})
|
|
474
248
|
})
|
|
475
249
|
});
|
|
476
250
|
}
|
|
477
251
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("section", {
|
|
478
252
|
className: (0, _classnames.default)('upgrade-notification small', {
|
|
479
|
-
'card mb-4': shouldDisplayBorder
|
|
253
|
+
'pgn__card pgn__card-light card mb-4 rounded': shouldDisplayBorder
|
|
480
254
|
}),
|
|
481
255
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
482
256
|
id: "courseHome-upgradeNotification",
|
|
483
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.
|
|
484
|
-
|
|
485
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("h2", {
|
|
486
|
-
className: (0, _classnames.default)('h5 upgrade-notification-header', {
|
|
257
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("h2", {
|
|
258
|
+
className: (0, _classnames.default)('upgrade-notification-header', {
|
|
487
259
|
'd-flex align-items-center mr-2 ml-4 my-1.5 font-size-18': !!toggleSidebar
|
|
488
260
|
}),
|
|
489
261
|
id: "outline-sidebar-upgrade-header",
|
|
490
|
-
children: [
|
|
262
|
+
children: [formatMessage(_messages.default.pursueCertificateMessage), !!toggleSidebar && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
491
263
|
className: "d-inline-flex ml-auto",
|
|
492
264
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_paragon.IconButton, {
|
|
493
265
|
src: _icons.Close,
|
|
@@ -495,9 +267,14 @@ const ExperimentalUpgradeNotification = _ref5 => {
|
|
|
495
267
|
iconAs: _paragon.Icon,
|
|
496
268
|
onClick: toggleSidebar,
|
|
497
269
|
className: "icon-hover",
|
|
498
|
-
alt:
|
|
270
|
+
alt: formatMessage(_messages.default.closeAlt)
|
|
499
271
|
})
|
|
500
272
|
})]
|
|
273
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_certificatePreview.default, {
|
|
274
|
+
courseId: courseId
|
|
275
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("h3", {
|
|
276
|
+
className: "ml-4",
|
|
277
|
+
children: upgradeNotificationHeaderText
|
|
501
278
|
}), expirationBanner, /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
502
279
|
className: "upgrade-notification-message",
|
|
503
280
|
children: upsellMessage
|
|
@@ -520,5 +297,5 @@ ExperimentalUpgradeNotification.defaultProps = {
|
|
|
520
297
|
setNotificationCurrentState: null,
|
|
521
298
|
toggleSidebar: null
|
|
522
299
|
};
|
|
523
|
-
var _default = exports.default = (0,
|
|
300
|
+
var _default = exports.default = (0, _reactSdk.withOptimizely)(ExperimentalUpgradeNotification);
|
|
524
301
|
//# sourceMappingURL=ExperimentalUpgradeNotification.js.map
|