@mychoice/mychoice-sdk-modules 2.2.1 → 2.2.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
@@ -517,7 +517,7 @@ const HeaderBeginInsurance = ({ className }) => {
517
517
  const { appConfigState: { insuranceType }, } = mychoiceSdkStore.useStoreAppConfig();
518
518
  const insuranceTypeCls = insuranceType !== mychoiceSdkComponents.InsuranceTypes.Car && insuranceType !== mychoiceSdkComponents.InsuranceTypes.Life ? mychoiceSdkComponents.InsuranceTypes.Home : insuranceType;
519
519
  const { externalPathGroup } = usePathGroups(insuranceTypeCls);
520
- return (jsxRuntime.jsx("div", { className: `${className} primary-header`, children: jsxRuntime.jsxs("div", { className: "content", children: [jsxRuntime.jsx("div", { className: "logo", children: jsxRuntime.jsx("a", { href: "https://www.begininsurance.com/", rel: "noreferrer", children: jsxRuntime.jsx("img", { src: logo, alt: "Begin Insurance" }) }) }), jsxRuntime.jsx("div", { className: "nav-links", children: jsxRuntime.jsx(mychoiceSdkComponents.HeaderNavGroup, { className: insuranceTypeCls, navItems: externalPathGroup, isExternal: true }) }), jsxRuntime.jsx("div", { className: "empty-box" })] }) }));
520
+ return (jsxRuntime.jsx("div", { className: `${className} primary-header`, children: jsxRuntime.jsxs("div", { className: "content", children: [jsxRuntime.jsx("div", { className: "logo", children: jsxRuntime.jsx("a", { href: "https://begininsurance.ca/en", rel: "noreferrer", children: jsxRuntime.jsx("img", { src: logo, alt: "Begin Insurance" }) }) }), jsxRuntime.jsx("div", { className: "nav-links", children: jsxRuntime.jsx(mychoiceSdkComponents.HeaderNavGroup, { className: insuranceTypeCls, navItems: externalPathGroup, isExternal: true }) }), jsxRuntime.jsx("div", { className: "empty-box" })] }) }));
521
521
  };
522
522
  HeaderBeginInsurance.defaultProps = {
523
523
  className: '',
@@ -543,7 +543,7 @@ const HeaderBeginInsuranceMobile = ({ className }) => {
543
543
  const handleMenuClick = () => {
544
544
  setIsMenuOpen(!isMenuOpen);
545
545
  };
546
- return (jsxRuntime.jsxs("div", { className: `${className} ${isMenuOpen ? 'open' : ''} primary-header-mobile`, children: [jsxRuntime.jsxs("div", { className: "content-mobile", children: [jsxRuntime.jsx("div", { className: "logo", children: jsxRuntime.jsx("a", { href: "https://www.begininsurance.com/", target: "_blank", rel: "noreferrer", children: jsxRuntime.jsx("img", { src: logo, alt: "Begin Insurance" }) }) }), jsxRuntime.jsx(mychoiceSdkComponents.ButtonMenu, { className: `${className} ${isMenuOpen ? 'is-active' : ''}`, onClick: handleMenuClick })] }), isMenuOpen && (jsxRuntime.jsx("div", { className: "menu-items", children: jsxRuntime.jsx("div", { className: "nav-links", children: jsxRuntime.jsx(mychoiceSdkComponents.HeaderNavGroup, { className: insuranceType, navItems: externalPathGroup, isExternal: true }) }) }))] }));
546
+ return (jsxRuntime.jsxs("div", { className: `${className} ${isMenuOpen ? 'open' : ''} primary-header-mobile`, children: [jsxRuntime.jsxs("div", { className: "content-mobile", children: [jsxRuntime.jsx("div", { className: "logo", children: jsxRuntime.jsx("a", { href: "https://begininsurance.ca/en", target: "_blank", rel: "noreferrer", children: jsxRuntime.jsx("img", { src: logo, alt: "Begin Insurance" }) }) }), jsxRuntime.jsx(mychoiceSdkComponents.ButtonMenu, { className: `${className} ${isMenuOpen ? 'is-active' : ''}`, onClick: handleMenuClick })] }), isMenuOpen && (jsxRuntime.jsx("div", { className: "menu-items", children: jsxRuntime.jsx("div", { className: "nav-links", children: jsxRuntime.jsx(mychoiceSdkComponents.HeaderNavGroup, { className: insuranceType, navItems: externalPathGroup, isExternal: true }) }) }))] }));
547
547
  };
548
548
  HeaderBeginInsuranceMobile.defaultProps = {
549
549
  className: '',
@@ -3630,7 +3630,7 @@ StepsBox.defaultProps = {
3630
3630
  activeIndex: 0,
3631
3631
  };
3632
3632
 
3633
- const ButtonsBox = ({ formSteps, validationHooks, clearForm, }) => {
3633
+ const ButtonsBox = ({ formSteps, validationHooks, clearForm }) => {
3634
3634
  const { pathname } = reactRouterDom.useLocation();
3635
3635
  const navigate = reactRouterDom.useNavigate();
3636
3636
  const { appConfigState } = mychoiceSdkStore.useStoreAppConfig();
@@ -3651,7 +3651,7 @@ const ButtonsBox = ({ formSteps, validationHooks, clearForm, }) => {
3651
3651
  let activeIndex = formSteps.indexOf(activeStep);
3652
3652
  activeIndex = activeIndex === -1 ? 0 : activeIndex;
3653
3653
  const onForwardClick = () => {
3654
- const { validateOptions: { validate, isValid }, requestFn } = validationHooks[activeIndex] || { validateOptions: { isValid: true } };
3654
+ const { validateOptions: { validate, isValid }, requestFn, } = validationHooks[activeIndex] || { validateOptions: { isValid: true } };
3655
3655
  const formIsValid = !isValid ? validate && validate() : isValid;
3656
3656
  if (activeIndex < formSteps.length && formIsValid) {
3657
3657
  if (requestFn) {
@@ -3670,11 +3670,12 @@ const ButtonsBox = ({ formSteps, validationHooks, clearForm, }) => {
3670
3670
  }
3671
3671
  };
3672
3672
  const onFinishClick = () => {
3673
+ const companyName = appType === mychoiceSdkComponents.AppTypes.BeginInsurance ? 'Begin Insurance' : 'My Choice';
3673
3674
  dispatchAppModalState({
3674
3675
  type: mychoiceSdkStore.StoreConfigAppModalActionTypes.AppModalFinaleModal,
3675
3676
  payload: {
3676
3677
  title: 'Thank You!',
3677
- description: 'Thanks for using My Choice to compare car insurance rates.',
3678
+ description: `Thanks for using ${companyName} to compare insurance rates.`,
3678
3679
  submitCallBack: () => {
3679
3680
  navigate(`/${localIndex}/${insuranceType}${formSteps[0].path}`);
3680
3681
  if (clearForm) {
@@ -3699,8 +3700,7 @@ const ButtonsBox = ({ formSteps, validationHooks, clearForm, }) => {
3699
3700
  },
3700
3701
  });
3701
3702
  };
3702
- return (jsxRuntime.jsxs("div", { className: "buttons-box", children: [activeIndex === 0 ? (jsxRuntime.jsx(mychoiceSdkComponents.ButtonBase, { size: isMobile ? mychoiceSdkComponents.SizeTypes.Small : mychoiceSdkComponents.SizeTypes.Medium, category: mychoiceSdkComponents.CategoryTypes.Outlined, color: mychoiceSdkComponents.ColorTypes.Secondary, variant: mychoiceSdkComponents.ButtonVariantTypes.Circle, className: "button-arrow button-with-text", onClick: onClearClick, children: jsxRuntime.jsx("span", { children: "Clear Form" }) }))
3703
- : (jsxRuntime.jsx(mychoiceSdkComponents.ButtonArrow, { direction: mychoiceSdkComponents.DirectionTypes.Left, category: mychoiceSdkComponents.CategoryTypes.Outlined, color: mychoiceSdkComponents.ColorTypes.Secondary, size: isMobile ? mychoiceSdkComponents.SizeTypes.Small : mychoiceSdkComponents.SizeTypes.Medium, onClick: onBackClick })), activeIndex === formSteps.length - 1 ? (jsxRuntime.jsx(jsxRuntime.Fragment, { children: !isTheBig && (jsxRuntime.jsx(mychoiceSdkComponents.ButtonBase, { size: isMobile ? mychoiceSdkComponents.SizeTypes.Small : mychoiceSdkComponents.SizeTypes.Medium, category: mychoiceSdkComponents.CategoryTypes.Filled, color: mychoiceSdkComponents.ColorTypes.Secondary, variant: mychoiceSdkComponents.ButtonVariantTypes.Circle, className: "button-arrow button-with-text", onClick: onFinishClick, children: jsxRuntime.jsx("span", { children: "Finish" }) })) })) : (jsxRuntime.jsx(mychoiceSdkComponents.ButtonArrow, { direction: mychoiceSdkComponents.DirectionTypes.Right, category: mychoiceSdkComponents.CategoryTypes.Filled, color: mychoiceSdkComponents.ColorTypes.Secondary, size: isMobile ? mychoiceSdkComponents.SizeTypes.Small : mychoiceSdkComponents.SizeTypes.Medium, onClick: onForwardClick }))] }));
3703
+ return (jsxRuntime.jsxs("div", { className: "buttons-box", children: [activeIndex === 0 ? (jsxRuntime.jsx(mychoiceSdkComponents.ButtonBase, { size: isMobile ? mychoiceSdkComponents.SizeTypes.Small : mychoiceSdkComponents.SizeTypes.Medium, category: mychoiceSdkComponents.CategoryTypes.Outlined, color: mychoiceSdkComponents.ColorTypes.Secondary, variant: mychoiceSdkComponents.ButtonVariantTypes.Circle, className: "button-arrow button-with-text", onClick: onClearClick, children: jsxRuntime.jsx("span", { children: "Clear Form" }) })) : (jsxRuntime.jsx(mychoiceSdkComponents.ButtonArrow, { direction: mychoiceSdkComponents.DirectionTypes.Left, category: mychoiceSdkComponents.CategoryTypes.Outlined, color: mychoiceSdkComponents.ColorTypes.Secondary, size: isMobile ? mychoiceSdkComponents.SizeTypes.Small : mychoiceSdkComponents.SizeTypes.Medium, onClick: onBackClick })), activeIndex === formSteps.length - 1 ? (jsxRuntime.jsx(jsxRuntime.Fragment, { children: !isTheBig && (jsxRuntime.jsx(mychoiceSdkComponents.ButtonBase, { size: isMobile ? mychoiceSdkComponents.SizeTypes.Small : mychoiceSdkComponents.SizeTypes.Medium, category: mychoiceSdkComponents.CategoryTypes.Filled, color: mychoiceSdkComponents.ColorTypes.Secondary, variant: mychoiceSdkComponents.ButtonVariantTypes.Circle, className: "button-arrow button-with-text", onClick: onFinishClick, children: jsxRuntime.jsx("span", { children: "Finish" }) })) })) : (jsxRuntime.jsx(mychoiceSdkComponents.ButtonArrow, { direction: mychoiceSdkComponents.DirectionTypes.Right, category: mychoiceSdkComponents.CategoryTypes.Filled, color: mychoiceSdkComponents.ColorTypes.Secondary, size: isMobile ? mychoiceSdkComponents.SizeTypes.Small : mychoiceSdkComponents.SizeTypes.Medium, onClick: onForwardClick }))] }));
3704
3704
  };
3705
3705
  ButtonsBox.defaultProps = {
3706
3706
  isMobile: false,
@@ -4528,6 +4528,10 @@ const AppConfig = (props) => {
4528
4528
  const localIndex = window.location.pathname.split('/')[1];
4529
4529
  const authHandler = mychoiceSdkStore.useHandlerAuth();
4530
4530
  const partnerHandler = mychoiceSdkStore.useHandlerPartner();
4531
+ // Check if localIndex is actually an insurance type (car, home, condo, tenant, life)
4532
+ // In that case, it should not be treated as a partner ID
4533
+ const insuranceTypeValues = Object.values(mychoiceSdkComponents.InsuranceTypes);
4534
+ const isInsuranceTypePath = insuranceTypeValues.includes(localIndex);
4531
4535
  const windowResize = () => {
4532
4536
  dispatchDeviceState({
4533
4537
  type: mychoiceSdkStore.StoreConfigAppDeviceActionTypes.AppDeviceSetSize,
@@ -4546,7 +4550,7 @@ const AppConfig = (props) => {
4546
4550
  payload: appType,
4547
4551
  });
4548
4552
  }
4549
- if (appType !== mychoiceSdkComponents.AppTypes.TheBig && localIndex !== mychoiceSdkComponents.defaultLocalIndex && localIndex !== '') {
4553
+ if (appType !== mychoiceSdkComponents.AppTypes.TheBig && localIndex !== mychoiceSdkComponents.defaultLocalIndex && localIndex !== '' && !isInsuranceTypePath) {
4550
4554
  partnerHandler.getPartner(localIndex);
4551
4555
  }
4552
4556
  else {