@edx/frontend-plugin-advertisements 2.11.0 → 2.13.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/access-expiration-alert/AccessExpirationAlert.js +130 -0
- package/dist/access-expiration-alert/AccessExpirationAlert.js.map +1 -0
- package/dist/access-expiration-alert/index.js +10 -0
- package/dist/access-expiration-alert/index.js.map +1 -0
- package/dist/access-expiration-alert/messages.js +16 -0
- package/dist/access-expiration-alert/messages.js.map +1 -0
- package/dist/dynamic-experience-slot/DynamicExperienceSlot.js +87 -0
- package/dist/dynamic-experience-slot/DynamicExperienceSlot.js.map +1 -0
- package/dist/dynamic-experience-slot/index.js +10 -0
- package/dist/dynamic-experience-slot/index.js.map +1 -0
- package/dist/index.js +21 -0
- package/dist/index.js.map +1 -1
- package/dist/ucl-wrapper/UclWrapper.js +42 -0
- package/dist/ucl-wrapper/UclWrapper.js.map +1 -0
- package/dist/ucl-wrapper/index.js +10 -0
- package/dist/ucl-wrapper/index.js.map +1 -0
- package/package.json +2 -1
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
+
var _analytics = require("@edx/frontend-platform/analytics");
|
|
10
|
+
var _i18n = require("@edx/frontend-platform/i18n");
|
|
11
|
+
var _paragon = require("@openedx/paragon");
|
|
12
|
+
var _icons = require("@openedx/paragon/icons");
|
|
13
|
+
var _modelStore = require("@src/generic/model-store");
|
|
14
|
+
var _messages = _interopRequireDefault(require("./messages"));
|
|
15
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
16
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
17
|
+
function 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; }
|
|
18
|
+
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; }
|
|
19
|
+
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; }
|
|
20
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
21
|
+
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 */ /**
|
|
22
|
+
* Access Expiration top-of-courseware banner.
|
|
23
|
+
*
|
|
24
|
+
* This is the plugin-architecture equivalent of the Learning MFE's
|
|
25
|
+
* `src/alerts/access-expiration-alert/AccessExpirationAlert.jsx`.
|
|
26
|
+
*
|
|
27
|
+
* It renders directly as a plugin widget (does NOT use the Learning MFE alert registration system).
|
|
28
|
+
*/
|
|
29
|
+
const AccessExpirationAlert = _ref => {
|
|
30
|
+
let {
|
|
31
|
+
courseId
|
|
32
|
+
} = _ref;
|
|
33
|
+
const intl = (0, _i18n.useIntl)();
|
|
34
|
+
const {
|
|
35
|
+
org,
|
|
36
|
+
userTimezone
|
|
37
|
+
} = (0, _modelStore.useModel)('courseHomeMeta', courseId);
|
|
38
|
+
const {
|
|
39
|
+
accessExpiration
|
|
40
|
+
} = (0, _modelStore.useModel)('coursewareMeta', courseId);
|
|
41
|
+
const timezoneFormatArgs = userTimezone ? {
|
|
42
|
+
timeZone: userTimezone
|
|
43
|
+
} : {};
|
|
44
|
+
|
|
45
|
+
// Match original MFE logic.
|
|
46
|
+
if (!accessExpiration || accessExpiration.masqueradingExpiredCourse) {
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
const {
|
|
50
|
+
expirationDate,
|
|
51
|
+
upgradeDeadline,
|
|
52
|
+
upgradeUrl
|
|
53
|
+
} = accessExpiration;
|
|
54
|
+
const logClick = () => {
|
|
55
|
+
// Keep analytics identical to the temporary in-course wiring:
|
|
56
|
+
// analyticsPageName === 'in_course'
|
|
57
|
+
const analyticsPageName = 'in_course';
|
|
58
|
+
(0, _analytics.sendTrackEvent)('edx.bi.ecommerce.upsell_links_clicked', {
|
|
59
|
+
org_key: org,
|
|
60
|
+
courserun_key: courseId,
|
|
61
|
+
linkCategory: 'FBE_banner',
|
|
62
|
+
linkName: `${analyticsPageName}_audit_access_expires`,
|
|
63
|
+
linkType: 'link',
|
|
64
|
+
pageName: analyticsPageName
|
|
65
|
+
});
|
|
66
|
+
};
|
|
67
|
+
let deadlineMessage = null;
|
|
68
|
+
if (upgradeDeadline && upgradeUrl) {
|
|
69
|
+
deadlineMessage = /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
70
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("br", {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_i18n.FormattedMessage, {
|
|
71
|
+
id: "learning.accessExpiration.deadline",
|
|
72
|
+
defaultMessage: "Upgrade by {date} to get unlimited access to the course as long as it exists on the site.",
|
|
73
|
+
description: "Warning shown to learner to upgrade while they are enrolled on the audit version and it's possible to upgrade",
|
|
74
|
+
values: {
|
|
75
|
+
date: /*#__PURE__*/(0, _jsxRuntime.jsx)(_i18n.FormattedDate, _objectSpread({
|
|
76
|
+
day: "numeric",
|
|
77
|
+
month: "short",
|
|
78
|
+
year: "numeric",
|
|
79
|
+
value: upgradeDeadline
|
|
80
|
+
}, timezoneFormatArgs), "accessExpirationUpgradeDeadline")
|
|
81
|
+
}
|
|
82
|
+
}), "\xA0", /*#__PURE__*/(0, _jsxRuntime.jsx)(_paragon.Hyperlink, {
|
|
83
|
+
className: "font-weight-bold",
|
|
84
|
+
style: {
|
|
85
|
+
textDecoration: 'underline'
|
|
86
|
+
},
|
|
87
|
+
destination: upgradeUrl,
|
|
88
|
+
onClick: logClick,
|
|
89
|
+
children: intl.formatMessage(_messages.default.upgradeNow)
|
|
90
|
+
})]
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_paragon.Alert, {
|
|
94
|
+
variant: "info",
|
|
95
|
+
icon: _icons.Info,
|
|
96
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
97
|
+
className: "font-weight-bold",
|
|
98
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_i18n.FormattedMessage, {
|
|
99
|
+
id: "learning.accessExpiration.header",
|
|
100
|
+
defaultMessage: "Audit Access Expires {date}",
|
|
101
|
+
description: "Headline for auditing deadline",
|
|
102
|
+
values: {
|
|
103
|
+
date: /*#__PURE__*/(0, _jsxRuntime.jsx)(_i18n.FormattedDate, _objectSpread({
|
|
104
|
+
day: "numeric",
|
|
105
|
+
month: "short",
|
|
106
|
+
year: "numeric",
|
|
107
|
+
value: expirationDate
|
|
108
|
+
}, timezoneFormatArgs), "accessExpirationHeaderDate")
|
|
109
|
+
}
|
|
110
|
+
})
|
|
111
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("br", {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_i18n.FormattedMessage, {
|
|
112
|
+
id: "learning.accessExpiration.body",
|
|
113
|
+
defaultMessage: "You lose all access to this course, including your progress, on {date}.",
|
|
114
|
+
description: "Message body to tell learner the consequences of course expiration.",
|
|
115
|
+
values: {
|
|
116
|
+
date: /*#__PURE__*/(0, _jsxRuntime.jsx)(_i18n.FormattedDate, _objectSpread({
|
|
117
|
+
day: "numeric",
|
|
118
|
+
month: "short",
|
|
119
|
+
year: "numeric",
|
|
120
|
+
value: expirationDate
|
|
121
|
+
}, timezoneFormatArgs), "accessExpirationBodyDate")
|
|
122
|
+
}
|
|
123
|
+
}), deadlineMessage]
|
|
124
|
+
});
|
|
125
|
+
};
|
|
126
|
+
AccessExpirationAlert.propTypes = {
|
|
127
|
+
courseId: _propTypes.default.string.isRequired
|
|
128
|
+
};
|
|
129
|
+
var _default = exports.default = AccessExpirationAlert;
|
|
130
|
+
//# sourceMappingURL=AccessExpirationAlert.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AccessExpirationAlert.js","names":["_react","_interopRequireDefault","require","_propTypes","_analytics","_i18n","_paragon","_icons","_modelStore","_messages","_jsxRuntime","e","__esModule","default","ownKeys","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","_toPropertyKey","value","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","AccessExpirationAlert","_ref","courseId","intl","useIntl","org","userTimezone","useModel","accessExpiration","timezoneFormatArgs","timeZone","masqueradingExpiredCourse","expirationDate","upgradeDeadline","upgradeUrl","logClick","analyticsPageName","sendTrackEvent","org_key","courserun_key","linkCategory","linkName","linkType","pageName","deadlineMessage","jsxs","Fragment","children","jsx","FormattedMessage","id","defaultMessage","description","values","date","FormattedDate","day","month","year","Hyperlink","className","style","textDecoration","destination","onClick","formatMessage","messages","upgradeNow","Alert","variant","icon","Info","propTypes","PropTypes","string","isRequired","_default","exports"],"sources":["../../src/access-expiration-alert/AccessExpirationAlert.jsx"],"sourcesContent":["/* eslint import/no-unresolved: 0 */\nimport React from 'react';\nimport PropTypes from 'prop-types';\n\nimport { sendTrackEvent } from '@edx/frontend-platform/analytics';\nimport { FormattedMessage, FormattedDate, useIntl } from '@edx/frontend-platform/i18n';\nimport { Alert, Hyperlink } from '@openedx/paragon';\nimport { Info } from '@openedx/paragon/icons';\n\nimport { useModel } from '@src/generic/model-store';\n\nimport messages from './messages';\n\n/**\n * Access Expiration top-of-courseware banner.\n *\n * This is the plugin-architecture equivalent of the Learning MFE's\n * `src/alerts/access-expiration-alert/AccessExpirationAlert.jsx`.\n *\n * It renders directly as a plugin widget (does NOT use the Learning MFE alert registration system).\n */\nconst AccessExpirationAlert = ({\n courseId,\n}) => {\n const intl = useIntl();\n\n const { org, userTimezone } = useModel('courseHomeMeta', courseId);\n const { accessExpiration } = useModel('coursewareMeta', courseId);\n\n const timezoneFormatArgs = userTimezone ? { timeZone: userTimezone } : {};\n\n // Match original MFE logic.\n if (!accessExpiration || accessExpiration.masqueradingExpiredCourse) {\n return null;\n }\n\n const {\n expirationDate,\n upgradeDeadline,\n upgradeUrl,\n } = accessExpiration;\n\n const logClick = () => {\n // Keep analytics identical to the temporary in-course wiring:\n // analyticsPageName === 'in_course'\n const analyticsPageName = 'in_course';\n sendTrackEvent('edx.bi.ecommerce.upsell_links_clicked', {\n org_key: org,\n courserun_key: courseId,\n linkCategory: 'FBE_banner',\n linkName: `${analyticsPageName}_audit_access_expires`,\n linkType: 'link',\n pageName: analyticsPageName,\n });\n };\n\n let deadlineMessage = null;\n if (upgradeDeadline && upgradeUrl) {\n deadlineMessage = (\n <>\n <br />\n <FormattedMessage\n id=\"learning.accessExpiration.deadline\"\n defaultMessage=\"Upgrade by {date} to get unlimited access to the course as long as it exists on the site.\"\n description=\"Warning shown to learner to upgrade while they are enrolled on the audit version and it's possible to upgrade\"\n values={{\n date: (\n <FormattedDate\n key=\"accessExpirationUpgradeDeadline\"\n day=\"numeric\"\n month=\"short\"\n year=\"numeric\"\n value={upgradeDeadline}\n {...timezoneFormatArgs}\n />\n ),\n }}\n />\n \n <Hyperlink\n className=\"font-weight-bold\"\n style={{ textDecoration: 'underline' }}\n destination={upgradeUrl}\n onClick={logClick}\n >\n {intl.formatMessage(messages.upgradeNow)}\n </Hyperlink>\n </>\n );\n }\n\n return (\n <Alert variant=\"info\" icon={Info}>\n <span className=\"font-weight-bold\">\n <FormattedMessage\n id=\"learning.accessExpiration.header\"\n defaultMessage=\"Audit Access Expires {date}\"\n description=\"Headline for auditing deadline\"\n values={{\n date: (\n <FormattedDate\n key=\"accessExpirationHeaderDate\"\n day=\"numeric\"\n month=\"short\"\n year=\"numeric\"\n value={expirationDate}\n {...timezoneFormatArgs}\n />\n ),\n }}\n />\n </span>\n <br />\n <FormattedMessage\n id=\"learning.accessExpiration.body\"\n defaultMessage=\"You lose all access to this course, including your progress, on {date}.\"\n description=\"Message body to tell learner the consequences of course expiration.\"\n values={{\n date: (\n <FormattedDate\n key=\"accessExpirationBodyDate\"\n day=\"numeric\"\n month=\"short\"\n year=\"numeric\"\n value={expirationDate}\n {...timezoneFormatArgs}\n />\n ),\n }}\n />\n {deadlineMessage}\n </Alert>\n );\n};\n\nAccessExpirationAlert.propTypes = {\n courseId: PropTypes.string.isRequired,\n};\n\nexport default AccessExpirationAlert;\n"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AAEA,IAAAE,UAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AAEA,IAAAM,WAAA,GAAAN,OAAA;AAEA,IAAAO,SAAA,GAAAR,sBAAA,CAAAC,OAAA;AAAkC,IAAAQ,WAAA,GAAAR,OAAA;AAAA,SAAAD,uBAAAU,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA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iC,qBAAqB","ignoreList":[]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _AccessExpirationAlert = _interopRequireDefault(require("./AccessExpirationAlert"));
|
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
|
+
var _default = exports.default = _AccessExpirationAlert.default;
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["_AccessExpirationAlert","_interopRequireDefault","require","e","__esModule","default","_default","exports","AccessExpirationAlert"],"sources":["../../src/access-expiration-alert/index.jsx"],"sourcesContent":["import AccessExpirationAlert from './AccessExpirationAlert';\n\nexport default AccessExpirationAlert;\n"],"mappings":";;;;;;AAAA,IAAAA,sBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA4D,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,IAAAG,QAAA,GAAAC,OAAA,CAAAF,OAAA,GAE7CG,8BAAqB","ignoreList":[]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _i18n = require("@edx/frontend-platform/i18n");
|
|
8
|
+
const messages = (0, _i18n.defineMessages)({
|
|
9
|
+
upgradeNow: {
|
|
10
|
+
id: 'learning.accessExpiration.upgradeNow',
|
|
11
|
+
defaultMessage: 'Upgrade now',
|
|
12
|
+
description: 'The anchor text for the upgrading link'
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
var _default = exports.default = messages;
|
|
16
|
+
//# sourceMappingURL=messages.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messages.js","names":["_i18n","require","messages","defineMessages","upgradeNow","id","defaultMessage","description","_default","exports","default"],"sources":["../../src/access-expiration-alert/messages.js"],"sourcesContent":["import { defineMessages } from '@edx/frontend-platform/i18n';\n\nconst messages = defineMessages({\n upgradeNow: {\n id: 'learning.accessExpiration.upgradeNow',\n defaultMessage: 'Upgrade now',\n description: 'The anchor text for the upgrading link',\n },\n});\n\nexport default messages;\n"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AAEA,MAAMC,QAAQ,GAAG,IAAAC,oBAAc,EAAC;EAC9BC,UAAU,EAAE;IACVC,EAAE,EAAE,sCAAsC;IAC1CC,cAAc,EAAE,aAAa;IAC7BC,WAAW,EAAE;EACf;AACF,CAAC,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEYR,QAAQ","ignoreList":[]}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
10
|
+
const _excluded = ["widgetName"];
|
|
11
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
|
+
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; }
|
|
13
|
+
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; }
|
|
14
|
+
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; }
|
|
15
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
16
|
+
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); }
|
|
17
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
18
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
19
|
+
function useUCL() {
|
|
20
|
+
let timeout = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 5000;
|
|
21
|
+
const [ucl, setUcl] = (0, _react.useState)(() => window.UCL);
|
|
22
|
+
(0, _react.useEffect)(() => {
|
|
23
|
+
if (ucl) {
|
|
24
|
+
return undefined;
|
|
25
|
+
}
|
|
26
|
+
const start = Date.now();
|
|
27
|
+
const id = setInterval(() => {
|
|
28
|
+
if (window.UCL) {
|
|
29
|
+
setUcl(window.UCL);
|
|
30
|
+
clearInterval(id);
|
|
31
|
+
} else if (Date.now() - start > timeout) {
|
|
32
|
+
clearInterval(id);
|
|
33
|
+
}
|
|
34
|
+
}, 100);
|
|
35
|
+
return () => clearInterval(id);
|
|
36
|
+
}, [ucl, timeout]);
|
|
37
|
+
return ucl;
|
|
38
|
+
}
|
|
39
|
+
class RenderFallbackSignal extends Error {
|
|
40
|
+
constructor() {
|
|
41
|
+
super('Render fallback requested by widget');
|
|
42
|
+
this.name = 'RenderFallbackSignal';
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
const DynamicExperienceSlot = _ref => {
|
|
46
|
+
let {
|
|
47
|
+
widgetName
|
|
48
|
+
} = _ref,
|
|
49
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
50
|
+
const ref = (0, _react.useRef)(null);
|
|
51
|
+
const UCL = useUCL();
|
|
52
|
+
const [shouldThrow, setShouldThrow] = (0, _react.useState)(false);
|
|
53
|
+
const [error, setError] = (0, _react.useState)(null);
|
|
54
|
+
|
|
55
|
+
// Lock props to prevent unnecessary re-renders
|
|
56
|
+
const restPropsRef = (0, _react.useRef)(rest);
|
|
57
|
+
// Update ref on each render to prevent stale props
|
|
58
|
+
restPropsRef.current = rest;
|
|
59
|
+
(0, _react.useEffect)(() => {
|
|
60
|
+
const refCurrent = ref.current;
|
|
61
|
+
if (!refCurrent || !UCL) {
|
|
62
|
+
return undefined;
|
|
63
|
+
}
|
|
64
|
+
try {
|
|
65
|
+
UCL.mount(widgetName, refCurrent, _objectSpread(_objectSpread({}, restPropsRef.current), {}, {
|
|
66
|
+
onFallbackShouldRender: setShouldThrow
|
|
67
|
+
}));
|
|
68
|
+
} catch (e) {
|
|
69
|
+
setError(e);
|
|
70
|
+
}
|
|
71
|
+
return () => UCL.unmount(refCurrent);
|
|
72
|
+
}, [widgetName, UCL]);
|
|
73
|
+
if (error) {
|
|
74
|
+
throw error;
|
|
75
|
+
}
|
|
76
|
+
if (shouldThrow) {
|
|
77
|
+
throw new RenderFallbackSignal();
|
|
78
|
+
}
|
|
79
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
80
|
+
ref: ref
|
|
81
|
+
});
|
|
82
|
+
};
|
|
83
|
+
DynamicExperienceSlot.propTypes = {
|
|
84
|
+
widgetName: _propTypes.default.string.isRequired
|
|
85
|
+
};
|
|
86
|
+
var _default = exports.default = DynamicExperienceSlot;
|
|
87
|
+
//# sourceMappingURL=DynamicExperienceSlot.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DynamicExperienceSlot.js","names":["_react","require","_propTypes","_interopRequireDefault","_jsxRuntime","_excluded","e","__esModule","default","ownKeys","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","_toPropertyKey","value","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","_objectWithoutProperties","_objectWithoutPropertiesLoose","n","indexOf","propertyIsEnumerable","hasOwnProperty","useUCL","timeout","undefined","ucl","setUcl","useState","window","UCL","useEffect","start","Date","now","id","setInterval","clearInterval","RenderFallbackSignal","Error","constructor","name","DynamicExperienceSlot","_ref","widgetName","rest","ref","useRef","shouldThrow","setShouldThrow","error","setError","restPropsRef","current","refCurrent","mount","onFallbackShouldRender","unmount","jsx","propTypes","PropTypes","string","isRequired","_default","exports"],"sources":["../../src/dynamic-experience-slot/DynamicExperienceSlot.jsx"],"sourcesContent":["import { useState, useEffect, useRef } from 'react';\nimport PropTypes from 'prop-types';\n\nfunction useUCL(timeout = 5000) {\n const [ucl, setUcl] = useState(() => window.UCL);\n useEffect(() => {\n if (ucl) { return undefined; }\n const start = Date.now();\n const id = setInterval(() => {\n if (window.UCL) {\n setUcl(window.UCL);\n clearInterval(id);\n } else if (Date.now() - start > timeout) {\n clearInterval(id);\n }\n }, 100);\n return () => clearInterval(id);\n }, [ucl, timeout]);\n return ucl;\n}\nclass RenderFallbackSignal extends Error {\n constructor() {\n super('Render fallback requested by widget');\n this.name = 'RenderFallbackSignal';\n }\n}\n\nconst DynamicExperienceSlot = ({ widgetName, ...rest }) => {\n const ref = useRef(null);\n const UCL = useUCL();\n const [shouldThrow, setShouldThrow] = useState(false);\n const [error, setError] = useState(null);\n\n // Lock props to prevent unnecessary re-renders\n const restPropsRef = useRef(rest);\n // Update ref on each render to prevent stale props\n restPropsRef.current = rest;\n\n useEffect(() => {\n const refCurrent = ref.current;\n if (!refCurrent || !UCL) { return undefined; }\n try {\n UCL.mount(widgetName, refCurrent, {\n ...restPropsRef.current,\n onFallbackShouldRender: setShouldThrow,\n });\n } catch (e) {\n setError(e);\n }\n return () => UCL.unmount(refCurrent);\n }, [widgetName, UCL]);\n if (error) { throw error; }\n if (shouldThrow) { throw new RenderFallbackSignal(); }\n return <div ref={ref} />;\n};\n\nDynamicExperienceSlot.propTypes = {\n widgetName: PropTypes.string.isRequired,\n};\n\nexport default DynamicExperienceSlot;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,UAAA,GAAAC,sBAAA,CAAAF,OAAA;AAAmC,IAAAG,WAAA,GAAAH,OAAA;AAAA,MAAAI,SAAA;AAAA,SAAAF,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,QAAAH,CAAA,EAAAI,CAAA,QAAAC,CAAA,GAAAC,MAAA,CAAAC,IAAA,CAAAP,CAAA,OAAAM,MAAA,CAAAE,qBAAA,QAAAC,CAAA,GAAAH,MAAA,CAAAE,qBAAA,CAAAR,CAAA,GAAAI,CAAA,KAAAK,CAAA,GAAAA,CAAA,CAAAC,MAAA,WAAAN,CAAA,WAAAE,MAAA,CAAAK,wBAAA,CAAAX,CAAA,EAAAI,CAAA,EAAAQ,UAAA,OAAAP,CAAA,CAAAQ,IAAA,CAAAC,KAAA,CAAAT,CAAA,EAAAI,CAAA,YAAA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I,CAACC,UAAU,IAAI,CAACxB,GAAG,EAAE;MAAE,OAAOL,SAAS;IAAE;IAC7C,IAAI;MACFK,GAAG,CAACyB,KAAK,CAACX,UAAU,EAAEU,UAAU,EAAAzD,aAAA,CAAAA,aAAA,KAC3BuD,YAAY,CAACC,OAAO;QACvBG,sBAAsB,EAAEP;MAAc,EACvC,CAAC;IACJ,CAAC,CAAC,OAAOnE,CAAC,EAAE;MACVqE,QAAQ,CAACrE,CAAC,CAAC;IACb;IACA,OAAO,MAAMgD,GAAG,CAAC2B,OAAO,CAACH,UAAU,CAAC;EACtC,CAAC,EAAE,CAACV,UAAU,EAAEd,GAAG,CAAC,CAAC;EACrB,IAAIoB,KAAK,EAAE;IAAE,MAAMA,KAAK;EAAE;EAC1B,IAAIF,WAAW,EAAE;IAAE,MAAM,IAAIV,oBAAoB,CAAC,CAAC;EAAE;EACrD,oBAAO,IAAA1D,WAAA,CAAA8E,GAAA;IAAKZ,GAAG,EAAEA;EAAI,CAAE,CAAC;AAC1B,CAAC;AAEDJ,qBAAqB,CAACiB,SAAS,GAAG;EAChCf,UAAU,EAAEgB,kBAAS,CAACC,MAAM,CAACC;AAC/B,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAhF,OAAA,GAEa0D,qBAAqB","ignoreList":[]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _DynamicExperienceSlot = _interopRequireDefault(require("./DynamicExperienceSlot"));
|
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
|
+
var _default = exports.default = _DynamicExperienceSlot.default;
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["_DynamicExperienceSlot","_interopRequireDefault","require","e","__esModule","default","_default","exports","DynamicExperienceSlot"],"sources":["../../src/dynamic-experience-slot/index.jsx"],"sourcesContent":["import DynamicExperienceSlot from './DynamicExperienceSlot';\n\nexport default DynamicExperienceSlot;\n"],"mappings":";;;;;;AAAA,IAAAA,sBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA4D,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,IAAAG,QAAA,GAAAC,OAAA,CAAAF,OAAA,GAE7CG,8BAAqB","ignoreList":[]}
|
package/dist/index.js
CHANGED
|
@@ -3,6 +3,18 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
Object.defineProperty(exports, "AccessExpirationAlert", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _accessExpirationAlert.default;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "DynamicExperienceSlot", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _dynamicExperienceSlot.default;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
6
18
|
Object.defineProperty(exports, "LockPaywall", {
|
|
7
19
|
enumerable: true,
|
|
8
20
|
get: function () {
|
|
@@ -21,6 +33,12 @@ Object.defineProperty(exports, "SectionList", {
|
|
|
21
33
|
return _sectionOutline.default;
|
|
22
34
|
}
|
|
23
35
|
});
|
|
36
|
+
Object.defineProperty(exports, "UclWrapper", {
|
|
37
|
+
enumerable: true,
|
|
38
|
+
get: function () {
|
|
39
|
+
return _uclWrapper.default;
|
|
40
|
+
}
|
|
41
|
+
});
|
|
24
42
|
Object.defineProperty(exports, "UpgradeNotification", {
|
|
25
43
|
enumerable: true,
|
|
26
44
|
get: function () {
|
|
@@ -36,8 +54,11 @@ Object.defineProperty(exports, "UpsellBullets", {
|
|
|
36
54
|
var _upgradeNotification = _interopRequireDefault(require("./upgrade-notification"));
|
|
37
55
|
var _paywall = _interopRequireDefault(require("./paywall"));
|
|
38
56
|
var _upgradeModal = _interopRequireDefault(require("./upgrade-modal"));
|
|
57
|
+
var _accessExpirationAlert = _interopRequireDefault(require("./access-expiration-alert"));
|
|
39
58
|
var _generic = require("./generic");
|
|
40
59
|
var _sectionOutline = _interopRequireDefault(require("./section-outline"));
|
|
60
|
+
var _dynamicExperienceSlot = _interopRequireDefault(require("./dynamic-experience-slot"));
|
|
61
|
+
var _uclWrapper = _interopRequireDefault(require("./ucl-wrapper"));
|
|
41
62
|
require("./index.scss");
|
|
42
63
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
43
64
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_upgradeNotification","_interopRequireDefault","require","_paywall","_upgradeModal","_generic","_sectionOutline","e","__esModule","default"],"sources":["../src/index.jsx"],"sourcesContent":["import UpgradeNotification from './upgrade-notification';\nimport LockPaywall from './paywall';\nimport NextUnitButton from './upgrade-modal';\nimport { UpsellBullets } from './generic';\nimport SectionList from './section-outline';\nimport './index.scss';\n\nexport {\n UpgradeNotification,\n LockPaywall,\n NextUnitButton,\n UpsellBullets,\n SectionList,\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","names":["_upgradeNotification","_interopRequireDefault","require","_paywall","_upgradeModal","_accessExpirationAlert","_generic","_sectionOutline","_dynamicExperienceSlot","_uclWrapper","e","__esModule","default"],"sources":["../src/index.jsx"],"sourcesContent":["import UpgradeNotification from './upgrade-notification';\nimport LockPaywall from './paywall';\nimport NextUnitButton from './upgrade-modal';\nimport AccessExpirationAlert from './access-expiration-alert';\nimport { UpsellBullets } from './generic';\nimport SectionList from './section-outline';\nimport DynamicExperienceSlot from './dynamic-experience-slot';\nimport UclWrapper from './ucl-wrapper';\nimport './index.scss';\n\nexport {\n UpgradeNotification,\n LockPaywall,\n NextUnitButton,\n AccessExpirationAlert,\n UpsellBullets,\n SectionList,\n DynamicExperienceSlot,\n UclWrapper,\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,oBAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,QAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,aAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,sBAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,eAAA,GAAAN,sBAAA,CAAAC,OAAA;AACA,IAAAM,sBAAA,GAAAP,sBAAA,CAAAC,OAAA;AACA,IAAAO,WAAA,GAAAR,sBAAA,CAAAC,OAAA;AACAA,OAAA;AAAsB,SAAAD,uBAAAS,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA","ignoreList":[]}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _logging = require("@edx/frontend-platform/logging");
|
|
9
|
+
const UclWrapper = () => {
|
|
10
|
+
const [isLoaded, setLoaded] = (0, _react.useState)(false);
|
|
11
|
+
|
|
12
|
+
// eslint-disable-next-line no-underscore-dangle
|
|
13
|
+
window._UCL = {
|
|
14
|
+
identity: '2u-edx-learning'
|
|
15
|
+
};
|
|
16
|
+
(0, _react.useEffect)(() => {
|
|
17
|
+
if (isLoaded) {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
const head = document.getElementsByTagName('head')[0];
|
|
21
|
+
const script = document.createElement('script');
|
|
22
|
+
script.src = 'https://affiliate-bundle.api.highereducation.com/latest/UCL.adapter.js';
|
|
23
|
+
script.dataset.testId = 'ucl-test';
|
|
24
|
+
script.async = true;
|
|
25
|
+
script.onload = () => {
|
|
26
|
+
if (window.UCL && typeof window.UCL === 'function') {
|
|
27
|
+
(0, _logging.logInfo)('UCL script loaded successfully!');
|
|
28
|
+
} else {
|
|
29
|
+
// in the case that the script successfully loaded but UCL is still not found
|
|
30
|
+
(0, _logging.logError)('window.UCL not found after UCL script load.');
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
script.onerror = e => {
|
|
34
|
+
(0, _logging.logError)('UCL script failed to load', e);
|
|
35
|
+
};
|
|
36
|
+
head.appendChild(script);
|
|
37
|
+
setLoaded(true);
|
|
38
|
+
}, [isLoaded]);
|
|
39
|
+
return null;
|
|
40
|
+
};
|
|
41
|
+
var _default = exports.default = UclWrapper;
|
|
42
|
+
//# sourceMappingURL=UclWrapper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UclWrapper.js","names":["_react","require","_logging","UclWrapper","isLoaded","setLoaded","useState","window","_UCL","identity","useEffect","head","document","getElementsByTagName","script","createElement","src","dataset","testId","async","onload","UCL","logInfo","logError","onerror","e","appendChild","_default","exports","default"],"sources":["../../src/ucl-wrapper/UclWrapper.jsx"],"sourcesContent":["import { useState, useEffect } from 'react';\nimport { logError, logInfo } from '@edx/frontend-platform/logging';\n\nconst UclWrapper = () => {\n const [isLoaded, setLoaded] = useState(false);\n\n // eslint-disable-next-line no-underscore-dangle\n window._UCL = {\n identity: '2u-edx-learning',\n };\n\n useEffect(() => {\n if (isLoaded) {\n return;\n }\n\n const head = document.getElementsByTagName('head')[0];\n const script = document.createElement('script');\n script.src = 'https://affiliate-bundle.api.highereducation.com/latest/UCL.adapter.js';\n script.dataset.testId = 'ucl-test';\n script.async = true;\n\n script.onload = () => {\n if (window.UCL && typeof window.UCL === 'function') {\n logInfo('UCL script loaded successfully!');\n } else {\n // in the case that the script successfully loaded but UCL is still not found\n logError('window.UCL not found after UCL script load.');\n }\n };\n\n script.onerror = (e) => {\n logError('UCL script failed to load', e);\n };\n\n head.appendChild(script);\n setLoaded(true);\n }, [isLoaded]);\n\n return null;\n};\n\nexport default UclWrapper;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AAEA,MAAME,UAAU,GAAGA,CAAA,KAAM;EACvB,MAAM,CAACC,QAAQ,EAAEC,SAAS,CAAC,GAAG,IAAAC,eAAQ,EAAC,KAAK,CAAC;;EAE7C;EACAC,MAAM,CAACC,IAAI,GAAG;IACZC,QAAQ,EAAE;EACZ,CAAC;EAED,IAAAC,gBAAS,EAAC,MAAM;IACd,IAAIN,QAAQ,EAAE;MACZ;IACF;IAEA,MAAMO,IAAI,GAAGC,QAAQ,CAACC,oBAAoB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IACrD,MAAMC,MAAM,GAAGF,QAAQ,CAACG,aAAa,CAAC,QAAQ,CAAC;IAC/CD,MAAM,CAACE,GAAG,GAAG,wEAAwE;IACrFF,MAAM,CAACG,OAAO,CAACC,MAAM,GAAG,UAAU;IAClCJ,MAAM,CAACK,KAAK,GAAG,IAAI;IAEnBL,MAAM,CAACM,MAAM,GAAG,MAAM;MACpB,IAAIb,MAAM,CAACc,GAAG,IAAI,OAAOd,MAAM,CAACc,GAAG,KAAK,UAAU,EAAE;QAClD,IAAAC,gBAAO,EAAC,iCAAiC,CAAC;MAC5C,CAAC,MAAM;QACL;QACA,IAAAC,iBAAQ,EAAC,6CAA6C,CAAC;MACzD;IACF,CAAC;IAEDT,MAAM,CAACU,OAAO,GAAIC,CAAC,IAAK;MACtB,IAAAF,iBAAQ,EAAC,2BAA2B,EAAEE,CAAC,CAAC;IAC1C,CAAC;IAEDd,IAAI,CAACe,WAAW,CAACZ,MAAM,CAAC;IACxBT,SAAS,CAAC,IAAI,CAAC;EACjB,CAAC,EAAE,CAACD,QAAQ,CAAC,CAAC;EAEd,OAAO,IAAI;AACb,CAAC;AAAC,IAAAuB,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEa1B,UAAU","ignoreList":[]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _UclWrapper = _interopRequireDefault(require("./UclWrapper"));
|
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
|
+
var _default = exports.default = _UclWrapper.default;
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["_UclWrapper","_interopRequireDefault","require","e","__esModule","default","_default","exports","UclWrapper"],"sources":["../../src/ucl-wrapper/index.jsx"],"sourcesContent":["import UclWrapper from './UclWrapper';\n\nexport default UclWrapper;\n"],"mappings":";;;;;;AAAA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAsC,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,IAAAG,QAAA,GAAAC,OAAA,CAAAF,OAAA,GAEvBG,mBAAU","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@edx/frontend-plugin-advertisements",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.13.0",
|
|
4
4
|
"description": "Frontend plugin for edX in course advertisements",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"repository": {
|
|
@@ -42,6 +42,7 @@
|
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@optimizely/react-sdk": "^3.1.0",
|
|
44
44
|
"react-dom": "^18.3.1",
|
|
45
|
+
"react-error-boundary": "^6.1.1",
|
|
45
46
|
"universal-cookie": "^8.0.1",
|
|
46
47
|
"uuid": "^11.1.0"
|
|
47
48
|
},
|