@mychoice/mychoice-sdk-modules 2.1.27 → 2.1.29
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 +20 -14
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +21 -15
- package/dist/esm/index.js.map +1 -1
- package/package.json +2 -2
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,8 @@ const SectionCoverage = () => {
|
|
|
2952
2951
|
payload: { coverage: value },
|
|
2953
2952
|
});
|
|
2954
2953
|
};
|
|
2955
|
-
|
|
2954
|
+
const newLifeOptions = mychoiceSdkComponents.lifeInsuranceTypeOptions.filter(option => option.name.includes("Year Level") && option.name !== "40 Year Level Term");
|
|
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: 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
2956
|
};
|
|
2957
2957
|
|
|
2958
2958
|
const PageCoverage = () => {
|
|
@@ -3061,7 +3061,6 @@ const SectionApplicant = () => {
|
|
|
3061
3061
|
const handleEmailChange = ({ value }) => {
|
|
3062
3062
|
validateEmail(value);
|
|
3063
3063
|
};
|
|
3064
|
-
console.log(getSelectedOption(mychoiceSdkComponents.smokerOptions, smoker), "show me");
|
|
3065
3064
|
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
3065
|
? (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
3066
|
: 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 +3086,6 @@ const SectionQuoteEdit = () => {
|
|
|
3087
3086
|
const { applicantState } = mychoiceSdkStore.useStoreFormLifeApplicant();
|
|
3088
3087
|
const { coverageState } = mychoiceSdkStore.useStoreFormLifeCoverage();
|
|
3089
3088
|
const { smoker, quoterInfo } = applicantState;
|
|
3090
|
-
console.log(applicantState, "applicantState");
|
|
3091
|
-
console.log(smoker, "smoker app stat");
|
|
3092
3089
|
const navigate = reactRouterDom.useNavigate();
|
|
3093
3090
|
const coverageLabel = mychoiceSdkComponents.coverageOptions.find((item) => item.value.toString() === coverageState.coverage.toString())?.name || '';
|
|
3094
3091
|
const coverageTypeLabel = mychoiceSdkComponents.lifeInsuranceTypeOptions.find((item) => item.value.toString() === coverageState.type.toString())?.name || '';
|
|
@@ -3136,20 +3133,29 @@ const PageLifeQuote = () => {
|
|
|
3136
3133
|
behavior: 'smooth',
|
|
3137
3134
|
});
|
|
3138
3135
|
});
|
|
3136
|
+
const uniqueItems = items.reduce((acc, currentItem) => {
|
|
3137
|
+
// Check if the company is already added and if so, whether the current item has a lower priceMonthly.
|
|
3138
|
+
if (!acc[currentItem.company] || currentItem.priceMonthly < acc[currentItem.company].priceMonthly) {
|
|
3139
|
+
acc[currentItem.company] = currentItem; // Add or update the item for the company
|
|
3140
|
+
}
|
|
3141
|
+
return acc;
|
|
3142
|
+
}, {});
|
|
3143
|
+
const result = Object.values(uniqueItems);
|
|
3144
|
+
console.log(result, "ach");
|
|
3139
3145
|
return (jsxRuntime.jsx("div", { className: "quote-page-content", children: !appLoaderState.isOpen
|
|
3140
|
-
&& (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("div", { className: "form-section-container", children: [appDeviceType === mychoiceSdkComponents.DeviceTypes.Mobile && (jsxRuntime.jsx(jsxRuntime.Fragment, { children: !!
|
|
3141
|
-
? (jsxRuntime.jsx("div", { className: "offer-container", children: jsxRuntime.jsx(OfferSection, { isBestOffer: true, offerCompany:
|
|
3142
|
-
monthly:
|
|
3143
|
-
yearly:
|
|
3146
|
+
&& (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("div", { className: "form-section-container", children: [appDeviceType === mychoiceSdkComponents.DeviceTypes.Mobile && (jsxRuntime.jsx(jsxRuntime.Fragment, { children: !!result?.length && (jsxRuntime.jsx(jsxRuntime.Fragment, { children: !quoteState.showCallMessage
|
|
3147
|
+
? (jsxRuntime.jsx("div", { className: "offer-container", children: jsxRuntime.jsx(OfferSection, { isBestOffer: true, offerCompany: result[0]?.company, brokerCompany: result[0]?.brokerProfile, offerPrice: {
|
|
3148
|
+
monthly: result[0]?.priceMonthly,
|
|
3149
|
+
yearly: result[0]?.priceYearly,
|
|
3144
3150
|
}, operationHours: {
|
|
3145
|
-
saturdayHours:
|
|
3146
|
-
sundayHours:
|
|
3147
|
-
weekdayHours:
|
|
3151
|
+
saturdayHours: result[0]?.brokerProfile.hoursSaturday,
|
|
3152
|
+
sundayHours: result[0]?.brokerProfile.hoursSunday,
|
|
3153
|
+
weekdayHours: result[0]?.brokerProfile.hoursWorkdays,
|
|
3148
3154
|
}, phoneNumber: formatPhoneObject(items[0]?.brokerProfile.phone), redirectUrl: items[0]?.brokerProfile.redirectUrl || '' }) }))
|
|
3149
3155
|
: jsxRuntime.jsx(SplashScreen, {}) })) })), jsxRuntime.jsx(SectionQuoteEdit, {})] }), appDeviceType !== mychoiceSdkComponents.DeviceTypes.Mobile && quoteState.showCallMessage
|
|
3150
3156
|
&& jsxRuntime.jsx(SplashScreen, {}), !quoteState.showCallMessage
|
|
3151
|
-
&& (jsxRuntime.jsx("div", { className: "offer-container", children: !!
|
|
3152
|
-
&&
|
|
3157
|
+
&& (jsxRuntime.jsx("div", { className: "offer-container", children: !!result?.length
|
|
3158
|
+
&& result.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
3159
|
monthly: priceMonthly,
|
|
3154
3160
|
yearly: priceYearly,
|
|
3155
3161
|
}, operationHours: {
|