PageSourceSearch

https://www.bureauengros.com/cdn/shop/t/3770/assets/FlexitiForm-3aebb806.min.js

js bureauengros.com collected 2026-09-25 19:53:18 UTC 50,782 bytes, 12 lines download raw bytes

1import{n as e,m as s,i as E,am as ce,a4 as ue,ar as Je,ap as Ie,as as Ve,ao as de,T as P,an as he,R as Ue,by as Te,b5 as Ze}from"./vendor-4e4afb58.min.js";import{ex as O,ct as S,cv as Xe,bM as er,dk as rr,B as ar,M as sr,cz as nr}from"./index-4aafec89.min.js";import"./lodash.js_shop-f1ea9d13.min.js";import{m as Ae}from"./multiplier-6e9a7cca.min.js";import{s as Qe,g as tr,a as lr,t as or,b as ir,c as cr,d as ur,F as ye,p as dr}from"./FlexitiService-daca63a3.min.js";import"./date-fns.js_shop-9014d6c7.min.js";import"./EmailFormFieldValidator-5dd093c9.min.js";const mr=()=>e.jsx("svg",{version:"1.1",id:"Layer_1",xmlns:"http://www.w3.org/2000/svg",x:"0px",y:"0px",viewBox:"0 0 508.6 161.1",children:e.jsxs("g",{children:[e.jsx("path",{className:"st0",d:"M288,66.8l-12.8-18.6H239l34.4,50.2C277.7,87.9,282.6,76.7,288,66.8z"}),e.jsx("path",{className:"st1",d:"M82.6,157.3V0h29.9v157.2H82.6z"}),e.jsx("path",{className:"st1",d:`M449.6,125.2c0,5.2,1.9,6.6,8.5,7.1h5.2v25h-23.8c-14.6-0.5-20-6.4-19.8-20.7V72.9h-12.5V48.1h12.5V18.4h29.9
2		v29.7h13.7v24.8h-13.7V125.2z`}),e.jsx("path",{className:"st1",d:`M508.6,17.3c0,9.2-7.1,16.3-16.5,16.3c-9.7,0-16.7-7.1-16.7-16.5c0-9.7,7.1-16.7,16.7-16.7
3		S508.6,7.4,508.6,17.3z M506.9,157.3H477V48.1h29.9V157.3z`}),e.jsx("path",{className:"st1",d:`M67,27.6V0H56.3C26.4-0.9,12,12.8,12,42v6.1H0v25.2h12v83.9H42V73.4H67V48.1H42V42c0-7.9,2.9-12,10.3-13.7
4		c2.1-0.5,4.2-0.7,6.4-0.7C60.8,27.6,67,27.6,67,27.6z`}),e.jsx("path",{className:"st1",d:`M156.9,109.9c2.6,15.1,13.7,24.5,28.5,24.5c11.1,0,20.5-5.4,25.2-14.1l27.6,7.5c-10.8,21.2-29.9,33.2-53,33.2
5		c-34.7,0-59.4-24.5-59.4-58.5c0-34.2,23.8-58.2,57.5-58.2c34.9,0,59.2,24.5,59.2,59.6l-0.2,5.9H156.9z M211.6,92.7
6		c-2.6-14.4-13-23.1-27.8-23.1c-14.4,0-24,8.3-26.9,23.1H211.6z`}),e.jsx("g",{children:e.jsx("path",{className:"st0",d:`M318.6,85.5c5.1-10.8,14.4-23.2,24.1-28.2c4.4-2.3,7.7-2.6,13.8-2.8c0,0,0,0,0,0c0,0-0.1,0-0.1-0.1
7			c-9.4-5-17.5-9.6-25.9-9.9c0,0,0,0,0,0c-1,0-2.1-0.1-3.1-0.1c-5.8,0-11.9,0.8-17,3.9c-16.8,10.5-30.6,52.4-39.8,71.7
8			c-5.1,10.8-14.4,23.2-24.1,28.2c-4.4,2.3-7.7,2.6-13.8,2.8c0,0,0,0,0,0c0,0,0.1,0,0.1,0.1c9.4,4.9,17.5,9.5,25.8,9.9c0,0,0,0,0,0
9			c1,0,2.1,0.1,3.1,0.1c5.8,0,11.9-0.8,17-3.9C295.6,146.6,309.4,104.7,318.6,85.5z`})}),e.jsx("path",{className:"st1",d:`M395.8,17.3c0,9.2-7.1,16.3-16.5,16.3c-9.7,0-16.7-7.1-16.7-16.5c0-9.7,7.1-16.7,16.7-16.7
10		S395.8,7.4,395.8,17.3z M394.1,157.3h-29.9V48.1h29.9V157.3z`}),e.jsx("path",{className:"st0",d:"M301.1,138.7l12.8,18.6h36.3l-34.4-50.2C311.4,117.5,306.5,128.8,301.1,138.7z"})]})}),Q=s.createContext(),pr=t=>{var Le,Pe,ke,Be,De,Oe,Me,He,ze,$e,Re,qe;const a=N=>E.t(`default:general.flexiti.application_form.${N}`),[l,r]=s.useState({client_id:((Pe=(Le=window==null?void 0:window.ENV)==null?void 0:Le.Flexiti)==null?void 0:Pe.flexiti_client_id)||"",client_secret:((Be=(ke=window==null?void 0:window.ENV)==null?void 0:ke.Flexiti)==null?void 0:Be.flexiti_client_secret)||"",grant_type:"client_credentials",scope:((Oe=(De=window==null?void 0:window.ENV)==null?void 0:De.Flexiti)==null?void 0:Oe.flexiti_posapi_scope)||"customer"}),n=((He=(Me=window==null?void 0:window.ENV)==null?void 0:Me.Flexiti)==null?void 0:He.flexiti_client_id)||null,{FLEXITI_IMPORTANT_DISCLOSURES:i,FLEXITI_PERSONAL_INFO:o,FLEXITI_FINANCIAL_INFO:h,FLEXITI_TERMS_AND_CONDITIONS:v,FLEXITI_REDIRECT_VALIDATION:m,FLEXITI_APPROVAL_STATUS:p,FLEXITI_APPLICATION_CLOSED:b,FLEXITI_ERROR:u,DEFAULT_AMOUNT_REQUEST:k,CONSUMER:C,BUSINESS:F}=O,[f,c]=s.useState(C),[B,T]=s.useState(!1),[g,L]=s.useState(null),[_,q]=s.useState(null),[H,V]=s.useState(0),[$,D]=s.useState(!1),[j,I]=s.useState(!1),[W,R]=s.useState({}),[M,K]=s.useState((($e=(ze=window==null?void 0:window.bounteous)==null?void 0:ze.l10n)==null?void 0:$e.lang)||"en"),[G,z]=s.useState(a("important_disclosure.welcome_header")),[Y,oe]=s.useState({}),[Z,U]=s.useState({}),[ne,A]=s.useState(!0),[te,le]=s.useState(1),[y,re]=s.useState(i),[x,ie]=s.useState(0),[me,pe]=s.useState({customer_identification:{personal_information:{first_name:"",last_name:"",dob:"",postal_code:""}},flow:"apply",email:"",phone_number:0,address_1:"",city:"",province:"",tos_agreement:!0,account_type:C}),[J,_e]=s.useState({amount_requested:k,phone_number:"",email:"",preferred_language:((qe=(Re=window==null?void 0:window.bounteous)==null?void 0:Re.l10n)==null?void 0:qe.lang)+"-CA"||"en-CA",salutation:"",first_name:"",middle_name:"",last_name:"",dob:"",address_1:"",city:"",province:"",postal_code:"",input_type:"",personal_income:0,household_income:0,housing_type:"",occupation_id:"",occupation_title:"",security_qid:"",security_answer:"",piw:"",widget_session_id:"",tos_agreement:!0}),ve=()=>{je({...l,grant_type:"refresh_token",refresh_token:_},!1)},ae=N=>{N!=null&&N.error&&N.error.indexOf("expired")>-1&&(I(!0),D(!0),re(u))},Fe=N=>{T(N)},ee=async N=>{if(!n&&!g)return;const w=(await window.BOLD.pre.ready()).getCart().sub_total||0;if(w>
10k*Ae.CENTS_MULTIPLIER){const Ye=Math.round(parseFloat(w/Ae.CENTS_MULTIPLIER));Ee({amount_requested:Ye})}const xe=await ur(n,N,M);R(xe),A(!1)},fe=async N=>{switch(A(!0),re(N),N){case i:z(a("important_disclosure.welcome_header")),X(1),A(!1);break;case o:z(a("heading.header")),X(2),A(!1);break;case h:z(a("heading.header")),X(3),A(!1);break;case v:z(a("heading.customer_agreement")),X(4),d(g,J==null?void 0:J.province);break;case m:z(a("heading.validate_application")),X(5),A(!1);break;case p:X(6);break;case b:X(6),z(a("heading.application_closed")),be(g,Z.account_data.account_number);break;default:X(6);break}},X=N=>{le(N)},Se=N=>{K(N)},Ne=N=>{A(N)},d=async(N,se)=>{const w=await tr(n,N,M,se);A(!1),w||re(u),ae(w),oe(w)},ge=async(N,se)=>{var xe;const w=await lr(n,N,se);or(J),U(w),A(!1),ae(w),(xe=w==null?void 0:w.status)!=null&&xe.decision&&z(a(`heading.${w.status.decision}`))},je=async(N,se)=>{const w=await ir(new URLSearchParams(N).toString());ae(w),w!=null&&w.access_token&&(V(parseInt(w.expires_in)-600),L(w.access_token),q(w.refresh_token),D(!1),se&&ee(w.access_token))},Ce=N=>{D(N)},be=async(N,se)=>{const w=await cr(n,N,se);w&&A(!1),ae(w)},Ge=N=>{pe({...me,...N})},Ee=N=>{_e({...J,...N})};return s.useEffect(()=>{J!=null&&J.widget_session_id&&ge(g,J)},[J]),s.useEffect(()=>{var N;if(A(!0),l.client_id){const se=new URL(window.location.href),xe=((N=new URLSearchParams(se.search).get("type"))==null?void 0:N.toLowerCase())||"";c(xe.indexOf(F)>-1?F:C),je(l,!0)}},[l]),s.useEffect(()=>{H===0||!g||Qe(H,ie)},[g,H]),s.useEffect(()=>{x===1&&!$&&D(!0)},[x]),e.jsx(Q.Provider,{value:{typeParameter:f,isBusinessType:B,currentStep:y,loading:ne,authData:l,clientId:n,stepsHeader:G,accessToken:g,formTranslations:W,language:M,termsAndCondition:Y,applicationResponse:Z,applicationPage:te,customerValidationData:me,customerApplicationData:J,isExpirationWarningOpen:$,sessionExpired:j,handleSetIsBusinessType:Fe,handleSetIsExpirationWarningOpen:Ce,handleAuthRefresh:ve,handleCurrentStep:fe,handleSetApplicationPage:X,handleFlexitiTermsAndConditionContent:d,handleFlexitiFormApplicationSubmit:ge,handleSetLanguage:Se,handleSetLoading:Ne,handleSetCustomerValidationData:Ge,handleSetCustomerApplicationData:Ee},children:t.children})};const _r=()=>{const t=F=>E.t(`default:general.flexiti.application_form.${F}`),a=F=>E.t(`default:general.language.${F}`),{FLEXITI_PERSONAL_INFO:l,FLEXITI_FINANCIAL_INFO:r,FLEXITI_TERMS_AND_CONDITIONS:n,FLEXITI_REDIRECT_VALIDATION:i}=O,{language:o,handleSetLanguage:h,applicationPage:v,currentStep:m,handleCurrentStep:p,stepsHeader:b}=s.useContext(Q),u=`//${window.bounteous.l10n.switcher.url}`||"",k=F=>{h(F.target.value),window.location.href=`${u}?view=flexiti`},C=F=>{F.preventDefault(),m===r&&p(l),m===n&&p(r)};return m===i?e.jsx("div",{}):e.jsxs("div",{className:"FlexitiFormHeader",children:[e.jsxs("div",{className:"FlexitiFormHeader__header",children:[e.jsx("div",{className:"FlexitiFormHeader__logo",children:e.jsx(mr,{})}),e.jsx("h2",{className:"FlexitiFormHeader__heading",children:b}),e.jsx("div",{className:"FlexitiFormHeader__language-selector",children:e.jsx(ce,{children:e.jsxs(ue,{native:!0,required:!0,value:o,onChange:k,IconComponent:()=>e.jsx("span",{className:"icon icon--chevron-down"}),children:[e.jsx("option",{value:"en",children:a("english")}),e.jsx("option",{value:"fr",children:a("french")})]})})})]}),e.jsx("div",{className:"FlexitiFormHeader__progress-bar",children:[...Array(6)].map((F,f)=>{const c=f+1;return e.jsx("span",{className:`FlexitiFormHeader__online-step-indicator 
11                ${c===v&&"active"} 
12                ${c!==v&&c>v&&"inactive"}`},f)})}),e.jsx("div",{className:"FlexitiFormHeader__breadcrumbs",children:(m===r||m===n)&&e.jsx("a",{href:"/",onClick:C,className:"FlexitiFormHeader__breadcrumbs-link",children:t("heading.breadcrumbs")})})]})},xr=({accountType:t,phone:a,email:l,salutation:r,firstName:n,middleName:i,lastName:o,birthday:h,streetName:v,otherAddress:m,city:p,province:b,zip:u,businessName:k,businessAddress1:C,businessAddress2:F,businessCity:f,businessPhone:c,businessProvince:B,businessPostalCode:T,nextStep:g,nextDisabled:L})=>{const _=I=>E.t(`default:general.flexiti.application_form.${I}`),{handleCurrentStep:q,handleSetCustomerApplicationData:H,handleSetCustomerValidationData:V,language:$,handleSetIsBusinessType:D}=s.useContext(Q),j=I=>{I.preventDefault();const W={business_name:k,business_address_1:C,business_address_2:F,business_city:f,business_phone:c==null?void 0:c.replace(/-/g,"").toString(),business_province:B.province,business_postal_code:T.zip};let R={account_type:t,phone_number:a,email:l,salutation:r,first_name:n,middle_name:i,last_name:o,dob:h,address_1:v,address_2:m,city:p,province:b,postal_code:u,input_type:"manual"};t===O.BUSINESS&&(R={...R,...W}),V({customer_identification:{personal_information:{first_name:n,last_name:o,dob:h,postal_code:u}},flow:"apply",lang:$,email:l,phone_number:parseInt(a),address_1:v,city:p,province:b,account_type:t}),D(t===O.BUSINESS),H(R),q(g)};return e.jsx("div",{className:"FlexiFormPersonalInfoFooter FlexiFormCTA",children:e.jsxs("div",{className:"FlexiFormCTA__btns",children:[e.jsx("a",{href:"/",className:"FlexiFormAgreement__link cancel",children:_("footer.cancel")}),e.jsx("a",{href:"/",className:"FlexiFormAgreement__link btn-next",onClick:j,"data-disabled":L,children:_("footer.next")})]})})},hr=({accountType:t,handleBlur:a,handleChange:l,typeParameter:r})=>{const n=i=>E.t(`default:general.flexiti.application_form.${i}`);return e.jsxs("div",{className:"FlexiFormPersonalInfoHeader",children:[e.jsxs("div",{className:"FlexitiFormContainer__header justify-center",children:[e.jsx("h3",{className:"FlexitiFormContainer__welcome",children:n("personal_info.welcome_header")}),e.jsx("p",{className:"FlexitiFormContainer__subheader",children:n("personal_info.welcome_subheader")}),e.jsx("div",{className:"FlexitiFormContainer__personal-info__top-disclosure",dangerouslySetInnerHTML:{__html:n("personal_info.disclosure")}})]}),e.jsx("div",{className:"FlexitiFormContainer__form",children:e.jsx("div",{className:"FlexitiFormContainer__row action-type",children:e.jsxs(ce,{component:"fieldset",error:t.errors.length!==0,children:[e.jsxs(Je,{"aria-label":"account-type",name:"account-type",value:t.value,onBlur:a,onChange:l,children:[r!==O.BUSINESS&&e.jsx(Ie,{value:O.CONSUMER,control:e.jsx(Ve,{}),label:n("personal_info.consumer_account")}
12),e.jsx(Ie,{value:O.BUSINESS,control:e.jsx(Ve,{}),label:n("personal_info.business_account")})]}),t.errors.length!==0&&e.jsx(de,{children:t.errors[0]})]})})})]})},vr=()=>{const t=a=>E.t(`default:general.flexiti.application_form.${a}`);return e.jsxs("div",{className:"FlexiFormCardHolderAgreement FlexiFormAgreement",children:[e.jsx("div",{className:"FlexiFormAgreement__link",dangerouslySetInnerHTML:{__html:t("personal_info.quebec_card_holder_agreement")}}),e.jsx("div",{className:"FlexiFormAgreement__link",dangerouslySetInnerHTML:{__html:t("personal_info.other_province_card_holder_agreement")}})]})},Fr=({businessName:t,businessPhone:a,businessAddress1:l,businessAddress2:r,businessCity:n,businessPostalCode:i,businessProvince:o,businessProvinceSetter:h,businessPhoneSetter:v,businessNameSetter:m,businessAddress1Setter:p,businessAddress2Setter:b,businessCitySetter:u,businessPostalCodeSetter:k,keySetter:C,indexKey:F,financialValidationSchema:f})=>{const c=_=>E.t(`default:general.flexiti.application_form.${_}`),{flexitiPhoneMask:B,validatePostalProvinceFSACode:T,validateFormField:g}=ye,{formTranslations:L}=s.useContext(Q);return e.jsxs(e.Fragment,{children:[e.jsx("h3",{className:"FlexitiFormContainer__welcome",children:c("financial_info.employment_information")}),e.jsxs("div",{className:"FlexitiFormContainer__form",children:[e.jsx("div",{className:"FlexitiFormContainer__column",children:e.jsx(P,{value:t.value,onChange:_=>g(_,m({value:_.target.value,errors:[]})),error:t.errors.length!==0,onBlur:()=>S(t.value,f.businessName,m),helperText:t.errors.length!==0&&t.errors[0],required:!0,label:c("financial_info.business_name")})}),e.jsx("div",{className:"FlexitiFormContainer__column",children:e.jsx(P,{value:a.value,onChange:_=>B(_,F,v),error:a.errors.length!==0,onBlur:()=>S(a.value,f.businessPhone,v),helperText:a.errors.length!==0&&a.errors[0],required:!0,onKeyDown:_=>C(_.key),placeholder:c("personal_info.phone_placeholder"),label:c("financial_info.business_phone")})}),e.jsx("div",{className:"FlexitiFormContainer__column manual-address",children:e.jsx(P,{value:l.value,onChange:_=>g(_,p({value:_.target.value,errors:[]})),error:l.errors.length!==0,onBlur:()=>S(l.value,f.businessAddress1,p),helperText:l.errors.length!==0&&l.errors[0],required:!0,label:c("financial_info.business_address1")})}),e.jsx("div",{className:"FlexitiFormContainer__column",children:e.jsx(P,{value:r.value,onChange:_=>g(_,b({value:_.target.value,errors:[]})),error:r.errors.length!==0,onBlur:()=>S(r.value,f.businessAddress2,b),helperText:r.errors.length!==0&&r.errors[0],label:c("financial_info.business_address2")})}),e.jsx("div",{className:"FlexitiFormContainer__column manual-address",children:e.jsx(P,{value:n.value,onChange:_=>g(_,u({value:_.target.value,errors:[]})),error:n.errors.length!==0,onBlur:()=>S(n.value,f.businessCity,u),helperText:n.errors.length!==0&&n.errors[0],required:!0,label:c("financial_info.business_city")})}),e.jsx("div",{className:"FlexitiFormContainer__column manual-address",children:e.jsx(P,{value:i.value.zip,onChange:_=>T(_,"postal_code",{zip:i.value.zip||"",province:o.value.province||""},h,k,f.businessPostalCode),error:i.errors.length!==0,onBlur:()=>S({zip:i.value.zip,province:o.value.province},f.businessPostalCode,k),helperText:i.errors.length!==0&&i.errors[0],required:!0,label:c("financial_info.business_postalcode")})}),e.jsx("div",{className:"FlexitiFormContainer__column manual-address",children:e.jsxs(ce,{error:o.errors.length!==0,children:[e.jsxs(he,{htmlFor:"provinces-business-select",children:[c("financial_info.business_province"),"*"]}),L.provinces&&e.jsxs(ue,{native:!0,required:!0,value:o.value.province,onChange:_=>T(_,"province",{zip:i.value.zip||"",province:o.value.province||""},h,k,f.businessPostalCode),IconComponent:()=>e.jsx("span",{className:"icon icon--chevron-down"}),onBlur:()=>S({zip:i.value.zip,province:o.value.province},f.businessProvince,h),error:o.errors.length!==0,inputProps:{name:"province-business",id:"provinces-business-select"},children:[e.jsx("option",{"aria-label":"None",value:""}),Object.keys(L.provinces).map(_=>e.jsx("option",{value:_,children:L.provinces[_]},_))]}),o.errors.length!==0&&e.jsx(de,{children:o.errors[0]})]})})]})]})},fr=()=>{const t=a=>E.t(`default:general.flexiti.application_form.${a}`);return e.jsxs("div",{className:"FlexitiFormBusinessNote FlexitiFormContainer__row FlexitiFormContainer__note-container",children:[e.jsx("h6",{children:t("financial_info.note")}),e.jsxs("ul",{children:[e.jsx("li",{children:t("financial_info.note_liability")}),e.jsx("li",{children:t("financial_info.note_mailing_address")})]})]})},gr=({nextStep:t})=>{var Ne;const a=d=>E.t(`default:general.flexiti.application_form.${d}`),{formTranslations:l,customerApplicationData:r,typeParameter:n}=s.useContext(Q),{salutations:i,provinces:o}=l,{formatPhone:h,flexitiPhoneMask:v,validatePostalProvinceFSACode:m,validateFormField:p,financialInfoValidationSchema:b}=ye,u=dr(),[k,C]=Ue.useState(void 0),[F,f]=s.useState({value:n,errors:[]}),[c,B]=s.useState({value:"",errors:[]}),[T,g]=s.useState({value:"",errors:[]}),[L,_]=s.useState({value:"",errors:[]}),[q,H]=s.useState({value:"",errors:[]}),[V,$]=s.useState({value:"",errors:[]}),[D,j]=s.useState({value:"",errors:[]}),[I,W]=s.useState({value:"",errors:[]}),[R,M]=s.useState({value:"",errors:[]}),[K,G]=s.useState({value:"",errors:[]}),[z,Y]=s.useState({value:"",errors:[]}),[oe,Z]=s.useState(!0),[U,ne]=s.useState({value:{zip:"",province:""},errors:[]}),[A,te]=s.useState({value:{zip:"",province:""},errors:[]}),[le,y]=s.useState({value:"",errors:[]}),[re,x]=s.useState({value:"",errors:[]}),[ie,me]=s.useState({value:"",errors:[]}),[pe,J]=s.useState({value:"",errors:[]}),[_e,ve]=s.useState({value:"",errors:[]}),[ae,Fe]=s.useState({value:{zip:"",province:""},errors:[]}),[ee,fe]=s.useState({value:{zip:"",province:""},errors:[]}),X=b(r.province===O.QC,F.value===O.BUSINESS),Se=()=>{var ge,je,Ce,be;const d={accountType:{value:F.value,setter:f,schema:u.accountType},salutation:{value:c.value,setter:B,schema:u.salutation},email:{value:T.value,setter:g,schema:u.email},phone:{value:L.value,setter:_,schema:u.phone},firstName:{value:q.value,setter:H,schema:u.firstName},middleName:{value:V.value,setter:$,schema:u.middleName},lastName:{value:D.value,setter:j,schema:u.lastName},birthday:{value:I.value,setter:W,schema:u.birthday},streetName:{value:R.value,setter:M,schema:u.streetName},city:{value:K.value,setter:G,schema:u.city},otherAddress:{value:z.value,setter:Y,schema:u.otherAddress},province:{value:{zip:U.value.zip.replace(/ /g,""),province:A.value.province},setter:te,schema:u.province},fsaLetters:{value:{zip:U.value.zip.replace(/ /g,""),province:A.value.province},setter:ne,schema:u.fsaLetters},businessName:{value:le.value,setter:y,schema:X.businessName},businessCity:{value:_e.value,setter:ve,schema:X.businessCity},businessAddress1:{value:ie.value,setter:me,schema:X.businessAddress1},businessAddress2:{value:pe.value,setter:J,schema:X.businessAddress2},businessPhone:{value:re.value,setter:x,schema:X.businessPhone},businessProvince:{value:{zip:((je=(ge=ee==null?void 0:ee.value)==null?void 0:ge.zip)==null?void 0:je.replace(/ /g,""))||"",province:ae.value.province},setter:Fe,schema:X.businessProvince},businessPostalCode:{value:{zip:((be=(Ce=ee==null?void 0:ee.value)==null?void 0:Ce.zip)==null?void 0:be.replace(/ /g,""))||"",province:ae.value.province},setter:fe,schema:X.businessPostalCode}};return!Xe(d)};return s.useEffect(()=>{Z(Se())},[c,F,T,L,q,V,D,I,R,K,A,U,le,re,_e,ie,pe,ae,ee]),s.useEffect(()=>{if(r.first_name!==""){const d=h(r.phone_number);f({value:r.account_type,errors:[]}),B({value:r.salutation,errors:[]}),g({value:r.email,errors:[]}),_({value:d,errors:[]}),H({value:r.first_name,errors:[]}),$({value:r.middle_name,errors:[]}),j({value:r.last_name,errors:[]}),W({value:r.dob,errors:[]}),M({value:r.address_1,errors:[]}),Y({value:r.address_1,errors:[]}),G({value:r.city,errors:[]}),ne({value:{zip:r.postal_code,province:r.province},errors:[]}),te({value:{zip:r.postal_code,province:r.province},errors:[]})}r.business_name&&r.business_name!==""&&(y({value:r.business_name,errors:[]}),me({value:r.business_address_1,errors:[]}),J({value:r.business_address_2,errors:[]}),ve({value:r.business_city,errors:[]}),x({value:h(r.business_phone),errors:[]}),Fe({value:{zip:r.business_postal_code,province:r.business_province},errors:[]}),fe({value:{zip:r.business_postal_code,province:r.business_province},errors:[]}))},[r]),Object.keys(l).length===0?e.jsx("div",{}):e.jsxs("div",{className:"FlexiFormPersonalInfo FlexitiFormContainer",children:[e.jsx(hr,{accountType:F,typeParameter:n,handleBlur:()=>S(F.value,u.accountType,f),handleChange:d=>p(d,f({value:d.target.value,errors:[]}))}),e.jsx(fr,{}),e.jsx("h3",{className:"FlexitiFormContainer__welcome",children:a("personal_info.personal_information")}),e.jsxs("div",{className:"FlexitiFormContainer__form",children:[e.jsx("div",{className:"FlexitiFormContainer__column",children:e.jsx(P,{value:T.value,onChange:d=>p(d,g({value:d.target.value,errors:[]})),error:T.errors.length!==0,onBlur:()=>S(T.value,u.email,g),helperText:T.errors.length!==0&&T.errors[0],required:!0,type:"email",placeholder:a("personal_info.email_placeholder"),label:a("personal_info.email_label")})}),e.jsx("div",{className:"FlexitiFormContainer__column",children:e.jsx(P,{value:L.value,onChange:d=>v(d,k,_),error:L.errors.length!==0,onBlur:()=>S(L.value,u.phone,_),helperText:L.errors.length!==0&&L.errors[0],required:!0,onKeyDown:d=>C(d.key),placeholder:a("personal_info.phone_placeholder"),label:a("personal_info.phone_label")})}),e.jsx("div",{className:"FlexitiFormContainer__column",children:e.jsxs(ce,{error:c.errors.length!==0,children:[e.jsxs(he,{htmlFor:"salutation-select",children:[a("personal_info.salutation_label"),"*"]}),i&&e.jsxs(ue,{value:c.value,onChange:d=>p(d,B({value:d.target.value,errors:[]})),error:c.errors.length!==0,onBlur:()=>S(c.value,u.salutation,B),native:!0,inputProps:{name:"salutation",id:"salutation-select"},children:[e.jsx("option",{"aria-label":"None",value:""}),Object.keys(i).map(d=>e.jsx("option",{value:d,children:i[d]},d))]}),c.errors.length!==0&&e.jsx(de,{children:c.errors[0]})]})}),e.jsx("div",{className:"FlexitiFormContainer__column",children:e.jsx(P,{value:q.value,onChange:d=>p(d,H({value:d.target.value,errors:[]})),error:q.errors.length!==0,onBlur:()=>S(q.value,u.firstName,H),helperText:q.errors.length!==0&&q.errors[0],required:!0,label:a("personal_info.first_name_label")})}),e.jsx("div",{className:"FlexitiFormContainer__column",children:e.jsx(P,{value:V.value,onChange:d=>p(d,$({value:d.target.value,errors:[]})),error:V.errors.length!==0,onBlur:()=>S(V.value,u.middleName,$),helperText:V.errors.length!==0&&V.errors[0],label:a("personal_info.middle_name_label")})}),e.jsx("div",{className:"FlexitiFormContainer__column",children:e.jsx(P,{value:D.value,onChange:d=>p(d,j({value:d.target.value,errors:[]})),error:D.errors.length!==0,onBlur:()=>S(D.value,u.lastName,j),helperText:D.errors.length!==0&&D.errors[0],required:!0,label:a("personal_info.last_name_label")})}),e.jsx("div",{className:"FlexitiFormContainer__column birthday-date",children:e.jsx(P,{value:I.value,onChange:d=>p(d,W({value:d.target.value,errors:[]})),error:I.errors.length!==0,onBlur:()=>S(I.value,u.birthday,W),helperText:I.errors.length!==0&&I.errors[0],required:!0,type:"date",placeholder:a("personal_info.birthday_placeholder"),InputLabelProps:{shrink:!0},InputProps:{inputProps:{min:"1900-01-01",max:`${new Date().getFullYear()}-12-31`}},label:a("personal_info.birthday_label")})}),e.jsx("div",{className:"FlexitiFormContainer__column manual-address",children:e.jsx(P,{value:R.value,onChange:d=>p(d,M({value:d.target.value,errors:[]})),error:R.errors.length!==0,onBlur:()=>S(R.value,u.streetName,M),helperText:R.errors.length!==0&&R.errors[0],required:!0,label:a("personal_info.street_name")}
12)}),e.jsx("div",{className:"FlexitiFormContainer__column manual-address",children:e.jsx(P,{value:K.value,onChange:d=>p(d,G({value:d.target.value,errors:[]})),error:K.errors.length!==0,onBlur:()=>S(K.value,u.city,G),helperText:K.errors.length!==0&&K.errors[0],required:!0,label:a("personal_info.city")})}),e.jsx("div",{className:"FlexitiFormContainer__column manual-address",children:e.jsxs(ce,{error:A.errors.length!==0,children:[e.jsxs(he,{htmlFor:"provinces-select",children:[a("personal_info.province"),"*"]}),o&&e.jsxs(ue,{native:!0,required:!0,value:A.value.province,onChange:d=>m(d,"province",{zip:U.value.zip,province:A.value.province},te,ne,u.fsaLetters),IconComponent:()=>e.jsx("span",{className:"icon icon--chevron-down"}),onBlur:()=>S({zip:U.value.zip,province:A.value.province},u.province,te),error:A.errors.length!==0,inputProps:{name:"province",id:"provinces-select"},children:[e.jsx("option",{"aria-label":"None",value:""}),Object.keys(o).map(d=>e.jsx("option",{value:d,children:o[d]},d))]}),A.errors.length!==0&&e.jsx(de,{children:A.errors[0]})]})}),e.jsx("div",{className:"FlexitiFormContainer__column manual-address",children:e.jsx(P,{value:U.value.zip,onChange:d=>m(d,"postal_code",{zip:U.value.zip,province:A.value.province},te,ne,u.fsaLetters),error:U.errors.length!==0,onBlur:()=>S({zip:U.value.zip,province:A.value.province},u.fsaLetters,ne),helperText:U.errors.length!==0&&U.errors[0],required:!0,label:a("personal_info.postal_code")})}),e.jsx("div",{className:"FlexitiFormContainer__column",children:e.jsx(P,{value:z.value,onChange:d=>p(d,Y({value:d.target.value,errors:[]})),error:z.errors.length!==0,onBlur:()=>S(z.value,u.otherAddress,Y),helperText:z.errors.length!==0&&z.errors[0],label:a("personal_info.other")})}),F.value===O.BUSINESS&&e.jsx(Fr,{businessName:le,businessPhone:re,businessAddress1:ie,businessAddress2:pe,businessCity:_e,businessPostalCode:ee,businessProvince:ae,indexKey:k,financialValidationSchema:X,businessProvinceSetter:Fe,businessPhoneSetter:x,businessNameSetter:y,businessAddress1Setter:me,businessAddress2Setter:J,businessCitySetter:ve,businessPostalCodeSetter:fe,keySetter:C})]}),e.jsx(vr,{}),e.jsx(xr,{accountType:F.value,phone:(Ne=L==null?void 0:L.value)==null?void 0:Ne.replace(/-/g,""),email:T.value,salutation:c.value,firstName:q.value,middleName:V.value,lastName:D.value,birthday:I.value.toString(),streetName:R.value,otherAddress:z.value,city:K.value,province:A.value.province,zip:U.value.zip,businessName:le.value,businessAddress1:ie.value,businessAddress2:pe.value,businessCity:_e.value,businessPhone:re.value,businessProvince:ae.value,businessPostalCode:ee.value,nextStep:t,nextDisabled:oe})]})},jr=({nextDisabled:t,personalIncome:a,householdIncome:l,housingType:r,occupationId:n,occupationTitle:i,securityQid:o,securityAnswer:h,piw:v,employerName:m,employerPhone:p,sin:b,monthlyHousingExpenses:u,nextStep:k})=>{const C=T=>E.t(`default:general.flexiti.application_form.${T}`),{handleCurrentStep:F,handleSetCustomerApplicationData:f,customerApplicationData:c}=s.useContext(Q),B=T=>{T.preventDefault();const g={personal_income:parseInt(a.replace(/,/g,"").replace(/\s/g,"")),household_income:parseInt(l.replace(/,/g,"").replace(/\s/g,"")),housing_type:r,occupation_id:n.id,occupation_title:i.jobTitle,security_qid:parseInt(o),security_answer:h,piw:v};m.companyName!==""&&(g.employer_name=m.companyName),p.companyPhone!==""&&(g.employer_phone=p.companyPhone.replace(/-/g,"")),b!==""&&(g.sin=parseInt(b)),(c==null?void 0:c.province)===O.QC&&(g.monthly_housing_expenses=parseInt(u==null?void 0:u.replace(/,/g,"").replace(/\s/g,""))),f(g),F(k)};return e.jsx("div",{className:"FlexiFormFinancialInfoFooter FlexiFormCTA",children:e.jsxs("div",{className:"FlexiFormCTA__btns",children:[e.jsx("a",{href:"/",className:"FlexiFormAgreement__link cancel",children:C("footer.cancel")}),e.jsx("a",{href:"/",className:"FlexiFormAgreement__link btn-next","data-disabled":t,onClick:B,children:C("footer.next")})]})})},Nr=()=>{const t=a=>E.t(`default:general.flexiti.application_form.${a}`);return e.jsxs("div",{className:"FlexiFormFinancialInfoHeader FlexitiFormContainer__header",children:[e.jsx("h3",{className:"FlexitiFormContainer__welcome",children:t("financial_info.welcome_header")}),e.jsx("p",{className:"FlexitiFormContainer__subheader",children:t("financial_info.welcome_subheader")})]})},Cr=({occupationId:t,occupationTitle:a,employerName:l,employerPhone:r,occupationIdSetter:n,occupationTitleSetter:i,employerNameSetter:o,employerPhoneSetter:h,isOccupationInfoRequired:v,financialValidationSchema:m,isOccupationInfoRequiredSetter:p,setKey:b,indexKey:u})=>{var f;const k=c=>E.t(`default:general.flexiti.application_form.${c}`),{validateJobDetails:C}=ye,{formTranslations:F}=s.useContext(Q);return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"FlexitiFormContainer__column",children:e.jsxs(ce,{"data-error":t.errors.length!==0,children:[e.jsxs(he,{htmlFor:"occupation-select",children:[k("financial_info.occupation"),"*"]}),e.jsxs(ue,{native:!0,required:!0,value:t.value.id,onChange:c=>C(c,u,"id",{id:a.value.id,jobTitle:a.value.jobTitle,companyName:l.value.companyName,companyPhone:r.value.companyPhone},F.occupation_ids,n,i,o,h,v,m,p),error:t.errors.length!==0,onBlur:()=>S({id:t.value.id,jobTitle:a.value.jobTitle,companyName:l.value.companyName,companyPhone:r.value.companyPhone},m.occupationId,n),inputProps:{name:"occupation",id:"occupation-select"},children:[e.jsx("option",{"aria-label":"None",value:""}),Object.keys((f=F.occupation_ids)==null?void 0:f.options).map(c=>e.jsx("option",{value:c,children:F.occupation_ids.options[c]},c))]}),t.errors.length!==0&&e.jsx(de,{children:t.errors[0]})]})}),e.jsx("div",{className:"FlexitiFormContainer__column","data-readonly":!v,children:e.jsx(P,{required:!0,value:a.value.jobTitle,onChange:c=>C(c,u,"jobTitle",{id:a.value.id,jobTitle:a.value.jobTitle,companyName:l.value.companyName,companyPhone:r.value.companyPhone},F.occupation_ids,n,i,o,h,v,m,p),error:a.errors.length!==0,helperText:a.errors.length!==0&&a.errors[0],InputProps:{readOnly:!v},onBlur:()=>S({id:t.value.id,jobTitle:a.value.jobTitle,companyName:l.value.companyName,companyPhone:r.value.companyPhone},m.occupationTitle,i),label:k("financial_info.job_title")})}),v&&e.jsx("div",{className:"FlexitiFormContainer__column",children:e.jsx(P,{required:!0,value:l.value.companyName,onChange:c=>C(c,u,"companyName",{id:a.value.id,jobTitle:a.value.jobTitle,companyName:l.value.companyName,companyPhone:r.value.companyPhone},F.occupation_ids,n,i,o,h,v,m,p),error:l.errors.length!==0,helperText:l.errors.length!==0&&l.errors[0],onBlur:()=>S({id:t.value.id,jobTitle:a.value.jobTitle,companyName:l.value.companyName,companyPhone:r.value.companyPhone},m.employerName,o),label:k("financial_info.employer_business_name")})}),v&&e.jsx("div",{className:"FlexitiFormContainer__column",children:e.jsx(P,{required:!0,value:r.value.companyPhone,onChange:c=>C(c,u,"companyPhone",{id:a.value.id,jobTitle:a.value.jobTitle,companyName:l.value.companyName,companyPhone:r.value.companyPhone},F.occupation_ids,n,i,o,h,v,m,p),error:r.errors.length!==0,onKeyDown:c=>b(c.key),helperText:r.errors.length!==0&&r.errors[0],onBlur:()=>S({id:t.value.id,jobTitle:a.value.jobTitle,companyName:l.value.companyName,companyPhone:r.value.companyPhone},m.employerPhone,h),label:k("financial_info.employer_business_phone")})}),e.jsx("div",{})]})};const br=({nextStep:t})=>{const a=x=>E.t(`default:general.flexiti.application_form.${x}
12`),{formTranslations:l,customerApplicationData:r,language:n,isBusinessType:i}=s.useContext(Q),{security_ids:o,housing_type:h}=l,{formatPhone:v,financialInfoValidationSchema:m,validateFormField:p,formatAllUserInputAmount:b,removeAllCommaFromAmount:u,handleIsOccupationInfoRequired:k}=ye,[C,F]=s.useState({value:"",errors:[]}),[f,c]=s.useState({value:"",errors:[]}),[B,T]=s.useState({value:"",errors:[]}),[g,L]=s.useState({value:"",errors:[]}),[_,q]=s.useState({value:{id:"",jobTitle:"",companyName:"",companyPhone:""},errors:[]}),[H,V]=s.useState({value:{id:"",jobTitle:"",companyName:"",companyPhone:""},errors:[]}),[$,D]=s.useState({value:{id:"",jobTitle:"",companyName:"",companyPhone:""},errors:[]}),[j,I]=s.useState({value:{id:"",jobTitle:"",companyName:"",companyPhone:""},errors:[]}),[W,R]=Ue.useState(void 0),[M,K]=s.useState({value:"",errors:[]}),[G,z]=s.useState({value:"",errors:[]}),[Y,oe]=s.useState({value:"",errors:[]}),[Z,U]=s.useState({value:"",errors:[]}),[ne,A]=s.useState(!0),[te,le]=s.useState(!0),y=m(r.province===O.QC,i),re=()=>{const x=(r==null?void 0:r.province)===O.QC?B.value:0,ie={personalIncome:{value:C.value,setter:F,schema:y.personalIncome},householdIncome:{value:f.value,setter:c,schema:y.householdIncome},monthlyHousingExpenses:{value:x,setter:T,schema:y.monthlyHousingExpenses},housingType:{value:g.value,setter:L,schema:y.housingType},securityQid:{value:M.value,setter:K,schema:y.securityQid},securityAnswer:{value:G.value,setter:z,schema:y.securityAnswer},piw:{value:Y.value,setter:oe,schema:y.piw},sin:{value:Z.value,setter:U,schema:y.sin},occupationTitle:{value:{id:_.value.id,jobTitle:H.value.jobTitle,companyName:$.value.companyName,companyPhone:j.value.companyPhone},setter:V,schema:y.occupationTitle},occupationId:{value:{id:_.value.id,jobTitle:H.value.jobTitle,companyName:$.value.companyName,companyPhone:j.value.companyPhone},setter:q,schema:y.occupationId},employerName:{value:{id:_.value.id,jobTitle:H.value.jobTitle,companyName:$.value.companyName,companyPhone:j.value.companyPhone},setter:D,schema:y.employerName},employerPhone:{value:{id:_.value.id,jobTitle:H.value.jobTitle,companyName:$.value.companyName,companyPhone:j.value.companyPhone},setter:I,schema:y.employerPhone}};return!Xe(ie)};return s.useEffect(()=>{if(r.occupation_id!==""){const x=r.employer_phone&&r.employer_phone!==""?v(r.employer_phone):"";b(r.personal_income,y.personalIncome,F,n),b(r.household_income,y.householdIncome,c,n),L({value:r.housing_type,errors:[]}),q({value:{id:r.occupation_id,jobTitle:r.occupation_title,companyName:r.employer_name,companyPhone:x},errors:[]}),V({value:{id:r.occupation_id,jobTitle:r.occupation_title,companyName:r.employer_name,companyPhone:x},errors:[]}),D({value:{id:r.occupation_id,jobTitle:r.occupation_title,companyName:r.employer_name,companyPhone:x},errors:[]}),I({value:{id:r.occupation_id,jobTitle:r.occupation_title,companyName:r.employer_name,companyPhone:x},errors:[]}),K({value:r.security_qid,errors:[]}),z({value:r.security_answer,errors:[]}),oe({value:r.piw,errors:[]})}le(k(r.occupation_id)),r.monthly_housing_expenses&&r.monthly_housing_expenses!==""&&b(r.monthly_housing_expenses,y.monthlyHousingExpenses,T,n)},[r]),s.useEffect(()=>{A(re())},[C,f,B,g,_,H,$,j,M,G,Y,Z]),e.jsx("div",{className:"FlexiFormFinancialInfo","data-qc":(r==null?void 0:r.province)===O.QC,children:e.jsxs("div",{className:"FlexitiFormContainer",children:[e.jsx(Nr,{}),e.jsxs("div",{className:"FlexitiFormContainer__form",children:[e.jsx("div",{className:"FlexitiFormContainer__column",children:e.jsx(P,{value:C.value,onChange:x=>u(x,F),error:C.errors.length!==0,onBlur:()=>b(C.value,y.personalIncome,F,n),helperText:C.errors.length!==0&&C.errors[0],required:!0,InputProps:{startAdornment:e.jsx(Te,{position:"start",children:"$"})},label:a("financial_info.personal_income")})}),e.jsx("div",{className:"FlexitiFormContainer__column",children:e.jsx(P,{value:f.value,onChange:x=>u(x,c),error:f.errors.length!==0,onBlur:()=>b(f.value,y.householdIncome,c,n),helperText:f.errors.length!==0&&f.errors[0],required:!0,InputProps:{startAdornment:e.jsx(Te,{position:"start",children:"$"})},label:a("financial_info.household_income")})}),r.province===O.QC&&e.jsx("div",{className:"FlexitiFormContainer__column",children:e.jsx(P,{value:B.value,onChange:x=>u(x,T),error:B.errors.length!==0,onBlur:()=>b(B.value,y.monthlyHousingExpenses,T,n),helperText:B.errors.length!==0&&B.errors[0],required:!0,InputProps:{startAdornment:e.jsx(Te,{position:"start",children:"$"})},label:a("financial_info.monthly_housing_expenses")})}),e.jsx("div",{className:"FlexitiFormContainer__column",children:e.jsxs(ce,{"data-error":g.errors.length!==0,children:[e.jsxs(he,{htmlFor:"housing-type-select",children:[a("financial_info.housing_type"),"*"]}),e.jsxs(ue,{native:!0,required:!0,value:g.value,onChange:x=>p(x,L({value:x.target.value,errors:[]})),error:g.errors.length!==0,onBlur:()=>S(g.value,y.housingType,L),inputProps:{name:"housing-type",id:"housing-type-select"},children:[e.jsx("option",{"aria-label":"None",value:""}),Object.keys(h).map(x=>e.jsx("option",{value:x,children:h[x]},x))]}),g.errors.length!==0&&e.jsx(de,{children:g.errors[0]})]})}),e.jsx(Cr,{occupationId:_,occupationTitle:H,employerName:$,employerPhone:j,isOccupationInfoRequired:te,financialValidationSchema:y,occupationIdSetter:q,occupationTitleSetter:V,employerNameSetter:D,employerPhoneSetter:I,isOccupationInfoRequiredSetter:le,setKey:R,indexKey:W}),e.jsx("div",{className:"FlexitiFormContainer__row",children:e.jsx("p",{children:a("financial_info.sin_helper_text")})}),e.jsx("div",{className:"FlexitiFormContainer__column",children:e.jsx(P,{value:Z.value,onChange:x=>p(x,U({value:x.target.value,errors:[]})),error:Z.errors.length!==0,helperText:Z.errors.length!==0&&Z.errors[0],type:"password",onBlur:()=>S(Z.value,y.sin,U),label:a("financial_info.sin")})}),e.jsx("div",{className:"FlexitiFormContainer__row",children:e.jsx("p",{children:a("financial_info.piw_helper_text")})}),e.jsx("div",{className:"FlexitiFormContainer__row",children:e.jsx("p",{children:a("financial_info.secret_question_helper_text")})}),e.jsx("div",{className:"FlexitiFormContainer__row",children:e.jsx("div",{className:"FlexitiFormContainer__column",children:e.jsx(P,{required:!0,value:Y.value,onChange:x=>p(x,oe({value:x.target.value,errors:[]})),error:Y.errors.length!==0,helperText:Y.errors.length!==0&&Y.errors[0],onBlur:()=>S(Y.value,y.piw,oe),label:a("financial_info.piw")})})}),e.jsx("div",{className:"FlexitiFormContainer__column",children:e.jsxs(ce,{"data-error":M.errors.length!==0,children:[e.jsxs(he,{htmlFor:"housing-type-select",children:[a("financial_info.security_question"),"*"]}),e.jsxs(ue,{native:!0,required:!0,value:M.value,onChange:x=>p(x,K({value:x.target.value,errors:[]})),error:M.errors.length!==0,onBlur:()=>S(M.value,y.securityQid,K),inputProps:{name:"security-question",id:"security-question-select"},children:[e.jsx("option",{"aria-label":"None",value:""}),Object.keys(o).map(x=>e.jsx("option",{value:x,children:o[x]},x))]}),M.errors.length!==0&&e.jsx(de,{children:M.errors[0]})]})}),e.jsx("div",{className:"FlexitiFormContainer__column",children:e.jsx(P,{required:!0,value:G.value,onChange:x=>p(x,z({value:x.target.value,errors:[]})),error:G.errors.length!==0,helperText:G.errors.length!==0&&G.errors[0],onBlur:()=>S(G.value,y.securityAnswer,z),label:a("financial_info.security_answer")})})]}),e.jsx(jr,{nextDisabled:ne,personalIncome:C.value,householdIncome:f.value,housingType:g.value,occupationId:_.value,occupationTitle:H.value,securityQid:M.value,securityAnswer:G.value,piw:Y.value,employerName:$.value,employerPhone:j.value,sin:Z.value,monthlyHousingExpenses:B.value,nextStep:t})]})})};const We=()=>{var a,l;const t=((l=(a=window==null?void 0:window.ENV)==null?void 0:a.Flexiti)==null?void 0:l.flexiti_animated_gif)||"";return e.jsx("div",{className:"FlexiFormLoading",children:e.jsx(er,{src:t,alt:"loading"})})};const yr=({nextStep:t})=>{const a=i=>E.t(`default:general.flexiti.application_form.${i}`),{handleCurrentStep:l,termsAndCondition:r}=s.useContext(Q),n=i=>{i.preventDefault(),l(t)};return e.jsx("div",{className:"FlexitiFormTermsAndConditions",children:e.jsxs("div",{className:"FlexitiFormContainer",children:[e.jsx("div",{className:"FlexitiFormContainer__header",dangerouslySetInnerHTML:{__html:r==null?void 0:r.tcs_terms_and_conditions}}),e.jsx("div",{className:"FlexitiFormContainer__customer-agreement__activation",dangerouslySetInnerHTML:{__html:r==null?void 0:r.fac_footer_activation}}),e.jsx("div",{className:"FlexitiFormAgreement",children:e.jsxs("div",{className:"FlexiFormCTA",children:[e.jsx("div",{className:"FlexiFormCTA__agreement",dangerouslySetInnerHTML:{__html:r==null?void 0:r.fap_footer_apply}}),e.jsxs("div",{className:"FlexiFormCTA__btns",children:[e.jsx("a",{href:"/",className:"FlexiFormAgreement__link cancel",children:a("footer.cancel_thank_you")}),e.jsx("a",{href:"/",className:"FlexiFormAgreement__link btn-next",onClick:n,children:a("footer.agree")})]})]})})]})})},Sr=({approvalRate:t,debtRatio:a,isQC:l})=>{const r=o=>E.t(`default:general.flexiti.application_form.${o}`),n=(o,h)=>E.t(`default:general.flexiti.application_form.${o}`,{approvalRate:h}),{formTranslations:i}=s.useContext(Q);return e.jsxs("div",{className:"FlexitiConsumerApprovedStatus",children:[l?e.jsx("div",{dangerouslySetInnerHTML:{__html:n("application_result.approved.welcome_message_consumer_quebec",t)}}):e.jsx("div",{dangerouslySetInnerHTML:{__html:n("application_result.approved.welcome_message_consumer",t)}}),e.jsx("p",{children:i==null?void 0:i.annual_fees}),l?e.jsxs("div",{children:[e.jsx("p",{children:r("application_result.approved.quebec_only_message")}),e.jsxs("p",{children:[r("application_result.approved.quebec_debt_ratio")," ",a,"%"]}),e.jsx("p",{children:r("application_result.approved.quebec_application")})]}):e.jsx("p",{children:r("application_result.approved.cta_button")})]})},Tr=({approvalRate:t,debtRatio:a,isQC:l})=>{const r=o=>E.t(`default:general.flexiti.application_form.${o}`),n=o=>E.t(`default:general.flexiti.application_form.${o}`,{approvalRate:t}),{formTranslations:i}=s.useContext(Q);return e.jsxs("div",{className:"FlexitiBusinessApprovedStatus",children:[l?e.jsx("div",{dangerouslySetInnerHTML:{__html:n("application_result.approved.welcome_message_business_quebec")}}):e.jsx("div",{dangerouslySetInnerHTML:{__html:n("application_result.approved.welcome_message_business")}}),e.jsx("p",{children:i.annual_fees}),l&&e.jsxs("div",{children:[e.jsx("p",{children:r("application_result.approved.quebec_only_message")}),e.jsxs("p",{children:[r("application_result.approved.quebec_debt_ratio")," ",a,"%"]}),e.jsx("p",{children:r("application_result.approved.quebec_application")})]}),e.jsx("p",{dangerouslySetInnerHTML:{__html:r("application_result.approved.application_email_business")}}),l&&e.jsx("p",{children:r("application_result.approved.cta_button")})]})},Ir=()=>{const t=m=>E.t(`default:general.flexiti.application_form.${m}`),{customerApplicationData:a,applicationResponse:l,isBusinessType:r}=s.useContext(Q),[n,i]=s.useState(0),[o,h]=s.useState(0),v=a.province===O.QC;return s.useEffect(()=>{var m,p;(m=l==null?void 0:l.account_data)!=null&&m.air&&i(l.account_data.air),(p=l==null?void 0:l.account_data)!=null&&p.debt_ratio&&h(l.account_data.debt_ratio)},[l]),e.jsx("div",{className:"FlexitiApprovedStatus",children:e.jsxs("div",{className:"FlexitiFormApprovalStatus__wrapper-container",children:[e.jsxs("span",{className:"congratulation-greetings",children:[t("application_result.approved.congratulations")," ",a.first_name]}),e.jsxs("h2",{children:[e.jsx("span",{className:"icon icon--check icon--check"}),t("application_result.approved.approval_amount_text")," ",e.jsx("span",{className:"congratulations-price",children:rr(l.account_data.credit_limit*Ae.CENTS_MULTIPLIER)})]}),r?e.jsx(Tr,{approvalRate:n,isQC:v,debtRatio:o}):e.jsx(Sr,{approvalRate:n,isQC:v,debtRatio:o})]})})},Ke=({status:t})=>{const a=l=>E.t(`default:general.flexiti.application_form.${l}`);return e.jsx("div",{className:"FlexitiStatus",children:e.jsxs("div",{className:"FlexitiFormApprovalStatus__wrapper-container",children:[e.jsx("h3",{children:a(`application_result.${t}.thank_you_message`)}),e.jsx("p",{children:a(`application_result.${t}.more_info`)})]})})};const Ar=({nextStep:t})=>{const{handleCurrentStep:a,clientId:l,accessToken:r,customerValidationData:n,handleSetCustomerApplicationData:i}=s.useContext(Q),[o,h]=s.useState(!1),[v,m]=s.useState(!1),[p,b]=s.useState(!1),{PURCHASE:u,ACTIVATION:k,APPLY:C,RETRY:F,FLX_CANCEL:f,FLX_FAILURE:c,FLX_SUCCESS:B,MESSAGE:T,DECLINED:g,FLEXITI_DASHBOARD:L}=O,_=j=>{j!=null&&j.widget_session_id&&i({widget_session_id:j.widget_session_id}),j!=null&&j.verified&&a(t)},q=()=>{window.location.href="/"},H=()=>{b(!0)},V=()=>{var I,W;if(!FlexitiSdk)return;const j=new FlexitiSdk({clientId:l,accessToken:r,iframeContainerId:"flexiti-widget-sms-validation",env:((W=(I=window.ENV)==null?void 0:I.Flexiti)==null?void 0:W.flexiti_posapi_environment)||"mi",failureCallback:H,cancelCallback:q,successCallback:_});h(!0),j.init(n)},$=j=>{const I=(j==null?void 0:j.action)||null;if(I===null){m(!0);return}switch(I){case u:window.location.href="/";return;case k:window.location.href=L;return;case C:a(t);return;case F:b(!0);return;default:return}},D=j=>
12{var R,M;const I=(R=j==null?void 0:j.data)==null?void 0:R.eventType,W=(M=j==null?void 0:j.data)==null?void 0:M.eventData;if(I)switch(I){case f:window.location.href="/";return;case c:b(!0);return;case B:$(W);return;default:return}};return s.useEffect(()=>{!o&&r&&l&&V()},[r,l,o]),s.useEffect(()=>{if(o)return window.addEventListener(T,D),()=>{window.removeEventListener(T,D)}},[o]),p?e.jsx(we,{}):v?e.jsx(Ke,{status:g}):e.jsx("div",{className:"FlexitiRedirectValidation",children:e.jsx("div",{id:"flexiti-widget-sms-validation",children:e.jsx(We,{})})})};const we=({errorHeading:t="",errorDescription:a=""})=>{const l=n=>E.t(`default:general.flexiti.application_form.${n}`),r=n=>{n.preventDefault(),window.location.href=ar.flexiti.APPLICATION_URL};return e.jsx("div",{className:"FlexitiFormApprovalStatus",children:e.jsx("div",{className:"FlexitiFormApprovalStatus__wrapper",children:e.jsxs("div",{className:"FlexitiFormError",children:[e.jsx("div",{className:"FlexitiFormError__wrapper",children:e.jsxs("div",{className:"FlexitiFormError__wrapper-container",children:[e.jsx("h3",{children:t!==""?t:l("application_result.error.error_message")}),e.jsx("p",{children:a!==""?a:l("application_result.error.try_again_message")})]})}),e.jsx("div",{className:"FlexiFormCTA",children:e.jsx("div",{className:"FlexiFormCTA__btns",children:e.jsx("a",{href:"/",className:"FlexiFormAgreement__link btn-next",onClick:r,children:l("footer.continue")})})})]})})})};const wr=({nextStep:t})=>{var o,h,v,m;const a=p=>E.t(`default:general.flexiti.application_form.${p}`),{handleCurrentStep:l,customerApplicationData:r,applicationResponse:n}=s.useContext(Q),i=p=>{var b;p.preventDefault(),(b=n==null?void 0:n.account_data)!=null&&b.account_number&&l(t)};return(o=n==null?void 0:n.status)!=null&&o.decision?e.jsx("div",{className:"FlexitiFormApprovalStatus",children:e.jsx("div",{className:"FlexitiFormApprovalStatus__wrapper",children:e.jsxs("div",{className:"FlexitiFormApprovalStatus__container",children:[((h=n==null?void 0:n.status)==null?void 0:h.decision)===O.APPROVED?e.jsx(Ir,{}):e.jsx(Ke,{status:((v=n==null?void 0:n.status)==null?void 0:v.decision)||O.DECLINED}),e.jsx("div",{className:"FlexiFormCTA",children:e.jsxs("div",{className:"FlexiFormCTA__btns",children:[(r==null?void 0:r.province)===O.QC&&((m=n==null?void 0:n.status)==null?void 0:m.decision)===O.APPROVED&&e.jsx("a",{href:"/",className:"FlexiFormAgreement__link cancel",onClick:i,children:a("footer.cancel_application")}),e.jsx("a",{href:"/",className:"FlexiFormAgreement__link btn-next",children:a("footer.continue")})]})})]})})}):e.jsx(we,{})};const Er=()=>{const t=a=>E.t(`default:general.flexiti.application_form.${a}`);return e.jsxs("div",{className:"FlexitiFormApplicationClosed",children:[e.jsx("div",{className:"FlexitiFormApplicationClosed__wrapper",children:e.jsxs("div",{className:"FlexitiFormApplicationClosed__wrapper-container",children:[e.jsx("h3",{children:t("application_result.cancellation.thank_you_message")}),e.jsx("p",{children:t("application_result.cancellation.more_info")})]})}),e.jsx("div",{className:"FlexiFormCTA",children:e.jsx("div",{className:"FlexiFormCTA__btns",children:e.jsx("a",{href:"/",className:"FlexiFormAgreement__link btn-next",children:t("footer.back_to_staples")})})})]})},Lr=()=>{const{FLEXITI_PERSONAL_INFO:t,FLEXITI_FINANCIAL_INFO:a,FLEXITI_TERMS_AND_CONDITIONS:l,FLEXITI_REDIRECT_VALIDATION:r,FLEXITI_APPROVAL_STATUS:n,FLEXITI_APPLICATION_CLOSED:i}=O,{currentStep:o,loading:h,isExpirationWarningOpen:v}=s.useContext(Q),m=()=>{sr("Form Viewed",{form_id:"Flexiti applicaiton"})};return e.jsxs("div",{className:"FlexitiBody",onLoad:m,children:[h?e.jsx(We,{}):{FLEXITI_IMPORTANT_DISCLOSURES:e.jsx(Br,{nextStep:t}),FLEXITI_PERSONAL_INFO:e.jsx(gr,{nextStep:a}),FLEXITI_FINANCIAL_INFO:e.jsx(br,{nextStep:l}),FLEXITI_TERMS_AND_CONDITIONS:e.jsx(yr,{nextStep:r}),FLEXITI_REDIRECT_VALIDATION:e.jsx(Ar,{nextStep:n}),FLEXITI_APPROVAL_STATUS:e.jsx(wr,{nextStep:i}),FLEXITI_APPLICATION_CLOSED:e.jsx(Er,{})}[o]||e.jsx(we,{}),o!==n&&o!==i&&e.jsx(Ze,{open:v,"aria-labelledby":"session-timeout-dialog","aria-describedby":"session-timeout-dialog-description",children:v&&e.jsx(kr,{})})]})},Pr=({closeSession:t})=>{const a=l=>E.t(`default:general.flexiti.application_form.${l}`);return e.jsx("div",{className:"FlexitiSessionExpireModal",children:e.jsxs("div",{className:"FlexitiSessionExpireModal__heading session-expired",children:[e.jsx("h2",{children:a("session_modal.session_expired")}),e.jsx("div",{className:"FlexiFormCTA",children:e.jsx("a",{href:"/",className:"btn-next",onClick:t,children:a("footer.back_to_staples")})})]})})};const kr=()=>{const t=(m,p=0)=>E.t(`default:general.flexiti.application_form.${m}`,{timer:p}),{handleAuthRefresh:a,isExpirationWarningOpen:l,sessionExpired:r,handleSetIsExpirationWarningOpen:n}=s.useContext(Q),[i,o]=s.useState(60),h=m=>{m.preventDefault(),n(!1),a(),o(60)},v=m=>{m.preventDefault(),n(!1),window.location.href="/"};return s.useEffect(()=>{Qe(60,o)},[l]),l?i===0||r?e.jsx(Pr,{closeSession:v}):e.jsx("div",{className:"FlexitiSessionExpireModal",children:e.jsxs("div",{className:"FlexitiSessionExpireModal__heading",children:[e.jsx("h2",{children:t("session_modal.session_expire_warning")}),e.jsx("p",{children:t("session_modal.session_expire_description",i)}),e.jsxs("div",{className:"FlexiFormCTA",children:[e.jsx("a",{href:"/",onClick:v,children:t("footer.cancel")}),e.jsx("a",{href:"/",className:"btn-next",onClick:h,children:t("footer.continue")})]})]})}):e.jsx(e.Fragment,{})},Br=({nextStep:t})=>{const{formTranslations:a,handleCurrentStep:l}=s.useContext(Q),r=h=>E.t(`default:general.flexiti.application_form.${h}`),{important_disclosures:n}=a,[i,o]=s.useState(!0);return e.jsx("div",{className:"FlexiFlexitiDisclosures",children:e.jsxs("div",{className:"FlexitiDisclosuresContainer",children:[e.jsx("div",{className:"FlexiFormPersonalInfoHeader mt-4",children:e.jsx("div",{className:"FlexitiFormContainer__header",children:e.jsx("h3",{className:"FlexitiFormContainer__welcome",children:n.title})})}),e.jsx("div",{className:"FlexitiFormContainer__disclosure_content",dangerouslySetInnerHTML:{__html:n.content}}),e.jsx(Ie,{control:e.jsx(nr,{checked:!i,name:"disclosure",onChange:h=>o(!h.target.checked),disabled:!1}),label:e.jsx("div",{dangerouslySetInnerHTML:{__html:n.checkbox}})}),e.jsx("div",{className:"FlexiFormFinancialInfoFooter FlexiFormCTA",children:e.jsxs("div",{className:"FlexiFormCTA__btns",children:[e.jsx("a",{href:"/",className:"FlexiFormAgreement__link cancel",children:r("footer.cancel")}),e.jsx("a",{href:"/",className:"FlexiFormAgreement__link btn-next","data-disabled":i,onClick:h=>{h.preventDefault(),l(t)},children:r("footer.next")})]})})]})})};const qr=()=>e.jsx("div",{className:"FlexitiForm",children:e.jsxs(pr,{children:[e.jsx(_r,{}),e.jsx(Lr,{})]})});export{qr as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.