1"use strict";(self.webpackChunk_soar_member_hub=self.webpackChunk_soar_member_hub||[]).push([[625],{1538(e,t,r){r.d(t,{A:()=>a});var n=r(657),i=r(4276),o=r(9399);const a=e=>{const t=e.children,r=e.resourceUrl,a=e.allowLogin;return(0,o.jsxs)("div",{className:"h-full flex flex-col bg-gradient-to-r from-navigation-from to-navigation-to",children:[(0,o.jsxs)("header",{className:"flex flex-row justify-between px-10 py-10 lg:py-16 lg:px-20",children:[(0,o.jsx)("div",{className:"flex items-center",children:(0,o.jsx)("a",{href:"/",children:(0,o.jsx)("img",{src:"".concat(r,"/resources/logo-mono-h.png"),className:"max-h-[45px]",alt:"Logo"})})}),a&&(0,o.jsxs)("div",{className:"flex flex-row space-x-6",children:[(0,o.jsx)(n.EY,{className:"hidden md:block text-white",children:"Already registered? Let's get you logged in"}),(0,o.jsx)(n.$n,{variant:"secondary",asChild:!0,children:(0,o.jsx)(i.N_,{to:"/login",children:"Log in"})})]})]}),(0,o.jsx)("main",{className:"flex items-center",children:(0,o.jsx)("div",{className:"flex flex-1 flex-col md:flex-row justify-center md:mx-32 w-full md:w-3/4 max-w-[1200px] overflow-hidden rounded-lg bg-white",children:t})}),(0,o.jsx)("footer",{className:"py-10",children:(0,o.jsxs)(n.EY,{className:"text-sm text-center text-white",children:["\xa9 Glasgow Credit Union ",(new Date).getFullYear()," All Rights Reserved. Version: ","1.10.0"]})})]})}},6585(e,t,r){r.r(t),r.d(t,{default:()=>Zo});var n=r(4276),i=r(2319),o=r(3313),a=r(2865),l=r(2480),s=r(5602),c=r(657),u=r(2729),d=r(9399);const m=e=>{const t=e.cssClasses,r=e.icon,i=e.title,o=e.description,a=e.action;return(0,d.jsx)("div",{className:(0,u.cn)(t,"flex flex-col items-center py-10 px-8 md:flex-1 md:justify-center md:max-w-3xl lg:max-w-5xl"),children:(0,d.jsxs)("div",{className:"flex flex-col items-center md:w-3/4",children:[(0,d.jsx)(c.In,{mb:3,icon:r.name,width:["90px",null,null,"150px"],height:["90px",null,null,"150px"],size:"55px",bg:r.background,background:!0}),(0,d.jsx)(c.EY,{children:i}),(0,d.jsx)(c.EY,{className:"text-secondary text-sm mb-10",children:o}),(0,d.jsx)(c.$n,{className:"w-full",variant:a.variant,asChild:!0,children:(0,d.jsx)(n.N_,{to:a.href,children:a.title})})]})})},y=()=>(0,d.jsxs)("div",{className:"text-center flex flex-col md:flex-row flex-1 justify-center",children:[(0,d.jsx)(m,{cssClasse
1s:"bg-tabs md:rounded-l-lg",icon:{name:"group",background:"#ffffff"},title:"I\u2019m already a member",description:"If you are a member but haven't set up your online account yet, register for online access.",action:{title:"Register for online access",variant:"outline",href:"/register"}}),(0,d.jsx)(m,{cssClasses:"bg-white md:rounded-r-lg",icon:{name:"clipboard-alt",background:"#f7f7f7"},title:"I\u2019m not a member",description:"If you wish to join our Credit Union and open an account with us, start the process now.",action:{title:"Join our Credit Union",href:"/join"}})]});var f=r(5244),p=r(9338),h=r.n(p),b=r(3101),g=r(4264),v=r(1013),x=r(4758),j=r(1818),w=r(3788),k=r(140),S=r(854),A=r(2246);function C(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function O(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?C(Object(r),!0).forEach(function(t){E(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):C(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function E(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const N=e=>{const t=e.onBack,r=e.onContinue,n=e.inputFields,o=(0,S.TW9)({fetchPolicy:"no-cache",errorPolicy:"all"}).data,a=b.Ik({agreements:A.A.Agreements}),l=(0,w.mN)({resolver:(0,k.u)(a)}),s=l.control,u=l.reset,m=(0,w.jz)({control:s,name:"agreements"}),y=m.fields,f=m.replace,p=m.update;(0,i.useEffect)(()=>{var e;const t=null===(e=o.getCreditUnion)||void 0===e?void 0:e.termsAndConditionsUrls.filter(e=>e&&e.processKeys&&e.processKeys.includes("registration")).flatMap(e=>e&&e.key&&e.title&&e.url?{key:e.key,title:e.title,url:e.url,value:!1}:[]);if(t){const e=[];t.forEach(t=>{var r;e.push({key:t.key,title:t.title,url:t.url,value:null===(r=n.agreements.find(e=>e.key===t.key))||void 0===r?void 0:r.value})}),f(e)}},[f,o.getCreditUnion,u,n.agreements]);return(0,d.jsxs)(c.lV,O(O({},l),{},{onSubmit:async e=>{const t=Object.fromEntries(e.agreements.map(e=>[e.key,{key:e.key,title:e.title,value:e.value}]));r(Object.values(t))},title:"Terms and conditions",children:[(0,d.jsxs)(c.sf,{children:[(0,d.jsx)(c.fV,{variant:"h4",as:"h3",children:"What are you agreeing to?"}),(0,d.jsx)(c.EY,{children:"Our Membership Terms and Conditions outlines the conditions of membership to Glasgow Credit Union including your use of our Digital Services. Membership of the credit union and continued use of our services is conditional on your acceptance of these Terms and Conditions."}),(0,d.jsx)(c.EY,{children:"Additionally, you agree:"}),(0,d.jsx)(c.Pg,{items:["not to share your login or security credentials with anyone.","to make sure no one else sees you enter your login or security credentials when using our services.","not to document or retain a copy of your security credentials in a way that they could be understood by anyone else."].map(e=>({content:e}))}),(0,d.jsx)(c.CL,{children:(0,d.jsx)(c.zB,{control:l.control,name:"agreements",render:()=>(0,d.jsx)("div",{children:y.map((e,t)=>(0,d.jsxs)(c.eI,{children:[(0,d.jsxs)(c.Rr,{children:["Please review the"," ",(0,d.jsx)(c.$n,{asChild:!0,variant:"link",size:"link",className:"text-sm",children:(0,d.jsx)("a",{target:"_blank",href:e.url,rel:"noreferrer",children:e.title})}),"."]}),(0,d.jsxs)("div",{className:"flex flex-row space-x-3",children:[(0,d.jsx)(c.MJ,{children:(0,d.jsx)(c.oV,{checked:e.value,onCheckedChange:r=>{p(t,{key:e.key,title:e.title,value:!!r,url:e.url})}})}),(0,d.jsxs)(c.lR,{children:["I have read, understand and agree to the ".concat(e.title),"."]})]}),(0,d.jsx)(c.C5,{})]},e.key))})})})]}),(0,d.jsx)(c.OJ,{primary:(0,d.jsx)(c.$n,{type:"submit",children:"Next"}),secondary:(0,d.jsx)(c.$n,{onClick:t,children:"Back"})})]}))};function P(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function D(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};
1t%2?P(Object(r),!0).forEach(function(t){I(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):P(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function I(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const L=e=>{const t=e.onContinue,r=(0,w.mN)();return(0,d.jsxs)(c.lV,D(D({},r),{},{onSubmit:()=>{t()},title:"Register for online access",children:[(0,d.jsxs)(c.sf,{children:[(0,d.jsx)(c.fV,{variant:"h4",as:"h3",children:"Before we start"}),(0,d.jsx)(c.EY,{children:"If you are already a member of Glasgow Credit Union, this will allow you to setup online access to your account(s)."}),(0,d.jsx)(c.EY,{children:"This will only take a few minutes. You will need the following information:"}),(0,d.jsx)(c.Pg,{items:["Your Glasgow Credit Union Membership Number","Your National Insurance Number","Other personal details including your date of birth and contact details","You may also need to confirm the Primary Bank Account details already registered on your account"].map(e=>({content:e}))})]}),(0,d.jsx)(c.OJ,{primary:(0,d.jsx)(c.$n,{type:"submit",children:"Next"}),secondary:(0,d.jsx)(c.$n,{asChild:!0,children:(0,d.jsx)(n.N_,{to:"/",children:"Back"})})})]}))},R=e=>{let t=e.onNavigate,r=e.isAccountMigration;const n=r?"Your account migration is now complete.":"You have now registered your Glasgow Credit Union account.";return(0,d.jsx)("div",{className:"w-full h-full flex flex-col justify-center items-center",children:(0,d.jsx)(c.Gb,{title:"You're all set",subHeading:[{content:n,emphasise:[{content:n}]},...r?[{content:"You will no longer be prompted for your password or PIN when logging in.",emphasise:[{content:"You will no longer be prompted for your password or PIN when logging in."}]}]:[]],action:{title:"Continue",to:"/"},onNavigate:t})})};var M=r(4497);function T(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function F(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?T(Object(r),!0).forEach(function(t){q(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):T(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function q(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const V=e=>{const t=e.inputFields,r=e.onBack,n=e.onContinue,i=e.errorMessage,o=b.Ik({memberNumber:A.A.MemberNumber,niNumber:A.A.NationalInsurance.transform(e=>e.replace(/-/g,"")),dateOfBirth:A.A.DateOfBirth}),a=(0,w.mN)({resolver:(0,k.u)(o),defaultValues:{memberNumber:t.memberNumber,niNumber:t.niNumber,dateOfBirth:t.dateOfBirth?t.dateOfBirth.format(A.D):""}});return(0,d.jsxs)(c.lV,F(F({},a),{},{onSubmit:async e=>{n(e.memberNumber,e.niNumber,h()(e.dateOfBirth,A.D))},title:"Your membership details",children:[(0,d.jsxs)(c.sf,{children:[(0,d.jsx)(c.fV,{variant:"h4",as:"h3",children:"Let\u2019s find your account"}),(0,d.jsx)(c.EY,{children:"Enter your Member Number, National Insurance Number and date of birth so we can find your Glasgow Credit Union account."}),(0,d.jsxs)(c.CL,{children:[(0,d.jsx)(c.zB,{control:a.control,name:"memberNumber",render:e=>{let t=e.field;return(0,d.jsx)(c.ZQ,F(F({label:"Member Number",maxLength:M.tl,pattern:M.$2,required:!0,helperText:"You can find this on your welcome email or any correspondence from us"},t),{},{onInput:e=>{e.target.value=e.target.value.replace(/[^0-9]/g,""),e.target.value=e.target.value.replace(/^0+/,""),a.setValue("memberNumber",e.target.value)}}))}}),(0,d.jsx)(c.zB,{control:a.control,name:"niNumber",render:e=>{let t=e.field;return(0,d.jsx)(c.ZQ,F({label:"National Insurance Number",placeholder:M.hU,options:M.Qw,required:!0},t))}}),(0,d.jsx)(c.zB,{control:a.control,name:"dateOfBirth",render:e=>{let t=e.field;return(0,d.jsx)(c.ZQ,F({label:"Date of birth",placeholder:M.ET,pattern:M.Tj,options:M.bv,required:!0},t))}})]}),i&&(0,d.jsx)(c.EY,{className:"text-destructive",children:i})]}),(0,d.jsx)(c.OJ,{primary:(0,d.jsx)(c.$n,{type:"submit",children:"Next"}),secondary:(0,d.jsx)(c.$n,{onClick:r,children:"Back"})})]}))};function Y(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function U(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};
1t%2?Y(Object(r),!0).forEach(function(t){B(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Y(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function B(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,a,l=[],s=!0,c=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=o.call(r)).done)&&(l.push(n.value),l.length!==t);s=!0);}catch(e){c=!0,i=e}finally{try{if(!s&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw i}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return z(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?z(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function z(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}const $=e=>{const t=e.inputFields,r=e.onContinue,n=e.onBack,o=_((0,i.useState)(!1),2),a=o[0],l=o[1],s=b.Ik({emailAddress:A.A.EmailAddress,mobileNumber:A.A.MobilePhone.optional()}),u=(0,w.mN)({resolver:(0,k.u)(s),defaultValues:{emailAddress:t.emailAddress,mobileNumber:t.mobileNumber}});return a?(0,d.jsx)(c.kt,{}):(0,d.jsxs)(c.lV,U(U({},u),{},{onSubmit:async e=>{l(!0),await r(e.emailAddress,e.mobileNumber),l(!1)},title:"Your contact details",children:[(0,d.jsxs)(c.sf,{children:[(0,d.jsx)(c.fV,{variant:"h4",as:"h3",children:"Confirm your contact details"}),(0,d.jsx)(c.EY,{children:"Enter your email address and mobile number. We will verify them by sending a one time passcode."}),(0,d.jsxs)(c.CL,{children:[(0,d.jsx)(c.zB,{control:u.control,name:"emailAddress",render:e=>{let t=e.field;return(0,d.jsx)(c.ZQ,U({label:"Email address",type:"email",maxLength:M.vX,inputStyle:"lowercase",required:!0},t))}}),(0,d.jsx)(c.zB,{control:u.control,name:"mobileNumber",render:e=>{let t=e.field;return(0,d.jsx)(c.ZQ,U({label:"Mobile phone number (optional)",maxLength:M.dF,onInput:e=>{e.target.value=e.target.value.replace(/[^0-9+]/g,"").toLowerCase()}},t))}})]})]}),(0,d.jsx)(c.OJ,{primary:(0,d.jsx)(c.$n,{type:"submit",isLoading:a,children:"Next"}),secondary:(0,d.jsx)(c.$n,{onClick:n,children:"Back"})})]}))};var G=r(4493),H=r(3262);function W(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function K(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?W(Object(r),!0).forEach(function(t){Z(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):W(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function Z(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Q(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,a,l=[],s=!0,c=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=o.call(r)).done)&&(l.push(n.value),l.length!==t);s=!0);}catch(e){c=!0,i=e}
1finally{try{if(!s&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw i}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return J(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?J(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function J(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}const X=e=>{const t=e.onContinue,r=e.inputFields,n=Q((0,i.useState)(!1),2),o=n[0],a=n[1],l=(0,S.laO)({fetchPolicy:"no-cache",errorPolicy:"all",variables:{memberNumber:r.memberNumber}}),s=l.data,u=l.error,m=b.Ik({questions:b.YO(A.A.SecurityQuestion())}),y=(0,w.mN)({resolver:(0,k.u)(m)}),f=y.control,p=y.reset,h=(0,w.jz)({control:f,name:"questions"}),g=h.fields,v=h.replace;(0,i.useEffect)(()=>{var e;const t=null===s||void 0===s||null===(e=s.getSecurityQuestions)||void 0===e||null===(e=e.securityQuestions)||void 0===e?void 0:e.filter(e=>e).flatMap(e=>e&&e.key&&e.inputData&&e.question?{key:e.key,inputData:e.inputData,question:e.question}:null);if(t){const e=[];t.forEach(t=>{e.push({key:t.key,question:t.question,inputData:K(K({htmlElement:t.inputData.htmlElement,helperText:t.inputData.helperText,options:t.inputData.options},t.inputData.minLength&&{minLength:t.inputData.minLength}),t.inputData.maxLength&&{maxLength:t.inputData.maxLength})})}),v(e)}},[v,null===s||void 0===s?void 0:s.getSecurityQuestions,p]),(0,i.useEffect)(()=>{if(!s||u||null!==s&&void 0!==s&&s.getSecurityQuestions.error)throw new H.y("Sorry, we are unable to complete your account reset.","There is not enough information available on the system to verify your account at the moment. Please contact Credit Union staff in order to update your details on the system and try again.")},[s,null===s||void 0===s?void 0:s.getSecurityQuestions,u]);return(0,d.jsxs)(c.lV,K(K({},y),{},{onSubmit:async e=>{const r={};e.questions.forEach(e=>{const t=e.key,n=e.answer;Object.assign(r,{[t]:n})}),a(!0),await t(r),a(!1)},title:"Verify your account",children:[(0,d.jsxs)(c.sf,{children:[(0,d.jsx)(c.fV,{variant:"h4",as:"h3",children:"We need to confirm some details"}),(0,d.jsx)(c.EY,{children:"To keep your account secure, please answer the following questions before you can access your account."}),(0,d.jsx)(c.CL,{children:g.map((e,t)=>{if("text"===e.inputData.htmlElement)return(0,d.jsx)(c.zB,{control:y.control,name:"questions.".concat(t,".answer"),defaultValue:"",render:t=>{let r=t.field;return(0,d.jsx)(c.ZQ,K({label:e.question,required:!0,helperText:e.inputData.helperText,minLength:e.inputData.minLength,maxLength:e.inputData.maxLength},r))}},"text_".concat(e.id));if("number"===e.inputData.htmlElement)return(0,d.jsx)(c.zB,{control:y.control,name:"questions.".concat(t,".answer"),defaultValue:"",render:t=>{let r=t.field;return(0,d.jsx)(c.ZQ,K({label:e.question,pattern:c.$2,type:"number",required:!0,helperText:e.inputData.helperText,minLength:e.inputData.minLength,maxLength:e.inputData.maxLength},r))}},"number_".concat(e.id));if("sortcode"===e.inputData.htmlElement)return(0,d.jsx)(c.zB,{control:y.control,name:"questions.".concat(t,".answer"),render:t=>{let r=t.field;return(0,d.jsx)(c.ZQ,K({label:e.question,placeholder:c.gk,required:!0,options:c.xm,helperText:e.inputData.helperText},r))}},"sortcode".concat(e.id));if("currency"===e.inputData.htmlElement)return(0,d.jsx)(c.zB,{control:y.control,name:"questions.".concat(t,".answer"),defaultValue:"",render:r=>{let n=r.field;return(0,d.jsx)(c.ZQ,K(K({label:e.question},n),{},{type:"text",options:c.cl,id:e.question,helperText:e.inputData.helperText,required:!0,onBlur:e=>{y.setValue("questions.".concat(t,".answer"),parseFloat(e.target.rawValue).toFixed(2))}}))}},"currency".concat(e.id));if("select"===e.inputData.htmlElement){const r=Object.fromEntries(e.inputData.options.map(e=>[e.value,e.option]));return(0,d.jsx)(c.zB,{control:y.control,name:"questions.".concat(t,".answer"),defaultValue:"",render:t=>{let n=t.field;return(0,d.jsx)(G.FX,K(K({id:e.question,helperText:e.inputData.helperText,options:r},n),{},{onValueChange:n.onChange}))}},"select".concat(e.id))}return null})})]}),(0,d.jsx)(c.OJ,{primary:(0,d.jsx)(c.$n,{type:"submit",isLoading:o,children:"Next"}),secondary:(0,d.jsx)(c.$n,{isDisabled:!0,children:"Back"})})]}))},ee=e=>{const t=e.onResendClick,r=e.emailAddress,n=e.errorMessage,i=e.websiteUrl;return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:"text-2xl font-bold text-fields",children:"Check your email"}),(0,d.jsxs)("div",{className:"text-base flex flex-grow flex-col justify-between w-full h-full my-24 min-h-[40%]",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("div",{className:"",children:"We've sent an email to"}),(0,d.jsx)("div",{className:"font-bold text-fields py-6",children:r}),(0,d.jsx)("div",{className:"pb-6",children:"This email contains a magic link that will verify your email address."}),(0,d.jsxs)("div",{children:["Incorrect email address? Please"," ",(0,d.jsx)(c.$n,{asChild:!0,variant:"link",size:"link",children:(0,d.jsx)("a",{target:"_blank",href:"".concat(i,"/info/help-and-support/"),rel:"noreferrer",children:"contact us"})}),"."]})]}
1),(0,d.jsx)("div",{className:"flex xs:h-full flex-col justify-center text-center",children:(0,d.jsx)("div",{children:(0,d.jsx)(c.HO,{className:"text-center"})})}),(0,d.jsxs)("div",{children:[(0,d.jsx)("div",{className:"text-base flex flex-col justify-end",children:n&&(0,d.jsx)("div",{className:"errors",children:(0,d.jsx)(c.EY,{className:"text-destructive",children:n})})}),(0,d.jsxs)("div",{children:[(0,d.jsxs)(c.$n,{className:"pt-10",variant:"link",size:"link",onClick:t,children:["I didn't get an email"," "]})," "]})]})]})]})};var te=r(8964),re=r(5130);function ne(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function ie(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ne(Object(r),!0).forEach(function(t){oe(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ne(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function oe(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ae(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,a,l=[],s=!0,c=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=o.call(r)).done)&&(l.push(n.value),l.length!==t);s=!0);}catch(e){c=!0,i=e}finally{try{if(!s&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw i}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return le(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?le(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function le(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}const se=e=>{const t=e.onContinue,r=e.onBack,n=e.onResendClick,o=e.mobileNumber,a=ae((0,i.useState)(!1),2),l=a[0],s=a[1],u=ae((0,i.useState)(!1),2),m=u[0],y=u[1],f=ae((0,i.useState)(""),2),p=f[0],h=f[1],g=(0,c.dj)().toast,v=b.Ik({verificationCode:A.A.VerificationCode}),x=(0,w.mN)({resolver:(0,k.u)(v),defaultValues:{verificationCode:""}});return m?(0,d.jsx)(c.kt,{}):(0,d.jsxs)(c.lV,ie(ie({},x),{},{onSubmit:async e=>{s(!0),h("");try{await t(e.verificationCode)}catch(r){const e=(0,re.u$)(r).message;h(e||"Something went wrong. Please try again.")}s(!1)},title:"Confirm your phone number",children:[(0,d.jsxs)(c.sf,{children:[(0,d.jsxs)(c.EY,{children:["We\u2019ve sent an SMS with an verification code to:",(0,d.jsx)("br",{}),(0,d.jsx)(c.EY,{as:"span",className:"font-bold",children:"".concat(o.obsecure?((e,t)=>{if(t>0){const r=e.slice(-1*t);return"*".repeat(e.length-t)+r}return e})(o.value,4):o.value)})]}),(0,d.jsx)("div",{children:(0,d.jsxs)(c.EY,{children:["Incorrect mobile number? Please"," ",(0,d.jsx)(c.$n,{asChild:!0,variant:"link",size:"link",children:(0,d.jsx)("a",{target:"_blank",href:"https://www.glasgowcu.com/contact-us/",rel:"noreferrer",children:"contact us"})}),"."]})}),(0,d.jsxs)(c.CL,{children:[(0,d.jsx)(c.zB,{control:x.control,name:"verificationCode",render:e=>{let t=e.field;return(0,d.jsx)(c.Wf,ie({onFocus:()=>{p&&h("")},label:"Enter SMS verification code",maxLength:6,pattern:te.UO,required:!0},t))}}),p&&(0,d.jsx)("div",{className:"errors",children:(0,d.jsx)(c.EY,{className:"text-destructive",children:p})})]}),(0,d.jsx)(c.EY,{children:"Didn\u2019t get the SMS?"}),(0,d.jsx)("div",{children:(0,d.jsx)(c.$n,{type:"button",variant:"link",size:"link",onClick:async()=>{y(!0),h(""),x.reset();try{await n(),g({variant:"success",title:"Verification Sent",description:"A verification code has been sent to ".concat(o.value,".")})}catch(e){g({variant:"destructive",title:"Verification Sending Failed",description:"Something has gone wrong, please try again."})}finally{y(!1)}},formNoValidate:!0,children:"Resend SMS verification code"})})]}),(0,d.jsx)(c.OJ,{primary:(0,d.jsx)(c.$n,{type:"submit",isLoading:l,children:"Next"}),secondary:(0,d.jsx)(c.$n,{disabled:void 0===r,onClick:r,children:"Back"})})]}))};function ce(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function ue(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};
1t%2?ce(Object(r),!0).forEach(function(t){de(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ce(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function de(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const me=e=>{const t=e.onContinue,r=(0,S.XfP)({fetchPolicy:"no-cache",errorPolicy:"all"}).data,n=b.Ik({options:b.YO(A.A.PreferenceOption)}),o=(0,w.mN)({resolver:(0,k.u)(n)}),a=o.control,l=(0,w.jz)({control:a,name:"options"}),s=l.fields,u=l.replace,m=l.update;(0,i.useEffect)(()=>{const e=r.getCreditUnion.communicationOptions.filter(e=>e&&"notifications"===e.key&&e.enabled||e&&"electronicDocuments"===e.key&&e.enabled),t=[];e.forEach(e=>{t.push({key:e.key,name:e.name,description:e.description,value:"electronicDocuments"===e.key})}),u(t)},[u,null===r||void 0===r?void 0:r.getCreditUnion]);return(0,d.jsxs)(c.lV,ue(ue({},o),{},{onSubmit:e=>{const r={};e.options.forEach(e=>{const t=e.key,n=e.value;Object.assign(r,{[t]:n})}),t(r)},title:"Communication preferences",children:[(0,d.jsxs)(c.sf,{children:[(0,d.jsx)(c.fV,{variant:"h4",as:"h3",children:"Nearly there! Let\u2019s confirm your communication preferences."}),(0,d.jsx)(c.EY,{children:"Glasgow Credit Union is a member led organisation. As such, we may contact you with operational information such as system availability or call centre opening times together with important news and updates about the credit union. We may also contact you with updates on products and services that you currently have or with any applications you may have made."}),(0,d.jsx)(c.CL,{children:(0,d.jsx)(c.zB,{control:o.control,name:"options",render:()=>(0,d.jsx)(d.Fragment,{children:s.map((e,t)=>(0,d.jsxs)(c.eI,{children:[(0,d.jsxs)("div",{className:"flex flex-row items-center space-x-3",children:[(0,d.jsx)(c.MJ,{children:(0,d.jsx)(c.oV,{checked:e.value,onCheckedChange:r=>{m(t,{key:e.key,name:e.name,description:e.description,value:!!r})}})}),(0,d.jsx)(c.lR,{className:"mb-0",children:e.name})]}),(0,d.jsx)(c.Rr,{children:e.description})]},e.key))})})})]}),(0,d.jsx)(c.OJ,{primary:(0,d.jsx)(c.$n,{type:"submit",children:"Next"}),secondary:(0,d.jsx)(c.$n,{isDisabled:!0,type:"button",children:"Back"})})]}))};function ye(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function fe(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ye(Object(r),!0).forEach(function(t){pe(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ye(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function pe(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function he(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,a,l=[],s=!0,c=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=o.call(r)).done)&&(l.push(n.value),l.length!==t);s=!0);}catch(e){c=!0,i=e}finally{try{if(!s&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw i}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return be(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?be(e,t):void 0}}
1(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function be(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}const ge=e=>{const t=e.onBack,r=e.onContinue,n=e.apiError,o=he((0,i.useState)(!1),2),a=o[0],l=o[1],s=(0,S.XfP)({fetchPolicy:"no-cache",errorPolicy:"all"}).data,u=b.Ik({options:b.YO(A.A.PreferenceOption)}),m=(0,w.mN)({resolver:(0,k.u)(u)}),y=m.control,f=(0,w.jz)({control:y,name:"options"}),p=f.fields,h=f.replace,g=f.update;(0,i.useEffect)(()=>{const e=s.getCreditUnion.communicationOptions.filter(e=>e&&"post"===e.key&&e.enabled||e&&"email"===e.key&&e.enabled||e&&"sms"===e.key&&e.enabled||e&&"phone"===e.key&&e.enabled),t=[];e.forEach(e=>{t.push({key:e.key,name:e.name,description:e.description,value:!1})}),h(t)},[h,null===s||void 0===s?void 0:s.getCreditUnion]);return(0,d.jsxs)(c.lV,fe(fe({},m),{},{onSubmit:async e=>{const t={};e.options.forEach(e=>{const r=e.key,n=e.value;Object.assign(t,{[r]:n})}),l(!0),await r(t)},title:"Marketing preferences",children:[(0,d.jsxs)(c.sf,{children:[(0,d.jsx)(c.fV,{variant:"h4",as:"h3",children:"And Finally... Let\u2019s confirm your marketing preferences."}),(0,d.jsx)(c.EY,{children:"As a member run organisation, we\u2019ll still contact you about your account and any applications you\u2019ve made. We\u2019ll also provide you with operational information such as system availability or call centre opening times together with important news and updates about the credit union. We\u2019ll do this by letter, email, phone or SMS based on operational or security reasons."}),(0,d.jsx)(c.CL,{children:(0,d.jsx)(c.zB,{control:m.control,name:"options",render:()=>(0,d.jsx)(d.Fragment,{children:p.map((e,t)=>(0,d.jsxs)(c.eI,{children:[(0,d.jsxs)("div",{className:"flex flex-row items-center space-x-3",children:[(0,d.jsx)(c.MJ,{children:(0,d.jsx)(c.oV,{checked:e.value,onCheckedChange:r=>{g(t,{key:e.key,name:e.name,description:e.description,value:!!r})}})}),(0,d.jsx)(c.lR,{className:"mb-0",children:e.name})]}),(0,d.jsx)(c.Rr,{children:e.description})]},e.key))})})})]}),n&&(0,d.jsx)("div",{className:"errors",children:(0,d.jsx)(c.EY,{className:"text-destructive",children:n})}),(0,d.jsx)(c.OJ,{primary:(0,d.jsx)(c.$n,{type:"submit",isLoading:a,children:"Next"}),secondary:(0,d.jsx)(c.$n,{type:"button",isDisabled:void 0===t,onClick:t,children:"Back"})})]}))};var ve=r(2356);function xe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function je(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?xe(Object(r),!0).forEach(function(t){we(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):xe(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function we(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ke(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,a,l=[],s=!0,c=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=o.call(r)).done)&&(l.push(n.value),l.length!==t);s=!0);}catch(e){c=!0,i=e}finally{try{if(!s&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw i}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Se(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Se(e,t):void 0}}
1(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Se(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}const Ae=e=>{const t=e.inputFields,r=e.onContinue,n=ke((0,i.useState)(!1),2),o=n[0],a=n[1],l=b.Ik({emailAddress:A.A.EmailAddress,mobileNumber:A.A.MobilePhone.optional()}),s=(0,w.mN)({resolver:(0,k.u)(l),defaultValues:{emailAddress:t.emailAddress,mobileNumber:t.mobileNumber}});return(0,d.jsxs)(c.lV,je(je({},s),{},{onSubmit:async e=>{a(!0),await r(e.emailAddress,e.mobileNumber),a(!1)},title:"Update your information",children:[(0,d.jsxs)(c.sf,{children:[(0,d.jsx)(c.fV,{variant:"h4",as:"h3",children:"Confirm your contact details"}),(0,d.jsx)(c.EY,{children:"Enter your email address and mobile number. We will verify them by sending a one time passcode."}),(0,d.jsxs)(c.CL,{children:[(0,d.jsx)(c.zB,{control:s.control,name:"emailAddress",render:e=>{let t=e.field;return(0,d.jsx)(c.ZQ,je({label:"Confirm your email",maxLength:M.vX,inputStyle:"lowercase",required:!0},t))}}),(0,d.jsx)(c.zB,{control:s.control,name:"mobileNumber",render:e=>{let t=e.field;return(0,d.jsx)(c.ZQ,je(je({label:"Confirm your mobile number (optional)",maxLength:M.dF},t),{},{onInput:e=>{e.target.value=e.target.value.replace(/[^0-9+]/g,"").toLowerCase()}}))}})]})]}),(0,d.jsx)(c.OJ,{primary:(0,d.jsx)(c.$n,{isDisabled:o,isLoading:o,type:"submit",children:"Next"}),secondary:(0,d.jsx)(c.$n,{children:"Back"})})]}))};var Ce=r(8190),Oe=r(9776),Ee=r(8013),Ne=r(3512),Pe=r(3814),De=r(8399),Ie=r(9138),Le=r(6577),Re=r(319),Me=r(3265),Te=r(3516),Fe=r(5257),qe=r(9740),Ve=r(1527),Ye=r(2205),Ue=r(7153),Be=r(7536),_e=r(3221);var ze=r(7680);async function $e(e){var t;const r=null===(t=Pe.H.getConfig().Auth)||void 0===t?void 0:t.Cognito;(0,De.$y)(r);const n=r.userPoolEndpoint,i=r.userPoolId,a=e.confirmationCode,l=e.userAttributeKey;(0,Re.M)(!!a,Le.P.EmptyConfirmUserAttributeCode);const s=(await(0,o.$)({forceRefresh:!1})).tokens;(0,Te.H0)(s);const c=(u={endpointResolver:(0,ze.o)({endpointOverride:n})},(0,Ve.A)(Ye.e,(0,Ue._)("VerifyUserAttribute"),(0,Be.T)(),(0,qe.A)((0,qe.A)({},_e.C),u)));var u;await c({region:(0,Me.J)(i),userAgentValue:(0,Fe.A)(Ie.BM.ConfirmUserAttribute)},{AccessToken:s.accessToken.toString(),AttributeName:l,Code:a})}var Ge=r(6595),He=r(7061);var We=r(6704),Ke=r(2224);async function Ze(e){var t;const r=e.username,n=e.confirmationCode,i=e.options,o=null===(t=Pe.H.getConfig().Auth)||void 0===t?void 0:t.Cognito;(0,De.$y)(o);const a=o.userPoolId,l=o.userPoolClientId,s=o.userPoolEndpoint,c=null===i||void 0===i?void 0:i.clientMetadata;(0,Re.M)(!!r,Le.P.EmptyConfirmSignUpUsername),(0,Re.M)(!!n,Le.P.EmptyConfirmSignUpCode);const u=(0,He.d)({username:r,userPoolId:a,userPoolClientId:l}),d=(m={endpointResolver:(0,ze.o)({endpointOverride:s})},(0,Ve.A)(Ye.e,(0,Ue._)("ConfirmSignUp"),(0,Be.T)(),(0,qe.A)((0,qe.A)({},_e.C),m)));var m;const y=(await d({region:(0,Me.J)(o.userPoolId),userAgentValue:(0,Fe.A)(Ie.BM.ConfirmSignUp)},{Username:r,ConfirmationCode:n,ClientMetadata:c,ForceAliasCreation:null===i||void 0===i?void 0:i.forceAliasCreation,ClientId:o.userPoolClientId,UserContextData:u})).Session;return new Promise((e,t)=>{try{const t={isSignUpComplete:!0,nextStep:{signUpStep:"DONE"}},n=We.z.getState();if(!n.active||n.username!==r)return e(t),void(0,Ke.xO)();We.z.dispatch({type:"SET_SESSION",value:y});const i=Ge.f3.listen("auth-internal",t=>{if("autoSignIn"===t.payload.event)e({isSignUpComplete:!0,nextStep:{signUpStep:"COMPLETE_AUTO_SIGN_IN"}}),i()});Ge.f3.dispatch("auth-internal",{event:"confirmSignUp",data:t})}catch(n){t(n)}})}async function Qe(e){var t,r;const n=e.username;(0,Re.M)(!!n,Le.P.EmptySignUpUsername);const i=null===(t=Pe.H.getConfig().Auth)||void 0===t?void 0:t.Cognito;(0,De.$y)(i);const o=i.userPoolClientId,a=i.userPoolId,l=i.userPoolEndpoint,s=null===(r=e.options)||void 0===r?void 0:r.clientMetadata,c=(0,He.d)({username:n,userPoolId:a,userPoolClientId:o}),u=(d={endpointResolver:(0,ze.o)({endpointOverride:l})},(0,Ve.A)(Ye.e,(0,Ue._)("ResendConfirmationCode"),(0,Be.T)(),(0,qe.A)((0,qe.A)({},_e.C),d)));var d;const m=(await u({region:(0,Me.J)(i.userPoolId),userAgentValue:(0,Fe.A)(Ie.BM.ResendSignUpCode)},{Username:n,ClientMetadata:s,ClientId:i.userPoolClientId,UserContextData:c})).CodeDeliveryDetails,y=(0,qe.A)({},m),f=y.DeliveryMedium,p=y.AttributeName;return{destination:y.Destination,deliveryMedium:f,attributeName:p||void 0}}const Je=async e=>{var t;const r=e.userAttributeKey,n=e.options,i=null===(t=Pe.H.getConfig().Auth)||void 0===t?void 0:t.Cognito,a=null===n||void 0===n?void 0:n.clientMetadata;(0,De.$y)(i);const l=i.userPoolEndpoint,s=i.userPoolId,c=(await(0,o.$)({forceRefresh:!1})).tokens;(0,Te.H0)(c);const u=(d={endpointResolver:(0,ze.o)({endpointOverride:l})},(0,Ve.A)(Ye.e,(0,Ue._)("GetUserAttributeVerificationCode"),(0,Be.T)(),(0,qe.A)((0,qe.A)({},_e.C),d)));var d;const m=(await u({region:(0,Me.J)(s),userAgentValue:(0,Fe.A)(Ie.BM.SendUserAttributeVerificationCode)}
1,{AccessToken:c.accessToken.toString(),ClientMetadata:a,AttributeName:r})).CodeDeliveryDetails,y=(0,qe.A)({},m),f=y.DeliveryMedium,p=y.AttributeName;return{destination:y.Destination,deliveryMedium:f,attributeName:p}},Xe=async e=>{await Qe({username:e})},et=async(e,t)=>{try{await(0,Oe.J)({username:e,password:t}),await Je({userAttributeKey:"phone_number"}),await(0,Ne.C)()}catch(r){throw await(0,Ne.C)(),r}},tt=async()=>{try{await Je({userAttributeKey:"phone_number"})}catch(e){throw new Error("Something went wrong")}},rt=async e=>{let t=e.smsCode;await $e({userAttributeKey:"phone_number",confirmationCode:t})};function nt(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,a,l=[],s=!0,c=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=o.call(r)).done)&&(l.push(n.value),l.length!==t);s=!0);}catch(e){c=!0,i=e}finally{try{if(!s&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw i}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return it(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?it(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function it(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}const ot=e=>{let t=e.onBack,r=e.onResendMagicLink,n=e.emailAddress,o=e.contactEmail,a=e.websiteUrl;const l=nt((0,i.useState)(!1),2),s=l[0],u=l[1];return s?(0,d.jsx)(c.kt,{}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:"text-2xl font-bold text-fields",children:"I didn't get an email"}),(0,d.jsxs)("div",{className:"text-base flex flex-col w-full h-full my-24 min-h-[40%]",children:[(0,d.jsx)("div",{children:"We've sent an email to"}),(0,d.jsx)("div",{className:"font-bold text-fields py-5",children:n}),(0,d.jsxs)("div",{className:"py-10 ",children:["Check your email address is right. If it isn\u2019t,"," ",(0,d.jsx)(c.$n,{asChild:!0,variant:"link",size:"link",children:(0,d.jsx)("a",{target:"_blank",href:"".concat(a,"/info/help-and-support/"),rel:"noreferrer",children:"contact us"})}),"."]}),(0,d.jsx)("div",{className:"font-bold text-fields py-5",children:"If your email address is correct:"}),(0,d.jsx)(c.Pg,{type:"circle",items:[{content:"Wait 10 minutes. Sometimes emails can be delayed reaching your inbox"},{content:"Check your spam folder (and mark the email as \u2018Not Spam\u2019 if it is in there)"},{content:"Re-send the email with the button below"},{content:"If none of that works, please send an email to ".concat(o," from the same email you registered with us and we will help you out.")}]})]}),(0,d.jsx)(c.e2,{primary:(0,d.jsx)(c.$n,{isLoading:s,className:"w-full",onClick:async()=>{u(!0),await r(),u(!1)},children:"Resend email"}),secondary:(0,d.jsx)(c.$n,{onClick:()=>t(),children:"Back"})})]})};var at=r(3797);function lt(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function st(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?lt(Object(r),!0).forEach(function(t){ct(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):lt(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function ct(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ut(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,a,l=[],s=!0,c=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=o.call(r)).done)&&(l.push(n.value),l.length!==t);s=!0);}catch(e){c=!0,i=e}
1finally{try{if(!s&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw i}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return dt(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?dt(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function dt(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}const mt={1:"Get Started",2:"Personal Details",3:"Security",4:"Verification",5:"Communication"},yt={Start:"1",TermsAndConditions:"1",PersonalDetailsForm:"2",EmailAndPhoneForm:"2",SecurityQuestionsForm:"3",UpdateInformationForm:"3",MagicLinkContent:"4",MagicLinkResend:"4",MobileVerificationForm:"4",CommunicationPreferences:"5",MarketingPreferences:"5",Success:"5"},ft=()=>{g.Q.setKeyValueStorage(v.sZ);const e=(0,f.Md)().showBoundary,t=(0,n.zy)(),r=(0,ve.A)(),o=r.passwordlessRegister,l=r.validateDetails,s=r.validateSecurityQuestions,u=r.passwordlessRegistrationUpdateDetails,m=r.acceptTerms,y=r.passwordlessCompleteRegistration,p=r.passwordlessAuthenticate,w=r.passwordlessRequestLoginOtp,k=r.setUserShouldLogIn,C=ut((0,i.useState)("1"),2),O=C[0],E=C[1],P=ut((0,i.useState)("Start"),2),D=P[0],I=P[1],M=ut((0,i.useState)([]),2),T=M[0],F=M[1],q=ut((0,i.useState)(""),2),Y=q[0],U=q[1],B=ut((0,i.useState)(),2),_=B[0],z=B[1],G=ut((0,i.useState)(""),2),W=G[0],K=G[1],Z=ut((0,i.useState)(""),2),Q=Z[0],J=Z[1],te=ut((0,i.useState)(""),2),ne=te[0],ie=te[1],oe=ut((0,i.useState)(""),2),ae=oe[0],le=oe[1],ce=ut((0,i.useState)("none"),2),ue=ce[0],de=ce[1],ye=ut((0,i.useState)({}),2),fe=ye[0],pe=ye[1],he=(0,c.dj)().toast,be=(0,i.useRef)(!1),xe=(0,i.useRef)(new BroadcastChannel("login-token")),je=b.Ik({emailAddress:A.A.EmailAddress,mobileNumber:A.A.MobilePhone.optional(),memberNumber:A.A.MemberNumber,dateOfBirth:A.A.DateOfBirth,niNumber:A.A.NationalInsurance.transform(e=>e.replace(/-/g,"")),agreements:A.A.Agreements}),we=ut((0,S.gpM)(),1)[0],ke=(0,S.P2n)({fetchPolicy:"cache-and-network",nextFetchPolicy:"cache-first"}),Se=ke.data,Ce=ke.loading,Oe=ke.error,Ee=async t=>{const r=new Error("Something went wrong");if(t instanceof x.K4){const n=(0,re.u$)(t),i=n.message,o=n.key,a=n.code;if("LOCKED_ACCOUNT"===o)return e(new H.y("Something went wrong.",i)),{validDetails:!1};"CONTACT_DETAILS"===o?Pe("SecurityQuestionsForm"):"PERSONAL_DETAILS"===o?(le(i),Pe("PersonalDetailsForm")):"JUNIOR_ACCOUNT"===o?e(new H.y(i)):"EXISTING_EMAIL"===o?e(new H.y(i,"Alternatively, you can try registering again with another email address. Having a problem?")):"TOKEN_EXPIRED"===a?le("".concat(i," Please request a new verification email using the link below and try again.")):e("CONTACT_CU"===o||"BAD_USER_INPUT"===a?new H.y(i):r)}else if(t instanceof j.l){"NotAuthorizedException"===t.name?le("Your session has expired. Please use the latest email you have from us or use the link below to request a new verification email and try again."):e(r)}else e(r)},Ne=(0,i.useCallback)(async(e,t,r,n,i,o)=>{try{return await l({email:n,memberNumber:e,mobileNumber:o,dateOfBirth:r.format("YYYY-MM-DD"),niNumber:t}),await m({memberNumber:e,userAgreements:i}),{validDetails:!0}}catch(a){Ee(a)}},[m,e,l]);window.onbeforeunload=async function(){await v.sZ.clear(),await(0,at.ri)()},(0,i.useEffect)(()=>{if(t.state&&"joining"!==ue||"joined"!==ue){const r=t.state;(async()=>{if(r){const n=r,i=n.stepNumber,a=n.member,l=n.userEmail,s=n.userDob,c=n.userMobileNumber,u=n.userNiNumber,d=n.userAgreements;if(de("joining"),3===i){if(je.safeParse({emailAddress:l,mobileNumber:c,memberNumber:a,dateOfBirth:s,niNumber:u,agreements:d}).success){const e=h()(s,"DD-MM-YYYY");U(a),J(l),z(e),ie(c),K(u),F(d),await Ne(a,u,e,l,d,c);try{const e=await o({memberNumber:a,email:l,mobileNumber:c});if(!e||!e.success)throw new Error;Pe("MagicLinkContent"),de("joined")}catch(t){de("joined"),Ee(t)}}else e(new H.y("Sorry, unable to continue registration."))}}})()}},[t.state]);const Pe=e=>{const t=Object.entries(yt).find(t=>ut(t,1)[0]===e)[1];E(t),I(e)},De=e=>{F(e),Pe("PersonalDetailsForm")},Ie=(e,t,r)=>{U(e),K(t),z(r),le(""),Pe("EmailAndPhoneForm")},Le=async(e,t)=>{J(e),ie(t);try{const r=await Ne(Y,W.replace(/-/g,""),_,e,T,t);if(r&&r.validDetails){const r=await o({memberNumber:Y,email:e,mobileNumber:t});r&&r.success&&Pe("MagicLinkContent")}}catch(r){Ee(r)}},Re=(0,i.useCallback)(async e=>{if(le(""),"TOKEN_RECEIVED"===e.data.type&&!be.current)try{var t;const r=await we({variables:{emailAddress:Q,token:e.data.token},fetchPolicy:"no-cache"}),n=r.data,i=r.error;if(i)throw i;n&&null!==(t=n.getAuthCode)&&void 0!==t&&t.code&&await Me(n.getAuthCode.code)}catch(r){Ee(r)}},[we,Q]);(0,i.useEffect)(()=>
1{if("MagicLinkContent"===D){const e=null===xe||void 0===xe?void 0:xe.current;return null!==e&&void 0!==e&&e.onmessage||(e.onmessage=Re),()=>{be.current&&!(null===e||void 0===e||!e.onmessage)&&e.close()}}},[D]);const Me=async e=>{try{(await p({otpCode:e})).success?(await u({email:Q}),be.current=!0,ne?(await tt(),Pe("MobileVerificationForm")):Pe("CommunicationPreferences")):le("Something went wrong. Please use the link from the latest verification email or request a new one and try again")}catch(t){Ee(t)}},Te=async e=>{await rt({smsCode:e}),await u({email:Q,mobileNumber:ne}),Pe("CommunicationPreferences")},Fe=async()=>{ne&&tt()},qe=e=>{pe(e),Pe("MarketingPreferences")},Ve=async e=>{const t=st(st({},fe),e);await y({communicationPreferences:t,email:Q}),Pe("Success")},Ye=async e=>{try{const t=await s(st({memberNumber:Y},e));t.validateSecurityQuestions.success&&(await m({memberNumber:Y,userAgreements:T}),Pe("UpdateInformationForm"))}catch(t){Ee(t)}},Ue=async(e,t)=>{J(e),ie(t);try{const r=await o({memberNumber:Y,email:e,mobileNumber:t});if(!r||!r.success)throw new Error("");Pe("MagicLinkContent")}catch(r){Ee(r)}},Be=async()=>{try{await w({emailAddress:Q}),le(""),he({variant:"success",title:"Verification Sent",description:"A new email has been sent to ".concat(Q,".")}),I("MagicLinkContent")}catch(e){he({variant:"destructive",title:"Verification Sending Failed",description:"Something has gone wrong, please try again."})}};if(Ce)return(0,d.jsx)(c.kt,{});if(Oe)return(0,d.jsx)(a.A,{message:void 0,title:void 0});const _e=Se.getCreditUnion,ze=_e.contactEmail,$e=_e.websiteUrl;if("Success"===D)return(0,d.jsx)(R,{onNavigate:()=>{window.onbeforeunload=null,k(!0)}});const Ge=Object.entries(mt).findIndex(e=>ut(e,1)[0]===O),He=Object.entries(mt).map(e=>{let t=ut(e,2),r=t[0];return{title:t[1],step:r}});return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(c.Jc,{currentStep:Ge,steps:He}),(0,d.jsx)("div",{className:"flex flex-1 flex-col p-12 bg-background",children:"joining"===ue?(0,d.jsx)(c.kt,{}):(0,d.jsx)(i.Suspense,{fallback:(0,d.jsx)(c.kt,{}),children:(()=>{switch(D){case"Start":default:return(0,d.jsx)(L,{onContinue:()=>Pe("TermsAndConditions")});case"TermsAndConditions":return(0,d.jsx)(N,{onContinue:De,onBack:()=>{Pe("Start")},inputFields:{agreements:T}});case"PersonalDetailsForm":return(0,d.jsx)(V,{onBack:()=>{Pe("TermsAndConditions")},onContinue:Ie,inputFields:{memberNumber:Y,niNumber:W,dateOfBirth:_},errorMessage:ae});case"EmailAndPhoneForm":return(0,d.jsx)($,{onBack:()=>{Pe("PersonalDetailsForm")},onContinue:Le,inputFields:{emailAddress:Q,mobileNumber:ne}});case"MagicLinkContent":return(0,d.jsx)(ee,{emailAddress:Q,websiteUrl:$e,onResendClick:async()=>Pe("MagicLinkResend"),errorMessage:ae});case"MagicLinkResend":return(0,d.jsx)(ot,{emailAddress:Q,contactEmail:ze,websiteUrl:$e,onResendMagicLink:Be,onBack:()=>Pe("MagicLinkContent")});case"UpdateInformationForm":return(0,d.jsx)(Ae,{onContinue:Ue,inputFields:{emailAddress:Q,mobileNumber:ne}});case"MobileVerificationForm":return(0,d.jsx)(se,{onContinue:Te,onResendClick:Fe,mobileNumber:{value:ne,obsecure:!1}});case"SecurityQuestionsForm":return(0,d.jsx)(X,{onContinue:Ye,inputFields:{memberNumber:Y}});case"CommunicationPreferences":return(0,d.jsx)(me,{onContinue:qe});case"MarketingPreferences":return(0,d.jsx)(ge,{onContinue:Ve,onBack:()=>Pe("CommunicationPreferences")})}})()})})]})},pt=()=>(0,d.jsx)(f.tH,{fallbackRender:e=>{let t=e.error,r="We couldn\u2019t complete your account setup",n="There has been an issue registering your account for online access.";return t instanceof H.y&&(t.message&&(r=t.message),t.description&&(n=t.description)),(0,d.jsx)(Ce.A,{title:r,heading:n})},children:(0,d.jsx)(ft,{})});var ht=r(7104),bt=r(5127);const gt=e=>{let t=e.onClick,r=e.setFieldValue;const i=(0,n.Zp)();return(0,d.jsxs)("div",{className:"qualification-triage-container",children:[(0,d.jsx)(c.DZ,{as:"h3",color:"#363636",fontWeight:0,textAlign:"center",children:"Apply for Membership"}),(0,d.jsxs)("div",{children:[(0,d.jsx)(c.zz,{className:"sub-heading",textAlign:"center",mb:4,mt:2,fontSize:4,children:"To qualify for membership, you must:"}),(0,d.jsxs)(c.xA,{mt:2,className:"qualification-grid",mb:2,gridTemplateColumns:["40px 1fr","40px 1fr"],gridGap:"5px",children:[(0,d.jsx)("div",{className:"join-icon-container",children:(0,d.jsx)(bt.g,{icon:"check",color:"#3b8634",size:"lg"})}),(0,d.jsx)(c.zz,{fontSize:2,mt:0,mb:0,children:"Be aged 16 years or over and live or work in the West of Scotland or work for one of our Employer Partners"}),(0,d.jsx)("div",{className:"join-icon-container",children:(0,d.jsx)(bt.g,{icon:"check",color:"#3b8634",size:"lg"})}),(0,d.jsx)(c.zz,{fontSize:2,mt:0,mb:0,children:"Have the right to permanently remain in the UK"}),(0,d.jsx)("div",{className:"join-icon-container",children:(0,d.jsx)(bt.g,{icon:"check",color:"#3b8634",size:"lg"})}),(0,d.jsx)(c.zz,{fontSize:2,mt:0,mb:0,children:"Be a tax resident in the UK, not be a tax resident of another country or be classed as non-domiciled."})]}),(0,d.jsx)(c.zz,{className:"sub-heading",textAlign:"center",mb:4,mt:4,fontSize:4,children:"To proceed with the application, you\u2019ll need:"}),(0,d.jsxs)(c.xA,{mt:2,className:"qualification-grid",mb:2,gridTemplateColumns:["40px 1fr","40px 1fr"],gridGap:"5px",children:[(0,d.jsx)("div",{className:"join-icon-container",children:(0,d.jsx)(bt.g,{icon:"check",color:"#3b8634",size:"lg"})}),(0,d.jsx)(c.zz,{fontSize:2,mt:0,mb:0,children:"Your personal details including home address"}),(0,d.jsx)("div",{className:"join-icon-container",children:(0,d.jsx)(bt.g,{icon:"check",color:"#3b8634",size:"lg"})})," ",(0,d.jsx)(c.zz,{fontSize:2,mt:0,mb:0,children:"Your National Insurance Number"}),(0,d.jsx)("div",{className:"join-icon-container",children:(0,d.jsx)(bt.g,{icon:"check",color:"#3b8634",size:"lg"})})," ",(0,d.jsx)(c.zz,{fontSize:2,mt:0,mb:0,children:"Your work address and postcode"}),(0,d.jsx)("div",{className:"join-icon-container",children:(0,d.jsx)(bt.g,{icon:"check",color:"#3b8634",size:"lg"})})," ",(0,d.jsx)(c.zz,{fontSize:2,mt:0,mb:0,children:"The bank account details you want to link to your account"})]}),(0,d.jsx)(c.az,{mb:2,mt:4,borderRadius:2,children:(0,d.jsx)(c.zz,{fontSize:2,mt:0,mb:0,children:"By
1selecting Agree and Proceed you confirm that you qualify for membership as stated above and declare, to the best of your knowledge, these statements are correct."})})]}),(0,d.jsxs)("div",{className:"triage-button-container",children:[(0,d.jsx)(c.Y0,{className:"secondary",secondary:!0,onClick:()=>i("/"),text:"I'm already a member",bg:c.w4.colors.white,flex:1}),(0,d.jsx)(c.Y0,{primary:!0,onClick:()=>{r("qualificationAgreement",!0),t()},text:"Agree and Proceed",bg:c.w4.colors.primary,flex:2,ml:3})]})]})};function vt(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function xt(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?vt(Object(r),!0).forEach(function(t){jt(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):vt(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function jt(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function wt(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,a,l=[],s=!0,c=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=o.call(r)).done)&&(l.push(n.value),l.length!==t);s=!0);}catch(e){c=!0,i=e}finally{try{if(!s&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw i}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return kt(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?kt(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function kt(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}const St=e=>{let t=e.termsAndConditionsUrls,r=e.onClick,n=e.backStep,o=e.setFieldValue,a=e.isJoinAndBorrow;const l=wt((0,i.useState)(0),2),s=l[0],u=l[1],m=wt((0,i.useState)({}),2),y=m[0],f=m[1],p=wt((0,i.useState)(""),2),h=p[0],b=p[1];let g=null===t||void 0===t?void 0:t.filter(e=>e.processKeys.includes(re.x6.JOIN));return a&&(g=g.concat(null===t||void 0===t?void 0:t.filter(e=>e.processKeys.includes(re.x6.BORROW)))),(0,d.jsxs)(c.so,{py:4,width:["100%",null,null,"70%"],m:[null,null,null,"0 auto"],height:"100%",flexDirection:"column",justifyContent:"center",children:[(0,d.jsx)(c.DZ,{as:"h3",color:c.w4.colors.nearBlack,fontWeight:0,textAlign:"center",children:"Terms and Conditions"}),(0,d.jsx)(c.az,{children:(0,d.jsx)(c.so,{justifyContent:"center",alignItems:"center",children:(0,d.jsx)(c.In,{my:4,icon:"cog-hand",width:["100px",null,null,"150px"],height:["100px",null,null,"150px"],size:"50px",bg:"#f7f7f7",background:!0})})}),(0,d.jsxs)(c.az,{border:"1px solid ".concat(c.w4.colors.mediumGrey),p:3,borderRadius:2,children:[(0,d.jsx)(c.DZ,{as:"h5",fontWeight:0,color:c.w4.colors.nearBlack,fontSize:2,children:"You must agree to the following terms & conditions"}),(0,d.jsx)(c.so,{flexDirection:"column",my:3,children:g.map(e=>{var t;return(0,d.jsxs)(c.ph,{my:2,children:[(0,d.jsx)("input",{type:"checkbox",checked:(null===(t=y[e.key])||void 0===t?void 0:t.value)||!1,onChange:t=>((e,t)=>{f(xt(xt({},y),{},{[e.key]:xt({value:t},e)})),u(t?s+1:s-1)})(e,t.target.checked),mr:2},e.key),(0,d.jsx)(c.zz,{as:"span",m:"0",ml:2,fontSize:1,children:e.url&&(0,d.jsxs)(d.Fragment,{children:["I have read and agreed to the following:",(0,d.jsx)(c.a9,{ml:1,href:e.url,target:"_blank",rel:"noopener noreferrer",fontSize:1,textDcoration:"none",color:c.w4.colors.primary,children:e.title})]})})]},e.key)})})]}
1),(0,d.jsxs)(c.so,{my:[4,4,4,null],mt:[null,null,"20px auto 0"],children:[(0,d.jsx)(c.Y0,{secondary:!0,text:"Back",onClick:n,flex:"1",bg:c.w4.colors.white}),(0,d.jsx)(c.Y0,{primary:!0,onClick:()=>{g.length!==s?b("You must agree to all terms & conditions to proceed"):(o("userAgreements",y),r())},text:"Agree and Proceed",bg:c.w4.colors.primary,flex:"2",ml:3})]}),h&&(0,d.jsx)(c.zz,{my:3,color:"red",fontSize:[1,2],children:h})]})};var At=r(5721);function Ct(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function Ot(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Ct(Object(r),!0).forEach(function(t){Et(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ct(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function Et(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Nt=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:2;if(Number.isNaN(Number(e))||!e)return"\xa30.00";const n=e<0?"-":"";let i=null;if("pounds"===t)i=e.toFixed(r);else i=(e/100).toFixed(r);const o=i.toString().replace("-","").replace(/\B(?=(\d{3})+(?!\d))/g,",");return"".concat(n,"\xa3").concat(o)},Pt=e=>{const t=e.sections,r={};let n=1;return t.sort((e,t)=>e.sectionNumber>t.sectionNumber?1:-1),t.forEach(e=>{const t=e.steps;t.sort((e,t)=>e.stepNumber>t.stepNumber?1:-1),t.forEach(t=>{r[t.key]=Ot(Ot({},t),{},{sectionKey:e.key,sectionTitle:e.title,navigationOptions:{title:e.title,inStack:"previous"===t.backButtonMode},navigationOrder:n}),n+=1})}),r},Dt=(e,t)=>{const r=e.parentKey,n=e.key,i=e.requiresField,o=r?t[r]:null;return{fieldParent:o,fieldValue:o?o[n]:t[n],requiredFieldValue:i?t[i.fieldKey]:null}},It=e=>{var t;if(null==e)return!1;const r=(0,At.l)(e,"GB");return void 0!==r&&(null!==(t=(null===r||void 0===r?void 0:r.isValid())&&"MOBILE"===r.getType())&&void 0!==t&&t)},Lt=e=>{var t;if(null==e)return!1;const r=(0,At.l)(e,"GB");return void 0!==r&&(null!==(t=null===r||void 0===r?void 0:r.isValid())&&void 0!==t&&t)},Rt=e=>{if(!e)return!1;return new RegExp("^[a-zA-Z0-9.!#$%&\u2019*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:.[a-zA-Z0-9-]+)*$").test(e)},Mt=e=>{if(!e)return!1;return new RegExp("[a-zA-Z]{2}[0-9]{6}[A-Za-z]{1}").test(e)},Tt=(e,t)=>{const r=Dt(e,t).requiredFieldValue,n=e.requiresField;if(n){const e=Array.isArray(n.fieldValue);if(!e&&r!==n.fieldValue)return!1;if(e&&n.fieldValue.length>=1){if(!n.fieldValue.find(e=>e===r))return!1}}return!0},Ft=(e,t)=>{const r=e.fields,n=e.dynamicFields;if(n){const e=n.dynamicSetKey;return n.fieldSets[t[e]]}return r},qt={formId:1,name:"Join & Save Form",sections:[{title:"Personal Details",key:"PersonalDetailsSection",description:null,sectionNumber:1,steps:[{id:0,stepNumber:1,stepDescription:"About You",key:"AboutYou",fields:[{id:0,label:"Title",placeholder:"Select a title",key:"title",type:"select",isRequired:!0,options:[{id:0,label:"Mr",value:"MR"},{id:1,label:"Mrs",value:"MRS"},{id:2,label:"Miss",value:"MISS"},{id:3,label:"Ms",value:"MS"},{id:4,label:"Mx",value:"MX"},{id:5,label:"Sir",value:"SIR"},{id:6,label:"Dr",value:"DR"},{id:7,label:"Lady",value:"LADY"},{id:8,label:"Lord",value:"LORD"}]},{id:1,label:"Forename",placeholder:"Enter your forename",key:"firstName",type:"textfield",isRequired:!0,maxLength:30,minLength:1},{id:2,label:"Surname",placeholder:"Enter your surname",key:"lastName",type:"textfield",isRequired:!0,maxLength:30,minLength:1},{id:3,label:"Date of Birth",placeholder:"DD/MM/YYYY",key:"dateOfBirth",type:"textDate",isRequired:!0},{id:4,label:"National Insurance Number",placeholder:"Enter your NI number",key:"nationalInsuranceNumber",type:"niNumber",isRequired:!0},{id:5,label:"Email",placeholder:"Enter your email address",key:"emailAddress",type:"email",maxLength:50,isRequired:["members"],externalValidationKey:"emailAddress"},{id:6,label:"Home Phone Number",type:"phoneNumber",key:"phoneNumber",placeholder:"Enter your home phone number",maxLength:13,minLength:11},{id:7,label:"Mobile Number",type:"mobileNumber",key:"mobileNumber",placeholder:"Enter your mobile number",externalValidationKey:"mobileNumber",maxLength:13},{id:8,label:"Where did you hear about us?",type:"select",placeholder:"Enter where you heard about us",key:"survey",scrollable:!0,isRequired:!0,options:[{id:0,label:"TV Advert",value:"TV Advert"},{id:1,label:"Workplace Visit",value:"Workplace Visit"},{id:2,label:"Social Media",value:"Social Media"},{id:3,label:"Search Engine",value:"Search Engine"},{id:4,label:"Online Advert",value:"Online Advert"},{id:5,label:"Email",value:"Email"},{id:6,label:"Radio",value:"Radio"},{id:7,label:"Word of Mouth",value:"Word of Mouth"},{id:8,label:"Other:",value:"Other"}]},{id:9,placeholder:"Enter where you heard about us",type:"textfield",key:"otherSurvey",requiresField:{fieldKey:"survey",fieldValue:["Other"]},isRequired:!0}]}
1,{id:1,stepNumber:2,key:"HomeAddressDetails",stepDescription:"Address Details",stepInstructions:"Please provide your current address.",fields:[{id:0,type:"addressHistory",key:"homeAddressHistory",parentKey:"homeAddresses",isRequired:!0,requiredAddressMonths:1,requiredAddressCount:1,subFields:[{id:0,label:"Flat",placeholder:"Enter flat number",type:"textfield",key:"flat",maxLength:20,minLength:1},{id:1,label:"House Name",placeholder:"Enter house name",type:"textfield",key:"houseName",maxLength:50,minLength:1},{id:2,label:"House Number",placeholder:"Enter house number",type:"textfield",key:"houseNumber",maxLength:6,minLength:1},{id:3,label:"Address Line 1",placeholder:"Enter house number and street name",type:"textfield",key:"addressLine1",isRequired:!0,maxLength:50,minLength:1},{id:4,label:"Address Line 2",placeholder:"Enter address line 2",type:"textfield",key:"addressLine2",maxLength:50,minLength:1},{id:5,label:"Town/City",placeholder:"Enter your town/city",type:"textfield",key:"townCity",isRequired:!0,maxLength:50,minLength:1},{id:6,label:"Postcode",placeholder:"Enter your postcode",key:"postcode",type:"textfield",maxLength:8,minLength:5,isRequired:!0},{id:7,label:"Residential Status",placeholder:"What is your residential status?",key:"residentialStatus",type:"select",isRequired:!0,options:[{id:0,label:"Homeowner",value:"homeowner"},{id:1,label:"Private Tenant",value:"privateTenant"},{id:2,label:"Living with Family",value:"livingWithFamily"},{id:3,label:"Council/HA Tenant",value:"rentingFromPublicBody"}]},{id:8,label:"How long have you lived at this address?",placeholder:"When did you move in?",key:"timeAtAddress",type:"monthYearSelect",isRequired:!0,residentFrom:"residentFrom",residentTo:"residentTo"}]}]}]},{title:"Employer Details",key:"EmployerDetailsSection",description:null,sectionNumber:2,steps:[{id:0,stepNumber:1,key:"EmploymentDetails",stepDescription:"Employment Details",isRequiredByStep:{requiredFieldKey:"contributionMethod",fieldKeyToValidate:"employmentStatus",valueToSetIfNotValid:"DirectDebit",requiredValues:["FULL_TIME_EMPLOYED","PART_TIME_EMPLOYED","SELF_EMPLOYED","TEMP_CONTRACT"]},fields:[{id:0,label:"Employment Status",placeholder:"Select your employment status",key:"employmentStatus",type:"select",scrollable:!0,isRequired:!0,options:[{id:0,label:"Full time employed",value:"FULL_TIME_EMPLOYED"},{id:1,label:"Part time employed",value:"PART_TIME_EMPLOYED"},{id:2,label:"Self employed",value:"SELF_EMPLOYED"},{id:3,label:"Temp or contract work",value:"TEMP_CONTRACT"},{id:5,label:"Retired",value:"RETIRED"},{id:6,label:"Benefits",value:"BENEFITS"},{id:7,label:"Student",value:"STUDENT"}]},{id:1,label:"Occupation",placeholder:"Enter your occupation",type:"textfield",key:"occupation",requiresField:{fieldKey:"employmentStatus",fieldValue:["FULL_TIME_EMPLOYED","PART_TIME_EMPLOYED","SELF_EMPLOYED","TEMP_CONTRACT"]},isRequired:!0,maxLength:16,minLength:2},{id:2,label:"Employment Start Date",placeholder:"Enter your Start Date",type:"textDate",key:"employmentStart",requiresField:{fieldKey:"employmentStatus",fieldValue:["FULL_TIME_EMPLOYED","PART_TIME_EMPLOYED","SELF_EMPLOYED","TEMP_CONTRACT"]},isRequired:!0},{id:3,label:"Contract End Date",placeholder:"Enter the End Date of your contract",type:"textDate",noMaxDateRequired:!0,key:"employmentContractEnd",requiresField:{fieldKey:"employmentStatus",fieldValue:["TEMP_CONTRACT"]},isRequired:!0},{id:4,label:"Organisation",placeholder:"Enter your Employer's name",type:"textfield",key:"employer",isRequired:!0,includedInReadOnlyAddress:!0,requiresField:{fieldKey:"employmentStatus",fieldValue:["FULL_TIME_EMPLOYED","PART_TIME_EMPLOYED","SELF_EMPLOYED","TEMP_CONTRACT"]},maxLength:15,minLength:2},{id:5,label:"Employment Category",placeholder:"Select an option",key:"employmentCategory",type:"employmentCategorySelect",isRequired:!0,scrollable:!0,requiresField:{fieldKey:"employmentStatus",fieldValue:["FULL_TIME_EMPLOYED","PART_TIME_EMPLOYED","SELF_EMPLOYED","TEMP_CONTRACT"]}},{id:6,label:"Phone Number",placeholder:"Enter your Employer's Phone Number",key:"employerPhoneNumber",type:"phoneNumber",isRequired:!0,requiresField:{fieldKey:"employmentStatus",fieldValue:["FULL_TIME_EMPLOYED","PART_TIME_EMPLOYED","SELF_EMPLOYED","TEMP_CONTRACT"]},maxLength:50,minLength:1},{id:7,type:"employerHistory",key:"employerHistory",parentKey:"employerAddress",placeholder:"Enter your Employer's postcode",requiresField:{fieldKey:"employmentStatus",fieldValue:["FULL_TIME_EMPLOYED","PART_TIME_EMPLOYED","SELF_EMPLOYED","TEMP_CONTRACT"]},isRequired:!0,subFields:[{id:0,label:"Flat",placeholder:"Enter your Employer's flat number",type:"textfield",key:"flat",includedInReadOnlyAddress:!0,maxLength:20,minLength:1},{id:1,label:"House Name",placeholder:"Enter your Employer's house name",type:"textfield",key:"house
1Name",includedInReadOnlyAddress:!0,maxLength:50,minLength:1},{id:2,label:"House Number",placeholder:"Enter your Employer's house number",type:"textfield",key:"houseNumber",includedInReadOnlyAddress:!0,maxLength:6,minLength:1},{id:3,label:"Address Line 1",placeholder:"Enter your Employer's street name",type:"textfield",key:"addressLine1",isRequired:!0,includedInReadOnlyAddress:!0,maxLength:50,minLength:1},{id:4,label:"Address Line 2",placeholder:"Enter your Employer's address line 2",type:"textfield",key:"addressLine2",includedInReadOnlyAddress:!0,maxLength:50,minLength:1},{id:5,label:"Town/City",placeholder:"Enter your Employer's town/city",type:"textfield",key:"townCity",isRequired:!0,includedInReadOnlyAddress:!0,maxLength:50,minLength:1},{id:6,label:"Postcode",placeholder:"Enter your Employer's postcode",key:"postcode",type:"textfield",maxLength:8,minLength:5,isRequired:!0,includedInReadOnlyAddress:!0}]}]}]},{title:"Contributions",key:"ContributionSection",description:null,sectionNumber:3,steps:[{id:0,stepNumber:1,stepDescription:"Contributions",stepInstructions:"Glasgow Credit Union accounts are regular savings products.",description:"You can save monthly by Direct Debit or, if you work for one of our employer partners, directly from your salary.",key:"ContributionMethod",backButtonMode:"previous",fields:[{id:0,label:"Contribution Method",placeholder:"Select an option",key:"contributionMethod",type:"select",isRequired:!0,options:[{id:0,label:"Salary Deduction",value:"Payroll"},{id:1,label:"Direct Debit",value:"DirectDebit"}]}]},{id:1,stepNumber:2,stepDescription:"Contribution information",stepInstructions:"Glasgow Credit Union accounts are regular savings products.",description:"You can save monthly either by direct debit or if you work for one of our employer partners direct from your salary.",backButtonMode:"previous",key:"ContributionDetails",dynamicFields:{dynamicSetKey:"contributionMethod",fieldSets:{Payroll:[{id:0,label:"Contribution Amount",placeholder:"Enter amount",type:"currency",key:"contributionAmount",isRequired:!0,maxLength:7,minLength:1},{id:1,label:"Employee payroll number",placeholder:"Enter your payroll number",type:"textfield",key:"payrollNumber",isRequired:!0,minLength:1},{id:2,label:"Employer",placeholder:"Select an option",key:"payrollEmployer",type:"payrollSelect",isRequired:!0,scrollable:!0}],DirectDebit:[{id:0,type:"directDebit",key:"directDebit",subFields:[{id:0,label:"Savings Contribution Amount",placeholder:"Enter amount",type:"currency",key:"contributionAmount",isRequired:!0,maxLength:7,minLength:1},{id:1,label:"Name Of Your Bank",placeholder:"Enter your bank account providers name",type:"textfield",key:"accountBankName",isRequired:!0,minLength:1},{id:2,label:"Account Holder's Name",placeholder:"Enter account holders name",type:"textfield",key:"accountHolderName",isRequired:!0,minLength:1},{id:3,label:"Bank Account Number",placeholder:"Enter your account number",type:"numeric",key:"accountNumber",isRequired:!0,externalValidationKey:"accountNumber",minLength:1,maxLength:8},{id:4,label:"Bank Sort Code",placeholder:"Enter your sort code",type:"sortCode",key:"sortCode",isRequired:!0,externalValidationKey:"sortCode",minLength:1,maxLength:6},{id:5,label:"Preferred Direct Debit Collection Date",placeholder:"Select a date",key:"directDebitDate",type:"select",isRequired:!0,options:[{id:0,label:"Every 1st of the month",value:1},{id:1,label:"Every 7th of the month",value:7},{id:2,label:"Every 14th of the month",value:14},{id:3,label:"Every 21st of the month",value:21},{id:4,label:"Every 28th of the month",value:28}]}]}]}}},{id:2,stepNumber:3,stepDescription:"Bank details",backButtonMode:"previous",allRequired:!0,partialCompleteError:'Please fill in all of the fields to continue. If you do not wish to add another bank account, please remove your information from the fields and click "next"',key:"BankDetails",dynamicFields:{dynamicSetKey:"contributionMethod",stepInformation:{Payroll:"Please enter the details of the bank account you would like to withdraw savings to.",DirectDebit:'To add another bank account for withdrawals, please provide your account information below. Alternatively you can skip this
1step by clicking "next"'},fieldSets:{Payroll:[{id:0,label:"Bank",placeholder:"Enter your bank account providers name",type:"textfield",key:"accountBankName",isRequired:!0,minLength:1},{id:1,label:"Account Holders Name",placeholder:"Enter account holders name",type:"textfield",key:"accountHolderName",isRequired:!0,minLength:1},{id:2,label:"Account Number",placeholder:"Enter your account number",type:"numeric",key:"accountNumber",isRequired:!0,externalValidationKey:"accountNumber",minLength:1,maxLength:8},{id:3,label:"Sort Code",placeholder:"Enter your sort code",type:"sortCode",key:"sortCode",isRequired:!0,externalValidationKey:"sortCode",minLength:1,maxLength:6},{id:4,label:"I confirm I am the account holder for the above bank account",key:"shareBankAccountAttestationPayroll",type:"checkbox",isRequired:!0}],DirectDebit:[{id:0,label:"Bank",placeholder:"Enter your bank account providers name",type:"textfield",isRequired:!1,key:"accountBankName2",minLength:1},{id:1,label:"Account Holders Name",placeholder:"Enter account holders name",type:"textfield",isRequired:!1,key:"accountHolderName2",minLength:1},{id:2,label:"Account Number",placeholder:"Enter your account number",type:"numeric",isRequired:!1,key:"accountNumber2",externalValidationKey:"accountNumber",minLength:1,maxLength:8},{id:3,label:"Sort Code",placeholder:"Enter your sort code",type:"sortCode",key:"sortCode2",externalValidationKey:"sortCode",isRequired:!1,minLength:1,maxLength:6},{id:4,label:"I confirm I am the account holder for the above bank account",key:"shareBankAccountAttestationDD",type:"checkbox",isRequired:!1}]}}}]}]},Vt={formId:1,name:"Join & Borrow Form",sections:[{title:"Personal Details",key:"PersonalDetailsSection",description:null,sectionNumber:1,steps:[{id:0,stepNumber:1,stepDescription:"About You",key:"AboutYou",fields:[{id:0,label:"Title",placeholder:"Select a title",key:"title",type:"select",isRequired:!0,options:[{id:0,label:"Mr",value:"MR"},{id:1,label:"Mrs",value:"MRS"},{id:2,label:"Miss",value:"MISS"},{id:3,label:"Ms",value:"MS"},{id:4,label:"Mx",value:"MX"},{id:5,label:"Sir",value:"SIR"},{id:6,label:"Dr",value:"DR"},{id:7,label:"Lady",value:"LADY"},{id:8,label:"Lord",value:"LORD"}]},{id:1,label:"Forename",placeholder:"Enter your forename",key:"firstName",type:"textfield",isRequired:!0,maxLength:30,minLength:1},{id:2,label:"Surname",placeholder:"Enter your surname",key:"lastName",type:"textfield",isRequired:!0,maxLength:30,minLength:1},{id:3,label:"Date of Birth",placeholder:"DD/MM/YYYY",key:"dateOfBirth",type:"textDate",isRequired:!0},{id:4,label:"National Insurance Number",placeholder:"Enter your NI number",key:"nationalInsuranceNumber",type:"niNumber",isRequired:!0},{id:5,label:"Email",placeholder:"Enter your email address",key:"emailAddress",type:"email",maxLength:50,isRequired:!0,externalValidationKey:"emailAddress"},{id:6,label:"Home Phone Number",type:"phoneNumber",key:"phoneNumber",placeholder:"Enter your home phone number",maxLength:13,minLength:11},{id:7,label:"Mobile Number",type:"mobileNumber",key:"mobileNumber",placeholder:"Enter your mobile number",externalValidationKey:"mobileNumber",maxLength:13},{id:8,label:"Relationship Status",type:"select",key:"relationshipStatus",placeholder:"Enter your relationship status",isRequired:!0,options:[{id:0,label:"Single",value:"SINGLE"},{id:1,label:"Married/Civil Partnership",value:"MARRIED_CIVIL"},{id:2,label:"Divorced",value:"DIVORCED"},{id:3,label:"Widowed",value:"WIDOWED"},{id:4,label:"Living with Partner",value:"LIVING_WITH_PARTNER"}]},{id:9,label:"Number of Dependants",placeholder:"How many dependants in your household?",key:"numberOfDependants",type:"select",isRequired:!0,options:[{id:0,label:"None",value:"
10"},{id:1,label:"1",value:"1"},{id:2,label:"2",value:"2"},{id:3,label:"3",value:"3"},{id:4,label:"4",value:"4"},{id:5,label:"5",value:"5"},{id:6,label:"6",value:"6"},{id:7,label:"7",value:"7"},{id:8,label:"8",value:"8"},{id:9,label:"9+",value:"9+"}]},{id:10,label:"Where did you hear about us?",type:"select",key:"survey",placeholder:"Enter where you heard about us",scrollable:!0,isRequired:!0,options:[{id:0,label:"TV Advert",value:"TV Advert"},{id:1,label:"Workplace Visit",value:"Workplace Visit"},{id:2,label:"Social Media",value:"Social Media"},{id:3,label:"Search Engine",value:"Search Engine"},{id:4,label:"Online Advert",value:"Online Advert"},{id:5,label:"Email",value:"Email"},{id:6,label:"Radio",value:"Radio"},{id:7,label:"Word of Mouth",value:"Word of Mouth"},{id:8,label:"Other",value:"Other"}]},{id:11,displayFieldForParent:["advisors"],placeholder:"We will send all correspondence relating to this loan electronically",label:"I wish to also receive my loan correspondence by post",key:"sendDocumentsByPost",type:"checkbox",isRequired:!1}]},{id:1,stepNumber:2,key:"HomeAddressDetails",stepDescription:"Address Details",stepInstructions:"Please provide your current address.",backButtonMode:"previous",fields:[{id:0,type:"addressHistory",key:"homeAddressHistory",parentKey:"homeAddresses",isRequired:!0,requiredAddressMonths:36,requiredAddressCount:5,readOnly:!0,subFields:[{id:0,label:"Flat",placeholder:"Enter flat number",type:"textfield",key:"flat",maxLength:20,minLength:1},{id:1,label:"House Name",placeholder:"Enter house name",type:"textfield",key:"houseName",maxLength:50,minLength:1},{id:2,label:"House Number",placeholder:"Enter house number",type:"textfield",key:"houseNumber",maxLength:6,minLength:1},{id:3,label:"Address Line 1",placeholder:"Enter house number and street name",type:"textfield",key:"addressLine1",isRequired:!0,maxLength:50,minLength:1},{id:4,label:"Address Line 2",placeholder:"Enter address line 2",type:"textfield",key:"addressLine2",maxLength:50,minLength:1},{id:5,label:"Town/City",placeholder:"Enter your town/city",type:"textfield",key:"townCity",isRequired:!0,maxLength:50,minLength:1},{id:6,label:"Postcode",placeholder:"Enter your postcode",key:"postcode",maxLength:8,minLength:5,type:"textfield",isRequired:!0},{id:7,label:"Residential Status",placeholder:"What is your residential status?",key:"residentialStatus",type:"select",isRequired:!0,options:[{id:0,label:"Homeowner",value:"homeowner"},{id:1,label:"Private Tenant",value:"privateTenant"},{id:2,label:"Living with Family",value:"livingWithFamily"},{id:3,label:"Council/HA Tenant",value:"rentingFromPublicBody"}]},{id:8,label:"How long have you lived at this address?",placeholder:"When did you move in?",key:"timeAtAddress",type:"monthYearSelect",isRequired:!0}]}]}]},{title:"Employer Details",key:"EmployerDetailsSection",description:null,sectionNumber:2,steps:[{id:0,stepNumber:1,key:"EmploymentDetails",stepDescription:"Employment Details",fields:[{id:0,label:"Employment Status",placeholder:"Select your employment status",key:"employmentStatus",scrollable:!0,type:"select",isRequired:!0,options:[{id:0,label:"Full time employed",value:"FULL_TIME_EMPLOYED"},{id:1,label:"Part time employed",value:"PART_TIME_EMPLOYED"},{id:2,label:"Self employed",value:"SELF_EMPLOYED"},{id:3,label:"Temp or contract work",value:"TEMP_CONTRACT"},{id:5,label:"Retired",value:"RETIRED"},{id:6,label:"Benefits",value:"BENEFITS"},{id:7,label:"Student",value:"STUDENT"}]},{id:1,label:"Occupation",placeholder:"Enter your occupation",type:"textfield",key:"occupation",requiresField:{fieldKey:"employmentStatus",fieldValue:["FULL_TIME_EMPLOYED","PART_TIME_EMPLOYED","SELF_EMPLOYED","TEMP_CONTRACT"]},isRequired:!0,maxLength:16,minLength:2},{id:2,label:"Employment Start Date",placeholder:"Enter your Start Date",type:"textDate",key:"employmentStart",requiresField:{fieldKey:"employmentStatus",fieldValue:["FULL_TIME_EMPLOYED","PART_TIME_EMPLOYED","SELF_EMPLOYED","TEMP_CONTRACT"]},isRequired:!0},{id:3,label:"Contract End Date",placeholder:"Enter the End Date of your contract",type:"textDate",noMaxDateRequired:!0,key:"employmentContractEnd",requiresField:{fieldKey:"employmentStatus",fieldValue:["TEMP_CONTRACT"]},isRequired:!0},{id:4,label:"Organisation",placeholder:"Enter your Employer's name",type:"textfield",key:"employer",isRequired:!0,includedInReadOnlyAddress:!0,requiresField:{fieldKey:"employmentStatus",fieldValue:["FULL_TIME_EMPLOYED","PART_TIME_EMPLOYED","SELF_EMPLOYED","TEMP_CONTRACT"]},maxLength:15,minLength:2},{id:5,label:"Employment Category",placeholder:"Select an option",key:"employmentCategory",type:"employmentCategorySelect",isRequired:!0,scrollable:!0,requiresField:{fieldKey:"employmentStatus",fieldValue:["FULL_TIME_EMPLOYED","PART_TIME_EMPLOYED","SELF_EMPLOYED","TEMP_CONTRACT"]}},{id:6,label:"Phone Number",placeholder:"Enter your Employer's Phone Number",key:"employerPhoneNumber",type:"phoneNumber",isRequired:!0,requiresField:{fieldKey:"employmentStatus",fieldValue:["FULL_TIME_EMPLOYED","PART_TIME_EMPLOYED","SELF_EMPLOYED","TEMP_CONTRACT"]},maxLength:50,minLength:1},{id:7,type:"employerHistory",key:"employerHistory",parentKey:"employerAddress",placeholder:"Enter your Employer's postcode",requiresField:{fieldKey:"employmentStatus",fieldValue:["FULL_TIME_EMPLOYED","PART_TIME_EMPLOYED","SELF_EMPLOYED","TEMP_CONTRACT"]},isRequired:!0,subFields:[{id:0,label:"Flat",placeholder:"Enter your Employer's flat number",type:"textfield",key:"flat",includedInReadOnlyAddress:!0,maxLength:20,minLength:1},{id:1,label:"House Name",placeholder:"Enter your Employer's house name",type:"textfield",key:"house
1Name",includedInReadOnlyAddress:!0,maxLength:50,minLength:1},{id:2,label:"House Number",placeholder:"Enter your Employer's house number",type:"textfield",key:"houseNumber",includedInReadOnlyAddress:!0,maxLength:6,minLength:1},{id:3,label:"Address Line 1",placeholder:"Enter your Employer's street name",type:"textfield",key:"addressLine1",isRequired:!0,includedInReadOnlyAddress:!0,maxLength:50,minLength:1},{id:4,label:"Address Line 2",placeholder:"Enter your Employer's address line 2",type:"textfield",key:"addressLine2",includedInReadOnlyAddress:!0,maxLength:50,minLength:1},{id:5,label:"Town/City",placeholder:"Enter your Employer's town/city",type:"textfield",key:"townCity",isRequired:!0,includedInReadOnlyAddress:!0,maxLength:50,minLength:1},{id:6,label:"Postcode",placeholder:"Enter your Employer's postcode",key:"postcode",type:"textfield",maxLength:8,minLength:5,isRequired:!0,includedInReadOnlyAddress:!0}]}]}]},{title:"Income & Expenditure",key:"IncomeExpenditureSection",description:null,sectionNumber:3,steps:[{id:0,stepNumber:1,stepDescription:"Income Details",key:"IncomeDetails",fields:[{id:0,label:"Gross Annual Income",placeholder:"Enter your gross annual income",key:"grossAnnualIncome",type:"currency",isRequired:!0,maxLength:7,minLength:1},{id:1,label:"Monthly Income after Tax",placeholder:"Enter your monthly income",key:"monthlyIncome",type:"currency",isRequired:!0,maxLength:7,minLength:1},{id:2,label:"Monthly Benefits",placeholder:"Enter any monthly benefits you receive",key:"monthlyBenefits",type:"currency",isRequired:!0,maxLength:7,minLength:1},{id:3,label:"Monthly Pension",placeholder:"Enter any monthly pension you receive",key:"monthlyPension",type:"currency",isRequired:!0,maxLength:7,minLength:1},{id:4,label:"Other Monthly Income",placeholder:"Enter any other monthly income",key:"monthlyIncomeOther",type:"currency",isRequired:!0,maxLength:7,minLength:1},{id:5,label:"Do you expect your income to reduce over the loan period?",placeholder:"Select an option",key:"incomeReductionExpected",type:"select",isRequired:!0,minLength:1,options:[{id:0,label:"No",value:"N"},{id:1,label:"Yes",value:"Y"}]},{id:6,label:"Reason for above",placeholder:"Enter a reason",key:"incomeReductionReason",requiresField:{fieldKey:"incomeReductionExpected",fieldValue:"Y"},type:"textfield",isRequired:!0,minLength:1}]},{id:1,stepNumber:2,stepDescription:"Expenditure Details",key:"ExpenditureDetails",isRequiredByStep:{requiredFieldKey:"contributionMethod",fieldKeyToValidate:"employmentStatus",valueToSetIfNotValid:"DirectDebit",requiredValues:["FULL_TIME_EMPLOYED","PART_TIME_EMPLOYED","SELF_EMPLOYED","TEMP_CONTRACT"]},fields:[{id:0,label:"Do you have Credit/Store cards?",placeholder:"Select an option",key:"hasCreditStoreCard",type:"select",isRequired:!0,options:[{id:0,label:"No",value:"no"},{id:1,label:"Yes",value:"yes"}]},{id:1,label:"Total value of Credit/Store cards",placeholder:"Enter the total value of all your Credit/Store cards",key:"creditStoreCardAmount",requiresField:{fieldKey:"hasCreditStoreCard",fieldValue:"yes"},type:"currency",isRequired:!0,maxLength:7,minLength:1},{id:2,label:"Other credit commitments",placeholder:"Enter the total amount of your other credit commitments",key:"otherCreditCommitments",type:"currency",maxLength:7,minLength:1},{id:3,label:"Monthly Mortgage/Rent payment",placeholder:"Enter the amount of your monthly Mortage/Rent",key:"monthlyMortgage",type:"currency",isRequired:!0,maxLength:7,minLength:1},{id:4,label:"Monthly Council Tax",placeholder:"Enter your monthly Council Tax",key:"councilTax",type:"currency",isRequired:!0,maxLength:7,minLength:1},{id:5,label:"Monthly Travel Costs",placeholder:"Enter any monthly travel costs",key:"monthlyTravel",type:"currency",isRequired:!0,maxLength:7,minLength:1},{id:6,label:"Monthly Utility Costs",placeholder:"Enter any monthly utility costs",key:"monthlyUtility",type:"currency",isRequired:!0,maxLength:7,minLength:1},{id:7,label:"Do you have any other expenditure",placeholder:"Select an option",key:"hasOtherExpenditure",isRequired:!0,type:"select",options:[{id:0,label:"No",value:"no"},{id:1,label:"Yes",value:"yes"}]},{id:8,label:"Other Monthly Expenditure",placeholder:"Enter your total other monthly expenditure",key:"otherExpenditure",type:"currency",isRequired:!0,maxLength:7,requiresField:{fieldKey:"hasOtherExpenditure",fieldValue:"yes"},minLength:1}]}]},{title:"Contributions",key:"ContributionSection",description:null,sectionNumber:4,steps:[{id:0,stepNumber:1,stepDescription:"Contributions",stepInstructions:"Glasgow Credit Union accounts are regular savings products.",description:"You can save monthly by Direct Debit or, if you work for one of our employer partners, directly from your salary.",key:"ContributionMethod",backButtonMode:"previous",fields:[{id:0,label:"Contribution Method",placeholder:"Select an option",key:"contributionMethod",type:"select",isRequired:!0,options:[{id:0,label:"Salary Deduction",value:"Payroll"},{id:1,label:"Direct Debit",value:"DirectDebit"}]}]},{id:1,stepNumber:2,stepDescription:"Contribution information",stepInstructions:"Glasgow Credit Union accounts are regular savings products.",description:"You can save monthly either by direct debit or if you work for one of our employer partners direct from your salary.",backButtonMode:"previous",key:"ContributionDetail
1s",dynamicFields:{dynamicSetKey:"contributionMethod",fieldSets:{Payroll:[{id:0,label:"Contribution Amount",placeholder:"Enter amount",type:"currency",key:"contributionAmount",isRequired:!0,maxLength:7,minLength:1},{id:1,label:"Employment ID",placeholder:"Enter your employment ID",type:"textfield",key:"payrollNumber",isRequired:!0,minLength:1},{id:2,label:"Employer",placeholder:"Select an option",key:"payrollEmployer",type:"payrollSelect",scrollable:!0,isRequired:!0}],DirectDebit:[{id:0,type:"directDebit",key:"directDebit",subFields:[{id:0,label:"Contribution Amount",placeholder:"Enter amount",type:"currency",key:"contributionAmount",isRequired:!0,maxLength:7,minLength:1},{id:1,label:"Bank",placeholder:"Enter your bank account providers name",type:"textfield",key:"accountBankName",isRequired:!0,minLength:1},{id:2,label:"Account Holders Name",placeholder:"Enter account holders name",type:"textfield",key:"accountHolderName",isRequired:!0,minLength:1},{id:3,label:"Account Number",placeholder:"Enter your account number",type:"numeric",key:"accountNumber",isRequired:!0,externalValidationKey:"accountNumber",minLength:1,maxLength:8},{id:4,label:"Sort Code",placeholder:"Enter your sort code",type:"sortCode",key:"sortCode",isRequired:!0,externalValidationKey:"sortCode",minLength:1,maxLength:6},{id:5,label:"Direct Debit Collection Date",placeholder:"Select a date",key:"directDebitDate",type:"select",isRequired:!0,options:[{id:0,label:"Every 1st of the month",value:1},{id:1,label:"Every 7th of the month",value:7},{id:2,label:"Every 14th of the month",value:14},{id:3,label:"Every 21st of the month",value:21},{id:4,label:"Every 28th of the month",value:28}]}]}]}}},{id:2,stepNumber:3,stepDescription:"Bank details",backButtonMode:"previous",key:"BankDetails",allRequired:!0,partialCompleteError:'Please fill in all of the fields to continue. If you do not wish to add another bank account, please remove your information from the fields and click "next"',dynamicFields:{dynamicSetKey:"contributionMethod",stepInformation:{Payroll:"Please enter the details of the bank account you would like to withdraw savings to.",DirectDebit:'To add another bank account for withdrawals, please provide your account information below. Alternatively you can skip this step by clicking "next"'},fieldSets:{Payroll:[{id:0,label:"Bank",placeholder:"Enter your bank account providers name",type:"textfield",key:"accountBankName",isRequired:!0,minLength:1},{id:1,label:"Account Holders Name",placeholder:"Enter account holders name",type:"textfield",key:"accountHolderName",isRequired:!0,minLength:1},{id:2,label:"Account Number",placeholder:"Enter your account number",type:"numeric",key:"accountNumber",isRequired:!0,externalValidationKey:"accountNumber",minLength:1,maxLength:8},{id:3,label:"Sort Code",placeholder:"Enter your sort code",type:"sortCode",key:"sortCode",isRequired:!0,externalValidationKey:"sortCode",minLength:1,maxLength:6},{id:4,label:"I confirm I am the account holder for the above bank account",key:"shareBankAccountAttestationPayroll",type:"checkbox",isRequired:!0}],DirectDebit:[{id:0,label:"Bank",placeholder:"Enter your bank account providers name",type:"textfield",isRequired:!1,key:"accountBankName2",minLength:1},{id:1,label:"Account Holders Name",placeholder:"Enter account holders name",type:"textfield",isRequired:!1,key:"accountHolderName2",minLength:1},{id:2,label:"Account Number",placeholder:"Enter your account number",type:"numeric",isRequired:!1,key:"accountNumber2",minLength:1,maxLength:8},{id:3,label:"Sort Code",placeholder:"Enter your sort code",type:"sortCode",key:"sortCode2",isRequired:!1,minLength:1,maxLength:6},{id:4,label:"I confirm I am the account holder for the above bank account",key:"shareBankAccountAttestationDD",type:"checkbox",isRequired:!1}]}}}]}],additionalOverviewText:{text:"We\u2019ll send all correspondence relating to this loan electronically",displayFieldForParent:["members"]}},Yt=e=>{let t=e.onClick,r=e.form,n=e.formData,i=e.setFormStep,o=e.backStep,a=e.errorMessage,l=e.setErrorMessage,s=e.loading,u=e.extraSections,m=e.isJoinAndBorrow,y=e.parentComponent;const f=(m?Vt:qt).additionalOverviewText||null,p=[{key:"accountNumber2",newLabel:"Additional Bank Account Number"},{key:"accountHolderName2",newLabel:"Additional Account Holder's Name"},{key:"sortCode2",newLabel:"Additional Account Sort Code"},{key:"accountBankName2",newLabel:"Additional Bank Name"}],h=e=>{const t=e.parentKey,r=e.key,i=t?n[t]:null,o=i?i[r]:n[r],a=e.options?e.options.find(e=>e.value===o):null;switch(e.type){case"currency":return Nt(o?parseFloat(o):0,"pounds");case"select":return a?a.label:null;case"textfield":return o.charAt(0).toUpperCase()+o.slice(1);case"checkbox":return o?"Yes":"No";default:return null===o||void 0===o?void 0:o.toString()}},b=(e,t,r,n)=>(0,d.jsxs)(d.Fragment,{children:[n&&(0,d.jsx)(c.cG,{my:3,bg:c.w4.colors.mediumGrey,height:c.w4.sizes.divider[0]}),(0,d.jsxs)(c.so,{alignItems:"center",justifyContent:"space-between",my:2,children:[(0,d.jsx)(c.zz,{m:0,flex:1,children:e}),(0,d.jsx)(c.zz,{m:0,flex:1,textAlign:"right",children:t})]},r)]}),g=(e,t)=>{if(!1===e.isRequired&&"checkbox"!==e.type&&!n[e.key]||"shareBankAccountAttestationDD"===e.key&&!n[e.key])return null;if(!Tt(e,n))return null;let r=!1;if("accountBankName2"===e.key&&(r=!0),"addressHistory"===e.type||"employerHistory"===e.type){return n[e.parentKey].map(e=>b(e.title,(e=>{const t=e.flat,r=e.houseName,n=e.houseNumber,i=e.addressLine1,o=e.addressLine2,a=e.townCity,l=e.postcode,s=t||"",c=r||"",u=n||"",m=i?i.charAt(0).toUpperCase()+i.slice(1):null,y=o?o.charAt(0).toUpperCase()+o.slice(1):null,f=a?a.charAt(0).toUpperCase()+a.slice(1):null;
1return(0,d.jsxs)(d.Fragment,{children:["".concat([s,c].filter(Boolean).join(", ")).concat(s||c?", ":"").concat([u,m].filter(Boolean).join(" "),", ")," ",y&&"".concat(y,", ")," ","".concat(f,", ").concat(l.toUpperCase())]})})(e),e.id,r))}const i=p.find(t=>e.key===t.key);if(i)return b(i.newLabel,h(e),t,r);if(e.subFields){return e.subFields.map((e,t)=>g(e,t))}return b(e.label,h(e),t,r)};return(0,d.jsxs)(c.az,{className:"wrapper",p:3,children:[(0,d.jsx)(c.DZ,{as:"h3",color:c.w4.colors.secondary,my:3,children:"Application Overview"}),u&&u.map(e=>(0,d.jsx)(c.az,{p:3,children:(0,d.jsx)(c.xA,{gridGap:3,children:(0,d.jsxs)(c.az,{bg:c.w4.colors.lighGrey,borderRadius:10,p:3,children:[(0,d.jsx)(c.so,{alignItems:"center",justifyContent:"space-between",children:(0,d.jsx)(c.zz,{fontSize:3,color:c.w4.colors.primary,m:0,children:e.title},"title_Step".concat(10))},"flex_Step".concat(10)),(0,d.jsx)(c.cG,{my:3,bg:c.w4.colors.mediumGrey,height:c.w4.sizes.divider[0]},"divider_Step".concat(10)),e.fields.map(e=>b(e.label,e.value,e.key))]},"innerBox_Step".concat(10))},"grid_Step".concat(10))},"box_Step".concat(10))),r.sections.map(e=>{let t=[];return e.steps.forEach(e=>{const r=e.fields,i=e.dynamicFields;let o=r;if(i){const e=i.dynamicSetKey;o=i.fieldSets[n[e]]}t=t.concat(o)}),(0,d.jsx)(c.az,{children:(0,d.jsx)(c.xA,{gridGap:3,children:(0,d.jsxs)(c.az,{bg:c.w4.colors.lighGrey,border:"1px solid ".concat(c.w4.colors.mediumGrey),borderColor:"#DCDCDC",p:3,borderRadius:2,mb:4,children:[(0,d.jsxs)(c.so,{alignItems:"center",justifyContent:"space-between",children:[(0,d.jsx)(c.zz,{fontSize:3,color:c.w4.colors.secondary,m:0,children:e.title}),(0,d.jsx)(c.Y0,{primary:!0,px:4,text:"Edit",bg:c.w4.colors.primary,onClick:()=>(async e=>{l(""),await i(e),o()})(e)})]}),(0,d.jsx)(c.cG,{my:3,bg:c.w4.colors.mediumGrey,height:c.w4.sizes.divider[0]}),t.map((e,t)=>g(e,t))]})})},e.sectionNumber)}),f&&f.displayFieldForParent.includes(y)&&(0,d.jsx)(c.zz,{color:c.w4.colors.nearBlack,fontSize:2,children:f.text}),(0,d.jsxs)(c.so,{my:[4,4,4,null],mt:[null,null,"20px auto 0"],children:[(0,d.jsx)(c.Y0,{secondary:!0,disabled:!0,text:"Back",flex:"1",bg:c.w4.colors.white}),(0,d.jsx)(c.Y0,{primary:!0,onClick:t,type:"submit",text:"Submit application",bg:c.w4.colors.primary,flex:"2",ml:3,loading:s})]}),(0,d.jsx)(c.az,{mt:4,children:a&&(0,d.jsx)(c.zz,{color:"red",fontSize:2,children:a})})]})};const Ut=()=>(0,d.jsxs)(c.so,{height:"100%",width:[null,null,null,"70%"],m:"0 auto",justifyContent:"center",alignItems:"center",flexDirection:"column",children:[(0,d.jsx)(c.DZ,{as:"h3",color:"#363636",fontWeight:0,textAlign:"center",children:"We are currently processing your request"}),(0,d.jsx)(c.az,{children:(0,d.jsx)(c.so,{justifyContent:"center",alignItems:"center",children:(0,d.jsx)(c.In,{my:5,icon:"recruitment",width:["100px",null,null,"150px"],height:["100px",null,null,"150px"],size:"50px",bg:"#f7f7f7",background:!0})})}),(0,d.jsx)(c.az,{children:(0,d.jsx)(c.zz,{textAlign:"center",fontSize:1,children:"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum sit amet mauris sem. Nulla mauris tortor, condimentum non molestie ut, porta nec dui."})})]});function Bt(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,a,l=[],s=!0,c=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=o.call(r)).done)&&(l.push(n.value),l.length!==t);s=!0);}catch(e){c=!0,i=e}finally{try{if(!s&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw i}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return _t(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_t(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _t(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}const zt=e=>{let t=e.onItemSelect,r=e.getAllAddresses,n=e.displayForm,o=e.setErrorMessage,a=e.formData,l=e.parentField;
1const s=Bt((0,i.useState)(""),2),u=s[0],m=s[1],y=Bt((0,i.useState)(null),2),f=y[0],p=y[1],h=Bt((0,i.useState)([]),2),b=h[0],g=h[1],v=Bt((0,i.useState)(null),2),x=v[0],j=v[1],w=async e=>{if(e.length>=5&&/^[A-Z]{1,2}\d[A-Z\d]? ?\d[A-Z]{2}$/i.test(e))try{const t=await r(e);t.length?(p(t),(e=>{const t=e.map(e=>({value:e,label:e.summaryLine}));g(t)})(t)):o("Sorry we could not find any addresses for ".concat(e.toUpperCase()))}catch(t){o("Sorry we could not find any addresses for ".concat(e.toUpperCase()))}else o("Please enter a valid postcode")};(0,i.useEffect)(()=>{const e=a.homePostcode,t=a.employerPostcode;e&&"homeAddresses"===l.parentKey?(m(e),w(e)):t&&"employerAddress"===l.parentKey&&(m(t),w(t))},[l.parentKey]);return(0,d.jsxs)(c.xA,{gridTemplateColumns:[null,null,"1fr 1fr"],gridGap:3,children:[(0,d.jsxs)(c.so,{children:[(0,d.jsxs)(c.Gw,{htmlFor:"postcode",flex:"1",children:[(0,d.jsx)("span",{children:"Postcode"}),(0,d.jsx)(c.pd,{id:"postcode",type:"text",maxLength:"8",minLength:"5",value:u.toUpperCase(),onChange:e=>{o(null),m(e.target.value.replace(/[^a-z\d\s]+/gi,""))},style:{padding:"0px",borderRadius:"0px"},required:!1===n})]}),(0,d.jsx)(c.Y0,{text:(0,d.jsx)(bt.g,{icon:"search",color:c.w4.colors.primary}),noBorder:!0,type:"submit",onClick:e=>{x&&j(null),e.preventDefault(),w(u)},bg:"transparent",ml:-3,px:0,py:0,mb:"10px",alignSelf:"flex-end"})]}),f&&(0,d.jsxs)(c.az,{children:[(0,d.jsx)(c.Gw,{htmlFor:"address-select",children:(0,d.jsx)("span",{children:"Select address"})}),(0,d.jsx)(c.l6,{value:x,options:b,onChange:e=>{const r=e.value;t(r),j({value:r,label:r.summaryLine})},isSearchable:!0,scrollable:!0,id:"address-select"})]})]})};function $t(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,a,l=[],s=!0,c=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=o.call(r)).done)&&(l.push(n.value),l.length!==t);s=!0);}catch(e){c=!0,i=e}finally{try{if(!s&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw i}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Gt(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Gt(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Gt(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}const Ht=e=>{let t=e.formData,r=e.parentField,n=e.setValue,o=e.displayPreviousAddress,a=e.id,l=e.onPostcodeChange,s=e.setErrorMessage;const u=$t((0,i.useState)(null),2),m=u[0],y=u[1],f=r.parentKey,p=t[f].find(e=>e.id===a);return r.subFields.map(e=>{const i=p?p[e.key]:"";if("select"===e.type){const r=e.options.map(e=>({value:e.value,label:e.label})),i=p?r.find(t=>t.value===p[e.key]):r.find(r=>r.value===t[e.key]);return(0,d.jsxs)(c.az,{children:[(0,d.jsx)(c.Gw,{htmlFor:e.label,children:(0,d.jsxs)("span",{children:[e.label," ",!e.isRequired&&"- optional"]})}),(0,d.jsx)(c.l6,{options:r,isSearchable:!0,value:i||m,required:e.isRequired,onChange:t=>{n(e.key,t.value),y(t.value)}},e.key)]},e.key)}if("monthYearSelect"===e.type)return(0,d.jsx)(c.wj,{customRender:o,label:e.label,setValue:n,address:p,handleChange:t=>n(e.key,t)},e.key);if("phoneNumber"===e.type||"numeric"===e.type)return(0,d.jsxs)(c.Gw,{htmlFor:e.label,children:[(0,d.jsxs)("span",{children:[e.label," ",!e.isRequired&&"- optional"]}),(0,d.jsx)("input",{id:e.key,placeholder:e.placeholder,type:e.type,minLength:e.minLength,maxLength:e.maxLength,onInput:t=>{const r=t.target.value.replace(/[^0-9+]/g,"");n(e.key,r)},value:t[e.key],required:e.isRequired,bg:"transparent"},e.key)]},e.key);let u;return u="homeAddresses"===r.parentKey&&0===a&&"postcode"===e.key?l:n,(0,d.jsxs)(c.Gw,{htmlFor:e.label,children:[(0,d.jsxs)("span",{children:[e.label," ",!e.isRequired&&"- optional"]}),(0,d.jsx)("input",{id:e.key,placeholder:e.placeholder,type:e.type,minLength:e.minLength,maxLength:e.maxLength,onChange:t=>{s(),u(e.key,t.target.value)},defaultValue:i,required:e.isRequired},e.key)]},e.key)})};function Wt(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function Kt(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Zt(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,a,l=[],s=!0,c=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=o.call(r)).done)&&(l.push(n.value),l.length!==t);s=!0);}catch(e){c=!0,i=e}
1finally{try{if(!s&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw i}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Qt(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Qt(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Qt(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}const Jt=e=>{let t=e.getAllAddresses,r=e.formData,n=e.title,o=e.id,a=e.parentField,l=e.displayPreviousAddress,s=e.setErrorMessage;const u=Zt((0,i.useState)(!1),2),m=u[0],y=u[1],f=Zt((0,i.useState)({}),2),p=f[0],h=f[1],b=Zt((0,i.useState)(0),2),g=b[0],v=b[1],x=a.parentKey;function j(){y(!0)}(0,i.useEffect)(()=>{r[x].length&&j()},[r,x]);const w=(e,t)=>{const n=r[x].find(e=>e.id===t.id);if(n){const e=r[x].indexOf(n);-1!==e&&(r[x][e]=t)}else r[x].push(t)},k=(e,t)=>{const i=r[x].find(e=>e.id===o);if(i)i[e]=t;else{const i={};i.id=o,i.title=n,i[e]=t,r[x].push(i)}};return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)(c.az,{gridColumn:[null,null,null,"1 / 3"],children:[n&&(0,d.jsx)(c.DZ,{as:"h3",fontSize:[2,4],mb:3,color:"#818181",fontWeight:0,children:n}),(0,d.jsx)(zt,{parentField:a,formData:r,getAllAddresses:t,displayForm:m,setErrorMessage:s,onItemSelect:e=>{const t=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Wt(Object(r),!0).forEach(function(t){Kt(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Wt(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}({},e);t.id=o,t.title=n,w(0,t),h(t),j(),v(g+1)}}),!m&&(0,d.jsxs)(c.zz,{fontSize:1,children:["Alternatively,"," ",(0,d.jsx)(c.Y0,{style:{display:"inline"},p:0,noBorder:!0,type:"button",bg:"transparent",onClick:j,text:"click here",color:c.w4.colors.primary,fontWeight:0})," ","to enter your address manually."]})]}),m&&(0,d.jsx)(Ht,{formData:r,id:o,setValue:k,parentField:a,currentAddress:p,onAddressChange:w,onPostcodeChange:(e,t)=>
1{/[A-Z]{1,2}[0-9]{1,2} ?[0-9][A-Z]{2}/i.test(t)?s():s("Please enter a valid UK postcode"),k(e,t)},displayPreviousAddress:l,setErrorMessage:s},"addressForm_".concat(g))]})};function Xt(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,a,l=[],s=!0,c=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=o.call(r)).done)&&(l.push(n.value),l.length!==t);s=!0);}catch(e){c=!0,i=e}finally{try{if(!s&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw i}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return er(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?er(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function er(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}const tr=e=>{let t=e.getAllAddresses,r=e.formData,n=e.parentField,o=e.setFieldValue,a=e.setErrorMessage;const l=n.requiredAddressMonths,s=n.parentKey,c=Xt((0,i.useState)(!1),2),u=c[0],m=c[1],y=Xt((0,i.useState)(!1),2),f=y[0],p=y[1],h=Xt((0,i.useState)(!1),2),b=h[0],g=h[1],v=Xt((0,i.useState)(!1),2),x=v[0],j=v[1],w=()=>{const e=r[s].find(e=>0===e.id),t=r[s].find(e=>1===e.id),n=r[s].find(e=>2===e.id),i=r[s].find(e=>3===e.id);return e.timeAtAddress<l&&e.timeAtAddress>=0?(m(!0),t&&t.timeAtAddress<l?(p(!0),n&&n.timeAtAddress<l?(g(!0),i&&i.timeAtAddress<l?(j(!0),!0):(j(!1),r[s].splice(4,1),!0)):(g(!1),r[s].splice(3,1),!0)):(p(!1),r[s].splice(2,1),!0)):(m(!1),r[s].splice(1,1),!0)};return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(Jt,{getAllAddresses:t,setFieldValue:o,setErrorMessage:a,parentField:n,formData:r,displayPreviousAddress:w,title:"Current address",id:0},0),u&&(0,d.jsx)(Jt,{getAllAddresses:t,displayPreviousAddress:w,parentField:n,formData:r,title:"Previous address 1",id:1},1),f&&(0,d.jsx)(Jt,{getAllAddresses:t,displayPreviousAddress:w,parentField:n,formData:r,title:"Previous address 2",id:2},2),b&&(0,d.jsx)(Jt,{getAllAddresses:t,displayPreviousAddress:w,parentField:n,formData:r,title:"Previous address 3",id:3},3),x&&(0,d.jsx)(Jt,{getAllAddresses:t,parentField:n,formData:r,title:"Previous address 4",id:4},4)]})},rr=e=>{let t=e.getAllAddresses,r=e.formData,n=e.parentField,i=e.setFieldValue,o=e.setErrorMessage;return(0,d.jsx)(Jt,{title:"Employer Address",getAllAddresses:t,setFieldValue:i,parentField:n,formData:r,setErrorMessage:o,id:1},1)};var nr=r(1232),ir=r.n(nr),or=r(3352),ar=r(8118),lr=r.n(ar);function sr(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,a,l=[],s=!0,c=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=o.call(r)).done)&&(l.push(n.value),l.length!==t);s=!0);}catch(e){c=!0,i=e}finally{try{if(!s&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw i}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return cr(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?cr(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function cr(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}const ur=e=>{let t=e.field,r=e.fieldValue,n=e.setFieldValue,o=e.setErrorMessage,a=e.payrollEmployers,l=e.employmentCategories,s=e.fieldRequired;const u=sr((0,i.useState)(r),2),m=u[0],y=u[1];(0,i.useEffect)(()=>{y(r)},[r]);const f=/^[ A-Za-z-\s]*$/i,p=/^[A-Za-z0-9]+$/;if("sortCode"===t.type)return(0,d.jsxs)(c.Gw,{htmlFor:t.label,children:[(0,d.jsxs)("span",{children:[t.label," ",!s&&"- optional"]}),(0,d.jsx)(lr(),{placeholder:"00-00-00",value:r,id:t.label,options:{delimiters:["-"],blocks:[2,2,2],uppercase:!0,numericOnly:!0,numeralPositiveOnly:!0},onInit:e=>{e.lastInputValue=""},onChange:e=>{const r=e.target.value.replace(/-|\s/g,"");n(t.key,r)},style:{padding:"0px",borderRadius:"0px"},required:s})]},t.key);if("select"===t.type){const e=t.options.map(e=>({value:e.value,label:e.label})),i=e.find(e=>e.value===r);return(0,d.jsxs)(c.az,{children:[(0,d.jsx)(c.Gw,{htmlFor:t.label,children:(0,d.jsxs)("span",{children:[t.label," ",!s&&"- optional"]})}),(0,d.jsx)(c.l6,{id:t.label,options:e,isSearchable:!0,placeholder:t.placeholder,value:i,required:s,scrollable:t.scrollable||!1,onChange:e=>{o(""),n(t.key,e.value)}},t.key)]},t.key)}if("payrollSelect"===t.type){const e=a.map(e=>({value:e.name,label:e.name})),i=e.find(e=>e.value===r);return(0,d.jsx)(c.az,{children:(0,d.jsxs)(c.Gw,{htmlFor:t.label,children:[(0,d.jsxs)("span",{children:[t.label," ",!s&&"- optional"]}),(0,d.jsx)(c.l6,{id:t.label,options:e,isSearchable:!0,value:i,required:!0,scrollable:t.scrollable||!1,onChange:e=>n(t.key,e.value)},t.key)]})},t.key)}if("employmentCategorySelect"===t.type){const e=l.map(e=>({value:e.name,label:e.name})),i=e.find(e=>e.value===r);return(0,d.jsx)(c.az,{children:(0,d.jsxs)(c.Gw,{htmlFor:t.label,children:[(0,d.jsxs)("span",{children:[t.label," ",!s&&"- optional"]}),(0,d.jsx)(c.l6,{id:t.label,options:e,isSearchable:!0,value:i,required:!0,scrollable:t.scrollable||!1,onChange:e=>n(t.key,e.value)},t.key)]})},t.key)}if("niNumber"===t.type)return(0,d.jsx)(c.az,{children:(0,d.jsxs)(c.Gw,{htmlFor:t.label,children:[(0,d.jsxs)("span",{children:[t.label," ",!s&&"- optional"]}),(0,d.jsx)(lr(),{placeholder:"AB-12-34-56-A",value:r,id:t.label,onInit:e=>{e.lastInputValue=""},pattern:"[A-Z]{2}-\\d{2}-\\d{2}-\\d{2}-[A-Z]{1}",options:{delimiter:"-",delimiterLazyShow:!0,blocks:[2,2,2,2,1],uppercase:!0},onChange:e=>{const r=e.target.value.replace(/-|\s/g,"");n(t.key,r)},required:s,style:{padding:"0px",borderRadius:"0px",width:"100%"}})]})},t.key);if("textDate"===t.type){const e=t.noMaxDateRequired?null:h()().format("YYYY-MM-DD");return(0,d.jsxs)(c.Gw,{htmlFor:t.label,children:[(0,d.jsxs)("span",{children:[t.label," ",!s&&"- optional"]}),(0,d.jsx)(lr(),{placeholder:"DD-MM-YYYY",value:r,id:t.label,options:{delimiters:["-"],blocks:[2,2,4],uppercase:!0,date:!0,dateMin:"1900-01-01",dateMax:e,datePattern:["d","m","Y"]},onInit:e=>{e.lastInputValue=""},onChange:e=>{n(t.key,e.target.value)},pattern:"(0[1-9]|1[0-9]|2[0-9]|3[01]).(0[1-9]|1[012]).[0-9]{4}",required:s,style:{padding:"0px",borderRadius:"0px",width:"100%"}},t.key)]},t.key)}if("phoneNumber"===t.type||"numeric"===t.type||"mobileNumber"===t.type){let e=!s;return"phoneNumber"!==t.key&&"mobileNumber"!==t.key||(e=!1),(0,d.jsxs)(c.Gw,{htmlFor:t.label,children:[(0,d.jsxs)("span",{children:[t.label," ",e&&"- optional"]}),(0,d.jsx)(c.pd,{id:t.label,placeholder:t.placeholder,type:t.type,minLength:t.minLength,maxLength:t.maxLength,onChange:e=>{const r=e.target.value.replace(/[^0-9+]/g,"");n(t.key,r),y(r)},value:m,required:s,bg:"transparent",autoComplete:"off"},t.key)]},t.key)}return"currency"===t.type?(0,d.jsxs)(c.Gw,{htmlFor:t.label,children:[(0,d.jsxs)("span",{children:[t.label," ",!s&&"- optional"]}),(0,d.jsxs)(c.so,{alignItems:"center",children:[(0,d.jsx)(c.zz,{as:"span",mr:"-10px",children:"\xa3"}),(0,d.jsx)(c.pd,{id:t.label,placeholder:t.placeholder,type:t.type,minLength:t.minLength,maxLength:t.maxLength,onChange:e=>{const r=e.target.value.replace(/[^0-9]/g,"");n(t.key,r),y(r)},onBlur:()=>{m&&(n(t.key,parseFloat(m).toFixed(2)),y(parseFloat(m).toFixed(2)))},value:m||"",required:s,bg:"transparent",pl:"20px",width:"100%",autoComplete:"off"},t.key)]})]},t.key):"accountHolderName"===t.key||"accountBankName"===t.key||"accountBankName2"===t.key||"accountHolderName2"===t.key||"occupation"===t.key?(0,d.jsxs)(c.Gw,{htmlFor:t.label,children:[(0,d.jsxs)("span",{children:[t.label," ",!s&&"- optional"]}),(0,d.jsx)(c.pd,{id:t.key,placeholder:t.placeholder,type:t.type,minLength:t.minLength,maxLength:t.maxLength,onChange:e=>{const r=e.target.value;(new RegExp(e.target.pattern).test(r)||""===r)&&n(t.key,e.target.value)},value:m,required:s,bg:"transparent",pattern:"^[a-zA-Z][\\sa-zA-Z]*$",autoComplete:"off"},t.key)]},t.key):"payrollNumber"===t.key?(0,d.jsxs)(c.Gw,{htmlFor:t.label,children:[(0,d.jsxs)("span",{children:[t.label," ",!s&&"- optional"]}),(0,d.jsx)(c.pd,{id:t.key,placeholder:t.placeholder,type:t.type,minLength:t.minLength,maxLength:t.maxLength,onChange:e=>{var r,i;p.test(null===e||void 0===e||null===(r=e.target)||void 0===r?void 0:r.value)||""===(null===e||void 0===e||null===(i=e.target)||void 0===i?void 0:i.value)?(o(""),n(t.key,e.target.value)):(o("Payroll number given appears to be invalid - Please check and re-enter"),n(t.key,e.target.value))},value:m||"",required:s,bg:"transparent",autoComplete:"off"},t.key)]},t.key):(0,d.jsxs)(c.Gw,{htmlFor:t.label,children:[(0,d.jsxs)("span",{children:[t.label," ",!s&&"- optional"]}),(0,d.jsx)(c.pd,{id:t.key,placeholder:t.placeholder,type:t.type,minLength:t.minLength,maxLength:t.maxLength,onChange:e=>{"firstName"===t.key||"lastName"===t.key?f.test(e.target.value)&&(n(t.key,e.target.value),y(e.target.value)):"emailAddress"===t.key?(n(t.key,e.target.value.toLowerCase()),y(e.target.value.toLowerCase())):n(t.key,e.target.value)},value:m,required:s,bg:"transparent",autoComplete:"off"},t.key)]},t.key)};function dr(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function mr(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};
1t%2?dr(Object(r),!0).forEach(function(t){yr(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):dr(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function yr(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function fr(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,a,l=[],s=!0,c=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=o.call(r)).done)&&(l.push(n.value),l.length!==t);s=!0);}catch(e){c=!0,i=e}finally{try{if(!s&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw i}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return pr(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?pr(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function pr(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}h().extend(ir()),h().extend(or.A);const hr=e=>{let t=e.formData,r=e.parentField,n=e.setFieldValue,o=e.globalRules,a=e.directDebitAgreement,l=e.setChildPreNavigationHook,s=e.setErrorMessage,u=e.agreementProcessEnum,m=e.setStepTitle,y=e.setSkipAdditionalBankDetails,f=e.skipAdditionalBankDetails,p=e.parentComponent;const b=fr((0,i.useState)(!1),2),g=b[0],v=b[1],x=o.directDebitMandateDays,j=r.subFields.find(e=>"directDebitDate"===e.key),w=Dt(j,t).fieldValue;(0,i.useEffect)(()=>{const e=()=>{if(null!==t&&void 0!==t&&t.joinDirectDebitAgreement){if(g)return n("userAgreements",mr(mr({},t.userAgreements),{},{directDebitAgreement:{value:!0,processKeys:[u.JOIN],key:"directDebitMandateAgreement",title:"Direct Debit Mandate Agreement"}})),!0;v(!0)}return!1};l(()=>e);let r="Direct Debit Instruction";return g&&(r="Direct Debit Instruction Confirmation"),m(r),()=>{l(null)}},[t,l,g,u,m]);const k=()=>{const e=h()().businessDaysAdd(x);return e.date()<=w?e.date(w):e.add(1,"month").date(w)},S=["accountBankName","directDebitDate"];return g?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(c.zz,{mt:2,fontSize:2,gridColumn:"1/3",children:"We\u2019ll collect your first Direct Debit contribution on or immediately after the ".concat(k().format("Do MMMM")," from the bank account below. Thereafter, we\u2019ll collect contributions on or immediately after the ").concat(k().format("Do")," of each month.")}),r.subFields.map(e=>{const r=Dt(e,t).fieldValue;if(!Tt(e,t)||S.includes(e.key))return null;const i=Array.isArray(e.isRequired)?e.isRequired.includes(p):e.isRequired;return(0,d.jsx)(ur,{field:e,fieldRequired:i,fieldValue:r,setFieldValue:n,setErrorMessage:s},e.key)}),(0,d.jsxs)(c.so,{flexDirection:"column",gridColumn:"1/3",position:"relative",children:[(0,d.jsx)(c.In,{icon:"directdebit",width:"100px",height:"50px",size:"auto",ml:"auto"}),(0,d.jsx)(c.az,{children:(0,d.jsx)(c.zz,{fontSize:2,gridColumn:"1/3",children:a})})]}),(0,d.jsx)(c.zz,{fontSize:2,gridColumn:"1/3",children:"We\u2019ll write to you when your bank confirms that your Direct Debit Instruction is active. You should check the information on this letter to confirm that all details are correct."}),(0,d.jsx)(c.zz,{fontSize:2,gridColumn:"1/3",children:"If you have any questions or want to make changes to your Direct Debit Instruction, please contact us on 0141 274 9933."})]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(c.zz,{mt:2,fontSize:2,gridColumn:"1/3",children:"Please complete the following Direct Debit Instruction with your bank details and how much you\u2019d like to save each month."}),r.subFields.map(e=>{const r=Dt(e,t).fieldValue;if(!Tt(e,t))return null;const i=Array.isArray(e.isRequired)?e.isRequired.includes(p):e.isRequired;return(0,d.jsx)(ur,{field:e,fieldRequired:i,fieldValue:r,setFieldValue:n,setErrorMessage:s},e.key)}),(0,d.jsxs)(c.ph,{flexDirection:"row !important",alignItems:"center",justifyContent:"flex-start !important",gridColumn:"1/3",children:[(0,d.jsx)("input",{type:"checkbox","data-val":"true",onCh
1ange:e=>n("joinDirectDebitAgreement",e.target.checked),mr:2,required:!0},"joinDirectDebitAgreement"),(0,d.jsx)(c.zz,{as:"span",m:"0",ml:2,children:"I confirm that this is my bank account and I have the authority to set up this Direct Debit Instruction"})]},"joinDirectDebitAgreement"),(0,d.jsxs)(c.ph,{flexDirection:"row !important",alignItems:"center",justifyContent:"flex-start !important",gridColumn:"1/3",children:[(0,d.jsx)("input",{type:"checkbox","data-val":"true",checked:!f,onChange:e=>{y(!e.target.checked)},mr:2},"addSavingsBankAccount"),(0,d.jsx)(c.zz,{as:"span",m:"0",ml:2,children:"I want to withdraw my savings to a different bank account"})]})]})};function br(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,a,l=[],s=!0,c=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=o.call(r)).done)&&(l.push(n.value),l.length!==t);s=!0);}catch(e){c=!0,i=e}finally{try{if(!s&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw i}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return gr(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?gr(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function gr(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}const vr=e=>{let t=e.getAllAddresses,r=e.currentStep,n=e.dynamicFields,o=e.setFieldValue,a=e.setSelectFieldValue,l=e.formData,s=e.steps,u=e.setErrorMessage,m=e.joinAndBorrowDetails,y=e.setChildPreNavigationHook,f=e.agreementProcessEnum,p=e.setSkipAdditionalBankDetails,h=e.skipAdditionalBankDetails,b=e.parentComponent;const g=br((0,i.useState)(""),2),v=g[0],x=g[1],j=r.stepDescription,w=r.fields,k=r.stepInstructions,S=r.description,A=m.payrollEmployers,C=m.employmentCategories,O=m.globalRules,E=m.directDebitAgreement;let N=w,P="";if((0,i.useEffect)(()=>{"ContributionDetails"!==r.key&&x(j)},[j,r]),n){const e=n.dynamicSetKey,t=n.fieldSets,r=n.stepInformation,i=l[e];N=t[i],r&&(P=r[i])}return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(c.az,{position:[null,null,"absolute"],top:0,right:0,children:(0,d.jsx)(c.SK,{steps:s,currentStep:r})}),(0,d.jsx)(c.zz,{fontSize:[2,5],color:c.w4.colors.nearBlack,my:4,children:v}),(0,d.jsx)(c.zz,{fontSize:2,children:k}),(0,d.jsx)(c.zz,{fontSize:2,children:S}),(0,d.jsx)(c.zz,{fontSize:2,children:P}),(0,d.jsx)(c.xA,{gridTemplateColumns:[null,null,null,"1fr 1fr"],gridGap:"20px",children:!!N&&N.map(e=>{const r=Dt(e,l).fieldValue;if(!Tt(e,l))return null;const n=Array.isArray(e.isRequired)?e.isRequired.includes(b):e.isRequired;return"checkbox"===e.type?(l[e.key]||(l[e.key]=!1),(0,d.jsxs)(c.az,{children:[e.placeholder&&(0,d.jsx)(c.zz,{as:"h5",fontWeight:0,color:c.w4.colors.nearBlack,style:{marginTop:"20px",marginBottom:"10px"},fontSize:2,children:e.placeholder}),(0,d.jsxs)(c.ph,{flexDirection:"row !important",alignItems:"center",justifyContent:"flex-start !important",gridColumn:"1/3",children:[(0,d.jsx)("input",{type:"checkbox",checked:l[e.key],onChange:t=>o(e.key,t.target.checked),mr:2},e.key),(0,d.jsx)(c.zz,{as:"span",m:"0",ml:2,children:e.label})]},e.key)]},e.key)):"addressHistory"===e.type?(l[e.parentKey]||(l[e.parentKey]=[]),(0,d.jsx)(tr,{getAllAddresses:t,formData:l,parentField:e,setFieldValue:o,setSelectFieldValue:a,setErrorMessage:u},e.key)):"directDebit"===e.type?(0,d.jsx)(hr,{formData:l,parentField:e,setStepTitle:x,setFieldValue:o,globalRules:O,directDebitAgreement:E,setChildPreNavigationHook:y,setErrorMessage:u,agreementProcessEnum:f,setSkipAdditionalBankDetails:p,skipAdditionalBankDetails:h,parentComponent:b},e.key):"employerHistory"===e.type?(l[e.parentKey]||(l[e.parentKey]=[]),(0,d.jsx)(rr,{getAllAddresses:t,formData:l,parentField:e,setFieldValue:o,setErrorMessage:u},e.key)):(0,d.jsx)(ur,{field:e,fieldValue:r,setFieldValue:o,setErrorMessage:u,payrollEmployers:A,employmentCategories:C,fieldRequired:n},e.key)})})]})};var xr=r(5866),jr=r(8041);const wr=e=>{let t=e.setShowCancelationModal;
1const r=(0,n.Zp)();return xr.createPortal((0,d.jsx)(c.so,{position:"absolute",top:0,left:0,width:"100%",height:"100%",bg:(0,jr.B3)(c.w4.colors.secondary,.7),justifyContent:"center",alignItems:"center",zIndex:5,children:(0,d.jsxs)(c.so,{flexDirection:"column",width:"560px",bg:"#F7F7F7",boxShadow:"0px 5px 10px #93939330",p:"37px",children:[(0,d.jsx)(c.az,{pb:4,borderBottom:"1px solid ".concat(c.w4.colors.mediumGrey),children:(0,d.jsx)(c.DZ,{color:c.w4.colors.secondary,textAlign:"center",as:"h3",children:"Exit Application"})}),(0,d.jsx)(c.zz,{m:"40px auto",style:{marginTop:"40px",marginBottom:"40px",fontSize:"16px"},textAlign:"center",color:"#363636",children:"You are about to exit your application, any unsaved data will be lost. Are you sure you want to exit?"}),(0,d.jsxs)(c.so,{alignItems:"center",mt:3,children:[(0,d.jsx)(c.Y0,{secondary:!0,text:"Cancel Application",as:"a",onClick:e=>{e.preventDefault(),t(!1),r("/")},bg:c.w4.colors.white,flex:1}),(0,d.jsx)(c.Y0,{primary:!0,text:"Continue Application",onClick:()=>{t(!1)},bg:c.w4.colors.primary,flex:1,ml:3})]})]})}),document.body)};function kr(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,a,l=[],s=!0,c=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=o.call(r)).done)&&(l.push(n.value),l.length!==t);s=!0);}catch(e){c=!0,i=e}finally{try{if(!s&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw i}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Sr(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Sr(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Sr(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}const Ar=e=>{let t=e.title,r=e.flattenedForm,n=e.getAllAddresses,o=e.formData,a=e.setFieldValue,l=e.onClick,s=e.backStep,u=e.formStep,m=e.setFormStep,y=e.performExternalValidation,f=e.joinAndBorrowDetails,p=e.externalValidationError,b=e.preNavigationHook,g=e.agreementProcessEnum,v=e.setStep,x=e.isJoinAndBorrow,j=e.setExternalValidationError,w=e.contributionSelectionSkipped,k=e.loading,S=e.parentComponent;const A=f.minimumJoiningAge,C=kr((0,i.useState)(1),2),O=C[0],E=C[1],N=kr((0,i.useState)({}),2),P=N[0],D=N[1],I=kr((0,i.useState)(""),2),L=I[0],R=I[1],M=kr((0,i.useState)(!1),2),T=M[0],F=M[1],q=kr((0,i.useState)(null),2),V=q[0],Y=q[1],U=kr((0,i.useState)(!0),2),B=U[0],_=U[1],z=Object.values(r);(0,i.useEffect)(()=>{if(u){const e=z.find(e=>e.sectionKey===(u.sectionKey||u.key));let t=e.navigationOrder;"ContributionMethod"===e.key&&w&&(t=e.navigationOrder+1),E(t),m(null),D(e)}else{const e=z.find(e=>e.navigationOrder===O);D(e)}},[u,O,P,m,z,w]);const $=()=>{R(""),j("")},G=(e,t,r)=>{if(!Tt(e,t))return!0;const n=Dt(e,t),i=n.fieldValue,o=n.fieldParent,a=n.requiredFieldValue;if((Array.isArray(e.isRequired)?e.isRequired.includes(S):e.isRequired)||r&&r.allRequired)if(e.requiresField){if("employerHistory"===e.type&&e.requiresField.fieldValue.includes(a)&&!o.length)return!1;if(a===e.requiresField.fieldValue&&!i)return!1}else if("addressHistory"===e.type){if(!o||!o.length)return!1;if(o.some(t=>e.subFields.some(e=>!G(e,t))))return!1}else{if(e.key&&0!==i&&!i)return!1;if(i&&0===i.length)return!1;if(i&&e.minLength&&i.length<e.minLength)return!1}else if(e.minLength&&i&&i.length<e.minLength)return!1;return!0},H=()=>{const e=Ft(P,o);if(!e)return!0;if(P.allRequired){if(!e.some(e=>!!Dt(e,o).fieldValue))return!0}if(e.some(e=>!G(e,o,P))){let t="Please fill in all required fields";const r=Object.values(e).every(e=>e.isRequired);return P.allRequired&&P.partialCompleteError&&!r&&(t=P.partialCompleteError),R(t),!1}return!0},W=e=>{const t=e[e.length-1].postcode;return(!/^[a-z\d\-_\s]+$/i.test(t)||null!==t.match(/^ *$/))&&(R("Please make sure you have entered the correct format of postcode"),!0)},K=()=>{$();const e=Ft(P,o);if(!e)return!0;
1return!e.some(e=>{if(!Tt(e,o))return!1;if(!(Array.isArray(e.isRequired)?e.isRequired.includes(S):e.isRequired))return!1;const t=Dt(e,o),r=t.fieldValue,n=t.fieldParent;let i=!1;switch(e.type){case"textDate":"dateOfBirth"===e.key&&10!==r.length&&(R("Please enter a valid date of birth"),i=!0),A&&"dateOfBirth"===e.key&&!((e,t)=>{const r=h()().subtract(e,"years"),n=h()(t,"DD-MM-YYYY").toISOString();return h()(n).isBefore(r)})(A,r)&&(R("The date of birth you have entered indicated that you do not meet the minimum age of ".concat(A,". Unfortunately, we cannot complete your application at this time.")),i=!0),"employmentStart"===e.key&&h()(r,"DD/MM/YYYY")<h()(o.dateOfBirth,"DD/MM/YYYY").add(16,"year")&&(R("Please enter a valid employment start date"),i=!0);break;case"niNumber":Mt(r)||(R("Please enter a valid national insurance number"),i=!0);break;case"emailAddress":Rt(r)||(R("Please enter a valid email address"),i=!0);break;case"phoneNumber":const t=Lt(r);if(r&&!t){const e="EmploymentDetails"===P.key?"Please enter a valid telephone number":"Please enter a valid home telephone number";R(e),i=!0}break;case"mobileNumber":const a=It(r);r&&!a&&(R("Please enter a valid mobile telephone number"),i=!0);break;case"addressHistory":const l=n[n.length-1].timeAtAddress;e.requiredAddressMonths&&l<e.requiredAddressMonths&&(i=!0),e.requiredAddressCount&&i&&(i=n.length<e.requiredAddressCount);const s=e=>{const t=h()();return t.subtract(e,"months").isAfter(t)},c=n.some(e=>s(e.timeAtAddress));if(c)return R("You have entered a move in date in the future. Please enter a new date and try again."),!0;if(i&&!c&&R("Please make sure you have supplied either 3 years worth of addresses, or 5 previous addresses."),i)return!0;let u=W(n);if(u=(e=>{const t=e[e.length-1].postcode;return!/[A-Z]{1,2}[0-9]{1,2} ?[0-9][A-Z]{2}/i.test(t)&&(R("Please enter a valid UK postcode"),!0)})(n),u)return!0;break;case"employerHistory":i=W(n)}return i})},Z=e=>{const t=[];return e.forEach(e=>{if(e.subFields){const r=Z(e.subFields);t.push(...r)}if(!e.externalValidationKey)return;const r=e,n=Dt(e,o).fieldValue;r.value=n,(e.isRequired||0===n||n)&&t.push(r)}),t},Q=e=>{z.length===O||z.length===O+e-1?l():E(O+e)},J=async e=>{if(e.preventDefault(),k||L)return!1;$();if(!H())return!1;if(!K())return!1;if(b){const e=await b(P,Vt),t=e.success,r=e.failedAffordability,n=e.isAffordabilityCheck,i=e.passedExistingMemberCheck,o=e.hasValidNameOrNumber,a=e.hasValidHomeOrMobile,l=e.skipContributionSelection,s=void 0!==l&&l,c=e.contributionIsValid,u=void 0===c||c;if(s)return Q(2),!0;if(!o&&!n)return R("Please provide a house name or number"),!1;if(!a)return R("Please provide a home phone number or mobile number"),!1;if(!u)return!1;if(!i&&!n)return x?(v(7),!1):(v(6),!1);if(!t&&!r&&n)return v(2),!1;if(!t&&r&&n)return v(7),!1}if(V){if(!await V())return!1}return!!await(async()=>{const e=Ft(P,o);if(!e)return!0;const t=Z(e);return null===t||void 0===t||!t.length||await y(t)})()&&("ContributionDetails"===P.key&&B&&"DirectDebit"===o.contributionMethod?(["accountBankName2","accountHolderName2","accountNumber2","sortCode2"].forEach(e=>a(e,null)),Q(2),!0):(Q(1),!0))};return(0,d.jsxs)(c.az,{p:4,pt:"92px",position:"relative",children:[(0,d.jsx)(c.Y0,{secondary:!0,noBorder:!0,text:"Cancel application",fontWeight:0,after:!0,position:"absolute",top:4,right:4,bg:"transparent",onClick:()=>{F(!T)},children:(0,d.jsx)(bt.g,{icon:"times",color:c.w4.colors.gray,size:"lg"})}),(0,d.jsxs)(c.q,{onSubmit:e=>J(e),autoComplete:"off",position:"relative",children:[(0,d.jsx)(c.DZ,{color:c.w4.colors.primary,as:"h3",mb:4,fontWeight:0,pb:4,borderBottom:1,borderColor:c.w4.colors.mediumGrey,fontSize:[4,6],children:t}),(0,d.jsx)(vr,{currentStep:P,steps:z,dynamicFields:P.dynamicFields,setFieldValue:(e,t)=>(L&&R(""),a(e,t)),formData:o,getAllAddresses:n,joinAndBorrowDetails:f,setErrorMessage:R,setChildPreNavigationHook:Y,agreementProcessEnum:g,setSkipAdditionalBankDetails:_,skipAdditionalBankDetails:B,parentComponent:S}),L&&(0,d.jsx)(c.zz,{my:3,color:"red",fontSize:[1,2],children:L}),p&&(0,d.jsx)(c.zz,{my:3,color:"red",fontSize:[1,2],children:p}
1),(0,d.jsxs)(c.so,{my:[4,4,4,null],mt:[null,null,"20px auto 0"],children:[(0,d.jsx)(c.Y0,{secondary:!0,onClick:e=>(e=>{e.preventDefault(),$(),"ContributionDetails"===P.key&&(w||B)?E(O-2):1===O?s():E(O-1)})(e),text:"Back",type:"button",flex:"1",bg:c.w4.colors.white}),(0,d.jsx)(c.Y0,{primary:!0,type:"submit",text:"Next",bg:c.w4.colors.primary,flex:"2",ml:3,loading:k})]})]}),T&&(0,d.jsx)(wr,{setShowCancelationModal:F})]})},Cr=e=>{let t=e.contactNumber,r=e.dropoutReference,i=e.response,o=e.responseTitle,a=e.advisorHub;const l=(0,n.Zp)(),s=a?"The unique reference for this application is:":"If you would like to discuss this further, please contact us on ".concat(t," and quote the following unique reference :");return(0,d.jsxs)(c.so,{flexDirection:"column",width:"100%",minHeight:"500px",flex:1,justifyContent:"space-evenly",alignItems:"center",py:5,children:[(0,d.jsx)(c.jK,{icon:"clipboard-x",iconSize:"100px",heading:o||"Sorry we are unable to proceed",text:i||"Your application is with our team.",as:"h3",color:c.w4.colors.secondary}),r&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(c.zz,{fontSize:[2,3],pt:4,color:c.w4.colors.secondary,children:s}),(0,d.jsx)(c.zz,{fontSize:[2,3],pb:4,fontWeight:1,children:r})]}),(0,d.jsx)(c.so,{width:"100%",justifyContent:"center",children:(0,d.jsx)(c.Y0,{primary:!0,onClick:()=>l("/"),text:"Back",bg:c.w4.colors.primary,flex:"0.5"})})]})};var Or=r(3539),Er=r(8238);const Nr=r.p+"static/media/error.782248760e3e9797f3ea58db83993c9c.svg";function Pr(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,a,l=[],s=!0,c=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=o.call(r)).done)&&(l.push(n.value),l.length!==t);s=!0);}catch(e){c=!0,i=e}finally{try{if(!s&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw i}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Dr(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Dr(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Dr(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}const Ir={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"NON_GEOGRAPHICAL_EMPLOYER_PARTNERS"},variableDefinitions:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"getNonGeographicalEmployerPartners"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"displayName"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"reference"},arguments:[],directives:[]}]}}]}}],loc:{start:0,end:118,source:{body:"query NON_GEOGRAPHICAL_EMPLOYER_PARTNERS {\n getNonGeographicalEmployerPartners {\n displayName\n reference\n }\n}\n",name:"GraphQL request",locationOffset:{line:1,column:1}}}},Lr=e=>{let t=e.backStep,r=e.onClick,n=e.setFieldValue;const o=Pr((0,i.useState)(),2),a=o[0],l=o[1],s=(0,Er.IT)(Ir,{fetchPolicy:"network-only"}),u=s.data,m=s.loading,y=s.error,f=s.refetch;if(m||!u)return null;if(y)return(0,d.jsxs)(c.so,{className:"form-wrapper",children:[(0,d.jsxs)(c.so,{className:"join-triage-error",children:[(0,d.jsxs)(c.Gw,{mb:5,as:"h5",textAlign:"center",children:["Something went wrong.",(0,d.jsx)("br",{})," Please refresh the page and try again"]}),(0,d.jsx)("img",{src:Nr,alt:""})]}),(0,d.jsxs)(c.so,{justifyContent:"space-around",width:"100%",mt:5,children:[(0,d.jsx)(c.Y0,{type:"button",className:"secondary",secondary:!0,onClick:()=>t(),text:"Back",bg:c.w4.colors.white,flex:1}),(0,d.jsx)(c.Y0,{type:"submit",loading:m,primary:!0,onClick:async()=>{await f()},text:"Reload",bg:c.w4.colors.primary,flex:2,ml:3})]})]});const p=u.getNonGeographicalEmployerPartners.map(e=>({value:e.reference,label:e.displayName}));return p.push({value:"NO",label:"Not Applicable"}),(0,d.jsxs)("div",{className:"qualification-triage-container",children:[(0,d.jsx)(c.DZ,{as:"h3",color:"#363636",fontWeight:0,textAlign:"center",children:"Do you qual
1ify for a membership?"}),(0,d.jsxs)("div",{className:"triage-form-content",children:[(0,d.jsx)(c.Gw,{mb:52,as:"h5",children:"Do you work for one of these employers?"}),(0,d.jsx)(c.l6,{scrollable:!0,required:!0,isDisabled:!1,options:p,onChange:e=>l(e),value:p.find(e=>e.value===(null===a||void 0===a?void 0:a.value))||"",title:void 0,titleColor:void 0,placeholder:"Please select your employer"}),(0,d.jsx)(c.Gw,{mt:3,fontSize:1,children:"Please select your employer or organisation you are a member of."}),(0,d.jsx)(c.Gw,{mt:1,fontSize:1,children:"If you do not work for or are not a member of any of the listed organisations, please select 'Not Applicable'"})]}),(0,d.jsxs)("div",{className:"triage-button-container",children:[(0,d.jsx)(c.Y0,{type:"button",className:"secondary",secondary:!0,onClick:()=>t(),text:"Back",bg:c.w4.colors.white,flex:1}),(0,d.jsx)(c.Y0,{type:"submit",loading:m,primary:!0,onClick:()=>{a&&("NO"===a.value?r(2):(n("nonGeoEmployerPartner",{name:a.value}),r(1)))},text:"Continue",bg:c.w4.colors.primary,flex:2,ml:3})]})]})},Rr=()=>{const e=(0,n.Zp)();return(0,d.jsxs)("div",{className:"qualification-triage-container",children:[(0,d.jsx)(c.DZ,{as:"h3",color:"#363636",fontWeight:0,textAlign:"center",children:"Unfortunatley, you can\u2019t join our credit union"}),(0,d.jsx)(c.zz,{as:"h5",mt:2,fontSize:3,textAlign:"center",children:"Based on the information you have given us you can\u2019t become a member"}),(0,d.jsx)(c.zz,{mt:2,fontSize:2,textAlign:"center",children:"Membership is only open to people that have a common bond. There may be other local credit unions in your area which you can join"}),(0,d.jsx)(c.so,{className:"triage-button-container",justifyContent:"center",children:(0,d.jsx)(c.Y0,{type:"submit",primary:!0,onClick:()=>{e("/")},text:"Exit",bg:c.w4.colors.primary,flex:.5})})]})},Mr=e=>{let t=e.onClick;return(0,d.jsxs)("div",{className:"qualification-triage-container",children:[(0,d.jsx)(c.DZ,{as:"h3",color:"#363636",fontWeight:0,textAlign:"center",children:"Congratulations, you qualify for membership"}),(0,d.jsx)(c.zz,{as:"h5",mt:2,fontSize:3,textAlign:"center",children:"Based on the information you have given us you can become a member"}),(0,d.jsx)(c.zz,{mt:2,fontSize:2,textAlign:"center",children:"We\u2019ve got a few more questions for you before we can open your account"}),(0,d.jsx)(c.so,{className:"triage-button-container",justifyContent:"center",children:(0,d.jsx)(c.Y0,{type:"submit",primary:!0,onClick:()=>t(),text:"Continue",bg:c.w4.colors.primary,flex:.5})})]})};function Tr(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,a,l=[],s=!0,c=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=o.call(r)).done)&&(l.push(n.value),l.length!==t);s=!0);}catch(e){c=!0,i=e}finally{try{if(!s&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw i}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Fr(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Fr(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Fr(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}const qr=e=>{let t=e.backStep,r=e.onClick,n=e.checkPostCodeMutation,o=e.loading,a=e.setFieldValue;const l=Tr((0,i.useState)(""),2),s=l[0],u=l[1],m=Tr((0,i.useState)(""),2),y=m[0],f=m[1],p=Tr((0,i.useState)(!1),2),h=p[0],b=p[1],g=async()=>{if(s)try{const e=await n({variables:{postCode:s}}),t=e.data.checkPreRegistrationPostcode.isValid;a("homePostcode",s),r(t?3:1)}catch(t){var e;a("homePostcode",null);const r=((null===t||void 0===t||null===(e=t.graphQLErrors)||void 0===e||null===(e=e[0])||void 0===e?void 0:e.extensions)||{}).code;
1r&&"INVALID_POSTCODE"===r?b(!0):f(!0)}};return!h&&y?(0,d.jsxs)("div",{className:"error-container",children:[(0,d.jsxs)(c.Gw,{mb:5,as:"h5",textAlign:"center",children:["Something went wrong. ",(0,d.jsx)("br",{}),"Please use the button to re-submit your information"]}),(0,d.jsx)("div",{children:(0,d.jsx)("img",{src:Nr,alt:""})}),(0,d.jsxs)(c.so,{justifyContent:"space-around",width:"100%",mt:5,children:[(0,d.jsx)(c.Y0,{type:"button",className:"secondary",secondary:!0,onClick:()=>t(),text:"Back",bg:c.w4.colors.white,flex:1}),(0,d.jsx)(c.Y0,{type:"submit",loading:o,primary:!0,onClick:async()=>{await g()},text:"Reload",bg:c.w4.colors.primary,flex:2,ml:3})]})]}):(0,d.jsxs)("div",{className:"qualification-triage-container",children:[(0,d.jsx)(c.DZ,{as:"h3",fontWeight:0,textAlign:"center",children:"Do you qualify for a membership?"}),(0,d.jsxs)("div",{className:"triage-form-content",children:[(0,d.jsx)(c.Gw,{as:"h5",children:"Tell us your Home Postcode"}),(0,d.jsx)("input",{className:h?"postcode-input error":"postcode-input",required:!0,id:"postcode",type:"text",maxLength:8,minLength:5,value:s.toUpperCase(),onChange:e=>{b(!1),f(""),u(e.target.value.replace(/[^a-z\d\s]+/gi,""))}}),(0,d.jsx)(c.Gw,{mt:2,mb:2,fontSize:1,children:"This is the postcode for your main residential address. If you have multiple residences, enter the postcode where you live for most of the year"}),(0,d.jsx)(c.az,{style:{height:"20px",marginBottom:"32px"},children:h&&(0,d.jsx)(c.Gw,{lineHeight:0,mt:0,fontSize:1,color:c.w4.colors.deleteRed,children:"Please enter a valid postcode"})})]}),(0,d.jsxs)("div",{className:"triage-button-container",children:[(0,d.jsx)(c.Y0,{type:"button",className:"secondary",secondary:!0,onClick:()=>t(),text:"Back",bg:c.w4.colors.white,flex:1}),(0,d.jsx)(c.Y0,{type:"submit",loading:o,primary:!0,onClick:async()=>{await g()},text:"Continue",bg:c.w4.colors.primary,flex:2,ml:3})]})]})};function Vr(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,a,l=[],s=!0,c=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=o.call(r)).done)&&(l.push(n.value),l.length!==t);s=!0);}catch(e){c=!0,i=e}finally{try{if(!s&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw i}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Yr(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Yr(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Yr(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}const Ur=e=>{let t=e.backStep,r=e.onClick,n=e.checkPostCodeMutation,o=e.loading,a=e.setFieldValue;const l=Vr((0,i.useState)(""),2),s=l[0],u=l[1],m=Vr((0,i.useState)(""),2),y=m[0],f=m[1],p=Vr((0,i.useState)(!1),2),h=p[0],b=p[1],g=Vr((0,i.useState)(!1),2),v=g[0],x=g[1],j=async()=>{if(v)r(3);else if(s||v)try{const e=await n({variables:{postCode:s}}),t=e.data.checkPreRegistrationPostcode.isValid;a("employerPostcode",s),r(t?2:1)}catch(t){var e;a("employerPostcode",null);const r=(null===t||void 0===t||null===(e=t.graphQLErrors)||void 0===e||null===(e=e[0])||void 0===e?void 0:e.extensions).code;r&&"INVALID_POSTCODE"===r?b(!0):f(!0)}};return!h&&y?(0,d.jsxs)("div",{className:"error-container",children:[(0,d.jsxs)(c.Gw,{mb:5,as:"h5",textAlign:"center",children:["Something went wrong. ",(0,d.jsx)("br",{}),"Please use the button to re-submit your information"]}),(0,d.jsx)("div",{children:(0,d.jsx)("img",{src:Nr,alt:""})}),(0,d.jsxs)(c.so,{justifyContent:"space-around",width:"100%",mt:5,children:[(0,d.jsx)(c.Y0,{type:"button",className:"secondary",secondary:!0,onClick:()=>t(),text:"Back",bg:c.w4.colors.white,flex:1}),(0,d.jsx)(c.Y0,{type:"submit",loading:o,primary:!0,onClick:async()=>{await j()},text:"Reload",bg:c.w4.colors.primary,flex:2,ml:3})]})]}):(0,d.jsxs)("div",{className:"qualification-triage-container",children:[(0,d.jsx)(c.DZ,{as:"h3",fontWeight:0,textAlign:"center",children:"Do you qual
1ify for a membership?"}),(0,d.jsxs)("div",{className:"triage-form-content",children:[(0,d.jsx)(c.Gw,{className:v?"unemployed":"",as:"h5",children:"Tell us your Employer's Postcode"}),(0,d.jsx)("input",{disabled:v,className:h?"postcode-input error":"postcode-input",required:!v,id:"postcode",type:"text",maxLength:8,minLength:5,value:s.toUpperCase(),onChange:e=>{b(!1),f(""),u(e.target.value.replace(/[^a-z\d\s]+/gi,""))}}),(0,d.jsx)(c.Gw,{className:v?"unemployed":"",mt:2,mb:2,fontSize:1,children:"This is the postcode for your workplace. If you work at multiple locations, enter the postcode for the location where you work most often"}),(0,d.jsx)(c.az,{style:{height:"20px"},children:h&&(0,d.jsx)(c.Gw,{lineHeight:0,mt:0,fontSize:1,color:c.w4.colors.deleteRed,children:"Invalid post code format"})}),(0,d.jsxs)(c.ph,{children:[(0,d.jsx)("input",{type:"checkbox",checked:v,onChange:()=>{u(""),x(e=>!e)}}),(0,d.jsx)("span",{}),(0,d.jsx)(c.zz,{m:"0",fontSize:2,ml:2,children:"I am not currently employed"})]})]}),(0,d.jsxs)("div",{className:"triage-button-container",children:[(0,d.jsx)(c.Y0,{type:"button",className:"secondary",secondary:!0,onClick:()=>t(),text:"Back",bg:c.w4.colors.white,flex:1}),(0,d.jsx)(c.Y0,{type:"submit",loading:o,primary:!0,onClick:async()=>{await j()},text:"Continue",bg:c.w4.colors.primary,flex:2,ml:3})]})]})};function Br(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,a,l=[],s=!0,c=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=o.call(r)).done)&&(l.push(n.value),l.length!==t);s=!0);}catch(e){c=!0,i=e}finally{try{if(!s&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw i}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return _r(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_r(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _r(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}const zr={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"CHECK_POSTCODE_MUTATION"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"postCode"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},directives:[]}],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"checkPreRegistrationPostcode"},arguments:[{kind:"Argument",name:{kind:"Name",value:"postCode"},value:{kind:"Variable",name:{kind:"Name",value:"postCode"}}}],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"isValid"},arguments:[],directives:[]}]}}]}}],loc:{start:0,end:127,source:{body:"mutation CHECK_POSTCODE_MUTATION($postCode: String!) {\n checkPreRegistrationPostcode(postCode: $postCode) {\n isValid\n }\n}\n",name:"GraphQL request",locationOffset:{line:1,column:1}}}},$r=e=>{let t=e.setFieldValue,r=e.changeStep,n=e.backStep;const o=Br((0,i.useState)(0),2),a=o[0],l=o[1],s=function(){l(a+(arguments.length>0&&void 0!==arguments[0]?arguments[0]:1))},u=function(){l(a-(arguments.length>0&&void 0!==arguments[0]?arguments[0]:1))},m=Br((0,Or.n)(zr,{notifyOnNetworkStatusChange:!0}),2),y=m[0],f=m[1].loading;return(0,d.jsxs)("div",{className:"join-triage",children:[(0,d.jsx)("form",{className:"triage-form",onSubmit:e=>{e.preventDefault()},children:(()=>{switch(a){case 0:return(0,d.jsx)(gt,{onClick:s,setFieldValue:t});case 1:return(0,d.jsx)(qr,{backStep:u,onClick:s,checkPostCodeMutation:y,loading:f,setFieldValue:t});case 2:return(0,d.jsx)(Ur,{backStep:u,onClick:s,checkPostCodeMutation:y,loading:f,setFieldValue:t});case 3:return(0,d.jsx)(Lr,{backStep:u,onClick:s,setFieldValue:t});case 4:return(0,d.jsx)(Mr,{onClick:r});case 5:return(0,d.jsx)(Rr,{});default:return(0,d.jsx)(gt,{backStep:n,onClick:s,setFieldValue:t})}})()}),(0,d.jsx)("div",{children:(0,d.jsxs)(c.zz,{textAlign:"center",fontSize:1,m:2,children:["Find out more about joining by reading our",(0,d.jsxs)(c.ah,{textAlign:"center",noDec:!0,href:"https://www.glasgowcu.com/info/",color:c.w4.colors.primary,cursor:"pointer",fontSize:[1,1],lineHeight:2,children:[" ","About Us page"]})]})})]})};var Gr=r(1584),Hr=r.n(Gr),Wr=r(8852),Kr=r(8485),Zr=r(6406);function Qr(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function Jr(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};
1t%2?Qr(Object(r),!0).forEach(function(t){Xr(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Qr(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function Xr(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function en(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,a,l=[],s=!0,c=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=o.call(r)).done)&&(l.push(n.value),l.length!==t);s=!0);}catch(e){c=!0,i=e}finally{try{if(!s&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw i}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return tn(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?tn(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function tn(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}const rn={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"JOIN_AND_BORROW_QUERY"},variableDefinitions:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"getCreditUnion"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"phoneNumber"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"openingTime"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"closingTime"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"openDays"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"termsAndConditionsUrls"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"title"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"url"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"key"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"processKeys"},arguments:[],directives:[]}]}},{kind:"Field",name:{kind:"Name",value:"payrollEmployers"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"name"},arguments:[],directives:[]}]}},{kind:"Field",name:{kind:"Name",value:"employmentCategories"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"name"},arguments:[],directives:[]}]}},{kind:"Field",name:{kind:"Name",value:"globalRules"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"directDebitMandateDays"},arguments:[],directives:[]}]}},{kind:"Field",name:{kind:"Name",value:"qualifications"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"minimumJoiningAge"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"directDebitAgreement"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"phoneNumber"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"websiteUrl"},arguments:[],directives:[]}]}}]}}],loc:{start:0,end:435,source:{body:"query JOIN_AND_BORROW_QUERY {\n getCreditUnion {\n phoneNumber\n openingTime\n closingTime\n openDays\n termsAndConditionsUrls {\n title\n url\n key\n processKeys\n }\n payrollEmployers {\n name\n }\n employmentCategories {\n name\n }\n globalRules {\n directDebitMandateDays\n }\n qualifications\n minimumJoiningAge\n directDebitAgreement\n phoneNumber\n websiteUrl\n }\n}\n",name:"GraphQL request",locationOffset:{line:1,column:1}}}},nn={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"GET_ADDRESSES_QUERY"}
1,variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"postcode"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},directives:[]}],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"getAddresses"},arguments:[{kind:"Argument",name:{kind:"Name",value:"postcode"},value:{kind:"Variable",name:{kind:"Name",value:"postcode"}}}],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"flat"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"houseName"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"houseNumber"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"addressLine1"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"addressLine2"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"county"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"townCity"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"postcode"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"summaryLine"},arguments:[],directives:[]}]}}]}}],loc:{start:0,end:218,source:{body:"query GET_ADDRESSES_QUERY($postcode: String!) {\n getAddresses(postcode: $postcode) {\n flat\n houseName\n houseNumber\n addressLine1\n addressLine2\n county\n townCity\n postcode\n summaryLine\n }\n}\n",name:"GraphQL request",locationOffset:{line:1,column:1}}}},on={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"CREATE_MEMBER_MUTATION"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"userDetails"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"UserInput"}}},directives:[]}],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"joinCreditUnion"},arguments:[{kind:"Argument",name:{kind:"Name",value:"userDetails"},value:{kind:"Variable",name:{kind:"Name",value:"userDetails"}}}],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"memberNumber"},arguments:[],directives:[]}]}}]}}],loc:{start:0,end:130,source:{body:"mutation CREATE_MEMBER_MUTATION($userDetails: UserInput!) {\n joinCreditUnion(userDetails: $userDetails) {\n memberNumber\n }\n}\n",name:"GraphQL request",locationOffset:{line:1,column:1}}}},an={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"VALIDATE_USER_DETAILS_EXTERNALLY"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"validationData"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"ValidationInput"}}},directives:[]}],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"validateUserDetailsWithExternalParties"},arguments:[{kind:"Argument",name:{kind:"Name",value:"validationData"},value:{kind:"Variable",name:{kind:"Name",value:"validationData"}}}],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"success"},arguments:[],directives:[]}]}}]}}],loc:{start:0,end:173,source:{body:"mutation VALIDATE_USER_DETAILS_EXTERNALLY($validationData: ValidationInput!) {\n validateUserDetailsWithExternalParties(validationData: $validationData) {\n success\n }\n}\n",name:"GraphQL request",locationOffset:{line:1,column:1}}}},ln={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"CHECK_EXISTING_MEMBER"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"memberDetails"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"ExistingMemberInput"}}},directives:[]}],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"checkExistingMember"},arguments:[{kind:"Argument",name:{kind:"Name",value:"memberDetails"},value:{kind:"Variable",name:{kind:"Name",value:"memberDetails"}}}],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"memberExists"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"reference"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"memberNumber"},arguments:[],directives:[]}]}}]}}],loc:{start:0,end:177,source:{body:"query CHECK_EXISTING_MEMBER($memberDetails: ExistingMemberInput!) {\n checkExistingMember(memberDetails: $memberDetails) {\n memberExists\n reference\n memberNumber\n }\n}\n",name:"GraphQL request",locationOffset:{line:1,column:1}}}},sn={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"CHECK_CONTRIBUTIONS_REQUIREMENTS"}
1,variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"contributionAmount"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"Int"}}},directives:[]}],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"checkContributionRequirements"},arguments:[{kind:"Argument",name:{kind:"Name",value:"contributionAmount"},value:{kind:"Variable",name:{kind:"Name",value:"contributionAmount"}}}],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"isValidContribution"},arguments:[],directives:[]}]}}]}}],loc:{start:0,end:173,source:{body:"query CHECK_CONTRIBUTIONS_REQUIREMENTS($contributionAmount: Int!) {\n checkContributionRequirements(contributionAmount: $contributionAmount) {\n isValidContribution\n }\n}\n",name:"GraphQL request",locationOffset:{line:1,column:1}}}},cn=Pt(qt),un=()=>{const e=(0,n.Zp)(),t=en((0,i.useState)({}),2),r=t[0],o=t[1],a=en((0,i.useState)(null),2),l=a[0],s=a[1],u=en((0,i.useState)(1),2),m=u[0],y=u[1],f=en((0,i.useState)(""),2),p=f[0],b=f[1],g=en((0,i.useState)(""),2),v=g[0],x=g[1],j=en((0,i.useState)(""),2),w=j[0],k=j[1],S=en((0,i.useState)(""),2),A=S[0],C=S[1],O=en((0,i.useState)(!1),2),E=O[0],N=O[1],P=en((0,i.useState)(),2),D=P[0],I=P[1],L=en((0,i.useState)(),2),R=L[0],M=L[1],T=en((0,i.useState)(!1),2),F=T[0],q=T[1];(0,i.useEffect)(()=>{(async()=>{const e=(await Kr.A.query({query:rn})).data.getCreditUnion;k(e),I(e.termsAndConditionsUrls)})()},[]);const V=()=>{y(m+1)},Y=()=>{y(m-1)},U=(e,t)=>{if(A&&C(""),t)o(Jr(Jr({},r),{},{[e]:t}));else{const t=JSON.parse(JSON.stringify(r));delete t[e],o(t)}},B=async e=>{try{const t=(await Kr.A.query({query:nn,variables:{postcode:e}})).data;return t.getAddresses}catch(t){return t}},_=async()=>{C(""),h().extend(Hr());const t=h()(r.dateOfBirth,"DD-MM-YYYY").format("DD-MM-YYYY"),n=await(0,Wr.qk)(r);try{N(!0);const i=await Kr.A.mutate({mutation:on,variables:{userDetails:n}}),o=i.data.joinCreditUnion.memberNumber;if(o){const n=(0,re.Tf)(r.userAgreements,re.x6.JOIN);e("/register",{state:{stepNumber:3,member:o,userDob:t,userEmail:r.emailAddress,userMobileNumber:r.mobileNumber,userNiNumber:r.nationalInsuranceNumber,userAgreements:n}})}}catch(a){const e=a.graphQLErrors;if(null!==e&&void 0!==e&&e.length){var i;const t=e[0],r=t.extensions,n=t.message;if("IDV_REFER"===(null===r||void 0===r||null===(i=r.exception)||void 0===i?void 0:i.key)){const e=n.title,t=n.bodyText;b(t),x(e),y(6)}else C(null!==n&&void 0!==n?n:"An error has occurred, please try again later."),N(!1)}else{var o;C(null!==(o=a.message)&&void 0!==o?o:"An error has occurred, please try again later."),N(!1)}}},z=async e=>{C("");const t=e.reduce((e,t)=>{const r=t.value,n=t.externalValidationKey;if("accountNumber"===n||"sortCode"===n||"accountHolderName"===n||"accountBankName"===n){const t=e.bankAccounts[0];e.bankAccounts[0]=Jr(Jr({},t),{},{primaryAccount:!0,[n]:r})}else if("accountNumber2"===n||"sortCode2"===n||"accountHolderName2"===n||"accountBankName2"===n){const t=e.bankAccounts[1];e.bankAccounts[1]=Jr(Jr({},t),{},{primaryAccount:!1,[n]:r})}else e[n]=r;return e},{bankAccounts:[]}),n={firstName:r.firstName,lastName:r.lastName},i=Jr(Jr({},t),n);try{N(!0);const e=await Kr.A.mutate({mutation:an,variables:{validationData:i}}),t=e.data.validateUserDetailsWithExternalParties.success;return N(!1),t}catch(o){return C(o.graphQLErrors[0]?o.graphQLErrors[0].message:"An error has occurred, please try again later."),N(!1),!1}},$=async e=>{const t=await(async()=>{try{N(!0);const e=r.nationalInsuranceNumber,t=r.firstName,n=r.lastName,i=r.dateOfBirth,a=r.emailAddress,l=h()(i,"DD-MM-YYYY").format("YYYY-MM-DD"),s=(await Kr.A.query({query:ln,variables:{memberDetails:{nationalInsuranceNumber:e,firstName:t,lastName:n,dateOfBirth:l,emailAddress:a}}})).data.checkExistingMember,c=s.memberExists,u=s.reference,d=s.memberNumber;if(d){const e=r;e.memberNumber=d,o(e)}else if(c)return M(u),N(!1),!1;return N(!1),!0}catch(n){var e,t;return C(null!==(e=null===n||void 0===n||null===(t=n.graphQLErrors[0])||void 0===t?void 0:t.message)&&void 0!==e?e:"An error has occurred, please try again later."),N(!1),!1}})();if("AboutYou"===e.key){return{passedExistingMemberCheck:t,hasValidNameOrNumber:!0,hasValidHomeOrMobile:r.phoneNumber||r.mobileNumber}}
1if("HomeAddressDetails"===e.key){return{passedExistingMemberCheck:!0,hasValidNameOrNumber:await r.homeAddresses.some(e=>e.houseName||e.houseNumber),hasValidHomeOrMobile:!0}}if("EmploymentDetails"===e.key&&e.isRequiredByStep){const t=(e=>{const t=e.fieldKeyToValidate,n=e.requiredFieldKey,i=e.requiredValues,o=e.valueToSetIfNotValid,a=r[t],l=!i.includes(a);return l&&(r[n]=o),l})(e.isRequiredByStep);return q(t),{passedExistingMemberCheck:!0,hasValidNameOrNumber:!0,skipContributionSelection:t,hasValidHomeOrMobile:!0}}if("ContributionDetails"===e.key){return{passedExistingMemberCheck:!0,hasValidNameOrNumber:!0,hasValidHomeOrMobile:!0,contributionIsValid:await(async()=>{try{N(!0);const e=r.contributionAmount,t=(await Kr.A.query({query:sn,variables:{contributionAmount:(0,Zr.Rx)(e)}})).data.checkContributionRequirements.isValidContribution;return N(!1),t}catch(n){var e,t;return C(null!==(e=null===n||void 0===n||null===(t=n.graphQLErrors[0])||void 0===t?void 0:t.message)&&void 0!==e?e:"An error has occurred, please try again later."),N(!1),!1}})()}}return{passedExistingMemberCheck:!0,hasValidNameOrNumber:!0,hasValidHomeOrMobile:!0}};return(0,d.jsxs)(ht.a,{theme:c.w4,children:[(0,d.jsx)(c.zy,{}),(0,d.jsx)(c.az,{width:"100%",bg:"#FFFFFF",flex:"1",p:[0,5],children:(()=>{switch(m){case 1:default:return(0,d.jsx)($r,{setFieldValue:U,changeStep:V});case 2:return(0,d.jsx)(St,{termsAndConditionsUrls:D,onClick:V,backStep:Y,setFieldValue:U});case 3:return(0,d.jsx)(Ar,{title:"Joining Application",flattenedForm:cn,formStep:l,setFormStep:s,backStep:Y,formData:r,onClick:V,setFieldValue:U,getAllAddresses:B,joinAndBorrowDetails:w,performExternalValidation:z,setExternalValidationError:C,externalValidationError:A,preNavigationHook:$,agreementProcessEnum:re.x6,setStep:y,loading:E,contributionSelectionSkipped:F,parentComponent:"members"});case 4:return(0,d.jsx)(Yt,{setFormStep:s,form:qt,onClick:_,formData:r,backStep:Y,errorMessage:A,setErrorMessage:C,loading:E,parentComponent:"members"});case 5:return(0,d.jsx)(Ut,{});case 6:return(0,d.jsx)(Cr,{contactNumber:w.phoneNumber,dropoutReference:R,response:p,responseTitle:v})}})()})]})};var dn=r(4577);const mn=()=>{const e=(0,n.Zp)();return(0,d.jsx)("div",{className:"bg-white h-full w-full flex flex-col justify-center items-center",children:(0,d.jsxs)("div",{className:"mx-10",children:[(0,d.jsx)(c.EY,{className:"text-2xl text-center mb-20",children:"You have been logged out due to inactivity"}),(0,d.jsx)(c.e2,{primary:(0,d.jsx)(c.$n,{onClick:()=>{e("/login")},children:"Log In"}),secondary:(0,d.jsx)(c.$n,{onClick:()=>{e("/")},children:"Back"})})]})})};function yn(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,a,l=[],s=!0,c=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=o.call(r)).done)&&(l.push(n.value),l.length!==t);s=!0);}catch(e){c=!0,i=e}finally{try{if(!s&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw i}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return fn(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?fn(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function fn(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}const pn=()=>{const e=(0,n.zy)(),t=yn((0,n.ok)(),1)[0],r=t.get("id"),o=r&&24===r.length&&/^[a-z0-9]+$/i.test(r);return(0,i.useEffect)(()=>{if(o){const t="".concat("gcu-mobile://").concat(window.location.hostname).concat(e.pathname,"?id=").concat(r);setTimeout(()=>{window.location.replace(t)},5e3)}},[r,o,e.pathname]),(0,d.jsxs)("div",{className:"flex flex-1 flex-col justify-center items-center bg-white text-center p-5 px-10",children:[(0,d.jsx)(c.fV,{variant:"h2",children:"Thank y
1ou for using Bank Pay to make your deposit"}),o?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:"my-12",children:(0,d.jsx)(c.kt,{})}),(0,d.jsx)(c.EY,{className:"mb-0",children:"We are attempting to redirect you automatically."}),(0,d.jsx)(c.EY,{children:"Alternatively, you can close this screen and reopen the Glasgow Credit Union mobile app."})]}):(0,d.jsx)(c.EY,{children:"You can close this screen and reopen the Glasgow Credit Union mobile app."})]})};var hn=r(1538),bn=r(325);const gn=e=>{let t=e.goCardlessPrivacyUrl,r=e.onInformation;return(0,d.jsxs)("div",{className:"text-center pb-24 pl-8 pr-8",children:[(0,d.jsxs)(c.EY,{className:"text-sm m-1",children:["Payments securely processed by GoCardless. GoCardless Ltd (company registration number 07495895) is authorised by the Financial Conduct Authority under the Payment Services Regulations 2017, registration number 597190, for the provision of payment services. GoCardless uses personal data as described in their",(0,d.jsx)(c.$n,{variant:"link",size:"link",onClick:()=>{var e;return null===(e=window.open(t,"_blank"))||void 0===e?void 0:e.focus()},children:(0,d.jsx)(c.EY,{className:"text-sm m-1",children:"Privacy Notice."})})," "]}),(0,d.jsx)(c.$n,{variant:"link",size:"link",onClick:()=>r(),children:(0,d.jsx)(c.EY,{className:"text-sm m-1",children:"Learn more about Bank Pay and GoCardless"})})]})};function vn(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,a,l=[],s=!0,c=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=o.call(r)).done)&&(l.push(n.value),l.length!==t);s=!0);}catch(e){c=!0,i=e}finally{try{if(!s&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw i}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return xn(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?xn(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function xn(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}const jn=e=>{let t=e.onDateOfBirth,r=e.onMemberNumber,n=e.onContinue,o=e.onBack,a=e.isLoanRepayment,l=e.paymentRequestRef,s=e.loanTermsAndConditionsUrl,u=e.gcuPrivacyPolicyUrl,m=e.memberNumber,y=e.dateOfBirth,f=e.canContinue;const p=vn((0,i.useState)(""),2),h=p[0],b=p[1],g=vn((0,i.useState)(!1),2),v=g[0],x=g[1],j=vn((0,S.zYI)({notifyOnNetworkStatusChange:!0,fetchPolicy:"no-cache"}),2),w=j[0],k=j[1].loading,A=async()=>{x(!1);const e=await w({variables:{paymentRequestRef:l,memberNumber:m,dateOfBirth:y},fetchPolicy:"no-cache"}),t=e.data,r=e.error;if(r){const e=(0,re.u$)(r),t=e.code,n=e.message;return void(t&&"INTERNAL_SERVER_ERROR"!==t?b(n):x(!0))}if(t&&t.getMemberPayIntent.paymentAmount){const e=t.getMemberPayIntent,r=e.paymentAmount,i=e.productName;n({paymentAmount:r,productName:i})}else n({})};return k?(0,d.jsx)(c.kt,{}):v&&!h?(0,d.jsx)(c.W5,{subHeading:"There has been an error processing your request",retry:{action:async()=>await A()}}):(0,d.jsx)(bn.A,{title:a?"Settle your loan":"Make a one off payment",children:(0,d.jsx)("div",{className:"flex lg:h-[calc(100vh-4rem)] flex-col justify-between -mt-[4rem]",children:(0,d.jsxs)("div",{className:"flex flex-col justify-between h-full ",children:[(0,d.jsxs)("div",{className:"flex flex-col justify-between h-full",children:[(0,d.jsxs)("div",{className:"flex flex-col justify-between h-[65%]",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)(c.EY,{className:"font-bold",children:a?"You\u2019ve requested to settle your loan with Glasgow Credit Union.":"You\u2019ve requested to make a one off payment into your Glasgow Credit Union account."}),(0,d.jsx)(c.EY,{children:"This process will use our BankPay service. To continue you will need:"}),(0,d.jsx)("div",{className:"pb-5",children:(0,d.jsx)(c.Pg,{type:"tick",items:[{content:"Your Glasgow Credit Union member number"},{content:"Your date of birth"},{content:"The Bank Account number and Sort Code you want to use for payment"}]})})]}),(0,d.jsxs)("div",{onFocus:()=>b(""),children:[(0,d.jsx)("div",{className:"py-10 md:w-1/2",children:(0,d.jsx)(c.$I,{value:m,onChange:e=>{e.target.value.length<=10&&r({memberNumber:e.target.value})},label:"Enter your member number",helperText:"Enter your Glasgow Credit Union member number so we can find your account",error:h?" ":"",type:"number"})}),(0,d.jsx)("div",{className:"py-10 md:w-1/2",children:(0,d.jsx)(c.$I,{onChange:e=>{t({dateOfBirth:e.target.value})},label:"Enter your date of birth",type:"date",options:M.bv,error:h,value:y})})]})]}),(0,d.jsx)(c.e2,{primary:(0,d.jsx)(c.$n,{onClick:()=>A(),disabled:!f,children:"Continue"}),secondary:(0,d.jsx)(c.$n,{onClick:()=>o(),children:"Back"})})]}),(0,d.jsxs)(c.EY,{className:"pt-5 text-sm",children:["By continuing, you agree to Glasgow Credit Union\u2019s"," ",(0,d.jsx)(c.$n,{variant:"link",size:"link",onClick:()=>{var e;return null===(e=window.open(s,"_blank"))||void 0===e?void 0:e.focus()},children:(0,d.jsx)(c.EY,{className:"text-sm",children:"Terms and Conditions"})})," ","and you confirm you have read Glasgow Credit Union\u2019s"," ",(0,d.jsx)(c.$n,{variant:"link",size:"link",onClick:()=>{var e;return null===(e=window.open(u,"_blank"))||void 0===e?void 0:e.focus()},children:(0,d.jsx)(c.EY,{className:"text-sm",children:"Privacy Notice"})})]})]})})})};function wn(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,a,l=[],s=!0,c=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=o.call(r)).done)&&(l.push(n.value),l.length!==t);s=!0);}catch(e){c=!0,i=e}
1finally{try{if(!s&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw i}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return kn(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?kn(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function kn(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}const Sn=e=>{let t=e.sourceOfFundsOptions,r=e.onSourceOfFunds;const n=wn((0,i.useState)(!1),2),o=n[0],a=n[1];return(0,d.jsxs)("div",{children:[(0,d.jsx)("div",{className:"md:w-1/2 pt-16",children:(0,d.jsx)(c.R6,{helperText:"We are required to collect this information to comply with the relevant laws and regulations that allow us to operate as a financial company.",label:"Please tell us the source of these funds",onValueChange:e=>{"OTHER"!==e?(a(!1),r({narrative:t.find(t=>t.value===e).label})):(r({narrative:""}),a(!0))},options:t.reduce((e,t)=>(e[t.value]=t.label,e),{}),defaultValue:""})}),o&&(0,d.jsx)("div",{className:"w-full pt-16",children:(0,d.jsx)(c.$I,{type:"text",maxLength:90,label:"Provide a brief description",onChange:e=>r({narrative:"Other- ".concat(e.target.value)})})})]})},An=e=>{let t=e.onContinue,r=e.onSourceOfFunds,n=e.onBack,i=e.productName,o=e.amount,a=e.sourceOfFundsOptions,l=e.requireSourceOfFundsNarrative,s=e.canContinue;return(0,d.jsx)(bn.A,{title:"Confirm settlement",children:(0,d.jsx)("div",{className:"flex lg:h-[70vh] flex-col justify-between -mt-[4rem]",children:(0,d.jsxs)("div",{className:"flex flex-col h-full justify-between",children:[(0,d.jsxs)("div",{children:[(0,d.jsxs)("div",{children:[(0,d.jsx)(c.EY,{className:"font-bold",children:"Your loan settlement figure is detailed below."}),(0,d.jsxs)(c.EY,{children:["This settlement value is only valid for today because we calculate and add interest daily to your loan account. This means that if you choose to settle the loan early you only pay interest until the date of settlement."," "]}),(0,d.jsx)(c.EY,{children:"We do not apply any interest penalties or early settlement fees on our loans."})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)(c.EY,{children:"Your settlement balance for your ".concat(i," is:")}),(0,d.jsx)(c.fV,{variant:"h1",className:"font-bold lg:py-20 py-10 text-center",children:(0,Zr.ye)(o)})]})]}),l&&(0,d.jsx)(Sn,{sourceOfFundsOptions:a,onSourceOfFunds:r}),(0,d.jsx)(c.e2,{className:"py-10",primary:(0,d.jsx)(c.$n,{disabled:!s,onClick:()=>t(),children:"Continue"}),secondary:(0,d.jsx)(c.$n,{onClick:()=>n(),children:"Back"})})]})})})};function Cn(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,a,l=[],s=!0,c=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=o.call(r)).done)&&(l.push(n.value),l.length!==t);s=!0);}catch(e){c=!0,i=e}finally{try{if(!s&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw i}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return On(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?On(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function On(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}const En=e=>{let t=e.onBack,r=e.onContinue,n=e.onSourceOfFunds,o=e.onAmount,a=e.maxSavingsDepositAmount,l=e.minSavingsDepositAmount,s=e.sourceOfFundsOptions,u=e.isValidAmount,m=e.requireSourceOfFundsNarrative,y=e.amount,f=e.canContinue;const p=Cn((0,i.useState)(""),2),h=p[0],b=p[1];return(0,d.jsx)(bn.A,{title:"Enter deposit amount",children:(0,d.jsxs)("div",{className:"flex flex-col h-full justify-between -mt-[4rem]",children:[(0,d.jsxs)("div",{className:"md:min-h-[450px]",children:[(0,d.jsx)(c.EY,{children:"How much do you want to deposit into your Member Savings Account?"}),(0,d.jsx)("div",{className:"md:pt-25 pt-16 md:w-1/2 min-h-[170px]",children:(0,d.jsx)(c.$I,{onFocus:()=>b(""),options:c.cl,value:y/100||"",type:"money",onChange:e=>o({amount:(0,Zr.Rx)(e.target.rawValue)}),label:"Deposit Amount",helperText:"Minimum deposit is ".concat((0,Zr.ye)(l,!0)," and maximum deposit is ").concat((0,Zr.ye)(a,!0)),error:h})}),m&&(0,d.jsx)(Sn,{sourceOfFundsOptions:s,onSourceOfFunds:n})]}),(0,d.jsx)(c.e2,{className:"py-10",primary:(0,d.jsx)(c.$n,{disabled:!f,onClick:()=>{u?r():b("Please enter a valid deposit amount")},children:"Continue"}),secondary:(0,d.jsx)(c.$n,{onClick:()=>t(),children:"Back"})})]})})};function Nn(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,a,l=[],s=!0,c=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=o.call(r)).done)&&(l.push(n.value),l.length!==t);s=!0);}catch(e){c=!0,i=e}
1finally{try{if(!s&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw i}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Pn(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Pn(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Pn(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}const Dn=e=>{let t=e.onContinue,r=e.onSortCode,n=e.onAccountNumber,o=e.onBack,a=e.memberNumber,l=e.narrative,s=e.sortCode,u=e.accountNumber,m=e.amount,y=e.paymentRequestRef,f=e.requireSourceOfFundsNarrative,p=e.canContinue;const h=Nn((0,i.useState)(""),2),b=h[0],g=h[1],v=Nn((0,i.useState)(!1),2),x=v[0],j=v[1],w=Nn((0,S.yHz)({notifyOnNetworkStatusChange:!0}),2),k=w[0],A=w[1].loading,C=async()=>{try{const e=(await k({variables:{sortCode:s,accountNumber:u,amount:m,memberNumber:a,paymentRequestRef:y,sourceOfFundsRequired:f,sourceOfFundsNarrative:l}})).data;if(e.createUnauthDeposit.depositAuditId){const r=e.createUnauthDeposit,n=r.hasGuessedInstitution,i=r.depositAuditId;t({hasGuessedInstitution:n,depositAuditId:i})}}catch(x){const t=(0,re.u$)(x),r=t.code,n=t.message;r&&"INTERNAL_SERVER_ERROR"!==r?g(n):j(!0)}};return A?(0,d.jsx)(c.kt,{}):x&&!b?(0,d.jsx)(c.W5,{subHeading:"There has been an error processing your request",retry:{action:async()=>C()}}):(0,d.jsx)(bn.A,{title:"Bank account details",children:(0,d.jsx)("div",{className:"flex lg:h-[70vh] flex-col justify-between -mt-[4rem]",children:(0,d.jsxs)("div",{className:"flex flex-col justify-between h-full",children:[(0,d.jsxs)("div",{className:"md:pb-20",children:[(0,d.jsx)(c.EY,{children:"Enter your bank account details for the account you wish to use to make your payment."}),(0,d.jsx)(c.EY,{className:"font-bold md:pb-20",children:"This account must be registered in your name."}),(0,d.jsx)("div",{className:"md:w-1/2 py-10",children:(0,d.jsx)(c.$I,{type:"number",onChange:e=>n({accountNumber:e.target.value}),value:u,label:"Account Number",helperText:"Enter your Bank Account Number",placeholder:"00000000",maxLength:8,options:{numericOnly:!0},error:b?" ":""})}),(0,d.jsx)("div",{className:"md:w-1/2 py-10",children:(0,d.jsx)(c.$I,{onChange:e=>r({sortCode:e.target.value}),value:s,label:"Sort Code",helperText:"Enter your Sort Code",type:"number",placeholder:"00-00-00",maxLength:8,options:{blocks:[2,2,2],delimiter:"-"},error:b||""})})]}),(0,d.jsx)(c.e2,{className:"md:py-10 pb-10",primary:(0,d.jsx)(c.$n,{disabled:!p,onClick:()=>C(),children:"Continue"}),secondary:(0,d.jsx)(c.$n,{onClick:()=>o(),children:"Back"})})]})})})};function In(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,a,l=[],s=!0,c=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=o.call(r)).done)&&(l.push(n.value),l.length!==t);s=!0);}catch(e){c=!0,i=e}finally{try{if(!s&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw i}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Ln(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Ln(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ln(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}const Rn=e=>{let t=e.onContinue,r=e.onInstitution,n=e.onBack,i=e.depositAuditId,o=e.institutionId;const a=(0,S.gXM)({variables:{depositAuditId:i},fetchPolicy:"network-only",notifyOnNetworkStatusChange:!0}),l=a.data,s=a.loading,u=a.error,m=a.refetch,y=In((0,S.kO7)(),2),f=y[0],p=y[1],h=p.loading,b=p.error,g=async()=>{try{const e=await f({variables:{depositAuditId:i,institutionId:o}});e.data.submitUnauthInstitution.success&&t()}catch(e){}};if(s||h)return(0,d.jsx)(c.kt,{});if(u||b||!l)return(0,d.jsx)(c.W5,{subHeading:"There has been an error processing your request",retry:{action:async()=>await(async()=>
1{if(u)try{await m()}catch(e){}else b&&await g()})()}});const v=l.getUnauthBankPayInstitutions.institutions.reduce((e,t)=>(Object.assign(e,{[t.id]:t.name}),e),{});return(0,d.jsx)(bn.A,{title:"Select your bank",children:(0,d.jsx)("div",{className:"flex lg:h-[70vh] flex-col justify-between -mt-[4rem]",children:(0,d.jsxs)("div",{className:"flex flex-col justify-between h-full ",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)(c.EY,{className:"font-bold",children:"Please select your bank from the list below."}),(0,d.jsx)(c.EY,{children:" We have been unable to automatically match your account details with your bank or building society."})]}),(0,d.jsx)(c.R6,{className:"py-20 md:py-40",options:v,onValueChange:e=>r({institutionId:e})}),(0,d.jsx)(c.e2,{className:"py-10",primary:(0,d.jsx)(c.$n,{disabled:!o,onClick:()=>g(),children:"Continue"}),secondary:(0,d.jsx)(c.$n,{onClick:()=>n(),children:"Back"})})]})})})};function Mn(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,a,l=[],s=!0,c=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=o.call(r)).done)&&(l.push(n.value),l.length!==t);s=!0);}catch(e){c=!0,i=e}finally{try{if(!s&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw i}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Tn(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Tn(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Tn(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}const Fn=e=>{let t=e.onContinue,r=e.onExit,n=e.onBack,i=e.depositAuditId,o=e.phoneNumber;const a=(0,S.rWn)({variables:{depositAuditId:i},notifyOnNetworkStatusChange:!0,fetchPolicy:"no-cache"}),l=a.data,s=a.loading,u=a.error,m=a.refetch,y=Mn((0,S.dA6)({notifyOnNetworkStatusChange:!0}),2),f=y[0],p=y[1],h=p.loading,b=p.error,g=async()=>{try{const e=await f({variables:{depositAuditId:i},notifyOnNetworkStatusChange:!0});e.data.confirmUnauthCustomerDetails.success&&t({name:"".concat(x," ").concat(j)})}catch(e){}};if(s||h)return(0,d.jsx)(c.kt,{});if(u||b){const e=(0,re.u$)(u||b),t=e.code,n=e.message;return t&&"INSUFFICIENT_DETAILS"===t?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(c.W5,{subHeading:n}),(0,d.jsx)("div",{className:"pb-12 w-1/2 self-center",children:(0,d.jsx)(c.$n,{className:"w-full",onClick:()=>r(),children:"Exit"})})]}):(0,d.jsx)("div",{className:"p-12",children:(0,d.jsx)(c.W5,{subHeading:"There has been an error processing your request",retry:{action:async()=>(async()=>{if(u)try{await m()}catch(e){}else b&&await g()})()}})})}const v=l.getUnauthMemberDetails,x=v.firstName,j=v.lastName,w=v.mobileNumber,k=v.emailAddress,A=v.postCode,C=v.addressLine1,O=v.addressLine2,E=v.addressLine3,N=v.addressLine4;return(0,d.jsx)(bn.A,{title:"Confirm your details",children:(0,d.jsx)("div",{className:"flex lg:h-full flex-col justify-between -mt-[4rem]",children:(0,d.jsxs)("div",{className:"flex flex-col justify-between h-full",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)(c.EY,{className:"font-bold",children:"Please confirm your personal details are correct."}),(0,d.jsx)(c.EY,{children:"Your name and address must match details held by your bank."}),(0,d.jsx)(c.EY,{className:"font-bold",children:"Name:"}),(0,d.jsxs)(c.EY,{children:[x," ",j]}),(0,d.jsx)(c.EY,{className:"font-bold",children:"Address:"}),(0,d.jsx)(c.EY,{children:C}),O&&(0,d.jsx)(c.EY,{children:O}),E&&(0,d.jsx)(c.EY,{children:E}),N&&(0,d.jsx)(c.EY,{children:N})," ",(0,d.jsx)(c.EY,{children:A}),(0,d.jsx)(c.EY,{className:"font-bold",children:"Contact Details:"}),(0,d.jsx)(c.EY,{children:k}),(0,d.jsx)(c.EY,{children:w}),(0,d.jsxs)(c.EY,{children:["If these details are incorrect, please contact us on ",o]})]}),(0,d.jsx)(c.e2,{className:"py-10",primary:(0,d.jsx)(c.$n,{onClick:()=>g(),children:"Continue"}),secondary:(0,d.jsx)(c.$n,{onClick:()=>n(),children:"Back"})})]})})})};function qn(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,a,l=[],s=!0,c=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=o.call(r)).done)&&(l.push(n.value),l.length!==t);s=!0);}catch(e){c=!0,i=e}
1finally{try{if(!s&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw i}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Vn(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Vn(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Vn(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}const Yn=e=>{let t=e.onContinue,r=e.onBack,n=e.depositAuditId,i=e.amount,o=e.accountHolderName,a=e.accountNumber,l=e.sortCode;const s=qn((0,S.OQJ)(),2),u=s[0],m=s[1],y=m.loading,f=m.error,p=qn((0,S.dA6)(),2),h=p[0],b=p[1],g=b.loading,v=b.error,x=async()=>{try{const e=await h({variables:{depositAuditId:n}});if(e.data.confirmUnauthCustomerDetails.success){const e=(await u({variables:{depositAuditId:n}})).data;e.getUnauthBankAuthorisationLink.authorisationLink&&!e.getUnauthBankAuthorisationLink.alreadyInProgress&&t({authorisationLink:e.getUnauthBankAuthorisationLink.authorisationLink})}}catch(e){}};return y||g?(0,d.jsx)(c.kt,{}):f||v?(0,d.jsx)(c.W5,{subHeading:"There has been an error processing your request",retry:{action:async()=>{await x()}}}):(0,d.jsx)(bn.A,{title:"Confirm and process",children:(0,d.jsx)("div",{className:"flex lg:h-full flex-col justify-between -mt-[4rem]",children:(0,d.jsxs)("div",{className:"flex flex-col justify-between h-full",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)(c.EY,{className:"font-bold",children:"Payment amount :"}),(0,d.jsxs)("div",{className:"flex flex-col items-center justify-center",children:[(0,d.jsx)(c.fV,{variant:"h1",className:"font-bold pt-20 text-center",children:(0,Zr.ye)(i)}),(0,d.jsx)(c.EY,{className:"text-center py-10",children:"from"}),(0,d.jsx)("div",{className:"xs:w-1/2 w-3/4",children:(0,d.jsxs)(c.hT,{children:[(0,d.jsx)(c.aR,{children:(0,d.jsx)(c.vw,{title:o})}),(0,d.jsx)(c.Wu,{children:(0,d.jsx)(c.FU,{items:[{name:"Account:",value:a},{name:"Sort Code:",value:l}]})})]})}),(0,d.jsx)(c.EY,{className:"pt-20",children:"This deposit will be made to Glasgow Credit Union from the above bank account and be authorised by you. Funds will be cleared within one working day."}),(0,d.jsx)(c.EY,{children:"We will now connect you to our payment provider, GoCardless, who will connect you with your bank to authorise the payment."})]})]}),(0,d.jsx)(c.e2,{className:"py-10",primary:(0,d.jsx)(c.$n,{onClick:()=>x(),children:"Authorise payment"}),secondary:(0,d.jsx)(c.$n,{onClick:()=>r(),children:"Back"})})]})})})},Un=e=>{let t=e.onContinue,r=e.depositAuditId,n=e.authorisationLink;const o=(0,S.p8f)({variables:{depositAuditId:r},pollInterval:3e3,fetchPolicy:"no-cache",notifyOnNetworkStatusChange:!0}),a=o.data,l=o.error,s=o.refetch,u=o.stopPolling;return(0,i.useEffect)(()=>{if(a){const e=a.getUnauthPaymentRequestStatus,r=e.isFailed,n=e.isFulfiled;(r&&!n||!r&&n)&&(t({isFailed:r}),u())}},[a]),l?(0,d.jsx)(c.W5,{subHeading:"There has been an error processing your request",retry:{action:async()=>{try{await s()}catch(e){}}}}):(0,d.jsx)(bn.A,{title:"Authorise payment",children:(0,d.jsxs)("div",{className:"flex flex-col justify-between h-full",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)(c.EY,{className:"font-bold",children:"Please do not refresh this page."}),(0,d.jsx)(c.EY,{children:"If the bank pay authorisation process has not opened in a new tab, you can access it by clicking the link below."})]}),(0,d.jsxs)("div",{className:"w-full flex flex-col justify-center items-center py-10 xs:pt-20",children:[(0,d.jsx)(c.kt,{}),(0,d.jsx)(c.EY,{children:"Awaiting authorisation..."})]}),(0,d.jsx)("div",{className:"w-full text-center py-10",children:(0,d.jsx)(c.$n,{onClick:()=>{var e;null===(e=window.open(n,"_blank"))||void 0===e||e.focus()},variant:"secondary",children:"Authorise Payment"})})]})})},Bn=e=>{let t=e.isLoanRepayment;return(0,d.jsx)(c.Gb,{title:"Success",heading:"We\u2019ve received your payment",subHeading:[{content:"We will process it shortly and you will receive confirmation of your ".concat(t?"loan settlement":"payment"," within one working day.")},{content:"You will receive a confirmation email about this payment."},{content:"You can now close this browser window."}],action:{to:"/",title:"Exit"}})},_n=e=>{let t=e.phoneNumber;return(0,d.jsx)(c.Gb,{title:"Error",heading:"There has been an error processing your payment",subHeading:[{content:"The payment process has failed."},{content:"No money has left your account."},{content:"Please retry the process and if the issue persists contact us on ".concat(t," for assistance.")}],topIcon:"error",action:{to:"/",title:"Exit"}})},zn=e=>{let t=e.phoneNumber,r=e.onBack;return(0,d.jsx)(bn.A,{title:"About GoCardless",children:(0,d.jsxs)("div",{className:"flex flex-col justify-between overflow-auto h-full",children:[(0,d.jsx)(c.EY,{className:"font-bold mb-0",children:"What is GoCardless?"}),(0,d.jsx)(c.EY,{className:"mt-5",children:"GoCardless is our trusted payments provider. Their services allow us to use Open Banking technology to securely connect you to your bank account and transfer funds to your Glasgow Credit Union Savings accounts."}),(0,d.jsx)(c.EY,{className:"font-bold mb-0",children:"How does Bank Pay work?"}),(0,d.jsxs)(c.EY,{className:"mt-5",children:["By partnering with GoCardless, Glasgow Credit Union can offer deposits via a"," ",(0,d.jsx)("div",{className:"font-bold inline",children:"direct secure transfer from your bank account"})," into a Glasgow Credit Union account without you having to enter our bank account information or using a debit card."]}),(0,d.jsx)(c.EY,{className:"mt-0",children:"GoCardless will connect you with your bank using your bank\u2019s mobile app or online banking website. Your bank will then ask you to login to their platform in the usual way to authorise the payment to Glasgow Credit Union."}),(0,d.jsx)(c.EY,{className:"mt-0",children:"Not only are deposits via Bank Pay secure, but using this free service means you benefit from faster processing times, meaning your funds arrive and are deposited by us sooner."}),(0,d.jsx)(c.EY,{className:"mt-0",children:"Please note that our Bank Pay bank account can only accept payments via the Go Cardless service. Do not transfer any funds to this bank account manually."}),(0,d.jsx)(c.EY,{className:"font-bold mb-0",children:"Having trouble using Bank Pay?"}),(0,d.jsx)(c.EY,{children:"Your bank may have a maximum payment limit in place which will be dependent upon the specific bank account type and conditions such as your current balance or how many payments you\u2019ve recently made."}),(0,d.jsxs)(c.EY,{children:["If you have any specific questions, please contact us on ",t]}
1),(0,d.jsx)(c.$n,{className:"my-10",onClick:()=>r(),children:"Back"})]})})};function $n(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,a,l=[],s=!0,c=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=o.call(r)).done)&&(l.push(n.value),l.length!==t);s=!0);}catch(e){c=!0,i=e}finally{try{if(!s&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw i}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Gn(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Gn(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Gn(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}const Hn=()=>{const e=(0,n.Zp)(),t=(0,n.g)().paymentRequestRef,r=$n((0,i.useState)("VerifyDetails"),2),o=r[0],a=r[1],l=$n((0,i.useState)(""),2),s=l[0],u=l[1],m=$n((0,i.useState)(0),2),y=m[0],f=m[1],p=$n((0,i.useState)(""),2),h=p[0],b=p[1],g=$n((0,i.useState)(""),2),v=g[0],x=g[1],j=$n((0,i.useState)(""),2),w=j[0],k=j[1],A=$n((0,i.useState)(""),2),C=A[0],O=A[1],E=$n((0,i.useState)(""),2),N=E[0],P=E[1],D=$n((0,i.useState)(""),2),I=D[0],L=D[1],R=$n((0,i.useState)(""),2),M=R[0],T=R[1],F=$n((0,i.useState)(""),2),q=F[0],V=F[1],Y=$n((0,i.useState)(!0),2),U=Y[0],B=Y[1],_=$n((0,i.useState)(null),2),z=_[0],$=_[1],G=$n((0,i.useState)(!1),2),H=G[0],W=G[1],K=$n((0,i.useState)(!1),2),Z=K[0],Q=K[1],J=$n((0,i.useState)(!1),2),X=J[0],ee=J[1],te=(0,S.P2n)({fetchPolicy:"cache-and-network",nextFetchPolicy:"cache-first",n
1otifyOnNetworkStatusChange:!0}),re=te.data,ne=te.loading,ie=te.error,oe=te.refetch,ae=(0,S.yBd)({variables:{paymentRequestRef:t},fetchPolicy:"no-cache",notifyOnNetworkStatusChange:!0}),le=ae.data,se=ae.loading,ce=ae.error;if((0,i.useEffect)(()=>{var e;le&&B(null===le||void 0===le||null===(e=le.getPayIntentType)||void 0===e?void 0:e.isLoanRepayment)},[le]),(0,i.useEffect)(()=>{re&&(y>=re.getCreditUnion.globalRules.minSavingsDepositAmount&&y<=re.getCreditUnion.globalRules.maxSavingsDepositAmount?Q(!0):Q(!1),y>=re.getCreditUnion.globalRules.sourceOfFundsThreshold?ee(!0):(ee(!1),u("")))},[y,re]),ne||se)return(0,d.jsx)(c.kt,{});if(ie||ce)return(0,d.jsx)(bn.A,{children:(0,d.jsx)(c.W5,{subHeading:ce?"The payment reference has expired or does not exist. Please contact us for support.":"There has been an error processing your request",retry:{action:async()=>{try{await oe()}catch(e){}}}})});const ue=re.getCreditUnion,de=ue.termsAndConditionsUrls,me=ue.globalRules,ye=ue.phoneNumber,fe=me.sourceOfFundsOptions,pe=me.sourceOfFundsThreshold,he=me.maxSavingsDepositAmount,be=me.minSavingsDepositAmount,ge=de.find(e=>"goCardlessPrivacyPolicy"===e.key).url,ve=de.find(e=>"joinPrivacyPolicyAgreement"===e.key).url,xe=de.find(e=>"borrowTermsAndConditionsAgreement"===e.key).url,je=e=>{let t=e.memberNumber;return x(t)},we=e=>{let t=e.dateOfBirth;return k(t)},ke=e=>{let t=e.narrative;return u(t)},Se=e=>{let t=e.amount;return f(t)},Ae=e=>{let t=e.sortCode;return P(t)},Ce=e=>{let t=e.institutionId;return T(t)},Oe=e=>{let t=e.accountNumber;return L(t)},Ee=()=>e("/"),Ne=e=>{let t=e.paymentAmount,r=e.productName;U?(f(t),b(r),u(""),a("ConfirmAmount")):a("EnterAmount")},Pe=()=>a("BankAccountDetails"),De=()=>a("BankAccountDetails"),Ie=e=>{let t=e.depositAuditId,r=e.hasGuessedInstitution;O(t),a(r?"ConfirmAndProcess":"SelectYourBank")},Le=()=>a("ConfirmYourDetails"),Re=e=>{let t=e.name;V(t),a("ConfirmAndProcess")},Me=e=>{var t;let r=e.authorisationLink;$(r),null===(t=window.open(r,"_blank"))||void 0===t||t.focus(),a("AuthorisePayment")},Te=e=>{let t=e.isFailed;return a(t?"Dropout":"Success")},Fe=()=>W(!H),qe=!!w&&10===w.length&&!!v,Ve=!X||!!s&&s.length>9,Ye=8===N.length&&8===I.length;return H?(0,d.jsx)(zn,{onBack:Fe,phoneNumber:ye}):"Success"===o?(0,d.jsx)(Bn,{isLoanRepayment:U}):"Dropout"===o?(0,d.jsx)(_n,{phoneNumber:ye}):(0,d.jsxs)("div",{className:"flex flex-col",children:[(()=>{switch(o){case"VerifyDetails":default:return(0,d.jsx)(jn,{onContinue:Ne,onMemberNumber:je,onDateOfBirth:we,onBack:()=>e("/"),dateOfBirth:w,memberNumber:v,isLoanRepayment:U,paymentRequestRef:t,loanTermsAndConditionsUrl:xe,gcuPrivacyPolicyUrl:ve,canContinue:qe});case"ConfirmAmount":return(0,d.jsx)(An,{onContinue:Pe,onBack:()=>{f(0),a("VerifyDetails")},onSourceOfFunds:ke,canContinue:Ve,amount:y,productName:h,sourceOfFundsOptions:fe,sourceOfFundsThreshold:pe,requireSourceOfFundsNarrative:X});case"EnterAmount":return(0,d.jsx)(En,{onContinue:De,onSourceOfFunds:ke,onAmount:Se,onBack:()=>{f(0),a("VerifyDetails")},canContinue:Ve,isValidAmount:Z,amount:y,maxSavingsDepositAmount:he,minSavingsDepositAmount:be,sourceOfFundsOptions:fe,requireSourceOfFundsNarrative:X});case"BankAccountDetails":return(0,d.jsx)(Dn,{onContinue:Ie,onSortCode:Ae,onAccountNumber:Oe,onBack:()=>{P(""),L(""),a(U?"ConfirmAmount":"EnterAmount")},canContinue:Ye,amount:y,narrative:s,memberNumber:v,sortCode:N,accountNumber:I,paymentRequestRef:t,requireSourceOfFundsNarrative:X,isLoanRepayment:U});case"SelectYourBank":return(0,d.jsx)(Rn,{onContinue:Le,onInstitution:Ce,onBack:()=>{T(""),a("BankAccountDetails")},depositAuditId:C,institutionId:M});case"ConfirmYourDetails":return(0,d.jsx)(Fn,{onExit:Ee,onContinue:Re,onBack:()=>{T(""),a("BankAccountDetails")},depositAuditId:C,phoneNumber:ye});case"ConfirmAndProcess":return(0,d.jsx)(Yn,{onContinue:Me,onBack:()=>{V(""),a("ConfirmYourDetails")},depositAuditId:C,amount:y,sortCode:N,accountHolderName:q,accountNumber:I});case"AuthorisePayment":return(0,d.jsx)(Un,{onContinue:Te,depositAuditId:C,authorisationLink:z})}})(),"VerifyDetails"!==o&&(0,d.jsx)(gn,{goCardlessPrivacyUrl:ge,onInformation:Fe})]})};function Wn(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,a,l=[],s=!0,c=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=o.call(r)).done)&&(l.push(n.value),l.length!==t);s=!0);}catch(e){c=!0,i=e}
1finally{try{if(!s&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw i}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Kn(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Kn(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Kn(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}const Zn=()=>{const e="true"===Wn((0,n.ok)(),1)[0].get("loanRepayment"),t=e?"We\u2019ve received your payment":" We\u2019ve received your deposit";return(0,d.jsxs)("div",{className:"w-full flex flex-col justify-start items-center md:p-20",children:[(0,d.jsx)(c.Gb,{title:"Success",heading:t,subHeading:e?[{content:"This payment will leave your bank account immediately. "},{content:"We will process it shortly and you will receive confirmation of your loan settlement within one working day."},{content:"You will receive a confirmation email about this payment."}]:[{content:"This payment will leave your bank account immediately. "},{content:"We will process it shortly and the funds will be available in your account within one working day."},{content:"You will receive a confirmation email about this deposit."}]}),(0,d.jsx)(c.fV,{className:"sm:p-10 p-5 text-center",variant:"h3",children:"You can now close this browser window."})]})};function Qn(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,a,l=[],s=!0,c=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=o.call(r)).done)&&(l.push(n.value),l.length!==t);s=!0);}catch(e){c=!0,i=e}finally{try{if(!s&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw i}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Jn(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Jn(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Jn(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}const Xn=()=>{const e=Qn((0,n.ok)(),1)[0],t=e.get("token"),r=t&&t.length>=1&&/^[a-zA-Z0-9_-]+$/.test(t),o=e=>"".concat("gcu-mobile://").concat(window.location.hostname,"/verify/mobile?token=").concat(e);(0,i.useEffect)(()=>{if(r){const e=o(t);setTimeout(()=>{window.location.replace(e)},5e3)}},[t,r]);return(0,d.jsxs)("div",{className:"flex flex-1 flex-col justify-center items-center bg-white text-center p-5 px-10",children:[(0,d.jsx)(c.fV,{variant:"h2",children:"Mobile Verification"}),r?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:"my-12",children:(0,d.jsx)(c.kt,{})}),(0,d.jsx)(c.EY,{className:"mb-6",children:"This link should only be opened on the device you are attempting to sign in on."}),(0,d.jsx)(c.EY,{className:"mb-6 ",children:"We are attempting to redirect you to the Glasgow Credit Union mobile app automatically."}),(0,d.jsx)(c.EY,{className:"mb-6 text-sm",children:"If you're not redirected automatically, you can tap the button below to open the app."}),(0,d.jsx)(c.$n,{onClick:()=>{if(r){const e=o(t);window.location.replace(e)}},className:"mb-4",children:"Open Mobile App"})]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(c.EY,{className:"mb-4",children:"Invalid or missing verification token."}),(0,d.jsx)(c.EY,{className:"text-sm",children:"Please check your link and try again, or contact support if the issue persists."})]})]})};function ei(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,a,l=[],s=!0,c=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=o.call(r)).done)&&(l.push(n.value),l.length!==t);s=!0);}catch(e){c=!0,i=e}
1finally{try{if(!s&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw i}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return ti(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?ti(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ti(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}const ri=e=>{let t=e.resourceUrl,r=e.gcuPrivacyPolicyUrl;const o=ei((0,i.useState)(""),2),a=o[0],l=o[1],s=ei((0,i.useState)(!1),2),u=s[0],m=s[1],y=(0,n.Zp)(),f=ei((0,S.IRE)({notifyOnNetworkStatusChange:!0,fetchPolicy:"no-cache"}),2),p=f[0],h=f[1].loading,b=(0,re.B9)(a);return(0,d.jsxs)("div",{className:"flex w-full text-base",children:[(0,d.jsxs)("div",{className:"flex flex-grow flex-col w-full h-full p-12 sm:p-12 md:p-16",children:[(0,d.jsx)("div",{className:"text-2xl font-bold text-fields",children:"Let's get you logged in"}),(0,d.jsx)("div",{className:"flex flex-grow flex-col justify-around w-full h-full my-24",children:(0,d.jsxs)("div",{className:"min-h-[40%] text-foreground",children:[(0,d.jsx)("div",{className:"pb-10",children:"Enter the email address registered with your Glasgow Credit Union account."}),(0,d.jsx)(c.$I,{disabled:h,value:a,type:"email",onChange:e=>{u&&m(!1),l(e.target.value.toLowerCase())},label:"Email address",placeholder:"Enter your email address",maxLength:M.vX}),(0,d.jsxs)(c.$n,{variant:"link",size:"link",className:"pt-10",onClick:()=>y("/lostemail"),children:["I've forgotten my email address",(0,d.jsx)(bt.g,{icon:"chevron-right",className:"pl-2"})]}),u&&(0,d.jsx)("div",{className:"errors",children:(0,d.jsx)(c.EY,{className:"text-destructive",children:"Something went wrong. Please try again"})})]})}),(0,d.jsxs)("div",{className:"bg-[var(--tabs)] p-10 flex flex-row",children:[(0,d.jsx)(bt.g,{icon:"info-circle",className:"text-primary pr-5",size:"2x"}),(0,d.jsxs)("div",{children:["We secure your data in line with our"," ",(0,d.jsx)(c.$n,{type:"button",variant:"link",size:"link",onClick:()=>window.open(r),children:"privacy notice"})]})]}),(0,d.jsx)(c.e2,{primary:(0,d.jsx)(c.$n,{isLoading:h,className:"w-full",isDisabled:h||!b,onClick:async()=>{await(async()=>{m(!1);const e=await p({variables:{emailAddress:a}}),t=e.data;if(e.error&&m(!0),t&&t.getUserPool){const e=t.getUserPool.isLegacy;y(e?"/legacylogin":"/passwordlesslogin",{state:{emailAddress:a}})}})()},children:"Continue"}),secondary:(0,d.jsx)(c.$n,{onClick:()=>y("/"),isDisabled:h,children:"Back"})})]}),(0,d.jsx)("div",{className:"hidden md:flex w-full flex-grow",children:(0,d.jsx)("img",{src:"".concat(t,"/resources/side-image-1.jpg"),alt:"",className:"object-cover object-center flex flex 1 w-full"})})]})};function ni(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,a,l=[],s=!0,c=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=o.call(r)).done)&&(l.push(n.value),l.length!==t);s=!0);}catch(e){c=!0,i=e}finally{try{if(!s&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw i}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return ii(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?ii(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ii(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}const oi=()=>{const e=ni((0,i.useState)(!1),2),t=e[0],r=e[1],o=(0,n.zy)(),a=new URLSearchParams(o.search).get("token"),l=(0,i.useMemo)(()=>new BroadcastChannel("login-token"),[]);return(0,i.useEffect)(()=>
1{if(!t)return r(!0),l.postMessage({type:"TOKEN_RECEIVED",token:a}),()=>{l.close()}},[]),(0,d.jsxs)("div",{className:"text-center",children:[(0,d.jsx)(c.Gb,{title:"You're all set",heading:"We've got your verification link.",subHeading:"Close this tab and switch to your other tab to continue."}),(0,d.jsx)(c.$n,{className:"w-1/2",onClick:()=>window.close(),children:"Close this tab"})]})};var ai=r(7348),li=r(7956),si=r(846);const ci=()=>{const e=(0,si.eX)({},{immediate:!1}),t=e.isLoading,r=e.error,n=e.getData;return{isLoading:t,error:r,getVisitorData:async(e,t,r)=>{const i=await n({tag:{emailAddress:e,userAction:t},linkedId:r});if(null===i||void 0===i||!i.requestId||null===i||void 0===i||!i.visitorId)throw new Error("Failed to get fingerprint data");return i}}},ui=e=>{let t=e.emailAddress,r=e.errorMessage,n=e.isLoading,i=e.onBack,o=e.onResendClick;return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:"text-2xl font-bold text-fields",children:"Check your email"}),(0,d.jsxs)("div",{className:"text-base flex flex-grow flex-col justify-between w-full h-full my-24 min-h-[40%]",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("div",{children:"If you are registered for online access, an email will be sent to"}),(0,d.jsx)("div",{className:"font-bold text-fields py-5",children:t}),(0,d.jsx)("div",{className:"text-base py-10",children:"This email contains a magic link that will verify your email address and sign you into your Glasgow Credit Union account."}),(0,d.jsx)("div",{className:"text-center pt-10",children:(0,d.jsx)(c.HO,{})})]}),n&&(0,d.jsx)(c.kt,{}),(0,d.jsxs)("div",{className:"text-base",children:[r&&(0,d.jsx)("div",{className:"errors",children:(0,d.jsx)(c.EY,{className:"text-destructive",children:r})}),(0,d.jsxs)(c.$n,{className:"pt-10",variant:"link",size:"link",onClick:o,children:["I didn't get an email"," "]})," "]})]}),i&&(0,d.jsx)(c.e2,{primary:(0,d.jsx)(c.$n,{onClick:i,children:"Back"})})]})};function di(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,a,l=[],s=!0,c=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=o.call(r)).done)&&(l.push(n.value),l.length!==t);s=!0);}catch(e){c=!0,i=e}finally{try{if(!s&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw i}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return mi(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?mi(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function mi(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}const yi=e=>{var t;let r=e.onBack,n=e.onResendMagicLink,o=e.emailAddress;const a=di((0,i.useState)(!1),2),l=a[0],s=a[1],u=(0,S.P2n)(),m=u.data,y=u.loading,f=u.error,p=u.refetch,h=null===m||void 0===m||null===(t=m.getCreditUnion)||void 0===t?void 0:t.helpCentreUrl;return l||y?(0,d.jsx)(c.kt,{}):f?(0,d.jsx)(c.W5,{subHeading:"Please try again and if the issue persists contact us for support",retry:{action:async()=>{await p()}}}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:"text-2xl font-bold text-fields",children:"I didn't get an email"}),(0,d.jsxs)("div",{className:"text-base flex flex-col w-full h-full my-24 min-h-[40%]",children:[(0,d.jsx)("div",{children:"If you are registered for online access, an email will be sent to"}),(0,d.jsx)("div",{className:"font-bold text-fields py-5",children:o}),(0,d.jsx)("div",{className:"py-10 ",children:"Check your email address is right. If it isn\u2019t, go back a screen and try again."}),(0,d.jsx)("div",{className:"font-bold text-fields py-5",children:"If your email address is correct:"}),(0,d.jsx)(c.Pg,{type:"circle",items:[{content:"Wait 10 minutes. Sometimes emails can be delayed reaching your inbox"},{content:"Check your spam folder (and mark the email as 'Not Spam' if it is in there)"},{content:"Re-send the email with the button below"}]}),h&&(0,d.jsxs)(c.EY,{className:"mt-10",children:["If you are still having trouble, please visit our"," ",(0,d.jsx)(c.$n,{variant:"link",onClick:()=>{h&&window.open(h,"_blank","noopener,noreferrer")},className:"p-0",children:"help centre"})," ","to raise a support request"]})]}),(0,d.jsx)(c.e2,{primary:(0,d.jsx)(c.$n,{isLoading:l,className:"w-full",onClick:async()=>{s(!0),await n(),s(!1)},children:"Resend email"}),secondary:(0,d.jsx)(c.$n,{onClick:()=>r(),children:"Back"})})]})};function fi(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,a,l=[],s=!0,c=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=o.call(r)).done)&&(l.push(n.value),l.length!==t);s=!0);}catch(e){c=!0,i=e}
1finally{try{if(!s&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw i}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return pi(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?pi(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function pi(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}const hi=e=>{var t;let r=e.resourceUrl,o=e.helpCentreArticles;const a=fi((0,i.useState)(!1),2),l=a[0],s=a[1],u=fi((0,i.useState)(""),2),m=u[0],y=u[1],f=fi((0,i.useState)(!1),2),p=f[0],h=f[1],b=fi((0,i.useState)(!1),2),g=b[0],w=b[1],k=fi((0,i.useState)("PasswordlessContent"),2),A=k[0],C=k[1],O=(0,i.useRef)(!1),E=(0,i.useRef)(!1),N=(0,ve.A)(),P=N.passwordlessRequestLoginOtp,D=N.passwordlessAuthenticate,I=N.passwordlessPreAuthCheck,L=N.setUserShouldLogIn,R=N.configureAmplify,M=(0,n.zy)(),T=(0,n.Zp)(),F=(0,c.dj)().toast,q=fi((0,S.gpM)(),1)[0],V=null===(t=M.state)||void 0===t?void 0:t.emailAddress,Y=(0,i.useRef)(new BroadcastChannel("login-token")),U=ci().getVisitorData;R("passwordless");const B=async()=>{try{y(""),s(!0),await P({emailAddress:V}),E.current=!0,O.current=!1}catch(e){await _(e)}finally{s(!1)}};(0,i.useEffect)(()=>{var e;null!==(e=M.state)&&void 0!==e&&e.emailAddress?E.current||B():T("/login")},[V]);const _=async e=>{O.current=!1;const t="Something went wrong. Please try again";if(e instanceof j.l){const r=e.name;y("EmptySignInUsername"===r?"Email address is required to initiate sign in process":"NotAuthorizedException"===r?"Your session has expired. Please use the latest email you have from us or use the link below to request a new verification email and try again.":"CodeMismatchException"===r?"The code you have entered is wrong. Please check your input and try again":t)}else if(e instanceof x.K4){const r=(0,re.u$)(e),n=r.key,i=r.message,o=r.code;if("VERIFICATION_PENDING"===o)return T("/login/account-check",{state:{verificationPending:!0}});if("VERIFICATION_REQUIRED"===o)return T("/login/account-check",{state:{verificationPending:!1}});if("PHONE_UNVERIFIED"===n){const e=await(async()=>{try{const e=await(0,Ee.T)();return(null===e||void 0===e?void 0:e.phone_number)||""}catch(e){return""}})();if(e)return await tt(),T("/completeregistration",{state:{emailAddress:V,key:n,phoneNumber:e}});y(t)}else{if("COMMS_PREFS_REQUIRED"===n)return T("/completeregistration",{state:{emailAddress:V,key:n}});"LOCKED_ACCOUNT"===n?(await v.sZ.clear(),h(!0),await(0,at.ri)(),y(i)):"TOKEN_EXPIRED"===o?y("".concat(i," Please request a new verification email using the link below and try again.")):(ai.v4(t=>{t.setLevel("error").setFingerprint(["type: PasswordlessWebLoginApolloError"]).setTags({emailAddress:V,code:o,key:n,message:i}),li.Cp(e)}),y(t))}}else{if(e instanceof Error&&(ai.v4(t=>{t.setLevel("error").setFingerprint(["type: PasswordlessWebLoginGenericError"]).setTags({emailAddress:V,message:(null===e||void 0===e?void 0:e.message)||"N/A"}),li.Cp(e)}),"Failed to get fingerprint data"===e.message))return await(0,at.ri)(),void w(!0);y(t)}},z=async e=>{let t=e.otpCode;s(!0);try{const e=await D({otpCode:t});if(!e||!e.success)throw new Error("");await(async()=>{s(!0);try{const e=await(0,Ee.T)(),t=await U(V,"login",e.sub),r=await I(t.requestId,t.visitorId);if(!r||!r.success)throw new Error("");L(!0)}catch(e){await _(e)}finally{s(!1),E.current=!1}})(),O.current=!0}catch(r){await _(r)}finally{s(!1)}},$=(0,i.useCallback)(async e=>{if("TOKEN_RECEIVED"===e.data.type&&!O.current)try{var t;const r=await q({variables:{emailAddress:V,token:e.data.token},fetchPolicy:"no-cache"}),n=r.data,i=r.error;if(i)throw i;null!==n&&void 0!==n&&null!==(t=n.getAuthCode)&&void 0!==t&&t.code&&await z({otpCode:n.getAuthCode.code})}catch(r){_(r)}},[q,V]);if((0,i.useEffect)(()=>{const e=Y.current;return e.onmessage=$,()=>{e.close()}},[$]),p)return(0,d.jsx)(c.Gb,{topIcon:"error",title:"Account locked",subHeading:"Please get in touch to unlock your account"});if(g){var G;const e=null===o||void 0===o||null===(G=o.find(e=>e.key===S.f_X.IssuesLoggingIn))||void 0===G?void 0:G.url;return(0,d.jsxs)("div",{className:"text-center",children:[(0,d.jsx)(c.Gb,{topIcon:"error",title:"We've been unable to verify your device.",subHeading:"We've been unable to verify your device which is stopping us from getting you logged into your account. Please visit the link below for more information. If the issue persists, please contact us and a member of the team will be happy to help."}),(0,d.jsx)(c.$n,{onClick:()=>{var t;return null===(t=window.open(e,"_blank","noopener,noreferrer"))||void 0===t?void 0:t.focus()},children:"Visit the Help Centre"})]})}const H="PasswordlessContent"===A?(0,d.jsx)(ui,{isLoading:l,emailAddress:V,errorMessage:m,onBack:()=>T("/login"),onResendClick:()=>C("ResendMagicLink")}):(0,d.jsx)(yi,{onBack:()=>C("PasswordlessContent"),onResendMagicLink:async()=>{await B(),F({variant:"success",title:"Email Sent!",description:"A verification link has been sent to ".concat(V,".")}),C("PasswordlessContent")},emailAddress:V});return(0,d.jsxs)("div",{className:"flex w-full",children:[(0,d.jsx)("div",{className:"flex flex-col w-full h-full p-12 sm:p-12 md:p-16",children:l?(0,d.jsx)(c.kt,{}):H}),(0,d.jsx)("div",{className:"hidden md:flex w-full",children:(0,d.jsx)("img",{src:"".concat(r,"/resources/side-image-1.jpg"),alt:"",className:"w-full object-cover object-center"})})]})};function bi(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function gi(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};
1t%2?bi(Object(r),!0).forEach(function(t){vi(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):bi(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function vi(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function xi(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,a,l=[],s=!0,c=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=o.call(r)).done)&&(l.push(n.value),l.length!==t);s=!0);}catch(e){c=!0,i=e}finally{try{if(!s&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw i}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return ji(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?ji(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ji(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}const wi={1:"Get Started",2:"Personal Details",3:"Security",4:"Verification",5:"Communication"},ki={MobileVerificationForm:"4",CommunicationPreferences:"5",MarketingPreferences:"5"},Si=e=>{let t=e.helpCentreArticles;const r=xi((0,i.useState)(""),2),o=r[0],a=r[1],l=xi((0,i.useState)("4"),2),s=l[0],u=l[1],m=xi((0,i.useState)(""),2),y=m[0],f=m[1],p=xi((0,i.useState)({}),2),h=p[0],b=p[1],g=xi((0,i.useState)(""),2),w=g[0],k=g[1],A=xi((0,i.useState)(!1),2),C=A[0],O=A[1],E=xi((0,i.useState)(!1),2),N=E[0],P=E[1],D=(0,n.zy)(),I=(0,n.Zp)(),L=e=>{if(""!==e){const t=Object.entries(ki).find(t=>xi(t,1)[0]===e)[1];u(t),f(e)}else u(""),f("")};(0,i.useEffect)(()=>{if(!D.state||!D.state.emailAddress||!D.state.key)return void I("/");const e=D.state.key;if("PHONE_UNVERIFIED"===e){const e=D.state.phoneNumber;a(e),L("MobileVerificationForm")}else"COMMS_PREFS_REQUIRED"===e&&L("CommunicationPreferences")},[D.state]);const R=(0,ve.A)(),M=R.passwordlessPreAuthCheck,T=R.setUserShouldLogIn,F=R.logout,q=ci().getVisitorData,V=async e=>{const t="Something went wrong. Please try again";if(e instanceof j.l){const r=e.name;k("EmptySignInUsername"===r?"Email address is required to initiate sign in process":"NotAuthorizedException"===r?"Your session has expired. Please use the latest email you have from us or use the link below to request a new verification email and try again.":t)}else if(e instanceof x.K4){const t=(0,re.u$)(e).key;"COMMS_PREFS_REQUIRED"===t?L("CommunicationPreferences"):"LOCKED_ACCOUNT"===t&&(O(!0),await v.sZ.clear(),T(!1),await F())}else if(e instanceof Error&&"Failed to get fingerprint data"===e.message)return await F(),void P(!0);k(t)},Y=async(e,t)=>{T(!1);try{const r=await(0,Ee.T)(),n=await q(e,t,r.sub),i=await M(n.requestId,n.visitorId);if(!i||!i.success)throw new Error;T(!0)}catch(r){V(r)}},U=async e=>{try{var t;await rt({smsCode:e});const r=await(0,at.Pr)({email:D.state.emailAddress,mobileNumber:o});if(!r||null===(t=r.updateRegistrationDetails)||void 0===t||!t.success)throw new Error;await Y(D.state.emailAddress,"verify_mobile")}catch(r){if(null!==r&&void 0!==r&&r.name&&"CodeMismatchException"===r.name)throw r;V(r)}},B=e=>{b(e),L("MarketingPreferences")},_=async e=>{try{const t=gi(gi({},h),e);await(0,at.ro)({communicationPreferences:t,email:D.state.emailAddress}),await Y(D.state.emailAddress,"update_comms_prefs")}catch(t){V(t)}},z=Object.entries(wi).findIndex(e=>xi(e,1)[0]===s),$=Object.entries(wi).map(e=>{let t=xi(e,2),r=t[0];return{title:t[1],step:r}});if(C)return(0,d.jsx)(c.Gb,{topIcon:"error",title:"Account locked",subHeading:"Please get in touch to unlock your account"});if(N){var G;const e=null===t||void 0===t||null===(G=t.find(e=>e.key===S.f_X.IssuesLoggingIn))||void 0===G?void 0:G.url;return(0,d.jsxs)("div",{className:"text-center",children:[(0,d.jsx)(c.Gb,{topIcon:"error",title:"We've been unable to verify your device.",subHeading:"We've been unable to verify your device which is stopping us from getting you logged into your account. Please visit the link below for more information. If the issue persists, please contact us and a member of the team will be happy to help."}),(0,d.jsx)(c.$n,{onClick:()=>{var t;return null===(t=window.open(e,"_blank","noopener,noreferrer"))||void 0===t?void 0:t.focus()},children:"Visit the Help Centre"})]})}return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(c.Jc,{currentStep:z,steps:$}),(0,d.jsx)("div",{className:"flex flex-1 p-12 bg-background",children:(0,d.jsx)(i.Suspense,{fallback:(0,d.jsx)(c.kt,{}),children:(()=>{switch(y){case"MobileVerificationForm":return(0,d.jsx)(se,{onContinue:U,onResendClick:tt,mobileNumber:{value:o,obsecure:!0},onBack:async()=>{await F(),I("/login")}});case"CommunicationPreferences":return(0,d.jsx)(me,{onContinue:B});case"MarketingPreferences":return(0,d.jsx)(ge,{onContinue:_,onBack:()=>L("CommunicationPreferences"),apiError:w});default:return null}})()})})]})};var Ai=r(8295);function Ci(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function Oi(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};
1t%2?Ci(Object(r),!0).forEach(function(t){Ei(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ci(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function Ei(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Ni(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,a,l=[],s=!0,c=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=o.call(r)).done)&&(l.push(n.value),l.length!==t);s=!0);}catch(e){c=!0,i=e}finally{try{if(!s&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw i}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Pi(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Pi(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Pi(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}const Di=e=>{const t=e.onContinue,r=e.onBack,n=e.onResendClick,o=e.emailAddress,a=Ni((0,i.useState)(!1),2),l=a[0],s=a[1],u=Ni((0,i.useState)(!1),2),m=u[0],y=u[1],f=Ni((0,i.useState)(""),2),p=f[0],h=f[1],g=(0,c.dj)().toast,v=b.Ik({verificationCode:A.A.VerificationCode}),x=(0,w.mN)({resolver:(0,k.u)(v),defaultValues:{verificationCode:""}});return m?(0,d.jsx)(c.kt,{}):(0,d.jsxs)(c.lV,Oi(Oi({},x),{},{onSubmit:async e=>{s(!0),h("");try{await t(e.verificationCode)}catch(r){const e=(0,re.u$)(r).message;h(e)}s(!1)},title:"Confirm your email address",children:[(0,d.jsxs)(c.sf,{children:[(0,d.jsxs)(c.EY,{children:["We\u2019ve sent an email with an email verification link to:",(0,d.jsx)("br",{}),(0,d.jsx)(c.EY,{as:"span",className:"font-bold",children:"".concat(o)})]}),(0,d.jsx)("div",{children:(0,d.jsxs)(c.EY,{children:["Incorrect email address? Please"," ",(0,d.jsx)(c.$n,{asChild:!0,variant:"link",size:"link",children:(0,d.jsx)("a",{target:"_blank",href:"https://www.glasgowcu.com/contact-us/",rel:"noreferrer",children:"contact us"})}),"."]})}),(0,d.jsxs)(c.CL,{children:[(0,d.jsx)(c.zB,{control:x.control,name:"verificationCode",render:e=>{let t=e.field;return(0,d.jsx)(c.Wf,Oi({label:"Enter email verification code",maxLength:6,pattern:te.UO,required:!0},t))}}),p&&(0,d.jsx)("div",{className:"errors",children:(0,d.jsx)(c.EY,{className:"text-destructive",children:p})})]}),(0,d.jsx)(c.EY,{children:"Didn\u2019t get the email?"}),(0,d.jsx)("div",{children:(0,d.jsx)(c.$n,{type:"button",variant:"link",size:"link",onClick:async()=>{y(!0),h(""),x.reset();try{await n(),g({variant:"success",title:"Verification Sent",description:"A verification code has been sent to ".concat(o,".")})}catch(e){g({variant:"destructive",title:"Verification Sending Failed",description:"Something has gone wrong, please try again."})}finally{y(!1)}},formNoValidate:!0,children:"Resend email verification code"})})]}),(0,d.jsx)(c.OJ,{primary:(0,d.jsx)(c.$n,{type:"submit",isLoading:l,isDisabled:l,children:"Next"}),secondary:(0,d.jsx)(c.$n,{disabled:void 0===r,onClick:r,children:"Back"})})]}))};function Ii(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,a,l=[],s=!0,c=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=o.call(r)).done)&&(l.push(n.value),l.length!==t);s=!0);}catch(e){c=!0,i=e}
1finally{try{if(!s&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw i}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Li(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Li(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Li(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}const Ri=e=>{let t=e.onSkip,r=e.onContinue,n=e.onInformation,o=e.canSkipMigration;const a=Ii((0,i.useState)(!1),2),l=a[0],s=a[1];return l?(0,d.jsx)(c.kt,{}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:"text-2xl font-bold text-fields",children:"Your login is changing"}),(0,d.jsxs)("div",{className:"text-base flex flex-grow flex-col justify-between w-full h-full my-24 min-h-[40%]",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("div",{className:"text-base py-10",children:"As part of continuously improving the security on our app and online services we are changing how you log in."}),(0,d.jsx)("div",{className:"text-base py-10",children:"Our enhanced authentication process lets you sign in to your account without needing to remember a password or PIN. Instead, you log in securely using your email."}),(0,d.jsx)("div",{className:"text-base py-10",children:"We will send a magic link to your email to make logging in fast, easy and secure."})]}),(0,d.jsx)("div",{className:"text-base",children:(0,d.jsx)(c.$n,{className:"pt-10",variant:"link",size:"link",onClick:n,children:"You can find out more information about passwordless here."})})]}),(0,d.jsx)(c.e2,{primary:(0,d.jsx)(c.$n,{className:"w-full",onClick:async()=>{s(!0),await r(),s(!1)},children:"Continue"}),secondary:o?(0,d.jsx)(c.$n,{onClick:()=>t(),children:"Skip this step (one time)"}):null})]})},Mi=e=>{let t=e.onBack,r=e.onContinue,n=e.isLoading;return(0,d.jsx)(c.lG,{defaultOpen:!0,children:(0,d.jsxs)(c.Cf,{className:"max-w-4xl",onClick:e=>{e.stopPropagation()},children:[(0,d.jsxs)(c.c7,{children:[(0,d.jsx)(c.L3,{className:"text-fields",children:"Skip account migration"}),(0,d.jsxs)(c.rr,{children:[(0,d.jsx)(c.EY,{as:"span",className:"mt-10 block",children:"This is the only time you can skip migrating your Glasgow Credit Union online account."}),(0,d.jsxs)(c.EY,{as:"span",className:"mt-10 block",children:["The next time you log into your account, you will need to complete the migration process."," "]})]})]}),(0,d.jsx)(c.Es,{children:(0,d.jsx)(c.e2,{primary:(0,d.jsx)(c.$n,{isLoading:n,isDisabled:n,onClick:r,children:"Continue"}),secondary:(0,d.jsx)(c.$n,{isDisabled:n,onClick:t,children:"Back"})})})]})})};function Ti(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function Fi(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Ti(Object(r),!0).forEach(function(t){qi(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ti(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function qi(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Vi(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,a,l=[],s=!0,c=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=o.call(r)).done)&&(l.push(n.value),l.length!==t);s=!0);}catch(e){c=!0,i=e}
1finally{try{if(!s&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw i}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Yi(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Yi(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Yi(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}const Ui={1:"Get Started",2:"Personal Details",3:"Security",4:"Verification",5:"Communication"},Bi={EmailVerificationForm:"4",MobileVerificationForm:"4",MigrateAccountPrompt:"4",MigrationNextSteps:"4",CommunicationPreferences:"5",MarketingPreferences:"5"},_i=e=>{let t=e.resourceUrl;const r=Vi((0,i.useState)("4"),2),o=r[0],a=r[1],l=Vi((0,i.useState)(""),2),s=l[0],u=l[1],m=Vi((0,i.useState)({}),2),y=m[0],f=m[1],p=Vi((0,i.useState)(!1),2),h=p[0],x=p[1],j=Vi((0,i.useState)(!0),2),C=j[0],O=j[1],E=Vi((0,i.useState)(!1),2),N=E[0],P=E[1],D=(0,n.Zp)(),I=(0,ve.A)(),L=I.login,R=I.updateDetails,T=I.completeRegistration,F=I.migrateUser,q=I.configureAmplify,V=(0,S.P2n)({fetchPolicy:"cache-and-network"}).data,Y=(0,n.zy)();q("legacy"),g.Q.setKeyValueStorage(v.sZ),(0,i.useEffect)(()=>{var e;Y.state&&null!==(e=Y.state)&&void 0!==e&&e.emailAddress?oe.setValue("emailAddress",Y.state.emailAddress):D("/")},[Y]);const U=e=>{if(""!==e){const t=Object.entries(Bi).find(t=>Vi(t,1)[0]===e)[1];a(t),u(e)}else a(""),u("")},B=e=>{G(e),U("")},_=()=>{K(!0),U("")},z=Vi((0,i.useState)(""),2),$=z[0],G=z[1],H=Vi((0,i.useState)(!1),2),W=H[0],K=H[1],Z=Vi((0,i.useState)(!1),2),Q=Z[0],J=Z[1],X=Vi((0,i.useState)(""),2),ee=X[0],ne=X[1],ie=b.Ik({emailAddress:A.A.EmailAddress,password:A.A.Password,pin:A.A.PIN()}),oe=(0,w.mN)({resolver:(0,k.u)(ie),defaultValues:{emailAddress:"",password:"",pin:""},resetOptions:{keepIsSubmitted:!1}}),ae=async e=>{J(!0);try{await L({email:e.emailAddress,password:e.password,pin:e.pin,skipMigrationOnce:N,userAction:"legacy_login"})}catch(t){await ue(t,e.emailAddress,e.password)}},le=async()=>{const e=oe.getValues(),t=e.emailAddress,r=e.password;try{const e=await F({email:t,password:r}),n=e.memberNumber,i=e.mobileNumber,o=e.migrationId,a=e.phoneRecordMismatch;D("/accountmigration",{state:{emailAddress:t,memberNumber:n,mobileNumber:i,migrationId:o,phoneRecordMismatch:a}})}catch(n){G("Something went wrong. Please try again."),U("")}},ce=()=>{var e;const t=null===V||void 0===V||null===(e=V.getCreditUnion)||void 0===e||null===(e=e.helpCentreArticles)||void 0===e?void 0:e.find(e=>e.key===S.f_X.PwdlessAccountMigration);t?window.open(t.url,"_blank","noopener,noreferrer"):G("Something went wrong. Please try again.")},ue=async(e,t,r)=>{G(""),ne(""),K(!1);const n=(0,re.u$)(e),i=n.message,o=n.code,a=n.key;if("PHONE_UNVERIFIED"===a)try{const e=await(async(e,t)=>{try{await(0,Oe.J)({username:e,password:t});const r=await(0,Ee.T)();return await(0,Ne.C)(),r.phone_number}catch(r){throw await(0,Ne.C)(),r}})(t,r);e?(ne(e),await et(t,r),U("MobileVerificationForm")):_()}catch(l){_()}else if("COMMS_PREFS_REQUIRED"===a)U("CommunicationPreferences");else if("UserNotConfirmedException"===o||"UserLambdaValidationException"===o)try{await Xe(t),U("EmailVerificationForm")}catch(s){_()}else"PasswordResetRequiredException"===o?D("/resetcredentials",{state:{userEmail:t}}):"NotAuthorizedException"===o||"Incorrect username or password."===i?_():"LOCKED_ACCOUNT"===a?B("Your account is currently locked - please contact us to reset your account."):"MIGRATE_REQUIRED"===a?(U("MigrateAccountPrompt"),O(!1)):"MIGRATE_PROMPT"===a?U("MigrateAccountPrompt"):(ai.v4(r=>{r.setLevel("error").setFingerprint(["type: LegacyWebLoginError"]).setTags({emailAddress:t,message:i||"N/A",code:o||"N/A",key:a||"N/A"}),li.Cp(e)}),B("Something went wrong - we couldn't authenticate your account. Please try again. If the issue persists, please contact us."));J(!1)},de=async e=>{const t=oe.getValues("emailAddress"),r=oe.getValues("password"),n=oe.getValues("pin");await(async(e,t)=>{await Ze({username:e,confirmationCode:t})})(t,e);try{(await R({email:t,password:r}
1)).updateRegistrationDetails.success||_(),await L({email:t,password:r,pin:n,skipMigrationOnce:N,userAction:"sign_up"})}catch(i){await ue(i,t,r)}},ye=async()=>{const e=oe.getValues("emailAddress");await Xe(e)},fe=()=>{K(!1),U(""),oe.reset()},pe=()=>{U("CommunicationPreferences")},he=async()=>{const e=oe.getValues("emailAddress"),t=oe.getValues("password");await et(e,t)},be=async e=>{const t=oe.getValues("emailAddress"),r=oe.getValues("password"),n=oe.getValues("pin");await(async(e,t,r)=>{try{await(0,Oe.J)({username:e,password:t}),await $e({userAttributeKey:"phone_number",confirmationCode:r}),await(0,Ne.C)()}catch(n){throw await(0,Ne.C)(),n}})(t,r,e);try{(await R({email:t,password:r,mobileNumber:ee})).updateRegistrationDetails.success||_(),await L({email:t,password:r,pin:n,skipMigrationOnce:N,userAction:"verify_mobile"})}catch(i){await ue(i,t,r)}},xe=e=>{f(e),U("MarketingPreferences")},je=async e=>{const t=oe.getValues("emailAddress"),r=oe.getValues("password"),n=oe.getValues("pin");try{const i=Fi(Fi({},y),e);await T({email:t,password:r,communicationPreferences:i}),await L({email:t,password:r,pin:n,skipMigrationOnce:N,userAction:"update_comms_prefs"})}catch(i){await ue(i,t,r)}},we=()=>{const e=oe.getValues("emailAddress");switch(s){case"EmailVerificationForm":return(0,d.jsx)(Di,{emailAddress:e,onResendClick:ye,onContinue:de,onBack:fe});case"MobileVerificationForm":return(0,d.jsx)(se,{onContinue:be,onResendClick:he,mobileNumber:{value:ee,obsecure:!0},onBack:fe});case"CommunicationPreferences":return(0,d.jsx)(me,{onContinue:xe});case"MarketingPreferences":return(0,d.jsx)(ge,{onContinue:je,onBack:pe});case"MigrateAccountPrompt":return(0,d.jsx)(Ri,{onSkip:()=>{P(!0),x(!0)},onContinue:le,onInformation:ce,canSkipMigration:C});default:return null}},ke=Object.entries(Ui).findIndex(e=>Vi(e,1)[0]===o),Se=Object.entries(Ui).map(e=>{let t=Vi(e,2),r=t[0];return{title:t[1],step:r}});return s?(0,d.jsxs)(d.Fragment,{children:[h&&(0,d.jsx)(Mi,{isLoading:Q,onContinue:async()=>{J(!0),await ae(oe.getValues()),J(!1)},onBack:()=>x(!1)}),(0,d.jsx)(c.Jc,{currentStep:ke,steps:Se}),(0,d.jsx)("div",{className:"flex flex-1 flex-col p-12 bg-background",children:(0,d.jsx)(i.Suspense,{fallback:(0,d.jsx)(c.kt,{}),children:we()})})]}):(0,d.jsx)("div",{className:"bg-white flex w-full",children:(0,d.jsxs)("div",{className:"flex flex-grow w-full h-full",children:[(0,d.jsx)("div",{className:"flex flex-grow w-full h-full p-12 sm:p-12 md:p-16",children:(0,d.jsxs)(c.lV,Fi(Fi({},oe),{},{onSubmit:ae,title:"Log In",children:[(0,d.jsx)(c.sf,{middleAlign:!0,className:"my-24",children:(0,d.jsxs)(c.CL,{width:"full",children:[(0,d.jsx)(c.zB,{control:oe.control,name:"emailAddress",render:e=>{let t=e.field;return(0,d.jsx)(c.ZQ,Fi(Fi({disabled:!0,id:"email",label:"Email",type:"email",maxLength:M.vX,inputStyle:"lowercase",required:!0},t),{},{icon:(0,d.jsx)(bt.g,{icon:Ai.e68,className:"w-8 h-8 text-primary"})}))}}),(0,d.jsx)(c.zB,{control:oe.control,name:"password",render:e=>{let t=e.field;return(0,d.jsx)(c.Wb,Fi(Fi({id:"password",required:!0},t),{},{onChangePassword:e=>{oe.setValue("password",e)}}))}}),(0,d.jsx)(c.zB,{control:oe.control,name:"pin",render:e=>{let t=e.field;return(0,d.jsx)(c.Wf,Fi({label:"PIN",maxLength:6,pattern:te.UO},t))}}),(0,d.jsx)("div",{className:"flex flex-col items-start",children:(0,d.jsx)(c.$n,{asChild:!0,variant:"link",size:"link",children:(0,d.jsx)(n.N_,{to:"/resetcredentials",children:"Forgotten your password or PIN?"})})}),($||W)&&(0,d.jsx)("div",{className:"errors",children:(0,d.jsx)(c.EY,{className:"text-destructive",children:$||(0,d.jsxs)(d.Fragment,{children:["Sorry, we couldn\u2019t find an account that matches those details. If you are having trouble logging in, please try recovering your password and PIN"," ",(0,d.jsx)(n.N_,{className:"text-destructive",to:"/resetcredentials",children:"here"})]})})})]})}),(0,d.jsx)(c.OJ,{primary:(0,d.jsx)(c.$n,{type:"submit",isLoading:Q,isDisabled:Q,children:"Next"}),secondary:(0,d.jsx)(c.$n,{onClick:()=>D("/"),children:"Back"})})]}))}),(0,d.jsx)("div",{className:"hidden md:flex w-full flex-grow",children:(0,d.jsx)("img",{src:"".concat(t,"/resources/side-image-1.jpg"),alt:"",className:"object-cover object-center flex flex 1 w-full"})})]})})};var zi=r(9634);const $i=async e=>{var t;const r=e.userAttributes,n=e.options,i=null===(t=Pe.H.getConfig().Auth)||void 0===t?void 0:t.Cognito,a=null===n||void 0===n?void 0:n.clientMetadata;(0,De.$y)(i);const l=i.userPoolEndpoint,s=i.userPoolId,c=(await(0,o.$)({forceRefresh:!1})).tokens;(0,Te.H0)(c);const u=(d={endpointResolver:(0,ze.o)({endpointOverride:l})},(0,Ve.A)(Ye.e,(0,Ue._)("UpdateUserAttributes"),(0,Be.T)(),(0,qe.A)((0,qe.A)({},_e.C),d)));var d;const m=(await u({region:(0,Me.J)(s),userAgentValue:(0,Fe.A)(Ie.BM.UpdateUserAttributes)},{AccessToken:c.accessToken.toString(),ClientMetadata:a,UserAttributes:(0,zi.Q)(r)})).CodeDeliveryDetailsList;return(0,qe.A)((0,qe.A)({},function(e){var t;const r={};
1return null===(t=Object.keys(e))||void 0===t||t.forEach(e=>{r[e]={isUpdated:!0,nextStep:{updateAttributeStep:"DONE"}}}),r}(r)),function(e){const t={};return null===e||void 0===e||e.forEach(e=>{const r=e.AttributeName,n=e.DeliveryMedium,i=e.Destination;r&&(t[r]={isUpdated:!1,nextStep:{updateAttributeStep:"CONFIRM_ATTRIBUTE_WITH_CODE",codeDeliveryDetails:{attributeName:r,deliveryMedium:n,destination:i}}})}),t}(m))};function Gi(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,a,l=[],s=!0,c=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=o.call(r)).done)&&(l.push(n.value),l.length!==t);s=!0);}catch(e){c=!0,i=e}finally{try{if(!s&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw i}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Hi(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Hi(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Hi(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}const Wi=e=>{let t=e.emailAddress,r=e.onContinue;const n=Gi((0,i.useState)(!1),2),o=n[0],a=n[1];return o?(0,d.jsx)(c.kt,{}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("div",{className:"text-2xl font-bold text-fields",children:"We're migrating your account"}),(0,d.jsx)("div",{className:"py-10",children:"We will send you an email that contains a magic link that will verify your email address and sign you into your Glasgow Credit Union account."}),(0,d.jsx)("div",{children:"Once you have verified your email, the migration is complete and you can continue to use your account."}),(0,d.jsx)("div",{className:"py-10",children:"You need to be able to access your email account from this device to continue."}),(0,d.jsx)("div",{className:"pb-5",children:"The verification link will be sent to:"}),(0,d.jsx)("div",{className:"font-bold text-fields ",children:t})]}),(0,d.jsx)("div",{className:"text-center",children:(0,d.jsx)(c.$n,{className:"w-1/2",onClick:async()=>{a(!0),await r(),a(!1)},children:"Continue"})})]})};function Ki(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function Zi(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Ki(Object(r),!0).forEach(function(t){Qi(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ki(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function Qi(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Ji(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,a,l=[],s=!0,c=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=o.call(r)).done)&&(l.push(n.value),l.length!==t);s=!0);}catch(e){c=!0,i=e}finally{try{if(!s&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw i}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Xi(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Xi(e,t):void 0}}
1(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Xi(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}const eo=e=>{const t=e.inputFields,r=e.onContinue,n=Ji((0,i.useState)(!1),2),o=n[0],a=n[1],l=b.Ik({mobileNumber:A.A.MobilePhone}),s=(0,w.mN)({resolver:(0,k.u)(l),defaultValues:{mobileNumber:t.mobileNumber}});return o?(0,d.jsx)(c.kt,{}):(0,d.jsxs)(c.lV,Zi(Zi({},s),{},{onSubmit:async e=>{a(!0),await r(e.mobileNumber),a(!1)},title:"Your contact details",children:[(0,d.jsxs)(c.sf,{children:[(0,d.jsx)(c.fV,{variant:"h4",as:"h3",children:"Confirm your contact details"}),(0,d.jsx)(c.EY,{children:"Enter your mobile number. We will verify it by sending a one time passcode."}),(0,d.jsx)(c.CL,{children:(0,d.jsx)(c.zB,{control:s.control,name:"mobileNumber",render:e=>{let t=e.field;return(0,d.jsx)(c.ZQ,Zi({label:"Mobile phone number",maxLength:M.dF,onInput:e=>{e.target.value=e.target.value.replace(/[^0-9+]/g,"").toLowerCase()}},t))}})})]}),(0,d.jsx)(c.OJ,{primary:(0,d.jsx)(c.$n,{type:"submit",isLoading:o,isDisabled:!s.getValues("mobileNumber"),children:"Next"})})]}))};function to(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function ro(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function no(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,a,l=[],s=!0,c=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=o.call(r)).done)&&(l.push(n.value),l.length!==t);s=!0);}catch(e){c=!0,i=e}finally{try{if(!s&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw i}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return io(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?io(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function io(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}const oo={1:"Get Started",2:"Security",3:"Personal Details",4:"Verification"},ao={Start:"1",PasswordlessContent:"2",ResendMagicLink:"2",EnterMobileNumber:"3",VerifyMobileNumber:"4",Success:"4"},lo=()=>{const e=no((0,i.useState)("1"),2),t=e[0],r=e[1],o=no((0,i.useState)("Start"),2),a=o[0],l=o[1],s=no((0,i.useState)(!1),2),u=s[0],m=s[1],y=no((0,i.useState)(""),2),f=y[0],p=y[1],h=(0,i.useRef)(new BroadcastChannel("login-token")),b=(0,i.useRef)(!1),w=(0,ve.A)(),k=w.passwordlessAuthenticate,A=w.passwordlessRegister,C=w.passwordlessRequestLoginOtp,O=w.setUserShouldLogIn,E=w.configureAmplify,N=(0,c.dj)().toast,P=(0,n.Zp)(),D=(0,n.zy)().state,I=no((0,S.gpM)(),1)[0];E("passwordless"),g.Q.setKeyValueStorage(v.sZ),(0,i.useEffect)(()=>{null!==D&&void 0!==D&&D.emailAddress&&null!==D&&void 0!==D&&D.memberNumber&&null!==D&&void 0!==D&&D.migrationId&&"boolean"===typeof D.phoneRecordMismatch||P("/")},[D]),(0,i.useEffect)(()=>{const e=async()=>{await v.sZ.clear(),await(0,at.ri)(),P("/",{replace:!0})};return window.addEventListener("popstate",e),()=>{window.removeEventListener("popstate",e)}},[]);const L=D||{},M=L.emailAddress,T=L.memberNumber,F=L.migrationId,q=L.phoneRecordMismatch,V=L.mobileNumber,Y=void 0===V?"":V,U=e=>{const t=Object.entries(ao).find(t=>no(t,1)[0]===e)[1];r(t),l(e)},B=async e=>{if(e instanceof x.K4){const t=(0,re.u$)(e),r=t.message;if("TOKEN_EXPIRED"===t.code)return N({variant:"destructive",title:r,de
1scription:"Please request a new verification email using the link below and try again."})}else if(e instanceof j.l){const t=e.name;if("NotAuthorizedException"===t)return N({variant:"destructive",title:"Your session has expired",description:"Please use the latest email you have from us or use the link below to request a new verification email and try again"});if("CodeMismatchException"===t)return N({variant:"destructive",title:"Invalid code",description:"The code you entered appears to be invalid. Please try again."})}return N({variant:"destructive",title:"Something went wrong",description:"Please try again"})},_=async()=>{try{const e=await A(function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?to(Object(r),!0).forEach(function(t){ro(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):to(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}({email:M,memberNumber:T,migrationId:F},Y&&!q?{mobileNumber:Y}:{}));if(!e.success)throw new Error("");U("PasswordlessContent")}catch(e){B(e)}},z=async()=>{await tt()},$=(0,i.useCallback)(async e=>{if(m(!0),"TOKEN_RECEIVED"===e.data.type&&!b.current)try{var t;const r=await I({variables:{emailAddress:M,token:e.data.token},fetchPolicy:"no-cache"}),n=r.data,i=r.error;if(i)throw i;n&&null!==(t=n.getAuthCode)&&void 0!==t&&t.code&&await(async e=>{let t=e.otpCode;try{(await k({otpCode:t})).success&&(b.current=!0,Y&&q?U("EnterMobileNumber"):(await(0,at.$g)({mobileNumber:f}),U("Success")))}catch(r){B(r)}})({otpCode:n.getAuthCode.code})}catch(r){B(r)}finally{m(!1)}},[I,M]);(0,i.useEffect)(()=>{if("PasswordlessContent"===a){const e=null===h||void 0===h?void 0:h.current,t=b.current;return null!==e&&void 0!==e&&e.onmessage||(e.onmessage=$),()=>{t&&!(null===e||void 0===e||!e.onmessage)&&e.close()}}},[a]);const G=async()=>{try{await C({emailAddress:M}),N({variant:"success",title:"Verification Sent",description:"A new email has been sent to ".concat(M,".")}),U("PasswordlessContent")}catch(e){N({variant:"destructive",title:"Verification Sending Failed",description:"Something has gone wrong, please try again."})}},H=Object.entries(oo).findIndex(e=>no(e,1)[0]===t),W=Object.entries(oo).map(e=>{let t=no(e,2),r=t[0];return{title:t[1],step:r}});return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(c.Jc,{currentStep:H,steps:W}),(0,d.jsx)("div",{className:"flex w-full p-12 sm:p-12 md:p-16 flex-col justify-between text-base",children:(0,d.jsx)(i.Suspense,{fallback:(0,d.jsx)(c.kt,{}),children:(()=>{switch(a){case"Start":default:return(0,d.jsx)(Wi,{emailAddress:M,onContinue:_});case"PasswordlessContent":return(0,d.jsx)(ui,{isLoading:u,emailAddress:M,onResendClick:()=>U("ResendMagicLink")});case"ResendMagicLink":return(0,d.jsx)(yi,{onBack:()=>U("PasswordlessContent"),onResendMagicLink:G,emailAddress:M});case"EnterMobileNumber":return(0,d.jsx)(eo,{onContinue:e=>(async e=>{let t=e.newMobileNumber;p(t);try{const e=(0,re.W6)(t);if(!e||!e.number)throw new Error("");await $i({userAttributes:{phone_number:e.number}}),await tt(),U("VerifyMobileNumber")}catch(r){B(r)}})({newMobileNumber:e}),inputFields:{mobileNumber:f}});case"VerifyMobileNumber":return(0,d.jsx)(se,{mobileNumber:{value:f,obsecure:!0},onContinue:e=>(async e=>{try{await rt(e),await(0,at.$g)({mobileNumber:f}),U("Success")}catch(t){B(t)}})({smsCode:e}),onResendClick:z});case"Success":return(0,d.jsx)(R,{isAccountMigration:!0,onNavigate:()=>O(!0)})}})()})})]})},so=e=>{let t=e.size,r=void 0===t?115:t;return(0,d.jsxs)("svg",{width:r,height:r,viewBox:"0 0 115 115",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,d.jsx)("path",{d:"M28.75 14.375H14.375V28.75",stroke:"#0C496A",strokeWidth:4.0625,strokeLinecap:"round",strokeLinejoin:"round"}),(0,d.jsx)("path",{d:"M86.25 14.375H100.625V28.75",stroke:"#0C496A",strokeWidth:4.0625,strokeLinecap:"round",strokeLinejoin:"round"}),(0,d.jsx)("path",{d:"M28.75 100.625H14.375V86.25",stroke:"#0C496A",strokeWidth:4.0625,strokeLinecap:"round",strokeLinejoin:"round"}),(0,d.jsx)("path",{d:"M33.5417 86.25V81.4583C33.5417 68.2266 44.2683 57.5 57.5001 57.5C70.7318 57.5 81.4584 68.2266 81.4584 81.4583V86.25",stroke:"url
1(#paint0_linear_6162_26078)",strokeWidth:4.0625,strokeLinecap:"round",strokeLinejoin:"round"}),(0,d.jsx)("path",{d:"M57.5 57.5C65.4393 57.5 71.875 51.0643 71.875 43.125C71.875 35.1859 65.4393 28.75 57.5 28.75C49.5607 28.75 43.125 35.1859 43.125 43.125C43.125 51.0643 49.5607 57.5 57.5 57.5Z",stroke:"url(#paint1_linear_6162_26078)",strokeWidth:4.0625,strokeLinecap:"round",strokeLinejoin:"round"}),(0,d.jsx)("path",{d:"M86.25 100.625H100.625V86.25",stroke:"#0C496A",strokeWidth:4.0625,strokeLinecap:"round",strokeLinejoin:"round"}),(0,d.jsxs)("defs",{children:[(0,d.jsxs)("linearGradient",{id:"paint0_linear_6162_26078",x1:39.1351,y1:60.9521,x2:80.777,y2:81.9251,gradientUnits:"userSpaceOnUse",children:[(0,d.jsx)("stop",{stopColor:"#1EAEA5"}),(0,d.jsx)("stop",{offset:1,stopColor:"#2C95B5"})]}),(0,d.jsxs)("linearGradient",{id:"paint1_linear_6162_26078",x1:46.481,y1:32.2021,x2:75.183,y2:40.8755,gradientUnits:"userSpaceOnUse",children:[(0,d.jsx)("stop",{stopColor:"#1EAEA5"}),(0,d.jsx)("stop",{offset:1,stopColor:"#2C95B5"})]})]})]})};function co(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function uo(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?co(Object(r),!0).forEach(function(t){mo(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):co(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function mo(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const yo=e=>{const t=e.helpCentreUrl,r=e.onContinue,n=(0,w.mN)();return(0,d.jsxs)(c.lV,uo(uo({},n),{},{onSubmit:r,title:"We need to verify it's you",children:[(0,d.jsxs)(c.sf,{children:[(0,d.jsx)(c.EY,{children:"We need you to take a selfie and an image of your photo ID using your device camera to verify it's really you. This is to make sure\n someone else isn't trying to access your account."}),(0,d.jsx)(c.EY,{children:"Once you are verified, you will automatically be logged into your dashboard."}),(0,d.jsx)("div",{className:"flex justify-center md:scale-125 lg:scale-150",children:(0,d.jsx)(so,{size:100})})]}),(0,d.jsx)(c.$n,{variant:"link",type:"button",onClick:()=>{window.open(t,"_blank","noopener,noreferrer")},children:"Find out more about our enhanced checks and how we protect your account"}),(0,d.jsx)(c.OJ,{primary:(0,d.jsx)(c.$n,{type:"submit",children:"Continue"})})]}))};function fo(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function po(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?fo(Object(r),!0).forEach(function(t){ho(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):fo(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function ho(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const bo=e=>{const t=e.helpCentreUrl,r=e.onContinue,n=e.onNoId,i=e.onCancel,o=(0,w.mN)();return(0,d.jsxs)(c.lV,po(po({},o),{},{onSubmit:r,title:"You will need to provide valid ID",children:[(0,d.jsxs)(c.sf,{children:[(0,d.jsx)(c.EY,{children:"You will need to provide a valid ID document to verify it's really you. We do this to make sure someone else isn't trying to\n access your account."}),(0,d.jsx)(c.EY,{children:"The following documents are accepted:"}),(0,d.jsx)(c.Pg,{items:[{content:"UK Passport"},{content:"UK Driving Licence"},{content:"UK Residency Permit"}]})]}),(0,d.jsx)(c.$n,{variant:"link",type:"button",onClick:()=>{window.open(t,"_blank","noopener,noreferrer")},children:"Find out more about our enhanced checks and how we protect your account"}),(0,d.jsx)(c.OJ,{primary:(0,d.jsx)(c.$n,{type:"submit",children:"Continue"}),secondary:i&&(0,d.jsx)(c.$n,{onClick:i,children:"Cancel"})}),(0,d.jsx)("div",{className:"text-center mt-4",children:(0,d.jsx)(c.$n,{variant:"link",onClick:n,children:"I don't have any of these documents"})})]}))};var go=r(4080);function vo(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function xo(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};
1t%2?vo(Object(r),!0).forEach(function(t){jo(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):vo(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function jo(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function wo(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,a,l=[],s=!0,c=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=o.call(r)).done)&&(l.push(n.value),l.length!==t);s=!0);}catch(e){c=!0,i=e}finally{try{if(!s&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw i}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return ko(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?ko(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ko(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}const So=e=>{const t=e.helpCentreUrl,r=e.onSuccess,n=e.onRefer,o=e.onCancel,a=(0,ve.A)().logout,l=(0,w.mN)(),s=(0,i.useRef)(!1),u=(0,i.useRef)(null),m=wo((0,i.useState)(!1),2),y=m[0],f=m[1],p=wo((0,i.useState)(!1),2),h=p[0],b=p[1],g=wo((0,i.useState)(!1),2),v=g[0],x=g[1],j=wo((0,S._XJ)(),1)[0],k=wo((0,S.phD)(),1)[0],A=(0,i.useCallback)(()=>{u.current&&(clearInterval(u.current),u.current=null)},[]),C=(0,i.useCallback)(async e=>{switch(e){case S.iSv.Completed:A(),r();break;case S.iSv.Review:A(),await a(),n();break;case S.iSv.Abandoned:A(),o();break;case S.iSv.Error:A(),b(!0);break;case S.iSv.Pending:f(!0);break;default:A()}},[A,r,a,n,o]),O=(0,i.useCallback)(async e=>{try{const t=(await k({variables:{workflowRunId:e}})).data;if(t&&t.getHighRiskVerificationStatus){const e=t.getHighRiskVerificationStatus.status;await C(e)}}catch(t){li.Cp(t,{tags:{location:"RiskCheckVerifyIdentity"}})}},[k,C]),E=(0,i.useCallback)(e=>{A();const t=setInterval(async()=>{await O(e)},5e3);u.current=t},[O,A]),N=(0,i.useCallback)(async e=>{let t=e.sdkToken,r=e.workflowRunId;try{go.S.init({token:t,containerId:"onfido-mount",workflowRunId:r,onComplete:()=>{E(r)},onError:e=>{li.Cp(e,{tags:{location:"RiskCheckVerifyIdentity",step:"SDK_ERROR"}}),b(!0)}})}catch(n){throw li.Cp(n,{tags:{location:"RiskCheckVerifyIdentity",step:"SDK_START"}}),new Error("Failed to start verification. Please try again.")}},[E]),P=(0,i.useCallback)(async()=>{try{const e=!1,t=(await j({variables:{hasBiometrics:e}})).data;if(t&&t.startHighRiskVerification){const e=t.startHighRiskVerification,r=e.sdkToken,n=e.workflowRunId;await N({sdkToken:r,workflowRunId:n})}}catch(e){li.Cp(e,{tags:{location:"RiskCheckVerifyIdentity",step:"FLOW_START"}}),await a(),b(!0)}},[a,j,N]);(0,i.useEffect)(()=>{s.current||(s.current=!0,P())},[P]),(0,i.useEffect)(()=>()=>{A()},[A]);const D=async()=>{b(!1),f(!1),s.current=!1,A(),await P()},I=async()=>{y?x(!0):(A(),await a(),o())},L=async()=>{x(!1),A(),await a(),o()},R=()=>{x(!1)},M=()=>{window.open(t,"_blank","noopener,noreferrer")};return v?(0,d.jsx)(c.lG,{defaultOpen:!0,children:(0,d.jsxs)(c.Cf,{className:"max-w-2xl",onClick:e=>{e.stopPropagation()},children:[(0,d.jsxs)(c.c7,{children:[(0,d.jsx)(c.L3,{children:"Abandon Verification?"}),(0,d.jsx)(c.rr,{children:(0,d.jsx)(c.EY,{as:"span",className:"mt-4 block",children:"If you abandon this process, you might need to complete it again the next time you log in."})})]}),(0,d.jsx)(c.Es,{children:(0,d.jsx)(c.e2,{primary:(0,d.jsx)(c.$n,{onClick:L,children:"Abandon"}),secondary:(0,d.jsx)(c.$n,{onClick:R,children:"Continue"})})})]})}):h?(0,d.jsxs)(c.lV,xo(xo({},l),{},{onSubmit:D,title:"We need to verify your identity",children:[(0,d.jsx)(c.sf,{children:(0,d.jsx)(c.Gb,{topIcon:"error",title:"Something went wrong",subHeading:"We encountered an issue with the verification process. Please try again."})}),(0,d.jsx)(c.$n,{variant:"link",type:"button",onClick:M,children:"Find out more about our enhanced checks and how we protect your account"}),(0,d.jsx)(c.OJ,{primary:(0,d.jsx)(c.$n,{type:"submit",children:"Retry"}),secondary:(0,d.jsx)(c.$n,{type:"button",onClick:I,children:"Close"})})]})):y?(0,d.jsxs)(c.lV,xo(xo({},l),{},{onSubmit:I,title:"We need to verify your identity",children:[(0,d.jsxs)(c.sf,{children:[(0,d.jsx)(c.Gb,{title:"Almost there",subHeading:"We are just finishing some further checks. Thanks for waiting."}),(0,d.jsx)("div",{className:"flex justify-center",children:(0,d.jsx)(c.kt,{})})]}),(0,d.jsx)(c.$n,{variant:"link",type:"button",onClick:M,children:"Find out more about our enhanced checks and how we protect your account"}),(0,d.jsx)(c.OJ,{primary:(0,d.jsx)(c.$n,{type:"submit",children:"Close"})})]})):(0,d.jsxs)("div",{className:"fixed inset-0 bg-white flex justify-center items-center z-50",children:[(0,d.jsx)("div",{className:"absolute inset-0 flex items-center justify-center pointer-events-none z-0",children:(0,d.jsx)(c.kt,{})}),(0,d.jsx)("div",{className:"flex flex-col items-center w-full h-full z-10",children:(0,d.jsx)("div",{id:"onfido-mount",className:" w-full h-full bg-white flex items-center justify-center relative overflow-auto ",style:{minWidth:0,minHeight:0,maxWidth:"100vw",maxHeight:"100vh"}})})]})};function Ao(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function Co(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};
1t%2?Ao(Object(r),!0).forEach(function(t){Oo(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ao(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function Oo(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Eo=e=>{const t=e.onContinue,r=(0,w.mN)();return(0,d.jsxs)(c.lV,Co(Co({},r),{},{onSubmit:t,title:"We've successfully verified your account",children:[(0,d.jsxs)(c.sf,{children:[(0,d.jsx)(c.EY,{children:"Thanks for verifying your account. You are now verified on this device."}),(0,d.jsx)("div",{className:"flex justify-center my-6",children:(0,d.jsx)(bt.g,{icon:"check",size:"3x",className:"text-success rounded-full border-success border-solid w-20 h-20 p-5"})})]}),(0,d.jsx)(c.OJ,{primary:(0,d.jsx)(c.$n,{type:"submit",children:"Continue to Dashboard"})})]}))},No=e=>{let t=e.size,r=void 0===t?115:t;return(0,d.jsxs)("svg",{width:r,height:r,viewBox:"0 0 115 115",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,d.jsx)("path",{d:"M96.0389 100.629H18.9608C11.5911 100.629 6.97942 92.6573 10.653 86.2686L49.1922 19.2438C52.877 12.8354 62.123 12.8354 65.8078 19.2438L104.347 86.2686C108.02 92.6573 103.409 100.629 96.0389 100.629Z",stroke:"#0C496A",strokeWidth:4,strokeLinecap:"round"}),(0,d.jsx)("path",{d:"M57.5 43.125V70.5",stroke:"url(#paint0_linear_7191_24360)",strokeWidth:4,strokeLinecap:"round"}),(0,d.jsx)("path",{d:"M57.5 81.5063L57.5479 81.4531",stroke:"url(#paint1_linear_7191_24360)",strokeWidth:7,strokeLinecap:"round",strokeLinejoin:"round"}),(0,d.jsxs)("defs",{children:[(0,d.jsxs)("linearGradient",{id:"paint0_linear_7191_24360",x1:57.6167,y1:46.412,x2:58.7061,y2:46.424,gradientUnits:"userSpaceOnUse",children:[(0,d.jsx)("stop",{stopColor:"#1EAEA5"}),(0,d.jsx)("stop",{offset:1,stopColor:"#2C95B5"})]}),(0,d.jsxs)("linearGradient",{id:"paint1_linear_7191_24360",x1:57.5056,y1:81.4595,x2:57.5542,y2:81.4727,gradientUnits:"userSpaceOnUse",children:[(0,d.jsx)("stop",{stopColor:"#1EAEA5"}),(0,d.jsx)("stop",{offset:1,stopColor:"#2C95B5"})]})]})]})};function Po(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function Do(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Po(Object(r),!0).forEach(function(t){Io(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Po(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function Io(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Lo=e=>{const t=e.helpCentreUrl,r=e.onClose,n=(0,w.mN)();return(0,d.jsxs)(c.lV,Do(Do({},n),{},{onSubmit:r,title:"We need to verify your identity",children:[(0,d.jsxs)(c.sf,{children:[(0,d.jsx)(c.EY,{children:"We are carrying out some additional checks to get you logged in. This is to make sure someone else isn't trying to access your account."}),(0,d.jsxs)("div",{className:"bg-[var(--tabs)] p-10 flex flex-row items-center gap-4",children:[(0,d.jsx)(bt.g,{icon:"info-circle",className:"text-primary",size:"2x"}
1),(0,d.jsx)(c.EY,{children:"A member of the team will contact you by phone or email to explain how to get your account verified."})]}),(0,d.jsx)("div",{className:"flex justify-center md:scale-125 lg:scale-150",children:(0,d.jsx)(No,{size:100})})]}),(0,d.jsx)(c.$n,{variant:"link",type:"button",onClick:()=>{window.open(t,"_blank","noopener,noreferrer")},children:"Find out more about our enhanced checks and how we protect your account"}),(0,d.jsx)(c.OJ,{primary:(0,d.jsx)(c.$n,{type:"submit",children:"Close"})})]}))};function Ro(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function Mo(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Ro(Object(r),!0).forEach(function(t){To(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ro(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function To(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Fo(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,a,l=[],s=!0,c=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=o.call(r)).done)&&(l.push(n.value),l.length!==t);s=!0);}catch(e){c=!0,i=e}finally{try{if(!s&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw i}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return qo(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?qo(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function qo(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}const Vo=e=>{const t=e.helpCentreUrl,r=e.onSuccess,n=e.onBack,o=(0,w.mN)(),a=Fo((0,i.useState)(!1),2),l=a[0],s=a[1],u=Fo((0,i.useState)(null),2),m=u[0],y=u[1],f=Fo((0,S.$7n)(),1)[0],p=async()=>{try{var e;s(!0),y(null);const t=(await f()).data;if(null===t||void 0===t||null===(e=t.updateHighRiskVerificationNoId)||void 0===e||!e.success)throw new Error("Failed to update high risk verification");r()}catch(t){li.Cp(t,{tags:{location:"RiskCheckNoId"}}),y("We encountered an error making your request. Please try again"),s(!1)}};return m?(0,d.jsxs)(c.lV,Mo(Mo({},o),{},{onSubmit:p,title:"We need to verify your identity",children:[(0,d.jsx)(c.sf,{children:(0,d.jsx)(c.Gb,{topIcon:"error",title:"Something went wrong",subHeading:"We encountered an error making your request. Please try again. If this issue persists, contact us for support."})}),(0,d.jsx)(c.OJ,{primary:(0,d.jsx)(c.$n,{type:"submit",isLoading:l,children:"Retry"})})]})):(0,d.jsxs)(c.lV,Mo(Mo({},o),{},{onSubmit:p,title:"We need to verify your identity",children:[(0,d.jsxs)(c.sf,{children:[(0,d.jsx)(c.EY,{children:"If you don't have one of the required documents, you will need to verify your identity in another way."}),(0,d.jsxs)("div",{className:"bg-[var(--tabs)] p-10 flex flex-row items-center gap-4",children:[(0,d.jsx)(bt.g,{icon:"info-circle",className:"text-primary",size:"2x"}),(0,d.jsx)(c.EY,{children:"If you continue, you will receive an email with instructions on how to complete this process."})]})]}),(0,d.jsx)(c.$n,{variant:"link",type:"button",onClick:()=>{window.open(t,"_blank","noopener,noreferrer")},children:"Find out more about our enhanced checks and how we protect your account"}),(0,d.jsx)(c.OJ,{primary:(0,d.jsx)(c.$n,{type:"submit",isLoading:l,children:"Continue"}),secondary:(0,d.jsx)(c.$n,{onClick:n,children:"Back"})})]}))};function Yo(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function Uo(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};
1t%2?Yo(Object(r),!0).forEach(function(t){Bo(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Yo(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function Bo(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const _o=e=>{const t=e.helpCentreUrl,r=e.onContinue,n=(0,w.mN)();return(0,d.jsxs)(c.lV,Uo(Uo({},n),{},{onSubmit:r,title:"Check your email for next steps",children:[(0,d.jsxs)(c.sf,{children:[(0,d.jsx)(c.EY,{children:"You will shortly receive an email with instructions on how to complete this process."}),(0,d.jsxs)("div",{className:"bg-[var(--tabs)] p-10 flex flex-row items-center gap-4",children:[(0,d.jsx)(bt.g,{icon:"info-circle",className:"text-primary",size:"2x"}),(0,d.jsx)(c.EY,{children:"Please wait at least 30 minutes before contacting us if you haven't received the email, as it can take some time to arrive. If you\n still haven't received it after this time, please check your spam folder or contact our support team for assistance."})]})]}),(0,d.jsx)(c.$n,{variant:"link",type:"button",onClick:()=>{window.open(t,"_blank","noopener,noreferrer")},children:"Find out more about our enhanced checks and how we protect your account"}),(0,d.jsx)(c.OJ,{primary:(0,d.jsx)(c.$n,{type:"submit",children:"Close"})})]}))};function zo(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,a,l=[],s=!0,c=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=o.call(r)).done)&&(l.push(n.value),l.length!==t);s=!0);}catch(e){c=!0,i=e}finally{try{if(!s&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw i}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return $o(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?$o(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function $o(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}const Go=()=>{const e=zo((0,i.useState)("Start"),2),t=e[0],r=e[1],o=(0,n.Zp)(),a=(0,n.zy)().state,l=(0,ve.A)().setUserShouldLogIn,s=(0,S.P2n)({skip:!1,fetchPolicy:"network-only"}),u=s.data,m=s.loading,y=s.error,f=s.refetch;(0,i.useEffect)(()=>{(async()=>{if(!a)return await(0,Ne.C)(),void o("/login",{replace:!0});a.verificationPending&&r("Refer")})()},[a,o]);const p=(0,i.useCallback)(()=>{r("IdentityInfo")},[]),h=(0,i.useCallback)(()=>{r("VerifyIdentity")},[]),b=(0,i.useCallback)(()=>{r("NoId")},[]),g=(0,i.useCallback)(()=>{r("Success")},[]),v=(0,i.useCallback)(()=>{r("Refer")},[]),x=(0,i.useCallback)(()=>{r("NoIdSuccess")},[]),j=(0,i.useCallback)(async()=>{await(0,at.ri)(),o("/login")},[o]),w=(0,i.useCallback)(()=>{l(!0)},[l]);if(m)return(0,d.jsx)("div",{className:"flex flex-1 flex-col p-12 bg-background",children:(0,d.jsx)(c.kt,{})});const k=u.getCreditUnion.helpCentreArticles.find(e=>e.key===S.f_X.HighRiskLogin);if(y||!u||!u.getCreditUnion||!u.getCreditUnion.helpCentreArticles||!k)return(0,d.jsx)("div",{className:"flex flex-1 flex-col p-12 bg-background",children:(0,d.jsxs)("div",{className:"w-half text-center",children:[(0,d.jsx)(c.Gb,{topIcon:"error",title:"Something went wrong",subHeading:"We encountered an issue starting your verification. Please try again. If this issue persists, contact us for support."}),(0,d.jsx)(c.$n,{onClick:()=>f(),children:"Retry"})]})});const A=k.url;return(0,d.jsx)("div",{className:"flex flex-1 flex-col p-12 bg-background",children:(()=>{switch(t){case"Start":default:return(0,d.jsx)(yo,{helpCentreUrl:A,onContinue:p});case"IdentityInfo":return(0,d.jsx)(bo,{helpCentreUrl:A,onContinue:h,onNoId:b});
1case"VerifyIdentity":return(0,d.jsx)(So,{helpCentreUrl:A,onSuccess:g,onRefer:v,onCancel:j});case"Success":return(0,d.jsx)(Eo,{onContinue:w});case"Refer":return(0,d.jsx)(Lo,{helpCentreUrl:A,onClose:j});case"NoId":return(0,d.jsx)(Vo,{helpCentreUrl:A,onSuccess:x,onBack:()=>r("IdentityInfo")});case"NoIdSuccess":return(0,d.jsx)(_o,{helpCentreUrl:A,onContinue:j})}})()})},Ho=e=>{let t=e.contactEmail;const r=(0,n.Zp)();return(0,d.jsx)("div",{className:"flex flex-grow w-full h-full p-12 sm:p-12 md:p-16 ",children:(0,d.jsxs)("div",{className:"flex flex-col h-full",children:[(0,d.jsx)("div",{className:"text-2xl font-bold text-fields",children:"Email us to recover your account"}),(0,d.jsx)("div",{className:"text-base flex flex-grow flex-col justify-between w-full h-full",children:(0,d.jsxs)("div",{children:[(0,d.jsx)("div",{className:"py-10",children:"Only use this process if you are already a member of Glasgow Credit Union but can't remember the email address registered to your account or no longer have access to it."}),(0,d.jsxs)("div",{className:" py-10",children:["Send the following details to"," ",(0,d.jsx)(c.$n,{variant:"link",size:"link",onClick:()=>window.location.href="mailto:".concat(t,"?subject=Account%20Recovery"),children:t})," ","and we will get back to you within 24-48 hours."]}),(0,d.jsx)(c.Pg,{type:"circle",items:[{content:"Your full name"},{content:"The original email address and phone number registered on your account (if you know them)"},{content:"Your member number"},{content:"Your new email address, if you want to update it."}]})]})}),(0,d.jsx)(c.e2,{primary:(0,d.jsx)(c.$n,{className:"w-full",onClick:()=>window.location.href="mailto:".concat(t,"?subject=Account%20Recovery"),children:"Email ".concat(t)}),secondary:(0,d.jsx)(c.$n,{onClick:()=>r("/login"),children:"Back"})})]})})};function Wo(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,a,l=[],s=!0,c=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=o.call(r)).done)&&(l.push(n.value),l.length!==t);s=!0);}catch(e){c=!0,i=e}finally{try{if(!s&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw i}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Ko(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Ko(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ko(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}const Zo=()=>{var e;const t=(0,n.zy)(),r=(0,ve.A)().setUserShouldLogIn,c=Wo((0,i.useState)(!0),2),u=c[0],m=c[1],f=(0,S.P2n)({fetchPolicy:"cache-and-network",nextFetchPolicy:"cache-first"}),p=f.data,h=f.loading,b=f.error;if((0,i.useEffect)(()=>{(async()=>{const e=await(0,o.$)();e&&e.tokens?(r(!0),m(!1)):m(!1)})()},[]),h||u)return(0,d.jsx)(l.A,{});if(b||!p.getCreditUnion)return(0,d.jsx)(a.A,{message:void 0,title:void 0});const g="/"===t.pathname,v=p.getCreditUnion,x=v.resourceUrl,j=v.contactEmail,w=v.termsAndConditionsUrls,k=v.helpCentreArticles,A=null===(e=w.find(e=>"joinPrivacyPolicyAgreement"===e.key))||void 0===e?void 0:e.url;return(0,d.jsx)(hn.A,{resourceUrl:x,allowLogin:g,children:(0,d.jsxs)(n.BV,{children:[(0,d.jsx)(n.qh,{path:"/",element:(0,d.jsx)(y,{})}),(0,d.jsx)(n.qh,{path:"/loggedout",element:(0,d.jsx)(mn,{})}),(0,d.jsx)(n.qh,{path:"/login",element:(0,d.jsx)(ri,{resourceUrl:x,gcuPrivacyPolicyUrl:A})}),(0,d.jsx)(n.qh,{path:"/resetcredentials",element:(0,d.jsx)(s.W,{})}),(0,d.jsx)(n.qh,{path:"/register",element:(0,d.jsx)(pt,{})}),(0,d.jsx)(n.qh,{path:"/join",element:(0,d.jsx)(un,{})}),(0,d.jsx)(n.qh,{path:"/mortgages/calculator",element:(0,d.jsx)(dn.A,{creditUnion:p.getCreditUnion})}),(0,d.jsx)(n.qh,{path:"/action/deposit",element:(0,d.jsx)(pn,{})}),(0,d.jsx)(n.qh,{path:"/bankpay/:paymentRequestRef",element:(0,d.jsx)(Hn,{})}),(0,d.jsx)(n.qh,{path:"/verify/mobile",element:(0,d.jsx)(Xn,{})}),(0,d.jsx)(n.qh,{path:"/bankpay/success",element:(0,d.jsx)(Zn,{})}),(0,d.jsx)(n.qh,{path:"/verify/login",element:(0,d.jsx)(oi,{})}),(0,d.jsx)(n.qh,{path:"/passwordlesslogin",element:(0,d.jsx)(hi,{resourceUrl:x,helpCentreArticles:k})}),(0,d.jsx)(n.qh,{path:"/legacylogin",element:(0,d.jsx)(_i,{resourceUrl:x})}),(0,d.jsx)(n.qh,{path:"/completeregistration",element:(0,d.jsx)(Si,{helpCentreArticles:k})}),(0,d.jsx)(n.qh,{path:"/accountmigration",element:(0,d.jsx)(lo,{})}),(0,d.jsx)(n.qh,{path:"/login/account-check",element:(0,d.jsx)(Go,{})}),(0,d.jsx)(n.qh,{path:"/lostemail",element:(0,d.jsx)(Ho,{contactEmail:j})}),(0,d.jsx)(n.qh,{path:"*",element:(0,d.jsx)(n.C5,{to:"/",replace:!0})})]})})}},3352(e,t){t.A=void 0;t.A=(e,t)=>
1{t.prototype.isBusinessDay=function(){return!![1,2,3,4,5].includes(this.day())},t.prototype.businessDaysAdd=function(e){const t=e<0?-1:1;let r=this.clone(),n=Math.abs(e);for(;n>0;)r=r.add(t,"d"),r.isBusinessDay()&&(n-=1);return r},t.prototype.businessDaysSubtract=function(e){let t=this.clone();return t=t.businessDaysAdd(-1*e),t},t.prototype.businessDiff=function(e){const t=this.clone(),r=e.clone(),n=t>=r;let i=n?r:t;const o=n?t:r;let a=0;if(i.isSame(o))return a;for(;i<o;)i.isBusinessDay()&&(a+=1),i=i.add(1,"d");return n?a:-a},t.prototype.nextBusinessDay=function(){let e=this.clone(),t=1;for(;t<7&&(e=e.add(1,"day"),!e.isBusinessDay());)t+=1;return e},t.prototype.prevBusinessDay=function(){let e=this.clone(),t=1;for(;t<7&&(e=e.subtract(1,"day"),!e.isBusinessDay());)t+=1;return e},t.prototype.businessDaysInMonth=function(){if(!this.isValid())return[];let e=this.clone().startOf("month");const t=this.clone().endOf("month"),r=[];let n=!1;for(;!n;)e.isBusinessDay()&&r.push(e.clone()),e=e.add(1,"day"),e.isAfter(t)&&(n=!0);return r},t.prototype.businessWeeksInMonth=function(){if(!this.isValid())return[];let e=this.clone().startOf("month");const t=this.clone().endOf("month"),r=[];let n=[],i=!1;for(;!i;)e.isBusinessDay()&&n.push(e.clone()),(5===e.day()||e.isSame(t,"day"))&&(r.push(n),n=[]),e=e.add(1,"day"),e.isAfter(t)&&(i=!0);return r}}}}]);
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.