@mychoice/mychoice-sdk-modules 2.1.2 → 2.1.3

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/cjs/index.js CHANGED
@@ -3,6 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var jsxRuntime = require('react/jsx-runtime');
6
+ var reactErrorBoundary = require('react-error-boundary');
6
7
  var mychoiceSdkComponents = require('@mychoice/mychoice-sdk-components');
7
8
  var mychoiceSdkStore = require('@mychoice/mychoice-sdk-store');
8
9
  var reactRouterDom = require('react-router-dom');
@@ -4290,6 +4291,15 @@ const AppConfig = (props) => {
4290
4291
  return null;
4291
4292
  };
4292
4293
 
4294
+ const AppErrorScreen = () => {
4295
+ const onClear = () => {
4296
+ localStorage.clear();
4297
+ // eslint-disable-next-line
4298
+ location.reload();
4299
+ };
4300
+ return (jsxRuntime.jsxs("div", { style: { textAlign: 'center', paddingTop: '100px' }, children: [jsxRuntime.jsx("h1", { children: "Something went wrong." }), jsxRuntime.jsxs("p", { style: { margin: '10px 0 10px 0' }, children: [jsxRuntime.jsx("a", { href: "#reset", onClick: onClear, style: { color: 'red', textDecoration: 'underline' }, children: "Click here" }), ' ', "to restart the application"] }), jsxRuntime.jsxs("p", { children: ["If that doesn't help, please reach out to us at", ' ', jsxRuntime.jsx("a", { href: "mailto:info@mychoice.ca", children: "info@mychoice.ca" })] })] }));
4301
+ };
4302
+
4293
4303
  const AppWrapperConfig = (props) => {
4294
4304
  mychoiceSdkStore.initHttpResponse();
4295
4305
  const { appType } = props;
@@ -4303,7 +4313,7 @@ const AppWrapperConfig = (props) => {
4303
4313
  return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(AppLoader, {}), jsxRuntime.jsx(AppConfig, { appType: appType }), drawWrapper && isReady
4304
4314
  && jsxRuntime.jsx(AppRoutes, { appType: appType })] }));
4305
4315
  };
4306
- const AppWrapper = ({ appType }) => (jsxRuntime.jsx(mychoiceSdkStore.StoreProvider, { children: jsxRuntime.jsx(AppWrapperConfig, { appType: appType }) }));
4316
+ const AppWrapper = ({ appType }) => (jsxRuntime.jsx(mychoiceSdkStore.StoreProvider, { children: jsxRuntime.jsx(reactErrorBoundary.ErrorBoundary, { fallbackRender: AppErrorScreen, children: jsxRuntime.jsx(AppWrapperConfig, { appType: appType }) }) }));
4307
4317
  AppWrapper.defaultProps = {
4308
4318
  appType: mychoiceSdkComponents.AppTypes.MyChoice,
4309
4319
  insuranceType: mychoiceSdkComponents.InsuranceTypes.Car,