@mychoice/mychoice-sdk-modules 2.1.2 → 2.1.4

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');
@@ -1811,7 +1812,7 @@ const SectionConfirm = () => {
1811
1812
  };
1812
1813
  if (!bestQuote)
1813
1814
  return null;
1814
- return (jsxRuntime.jsxs("div", { style: { zIndex: '1' }, children: [jsxRuntime.jsxs("div", { className: "shadow-box", children: [jsxRuntime.jsx("div", { className: "highlighted-heading", children: "Best Offer" }), jsxRuntime.jsx("h1", { children: `$${bestQuote.priceMonthly} / month` }), jsxRuntime.jsx("div", { className: "highlighted-heading", children: jsxRuntime.jsx("span", { children: `$${bestQuote.priceYearly} / year` }) })] }), jsxRuntime.jsxs("div", { className: "statistics-wrapper", children: [jsxRuntime.jsx("div", { className: "counter", id: "output", children: comparedCountMin }), jsxRuntime.jsx("div", { className: "divider" }), jsxRuntime.jsx("div", { style: { textAlign: 'center', fontSize: '1.15rem', marginTop: '10px' }, children: `Canadians have compared rates in the last 24 hours and saved ${savedPercentage}% on average` })] }), jsxRuntime.jsx("div", { style: { marginBottom: '2rem' }, children: jsxRuntime.jsx("div", { className: "all-quotes-form", children: jsxRuntime.jsx("h2", { style: { whiteSpace: 'normal', marginTop: '20px', textAlign: 'center' }, children: `${lockEmoji} Complete the form below to see which companies are offering your quotes.` }) }) }), jsxRuntime.jsx("div", { style: { marginBottom: '1rem' }, children: jsxRuntime.jsx(InputFormBox, { name: "firstName", title: "First Name", onChange: handleFirstNameChange, defaultValue: firstName, placeholder: "Your First Name", error: !firstName && discountState.inValidation, errorMessage: getErrorMessage(firstName, discountState.inValidation) }) }), jsxRuntime.jsx("div", { style: { marginBottom: '1rem' }, children: jsxRuntime.jsx(InputFormBox, { name: "lastname", title: "Last Name", onChange: handleLastNameChange, defaultValue: lastName, placeholder: "Your Last Name", error: !lastName && discountState.inValidation, errorMessage: getErrorMessage(lastName, discountState.inValidation) }) }), jsxRuntime.jsx("div", { style: { marginBottom: '1rem' }, children: jsxRuntime.jsx(InputFormPhoneBox, { name: "phone", onChange: handlePhoneNumberChange, defaultValue: phone, title: "Phone Number", placeholder: "(111) 111-1111", error: !phone && discountState.inValidation, errorMessage: getErrorMessage(phone, discountState.inValidation) }) }), jsxRuntime.jsx("div", { className: "submit-wrapper", children: jsxRuntime.jsx(mychoiceSdkComponents.ButtonBase, { className: "mychoice", size: mychoiceSdkComponents.SizeTypes.Large, category: mychoiceSdkComponents.CategoryTypes.Filled, onClick: handleSubmit, color: mychoiceSdkComponents.ColorTypes.Primary, label: "Get Your Quote" }) }), jsxRuntime.jsxs("div", { className: "extra-info", children: [jsxRuntime.jsx("h5", { children: "On the next page, you will also be able to:" }), jsxRuntime.jsx("div", { className: "next-page-points", children: jsxRuntime.jsxs("div", { style: { display: 'flex', flexDirection: 'column' }, children: [jsxRuntime.jsxs("div", { className: "bullet-container", children: [jsxRuntime.jsx("div", { className: "bullet-point", children: "1" }), jsxRuntime.jsx("div", { children: "See what rates insurance carriers are offering" })] }), jsxRuntime.jsxs("div", { className: "bullet-container", children: [jsxRuntime.jsx("div", { className: "bullet-point", children: "2" }), jsxRuntime.jsx("div", { children: "Get in touch with a broker and secure your rate" })] }), jsxRuntime.jsxs("div", { className: "bullet-container", children: [jsxRuntime.jsx("div", { className: "bullet-point", children: "3" }), jsxRuntime.jsx("div", { children: "Potentially save more by speaking with a broker" })] })] }) }), jsxRuntime.jsx("div", { className: "privacy-policy", children: jsxRuntime.jsxs("p", { children: ["Once you submit this form, you are agreeing to have your insurance quote sent to you via email and My Choice will provide your contact information to one of our trusted broker partners, who will contact you after your quote is complete to further assist you in securing your best rate. For more details, see our", jsxRuntime.jsx("a", { href: "https://www.mychoice.ca/privacy-policy/", children: " Privacy Policy" }), "."] }) })] })] }));
1815
+ return (jsxRuntime.jsxs("div", { style: { zIndex: '1' }, children: [jsxRuntime.jsxs("div", { className: "shadow-box", children: [jsxRuntime.jsx("div", { className: "highlighted-heading", children: "Best Offer" }), jsxRuntime.jsx("h1", { children: `$${bestQuote.priceMonthly} / month` }), jsxRuntime.jsx("div", { className: "highlighted-heading", children: jsxRuntime.jsx("span", { children: `$${bestQuote.priceYearly} / year` }) })] }), jsxRuntime.jsxs("div", { className: "statistics-wrapper", children: [jsxRuntime.jsx("div", { className: "counter", id: "output", children: comparedCountMin.toLocaleString('en-US') }), jsxRuntime.jsx("div", { className: "divider" }), jsxRuntime.jsx("div", { style: { textAlign: 'center', fontSize: '1.15rem', marginTop: '10px' }, children: ` and saved ${savedPercentage}% on average` })] }), jsxRuntime.jsx("div", { style: { marginBottom: '2rem' }, children: jsxRuntime.jsx("div", { className: "all-quotes-form", children: jsxRuntime.jsx("h2", { style: { whiteSpace: 'normal', marginTop: '20px', textAlign: 'center' }, children: `${lockEmoji} Complete the form below to see which companies are offering your quotes.` }) }) }), jsxRuntime.jsx("div", { style: { marginBottom: '1rem' }, children: jsxRuntime.jsx(InputFormBox, { name: "firstName", title: "First Name", onChange: handleFirstNameChange, defaultValue: firstName, placeholder: "Your First Name", error: !firstName && discountState.inValidation, errorMessage: getErrorMessage(firstName, discountState.inValidation) }) }), jsxRuntime.jsx("div", { style: { marginBottom: '1rem' }, children: jsxRuntime.jsx(InputFormBox, { name: "lastname", title: "Last Name", onChange: handleLastNameChange, defaultValue: lastName, placeholder: "Your Last Name", error: !lastName && discountState.inValidation, errorMessage: getErrorMessage(lastName, discountState.inValidation) }) }), jsxRuntime.jsx("div", { style: { marginBottom: '1rem' }, children: jsxRuntime.jsx(InputFormPhoneBox, { name: "phone", onChange: handlePhoneNumberChange, defaultValue: phone, title: "Phone Number", placeholder: "(111) 111-1111", error: !phone && discountState.inValidation, errorMessage: getErrorMessage(phone, discountState.inValidation) }) }), jsxRuntime.jsx("div", { className: "submit-wrapper", children: jsxRuntime.jsx(mychoiceSdkComponents.ButtonBase, { className: "mychoice", size: mychoiceSdkComponents.SizeTypes.Large, category: mychoiceSdkComponents.CategoryTypes.Filled, onClick: handleSubmit, color: mychoiceSdkComponents.ColorTypes.Primary, label: "Get Your Quote" }) }), jsxRuntime.jsxs("div", { className: "extra-info", children: [jsxRuntime.jsx("h5", { children: "On the next page, you will also be able to:" }), jsxRuntime.jsx("div", { className: "next-page-points", children: jsxRuntime.jsxs("div", { style: { display: 'flex', flexDirection: 'column' }, children: [jsxRuntime.jsxs("div", { className: "bullet-container", children: [jsxRuntime.jsx("div", { className: "bullet-point", children: "1" }), jsxRuntime.jsx("div", { children: "See what rates insurance carriers are offering" })] }), jsxRuntime.jsxs("div", { className: "bullet-container", children: [jsxRuntime.jsx("div", { className: "bullet-point", children: "2" }), jsxRuntime.jsx("div", { children: "Get in touch with a broker and secure your rate" })] }), jsxRuntime.jsxs("div", { className: "bullet-container", children: [jsxRuntime.jsx("div", { className: "bullet-point", children: "3" }), jsxRuntime.jsx("div", { children: "Potentially save more by speaking with a broker" })] })] }) }), jsxRuntime.jsx("div", { className: "privacy-policy", children: jsxRuntime.jsxs("p", { children: ["Once you submit this form, you are agreeing to have your insurance quote sent to you via email and My Choice will provide your contact information to one of our trusted broker partners, who will contact you after your quote is complete to further assist you in securing your best rate. For more details, see our", jsxRuntime.jsx("a", { href: "https://www.mychoice.ca/privacy-policy/", children: " Privacy Policy" }), "."] }) })] })] }));
1815
1816
  };
1816
1817
 
1817
1818
  const SplashScreen$2 = () => {
@@ -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,