@mychoice/mychoice-sdk-modules 2.1.39 → 2.1.41
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 +30 -6
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +30 -6
- package/dist/esm/index.js.map +1 -1
- package/package.json +4 -4
package/dist/esm/index.js
CHANGED
|
@@ -1561,10 +1561,10 @@ const getDynamicLicenceBoxProps = ({ isAlbertaProvince, isOntarioProvince, isNew
|
|
|
1561
1561
|
if (isAlbertaProvince) {
|
|
1562
1562
|
return {
|
|
1563
1563
|
placeholder: 'AB1234',
|
|
1564
|
-
maxLength:
|
|
1564
|
+
maxLength: 10,
|
|
1565
1565
|
manipulateInput: (value) => {
|
|
1566
1566
|
if (value.length > 6)
|
|
1567
|
-
return value.replace(/-/g, '').replace(/^(.{
|
|
1567
|
+
return value.replace(/-/g, '').replace(/^(.{6})(.)/, '$1-$2');
|
|
1568
1568
|
return value;
|
|
1569
1569
|
},
|
|
1570
1570
|
};
|
|
@@ -1573,7 +1573,10 @@ const getDynamicLicenceBoxProps = ({ isAlbertaProvince, isOntarioProvince, isNew
|
|
|
1573
1573
|
return {
|
|
1574
1574
|
placeholder: 'V1234-12345-12345',
|
|
1575
1575
|
maxLength: 17,
|
|
1576
|
-
manipulateInput: (value) =>
|
|
1576
|
+
manipulateInput: (value) => value
|
|
1577
|
+
.replace(/ /g, '')
|
|
1578
|
+
.replace(/-/g, '')
|
|
1579
|
+
.replace(/.{5}(?=.)/g, '$&-'),
|
|
1577
1580
|
};
|
|
1578
1581
|
}
|
|
1579
1582
|
if (isNewfoundlandProvince) {
|
|
@@ -2998,10 +3001,31 @@ BlockSubmit.defaultProps = {
|
|
|
2998
3001
|
};
|
|
2999
3002
|
|
|
3000
3003
|
const lockEmoji = '\u{1F512}';
|
|
3004
|
+
const getSavedPercentage = () => {
|
|
3005
|
+
const currentDay = new Date().getDate();
|
|
3006
|
+
const options = [25, 26, 27, 28, 29, 30];
|
|
3007
|
+
for (let i = 0; i < options.length; i++) {
|
|
3008
|
+
if (currentDay % options.length === i) {
|
|
3009
|
+
return options[i];
|
|
3010
|
+
}
|
|
3011
|
+
}
|
|
3012
|
+
return 30;
|
|
3013
|
+
};
|
|
3014
|
+
const getInitComparedCount = () => {
|
|
3015
|
+
const currentDay = new Date().getDate();
|
|
3016
|
+
const options = [1003, 1102, 1343, 1412, 1502];
|
|
3017
|
+
for (let i = 0; i < options.length; i++) {
|
|
3018
|
+
if (currentDay % options.length === i) {
|
|
3019
|
+
return options[i];
|
|
3020
|
+
}
|
|
3021
|
+
}
|
|
3022
|
+
return 1102;
|
|
3023
|
+
};
|
|
3001
3024
|
const SectionApplicant = () => {
|
|
3025
|
+
const initComparedCount = getInitComparedCount();
|
|
3026
|
+
const savedPercentage = getSavedPercentage();
|
|
3002
3027
|
const [comparedCountMin, setComparedCountMin] = useState(1000);
|
|
3003
|
-
const [comparedCountMax] = useState(
|
|
3004
|
-
const savedPercentage = random(25, 30);
|
|
3028
|
+
const [comparedCountMax] = useState(initComparedCount);
|
|
3005
3029
|
const { appConfigState: { appType }, } = useStoreAppConfig();
|
|
3006
3030
|
const isTheBig = appType === AppTypes.TheBig;
|
|
3007
3031
|
const { applicantState, dispatchApplicantState } = useStoreFormLifeApplicant();
|
|
@@ -3081,7 +3105,7 @@ const SectionApplicant = () => {
|
|
|
3081
3105
|
textAlign: 'center',
|
|
3082
3106
|
fontSize: '1.15rem',
|
|
3083
3107
|
marginTop: '10px',
|
|
3084
|
-
}, children: `Canadians have compared rates in the last 24 hours and saved ${savedPercentage}% on average` })] }), jsx("h2", { className: "section-title", style: { textAlign: 'center' }, children: `${lockEmoji} Complete the form below to see which companies are offering your quotes.` }), jsx("span", { className: "info-title-message", children: "You are seconds away from receiving your life insurance quotes, please provide your email after completing the final steps so we can send you your personalized free life insurance quotes!" }), 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: subYearsFromDate('', 14), isDay: true }), jsx(SelectFormBox, { options: genderOptions, name: "gender", onChange: handleGenderChange, defaultValue: getSelectedOption(genderOptions, gender), title: "Gender", placeholder: "Select", autoSelectIfValueIsOutOfOptions: false, error: !gender && inValidation, errorMessage: getErrorMessage(`${gender}`.toString(), inValidation) }), jsx(SwitchButtonBox, { items: smokerOptions, onChange: handleSmokerChange, name: "smoker", defaultValue: getSelectedOption(smokerOptions, smoker), title: "Smoker" }), isTheBig
|
|
3108
|
+
}, children: `Canadians have compared rates in the last 24 hours and saved ${savedPercentage}% on average` })] }), jsx("h2", { className: "section-title", style: { textAlign: 'center' }, children: `${lockEmoji} Complete the form below to see which companies are offering your quotes.` }), jsx("span", { className: "info-title-message", children: "You are seconds away from receiving your life insurance quotes, please provide your email after completing the final steps so we can send you your personalized free life insurance quotes!" }), 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: subYearsFromDate('', 14), isDay: true }), jsx(SelectFormBox, { options: genderOptions, name: "gender", onChange: handleGenderChange, defaultValue: getSelectedOption(genderOptions, gender), title: "Gender", placeholder: "Select", autoSelectIfValueIsOutOfOptions: false, error: !gender && inValidation, errorMessage: getErrorMessage(`${gender}`.toString(), inValidation) }), jsx(SwitchButtonBox, { items: smokerOptions, onChange: handleSmokerChange, name: "smoker", defaultValue: getSelectedOption(smokerOptions, smoker), title: "Smoker" }), isTheBig && (jsxs("div", { className: "input-form-box-container", children: [jsx(LabelFormBox, { title: "Complete this form to see all your personalized\n quotes on the next page, you will also be able to:" }), jsxs("ol", { className: "ordered-block", children: [jsx("li", { children: "See what rates insurance carriers are offering" }), jsx("li", { children: "Get in touch with us and secure your rate" }), jsx("li", { children: "Potentially save more by speaking with a broker" })] })] })), jsx(InputFormBox, { name: "firstName", title: "First Name", onChange: handleFirstNameChange, defaultValue: firstName, placeholder: "Your First Name", error: !firstName && inValidation, errorMessage: getErrorMessage(firstName, inValidation) }), jsx(InputFormBox, { name: "lastname", title: "Last Name", onChange: handleLastNameChange, defaultValue: lastName, placeholder: "Your Last Name", error: !lastName && inValidation, errorMessage: getErrorMessage(lastName, inValidation) }), jsx(InputFormPhoneBox, { name: "phone", onChange: handlePhoneNumberChange, defaultValue: phone, title: "Phone Number", placeholder: "(855) 325-8444", error: !phone && inValidation, errorMessage: getErrorMessage(phone, inValidation) }), 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 === ValidationStatusTypes.Declined
|
|
3085
3109
|
? errorMessage
|
|
3086
3110
|
: getErrorMessage(email, inValidation), error: emailStatus === ValidationStatusTypes.Declined ||
|
|
3087
3111
|
(!email && inValidation) }), jsx(BlockSubmit, { className: isTheBig ? 'thebig-bold' : '' }), jsx(BlockNextPageInfo, {})] }));
|