@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 CHANGED
@@ -1571,10 +1571,10 @@ const getDynamicLicenceBoxProps = ({ isAlbertaProvince, isOntarioProvince, isNew
1571
1571
  if (isAlbertaProvince) {
1572
1572
  return {
1573
1573
  placeholder: 'AB1234',
1574
- maxLength: 9,
1574
+ maxLength: 10,
1575
1575
  manipulateInput: (value) => {
1576
1576
  if (value.length > 6)
1577
- return value.replace(/-/g, '').replace(/^(.{5})(.)/, '$1-$2');
1577
+ return value.replace(/-/g, '').replace(/^(.{6})(.)/, '$1-$2');
1578
1578
  return value;
1579
1579
  },
1580
1580
  };
@@ -1583,7 +1583,10 @@ const getDynamicLicenceBoxProps = ({ isAlbertaProvince, isOntarioProvince, isNew
1583
1583
  return {
1584
1584
  placeholder: 'V1234-12345-12345',
1585
1585
  maxLength: 17,
1586
- manipulateInput: (value) => (value.replace(/ /g, '').replace(/-/g, '').replace(/.{5}(?=.)/g, '$&-')),
1586
+ manipulateInput: (value) => value
1587
+ .replace(/ /g, '')
1588
+ .replace(/-/g, '')
1589
+ .replace(/.{5}(?=.)/g, '$&-'),
1587
1590
  };
1588
1591
  }
1589
1592
  if (isNewfoundlandProvince) {
@@ -3008,10 +3011,31 @@ BlockSubmit.defaultProps = {
3008
3011
  };
3009
3012
 
3010
3013
  const lockEmoji = '\u{1F512}';
3014
+ const getSavedPercentage = () => {
3015
+ const currentDay = new Date().getDate();
3016
+ const options = [25, 26, 27, 28, 29, 30];
3017
+ for (let i = 0; i < options.length; i++) {
3018
+ if (currentDay % options.length === i) {
3019
+ return options[i];
3020
+ }
3021
+ }
3022
+ return 30;
3023
+ };
3024
+ const getInitComparedCount = () => {
3025
+ const currentDay = new Date().getDate();
3026
+ const options = [1003, 1102, 1343, 1412, 1502];
3027
+ for (let i = 0; i < options.length; i++) {
3028
+ if (currentDay % options.length === i) {
3029
+ return options[i];
3030
+ }
3031
+ }
3032
+ return 1102;
3033
+ };
3011
3034
  const SectionApplicant = () => {
3035
+ const initComparedCount = getInitComparedCount();
3036
+ const savedPercentage = getSavedPercentage();
3012
3037
  const [comparedCountMin, setComparedCountMin] = React.useState(1000);
3013
- const [comparedCountMax] = React.useState(lodash.random(1021, 1502));
3014
- const savedPercentage = lodash.random(25, 30);
3038
+ const [comparedCountMax] = React.useState(initComparedCount);
3015
3039
  const { appConfigState: { appType }, } = mychoiceSdkStore.useStoreAppConfig();
3016
3040
  const isTheBig = appType === mychoiceSdkComponents.AppTypes.TheBig;
3017
3041
  const { applicantState, dispatchApplicantState } = mychoiceSdkStore.useStoreFormLifeApplicant();
@@ -3091,7 +3115,7 @@ const SectionApplicant = () => {
3091
3115
  textAlign: 'center',
3092
3116
  fontSize: '1.15rem',
3093
3117
  marginTop: '10px',
3094
- }, children: `Canadians have compared rates in the last 24 hours and saved ${savedPercentage}% on average` })] }), jsxRuntime.jsx("h2", { className: "section-title", style: { textAlign: 'center' }, children: `${lockEmoji} Complete the form below to see which companies are offering your quotes.` }), jsxRuntime.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!" }), 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 ? (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" })] })] })) : (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
3118
+ }, children: `Canadians have compared rates in the last 24 hours and saved ${savedPercentage}% on average` })] }), jsxRuntime.jsx("h2", { className: "section-title", style: { textAlign: 'center' }, children: `${lockEmoji} Complete the form below to see which companies are offering your quotes.` }), jsxRuntime.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!" }), 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 && (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" })] })] })), 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
3095
3119
  ? errorMessage
3096
3120
  : getErrorMessage(email, inValidation), error: emailStatus === mychoiceSdkComponents.ValidationStatusTypes.Declined ||
3097
3121
  (!email && inValidation) }), jsxRuntime.jsx(BlockSubmit, { className: isTheBig ? 'thebig-bold' : '' }), jsxRuntime.jsx(BlockNextPageInfo, {})] }));