PageSourceSearch

https://www.sarstedt.com/_next/static/chunks/pages/[country]/custo…/ListPaymentMethods-97d240feb93a1ecf.js

js sarstedt.com collected 2026-10-03 21:32:56 UTC 6,261 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8427],{31640:(e,t,d)=>{"use strict";d.r(t),d.d(t,{default:()=>p});var n=d(37876),a=d(19581),r=d(14430),i=d(52913),s=d(89099),o=d(14232),l=d(97389),c=d(14169),h=d(30647),m=d(79511),f=d(61985);function p(){let{t:e}=(0,i.A)("forms"),{country:t}=(0,r.JK)((0,s.useRouter)()),{customer:d}=(0,a.cN)(),[p,u]=(0,o.useState)([]),[y,g]=(0,o.useState)(!0),[S,x]=(0,o.useState)(new Set),[w,j]=(0,o.useState)(new Set),[C,E]=(0,o.useState)(!1),[T,b]=(0,o.useState)(null),M=async()=>{try{g(!0);let e=await fetch("/api/customer/list-payment-methods",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({country:t,stripeCustomerId:d?.custom?.fields?.stripeCustomerId})}),n=await e.json();if(n.error)throw Error(n.error.message);u(n?.cards||[])}catch(e){l.$e.show({title:P.error,message:P.failedToLoadPaymentMethods,...a.TF.ERROR})}finally{g(!1)}};(0,o.useEffect)(()=>{M()},[d?.custom?.fields?.stripeCustomerId]);let P={error:e("common:error"),failedToLoadPaymentMethods:e("failedToLoadPaymentMethods"),failedToUpdatePaymentMethod:e("failedToUpdatePaymentMethod"),failedToDeletePaymentMethod:e("failedToDeletePaymentMethod"),noPaymentMethods:e("noPaymentMethods")},k=async d=>{try{if(j(e=>new Set(e).add(d.id)),!(await fetch("/api/customer/update-standard-payment-method",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({paymentMethodId:d.id,isStandard:!0,country:t})})).ok)throw Error("Failed to update payment method");await M(),l.$e.show({title:e("success"),message:e("paymentMethodSetAsStandard",{brand:d.brand.toUpperCase(),last4:d.last4}),...a.TF.SUCCESS})}catch(e){l.$e.show({title:P.error,message:P.failedToUpdatePaymentMethod,...a.TF.ERROR})}finally{j(e=>{let t=new Set(e);return t.delete(d.id),t})}},z=async e=>{b(e),E(!0)},F=async()=>{if(T)try{if(x(e=>new Set(e).add(T.id)),E(!1),!(await fetch("/api/customer/delete-payment-method",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({paymentMethodId:T.id,country:t})})).ok)throw Error("Failed to delete payment method");let d=p.find(e=>e.id!==T.id);if(T.isStandard&&d)try{await k(d)}catch(e){console.error("Failed to set standard card",e)}await M(),l.$e.show({title:e("success"),message:e("paymentMethodDeleted",{brand:T.brand.toUpperCase(),last4:T.last4}),...a.TF.SUCCESS})}catch(e){l.$e.show({title:P.error,message:P.failedToDeletePaymentMethod,...a.TF.ERROR})}finally{T&&x(e=>{let t=new Set(e);return t.delete(T.id),t}),b(null)}};return(0,n.jsxs)(c.s,{w:"100%",direction:"column",gap:"12px",my:"lg",children:[y?(0,n.jsx)(h.E,{c:"dimmed",children:"Loading payment methods..."}):0===p.length?(0,n.jsx)(h.E,{c:"gray.9",children:P.noPaymentMethods}):p.map(e=>(0,n.jsx)(m.default,{paymentMethod:e,handleSaveAsStandard:k,handleDelete:z,isDeleting:S.has(e.id),isSettingStandard:w.has(e.id)},e.id)),(0,n.jsx)(f.default,{opened:C,onClose:()=>{E(!1),b(null)},onDelete:F,brand:T?.brand||"",last4:T?.last4||""})]})}},61985:(e,t,d)=>{"use strict";d.r(t),d.d(t,{default:()=>l});var n=d(37876),a=d(78384),r=d(14169),i=d(30647),s=d(25407),o=d(52913);function l({opened:e,onClose:t,onDelete:d,brand:l,last4:c}){let{t:h}=(0,o.A)("forms"),m={title:h("deletePaymentMethodTitle"),description:h("deletePaymentMethodDescription"),warning:h("deletePaymentMethodWarning"),cancel:h("common:cancel"),delete:h("delete")},f=`${l} **** ${c}`;return(0,n.jsx)(a.a,{opened:e,onClose:t,centered:!0,withCloseButton:!0,size:"xl",children:(0,n.jsxs)(r.s,{direction:"column",gap:16,children:[(0,n.jsx)(i.E,{fw:700,fz:28,style:{marginBottom:0},children:m.title}),(0,n.jsx)(i.E,{fz:18,children:m.description}),(0,n.jsx)(i.E,{fw:700,fz:20,mt:8,children:f}),(0,n.jsx)(i.E,{c:"#C62828",fz:16,mt:4,style:{marginBottom:0},children:m.warning}),(0,n.jsxs)(r.s,{mt:24,gap:16,justify:"center",children:[(0,n.jsx)(s.$,{className:"secondary",onClick:t,children:m.cancel}),(0,n.jsx)(s.$,{color:"red",onClick:d,children:m.delete})]})]})})}},79511:(e,t,d)=>{"use strict";d.r(t),d.d(t,{default:()=>s});var n=d(37876),a=d(14169),r=d(30647),i=d(52913);function s({paymentMethod:e,handleSaveAsStandard:t,handleDelete:d,isDeleting:s,isSettingStandard:o}){let{t:l}=(0,i.A)("forms"),c={standardCard:l("standardCard"),setStandardCard:l("setStandardCard"),
1creditCard:l("creditCard"),delete:l("delete"),edit:l("edit"),cardholderName:l("cardholderName"),validUntil:l("validUntil")};return(0,n.jsxs)(a.s,{direction:"column",w:"100%",p:24,style:{border:"1px solid #E0E0E0",background:"#fff",minHeight:170},children:[(0,n.jsxs)(a.s,{justify:"space-between",align:"flex-start",mb:16,children:[(0,n.jsx)(a.s,{direction:"column",gap:8,children:(0,n.jsxs)(a.s,{align:"start",gap:8,children:[(0,n.jsx)(a.s,{align:"center",justify:"center",style:{background:"#E6F2FB",borderRadius:6,padding:"2px 12px",fontWeight:700,fontSize:18,color:"#222",minWidth:60},children:e.brand.toUpperCase()}),(0,n.jsxs)(a.s,{direction:"column",style:{marginLeft:8},children:[(0,n.jsxs)(r.E,{style:{fontSize:22,fontWeight:600},children:["**** **** **** ",e.last4]}),(0,n.jsx)(r.E,{style:{fontSize:18},children:e.name||c.cardholderName}),(0,n.jsxs)(r.E,{style:{fontSize:18},children:[c.validUntil," ",e.expiryDate]})]})]})}),(0,n.jsxs)(a.s,{direction:"row",align:"center",gap:8,mt:4,children:[e.isStandard&&(0,n.jsx)(a.s,{align:"center",style:{background:"#49AC33",color:"#fff",borderRadius:20,padding:"6px 12px",fontWeight:400,fontSize:16},children:c.standardCard}),(0,n.jsx)(a.s,{align:"center",style:{background:"#F2F2F2",color:"#222",borderRadius:20,padding:"6px 12px",fontWeight:400,fontSize:16},children:c.creditCard})]})]}),(0,n.jsxs)(a.s,{align:"center",direction:"row",gap:16,children:[!e.isStandard&&(0,n.jsx)(r.E,{style:{textDecoration:"underline",fontWeight:400,fontSize:18,cursor:o?"not-allowed":"pointer"},onClick:o?void 0:()=>t(e),children:o?"...":c.setStandardCard}),(0,n.jsx)(r.E,{style:{color:"#E53935",textDecoration:"underline",fontWeight:400,fontSize:18,cursor:s?"not-allowed":"pointer"},onClick:s?void 0:()=>d(e),children:s?"...":c.delete})]})]})}},80740:(e,t,d)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/[country]/customer/payment/ListPaymentMethods",function(){return d(31640)}])}},e=>{e.O(0,[636,6593,8792],()=>e(e.s=80740)),_N_E=e.O()}]);

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.