@edx/frontend-platform 6.1.2 → 6.2.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@edx/frontend-platform",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.2.0",
|
|
4
4
|
"description": "Foundational application framework for Open edX micro-frontend applications.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"publishConfig": {
|
|
@@ -34,13 +34,13 @@
|
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@edx/brand": "npm:@openedx/brand-openedx@^1.2.2",
|
|
36
36
|
"@edx/browserslist-config": "1.2.0",
|
|
37
|
-
"@edx/frontend-build": "13.0.
|
|
37
|
+
"@edx/frontend-build": "13.0.14",
|
|
38
38
|
"@edx/paragon": "21.5.6",
|
|
39
|
+
"@testing-library/jest-dom": "6.1.5",
|
|
40
|
+
"@testing-library/react": "12.1.5",
|
|
39
41
|
"@testing-library/react-hooks": "^8.0.1",
|
|
40
|
-
"@wojtekmaj/enzyme-adapter-react-17": "0.8.0",
|
|
41
42
|
"axios-mock-adapter": "^1.21.3",
|
|
42
|
-
"core-js": "3.
|
|
43
|
-
"enzyme": "3.11.0",
|
|
43
|
+
"core-js": "3.34.0",
|
|
44
44
|
"husky": "8.0.3",
|
|
45
45
|
"jsdoc": "^4.0.0",
|
|
46
46
|
"nodemon": "3.0.2",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"react-redux": "^8.1.1",
|
|
51
51
|
"react-router-dom": "^6.6.1",
|
|
52
52
|
"redux": "4.2.1",
|
|
53
|
-
"regenerator-runtime": "0.14.
|
|
53
|
+
"regenerator-runtime": "0.14.1"
|
|
54
54
|
},
|
|
55
55
|
"dependencies": {
|
|
56
56
|
"@cospired/i18n-iso-languages": "4.1.0",
|
package/react/AppProvider.js
CHANGED
|
@@ -85,7 +85,9 @@ export default function AppProvider(_ref) {
|
|
|
85
85
|
store: store
|
|
86
86
|
}, wrapWithRouter ? /*#__PURE__*/React.createElement(Router, {
|
|
87
87
|
basename: basename
|
|
88
|
-
},
|
|
88
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
89
|
+
"data-testid": "browser-router"
|
|
90
|
+
}, children)) : children))));
|
|
89
91
|
}
|
|
90
92
|
AppProvider.propTypes = {
|
|
91
93
|
// eslint-disable-next-line react/forbid-prop-types
|
package/react/AppProvider.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppProvider.js","names":["React","useState","useMemo","PropTypes","BrowserRouter","Router","OptionalReduxProvider","ErrorBoundary","AppContext","useAppEvent","useTrackColorSchemeChoice","getAuthenticatedUser","AUTHENTICATED_USER_CHANGED","getConfig","CONFIG_CHANGED","getLocale","getMessages","IntlProvider","LOCALE_CHANGED","basename","AppProvider","_ref","store","children","wrapWithRouter","_useState","_useState2","_slicedToArray","config","setConfig","_useState3","_useState4","authenticatedUser","setAuthenticatedUser","_useState5","_useState6","locale","setLocale","appContextValue","createElement","messages","Provider","value","propTypes","object","node","isRequired","bool","defaultProps"],"sources":["../../src/react/AppProvider.jsx"],"sourcesContent":["import React, { useState, useMemo } from 'react';\nimport PropTypes from 'prop-types';\nimport { BrowserRouter as Router } from 'react-router-dom';\n\nimport OptionalReduxProvider from './OptionalReduxProvider';\n\nimport ErrorBoundary from './ErrorBoundary';\nimport AppContext from './AppContext';\nimport { useAppEvent, useTrackColorSchemeChoice } from './hooks';\nimport { getAuthenticatedUser, AUTHENTICATED_USER_CHANGED } from '../auth';\nimport { getConfig } from '../config';\nimport { CONFIG_CHANGED } from '../constants';\nimport {\n getLocale,\n getMessages,\n IntlProvider,\n LOCALE_CHANGED,\n} from '../i18n';\nimport { basename } from '../initialize';\n\n/**\n * A wrapper component for React-based micro-frontends to initialize a number of common data/\n * context providers.\n *\n * ```\n * subscribe(APP_READY, () => {\n * ReactDOM.render(\n * <AppProvider>\n * <HelloWorld />\n * </AppProvider>\n * )\n * });\n * ```\n *\n * This will provide the following to HelloWorld:\n * - An error boundary as described above.\n * - An `AppContext` provider for React context data.\n * - IntlProvider for @edx/frontend-i18n internationalization\n * - Optionally a redux `Provider`. Will only be included if a `store` property is passed to\n * `AppProvider`.\n * - A `Router` for react-router.\n *\n * @param {Object} props\n * @param {Object} [props.store] A redux store.\n * @memberof module:React\n */\nexport default function AppProvider({ store, children, wrapWithRouter }) {\n const [config, setConfig] = useState(getConfig());\n const [authenticatedUser, setAuthenticatedUser] = useState(getAuthenticatedUser());\n const [locale, setLocale] = useState(getLocale());\n\n useTrackColorSchemeChoice();\n\n useAppEvent(AUTHENTICATED_USER_CHANGED, () => {\n setAuthenticatedUser(getAuthenticatedUser());\n });\n\n useAppEvent(CONFIG_CHANGED, () => {\n setConfig(getConfig());\n });\n\n useAppEvent(LOCALE_CHANGED, () => {\n setLocale(getLocale());\n });\n\n const appContextValue = useMemo(() => ({ authenticatedUser, config, locale }), [authenticatedUser, config, locale]);\n\n return (\n <IntlProvider locale={locale} messages={getMessages()}>\n <ErrorBoundary>\n <AppContext.Provider\n value={appContextValue}\n >\n <OptionalReduxProvider store={store}>\n {wrapWithRouter ? (\n <Router basename={basename}>\n {children}\n </Router>\n ) : children}\n </OptionalReduxProvider>\n </AppContext.Provider>\n </ErrorBoundary>\n </IntlProvider>\n );\n}\n\nAppProvider.propTypes = {\n // eslint-disable-next-line react/forbid-prop-types\n store: PropTypes.object,\n children: PropTypes.node.isRequired,\n wrapWithRouter: PropTypes.bool,\n};\n\nAppProvider.defaultProps = {\n store: null,\n wrapWithRouter: true,\n};\n"],"mappings":";;;;;;AAAA,OAAOA,KAAK,IAAIC,QAAQ,EAAEC,OAAO,QAAQ,OAAO;AAChD,OAAOC,SAAS,MAAM,YAAY;AAClC,SAASC,aAAa,IAAIC,MAAM,QAAQ,kBAAkB;AAE1D,OAAOC,qBAAqB,MAAM,yBAAyB;AAE3D,OAAOC,aAA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,CAAC;EAEFF,WAAW,CAACK,cAAc,EAAE,YAAM;IAChCe,SAAS,CAAChB,SAAS,CAAC,CAAC,CAAC;EACxB,CAAC,CAAC;EAEFJ,WAAW,CAACS,cAAc,EAAE,YAAM;IAChCmB,SAAS,CAACtB,SAAS,CAAC,CAAC,CAAC;EACxB,CAAC,CAAC;EAEF,IAAMuB,eAAe,GAAGpC,OAAO,CAAC;IAAA,OAAO;MAAE8B,iBAAiB,EAAjBA,iBAAiB;MAAEJ,MAAM,EAANA,MAAM;MAAEQ,MAAM,EAANA;IAAO,CAAC;EAAA,CAAC,EAAE,CAACJ,iBAAiB,EAAEJ,MAAM,EAAEQ,MAAM,CAAC,CAAC;EAEnH,oBACEpC,KAAA,CAAAuC,aAAA,CAACtB,YAAY;IAACmB,MAAM,EAAEA,MAAO;IAACI,QAAQ,EAAExB,WAAW,CAAC;EAAE,gBACpDhB,KAAA,CAAAuC,aAAA,CAAChC,aAAa,qBACZP,KAAA,CAAAuC,aAAA,CAAC/B,UAAU,CAACiC,QAAQ;IAClBC,KAAK,EAAEJ;EAAgB,gBAEvBtC,KAAA,CAAAuC,aAAA,CAACjC,qBAAqB;IAACgB,KAAK,EAAEA;EAAM,GACjCE,cAAc,gBACbxB,KAAA,CAAAuC,aAAA,CAAClC,MAAM;IAACc,QAAQ,EAAEA;EAAS,
|
|
1
|
+
{"version":3,"file":"AppProvider.js","names":["React","useState","useMemo","PropTypes","BrowserRouter","Router","OptionalReduxProvider","ErrorBoundary","AppContext","useAppEvent","useTrackColorSchemeChoice","getAuthenticatedUser","AUTHENTICATED_USER_CHANGED","getConfig","CONFIG_CHANGED","getLocale","getMessages","IntlProvider","LOCALE_CHANGED","basename","AppProvider","_ref","store","children","wrapWithRouter","_useState","_useState2","_slicedToArray","config","setConfig","_useState3","_useState4","authenticatedUser","setAuthenticatedUser","_useState5","_useState6","locale","setLocale","appContextValue","createElement","messages","Provider","value","propTypes","object","node","isRequired","bool","defaultProps"],"sources":["../../src/react/AppProvider.jsx"],"sourcesContent":["import React, { useState, useMemo } from 'react';\nimport PropTypes from 'prop-types';\nimport { BrowserRouter as Router } from 'react-router-dom';\n\nimport OptionalReduxProvider from './OptionalReduxProvider';\n\nimport ErrorBoundary from './ErrorBoundary';\nimport AppContext from './AppContext';\nimport { useAppEvent, useTrackColorSchemeChoice } from './hooks';\nimport { getAuthenticatedUser, AUTHENTICATED_USER_CHANGED } from '../auth';\nimport { getConfig } from '../config';\nimport { CONFIG_CHANGED } from '../constants';\nimport {\n getLocale,\n getMessages,\n IntlProvider,\n LOCALE_CHANGED,\n} from '../i18n';\nimport { basename } from '../initialize';\n\n/**\n * A wrapper component for React-based micro-frontends to initialize a number of common data/\n * context providers.\n *\n * ```\n * subscribe(APP_READY, () => {\n * ReactDOM.render(\n * <AppProvider>\n * <HelloWorld />\n * </AppProvider>\n * )\n * });\n * ```\n *\n * This will provide the following to HelloWorld:\n * - An error boundary as described above.\n * - An `AppContext` provider for React context data.\n * - IntlProvider for @edx/frontend-i18n internationalization\n * - Optionally a redux `Provider`. Will only be included if a `store` property is passed to\n * `AppProvider`.\n * - A `Router` for react-router.\n *\n * @param {Object} props\n * @param {Object} [props.store] A redux store.\n * @memberof module:React\n */\nexport default function AppProvider({ store, children, wrapWithRouter }) {\n const [config, setConfig] = useState(getConfig());\n const [authenticatedUser, setAuthenticatedUser] = useState(getAuthenticatedUser());\n const [locale, setLocale] = useState(getLocale());\n\n useTrackColorSchemeChoice();\n\n useAppEvent(AUTHENTICATED_USER_CHANGED, () => {\n setAuthenticatedUser(getAuthenticatedUser());\n });\n\n useAppEvent(CONFIG_CHANGED, () => {\n setConfig(getConfig());\n });\n\n useAppEvent(LOCALE_CHANGED, () => {\n setLocale(getLocale());\n });\n\n const appContextValue = useMemo(() => ({ authenticatedUser, config, locale }), [authenticatedUser, config, locale]);\n\n return (\n <IntlProvider locale={locale} messages={getMessages()}>\n <ErrorBoundary>\n <AppContext.Provider\n value={appContextValue}\n >\n <OptionalReduxProvider store={store}>\n {wrapWithRouter ? (\n <Router basename={basename}>\n <div data-testid=\"browser-router\">\n {children}\n </div>\n </Router>\n ) : children}\n </OptionalReduxProvider>\n </AppContext.Provider>\n </ErrorBoundary>\n </IntlProvider>\n );\n}\n\nAppProvider.propTypes = {\n // eslint-disable-next-line react/forbid-prop-types\n store: PropTypes.object,\n children: PropTypes.node.isRequired,\n wrapWithRouter: PropTypes.bool,\n};\n\nAppProvider.defaultProps = {\n store: null,\n wrapWithRouter: true,\n};\n"],"mappings":";;;;;;AAAA,OAAOA,KAAK,IAAIC,QAAQ,EAAEC,OAAO,QAAQ,OAAO;AAChD,OAAOC,SAAS,MAAM,YAAY;AAClC,SAASC,aAAa,IAAIC,MAAM,QAAQ,kBAAkB;AAE1D,OAAOC,qBAAqB,MAAM,yBAAyB;AAE3D,OAAOC,aAAa,MAAM,iBAAiB;AAC3C,OAAOC,UAAU,MAAM,cAAc;AACrC,SAASC,WAAW,EAAEC,yBAAyB,QAAQ,SAAS;AAChE,SAASC,oBAAoB,EAAEC,0BAA0B,QAAQ,SAAS;AAC1E,SAASC,SAAS,QAAQ,WAAW;AACrC,SAASC,cAAc,QAAQ,cAAc;AAC7C,SACEC,SAAS,EACTC,WAAW,EACXC,YAAY,EACZC,cAAc,QACT,SAAS;AAChB,SAASC,QAAQ,QAAQ,eAAe;;AAExC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,WAAWA,CAAAC,IAAA,EAAsC;EAAA,IAAnCC,KAAK,GAAAD,IAAA,CAALC,KAAK;IAAEC,QAAQ,GAAAF,IAAA,CAARE,QAAQ;IAAEC,cAAc,GAAAH,IAAA,CAAdG,cAAc;EACnE,IAAAC,SAAA,GAA4BxB,QAAQ,CAACY,SAAS,CAAC,CAAC,CAAC;IAAAa,UAAA,GAAAC,cAAA,CAAAF,SAAA;IAA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qB;IAACgB,KAAK,EAAEA;EAAM,GACjCE,cAAc,gBACbxB,KAAA,CAAAuC,aAAA,CAAClC,MAAM;IAACc,QAAQ,EAAEA;EAAS,gBACzBnB,KAAA,CAAAuC,aAAA;IAAK,eAAY;EAAgB,GAC9BhB,QACE,CACC,CAAC,GACPA,QACiB,CACJ,CACR,CACH,CAAC;AAEnB;AAEAH,WAAW,CAACuB,SAAS,GAAG;EACtB;EACArB,KAAK,EAAEnB,SAAS,CAACyC,MAAM;EACvBrB,QAAQ,EAAEpB,SAAS,CAAC0C,IAAI,CAACC,UAAU;EACnCtB,cAAc,EAAErB,SAAS,CAAC4C;AAC5B,CAAC;AAED3B,WAAW,CAAC4B,YAAY,GAAG;EACzB1B,KAAK,EAAE,IAAI;EACXE,cAAc,EAAE;AAClB,CAAC"}
|
package/react/ErrorPage.js
CHANGED
|
@@ -36,7 +36,8 @@ function ErrorPage(_ref) {
|
|
|
36
36
|
messages: getMessages()
|
|
37
37
|
}, /*#__PURE__*/React.createElement(Container, {
|
|
38
38
|
fluid: true,
|
|
39
|
-
className: "py-5 justify-content-center align-items-start text-center"
|
|
39
|
+
className: "py-5 justify-content-center align-items-start text-center",
|
|
40
|
+
"data-testid": "error-page"
|
|
40
41
|
}, /*#__PURE__*/React.createElement(Row, null, /*#__PURE__*/React.createElement(Col, null, /*#__PURE__*/React.createElement("p", {
|
|
41
42
|
className: "text-muted"
|
|
42
43
|
}, /*#__PURE__*/React.createElement(FormattedMessage, {
|
package/react/ErrorPage.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ErrorPage.js","names":["React","useState","PropTypes","Button","Container","Row","Col","useAppEvent","FormattedMessage","IntlProvider","getMessages","getLocale","LOCALE_CHANGED","ErrorPage","_ref","message","_useState","_useState2","_slicedToArray","locale","setLocale","reload","global","location","createElement","messages","fluid","className","id","defaultMessage","description","role","onClick","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,KAAK,IAAIC,QAAQ,QAAQ,OAAO;AACvC,OAAOC,SAAS,MAAM,YAAY;AAClC,SACEC,MAAM,EAAEC,SAAS,EAAEC,GAAG,EAAEC,GAAG,QACtB,cAAc;AAErB,SAASC,WAAW,QAAQ,SAAS;AACrC,SACEC,gBAAgB,EAChBC,YAAY,EACZC,WAAW,EACXC,SAAS,EACTC,cAAc,QACT,SAAS;;AAEhB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,SAASA,CAAAC,IAAA,EAEf;EAAA,IADDC,OAAO,GAAAD,IAAA,CAAPC,OAAO;EAEP,IAAAC,SAAA,GAA4Bf,QAAQ,CAACU,SAAS,CAAC,CAAC,CAAC;IAAAM,UAAA,GAAAC,cAAA,CAAAF,SAAA;IAA1CG,MAAM,GAAAF,UAAA;IAAEG,SAAS,GAAAH,UAAA;EAExBV,WAAW,CAACK,cAAc,EAAE,YAAM;IAChCQ,SAAS,CAACT,SAAS,CAAC,CAAC,CAAC;EACxB,CAAC,CAAC;;EAEF;EACA,IAAMU,MAAM,GAAG,SAATA,MAAMA,CAAA,EAAS;IACnBC,MAAM,CAACC,QAAQ,CAACF,MAAM,CAAC,CAAC;EAC1B,CAAC;EAED,oBACErB,KAAA,CAAAwB,aAAA,CAACf,YAAY;IAACU,MAAM,EAAEA,MAAO;IAACM,QAAQ,EAAEf,WAAW,CAAC;EAAE,gBACpDV,KAAA,CAAAwB,aAAA,CAACpB,SAAS;IAACsB,KAAK;IAACC,SAAS,EAAC;
|
|
1
|
+
{"version":3,"file":"ErrorPage.js","names":["React","useState","PropTypes","Button","Container","Row","Col","useAppEvent","FormattedMessage","IntlProvider","getMessages","getLocale","LOCALE_CHANGED","ErrorPage","_ref","message","_useState","_useState2","_slicedToArray","locale","setLocale","reload","global","location","createElement","messages","fluid","className","id","defaultMessage","description","role","onClick","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\" data-testid=\"error-page\">\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,KAAK,IAAIC,QAAQ,QAAQ,OAAO;AACvC,OAAOC,SAAS,MAAM,YAAY;AAClC,SACEC,MAAM,EAAEC,SAAS,EAAEC,GAAG,EAAEC,GAAG,QACtB,cAAc;AAErB,SAASC,WAAW,QAAQ,SAAS;AACrC,SACEC,gBAAgB,EAChBC,YAAY,EACZC,WAAW,EACXC,SAAS,EACTC,cAAc,QACT,SAAS;;AAEhB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,SAASA,CAAAC,IAAA,EAEf;EAAA,IADDC,OAAO,GAAAD,IAAA,CAAPC,OAAO;EAEP,IAAAC,SAAA,GAA4Bf,QAAQ,CAACU,SAAS,CAAC,CAAC,CAAC;IAAAM,UAAA,GAAAC,cAAA,CAAAF,SAAA;IAA1CG,MAAM,GAAAF,UAAA;IAAEG,SAAS,GAAAH,UAAA;EAExBV,WAAW,CAACK,cAAc,EAAE,YAAM;IAChCQ,SAAS,CAACT,SAAS,CAA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(_ref) {
|
|
|
14
14
|
}
|
|
15
15
|
return /*#__PURE__*/React.createElement(Provider, {
|
|
16
16
|
store: store
|
|
17
|
-
},
|
|
17
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
18
|
+
"data-testid": "redux-provider"
|
|
19
|
+
}, children));
|
|
18
20
|
}
|
|
19
21
|
OptionalReduxProvider.propTypes = {
|
|
20
22
|
store: PropTypes.object,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OptionalReduxProvider.js","names":["React","PropTypes","Provider","OptionalReduxProvider","_ref","store","children","createElement","propTypes","object","node","isRequired","defaultProps"],"sources":["../../src/react/OptionalReduxProvider.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { Provider } from 'react-redux';\n\n/**\n * @memberof module:React\n * @param {Object} props\n */\nexport default function OptionalReduxProvider({ store, children }) {\n if (store === null) {\n return children;\n }\n\n return (\n <Provider store={store}>\n {children}\n </Provider>\n );\n}\n\nOptionalReduxProvider.propTypes = {\n store: PropTypes.object, // eslint-disable-line\n children: PropTypes.node.isRequired,\n};\n\nOptionalReduxProvider.defaultProps = {\n store: null,\n};\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAClC,SAASC,QAAQ,QAAQ,aAAa;;AAEtC;AACA;AACA;AACA;AACA,eAAe,SAASC,qBAAqBA,CAAAC,IAAA,EAAsB;EAAA,IAAnBC,KAAK,GAAAD,IAAA,CAALC,KAAK;IAAEC,QAAQ,GAAAF,IAAA,CAARE,QAAQ;EAC7D,IAAID,KAAK,KAAK,IAAI,EAAE;IAClB,OAAOC,QAAQ;EACjB;EAEA,oBACEN,KAAA,CAAAO,aAAA,CAACL,QAAQ;IAACG,KAAK,EAAEA;EAAM,
|
|
1
|
+
{"version":3,"file":"OptionalReduxProvider.js","names":["React","PropTypes","Provider","OptionalReduxProvider","_ref","store","children","createElement","propTypes","object","node","isRequired","defaultProps"],"sources":["../../src/react/OptionalReduxProvider.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { Provider } from 'react-redux';\n\n/**\n * @memberof module:React\n * @param {Object} props\n */\nexport default function OptionalReduxProvider({ store, children }) {\n if (store === null) {\n return children;\n }\n\n return (\n <Provider store={store}>\n <div data-testid=\"redux-provider\">\n {children}\n </div>\n </Provider>\n );\n}\n\nOptionalReduxProvider.propTypes = {\n store: PropTypes.object, // eslint-disable-line\n children: PropTypes.node.isRequired,\n};\n\nOptionalReduxProvider.defaultProps = {\n store: null,\n};\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAClC,SAASC,QAAQ,QAAQ,aAAa;;AAEtC;AACA;AACA;AACA;AACA,eAAe,SAASC,qBAAqBA,CAAAC,IAAA,EAAsB;EAAA,IAAnBC,KAAK,GAAAD,IAAA,CAALC,KAAK;IAAEC,QAAQ,GAAAF,IAAA,CAARE,QAAQ;EAC7D,IAAID,KAAK,KAAK,IAAI,EAAE;IAClB,OAAOC,QAAQ;EACjB;EAEA,oBACEN,KAAA,CAAAO,aAAA,CAACL,QAAQ;IAACG,KAAK,EAAEA;EAAM,gBACrBL,KAAA,CAAAO,aAAA;IAAK,eAAY;EAAgB,GAC9BD,QACE,CACG,CAAC;AAEf;AAEAH,qBAAqB,CAACK,SAAS,GAAG;EAChCH,KAAK,EAAEJ,SAAS,CAACQ,MAAM;EAAE;EACzBH,QAAQ,EAAEL,SAAS,CAACS,IAAI,CAACC;AAC3B,CAAC;AAEDR,qBAAqB,CAACS,YAAY,GAAG;EACnCP,KAAK,EAAE;AACT,CAAC"}
|