@mychoice/mychoice-sdk-modules 2.1.27 → 2.1.28

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
@@ -135,7 +135,6 @@ const SwitchButtonBox = (props) => {
135
135
  };
136
136
  const handleClick = React.useCallback((selectedItem) => () => {
137
137
  setActiveId(selectedItem.value);
138
- console.log(selectedItem.value, "value?");
139
138
  if (onChange) {
140
139
  onChange({
141
140
  name,
@@ -2952,7 +2951,9 @@ const SectionCoverage = () => {
2952
2951
  payload: { coverage: value },
2953
2952
  });
2954
2953
  };
2955
- return (jsxRuntime.jsxs("div", { className: "form-section", children: [jsxRuntime.jsx("h2", { className: "section-title", style: { textAlign: 'center' }, children: "Let us meet your needs." }), jsxRuntime.jsx(SelectFormBox, { options: mychoiceSdkComponents.lifeProvinceOptions, name: "province", onChange: handleProvinceChange, defaultValue: province, title: "Province", placeholder: "Select", autoSelectIfValueIsOutOfOptions: false, error: !province && inValidation, errorMessage: getErrorMessage(type, inValidation) }), jsxRuntime.jsx(SelectFormBox, { options: mychoiceSdkComponents.lifeInsuranceTypeOptions, name: "type", onChange: handleLifeInsuranceTypeChange, defaultValue: type, title: "Type of Insurance", description: jsxRuntime.jsx(Description, {}), placeholder: "Select", autoSelectIfValueIsOutOfOptions: false, error: !type && inValidation, errorMessage: getErrorMessage(type, inValidation) }), jsxRuntime.jsx(SelectFormBox, { options: mychoiceSdkComponents.lifeCoverageOptions, name: "coverage", onChange: handleCoverageChange, defaultValue: coverage, title: "Required coverage", description: "The extent of coverage you need is determined by several factors,\n including your expenditure patterns, anticipated future expenses, yearly earnings,\n and so forth. Generally, individuals opt for a coverage amount that equals five\n times their current annual income before taxes. On an average,\n it is observed that Canadians choose a coverage amount of around $500,000.", placeholder: "Select", autoSelectIfValueIsOutOfOptions: false, error: !coverage && inValidation, errorMessage: getErrorMessage(coverage, inValidation) })] }));
2954
+ console.log(mychoiceSdkComponents.lifeInsuranceTypeOptions, "opts");
2955
+ const newLifeOptions = mychoiceSdkComponents.lifeInsuranceTypeOptions.filter(option => option.name.includes("Year Level") && option.name !== "40 Year Level Term");
2956
+ return (jsxRuntime.jsxs("div", { className: "form-section", children: [jsxRuntime.jsx("h2", { className: "section-title", style: { textAlign: 'center' }, children: "Let us meet your needs." }), jsxRuntime.jsx(SelectFormBox, { options: mychoiceSdkComponents.lifeProvinceOptions, name: "province", onChange: handleProvinceChange, defaultValue: province, title: "Province", placeholder: "Select", autoSelectIfValueIsOutOfOptions: false, error: !province && inValidation, errorMessage: getErrorMessage(type, inValidation) }), jsxRuntime.jsx(SelectFormBox, { options: newLifeOptions, name: "type", onChange: handleLifeInsuranceTypeChange, defaultValue: type, title: "Type of Insurance", description: jsxRuntime.jsx(Description, {}), placeholder: "Select", autoSelectIfValueIsOutOfOptions: false, error: !type && inValidation, errorMessage: getErrorMessage(type, inValidation) }), jsxRuntime.jsx(SelectFormBox, { options: mychoiceSdkComponents.lifeCoverageOptions, name: "coverage", onChange: handleCoverageChange, defaultValue: coverage, title: "Required coverage", description: "The extent of coverage you need is determined by several factors,\n including your expenditure patterns, anticipated future expenses, yearly earnings,\n and so forth. Generally, individuals opt for a coverage amount that equals five\n times their current annual income before taxes. On an average,\n it is observed that Canadians choose a coverage amount of around $500,000.", placeholder: "Select", autoSelectIfValueIsOutOfOptions: false, error: !coverage && inValidation, errorMessage: getErrorMessage(coverage, inValidation) })] }));
2956
2957
  };
2957
2958
 
2958
2959
  const PageCoverage = () => {
@@ -3061,7 +3062,6 @@ const SectionApplicant = () => {
3061
3062
  const handleEmailChange = ({ value }) => {
3062
3063
  validateEmail(value);
3063
3064
  };
3064
- console.log(getSelectedOption(mychoiceSdkComponents.smokerOptions, smoker), "show me");
3065
3065
  return (jsxRuntime.jsxs("div", { className: "form-section", children: [jsxRuntime.jsx("h2", { className: "section-title", style: { textAlign: 'center' }, children: "Just the basics about you." }), jsxRuntime.jsx(DateSelectFormBox, { name: "dateOfBirth", dateNames: ['birthYear', 'birthMonth', 'birthDay'], onDateChange: handleDateOfBirthChange, defaultValue: defaultDateOfBirth, title: "Date of birth", error: inValidation, errorMessage: getDateErrorMessage([birthDay || '', birthMonth || '', birthYear || ''], inValidation), maxDate: mychoiceSdkComponents.subYearsFromDate('', 14), isDay: true }), jsxRuntime.jsx(SelectFormBox, { options: mychoiceSdkComponents.genderOptions, name: "gender", onChange: handleGenderChange, defaultValue: getSelectedOption(mychoiceSdkComponents.genderOptions, gender), title: "Gender", placeholder: "Select", autoSelectIfValueIsOutOfOptions: false, error: !gender && inValidation, errorMessage: getErrorMessage(`${gender}`.toString(), inValidation) }), jsxRuntime.jsx(SwitchButtonBox, { items: mychoiceSdkComponents.smokerOptions, onChange: handleSmokerChange, name: "smoker", defaultValue: getSelectedOption(mychoiceSdkComponents.smokerOptions, smoker), title: "Smoker" }), isTheBig
3066
3066
  ? (jsxRuntime.jsxs("div", { className: "input-form-box-container", children: [jsxRuntime.jsx(LabelFormBox, { title: "Complete this form to see all your personalized\n quotes on the next page, you will also be able to:" }), jsxRuntime.jsxs("ol", { className: "ordered-block", children: [jsxRuntime.jsx("li", { children: "See what rates insurance carriers are offering" }), jsxRuntime.jsx("li", { children: "Get in touch with us and secure your rate" }), jsxRuntime.jsx("li", { children: "Potentially save more by speaking with a broker" })] })] }))
3067
3067
  : jsxRuntime.jsx("h2", { children: "Complete the form below to see which companies are offering your quotes." }), jsxRuntime.jsx(InputFormBox, { name: "firstName", title: "First Name", onChange: handleFirstNameChange, defaultValue: firstName, placeholder: "Your First Name", error: !firstName && inValidation, errorMessage: getErrorMessage(firstName, inValidation) }), jsxRuntime.jsx(InputFormBox, { name: "lastname", title: "Last Name", onChange: handleLastNameChange, defaultValue: lastName, placeholder: "Your Last Name", error: !lastName && inValidation, errorMessage: getErrorMessage(lastName, inValidation) }), jsxRuntime.jsx(InputFormPhoneBox, { name: "phone", onChange: handlePhoneNumberChange, defaultValue: phone, title: "Phone Number", placeholder: "(855) 325-8444", error: !phone && inValidation, errorMessage: getErrorMessage(phone, inValidation) }), jsxRuntime.jsx(InputFormEmailBox, { validationStatus: emailStatus, name: "email", title: "Please provide your email address so we can send you a copy of your quotes", onChange: handleEmailChange, defaultValue: email, placeholder: "johnsmith@mychoice.ca", errorMessage: emailStatus === mychoiceSdkComponents.ValidationStatusTypes.Declined
@@ -3087,8 +3087,6 @@ const SectionQuoteEdit = () => {
3087
3087
  const { applicantState } = mychoiceSdkStore.useStoreFormLifeApplicant();
3088
3088
  const { coverageState } = mychoiceSdkStore.useStoreFormLifeCoverage();
3089
3089
  const { smoker, quoterInfo } = applicantState;
3090
- console.log(applicantState, "applicantState");
3091
- console.log(smoker, "smoker app stat");
3092
3090
  const navigate = reactRouterDom.useNavigate();
3093
3091
  const coverageLabel = mychoiceSdkComponents.coverageOptions.find((item) => item.value.toString() === coverageState.coverage.toString())?.name || '';
3094
3092
  const coverageTypeLabel = mychoiceSdkComponents.lifeInsuranceTypeOptions.find((item) => item.value.toString() === coverageState.type.toString())?.name || '';
@@ -3136,6 +3134,23 @@ const PageLifeQuote = () => {
3136
3134
  behavior: 'smooth',
3137
3135
  });
3138
3136
  });
3137
+ const uniqueItems = items.reduce((acc, currentItem) => {
3138
+ // Check if the company is already added.
3139
+ const existingItem = acc.find((item) => item.company === currentItem.company);
3140
+ if (existingItem) {
3141
+ // If exists, keep the one with the lower priceMonthly.
3142
+ if (currentItem.priceMonthly < existingItem.priceMonthly) {
3143
+ // Replace the existing item with the current item.
3144
+ const index = acc.indexOf(existingItem);
3145
+ acc[index] = currentItem;
3146
+ }
3147
+ }
3148
+ else {
3149
+ // If !exists, add the current item.
3150
+ acc.push(currentItem);
3151
+ }
3152
+ return acc;
3153
+ }, []);
3139
3154
  return (jsxRuntime.jsx("div", { className: "quote-page-content", children: !appLoaderState.isOpen
3140
3155
  && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("div", { className: "form-section-container", children: [appDeviceType === mychoiceSdkComponents.DeviceTypes.Mobile && (jsxRuntime.jsx(jsxRuntime.Fragment, { children: !!items?.length && (jsxRuntime.jsx(jsxRuntime.Fragment, { children: !quoteState.showCallMessage
3141
3156
  ? (jsxRuntime.jsx("div", { className: "offer-container", children: jsxRuntime.jsx(OfferSection, { isBestOffer: true, offerCompany: items[0]?.company, brokerCompany: items[0]?.brokerProfile, offerPrice: {
@@ -3148,8 +3163,8 @@ const PageLifeQuote = () => {
3148
3163
  }, phoneNumber: formatPhoneObject(items[0]?.brokerProfile.phone), redirectUrl: items[0]?.brokerProfile.redirectUrl || '' }) }))
3149
3164
  : jsxRuntime.jsx(SplashScreen, {}) })) })), jsxRuntime.jsx(SectionQuoteEdit, {})] }), appDeviceType !== mychoiceSdkComponents.DeviceTypes.Mobile && quoteState.showCallMessage
3150
3165
  && jsxRuntime.jsx(SplashScreen, {}), !quoteState.showCallMessage
3151
- && (jsxRuntime.jsx("div", { className: "offer-container", children: !!items?.length
3152
- && items.map(({ company, brokerProfile, priceMonthly, priceYearly, }, index) => (jsxRuntime.jsx("div", { children: (appDeviceType !== mychoiceSdkComponents.DeviceTypes.Mobile || (appDeviceType === mychoiceSdkComponents.DeviceTypes.Mobile && index !== 0)) && (jsxRuntime.jsx(OfferSection, { isBestOffer: index === 0, offerCompany: company, brokerCompany: brokerProfile, offerPrice: {
3166
+ && (jsxRuntime.jsx("div", { className: "offer-container", children: !!uniqueItems?.length
3167
+ && uniqueItems.map(({ company, brokerProfile, priceMonthly, priceYearly, }, index) => (jsxRuntime.jsx("div", { children: (appDeviceType !== mychoiceSdkComponents.DeviceTypes.Mobile || (appDeviceType === mychoiceSdkComponents.DeviceTypes.Mobile && index !== 0)) && (jsxRuntime.jsx(OfferSection, { isBestOffer: index === 0, offerCompany: company, brokerCompany: brokerProfile, offerPrice: {
3153
3168
  monthly: priceMonthly,
3154
3169
  yearly: priceYearly,
3155
3170
  }, operationHours: {