1"use strict";(self.webpackChunkhost=self.webpackChunkhost||[]).push([[6160,2322,7285,5393,8865,1451,2267],{26160:(e,t,o)=>{o.r(t),o.d(t,{AUTH_ID:()=>d,AUTH_NONCE:()=>_,AuthContext:()=>y,CheckAuth:()=>T,REFRESH_TOKEN:()=>m,REWARDS_COOKIES:()=>I,RedirectToOnlineBankingV2:()=>H,SESSION_ID:()=>p,TOKEN:()=>g,WithAuthApi:()=>l,WithAuthContext:()=>M,WithRouterAuthApi:()=>u,WithRouterAuthContext:()=>D,getBaseUrl:()=>x,getCookieValue:()=>A,getCustomerOnBoardingUrl:()=>Y,getLegacyOlbBaseUrl:()=>V,getLegacyOlbUrl:()=>W,initialiseUnbluVisitorApi:()=>z,logoutUnblu:()=>G,navigateToOnlineBankingV1:()=>K,navigateToOnlineBankingV2:()=>F,redirectToOnboarding:()=>q,remoteTokenCookie:()=>O,removeCookie:()=>L,removeRewardsCookies:()=>U,setAccountTopUpDataPrivacyCookie:()=>P,setTokenCookie:()=>v,setUserDataCookies:()=>k,useAuth:()=>B,useAuthApi:()=>h,useAuthContext:()=>N});var n=o(62101),r=o.n(n),s=o(77285);const i=(0,s.createContext)(void 0);var a=o(76386),c=o(52322);const u=()=>(0,c.jsx)(l,{children:(0,c.jsx)(a.Outlet,{})}),l=({children:e})=>{const t=r().create({baseURL:"https://auth-dev.ariefinance.com",headers:{"Content-Type":"application/x-www-form-urlencoded"}});return(0,c.jsx)(i.Provider,{value:{authApi:t},children:e})},h=()=>{const e=(0,s.useContext)(i);if(void 0===e)throw new Error("useAuthApi must be within AuthApiContext Provider");return e},d="auth_id",_="auth_nonce",g="token",m="refreshToken",p="session_id";var f=o(13378),C=o(70486),w=o.n(C);const I=["businessRewardsAccountCustomerEmail","businessRewardsAccountCustomerId","businessRewardsAccountCustomerUserName"];function L(e){document.cookie=`${e}=; domain=.${window.location.hostname}; path=/; SameSite=None; Secure; max-age=0`}function U(){I.forEach(L)}function A(e){var t;return null==(t=document.cookie.split("; ").find((t=>t.startsWith(`${e}=`))))?void 0:t.split("=")[1]}function S(e,t,o){if(A(e)!==t){let n="";if(o){const e=new Date;e.setUTCDate(e.getUTCDate()+o),n=e.toUTCString()}document.cookie=`${e}=${t}; expires=${n}; domain=.${window.location.hostname}; path=/; SameSite=None; Secure`}}function k(e){S("businessRewardsAccountCustomerEmail",e.email),S("businessRewardsAccountCustomerId",e.id),S("businessRewardsAccountCustomerUserName",e.username)}function v(e,t){S("token",e),S("refreshToken",e)}function O(){L("token"),L("refreshToken")}function P(e="0"){S("accountTopUpDataPrivacyModal",e,365)}const x=e=>{const t=window.location.href,o="/online-banking",n=null==t?void 0:t.search(o);return-1===n?e:null==t?void 0:t.substring(0,n+15)};var E=o(91516);const B=()=>{const{olbBaseUrl:e,authClientId:t}=(0,E.useConfigurationContext)(),[o,n]=(0,s.useState)(!1),[r,i]=(0,s.useState)(!1),{authApi:a}=h(),c=t,u=async()=>{try{await l()}catch(e){sessionStorage.clear(),U(),O()}},l=async()=>{n(!0);const e=sessionStorage.getItem(m);e&&await(async e=>{await a.post("as/revoke_token.oauth2",new URLSearchParams({token:e,client_id:c,token_type_hint:"refresh_token"}))})(e),sessionStorage.clear(),U(),window.location.replace("https://auth-dev.ariefinance.com/idp/startSLO.ping?TargetResource=https://www.ariefinance.com/logout/")};return{initLogin:()=>{const t=(()=>{const e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";return[...Array(44)].reduce((t=>t+e.charAt(Math.floor(62*Math.random()))),"")})(),o=(0,f.v1)(),n=(0,f.v1)();sessionStorage.setItem(d,t),sessionStorage.setItem(_,o),sessionStorage.setItem(p,n),window.location.replace(((t,o)=>{const n=x(e);return`https://auth-dev.ariefinance.com/as/authorization.oauth2?code_challenge=${t}&client_id=${c}&response_type=code&scope=openid&redirect_uri=${n}/auth&nonce=${o}`})(t,o))},logout:l,isLoggingOut:o,login:async(t,o,n)=>{if(t&&sessionStorage.getItem(g))o();else{const l=x(e);try{const e=sessionStorage.getItem(d)||"",i=sessionStorage.getItem(_)||"",h=(await a.post("as/token.oauth2",new URLSearchParams({grant_type:"authorization_code",client_id:c,code:t,code_verifier:e,redirect_uri:`${l}/auth`,nonce:i}))).data,p=w()(h.id_token);p&&sessionStorage.getItem(_)===p.nonce?(r=h.access_token,s=h.refresh_token,sessionStorage.removeItem("auth_id"),sessionStorage.removeItem("auth_nonce"),sessionStorage.setItem(g,r),sessionStorage.setItem(m,s),{NX_PUBLIC_AUTH_URL:"https://auth-dev.ariefinance.com",NX_PUBLIC_LEGACY_OLB_BASE_URL:"http://online.ariefinance.com",NX_PUBLIC_APP_
1VERSION:"1.980.2"}.NX_PUBLIC_SHARE_TOKEN_WITH_OLB_PAYMENTS&&v(r),o()):(await u(),n())}catch(i){await u(),n()}}var r,s},refreshAccessToken:async()=>{i(!0);if("true"==={NX_PUBLIC_AUTH_URL:"https://auth-dev.ariefinance.com",NX_PUBLIC_LEGACY_OLB_BASE_URL:"http://online.ariefinance.com",NX_PUBLIC_APP_VERSION:"1.980.2"}.NX_PUBLIC_OFFLINE_MODE)return new Promise((e=>{setTimeout((()=>{i(!1),e()}),1500)}));const e=sessionStorage.getItem(m);if(!e)throw i(!1),new Error("Unable to retrieve new access token, no refresh token exists");{const t=(await a.post("as/token.oauth2",new URLSearchParams({grant_type:"refresh_token",client_id:c,refresh_token:e}))).data;t.refresh_token&&sessionStorage.setItem("refreshToken",t.refresh_token),sessionStorage.setItem("token",t.access_token),i(!1)}},isRefreshingToken:r}},y=(0,s.createContext)(void 0),N=()=>{const e=(0,s.useContext)(y);if(void 0===e)throw new Error("useAuthContext must be within AuthContext Provider");return e};var R=o(99296);const T=()=>{const[e,t]=(0,s.useState)(!0),o=(0,a.useLocation)(),{initLogin:n}=B();return(0,s.useEffect)((()=>{const e=sessionStorage.getItem(g);({NX_PUBLIC_AUTH_URL:"https://auth-dev.ariefinance.com",NX_PUBLIC_LEGACY_OLB_BASE_URL:"http://online.ariefinance.com",NX_PUBLIC_APP_VERSION:"1.980.2"}).NX_PUBLIC_OFFLINE_MODE||e?t(!1):(n(),localStorage.setItem("redirectUrl",o.pathname+o.search))}),[o.pathname,n,o.search]),e?(0,c.jsx)(R.PageLoading,{}):(0,c.jsx)(a.Outlet,{})};var b=o(22254),j=o(11871),X=o(73659);const $=({isOpen:e,onCloseModal:t,onLogout:o,onStayLoggedIn:n})=>(0,c.jsxs)(j.Modal,{isCentered:!0,isOpen:e,onClose:t,size:"2xl",closeOnOverlayClick:!1,children:[(0,c.jsx)(j.ModalOverlay,{}),(0,c.jsx)(j.ModalContent,{"data-testid":"cancel-modal",children:(0,c.jsx)(j.ModalBody,{p:"3.2rem",children:(0,c.jsxs)(j.Box,{children:[(0,c.jsx)(j.Box,{mt:"0.8rem",children:(0,c.jsx)(X.Heading,{textAlign:"center",size:"h2",children:"Are you still there?"})}),(0,c.jsx)(j.Box,{mt:"0.8rem",children:(0,c.jsx)(X.Text,{textAlign:"center",color:"$fg.tertiary",textStyle:"body-02-regular",children:"For security reasons we\u2019ll log you off in 30 seconds"})}),(0,c.jsx)(j.Button,{mt:"3.2rem",w:"100%",variant:"danger",onClick:o,"data-testid":"log-out-button",children:"Log out"}),(0,c.jsx)(j.Button,{mt:"1.6rem",w:"100%",variant:"ghost",id:"stay-logged-in-button",onClick:n,children:"I'm still here"})]})})})]}),D=()=>(0,c.jsx)(M,{children:(0,c.jsx)(a.Outlet,{})}),M=({children:e})=>
1{const[t,o]=(0,s.useState)(!1),{logout:n,isLoggingOut:r,initLogin:i}=B(),a=(0,b.useIdleTimer)({onIdle:()=>n(),onPrompt:()=>o(!0),timeout:27e4,promptBeforeIdle:3e4}),u=sessionStorage.getItem(g)||"",l=()=>(0,c.jsx)($,{isOpen:t,onCloseModal:()=>o(!1),onLogout:()=>n(),onStayLoggedIn:()=>{a.reset(),o(!1)}});return{NX_PUBLIC_AUTH_URL:"https://auth-dev.ariefinance.com",NX_PUBLIC_LEGACY_OLB_BASE_URL:"http://online.ariefinance.com",NX_PUBLIC_APP_VERSION:"1.980.2"}.NX_PUBLIC_OFFLINE_MODE||u?(0,c.jsxs)(y.Provider,{value:{token:u,logout:n,isLoggingOut:r},children:[t&&(0,c.jsx)(l,{}),e]}):(i(),null)},F=e=>{window.location.replace(`${x(e)}/accounts`)},H=({heapEvent:e})=>{const{olbBaseUrl:t}=(0,E.useConfigurationContext)();return(0,s.useEffect)((()=>{window.heap&&e&&window.heap.track(e.heapId,e.heapPayload),F(t)}),[]),null},V=()=>{const e="http://online.ariefinance.com";return e},W=()=>`${V()}/online-banking`,Y=()=>`${V()}/open`,z=()=>new Promise((e=>{let t=0;const o=setInterval((()=>{if(t<20){var n;t+=1;const{unblu:r}=window;null!=r&&null!=(n=r.floating)&&n.api&&(clearInterval(o),r.floating.api.initialize().then((t=>{e(t)})))}else e(null)}),1e3)})),G=async()=>{if("true"!=={NX_PUBLIC_AUTH_URL:"https://auth-dev.ariefinance.com",NX_PUBLIC_LEGACY_OLB_BASE_URL:"http://online.ariefinance.com",NX_PUBLIC_APP_VERSION:"1.980.2"}.NX_PUBLIC_OFFLINE_MODE)try{const t=await z();if(t)try{await t.logout()}catch(e){console.error("Unable to logout Unblu",e)}}catch(t){console.error("Unable to retrieve Unblu visitor API",t)}},K=()=>window.location.replace(W()),q=()=>window.location.replace(Y())},11837:(e,t,o)=>{var n=o(77285),r=Symbol.for("react.element"),s=Symbol.for("react.fragment"),i=Object.prototype.hasOwnProperty,a=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,c={key:!0,ref:!0,__self:!0,__source:!0};function u(e,t,o){var n,s={},u=null,l=null;for(n in void 0!==o&&(u=""+o),void 0!==t.key&&(u=""+t.key),void 0!==t.ref&&(l=t.ref),t)i.call(t,n)&&!c.hasOwnProperty(n)&&(s[n]=t[n]);if(e&&e.defaultProps)for(n in t=e.defaultProps)void 0===s[n]&&(s[n]=t[n]);return{$$typeof:r,type:e,key:u,ref:l,props:s,_owner:a.current}}t.Fragment=s,t.jsx=u,t.jsxs=u},52322:(e,t,o)=>{e.exports=o(11837)}}]);
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.