PageSourceSearch

https://shoplocalee.com/assets/ModalBindCard-3a593c7e.js

js shoplocalee.com collected 2026-10-02 01:44:15 UTC 7,893 bytes, 2 lines download raw bytes

1import{N as u,K as h,r as d,j as e,d as v}from"./vendor-99f70dcc.js";import{bj as s,T as n,ao as S,m as j,db as w,H as T,an as H,t as M}from"./index-4aa601a2.js";import{v as R,a as L,b as y,f as E,c as D}from"./cardValidators-7d54c1d3.js";const k=t=>t.replace(/\s/g,""),V=t=>t.replace(/\D/g,""),z=t=>{const a=t.replace(/\D/g,"");if(a.startsWith("9860"))return"humo";if(a.startsWith("8600"))return"uzcard";if(/^4/.test(a))return"visa";if(/^5[1-5]/.test(a))return"mastercard";if(a.length>=4){const r=parseInt(a.slice(0,4),10);if(r>=2221&&r<=2720)return"mastercard"}return"unknown"},_=t=>{const a=k(t.pan);if(!R(a)||a.length!==16||!L(t.exp)||t.cardHolderName.trim().length<2)return!1;const r=V(t.phone).length;if(r!==9&&r!==12)return!1;const o=z(a);if(o==="humo"||o==="uzcard"){if(t.cvc2.length>0&&!y(t.cvc2))return!1}else if(!y(t.cvc2))return!1;return!0},B={pan:"",exp:"",cardHolderName:"",phone:"",cvc2:""},C=t=>t.replace(/\D/g,""),p="h-12 w-full rounded-3 border-0 bg-surface-transparent-2 px-4 text-base text-text-primary placeholder:text-text-tertiary focus:outline-none",F=u(()=>{const{t}=h(),[a,r]=d.useState(()=>s.lastFormValues??B),o=d.useMemo(()=>_(a),[a]),i=l=>{const c=C(l.target.value).slice(0,16);r(N=>({...N,pan:E(c)}))},x=l=>{const c=D(l.target.value);c.length<=5&&r(N=>({...N,exp:c}))},f=l=>{r(c=>({...c,cvc2:C(l.target.value).slice(0,3)}))},g=l=>{r(c=>({...c,cardHolderName:l.target.value.toUpperCase()}))},b=l=>{r(c=>({...c,phone:C(l.target.value).slice(0,12)}))},m=async l=>{l.preventDefault(),!(!o||s.isLoading)&&await s.submitCardForm(a)};return e.jsxs("form",{onSubmit:m,className:"flex flex-col gap-6",children:[e.jsx(n.Header150Medium,{className:"text-text-primary",children:t("addCardTitle")}),e.jsxs("label",{className:"flex flex-col",children:[e.jsx(n.Text200Semibold,{as:"span",className:"pb-2 text-text-primary",children:t("cardNumber")}),e.jsx("input",{inputMode:"numeric",autoComplete:"cc-number",name:"cardnumber",value:a.pan,onChange:i,maxLength:19,placeholder:"0000 0000 0000 0000",className:p}),e.jsx(n.Text200Regular,{as:"span",className:"py-1 text-text-secondary",children:t("cardNumberHint")})]}),e.jsxs("div",{className:"flex desktop:flex-row flex-col desktop:gap-3 gap-6",children:[e.jsxs("label",{className:"flex flex-1 flex-col",children:[e.jsx(n.Text200Semibold,{as:"span",className:"pb-2 text-text-primary",children:t("cardDetails:expiryDate")}),e.jsx("input",{inputMode:"numeric",autoComplete:"cc-exp",name:"cc-exp",value:a.exp,onChange:x,maxLength:5,placeholder:"MM/YY",className:p}),e.jsx(n.Text200Regular,{as:"span",className:"py-1 text-text-secondary",children:t("expiryDateHint")})]}),e.jsxs("label",{className:"flex flex-1 flex-col",children:[e.jsx(n.Text200Semibold,{as:"span",className:"pb-2 text-text-primary",children:"CVC2/CVV2"}),e.jsx("input",{inputMode:"numeric",autoComplete:"cc-csc",name:"cc-csc",type:"password",value:a.cvc2,onChange:f,maxLength:3,placeholder:"•••",className:p}),e.jsx(n.Text200Regular,{as:"span",className:"py-1 text-text-secondary",children:t("cvcHint")})]})]}),e.jsxs("div",{className:"flex flex-col gap-6 desktop:flex-row desktop:gap-3",children:[e.jsxs("label",{className:"flex flex-1 flex-col",children:[e.jsx(n.Text200Semibold,{as:"span",className:"pb-2 text-text-primary",children:t("cardHolderName")}),e.jsx("input",{autoComplete:"cc-name",name:"ccname",value:a.cardHolderName,onChange:g,placeholder:"NAME SURNAME",className:v([p,"uppercase"])}),e.jsx(n.Text200Regular,{as:"span",className:"py-1 text-text-secondary",children:t("cardHolderHint")})]}),e.jsxs("label",{className:"flex flex-1 flex-col",children:[e.jsx(n.Text200Semibold,{as:"span",className:"pb-2 text-text-primary",children:t("phone")}),e.jsx("input",{inputMode:"tel",autoComplete:"tel",name:"tel",value:a.phone,onChange:b,maxLength:12,placeholder:"990000000000",className:p}),e.jsx(n.Text200Regular,{as:"span",className:"py-1 text-text-secondary",children:t("phoneHint")})]})]}),e.jsx(S,{type:"submit",variant:"brand",size:"xl",disabled:!o,isLoading:s.isLoading,className:"w-full rounded-4 shadow-[0_4px_20px_0_rgba(0,0,0,0.12)]",children:t("continue")})]})}),I=t=>t.replace(/\D/g,""),P=t=>{const a=Math.floor(t/60).toString().padStart(2,"0"),r=(t%60).toString().padStart(2,"0");return`${a}:${r}`},W=u(()=>{var m;const{t}=h(),[a,r]=d.useState(""),o=s.secondsLeft===0,i=((m=s.verification)==null?void 0:m.ph
1one)??"",x=l=>{r(I(l.target.value).slice(0,6)),s.error&&s.setError(null)},f=async l=>{l.preventDefault(),!(a.length!==6||s.isLoading)&&await s.submitSmsKey(a)},g=()=>{r(""),s.resendCode()},b=()=>{s.goBackToForm()};return e.jsxs("form",{onSubmit:f,className:"flex flex-col gap-6",children:[e.jsx(n.Header150Medium,{className:"text-text-primary",children:t("smsCodeTitle")}),e.jsxs("div",{className:"flex flex-col",children:[e.jsxs(n.Text300RegularHigh,{as:"p",className:"text-text-secondary",children:[t("smsCodeSentTo",{phone:""}),e.jsx(n.Text300SemiboldHigh,{as:"span",className:"text-text-primary",children:i})]}),e.jsx("button",{type:"button",onClick:b,className:"w-fit underline decoration-solid",children:e.jsx(n.Text300RegularHigh,{as:"span",className:"text-text-primary",children:t("changeNumber")})})]}),e.jsxs("label",{className:"flex flex-col",children:[e.jsx(n.Text300SemiboldHigh,{as:"span",className:"pb-2 text-text-primary",children:t("enterSmsCode")}),e.jsx("input",{inputMode:"numeric",autoComplete:"one-time-code",value:a,onChange:x,maxLength:6,placeholder:"000000",className:v(["h-12 w-full rounded-3 border-0 px-4 text-base text-text-primary placeholder:text-text-tertiary focus:outline-none",s.error?"bg-system-error-subtle":"bg-surface-transparent-2"])}),s.error?e.jsx(n.Text200Regular,{as:"span",className:"py-1 text-text-error",children:s.error}):o?e.jsx("button",{type:"button",onClick:g,disabled:s.isLoading,className:"w-fit underline disabled:opacity-50",children:e.jsx(n.Text200Semibold,{as:"span",className:"py-1 text-text-primary",children:t("resendCode")})}):e.jsx(n.Text200Regular,{as:"span",className:"py-1 text-text-secondary",children:t("resendIn",{time:P(s.secondsLeft)})})]}),e.jsx(S,{type:"submit",variant:"brand",size:"xl",disabled:a.length!==6,isLoading:s.isLoading,className:"w-full rounded-4 shadow-[0_4px_20px_0_rgba(0,0,0,0.12)]",children:t("continue")})]})}),A=u(()=>{const{t}=h(),a=s.redirectUrl;return d.useEffect(()=>{a&&(j.isRN&&(s.markInAppBrowserOpened(),j.sendToRN("openInAppBrowser",{url:a})),s.handleHostedOtpComplete())},[a]),a?j.isRN?e.jsxs("div",{className:"flex min-h-[320px] flex-col items-center justify-center gap-4 px-6 text-center",children:[e.jsx(w,{size:"xl"}),e.jsx(n.Text300RegularHigh,{as:"p",className:"text-text-primary",children:t("bindCardWaitingConfirmation")})]}):e.jsxs("div",{className:"flex h-[60vh] min-h-[480px] flex-col",children:[e.jsx("h2",{className:"sr-only",children:t("bindCardWebViewTitle")}),e.jsx("iframe",{src:a,title:t("bindCardWebViewTitle"),className:"size-full rounded-3 border-0"})]}):null}),Y=u(()=>{const{t}=h(),{closeModal:a}=T(),r=()=>{s.reset(),a()};return d.useEffect(()=>()=>s.reset(),[]),d.useEffect(()=>{s.shouldClose&&(window.scrollTo({top:0,behavior:"smooth"}),a())},[s.shouldClose,a]),d.useEffect(()=>{const o=i=>{if(i.origin!==window.location.origin||!i.data||typeof i.data!="object"||i.data.event!=="octoPaymentReturn")return;const x=i.data.status;if(x==="canceled"||x==="failed"){s.handleHostedOtpFail();return}s.handleHostedOtpComplete()};return window.addEventListener("message",o),()=>window.removeEventListener("message",o)},[]),e.jsxs(H,{isShow:!0,mode:"bottom-sheet",onBackdropDismiss:r,children:[e.jsx(M,{variant:"shadowS",size:"S",icon:"close",onClick:r,"aria-label":t("close"),className:"absolute desktop:top-6 top-4 desktop:right-8 right-4"}),s.step==="form"&&e.jsx(F,{}),s.step==="sms"&&e.jsx(W,{}),s.step==="webview"&&e.jsx(A,{})]})});export{Y as default};
2//# sourceMappingURL=ModalBindCard-3a593c7e.js.map

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.