@edx/frontend-platform 2.5.0 → 2.5.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/package.json +3 -3
- package/react/ErrorPage.js +49 -64
- package/react/ErrorPage.js.map +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@edx/frontend-platform",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.1",
|
|
4
4
|
"description": "Foundational application framework for Open edX micro-frontend applications.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"publishConfig": {
|
|
@@ -51,8 +51,8 @@
|
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
53
|
"@cospired/i18n-iso-languages": "2.2.0",
|
|
54
|
-
"@formatjs/intl-pluralrules": "
|
|
55
|
-
"@formatjs/intl-relativetimeformat": "
|
|
54
|
+
"@formatjs/intl-pluralrules": "4.3.3",
|
|
55
|
+
"@formatjs/intl-relativetimeformat": "10.0.1",
|
|
56
56
|
"axios": "0.26.1",
|
|
57
57
|
"axios-cache-adapter": "2.7.3",
|
|
58
58
|
"form-urlencoded": "4.1.4",
|
package/react/ErrorPage.js
CHANGED
|
@@ -1,29 +1,20 @@
|
|
|
1
|
-
function
|
|
1
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
2
|
|
|
3
|
-
function
|
|
3
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
4
|
|
|
5
|
-
function
|
|
5
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
6
6
|
|
|
7
|
-
function
|
|
7
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
8
8
|
|
|
9
|
-
function
|
|
9
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
10
10
|
|
|
11
|
-
function
|
|
11
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
16
|
-
|
|
17
|
-
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
18
|
-
|
|
19
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
20
|
-
|
|
21
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
22
|
-
|
|
23
|
-
import React, { Component } from 'react';
|
|
13
|
+
import React, { useState } from 'react';
|
|
24
14
|
import PropTypes from 'prop-types';
|
|
25
15
|
import { Button, Container, Row, Col } from '@edx/paragon';
|
|
26
|
-
import {
|
|
16
|
+
import { useAppEvent } from './hooks';
|
|
17
|
+
import { FormattedMessage, IntlProvider, getMessages, getLocale, LOCALE_CHANGED } from '../i18n';
|
|
27
18
|
/**
|
|
28
19
|
* An error page that displays a generic message for unexpected errors. Also contains a "Try
|
|
29
20
|
* Again" button to refresh the page.
|
|
@@ -32,52 +23,46 @@ import { FormattedMessage } from '../i18n';
|
|
|
32
23
|
* @extends {Component}
|
|
33
24
|
*/
|
|
34
25
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
var
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
})))));
|
|
76
|
-
}
|
|
77
|
-
}]);
|
|
78
|
-
|
|
79
|
-
return ErrorPage;
|
|
80
|
-
}(Component);
|
|
26
|
+
function ErrorPage(_ref) {
|
|
27
|
+
var message = _ref.message;
|
|
28
|
+
|
|
29
|
+
var _useState = useState(getLocale()),
|
|
30
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
31
|
+
locale = _useState2[0],
|
|
32
|
+
setLocale = _useState2[1];
|
|
33
|
+
|
|
34
|
+
useAppEvent(LOCALE_CHANGED, function () {
|
|
35
|
+
setLocale(getLocale());
|
|
36
|
+
});
|
|
37
|
+
/* istanbul ignore next */
|
|
38
|
+
|
|
39
|
+
var reload = function reload() {
|
|
40
|
+
global.location.reload();
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
return /*#__PURE__*/React.createElement(IntlProvider, {
|
|
44
|
+
locale: locale,
|
|
45
|
+
messages: getMessages()
|
|
46
|
+
}, /*#__PURE__*/React.createElement(Container, {
|
|
47
|
+
fluid: true,
|
|
48
|
+
className: "py-5 justify-content-center align-items-start text-center"
|
|
49
|
+
}, /*#__PURE__*/React.createElement(Row, null, /*#__PURE__*/React.createElement(Col, null, /*#__PURE__*/React.createElement("p", {
|
|
50
|
+
className: "text-muted"
|
|
51
|
+
}, /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
52
|
+
id: "unexpected.error.message.text",
|
|
53
|
+
defaultMessage: "An unexpected error occurred. Please click the button below to refresh the page.",
|
|
54
|
+
description: "error message when an unexpected error occurs"
|
|
55
|
+
})), message && /*#__PURE__*/React.createElement("div", {
|
|
56
|
+
role: "alert",
|
|
57
|
+
className: "my-4"
|
|
58
|
+
}, /*#__PURE__*/React.createElement("p", null, message)), /*#__PURE__*/React.createElement(Button, {
|
|
59
|
+
onClick: reload
|
|
60
|
+
}, /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
61
|
+
id: "unexpected.error.button.text",
|
|
62
|
+
defaultMessage: "Try again",
|
|
63
|
+
description: "text for button that tries to reload the app by refreshing the page"
|
|
64
|
+
}))))));
|
|
65
|
+
}
|
|
81
66
|
|
|
82
67
|
ErrorPage.propTypes = {
|
|
83
68
|
message: PropTypes.string
|
package/react/ErrorPage.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ErrorPage.js","names":["React","
|
|
1
|
+
{"version":3,"file":"ErrorPage.js","names":["React","useState","PropTypes","Button","Container","Row","Col","useAppEvent","FormattedMessage","IntlProvider","getMessages","getLocale","LOCALE_CHANGED","ErrorPage","message","locale","setLocale","reload","global","location","propTypes","string","defaultProps"],"sources":["../../src/react/ErrorPage.jsx"],"sourcesContent":["import React, { useState } from 'react';\nimport PropTypes from 'prop-types';\nimport {\n Button, Container, Row, Col,\n} from '@edx/paragon';\n\nimport { useAppEvent } from './hooks';\nimport {\n FormattedMessage,\n IntlProvider,\n getMessages,\n getLocale,\n LOCALE_CHANGED,\n} from '../i18n';\n\n/**\n * An error page that displays a generic message for unexpected errors. Also contains a \"Try\n * Again\" button to refresh the page.\n *\n * @memberof module:React\n * @extends {Component}\n */\nfunction ErrorPage({\n message,\n}) {\n const [locale, setLocale] = useState(getLocale());\n\n useAppEvent(LOCALE_CHANGED, () => {\n setLocale(getLocale());\n });\n\n /* istanbul ignore next */\n const reload = () => {\n global.location.reload();\n };\n\n return (\n <IntlProvider locale={locale} messages={getMessages()}>\n <Container fluid className=\"py-5 justify-content-center align-items-start text-center\">\n <Row>\n <Col>\n <p className=\"text-muted\">\n <FormattedMessage\n id=\"unexpected.error.message.text\"\n defaultMessage=\"An unexpected error occurred. Please click the button below to refresh the page.\"\n description=\"error message when an unexpected error occurs\"\n />\n </p>\n {message && (\n <div role=\"alert\" className=\"my-4\">\n <p>{message}</p>\n </div>\n )}\n <Button onClick={reload}>\n <FormattedMessage\n id=\"unexpected.error.button.text\"\n defaultMessage=\"Try again\"\n description=\"text for button that tries to reload the app by refreshing the page\"\n />\n </Button>\n </Col>\n </Row>\n </Container>\n </IntlProvider>\n );\n}\n\nErrorPage.propTypes = {\n message: PropTypes.string,\n};\n\nErrorPage.defaultProps = {\n message: null,\n};\n\nexport default ErrorPage;\n"],"mappings":";;;;;;;;;;;;AAAA,OAAOA,KAAP,IAAgBC,QAAhB,QAAgC,OAAhC;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,SACEC,MADF,EACUC,SADV,EACqBC,GADrB,EAC0BC,GAD1B,QAEO,cAFP;AAIA,SAASC,WAAT,QAA4B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