@mychoice/mychoice-sdk-modules 2.1.28 → 2.1.30

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/esm/index.js CHANGED
@@ -2941,7 +2941,6 @@ const SectionCoverage = () => {
2941
2941
  payload: { coverage: value },
2942
2942
  });
2943
2943
  };
2944
- console.log(lifeInsuranceTypeOptions, "opts");
2945
2944
  const newLifeOptions = lifeInsuranceTypeOptions.filter(option => option.name.includes("Year Level") && option.name !== "40 Year Level Term");
2946
2945
  return (jsxs("div", { className: "form-section", children: [jsx("h2", { className: "section-title", style: { textAlign: 'center' }, children: "Let us meet your needs." }), jsx(SelectFormBox, { options: lifeProvinceOptions, name: "province", onChange: handleProvinceChange, defaultValue: province, title: "Province", placeholder: "Select", autoSelectIfValueIsOutOfOptions: false, error: !province && inValidation, errorMessage: getErrorMessage(type, inValidation) }), jsx(SelectFormBox, { options: newLifeOptions, name: "type", onChange: handleLifeInsuranceTypeChange, defaultValue: type, title: "Type of Insurance", description: jsx(Description, {}), placeholder: "Select", autoSelectIfValueIsOutOfOptions: false, error: !type && inValidation, errorMessage: getErrorMessage(type, inValidation) }), jsx(SelectFormBox, { options: 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) })] }));
2947
2946
  };
@@ -3125,36 +3124,28 @@ const PageLifeQuote = () => {
3125
3124
  });
3126
3125
  });
3127
3126
  const uniqueItems = items.reduce((acc, currentItem) => {
3128
- // Check if the company is already added.
3129
- const existingItem = acc.find((item) => item.company === currentItem.company);
3130
- if (existingItem) {
3131
- // If exists, keep the one with the lower priceMonthly.
3132
- if (currentItem.priceMonthly < existingItem.priceMonthly) {
3133
- // Replace the existing item with the current item.
3134
- const index = acc.indexOf(existingItem);
3135
- acc[index] = currentItem;
3136
- }
3137
- }
3138
- else {
3139
- // If !exists, add the current item.
3140
- acc.push(currentItem);
3127
+ // Check if the company is already added and if so, whether the current item has a lower priceMonthly.
3128
+ if (!acc[currentItem.company] || currentItem.priceMonthly < acc[currentItem.company].priceMonthly) {
3129
+ acc[currentItem.company] = currentItem; // Add or update the item for the company
3141
3130
  }
3142
3131
  return acc;
3143
- }, []);
3132
+ }, {});
3133
+ const result = Object.values(uniqueItems);
3134
+ console.log(result, "ach");
3144
3135
  return (jsx("div", { className: "quote-page-content", children: !appLoaderState.isOpen
3145
- && (jsxs(Fragment, { children: [jsxs("div", { className: "form-section-container", children: [appDeviceType === DeviceTypes.Mobile && (jsx(Fragment, { children: !!items?.length && (jsx(Fragment, { children: !quoteState.showCallMessage
3146
- ? (jsx("div", { className: "offer-container", children: jsx(OfferSection, { isBestOffer: true, offerCompany: items[0]?.company, brokerCompany: items[0]?.brokerProfile, offerPrice: {
3147
- monthly: items[0]?.priceMonthly,
3148
- yearly: items[0]?.priceYearly,
3136
+ && (jsxs(Fragment, { children: [jsxs("div", { className: "form-section-container", children: [appDeviceType === DeviceTypes.Mobile && (jsx(Fragment, { children: !!result?.length && (jsx(Fragment, { children: !quoteState.showCallMessage
3137
+ ? (jsx("div", { className: "offer-container", children: jsx(OfferSection, { isBestOffer: true, offerCompany: result[0]?.company, brokerCompany: result[0]?.brokerProfile, offerPrice: {
3138
+ monthly: result[0]?.priceMonthly,
3139
+ yearly: result[0]?.priceYearly,
3149
3140
  }, operationHours: {
3150
- saturdayHours: items[0]?.brokerProfile.hoursSaturday,
3151
- sundayHours: items[0]?.brokerProfile.hoursSunday,
3152
- weekdayHours: items[0]?.brokerProfile.hoursWorkdays,
3141
+ saturdayHours: result[0]?.brokerProfile.hoursSaturday,
3142
+ sundayHours: result[0]?.brokerProfile.hoursSunday,
3143
+ weekdayHours: result[0]?.brokerProfile.hoursWorkdays,
3153
3144
  }, phoneNumber: formatPhoneObject(items[0]?.brokerProfile.phone), redirectUrl: items[0]?.brokerProfile.redirectUrl || '' }) }))
3154
3145
  : jsx(SplashScreen, {}) })) })), jsx(SectionQuoteEdit, {})] }), appDeviceType !== DeviceTypes.Mobile && quoteState.showCallMessage
3155
3146
  && jsx(SplashScreen, {}), !quoteState.showCallMessage
3156
- && (jsx("div", { className: "offer-container", children: !!uniqueItems?.length
3157
- && uniqueItems.map(({ company, brokerProfile, priceMonthly, priceYearly, }, index) => (jsx("div", { children: (appDeviceType !== DeviceTypes.Mobile || (appDeviceType === DeviceTypes.Mobile && index !== 0)) && (jsx(OfferSection, { isBestOffer: index === 0, offerCompany: company, brokerCompany: brokerProfile, offerPrice: {
3147
+ && (jsx("div", { className: "offer-container", children: !!result?.length
3148
+ && result.map(({ company, brokerProfile, priceMonthly, priceYearly, }, index) => (jsx("div", { children: (appDeviceType !== DeviceTypes.Mobile || (appDeviceType === DeviceTypes.Mobile && index !== 0)) && (jsx(OfferSection, { isBestOffer: index === 0, offerCompany: company, brokerCompany: brokerProfile, offerPrice: {
3158
3149
  monthly: priceMonthly,
3159
3150
  yearly: priceYearly,
3160
3151
  }, operationHours: {