@primer-io/primer-js 0.1.4 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/custom-elements.json +3636 -1814
- package/dist/jsx/index.d.ts +11 -7
- package/dist/primer-loader.d.ts +110 -38
- package/dist/primer-loader.js +485 -295
- package/dist/primer-react-wrappers.js +2370 -0
- package/dist/vscode.html-custom-data.json +15 -6
- package/dist/web-types.json +29 -15
- package/package.json +23 -1
package/dist/primer-loader.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import{a as Gi,b as fn,c as zr,d as n}from"./chunks/chunk.G45OCYEN.js";var wr=fn((zt,vi)=>{(function(i,t){typeof zt=="object"&&typeof vi=="object"?vi.exports=t():typeof define=="function"&&define.amd?define([],t):typeof zt=="object"?zt.Primer=t():i.Primer=t()})(zt,()=>(()=>{"use strict";let i;var t,e,r={};r.d=(a,l)=>{for(var c in l)r.o(l,c)&&!r.o(a,c)&&Object.defineProperty(a,c,{enumerable:!0,get:l[c]})},r.o=(a,l)=>Object.prototype.hasOwnProperty.call(a,l),r.r=a=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(a,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(a,"__esModule",{value:!0})};var o={};r.r(o),r.d(o,{SuccessScreenType:()=>pn,PaymentFlow:()=>nn,ThreeDSecureStatus:()=>sn,TokenType:()=>ln,isStripeOptionsDropInWithFullMandateText:()=>cn,PaymentInstrumentType:()=>Ct,ErrorCode:()=>dn,EventTypes:()=>mn,CheckoutUXFlow:()=>an,HeadlessManagerType:()=>un,PaymentMethodType:()=>_t,Primer:()=>hn});let s={LEGACY:"legacy",V_2_4:"2.4"},m=s.V_2_4,C=m;class v extends Error{static from(l,c=!1){if(l instanceof v)return l;let E=new v(l instanceof Error?l.message:String(l),c);return l instanceof Error&&l.stack&&(E.stack=l.stack,Object.assign(E,l)),E}markAsReported(){this.isReported=!0}constructor(l,c=!1){super(l),function(E,A,x){A in E?Object.defineProperty(E,A,{value:x,enumerable:!0,configurable:!0,writable:!0}):E[A]=x}(this,"isReported",void 0),this.isReported=c,this.name=this.constructor.name,Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}}let D="https://analytics.production.data.primer.io/sdk-logs";var F=function(a){return a.REQUEST_START="REQUEST_START",a.REQUEST_END="REQUEST_END",a}({}),$=function(a){return a.START="START",a.END="END",a}({});let te={createHeadless:"HEADLESS_LOADING",showUniversalCheckout:"DROP_IN_LOADING",showVaultManager:"VAULT_MANAGER_LOADING",preloadPrimer:"PRELOAD_PRIMER_LOADING"};var B=function(a){return a.NETWORK_CALL_EVENT="NETWORK_CALL_EVENT",a.CRASH_EVENT="CRASH_EVENT",a.TIMER_EVENT="TIMER_EVENT",a.MESSAGE_EVENT="MESSAGE_EVENT",a.V1_EVENT="V1_EVENT",a.SDK_FUNCTION_EVENT="SDK_FUNCTION_EVENT",a}({});async function tt(){if(typeof navigator>"u"||typeof performance>"u")return;let a=await navigator.getBattery?.();return{memoryFootprint:performance.memory?.usedJSHeapSize,screen:{height:screen?.height,width:screen?.width},userAgent:navigator.userAgent,locale:navigator.language,batteryLevel:a?.level,batteryStatus:a?.charging?"CHARGING":"NOT_CHARGING"}}let ka={get(a,l){let c;try{switch(a){case"PRIMER_SDK_VERSION":c="v2.53.4";break;case"PRIMER_ASSETS_URL":c=process.env.PRIMER_ASSETS_URL;break;case"PRIMER_BUILD_INTEGRATION_BUILDER":c=process.env.PRIMER_BUILD_INTEGRATION_BUILDER}}catch{}return c||l}}.get("PRIMER_SDK_VERSION");async function bi(a,l,c){return{...c,createdAt:Date.now(),device:await tt(),eventType:a,properties:l,sdkVersion:ka,sdkType:"WEB"}}let Ei=Symbol.for("__primerAnalytics__"),bt={providers:new Map,timers:new Map,eventsQueue:new Map};if(typeof window<"u"){let a=window[Ei];a?bt=a:window[Ei]=bt}let xi=()=>bt.providers,Ir=()=>bt.timers,Et=()=>bt.eventsQueue,Bt=new Map;function Lr(a,l=!1,c=1){Bt.has(a)&&(clearTimeout(Bt.get(a)),Bt.delete(a));let E=()=>{let x=Et().get(a);if(x?.length){let b=!0,M=[],N=0,S=0;for(;S<x.length;){let O=x[S],H=new Blob([JSON.stringify(O)]).size;if(H>64e3){console.error("Event size exceeds maximum payload size and will be skipped:",O),S++;continue}if(N+H>64e3&&M.length>0){try{b=navigator.sendBeacon(a,JSON.stringify(M))}catch(Y){b=!1,console.error("Unable to send events",Y)}if(!b)break;M=[],N=0}M.push(O),N+=H,S++}if(M.length>0&&b)try{b=navigator.sendBeacon(a,JSON.stringify(M))}catch(O){b=!1,console.error("Unable to send events",O)}b?Et().delete(a):c<5?setTimeout(()=>Lr(a,l,c+1),500*Math.pow(2,c)):console.error("Max retry attempts reached. Events will not be sent.")}};if(l)return void E();let A=setTimeout(E,500);Bt.set(a,A)}let Ci=!1;function Nr({url:a=D,...l}){typeof document>"u"||Ci||(document.addEventListener("visibilitychange",()=>{if(document.visibilityState==="hidden"){let A=rt(l.checkoutSessionId);A.messageEvent({messageType:"VISIBILITY_CHANGE",message:"Checkout visibility is hidden (tab or window change, redirect or being closed)."}),Lr(A.url,!0)}}),Ci=!0);let c=A=>async x=>{if(typeof navigator>"u")return;let b=function N(S,O,H=new WeakSet,Y=0,ae=10){if(Y>ae||H.has(S))return S;H.add(S);let ne=ie=>typeof ie=="object"&&ie!==null?N(ie,O,H,Y+1,ae):O(ie);return Array.isArray(S)?S.map(ne):Object.fromEntries(Object.entries(S).map(([ie,ot])=>[ie,ne(ot)]))}(await bi(A,x,l),N=>{var S;return typeof(S=typeof N=="function"?N.name||"function":N)=="string"&&S.length>5120?`${S.slice(0,5120)}...`:S});Et().has(a)||Et().set(a,[]),Et().get(a)?.push(b),Lr(a)},E={crashEvent:c(B.CRASH_EVENT),messageEvent:c(B.MESSAGE_EVENT),networkCallEvent:c(B.NETWORK_CALL_EVENT),sdkFunctionEvent:c(B.SDK_FUNCTION_EVENT),timerStart:({id:A,...x})=>{let b=`${l.checkoutSessionId}|${A}`,M=performance?.now?performance.now():Date.now();return Ir().set(b,{start:M}),c(B.TIMER_EVENT)({...x,id:A,timerType:$.START})},timerEnd:({id:A,...x})=>{let b=`${l.checkoutSessionId}|${A}`,{start:M}=Ir().get(b)??{};Ir().delete(b);let N=performance?.now?performance.now():Date.now();return c(B.TIMER_EVENT)({...x,id:A,timerType:$.END,duration:M?N-M:void 0})},v1Event:c(B.V1_EVENT),url:a};return xi().set(l.checkoutSessionId,E),rt(l.checkoutSessionId)}function rt(a){return new Proxy({},{get:(l,c)=>(xi().get(a)??Nr({checkoutSessionId:a}))[c]})}let Rr=(a,l,c,E)=>({callType:c?F.REQUEST_END:F.REQUEST_START,id:a,errorBody:c?.error&&JSON.stringify(c.error,Object.getOwnPropertyNames(c.error)),method:l.method,responseCode:c?.status,url:l.url,duration:E});function Ta(a){return a?new Promise(l=>{setTimeout(l,a)}):Promise.resolve()}async function _i(a,l,c,E=Ta){let A=0,x={enabled:l?.enabled??!1,maxRetries:8,initialBackoff:100,retryNetworkErrors:!0,retry500Errors:!1,maxJitter:100};if(!x.enabled)return a();for(;;)try{let b=await a();if(A){let M=`Request succeeded after ${A} retries.`;typeof b=="object"&&b&&"status"in b&&(M+=` Status code: ${b.status}`),c?.({messageType:"RETRY_SUCCESS",message:M,severity:"INFO"})}return b}catch(b){let M=A>=x.maxRetries,N=b.isNetworkError&&!x.retryNetworkErrors,S=b.status&&b.status>=500&&!x.retry500Errors;if(M||N||S){let Y=`Failed after ${A} retries. `;throw M?Y+=`Reached maximum retries (${x.maxRetries}).`:N?Y+="Network error encountered and retryNetworkErrors is disabled.":S&&(Y+="HTTP 500 error encountered and retry500Errors is disabled."),Y+=` Last error: ${b.message}`,c?.({messageType:"RETRY_FAILED",message:Y,severity:"ERROR",errorBody:JSON.stringify(b,Object.getOwnPropertyNames(b))}),Error(Y,{cause:b})}A++;let O=Math.min(x.initialBackoff*Math.pow(2,A-1)+Math.random()*x.maxJitter,Number.MAX_SAFE_INTEGER),H="Unknown error";b.isNetworkError?H="Network error":b.status&&(H=`HTTP ${b.status} error`),c?.({messageType:"RETRY",message:`Retry attempt ${A}/${x.maxRetries} due to: ${H}. Error details: ${b.message}. Waiting for ${O.toFixed(2)}ms before next attempt.`,severity:"WARN",errorBody:JSON.stringify(b,Object.getOwnPropertyNames(b))}),await E(O)}}let Or={cache:new Map};typeof window<"u"&&((t=window)[e="__primerCache__"]??(t[e]=Or),Or=window.__primerCache__);let re=()=>Or.cache;function Ai(){if(re().size<=30)return;let a=Date.now();for(let[l,c]of re())c.exp<a&&re().delete(l);if(re().size>50)for(let[l]of re()){if(re().size<=50)break;re().delete(l)}}let Dr=()=>Mi.randomUUID?.()||wa(),wa=()=>"10000000-1000-4000-8000-100000000000".replace(/[018]/g,a=>(a^Pa()>>a/4).toString(16)),Pa=()=>(Mi.getRandomValues?.(new Uint8Array(1))[0]??16*Math.random())&15,Mi=typeof crypto<"u"?crypto:{},Ia=(a,l,c)=>La(a,"get",l,c),La=async(a,l,c,E,A)=>{let x=Dr(),b=performance?.now(),M=rt(a),N={method:l,url:c,body:A};M.networkCallEvent(Rr(x,N));try{let S=await fetch(c,{body:A,method:l,headers:{"content-type":"application/json","x-request-id":x,...E}});if(!S.ok){let Y=Error(`HTTP error! status: ${S.status}`);throw Y.status=S.status,Y}let O=await S.json();if(c.includes("client-sdk/configuration")){let{primerAccountId:Y,clientSession:{clientSessionId:ae,customer:ne}}=O;M=Nr({checkoutSessionId:a,clientSessionId:ae,customerId:ne?.customerId,primerAccountId:Y,url:M.url})}let H=performance?.now();return M.networkCallEvent(Rr(x,N,{data:O},H-b)),{data:O,headers:S.headers,status:S.status,source:"NETWORK"}}catch(S){let O=performance?.now();throw Object.assign(S,{isNetworkError:S instanceof TypeError}),M.networkCallEvent(Rr(x,N,{error:S},O-b)),S}},Na=(a,l)=>new Promise((c,E)=>{let A=setTimeout(()=>{let x=Error("Request timed out");x.isNetworkError=!0,E(x)},l);a.then(c).catch(E).finally(()=>clearTimeout(A))}),Ra=(a,l)=>{let{headers:c,retryConfig:E,cacheConfig:A,timeout:x=15e3,checkoutSessionId:b}=l,M=rt(b);return function(N){if(!N)return ae=>ae();let{key:S,refresh:O=!1,usePrimerSessionCacheTtlHeader:H=!1,ttl:Y=36e5}=N;return async ae=>{let ne=Date.now(),ie=re().get(S);if(!O&&ie&&ie.exp>ne)return ie.promise;ie&&re().delete(S);let ot=ae().then(At=>{let Bi=Y;return H&&(Bi=1e3*(Number(At.headers.get("x-primer-session-cache-ttl"))||0)),function({key:Ki,ttl:ji=36e5},gn){ji?re().set(Ki,{promise:Promise.resolve({...gn,source:"CACHE"}),exp:Date.now()+ji}):re().delete(Ki)}({key:S,ttl:Bi},At),Ai(),At},At=>{throw re().delete(S),At});return re().set(S,{promise:ot,exp:ne+Y}),Ai(),ot}}(A)(()=>_i(()=>Na(Ia(b,a,c),x),E,N=>M.messageEvent({...N,url:a})))},it=typeof Buffer=="function",Si=typeof TextDecoder=="function"?new TextDecoder:void 0,ki=typeof TextEncoder=="function"?new TextEncoder:void 0,xt=Array.prototype.slice.call("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="),Kt=(a=>{let l={};return a.forEach((c,E)=>l[c]=E),l})(xt),Oa=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,K=String.fromCharCode.bind(String),Ti=typeof Uint8Array.from=="function"?Uint8Array.from.bind(Uint8Array):a=>new Uint8Array(Array.prototype.slice.call(a,0)),wi=a=>a.replace(/=/g,"").replace(/[+\/]/g,l=>l=="+"?"-":"_"),Pi=a=>a.replace(/[^A-Za-z0-9\+\/]/g,""),Ii=typeof btoa=="function"?a=>btoa(a):it?a=>Buffer.from(a,"binary").toString("base64"):a=>{let l,c,E,A,x="",b=a.length%3;for(let M=0;M<a.length;){if((c=a.charCodeAt(M++))>255||(E=a.charCodeAt(M++))>255||(A=a.charCodeAt(M++))>255)throw TypeError("invalid character found");x+=xt[(l=c<<16|E<<8|A)>>18&63]+xt[l>>12&63]+xt[l>>6&63]+xt[63&l]}return b?x.slice(0,b-3)+"===".substring(b):x},$r=it?a=>Buffer.from(a).toString("base64"):a=>{let l=[];for(let c=0,E=a.length;c<E;c+=4096)l.push(K.apply(null,a.subarray(c,c+4096)));return Ii(l.join(""))},ns=(a,l=!1)=>l?wi($r(a)):$r(a),Da=a=>{if(a.length<2){var l=a.charCodeAt(0);return l<128?a:l<2048?K(192|l>>>6)+K(128|63&l):K(224|l>>>12&15)+K(128|l>>>6&63)+K(128|63&l)}var l=65536+(a.charCodeAt(0)-55296)*1024+(a.charCodeAt(1)-56320);return K(240|l>>>18&7)+K(128|l>>>12&63)+K(128|l>>>6&63)+K(128|63&l)},$a=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,Va=a=>a.replace($a,Da),Li=it?a=>Buffer.from(a,"utf8").toString("base64"):ki?a=>$r(ki.encode(a)):a=>Ii(Va(a)),Ha=(a,l=!1)=>l?wi(Li(a)):Li(a),Ua=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,Ya=a=>{switch(a.length){case 4:var l=((7&a.charCodeAt(0))<<18|(63&a.charCodeAt(1))<<12|(63&a.charCodeAt(2))<<6|63&a.charCodeAt(3))-65536;return K((l>>>10)+55296)+K((1023&l)+56320);case 3:return K((15&a.charCodeAt(0))<<12|(63&a.charCodeAt(1))<<6|63&a.charCodeAt(2));default:return K((31&a.charCodeAt(0))<<6|63&a.charCodeAt(1))}},za=a=>a.replace(Ua,Ya),Ni=typeof atob=="function"?a=>atob(Pi(a)):it?a=>Buffer.from(a,"base64").toString("binary"):a=>{if(a=a.replace(/\s+/g,""),!Oa.test(a))throw TypeError("malformed base64.");a+="==".slice(2-(3&a.length));let l,c="",E,A;for(let x=0;x<a.length;)l=Kt[a.charAt(x++)]<<18|Kt[a.charAt(x++)]<<12|(E=Kt[a.charAt(x++)])<<6|(A=Kt[a.charAt(x++)]),c+=E===64?K(l>>16&255):A===64?K(l>>16&255,l>>8&255):K(l>>16&255,l>>8&255,255&l);return c},Ri=it?a=>Ti(Buffer.from(a,"base64")):a=>Ti(Ni(a).split("").map(l=>l.charCodeAt(0))),ss=a=>Ri(Oi(a)),Fa=it?a=>Buffer.from(a,"base64").toString("utf8"):Si?a=>Si.decode(Ri(a)):a=>za(Ni(a)),Oi=a=>Pi(a.replace(/[-_]/g,l=>l=="-"?"+":"/")),Ba=a=>Fa(Oi(a)),ls=a=>({value:a,enumerable:!1,writable:!0,configurable:!0}),Di={encode:Ha,decode:Ba},Ka={encode:function(a,l={}){let{urlSafe:c=!1}=l;return Di.encode(a,c)},decode:Di.decode},$i="The provided `clientToken`",ja=`${$i} has expired`,Ga=`${$i} is malformed`,qa=(a,l,c)=>({"primer-client-token":a,"primer-sdk-client":"WEB","primer-sdk-version":"v2.53.4","primer-sdk-checkout-session-id":l,...c&&{"x-api-version":c}});async function Wa(a,l,c){let{accessToken:E,configurationUrl:A,analyticsUrlV2:x}=function(S){let O=function(Y){try{let[ae,ne]=Y.split(".");return JSON.parse(Ka.decode(ne||ae))}catch{throw Error(Ga)}}(S),H=1e3*O.exp;if(Date.now()>H)throw Error(`${ja}. Expiration date: ${new Date(H).toISOString()}`);return O}(a),b=Nr({checkoutSessionId:l,url:x}),M=C,N=M!==s.LEGACY?M:"2.3";b.timerStart({id:"CONFIGURATION_LOADING"});try{let{data:S,source:O}=await Ra(`${A}/?withDisplayMetadata=true`,{checkoutSessionId:l,headers:qa(E,l,N),retryConfig:{enabled:!0},cacheConfig:c});return b.timerEnd({id:"CONFIGURATION_LOADING",context:{source:O}}),S}catch(S){let O=S instanceof Error?S.message:"Unknown error occurred";throw Error(`Failed to initialize client: ${O}`)}}function Vi(a){return a instanceof Error?{errorBody:a.message,stacktrace:a.stack}:typeof a=="object"&&a!==null&&"message"in a?{errorBody:String(a.message),stacktrace:"stack"in a?String(a.stack):void 0}:{errorBody:String(a||"Unknown error")}}function jt({checkoutSessionId:a,analytics:l,error:c,reporter:E}){l?.crashEvent?l.crashEvent({...Vi(c),reporter:E}):a&&Vr(a,c,E)}async function Vr(a,l,c){let E=await bi(B.CRASH_EVENT,{...Vi(l),reporter:c},{checkoutSessionId:a});try{await fetch(D,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(E)})}catch(A){console.error("Failed to post crash event",A)}}let Hi=Symbol.for("initGlobalErrorMonitoringLoaded"),Ui=(a,l)=>{typeof window<"u"&&window[Hi]||(window[Hi]=!0,window.addEventListener("error",c=>{!Za(c)&&Xa(c)&&jt({checkoutSessionId:a,analytics:l,error:c.error,reporter:"window.onerror"})}),window.addEventListener("unhandledrejection",c=>{let E=c.reason||Error("Unhandled promise rejection");Ja(E)&&jt({checkoutSessionId:a,analytics:l,error:E,reporter:"unhandledrejection"})}))},Za=a=>a.message==="Script error."||!a.filename||a.lineno===0,Xa=a=>{let l=a.filename;return!!(l&&Hr(l))&&!!new v(a.error).isReported||!1},Ja=a=>{if(a&&typeof a=="object"&&"stack"in a&&typeof a.stack=="string"){let l=v.from(a);return!l.isReported&&(!!("fileName"in a&&typeof a.fileName=="string"&&Hr(a.fileName))||Qa(l.stack).some(Hr))}return!1},Hr=a=>{try{return new URL(a,window.location.origin).hostname.endsWith(".primer.io")}catch{return!1}},Qa=a=>{if(!a)return[];let l=a.split(`
|
|
2
|
-
`),c=[],E=/^\s*at\s+(?:.*?\s+)?\(?(.+?):\d+:\d+\)?$/;for(let A of l){let x=A.match(E);if(x&&x[1])c.push(x[1]);else{let b=/@(.*?):\d+:\d+$/,M=A.match(b);M&&M[1]&&c.push(M[1])}}return c};function Yi(a,l,c){return document.querySelector(`${a}[${l}^="${c}"]`)}async function zi(a,l,c,E,A,x){let{analytics:b,name:M=l,retryConfig:N}=x;await _i(()=>new Promise((S,O)=>{let H=Yi(a,c,l)||function(Y,ae){let ne=document.createElement(Y);return Object.entries(ae).forEach(([ie,ot])=>ne.setAttribute(ie,ot)),ne}(a,{...E,[c]:l});H.onload=()=>{b?.sdkFunctionEvent({name:M,params:[`${a.charAt(0).toUpperCase()+a.slice(1)} loaded successfully: ${l}`]}),S()},H.onerror=()=>{H.remove(),O(Error(`${A}: ${l}`))},H.parentNode||document.head.appendChild(H)}),N,S=>b?.messageEvent({...S,url:l}))}async function Fi(a){return i||(i=Promise.all([function(l,c={}){return Yi("script","src",l)&&window.__Primer?(c.analytics?.sdkFunctionEvent({name:c.name??l,params:["Script already loaded"]}),Promise.resolve()):zi("script",l,"src",{...c.attributes,async:"",crossorigin:"anonymous"},"Can't load Primer SDK",c)}("https://sdk.primer.io/web/v2.53.4/PrimerCoreSDK.min.js",{analytics:a,name:"loadPrimerScript"}),function(l,c={}){return Array.from(document.styleSheets).some(E=>E.href===l)?(c.analytics?.sdkFunctionEvent({name:c.name??l,params:["Stylesheet already loaded"]}),Promise.resolve()):zi("link",l,"href",{...c.attributes,rel:"stylesheet"},"Can't load Primer SDK's Stylesheet",c)}("https://sdk.primer.io/web/v2.53.4/Checkout.css",{analytics:a,name:"loadPrimerCss"})]).then(()=>{let l=window.__Primer;return delete window.__Primer,l}).catch(l=>{throw i=void 0,l}))}let en=async()=>{let a=Dr();try{let l=rt(a);try{Ui(a,l),l.sdkFunctionEvent({name:"preloadPrimer"}),l.timerStart({id:te.preloadPrimer}),await Fi(l),l.timerEnd({id:te.preloadPrimer})}catch(c){let E=v.from(c);throw E.isReported||(jt({checkoutSessionId:a,analytics:l,error:E,reporter:"preloadPrimer level 1"}),E.markAsReported()),E}}catch(l){let c=v.from(l);throw c.isReported||(Vr(a,c,"preloadPrimer level 0"),c.markAsReported()),c}},tn=Ur("createHeadless"),rn=Ur("showUniversalCheckout"),on=Ur("showVaultManager");function Ur(a){return async(...[l,c,...E])=>{var A;(A=c?.apiVersion)||console.warn(`[Primer SDK] No API version was explicitly set. Defaulting to '${m}'.`),C=A??m;let x=Dr();try{let b=rt(x);try{Ui(x,b),b.sdkFunctionEvent({name:a,params:[l,c,...E]}),b.timerStart({id:te[a]});let[M,N]=await Promise.all([Wa(l,x,c?.clientSessionCachingEnabled?{key:l,usePrimerSessionCacheTtlHeader:!0}:void 0),Fi(b)]);return N[a](M,x,l,c,...E)}catch(M){let N=v.from(M);throw N.isReported||(jt({checkoutSessionId:x,analytics:b,error:N,reporter:"lazyLoad level 1"}),N.markAsReported()),N}}catch(b){let M=v.from(b);throw M.isReported||(Vr(x,M,"lazyLoad level 0"),M.markAsReported()),M}}}var an=function(a){return a.CHECKOUT="CHECKOUT",a.HEADLESS_CHECKOUT="HEADLESS_CHECKOUT",a.MANAGE_PAYMENT_METHODS="MANAGE_PAYMENT_METHODS",a}({}),nn=function(a){return a.DEFAULT="DEFAULT",a.PREFER_VAULT="PREFER_VAULT",a}({}),sn=function(a){return a.SUCCESS="AUTH_SUCCESS",a.FAILED="AUTH_FAILED",a.SKIPPED="SKIPPED",a.CHALLENGE="CHALLENGE",a}({});let Ct={WORLDPAY_IDEAL:"WORLDPAY_IDEAL",AUTOMATED_CLEARING_HOUSE:"AUTOMATED_CLEARING_HOUSE",ADYEN_KLARNA:"ADYEN_KLARNA",ADYEN_BANCONTACT_CARD:"ADYEN_BANCONTACT_CARD",PAY_NL_KAARTDIRECT:"PAY_NL_KAARTDIRECT",ADYEN_EPS:"ADYEN_EPS",ADYEN_BANCONTACT_PAYCONIQ:"ADYEN_BANCONTACT_PAYCONIQ",OMISE_PROMPTPAY:"OMISE_PROMPTPAY",OMISE_TRUEMONEY:"OMISE_TRUEMONEY",ADYEN_MULTIBANCO:"ADYEN_MULTIBANCO",PACYPAY_WECHAT:"PACYPAY_WECHAT",PACYPAY_ALIPAY:"PACYPAY_ALIPAY",ADYEN_MBWAY:"ADYEN_MBWAY",XENDIT_DANA:"XENDIT_DANA",XENDIT_SHOPEEPAY:"XENDIT_SHOPEEPAY",ADYEN_PAYSHOP:"ADYEN_PAYSHOP",ADYEN_PAYTRAIL:"ADYEN_PAYTRAIL",CLEARPAY:"CLEARPAY",RAPYD_FAST:"RAPYD_FAST",RAPYD_PROMPTPAY:"RAPYD_PROMPTPAY",RAPYD_GCASH:"RAPYD_GCASH",RAPYD_POLI:"RAPYD_POLI",RAPYD_GRABPAY:"RAPYD_GRABPAY",PRIMER_PAYPAL:"PRIMER_PAYPAL",TWOC2P:"TWOC2P",NETS:"NETS",STRIPE_ACH:"STRIPE_ACH",STRIPE_GIROPAY:"STRIPE_GIROPAY",MOLLIE_GIROPAY:"MOLLIE_GIROPAY",MOLLIE_EPS:"MOLLIE_EPS",PAY_NL_EPS:"PAY_NL_EPS",PAY_NL_P24:"PAY_NL_P24",MOLLIE_P24:"MOLLIE_P24",MOLLIE_SOFORT:"MOLLIE_SOFORT",COINBASE:"COINBASE",OPENNODE:"OPENNODE",MOLLIE_GIFT_CARD:"MOLLIE_GIFTCARD",XFERS_PAYNOW:"XFERS_PAYNOW",CARD:"PAYMENT_CARD",APPLE_PAY:"APPLE_PAY",GOOGLE_PAY:"GOOGLE_PAY",PAYPAL:"PAYPAL_ORDER",PAYPAL_VAULTED:"PAYPAL_BILLING_AGREEMENT",GO_CARDLESS:"GOCARDLESS",PAY_NL_IDEAL:"PAY_NL_IDEAL",PAY_NL_SOFORT_BANKING:"PAY_NL_SOFORT_BANKING",PAY_NL_BANCONTACT:"PAY_NL_BANCONTACT",PAY_NL_PAYPAL:"PAY_NL_PAYPAL",PAY_NL_CREDIT_TRANSFER:"PAY_NL_CREDIT_TRANSFER",PAY_NL_DIRECT_DEBIT:"PAY_NL_DIRECT_DEBIT",PAY_NL_GIROPAY:"PAY_NL_GIROPAY",PAY_NL_PAYCONIQ:"PAY_NL_PAYCONIQ",HOOLAH:"HOOLAH",ADYEN_BLIK:"ADYEN_BLIK",ADYEN_VIPPS:"ADYEN_VIPPS",ADYEN_GIROPAY:"ADYEN_GIROPAY",ADYEN_SOFORT:"ADYEN_SOFORT",ADYEN_IDEAL:"ADYEN_IDEAL",ADYEN_TRUSTLY:"ADYEN_TRUSTLY",ADYEN_ALIPAY:"ADYEN_ALIPAY",ADYEN_TWINT:"ADYEN_TWINT",ADYEN_MOBILEPAY:"ADYEN_MOBILEPAY",MOLLIE_BANCONTACT:"MOLLIE_BANCONTACT",MOLLIE_IDEAL:"MOLLIE_IDEAL",BUCKAROO_GIROPAY:"BUCKAROO_GIROPAY",BUCKAROO_EPS:"BUCKAROO_EPS",BUCKAROO_SOFORT:"BUCKAROO_SOFORT",BUCKAROO_BANCONTACT:"BUCKAROO_BANCONTACT",BUCKAROO_IDEAL:"BUCKAROO_IDEAL",ATOME:"ATOME",KLARNA_CUSTOMER_TOKEN:"KLARNA_CUSTOMER_TOKEN"},_t={WORLDPAY_IDEAL:"WORLDPAY_IDEAL",STRIPE_ACH:"STRIPE_ACH",STRIPE_IDEAL:"STRIPE_IDEAL",ADYEN_KLARNA:"ADYEN_KLARNA",ADYEN_BANCONTACT_CARD:"ADYEN_BANCONTACT_CARD",PAY_NL_KAARTDIRECT:"PAY_NL_KAARTDIRECT",ADYEN_EPS:"ADYEN_EPS",ADYEN_BANCONTACT_PAYCONIQ:"ADYEN_BANCONTACT_PAYCONIQ",OMISE_PROMPTPAY:"OMISE_PROMPTPAY",OMISE_TRUEMONEY:"OMISE_TRUEMONEY",ADYEN_MULTIBANCO:"ADYEN_MULTIBANCO",PACYPAY_WECHAT:"PACYPAY_WECHAT",PACYPAY_ALIPAY:"PACYPAY_ALIPAY",ADYEN_MBWAY:"ADYEN_MBWAY",XENDIT_DANA:"XENDIT_DANA",XENDIT_SHOPEEPAY:"XENDIT_SHOPEEPAY",ADYEN_PAYSHOP:"ADYEN_PAYSHOP",ADYEN_PAYTRAIL:"ADYEN_PAYTRAIL",CLEARPAY:"CLEARPAY",RAPYD_FAST:"RAPYD_FAST",RAPYD_PROMPTPAY:"RAPYD_PROMPTPAY",RAPYD_GCASH:"RAPYD_GCASH",RAPYD_POLI:"RAPYD_POLI",RAPYD_GRABPAY:"RAPYD_GRABPAY",PRIMER_PAYPAL:"PRIMER_PAYPAL",TWOC2P:"TWOC2P",NETS:"NETS",STRIPE_GIROPAY:"STRIPE_GIROPAY",MOLLIE_GIROPAY:"MOLLIE_GIROPAY",MOLLIE_EPS:"MOLLIE_EPS",PAY_NL_EPS:"PAY_NL_EPS",PAY_NL_P24:"PAY_NL_P24",MOLLIE_P24:"MOLLIE_P24",MOLLIE_SOFORT:"MOLLIE_SOFORT",COINBASE:"COINBASE",OPENNODE:"OPENNODE",MOLLIE_GIFT_CARD:"MOLLIE_GIFTCARD",XFERS_PAYNOW:"XFERS_PAYNOW",PAYMENT_CARD:"PAYMENT_CARD",APPLE_PAY:"APPLE_PAY",GOOGLE_PAY:"GOOGLE_PAY",PAYPAL:"PAYPAL",GO_CARDLESS:"GOCARDLESS",KLARNA:"KLARNA",PAY_NL_IDEAL:"PAY_NL_IDEAL",PAY_NL_SOFORT_BANKING:"PAY_NL_SOFORT_BANKING",PAY_NL_BANCONTACT:"PAY_NL_BANCONTACT",PAY_NL_PAYPAL:"PAY_NL_PAYPAL",PAY_NL_CREDIT_TRANSFER:"PAY_NL_CREDIT_TRANSFER",PAY_NL_DIRECT_DEBIT:"PAY_NL_DIRECT_DEBIT",PAY_NL_GIROPAY:"PAY_NL_GIROPAY",PAY_NL_PAYCONIQ:"PAY_NL_PAYCONIQ",HOOLAH:"HOOLAH",ADYEN_BLIK:"ADYEN_BLIK",ADYEN_MOBILEPAY:"ADYEN_MOBILEPAY",ADYEN_VIPPS:"ADYEN_VIPPS",ADYEN_GIROPAY:"ADYEN_GIROPAY",ADYEN_SOFORT:"ADYEN_SOFORT",ADYEN_IDEAL:"ADYEN_IDEAL",ADYEN_TRUSTLY:"ADYEN_TRUSTLY",ADYEN_ALIPAY:"ADYEN_ALIPAY",ADYEN_TWINT:"ADYEN_TWINT",ADYEN_BANK_TRANSFER:"ADYEN_BANK_TRANSFER",MOLLIE_BANCONTACT:"MOLLIE_BANCONTACT",MOLLIE_IDEAL:"MOLLIE_IDEAL",BUCKAROO_GIROPAY:"BUCKAROO_GIROPAY",BUCKAROO_EPS:"BUCKAROO_EPS",BUCKAROO_SOFORT:"BUCKAROO_SOFORT",BUCKAROO_BANCONTACT:"BUCKAROO_BANCONTACT",BUCKAROO_IDEAL:"BUCKAROO_IDEAL",ATOME:"ATOME"},ln={SINGLE_USE:"SINGLE_USE",MULTI_USE:"MULTI_USE"};Ct.PAYPAL_VAULTED,_t.PAYPAL,Ct.KLARNA_CUSTOMER_TOKEN,_t.KLARNA,Ct.AUTOMATED_CLEARING_HOUSE,_t.STRIPE_ACH,Ct.CARD,_t.PAYMENT_CARD;var dn=function(a){return a.INITIALIZATION_ERROR="INITIALIZATION_ERROR",a.NO_PAYMENT_METHODS="NO_PAYMENT_METHODS",a.PRIMER_TEARDOWN="PRIMER_TEARDOWN",a.PRIMER_SERVER_ERROR="PRIMER_SERVER_ERROR",a.THREE_DS_AUTH_FAILED="THREE_DS_AUTH_FAILED",a.TOKENIZATION_ERROR="TOKENIZATION_ERROR",a.DUPLICATE_PAYMENT_METHOD_ERROR="DUPLICATE_PAYMENT_METHOD_ERROR",a.CARD_NUMBER_ERROR="CARD_NUMBER_ERROR",a.PAYMENT_METHOD_NOT_SETUP="PAYMENT_METHOD_NOT_SETUP",a.PAYMENT_METHOD_NOT_PROVIDED="PAYMENT_METHOD_NOT_PROVIDED",a.PAYMENT_METHOD_NOT_COMPATIBLE="PAYMENT_METHOD_NOT_COMPATIBLE",a.RESUME_ERROR="RESUME_ERROR",a.VALIDATION_ERROR="VALIDATION_ERROR",a.PAYMENT_FAILED="PAYMENT_FAILED",a.PAYMENT_CREATION_ABORTED="PAYMENT_CREATION_ABORTED",a.PAYMENT_CREATION_DISABLED="PAYMENT_CREATION_DISABLED",a.CLIENT_SESSION_UPDATE_ERROR="CLIENT_SESSION_UPDATE_ERROR",a.INVALID_ARGUMENT="INVALID_ARGUMENT",a.VAULT_FETCH="VAULT_FETCH",a.VAULT_DELETE="VAULT_DELETE",a.HEADLESS_VAULT_MANAGER_VALIDATION="HEADLESS_VAULT_MANAGER_VALIDATION",a.CARD_FORM_VALIDATION_UNEXPECTED_FIELD="CARD_FORM_VALIDATION_UNEXPECTED_FIELD",a.MISSING_FIRST_NAME_OR_LAST_NAME="MISSING_FIRST_NAME_OR_LAST_NAME",a.MISSING_EMAIL_ADDRESS="MISSING_EMAIL_ADDRESS",a.INVALID_FLOW="INVALID_FLOW",a}({});function Gt(a,l,c){return l in a?Object.defineProperty(a,l,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[l]=c,a}class Yr extends v{static fromErrorCode(l,c){return new Yr(l,c)}constructor(l,c){super(c.message),Gt(this,"code",void 0),Gt(this,"diagnosticsId",void 0),Gt(this,"data",void 0),Gt(this,"isFromDeveloper",void 0),this.code=l,this.diagnosticsId=c.diagnosticsId??null,this.data=c.data,this.isFromDeveloper=c.isFromDeveloper??!1,this.name="PrimerClientError",Error.captureStackTrace&&Error.captureStackTrace(this,Yr)}}var pn=function(a){return a.PAYMENT_METHOD="PAYMENT_METHOD",a.CHECK="CHECK",a}({});let cn=a=>{let l=a?.mandateData;return!!l&&"fullMandateText"in l};var mn=function(a){return a.CHANGE="change",a.ERROR="error",a.FOCUS="focus",a.BLUR="blur",a.CLICK="click",a.CLOSE="close",a.CONFIRMED_KLARNA_CATEGORY="CONFIRMED_KLARNA_CATEGORY",a.CONFIRMED_KLARNA_CATEGORY_ERROR="CONFIRMED_KLARNA_CATEGORY_ERROR",a.KLARNA_SESSION_UPDATE="KLARNA_SESSION_UPDATE",a.KLARNA_SESSION_REFRESH_ERROR="KLARNA_SESSION_REFRESH_ERROR",a}({}),un=function(a){return a.CARD="CARD",a.NATIVE="NATIVE",a.REDIRECT="REDIRECT",a.KLARNA="KLARNA",a.ACH="ACH",a}({});let hn={SDK_VERSION:"v2.53.4",createHeadless:tn,showUniversalCheckout:rn,showVaultManager:on,preloadPrimer:en};return o})())});var qt=class{constructor(t){(this.host=t).addController(this)}hostConnected(){}setCardNetworksLoading(){let t={detectedCardNetwork:null,selectableCardNetworks:[],isLoading:!0};this.updateCardNetworksState(t)}updateCardNetworksState(t){this.host.primerEventsController.dispatchCardNetworkChange(t),this.host.sdkContextController.setCardNetworks(t)}async processCardNetworkChangeEvent(t){let{detectedCardNetworks:e,selectableCardNetworks:r}=t,o=e.preferred??e.items[0],s=r?.items??[];this.updateCardNetworksState({detectedCardNetwork:o,selectableCardNetworks:s,isLoading:!1})}};var at=class{constructor(t){(this.host=t).addController(this)}hostConnected(){}dispatchEvent(t,e){this.host.dispatchEvent(new CustomEvent(t,{detail:e,bubbles:!0,composed:!0}))}dispatchSdkState(t){this.dispatchEvent("primer-state-changed",t)}dispatchPaymentMethods(t){this.dispatchEvent("primer-payment-methods-updated",t)}dispatchCheckoutInitialized(t){this.dispatchEvent("primer-checkout-initialized",t)}dispatchCardNetworkChange(t){this.dispatchEvent("primer-card-network-change",t)}dispatchFormSubmitSuccess(t){this.dispatchEvent("primer-card-submit-success",{result:t})}dispatchFormSubmitErrors(t){this.dispatchEvent("primer-card-submit-errors",{errors:t})}};var we=class extends Event{constructor(t,e,r,o){super("context-request",{bubbles:!0,composed:!0}),this.context=t,this.contextTarget=e,this.callback=r,this.subscribe=o??!1}};var nt=class{constructor(t,e,r,o){if(this.subscribe=!1,this.provided=!1,this.value=void 0,this.t=(s,m)=>{this.unsubscribe&&(this.unsubscribe!==m&&(this.provided=!1,this.unsubscribe()),this.subscribe||this.unsubscribe()),this.value=s,this.host.requestUpdate(),this.provided&&!this.subscribe||(this.provided=!0,this.callback&&this.callback(s,m)),this.unsubscribe=m},this.host=t,e.context!==void 0){let s=e;this.context=s.context,this.callback=s.callback,this.subscribe=s.subscribe??!1}else this.context=e,this.callback=r,this.subscribe=o??!1;this.host.addController(this)}hostConnected(){this.dispatchRequest()}hostDisconnected(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=void 0)}dispatchRequest(){this.host.dispatchEvent(new we(this.context,this.host,this.t,this.subscribe))}};var Wt=class{get value(){return this.o}set value(t){this.setValue(t)}setValue(t,e=!1){let r=e||!Object.is(t,this.o);this.o=t,r&&this.updateObservers()}constructor(t){this.subscriptions=new Map,this.updateObservers=()=>{for(let[e,{disposer:r}]of this.subscriptions)e(this.o,r)},t!==void 0&&(this.value=t)}addCallback(t,e,r){if(!r)return void t(this.value);this.subscriptions.has(t)||this.subscriptions.set(t,{disposer:()=>{this.subscriptions.delete(t)},consumerHost:e});let{disposer:o}=this.subscriptions.get(t);t(this.value,o)}clearCallbacks(){this.subscriptions.clear()}};var Fr=class extends Event{constructor(t,e){super("context-provider",{bubbles:!0,composed:!0}),this.context=t,this.contextTarget=e}},j=class extends Wt{constructor(t,e,r){super(e.context!==void 0?e.initialValue:r),this.onContextRequest=o=>{if(o.context!==this.context)return;let s=o.contextTarget??o.composedPath()[0];s!==this.host&&(o.stopPropagation(),this.addCallback(o.callback,s,o.subscribe))},this.onProviderRequest=o=>{if(o.context!==this.context||(o.contextTarget??o.composedPath()[0])===this.host)return;let s=new Set;for(let[m,{consumerHost:C}]of this.subscriptions)s.has(m)||(s.add(m),C.dispatchEvent(new we(this.context,C,m,!0)));o.stopPropagation()},this.host=t,e.context!==void 0?this.context=e.context:this.context=e,this.attachListeners(),this.host.addController?.(this)}attachListeners(){this.host.addEventListener("context-request",this.onContextRequest),this.host.addEventListener("context-provider",this.onProviderRequest)}hostConnected(){this.host.dispatchEvent(new Fr(this.context,this.host))}};function y({context:i,subscribe:t}){return(e,r)=>{typeof r=="object"?r.addInitializer(function(){new nt(this,{context:i,callback:o=>{e.set.call(this,o)},subscribe:t})}):e.constructor.addInitializer(o=>{new nt(o,{context:i,callback:s=>{o[r]=s},subscribe:t})})}}var Zt="cardNetworksContext";var Pe="clientOptionsContext";var Ie="computedStylesContext";var G="headlessInstanceContext";var Xt="klarnaCategoriesContext";var Z="managerContext";var st="paymentMethodsContext";var z="sdkStateContext";var X="vaultManagerContext";var Le="vaultManagerCvvContext";var w=class w{static log(t,...e){w.enabled&&console.log(`%c${w.brandTag}%c ${t}`,w.brandStyle,w.styles.log,...e)}static info(t,...e){w.enabled&&console.info(`%c${w.brandTag}%c ${t}`,w.brandStyle,w.styles.info,...e)}static warn(t,...e){w.enabled&&console.warn(`%c${w.brandTag}%c ${t}`,w.brandStyle,w.styles.warn,...e)}static error(t,...e){w.enabled&&console.error(`%c${w.brandTag}%c ${t}`,w.brandStyle,w.styles.error,...e)}static debug(t,...e){w.enabled&&console.debug(`%c${w.brandTag}%c ${t}`,w.brandStyle,w.styles.debug,...e)}static table(t,e){w.enabled&&console.table(t,e)}static time(t){w.enabled&&console.time(`${w.brandTag} ${t}`)}static timeEnd(t){w.enabled&&console.timeEnd(`${w.brandTag} ${t}`)}};w.enabled=!0,w.defaultFont="font-family: Consolas, monospace; font-size: 12px;",w.brandTag="[PRIMER]",w.brandStyle="background: #24292e; color: #ffffff; padding: 2px 6px; border-radius: 3px; font-weight: bold; margin-right: 4px; "+w.defaultFont,w.styles={log:"color: #4CAF50; "+w.defaultFont,info:"color: #2196F3; "+w.defaultFont,warn:"color: #FF9800; "+w.defaultFont,error:"color: #F44336; "+w.defaultFont,debug:"color: #9C27B0; "+w.defaultFont};var P=w;var Jt={isSuccessful:!1,isProcessing:!1,isLoading:!1,error:null,failure:null},Qt=class{constructor(t){(this.host=t).addController(this),this._state=Jt}hostConnected(){}reducer(t,e){switch(e.type){case"START_LOADING":return{...t,isLoading:!0};case"START_PROCESSING":return{...t,failure:null,isProcessing:!0};case"STOP_PROCESSING":return{...t,isProcessing:!1};case"COMPLETE_PROCESSING":return{...t,isProcessing:!1,isSuccessful:!0};case"SET_ERROR":return P.error(e.payload.message),{...t,isProcessing:!1,error:e.payload};case"SET_FAILURE":return{...t,isProcessing:!1,failure:e.payload};case"COMPLETE_LOADING":return{...t,isLoading:!1};case"RESET":return Jt;default:return t}}dispatch(t){let e=this.reducer(this._state,t);this._state=e,this.host.sdkContextController.setSdkState(e),this.host.primerEventsController.dispatchSdkState(e)}startLoading(){this.dispatch({type:"START_LOADING"})}startProcessing(){this.dispatch({type:"START_PROCESSING"})}stopProcessing(){this.dispatch({type:"STOP_PROCESSING"})}completeProcessing(){this.dispatch({type:"COMPLETE_PROCESSING"})}completeLoading(){this.dispatch({type:"COMPLETE_LOADING"})}setError(t){this.dispatch({type:"SET_ERROR",payload:t})}setFailure(t,e,r){this.dispatch({type:"SET_FAILURE",payload:{code:t,message:e,details:r}})}reset(){this.dispatch({type:"RESET"})}forceCompleteLoading(){this._state.isLoading&&(P.warn("Force completing loading state"),this.completeLoading())}get state(){return this._state}};var er=class{constructor(t){this.sdkStateProvider=null;this.paymentMethodsProvider=null;this.paymentManagerProvider=null;this.cardNetworksContext=null;this.vaultManagerCvvProvider=null;this.clientOptionsContext=null;this.headlessUtilsProvider=null;this.klarnaCategoriesProvider=null;this.computedStylesProvider=null;(this.host=t).addController(this),this.sdkStateProvider=new j(t,{context:z,initialValue:Jt}),this.paymentMethodsProvider=new j(t,{context:st,initialValue:null}),this.paymentManagerProvider=new j(t,{context:Z,initialValue:new Map}),this.cardNetworksContext=new j(t,{context:Zt,initialValue:null}),this.vaultManagerProvider=new j(t,{context:X,initialValue:null}),this.vaultManagerCvvProvider=new j(t,{context:Le,initialValue:null}),this.clientOptionsContext=new j(t,{context:Pe,initialValue:null}),this.klarnaCategoriesProvider=new j(t,{context:Xt,initialValue:{categories:[],isLoading:!0}}),this.headlessUtilsProvider=new j(t,{context:G,initialValue:null}),this.computedStylesProvider=new j(t,{context:Ie,initialValue:null})}hostConnected(){}setSdkState(t){this.sdkStateProvider?.setValue(t)}setPaymentMethods(t){this.paymentMethodsProvider?.setValue(t)}setPaymentManagers(t){this.paymentManagerProvider?.setValue(t)}setCardNetworks(t){this.cardNetworksContext?.setValue(t)}setVaultManager(t){this.vaultManagerProvider?.setValue(t)}setKlarnaCategories(t){this.klarnaCategoriesProvider?.setValue(t)}setClientOptions(t){this.clientOptionsContext?.setValue(t)}setHeadlessUtils(t){this.headlessUtilsProvider?.setValue(t)}setComputedStyles(t){this.computedStylesProvider?.setValue(t)}setVaultManagerCvv(t){this.vaultManagerCvvProvider?.setValue(t)}};var Ke=class Ke{constructor(t){(this.host=t).addController(this)}processCustomStyles(t){try{let e=JSON.parse(t);this.applyStyles(e)}catch(e){P.error("Error parsing customStyles property.",e instanceof Error?e:new Error(String(e)))}}isValidCssProperty(t){return/^[a-zA-Z][a-zA-Z0-9]*$/.test(t)}isValidCssValue(t){let r=/^[\w\s#.,%()\-+/!]+$/.test(t);return r||P.warn(`Rejected potentially unsafe CSS value: ${t}`),r}getCssVarName(t){let e=Ke.cssVarCache.get(t);return e||(e="--"+t.replace(/([A-Z])/g,(r,o)=>"-"+o.toLowerCase()),Ke.cssVarCache.set(t,e)),e}applyStyles(t){let e=[];for(let r of Object.keys(t)){let o=t[r];if(!o)continue;if(!this.isValidCssProperty(r)){P.warn(`Skipping invalid CSS property name: ${r}`);continue}if(!this.isValidCssValue(o))continue;let s=this.getCssVarName(r);e.push([s,o])}if(e.length>0)for(let[r,o]of e)this.host.style.setProperty(r,o)}removeStyle(t){let e=this.getCssVarName(t);this.host.style.removeProperty(e)}clearAllStyles(){for(let t of Ke.cssVarCache.keys()){let e=Ke.cssVarCache.get(t);e&&this.host.style.removeProperty(e)}}hostDisconnected(){}};Ke.cssVarCache=new Map;var tr=Ke;var rr=globalThis,ir=rr.ShadowRoot&&(rr.ShadyCSS===void 0||rr.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Br=Symbol(),qi=new WeakMap,Mt=class{constructor(t,e,r){if(this._$cssResult$=!0,r!==Br)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o,e=this.t;if(ir&&t===void 0){let r=e!==void 0&&e.length===1;r&&(t=qi.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),r&&qi.set(e,t))}return t}toString(){return this.cssText}},Wi=i=>new Mt(typeof i=="string"?i:i+"",void 0,Br),h=(i,...t)=>{let e=i.length===1?i[0]:t.reduce((r,o,s)=>r+(m=>{if(m._$cssResult$===!0)return m.cssText;if(typeof m=="number")return m;throw Error("Value passed to 'css' function must be a 'css' function result: "+m+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(o)+i[s+1],i[0]);return new Mt(e,i,Br)},Kr=(i,t)=>{if(ir)i.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let e of t){let r=document.createElement("style"),o=rr.litNonce;o!==void 0&&r.setAttribute("nonce",o),r.textContent=e.cssText,i.appendChild(r)}},or=ir?i=>i:i=>i instanceof CSSStyleSheet?(t=>{let e="";for(let r of t.cssRules)e+=r.cssText;return Wi(e)})(i):i;var{is:vn,defineProperty:yn,getOwnPropertyDescriptor:bn,getOwnPropertyNames:En,getOwnPropertySymbols:xn,getPrototypeOf:Cn}=Object,Ne=globalThis,Zi=Ne.trustedTypes,_n=Zi?Zi.emptyScript:"",An=Ne.reactiveElementPolyfillSupport,St=(i,t)=>i,kt={toAttribute(i,t){switch(t){case Boolean:i=i?_n:null;break;case Object:case Array:i=i==null?i:JSON.stringify(i)}return i},fromAttribute(i,t){let e=i;switch(t){case Boolean:e=i!==null;break;case Number:e=i===null?null:Number(i);break;case Object:case Array:try{e=JSON.parse(i)}catch{e=null}}return e}},lt=(i,t)=>!vn(i,t),Xi={attribute:!0,type:String,converter:kt,reflect:!1,hasChanged:lt};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),Ne.litPropertyMetadata??(Ne.litPropertyMetadata=new WeakMap);var be=class extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??(this.l=[])).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=Xi){if(e.state&&(e.attribute=!1),this._$Ei(),this.elementProperties.set(t,e),!e.noAccessor){let r=Symbol(),o=this.getPropertyDescriptor(t,r,e);o!==void 0&&yn(this.prototype,t,o)}}static getPropertyDescriptor(t,e,r){let{get:o,set:s}=bn(this.prototype,t)??{get(){return this[e]},set(m){this[e]=m}};return{get(){return o?.call(this)},set(m){let C=o?.call(this);s.call(this,m),this.requestUpdate(t,C,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??Xi}static _$Ei(){if(this.hasOwnProperty(St("elementProperties")))return;let t=Cn(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(St("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(St("properties"))){let e=this.properties,r=[...En(e),...xn(e)];for(let o of r)this.createProperty(o,e[o])}let t=this[Symbol.metadata];if(t!==null){let e=litPropertyMetadata.get(t);if(e!==void 0)for(let[r,o]of e)this.elementProperties.set(r,o)}this._$Eh=new Map;for(let[e,r]of this.elementProperties){let o=this._$Eu(e,r);o!==void 0&&this._$Eh.set(o,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){let e=[];if(Array.isArray(t)){let r=new Set(t.flat(1/0).reverse());for(let o of r)e.unshift(or(o))}else t!==void 0&&e.push(or(t));return e}static _$Eu(t,e){let r=e.attribute;return r===!1?void 0:typeof r=="string"?r:typeof t=="string"?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(t=>t(this))}addController(t){(this._$EO??(this._$EO=new Set)).add(t),this.renderRoot!==void 0&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){let t=new Map,e=this.constructor.elementProperties;for(let r of e.keys())this.hasOwnProperty(r)&&(t.set(r,this[r]),delete this[r]);t.size>0&&(this._$Ep=t)}createRenderRoot(){let t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Kr(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),this._$EO?.forEach(t=>t.hostConnected?.())}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.())}attributeChangedCallback(t,e,r){this._$AK(t,r)}_$EC(t,e){let r=this.constructor.elementProperties.get(t),o=this.constructor._$Eu(t,r);if(o!==void 0&&r.reflect===!0){let s=(r.converter?.toAttribute!==void 0?r.converter:kt).toAttribute(e,r.type);this._$Em=t,s==null?this.removeAttribute(o):this.setAttribute(o,s),this._$Em=null}}_$AK(t,e){let r=this.constructor,o=r._$Eh.get(t);if(o!==void 0&&this._$Em!==o){let s=r.getPropertyOptions(o),m=typeof s.converter=="function"?{fromAttribute:s.converter}:s.converter?.fromAttribute!==void 0?s.converter:kt;this._$Em=o,this[o]=m.fromAttribute(e,s.type),this._$Em=null}}requestUpdate(t,e,r){if(t!==void 0){if(r??(r=this.constructor.getPropertyOptions(t)),!(r.hasChanged??lt)(this[t],e))return;this.P(t,e,r)}this.isUpdatePending===!1&&(this._$ES=this._$ET())}P(t,e,r){this._$AL.has(t)||this._$AL.set(t,e),r.reflect===!0&&this._$Em!==t&&(this._$Ej??(this._$Ej=new Set)).add(t)}async _$ET(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}let t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this._$Ep){for(let[o,s]of this._$Ep)this[o]=s;this._$Ep=void 0}let r=this.constructor.elementProperties;if(r.size>0)for(let[o,s]of r)s.wrapped!==!0||this._$AL.has(o)||this[o]===void 0||this.P(o,this[o],s)}let t=!1,e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach(r=>r.hostUpdate?.()),this.update(e)):this._$EU()}catch(r){throw t=!1,this._$EU(),r}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Ej&&(this._$Ej=this._$Ej.forEach(e=>this._$EC(e,this[e]))),this._$EU()}updated(t){}firstUpdated(t){}};be.elementStyles=[],be.shadowRootOptions={mode:"open"},be[St("elementProperties")]=new Map,be[St("finalized")]=new Map,An?.({ReactiveElement:be}),(Ne.reactiveElementVersions??(Ne.reactiveElementVersions=[])).push("2.0.4");var Re={INITIAL:0,PENDING:1,COMPLETE:2,ERROR:3},I=Symbol(),R=class{get taskComplete(){return this.t||(this.i===1?this.t=new Promise((t,e)=>{this.o=t,this.h=e}):this.i===3?this.t=Promise.reject(this.l):this.t=Promise.resolve(this.u)),this.t}constructor(t,e,r){this.p=0,this.i=0,(this._=t).addController(this);let o=typeof e=="object"?e:{task:e,args:r};this.v=o.task,this.j=o.args,this.m=o.argsEqual??Ji,this.k=o.onComplete,this.A=o.onError,this.autoRun=o.autoRun??!0,"initialValue"in o&&(this.u=o.initialValue,this.i=2,this.O=this.T?.())}hostUpdate(){this.autoRun===!0&&this.S()}hostUpdated(){this.autoRun==="afterUpdate"&&this.S()}T(){if(this.j===void 0)return;let t=this.j();if(!Array.isArray(t))throw Error("The args function must return an array");return t}async S(){let t=this.T(),e=this.O;this.O=t,t===e||t===void 0||e!==void 0&&this.m(e,t)||await this.run(t)}async run(t){let e,r;t??(t=this.T()),this.O=t,this.i===1?this.q?.abort():(this.t=void 0,this.o=void 0,this.h=void 0),this.i=1,this.autoRun==="afterUpdate"?queueMicrotask(()=>this._.requestUpdate()):this._.requestUpdate();let o=++this.p;this.q=new AbortController;let s=!1;try{e=await this.v(t,{signal:this.q.signal})}catch(m){s=!0,r=m}if(this.p===o){if(e===I)this.i=0;else{if(s===!1){try{this.k?.(e)}catch{}this.i=2,this.o?.(e)}else{try{this.A?.(r)}catch{}this.i=3,this.h?.(r)}this.u=e,this.l=r}this._.requestUpdate()}}abort(t){this.i===1&&this.q?.abort(t)}get value(){return this.u}get error(){return this.l}get status(){return this.i}render(t){switch(this.i){case 0:return t.initial?.();case 1:return t.pending?.();case 2:return t.complete?.(this.value);case 3:return t.error?.(this.error);default:throw Error("Unexpected status: "+this.i)}}},Ji=(i,t)=>i===t||i.length===t.length&&i.every((e,r)=>!lt(e,t[r]));var Tt={enabled:!1,isLoading:!1,cvvRecapture:!1,vaultedPaymentMethods:[],createCvvInput:void 0,deleteVaultedPaymentMethod:()=>Promise.resolve(),startVaultedPaymentFlow:()=>Promise.resolve()},ar={cvvInput:null,formIsDirty:!1,setCvvInput:()=>{},selectedVaultedPaymentMethod:null,setSelectedVaultedPaymentMethod:()=>{}};function jr(i,t,e){switch(t.type){case"SET_LOADING":return{...i,isLoading:t.payload};case"INITIALIZE_VAULT_MANAGER":return{...i,enabled:t.vaultEnabled,cvvRecapture:t.cvvRecapture,deleteVaultedPaymentMethod:e.deleteVaultedPaymentMethod,startVaultedPaymentFlow:e.startVaultedPaymentFlow,createCvvInput:e.createCvvInput};case"UPDATE_PAYMENT_METHODS":return{...i,vaultedPaymentMethods:t.payload,isLoading:t.isLoading??!1};case"SET_ERROR":return P.error("VaultManagerController",t.payload.message),{...i,isLoading:!1};case"DISABLE":return{...Tt,enabled:!1};case"RESET":return Tt;default:return i}}function Gr(i,t,e){switch(t.type){case"INITIALIZE_CVV":return{...i,setCvvInput:e.setCvvInput,setSelectedVaultedPaymentMethod:e.setSelectedVaultedPaymentMethod};case"SET_FORM_DIRTY":return{...i,formIsDirty:t.payload};case"SET_CVV_INPUT":return{...i,cvvInput:t.payload};case"SET_SELECTED_VAULTED_PAYMENT_METHOD":return{...i,selectedVaultedPaymentMethod:t.payload};case"RESET_CVV":return ar;default:return i}}var wt=class{constructor(t){this._vaultManager=null;this._options=null;this.deleteVaultedPaymentMethod=async t=>{if(!this._vaultManager)throw new Error("Vault manager not initialized");try{this.dispatchVaultManager({type:"UPDATE_PAYMENT_METHODS",payload:this._vaultManagerState.vaultedPaymentMethods,isLoading:!0}),await this._vaultManager.deleteVaultedPaymentMethod(t),await this.fetchVaultedPaymentMethods()}catch(e){throw this.dispatchVaultManager({type:"SET_ERROR",payload:e instanceof Error?e:new Error("Failed to delete payment method")}),e}};this.setCvvInput=t=>{this.dispatchVaultItem({type:"SET_CVV_INPUT",payload:t})};this.startVaultedPaymentFlow=async()=>{if(!this._vaultManager)throw new Error("Vault manager not initialized");let t=this._vaultItemState.selectedVaultedPaymentMethod,e=this._vaultManagerState.cvvRecapture,r=this._vaultItemState.cvvInput;if(!t||e&&(!r||r.metadata.error)){this.dispatchVaultItem({type:"SET_FORM_DIRTY",payload:!0});return}this.host.sdkStateController.startProcessing();try{await this._vaultManager.startPaymentFlow(t.id,e?{cvv:r.valueToken}:void 0)}catch(o){P.error("VaultManagerController: Error starting vaulted payment flow",o),this.dispatchVaultManager({type:"SET_ERROR",payload:o instanceof Error?o:new Error("Failed to start vaulted payment flow")}),this.host.sdkStateController.stopProcessing()}};this.setSelectedVaultedPaymentMethod=t=>{this.dispatchVaultItem({type:"SET_SELECTED_VAULTED_PAYMENT_METHOD",payload:t}),this.dispatchVaultItem({type:"SET_FORM_DIRTY",payload:!1})};(this.host=t).addController(this),this._vaultManagerState=Tt,this._vaultItemState=ar,new R(this.host,{task:async([e,r])=>{if(!e||!r?.vaultEnabled)return this.dispatchVaultManager({type:"DISABLE"}),I;this.dispatchVaultManager({type:"SET_LOADING",payload:!0});try{this.dispatchVaultManager({type:"INITIALIZE_VAULT_MANAGER",payload:e,vaultEnabled:r.vaultEnabled,cvvRecapture:!!r.captureVaultedCardCvv}),this.dispatchVaultItem({type:"INITIALIZE_CVV",createCvvInput:e.createCvvInput}),await this.fetchVaultedPaymentMethods(),P.log("VaultManagerController: Vault initialized successfully",{coreState:this._vaultManagerState,cvvState:this._vaultItemState})}catch(o){P.error("VaultManagerController: Failed to initialize vault",o),this.dispatchVaultManager({type:"SET_ERROR",payload:o instanceof Error?o:new Error("Unknown error")})}return this._vaultManager},args:()=>[this.vaultManager,this.options]})}initializeVaultManager(t,e){this.vaultManager=t,this.options=e??null}get vaultManager(){return this._vaultManager}set vaultManager(t){this._vaultManager=t,this.host.requestUpdate()}get options(){return this._options}set options(t){this._options=t,this.host.requestUpdate()}hostDisconnected(){this.vaultManager=null,this.dispatchVaultManager({type:"RESET"})}dispatchVaultManager(t){let e={deleteVaultedPaymentMethod:this.deleteVaultedPaymentMethod,startVaultedPaymentFlow:this.startVaultedPaymentFlow,createCvvInput:this.vaultManager?.createCvvInput},r=jr(this._vaultManagerState,t,e);this._vaultManagerState=r,this.host.sdkContextController.setVaultManager(r)}dispatchVaultItem(t){let e={setCvvInput:this.setCvvInput,setSelectedVaultedPaymentMethod:this.setSelectedVaultedPaymentMethod},r=Gr(this._vaultItemState,t,e);this._vaultItemState=r,this.host.sdkContextController.setVaultManagerCvv(r)}async fetchVaultedPaymentMethods(){if(!this._vaultManager)throw new Error("Vault manager not initialized");try{this.dispatchVaultManager({type:"UPDATE_PAYMENT_METHODS",payload:this._vaultManagerState.vaultedPaymentMethods,isLoading:!0});let t=await this._vaultManager.fetchVaultedPaymentMethods();return P.log("VaultManagerController: Fetched payment methods",t),this.dispatchVaultManager({type:"UPDATE_PAYMENT_METHODS",payload:t,isLoading:!1}),t}catch(t){throw this.dispatchVaultManager({type:"SET_ERROR",payload:t instanceof Error?t:new Error("Failed to fetch payment methods")}),t}}};var Pt="lit-localize-status";var Qi=i=>typeof i!="string"&&"strTag"in i,nr=(i,t,e)=>{let r=i[0];for(let o=1;o<i.length;o++)r+=t[e?e[o-1]:o-1],r+=i[o];return r};var It=i=>Qi(i)?nr(i.strings,i.values):i;var _=It,eo=!1;function qr(i){if(eo)throw new Error("lit-localize can only be configured once");_=i,eo=!0}var Wr=class{constructor(t){this.__litLocalizeEventHandler=e=>{e.detail.status==="ready"&&this.host.requestUpdate()},this.host=t}hostConnected(){window.addEventListener(Pt,this.__litLocalizeEventHandler)}hostDisconnected(){window.removeEventListener(Pt,this.__litLocalizeEventHandler)}},Mn=i=>i.addController(new Wr(i)),to=Mn;var L=()=>(i,t)=>(i.addInitializer(to),i);var Lt=class{constructor(){this.settled=!1,this.promise=new Promise((t,e)=>{this._resolve=t,this._reject=e})}resolve(t){this.settled=!0,this._resolve(t)}reject(t){this.settled=!0,this._reject(t)}};var Ee=[];for(let i=0;i<256;i++)Ee[i]=(i>>4&15).toString(16)+(i&15).toString(16);function ro(i){let t=0,e=8997,r=0,o=33826,s=0,m=40164,C=0,v=52210;for(let D=0;D<i.length;D++)e^=i.charCodeAt(D),t=e*435,r=o*435,s=m*435,C=v*435,s+=e<<8,C+=o<<8,r+=t>>>16,e=t&65535,s+=r>>>16,o=r&65535,v=C+(s>>>16)&65535,m=s&65535;return Ee[v>>8]+Ee[v&255]+Ee[m>>8]+Ee[m&255]+Ee[o>>8]+Ee[o&255]+Ee[e>>8]+Ee[e&255]}var Sn="",kn="h",Tn="s";function io(i,t){return(t?kn:Tn)+ro(typeof i=="string"?i:i.join(Sn))}var oo=new WeakMap,ao=new Map;function no(i,t,e){if(i){let r=e?.id??wn(t),o=i[r];if(o){if(typeof o=="string")return o;if("strTag"in o)return nr(o.strings,t.values,o.values);{let s=oo.get(o);return s===void 0&&(s=o.values,oo.set(o,s)),{...o,values:s.map(m=>t.values[m])}}}}return It(t)}function wn(i){let t=typeof i=="string"?i:i.strings,e=ao.get(t);return e===void 0&&(e=io(t,typeof i!="string"&&!("strTag"in i)),ao.set(t,e)),e}function Zr(i){window.dispatchEvent(new CustomEvent(Pt,{detail:i}))}var lr="",Xr,so,dr,Jr,lo,je=new Lt;je.resolve();var sr=0,po=i=>(qr((t,e)=>no(lo,t,e)),lr=so=i.sourceLocale,dr=new Set(i.targetLocales),dr.add(i.sourceLocale),Jr=i.loadLocale,{getLocale:Pn,setLocale:In}),Pn=()=>lr,In=i=>{if(i===(Xr??lr))return je.promise;if(!dr||!Jr)throw new Error("Internal error");if(!dr.has(i))throw new Error("Invalid locale code");sr++;let t=sr;return Xr=i,je.settled&&(je=new Lt),Zr({status:"loading",loadingLocale:i}),(i===so?Promise.resolve({templates:void 0}):Jr(i)).then(r=>{sr===t&&(lr=i,Xr=void 0,lo=r.templates,Zr({status:"ready",readyLocale:i}),je.resolve())},r=>{sr===t&&(Zr({status:"error",errorLocale:i,errorMessage:r.toString()}),je.reject(r))}),je.promise};var Qr="en",ei=["ar","bg","ca","cs","da","de","el","en-GB","es","es-AR","es-MX","et-EE","fi-FI","fr","he","hr","hu","id","it","ja","ko","lt","lt-LT","lv","lv-LV","ms","nb","nl","nl_NL","pl","pt","pt-BR","ro","ru","sk","sl","sr-RS","sv","th","tr","uk-UA","vi","zf","zh-CN","zh-HK","zh-TW"],co="You must call `loadLocale` first to set up the localized template.",mo,pr,uo=i=>{let t=po({sourceLocale:Qr,targetLocales:ei,loadLocale:i});mo=t.getLocale,pr=t.setLocale};var ti=i=>{uo(i)},ri=i=>{if(!pr)throw new Error(co);return pr(i)};var Nt=new Set(ei);Nt.add(Qr);var ii=i=>{if(typeof i!="string")return!1;if(i==="en")return!0;let t=i.replace("_","-");if(Nt.has(t))return!0;let e=t.split("-")[0];return!!Nt.has(e)},oi=i=>{if(i==="en")return"en-GB";let t=i.replace("_","-");if(Nt.has(t))return t;let e=t.split("-")[0];return Nt.has(e)?e:"en-GB"};var Ot=globalThis,cr=Ot.trustedTypes,ho=cr?cr.createPolicy("lit-html",{createHTML:i=>i}):void 0,ni="$lit$",xe=`lit$${Math.random().toFixed(9).slice(2)}$`,si="?"+xe,Ln=`<${si}>`,We=document,Dt=()=>We.createComment(""),$t=i=>i===null||typeof i!="object"&&typeof i!="function",li=Array.isArray,Eo=i=>li(i)||typeof i?.[Symbol.iterator]=="function",ai=`[
|
|
3
|
-
\f\r]`,
|
|
4
|
-
\f\r"'\`<>=]|("|')|))|$)`,"g"),
|
|
1
|
+
import{a as $o,b as _s,c as Ro,d as s}from"./chunks/chunk.G45OCYEN.js";var Zi=_s((tr,Wi)=>{(function(i,e){typeof tr=="object"&&typeof Wi=="object"?Wi.exports=e():typeof define=="function"&&define.amd?define([],e):typeof tr=="object"?tr.Primer=e():i.Primer=e()})(tr,()=>(()=>{"use strict";let i;var e,t,r={};r.d=(a,d)=>{for(var m in d)r.o(d,m)&&!r.o(a,m)&&Object.defineProperty(a,m,{enumerable:!0,get:d[m]})},r.o=(a,d)=>Object.prototype.hasOwnProperty.call(a,d),r.r=a=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(a,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(a,"__esModule",{value:!0})};var o={};r.r(o),r.d(o,{SuccessScreenType:()=>ys,PaymentFlow:()=>hs,PrimerClientError:()=>gr,ThreeDSecureStatus:()=>gs,TokenType:()=>fs,isStripeOptionsDropInWithFullMandateText:()=>bs,PaymentInstrumentType:()=>$t,ErrorCode:()=>vs,EventTypes:()=>Es,CheckoutUXFlow:()=>us,HeadlessManagerType:()=>Cs,PaymentMethodType:()=>Rt,Primer:()=>xs});let n={LEGACY:"legacy",V_2_4:"2.4"},l=n.V_2_4,g=l;class u extends Error{static from(d,m=!1){if(d instanceof u)return d;let C=new u(d instanceof Error?d.message:String(d),m);return d instanceof Error&&d.stack&&(C.stack=d.stack,Object.assign(C,d)),C}markAsReported(){this.isReported=!0}constructor(d,m=!1){super(d),function(C,M,x){M in C?Object.defineProperty(C,M,{value:x,enumerable:!0,configurable:!0,writable:!0}):C[M]=x}(this,"isReported",void 0),this.isReported=m,this.name=this.constructor.name,Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}}let S="https://analytics.production.data.primer.io/sdk-logs";var k=function(a){return a.REQUEST_START="REQUEST_START",a.REQUEST_END="REQUEST_END",a}({}),_=function(a){return a.START="START",a.END="END",a}({});let H={createHeadless:"HEADLESS_LOADING",showUniversalCheckout:"DROP_IN_LOADING",showVaultManager:"VAULT_MANAGER_LOADING",preloadPrimer:"PRELOAD_PRIMER_LOADING"};var Y=function(a){return a.NETWORK_CALL_EVENT="NETWORK_CALL_EVENT",a.CRASH_EVENT="CRASH_EVENT",a.TIMER_EVENT="TIMER_EVENT",a.MESSAGE_EVENT="MESSAGE_EVENT",a.V1_EVENT="V1_EVENT",a.SDK_FUNCTION_EVENT="SDK_FUNCTION_EVENT",a}({});async function he(){if(typeof navigator>"u"||typeof performance>"u")return;let a=await navigator.getBattery?.();return{memoryFootprint:performance.memory?.usedJSHeapSize,screen:{height:screen?.height,width:screen?.width},userAgent:navigator.userAgent,locale:navigator.language,batteryLevel:a?.level,batteryStatus:a?.charging?"CHARGING":"NOT_CHARGING"}}let On={get(a,d){let m;try{switch(a){case"PRIMER_SDK_VERSION":m="v2.53.6";break;case"PRIMER_ASSETS_URL":m=process.env.PRIMER_ASSETS_URL;break;case"PRIMER_BUILD_INTEGRATION_BUILDER":m=process.env.PRIMER_BUILD_INTEGRATION_BUILDER}}catch{}return m||d}}.get("PRIMER_SDK_VERSION");async function ao(a,d,m){return{...m,createdAt:Date.now(),device:await he(),eventType:a,properties:d,sdkVersion:On,sdkType:"WEB"}}let no=Symbol.for("__primerAnalytics__"),It={providers:new Map,timers:new Map,eventsQueue:new Map};if(typeof window<"u"){let a=window[no];a?It=a:window[no]=It}let so=()=>It.providers,mi=()=>It.timers,Nt=()=>It.eventsQueue,cr=new Map;function ui(a,d=!1,m=1){cr.has(a)&&(clearTimeout(cr.get(a)),cr.delete(a));let C=()=>{let x=Nt().get(a);if(x?.length){let E=!0,P=[],O=0,T=0;for(;T<x.length;){let U=x[T],z=new Blob([JSON.stringify(U)]).size;if(z>64e3){console.error("Event size exceeds maximum payload size and will be skipped:",U),T++;continue}if(O+z>64e3&&P.length>0){try{E=navigator.sendBeacon(a,JSON.stringify(P))}catch(B){E=!1,console.error("Unable to send events",B)}if(!E)break;P=[],O=0}P.push(U),O+=z,T++}if(P.length>0&&E)try{E=navigator.sendBeacon(a,JSON.stringify(P))}catch(U){E=!1,console.error("Unable to send events",U)}E?Nt().delete(a):m<5?setTimeout(()=>ui(a,d,m+1),500*Math.pow(2,m)):console.error("Max retry attempts reached. Events will not be sent.")}};if(d)return void C();let M=setTimeout(C,500);cr.set(a,M)}let lo=!1;function hi({url:a=S,...d}){typeof document>"u"||lo||(document.addEventListener("visibilitychange",()=>{if(document.visibilityState==="hidden"){let M=mt(d.checkoutSessionId);M.messageEvent({messageType:"VISIBILITY_CHANGE",message:"Checkout visibility is hidden (tab or window change, redirect or being closed)."}),ui(M.url,!0)}}),lo=!0);let m=M=>async x=>{if(typeof navigator>"u")return;let E=function O(T,U,z=new WeakSet,B=0,ne=10){if(B>ne||z.has(T))return T;z.add(T);let se=oe=>typeof oe=="object"&&oe!==null?O(oe,U,z,B+1,ne):U(oe);return Array.isArray(T)?T.map(se):Object.fromEntries(Object.entries(T).map(([oe,ht])=>[oe,se(ht)]))}(await ao(M,x,d),O=>{var T;return typeof(T=typeof O=="function"?O.name||"function":O)=="string"&&T.length>5120?`${T.slice(0,5120)}...`:T});Nt().has(a)||Nt().set(a,[]),Nt().get(a)?.push(E),ui(a)},C={crashEvent:m(Y.CRASH_EVENT),messageEvent:m(Y.MESSAGE_EVENT),networkCallEvent:m(Y.NETWORK_CALL_EVENT),sdkFunctionEvent:m(Y.SDK_FUNCTION_EVENT),timerStart:({id:M,...x})=>{let E=`${d.checkoutSessionId}|${M}`,P=performance?.now?performance.now():Date.now();return mi().set(E,{start:P}),m(Y.TIMER_EVENT)({...x,id:M,timerType:_.START})},timerEnd:({id:M,...x})=>{let E=`${d.checkoutSessionId}|${M}`,{start:P}=mi().get(E)??{};mi().delete(E);let O=performance?.now?performance.now():Date.now();return m(Y.TIMER_EVENT)({...x,id:M,timerType:_.END,duration:P?O-P:void 0})},v1Event:m(Y.V1_EVENT),url:a};return so().set(d.checkoutSessionId,C),mt(d.checkoutSessionId)}function mt(a){return new Proxy({},{get:(d,m)=>(so().get(a)??hi({checkoutSessionId:a}))[m]})}let gi=(a,d,m,C)=>({callType:m?k.REQUEST_END:k.REQUEST_START,id:a,errorBody:m?.error&&JSON.stringify(m.error,Object.getOwnPropertyNames(m.error)),method:d.method,responseCode:m?.status,url:d.url,duration:C});function Dn(a){return a?new Promise(d=>{setTimeout(d,a)}):Promise.resolve()}async function po(a,d,m,C=Dn){let M=0,x={enabled:d?.enabled??!1,maxRetries:8,initialBackoff:100,retryNetworkErrors:!0,retry500Errors:!1,maxJitter:100};if(!x.enabled)return a();for(;;)try{let E=await a();if(M){let P=`Request succeeded after ${M} retries.`;typeof E=="object"&&E&&"status"in E&&(P+=` Status code: ${E.status}`),m?.({messageType:"RETRY_SUCCESS",message:P,severity:"INFO"})}return E}catch(E){let P=M>=x.maxRetries,O=E.isNetworkError&&!x.retryNetworkErrors,T=E.status&&E.status>=500&&!x.retry500Errors;if(P||O||T){let B=`Failed after ${M} retries. `;throw P?B+=`Reached maximum retries (${x.maxRetries}).`:O?B+="Network error encountered and retryNetworkErrors is disabled.":T&&(B+="HTTP 500 error encountered and retry500Errors is disabled."),B+=` Last error: ${E.message}`,m?.({messageType:"RETRY_FAILED",message:B,severity:"ERROR",errorBody:JSON.stringify(E,Object.getOwnPropertyNames(E))}),Error(B,{cause:E})}M++;let U=Math.min(x.initialBackoff*Math.pow(2,M-1)+Math.random()*x.maxJitter,Number.MAX_SAFE_INTEGER),z="Unknown error";E.isNetworkError?z="Network error":E.status&&(z=`HTTP ${E.status} error`),m?.({messageType:"RETRY",message:`Retry attempt ${M}/${x.maxRetries} due to: ${z}. Error details: ${E.message}. Waiting for ${U.toFixed(2)}ms before next attempt.`,severity:"WARN",errorBody:JSON.stringify(E,Object.getOwnPropertyNames(E))}),await C(U)}}let fi={cache:new Map};typeof window<"u"&&((e=window)[t="__primerCache__"]??(e[t]=fi),fi=window.__primerCache__);let ie=()=>fi.cache;function co(){if(ie().size<=30)return;let a=Date.now();for(let[d,m]of ie())m.exp<a&&ie().delete(d);if(ie().size>50)for(let[d]of ie()){if(ie().size<=50)break;ie().delete(d)}}let vi=()=>mo.randomUUID?.()||Vn(),Vn=()=>"10000000-1000-4000-8000-100000000000".replace(/[018]/g,a=>(a^Hn()>>a/4).toString(16)),Hn=()=>(mo.getRandomValues?.(new Uint8Array(1))[0]??16*Math.random())&15,mo=typeof crypto<"u"?crypto:{},Un=(a,d,m)=>Yn(a,"get",d,m),Yn=async(a,d,m,C,M)=>{let x=vi(),E=performance?.now(),P=mt(a),O={method:d,url:m,body:M};P.networkCallEvent(gi(x,O));try{let T=await fetch(m,{body:M,method:d,headers:{"content-type":"application/json","x-request-id":x,...C}});if(!T.ok){let B=Error(`HTTP error! status: ${T.status}`);throw B.status=T.status,B}let U=await T.json();if(m.includes("client-sdk/configuration")){let{primerAccountId:B,clientSession:{clientSessionId:ne,customer:se}}=U;P=hi({checkoutSessionId:a,clientSessionId:ne,customerId:se?.customerId,primerAccountId:B,url:P.url})}let z=performance?.now();return P.networkCallEvent(gi(x,O,{data:U},z-E)),{data:U,headers:T.headers,status:T.status,source:"NETWORK"}}catch(T){let U=performance?.now();throw Object.assign(T,{isNetworkError:T instanceof TypeError}),P.networkCallEvent(gi(x,O,{error:T},U-E)),T}},zn=(a,d)=>new Promise((m,C)=>{let M=setTimeout(()=>{let x=Error("Request timed out");x.isNetworkError=!0,C(x)},d);a.then(m).catch(C).finally(()=>clearTimeout(M))}),Fn=(a,d)=>{let{headers:m,retryConfig:C,cacheConfig:M,timeout:x=15e3,checkoutSessionId:E}=d,P=mt(E);return function(O){if(!O)return ne=>ne();let{key:T,refresh:U=!1,usePrimerSessionCacheTtlHeader:z=!1,ttl:B=36e5}=O;return async ne=>{let se=Date.now(),oe=ie().get(T);if(!U&&oe&&oe.exp>se)return oe.promise;oe&&ie().delete(T);let ht=ne().then(Ot=>{let Io=B;return z&&(Io=1e3*(Number(Ot.headers.get("x-primer-session-cache-ttl"))||0)),function({key:No,ttl:Lo=36e5},As){Lo?ie().set(No,{promise:Promise.resolve({...As,source:"CACHE"}),exp:Date.now()+Lo}):ie().delete(No)}({key:T,ttl:Io},Ot),co(),Ot},Ot=>{throw ie().delete(T),Ot});return ie().set(T,{promise:ht,exp:se+B}),co(),ht}}(M)(()=>po(()=>zn(Un(E,a,m),x),C,O=>P.messageEvent({...O,url:a})))},ut=typeof Buffer=="function",uo=typeof TextDecoder=="function"?new TextDecoder:void 0,ho=typeof TextEncoder=="function"?new TextEncoder:void 0,Lt=Array.prototype.slice.call("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="),mr=(a=>{let d={};return a.forEach((m,C)=>d[m]=C),d})(Lt),Bn=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,G=String.fromCharCode.bind(String),go=typeof Uint8Array.from=="function"?Uint8Array.from.bind(Uint8Array):a=>new Uint8Array(Array.prototype.slice.call(a,0)),fo=a=>a.replace(/=/g,"").replace(/[+\/]/g,d=>d=="+"?"-":"_"),vo=a=>a.replace(/[^A-Za-z0-9\+\/]/g,""),yo=typeof btoa=="function"?a=>btoa(a):ut?a=>Buffer.from(a,"binary").toString("base64"):a=>{let d,m,C,M,x="",E=a.length%3;for(let P=0;P<a.length;){if((m=a.charCodeAt(P++))>255||(C=a.charCodeAt(P++))>255||(M=a.charCodeAt(P++))>255)throw TypeError("invalid character found");x+=Lt[(d=m<<16|C<<8|M)>>18&63]+Lt[d>>12&63]+Lt[d>>6&63]+Lt[63&d]}return E?x.slice(0,E-3)+"===".substring(E):x},yi=ut?a=>Buffer.from(a).toString("base64"):a=>{let d=[];for(let m=0,C=a.length;m<C;m+=4096)d.push(G.apply(null,a.subarray(m,m+4096)));return yo(d.join(""))},Tl=(a,d=!1)=>d?fo(yi(a)):yi(a),Kn=a=>{if(a.length<2){var d=a.charCodeAt(0);return d<128?a:d<2048?G(192|d>>>6)+G(128|63&d):G(224|d>>>12&15)+G(128|d>>>6&63)+G(128|63&d)}var d=65536+(a.charCodeAt(0)-55296)*1024+(a.charCodeAt(1)-56320);return G(240|d>>>18&7)+G(128|d>>>12&63)+G(128|d>>>6&63)+G(128|63&d)},jn=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,Gn=a=>a.replace(jn,Kn),bo=ut?a=>Buffer.from(a,"utf8").toString("base64"):ho?a=>yi(ho.encode(a)):a=>yo(Gn(a)),qn=(a,d=!1)=>d?fo(bo(a)):bo(a),Wn=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,Zn=a=>{switch(a.length){case 4:var d=((7&a.charCodeAt(0))<<18|(63&a.charCodeAt(1))<<12|(63&a.charCodeAt(2))<<6|63&a.charCodeAt(3))-65536;return G((d>>>10)+55296)+G((1023&d)+56320);case 3:return G((15&a.charCodeAt(0))<<12|(63&a.charCodeAt(1))<<6|63&a.charCodeAt(2));default:return G((31&a.charCodeAt(0))<<6|63&a.charCodeAt(1))}},Xn=a=>a.replace(Wn,Zn),Eo=typeof atob=="function"?a=>atob(vo(a)):ut?a=>Buffer.from(a,"base64").toString("binary"):a=>{if(a=a.replace(/\s+/g,""),!Bn.test(a))throw TypeError("malformed base64.");a+="==".slice(2-(3&a.length));let d,m="",C,M;for(let x=0;x<a.length;)d=mr[a.charAt(x++)]<<18|mr[a.charAt(x++)]<<12|(C=mr[a.charAt(x++)])<<6|(M=mr[a.charAt(x++)]),m+=C===64?G(d>>16&255):M===64?G(d>>16&255,d>>8&255):G(d>>16&255,d>>8&255,255&d);return m},Co=ut?a=>go(Buffer.from(a,"base64")):a=>go(Eo(a).split("").map(d=>d.charCodeAt(0))),wl=a=>Co(xo(a)),Jn=ut?a=>Buffer.from(a,"base64").toString("utf8"):uo?a=>uo.decode(Co(a)):a=>Xn(Eo(a)),xo=a=>vo(a.replace(/[-_]/g,d=>d=="-"?"+":"/")),Qn=a=>Jn(xo(a)),kl=a=>({value:a,enumerable:!1,writable:!0,configurable:!0}),Ao={encode:qn,decode:Qn},es={encode:function(a,d={}){let{urlSafe:m=!1}=d;return Ao.encode(a,m)},decode:Ao.decode},_o="The provided `clientToken`",ts=`${_o} has expired`,rs=`${_o} is malformed`,is=(a,d,m)=>({"primer-client-token":a,"primer-sdk-client":"WEB","primer-sdk-version":"v2.53.6","primer-sdk-checkout-session-id":d,...m&&{"x-api-version":m}});async function os(a,d,m){let{accessToken:C,configurationUrl:M,analyticsUrlV2:x}=function(T){let U=function(B){try{let[ne,se]=B.split(".");return JSON.parse(es.decode(se||ne))}catch{throw Error(rs)}}(T),z=1e3*U.exp;if(Date.now()>z)throw Error(`${ts}. Expiration date: ${new Date(z).toISOString()}`);return U}(a),E=hi({checkoutSessionId:d,url:x}),P=g,O=P!==n.LEGACY?P:"2.3";E.timerStart({id:"CONFIGURATION_LOADING"});try{let{data:T,source:U}=await Fn(`${M}/?withDisplayMetadata=true`,{checkoutSessionId:d,headers:is(C,d,O),retryConfig:{enabled:!0},cacheConfig:m});return E.timerEnd({id:"CONFIGURATION_LOADING",context:{source:U}}),T}catch(T){let U=T instanceof Error?T.message:"Unknown error occurred";throw Error(`Failed to initialize client: ${U}`)}}function So(a){return a instanceof Error?{errorBody:a.message,stacktrace:a.stack}:typeof a=="object"&&a!==null&&"message"in a?{errorBody:String(a.message),stacktrace:"stack"in a?String(a.stack):void 0}:{errorBody:String(a||"Unknown error")}}function ur({checkoutSessionId:a,analytics:d,error:m,reporter:C}){d?.crashEvent?d.crashEvent({...So(m),reporter:C}):a&&bi(a,m,C)}async function bi(a,d,m){let C=await ao(Y.CRASH_EVENT,{...So(d),reporter:m},{checkoutSessionId:a});try{await fetch(S,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(C)})}catch(M){console.error("Failed to post crash event",M)}}let Mo=Symbol.for("initGlobalErrorMonitoringLoaded"),Po=(a,d)=>{typeof window<"u"&&window[Mo]||(window[Mo]=!0,window.addEventListener("error",m=>{!as(m)&&ns(m)&&ur({checkoutSessionId:a,analytics:d,error:m.error,reporter:"window.onerror"})}),window.addEventListener("unhandledrejection",m=>{let C=m.reason||Error("Unhandled promise rejection");ss(C)&&ur({checkoutSessionId:a,analytics:d,error:C,reporter:"unhandledrejection"})}))},as=a=>a.message==="Script error."||!a.filename||a.lineno===0,ns=a=>{let d=a.filename;return!!(d&&Ei(d))&&!!new u(a.error).isReported||!1},ss=a=>{if(a&&typeof a=="object"&&"stack"in a&&typeof a.stack=="string"){let d=u.from(a);return!d.isReported&&(!!("fileName"in a&&typeof a.fileName=="string"&&Ei(a.fileName))||ls(d.stack).some(Ei))}return!1},Ei=a=>{try{return new URL(a,window.location.origin).hostname.endsWith(".primer.io")}catch{return!1}},ls=a=>{if(!a)return[];let d=a.split(`
|
|
2
|
+
`),m=[],C=/^\s*at\s+(?:.*?\s+)?\(?(.+?):\d+:\d+\)?$/;for(let M of d){let x=M.match(C);if(x&&x[1])m.push(x[1]);else{let E=/@(.*?):\d+:\d+$/,P=M.match(E);P&&P[1]&&m.push(P[1])}}return m};function To(a,d,m){return document.querySelector(`${a}[${d}^="${m}"]`)}async function wo(a,d,m,C,M,x){let{analytics:E,name:P=d,retryConfig:O}=x;await po(()=>new Promise((T,U)=>{let z=To(a,m,d)||function(B,ne){let se=document.createElement(B);return Object.entries(ne).forEach(([oe,ht])=>se.setAttribute(oe,ht)),se}(a,{...C,[m]:d});z.onload=()=>{E?.sdkFunctionEvent({name:P,params:[`${a.charAt(0).toUpperCase()+a.slice(1)} loaded successfully: ${d}`]}),T()},z.onerror=()=>{z.remove(),U(Error(`${M}: ${d}`))},z.parentNode||document.head.appendChild(z)}),O,T=>E?.messageEvent({...T,url:d}))}async function ko(a){return i||(i=Promise.all([function(d,m={}){return To("script","src",d)&&window.__Primer?(m.analytics?.sdkFunctionEvent({name:m.name??d,params:["Script already loaded"]}),Promise.resolve()):wo("script",d,"src",{...m.attributes,async:"",crossorigin:"anonymous"},"Can't load Primer SDK",m)}("https://sdk.primer.io/web/v2.53.6/PrimerCoreSDK.min.js",{analytics:a,name:"loadPrimerScript"}),function(d,m={}){return Array.from(document.styleSheets).some(C=>C.href===d)?(m.analytics?.sdkFunctionEvent({name:m.name??d,params:["Stylesheet already loaded"]}),Promise.resolve()):wo("link",d,"href",{...m.attributes,rel:"stylesheet"},"Can't load Primer SDK's Stylesheet",m)}("https://sdk.primer.io/web/v2.53.6/Checkout.css",{analytics:a,name:"loadPrimerCss"})]).then(()=>{let d=window.__Primer;return delete window.__Primer,d}).catch(d=>{throw i=void 0,d}))}let ds=async()=>{let a=vi();try{let d=mt(a);try{Po(a,d),d.sdkFunctionEvent({name:"preloadPrimer"}),d.timerStart({id:H.preloadPrimer}),await ko(d),d.timerEnd({id:H.preloadPrimer})}catch(m){let C=u.from(m);throw C.isReported||(ur({checkoutSessionId:a,analytics:d,error:C,reporter:"preloadPrimer level 1"}),C.markAsReported()),C}}catch(d){let m=u.from(d);throw m.isReported||(bi(a,m,"preloadPrimer level 0"),m.markAsReported()),m}},ps=Ci("createHeadless"),cs=Ci("showUniversalCheckout"),ms=Ci("showVaultManager");function Ci(a){return async(...[d,m,...C])=>{var M;(M=m?.apiVersion)||console.warn(`[Primer SDK] No API version was explicitly set. Defaulting to '${l}'.`),g=M??l;let x=vi();try{let E=mt(x);try{Po(x,E),E.sdkFunctionEvent({name:a,params:[d,m,...C]}),E.timerStart({id:H[a]});let[P,O]=await Promise.all([os(d,x,m?.clientSessionCachingEnabled?{key:d,usePrimerSessionCacheTtlHeader:!0}:void 0),ko(E)]);return O[a](P,x,d,m,...C)}catch(P){let O=u.from(P);throw O.isReported||(ur({checkoutSessionId:x,analytics:E,error:O,reporter:"lazyLoad level 1"}),O.markAsReported()),O}}catch(E){let P=u.from(E);throw P.isReported||(bi(x,P,"lazyLoad level 0"),P.markAsReported()),P}}}var us=function(a){return a.CHECKOUT="CHECKOUT",a.HEADLESS_CHECKOUT="HEADLESS_CHECKOUT",a.MANAGE_PAYMENT_METHODS="MANAGE_PAYMENT_METHODS",a}({}),hs=function(a){return a.DEFAULT="DEFAULT",a.PREFER_VAULT="PREFER_VAULT",a}({}),gs=function(a){return a.SUCCESS="AUTH_SUCCESS",a.FAILED="AUTH_FAILED",a.SKIPPED="SKIPPED",a.CHALLENGE="CHALLENGE",a}({});let $t={WORLDPAY_IDEAL:"WORLDPAY_IDEAL",AUTOMATED_CLEARING_HOUSE:"AUTOMATED_CLEARING_HOUSE",ADYEN_KLARNA:"ADYEN_KLARNA",ADYEN_BANCONTACT_CARD:"ADYEN_BANCONTACT_CARD",PAY_NL_KAARTDIRECT:"PAY_NL_KAARTDIRECT",ADYEN_EPS:"ADYEN_EPS",ADYEN_BANCONTACT_PAYCONIQ:"ADYEN_BANCONTACT_PAYCONIQ",OMISE_PROMPTPAY:"OMISE_PROMPTPAY",OMISE_TRUEMONEY:"OMISE_TRUEMONEY",ADYEN_MULTIBANCO:"ADYEN_MULTIBANCO",PACYPAY_WECHAT:"PACYPAY_WECHAT",PACYPAY_ALIPAY:"PACYPAY_ALIPAY",ADYEN_MBWAY:"ADYEN_MBWAY",XENDIT_DANA:"XENDIT_DANA",XENDIT_SHOPEEPAY:"XENDIT_SHOPEEPAY",ADYEN_PAYSHOP:"ADYEN_PAYSHOP",ADYEN_PAYTRAIL:"ADYEN_PAYTRAIL",CLEARPAY:"CLEARPAY",RAPYD_FAST:"RAPYD_FAST",RAPYD_PROMPTPAY:"RAPYD_PROMPTPAY",RAPYD_GCASH:"RAPYD_GCASH",RAPYD_POLI:"RAPYD_POLI",RAPYD_GRABPAY:"RAPYD_GRABPAY",PRIMER_PAYPAL:"PRIMER_PAYPAL",TWOC2P:"TWOC2P",NETS:"NETS",STRIPE_ACH:"STRIPE_ACH",STRIPE_GIROPAY:"STRIPE_GIROPAY",MOLLIE_GIROPAY:"MOLLIE_GIROPAY",MOLLIE_EPS:"MOLLIE_EPS",PAY_NL_EPS:"PAY_NL_EPS",PAY_NL_P24:"PAY_NL_P24",MOLLIE_P24:"MOLLIE_P24",MOLLIE_SOFORT:"MOLLIE_SOFORT",COINBASE:"COINBASE",OPENNODE:"OPENNODE",MOLLIE_GIFT_CARD:"MOLLIE_GIFTCARD",XFERS_PAYNOW:"XFERS_PAYNOW",CARD:"PAYMENT_CARD",APPLE_PAY:"APPLE_PAY",GOOGLE_PAY:"GOOGLE_PAY",PAYPAL:"PAYPAL_ORDER",PAYPAL_VAULTED:"PAYPAL_BILLING_AGREEMENT",GO_CARDLESS:"GOCARDLESS",PAY_NL_IDEAL:"PAY_NL_IDEAL",PAY_NL_SOFORT_BANKING:"PAY_NL_SOFORT_BANKING",PAY_NL_BANCONTACT:"PAY_NL_BANCONTACT",PAY_NL_PAYPAL:"PAY_NL_PAYPAL",PAY_NL_CREDIT_TRANSFER:"PAY_NL_CREDIT_TRANSFER",PAY_NL_DIRECT_DEBIT:"PAY_NL_DIRECT_DEBIT",PAY_NL_GIROPAY:"PAY_NL_GIROPAY",PAY_NL_PAYCONIQ:"PAY_NL_PAYCONIQ",HOOLAH:"HOOLAH",ADYEN_BLIK:"ADYEN_BLIK",ADYEN_VIPPS:"ADYEN_VIPPS",ADYEN_GIROPAY:"ADYEN_GIROPAY",ADYEN_SOFORT:"ADYEN_SOFORT",ADYEN_IDEAL:"ADYEN_IDEAL",ADYEN_TRUSTLY:"ADYEN_TRUSTLY",ADYEN_ALIPAY:"ADYEN_ALIPAY",ADYEN_TWINT:"ADYEN_TWINT",ADYEN_MOBILEPAY:"ADYEN_MOBILEPAY",MOLLIE_BANCONTACT:"MOLLIE_BANCONTACT",MOLLIE_IDEAL:"MOLLIE_IDEAL",BUCKAROO_GIROPAY:"BUCKAROO_GIROPAY",BUCKAROO_EPS:"BUCKAROO_EPS",BUCKAROO_SOFORT:"BUCKAROO_SOFORT",BUCKAROO_BANCONTACT:"BUCKAROO_BANCONTACT",BUCKAROO_IDEAL:"BUCKAROO_IDEAL",ATOME:"ATOME",KLARNA_CUSTOMER_TOKEN:"KLARNA_CUSTOMER_TOKEN"},Rt={WORLDPAY_IDEAL:"WORLDPAY_IDEAL",STRIPE_ACH:"STRIPE_ACH",STRIPE_IDEAL:"STRIPE_IDEAL",ADYEN_KLARNA:"ADYEN_KLARNA",ADYEN_BANCONTACT_CARD:"ADYEN_BANCONTACT_CARD",PAY_NL_KAARTDIRECT:"PAY_NL_KAARTDIRECT",ADYEN_EPS:"ADYEN_EPS",ADYEN_BANCONTACT_PAYCONIQ:"ADYEN_BANCONTACT_PAYCONIQ",OMISE_PROMPTPAY:"OMISE_PROMPTPAY",OMISE_TRUEMONEY:"OMISE_TRUEMONEY",ADYEN_MULTIBANCO:"ADYEN_MULTIBANCO",PACYPAY_WECHAT:"PACYPAY_WECHAT",PACYPAY_ALIPAY:"PACYPAY_ALIPAY",ADYEN_MBWAY:"ADYEN_MBWAY",XENDIT_DANA:"XENDIT_DANA",XENDIT_SHOPEEPAY:"XENDIT_SHOPEEPAY",ADYEN_PAYSHOP:"ADYEN_PAYSHOP",ADYEN_PAYTRAIL:"ADYEN_PAYTRAIL",CLEARPAY:"CLEARPAY",RAPYD_FAST:"RAPYD_FAST",RAPYD_PROMPTPAY:"RAPYD_PROMPTPAY",RAPYD_GCASH:"RAPYD_GCASH",RAPYD_POLI:"RAPYD_POLI",RAPYD_GRABPAY:"RAPYD_GRABPAY",PRIMER_PAYPAL:"PRIMER_PAYPAL",TWOC2P:"TWOC2P",NETS:"NETS",STRIPE_GIROPAY:"STRIPE_GIROPAY",MOLLIE_GIROPAY:"MOLLIE_GIROPAY",MOLLIE_EPS:"MOLLIE_EPS",PAY_NL_EPS:"PAY_NL_EPS",PAY_NL_P24:"PAY_NL_P24",MOLLIE_P24:"MOLLIE_P24",MOLLIE_SOFORT:"MOLLIE_SOFORT",COINBASE:"COINBASE",OPENNODE:"OPENNODE",MOLLIE_GIFT_CARD:"MOLLIE_GIFTCARD",XFERS_PAYNOW:"XFERS_PAYNOW",PAYMENT_CARD:"PAYMENT_CARD",APPLE_PAY:"APPLE_PAY",GOOGLE_PAY:"GOOGLE_PAY",PAYPAL:"PAYPAL",GO_CARDLESS:"GOCARDLESS",KLARNA:"KLARNA",PAY_NL_IDEAL:"PAY_NL_IDEAL",PAY_NL_SOFORT_BANKING:"PAY_NL_SOFORT_BANKING",PAY_NL_BANCONTACT:"PAY_NL_BANCONTACT",PAY_NL_PAYPAL:"PAY_NL_PAYPAL",PAY_NL_CREDIT_TRANSFER:"PAY_NL_CREDIT_TRANSFER",PAY_NL_DIRECT_DEBIT:"PAY_NL_DIRECT_DEBIT",PAY_NL_GIROPAY:"PAY_NL_GIROPAY",PAY_NL_PAYCONIQ:"PAY_NL_PAYCONIQ",HOOLAH:"HOOLAH",ADYEN_BLIK:"ADYEN_BLIK",ADYEN_MOBILEPAY:"ADYEN_MOBILEPAY",ADYEN_VIPPS:"ADYEN_VIPPS",ADYEN_GIROPAY:"ADYEN_GIROPAY",ADYEN_SOFORT:"ADYEN_SOFORT",ADYEN_IDEAL:"ADYEN_IDEAL",ADYEN_TRUSTLY:"ADYEN_TRUSTLY",ADYEN_ALIPAY:"ADYEN_ALIPAY",ADYEN_TWINT:"ADYEN_TWINT",ADYEN_BANK_TRANSFER:"ADYEN_BANK_TRANSFER",MOLLIE_BANCONTACT:"MOLLIE_BANCONTACT",MOLLIE_IDEAL:"MOLLIE_IDEAL",BUCKAROO_GIROPAY:"BUCKAROO_GIROPAY",BUCKAROO_EPS:"BUCKAROO_EPS",BUCKAROO_SOFORT:"BUCKAROO_SOFORT",BUCKAROO_BANCONTACT:"BUCKAROO_BANCONTACT",BUCKAROO_IDEAL:"BUCKAROO_IDEAL",ATOME:"ATOME"},fs={SINGLE_USE:"SINGLE_USE",MULTI_USE:"MULTI_USE"};$t.PAYPAL_VAULTED,Rt.PAYPAL,$t.KLARNA_CUSTOMER_TOKEN,Rt.KLARNA,$t.AUTOMATED_CLEARING_HOUSE,Rt.STRIPE_ACH,$t.CARD,Rt.PAYMENT_CARD;var vs=function(a){return a.INITIALIZATION_ERROR="INITIALIZATION_ERROR",a.NO_PAYMENT_METHODS="NO_PAYMENT_METHODS",a.PRIMER_TEARDOWN="PRIMER_TEARDOWN",a.PRIMER_SERVER_ERROR="PRIMER_SERVER_ERROR",a.THREE_DS_AUTH_FAILED="THREE_DS_AUTH_FAILED",a.TOKENIZATION_ERROR="TOKENIZATION_ERROR",a.DUPLICATE_PAYMENT_METHOD_ERROR="DUPLICATE_PAYMENT_METHOD_ERROR",a.CARD_NUMBER_ERROR="CARD_NUMBER_ERROR",a.PAYMENT_METHOD_NOT_SETUP="PAYMENT_METHOD_NOT_SETUP",a.PAYMENT_METHOD_NOT_PROVIDED="PAYMENT_METHOD_NOT_PROVIDED",a.PAYMENT_METHOD_NOT_COMPATIBLE="PAYMENT_METHOD_NOT_COMPATIBLE",a.RESUME_ERROR="RESUME_ERROR",a.VALIDATION_ERROR="VALIDATION_ERROR",a.PAYMENT_FAILED="PAYMENT_FAILED",a.PAYMENT_CREATION_ABORTED="PAYMENT_CREATION_ABORTED",a.PAYMENT_CREATION_DISABLED="PAYMENT_CREATION_DISABLED",a.CLIENT_SESSION_UPDATE_ERROR="CLIENT_SESSION_UPDATE_ERROR",a.INVALID_ARGUMENT="INVALID_ARGUMENT",a.VAULT_FETCH="VAULT_FETCH",a.VAULT_DELETE="VAULT_DELETE",a.HEADLESS_VAULT_MANAGER_VALIDATION="HEADLESS_VAULT_MANAGER_VALIDATION",a.CARD_FORM_VALIDATION_UNEXPECTED_FIELD="CARD_FORM_VALIDATION_UNEXPECTED_FIELD",a.MISSING_FIRST_NAME_OR_LAST_NAME="MISSING_FIRST_NAME_OR_LAST_NAME",a.MISSING_EMAIL_ADDRESS="MISSING_EMAIL_ADDRESS",a.INVALID_FLOW="INVALID_FLOW",a}({});function hr(a,d,m){return d in a?Object.defineProperty(a,d,{value:m,enumerable:!0,configurable:!0,writable:!0}):a[d]=m,a}class gr extends u{static fromErrorCode(d,m){return new gr(d,m)}constructor(d,m){super(m.message),hr(this,"code",void 0),hr(this,"diagnosticsId",void 0),hr(this,"data",void 0),hr(this,"isFromDeveloper",void 0),this.code=d,this.diagnosticsId=m.diagnosticsId??null,this.data=m.data,this.isFromDeveloper=m.isFromDeveloper??!1,this.name="PrimerClientError",Error.captureStackTrace&&Error.captureStackTrace(this,gr)}}var ys=function(a){return a.PAYMENT_METHOD="PAYMENT_METHOD",a.CHECK="CHECK",a}({});let bs=a=>{let d=a?.mandateData;return!!d&&"fullMandateText"in d};var Es=function(a){return a.CHANGE="change",a.ERROR="error",a.FOCUS="focus",a.BLUR="blur",a.CLICK="click",a.CLOSE="close",a.CONFIRMED_KLARNA_CATEGORY="CONFIRMED_KLARNA_CATEGORY",a.CONFIRMED_KLARNA_CATEGORY_ERROR="CONFIRMED_KLARNA_CATEGORY_ERROR",a.KLARNA_SESSION_UPDATE="KLARNA_SESSION_UPDATE",a.KLARNA_SESSION_REFRESH_ERROR="KLARNA_SESSION_REFRESH_ERROR",a}({}),Cs=function(a){return a.CARD="CARD",a.NATIVE="NATIVE",a.REDIRECT="REDIRECT",a.KLARNA="KLARNA",a.ACH="ACH",a}({});let xs={SDK_VERSION:"v2.53.6",createHeadless:ps,showUniversalCheckout:cs,showVaultManager:ms,preloadPrimer:ds};return o})())});var fr=class{constructor(e){(this.host=e).addController(this)}hostConnected(){}setCardNetworksLoading(){let e={detectedCardNetwork:null,selectableCardNetworks:[],isLoading:!0};this.updateCardNetworksState(e)}updateCardNetworksState(e){this.host.primerEventsController.dispatchCardNetworkChange(e),this.host.sdkContextController.setCardNetworks(e)}async processCardNetworkChangeEvent(e){let{detectedCardNetworks:t,selectableCardNetworks:r}=e,o=t.preferred??t.items[0],n=r?.items??[];this.updateCardNetworksState({detectedCardNetwork:o,selectableCardNetworks:n,isLoading:!1})}};var gt=class{constructor(e){(this.host=e).addController(this)}hostConnected(){}dispatchEvent(e,t){this.host.dispatchEvent(new CustomEvent(e,{detail:t,bubbles:!0,composed:!0}))}dispatchSdkState(e){this.dispatchEvent("primer-state-changed",e)}dispatchPaymentMethods(e){this.dispatchEvent("primer-payment-methods-updated",e)}dispatchCheckoutInitialized(e){this.dispatchEvent("primer-checkout-initialized",e)}dispatchCardNetworkChange(e){this.dispatchEvent("primer-card-network-change",e)}dispatchOnCheckoutComplete(e){this.dispatchEvent("primer-oncheckout-complete",{payment:e})}dispatchOnCheckoutFailure(e,t){this.dispatchEvent("primer-oncheckout-failure",{error:e,payment:t})}dispatchFormSubmitSuccess(e){this.dispatchEvent("primer-card-submit-success",{result:e})}dispatchFormSubmitErrors(e){this.dispatchEvent("primer-card-submit-errors",{errors:e})}};var Ne=class extends Event{constructor(e,t,r,o){super("context-request",{bubbles:!0,composed:!0}),this.context=e,this.contextTarget=t,this.callback=r,this.subscribe=o??!1}};var ft=class{constructor(e,t,r,o){if(this.subscribe=!1,this.provided=!1,this.value=void 0,this.t=(n,l)=>{this.unsubscribe&&(this.unsubscribe!==l&&(this.provided=!1,this.unsubscribe()),this.subscribe||this.unsubscribe()),this.value=n,this.host.requestUpdate(),this.provided&&!this.subscribe||(this.provided=!0,this.callback&&this.callback(n,l)),this.unsubscribe=l},this.host=e,t.context!==void 0){let n=t;this.context=n.context,this.callback=n.callback,this.subscribe=n.subscribe??!1}else this.context=t,this.callback=r,this.subscribe=o??!1;this.host.addController(this)}hostConnected(){this.dispatchRequest()}hostDisconnected(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=void 0)}dispatchRequest(){this.host.dispatchEvent(new Ne(this.context,this.host,this.t,this.subscribe))}};var vr=class{get value(){return this.o}set value(e){this.setValue(e)}setValue(e,t=!1){let r=t||!Object.is(e,this.o);this.o=e,r&&this.updateObservers()}constructor(e){this.subscriptions=new Map,this.updateObservers=()=>{for(let[t,{disposer:r}]of this.subscriptions)t(this.o,r)},e!==void 0&&(this.value=e)}addCallback(e,t,r){if(!r)return void e(this.value);this.subscriptions.has(e)||this.subscriptions.set(e,{disposer:()=>{this.subscriptions.delete(e)},consumerHost:t});let{disposer:o}=this.subscriptions.get(e);e(this.value,o)}clearCallbacks(){this.subscriptions.clear()}};var xi=class extends Event{constructor(e,t){super("context-provider",{bubbles:!0,composed:!0}),this.context=e,this.contextTarget=t}},q=class extends vr{constructor(e,t,r){super(t.context!==void 0?t.initialValue:r),this.onContextRequest=o=>{if(o.context!==this.context)return;let n=o.contextTarget??o.composedPath()[0];n!==this.host&&(o.stopPropagation(),this.addCallback(o.callback,n,o.subscribe))},this.onProviderRequest=o=>{if(o.context!==this.context||(o.contextTarget??o.composedPath()[0])===this.host)return;let n=new Set;for(let[l,{consumerHost:g}]of this.subscriptions)n.has(l)||(n.add(l),g.dispatchEvent(new Ne(this.context,g,l,!0)));o.stopPropagation()},this.host=e,t.context!==void 0?this.context=t.context:this.context=t,this.attachListeners(),this.host.addController?.(this)}attachListeners(){this.host.addEventListener("context-request",this.onContextRequest),this.host.addEventListener("context-provider",this.onProviderRequest)}hostConnected(){this.host.dispatchEvent(new xi(this.context,this.host))}};function b({context:i,subscribe:e}){return(t,r)=>{typeof r=="object"?r.addInitializer(function(){new ft(this,{context:i,callback:o=>{t.set.call(this,o)},subscribe:e})}):t.constructor.addInitializer(o=>{new ft(o,{context:i,callback:n=>{o[r]=n},subscribe:e})})}}var yr="cardNetworksContext";var Le="clientOptionsContext";var $e="computedStylesContext";var W="headlessInstanceContext";var br="klarnaCategoriesContext";var J="managerContext";var vt="paymentMethodsContext";var j="sdkStateContext";var Q="vaultManagerContext";var Re="vaultManagerCvvContext";var N=class N{static log(e,...t){N.enabled&&console.log(`%c${N.brandTag}%c ${e}`,N.brandStyle,N.styles.log,...t)}static info(e,...t){N.enabled&&console.info(`%c${N.brandTag}%c ${e}`,N.brandStyle,N.styles.info,...t)}static warn(e,...t){N.enabled&&console.warn(`%c${N.brandTag}%c ${e}`,N.brandStyle,N.styles.warn,...t)}static error(e,...t){N.enabled&&console.error(`%c${N.brandTag}%c ${e}`,N.brandStyle,N.styles.error,...t)}static debug(e,...t){N.enabled&&console.debug(`%c${N.brandTag}%c ${e}`,N.brandStyle,N.styles.debug,...t)}static table(e,t){N.enabled&&console.table(e,t)}static time(e){N.enabled&&console.time(`${N.brandTag} ${e}`)}static timeEnd(e){N.enabled&&console.timeEnd(`${N.brandTag} ${e}`)}};N.enabled=!0,N.defaultFont="font-family: Consolas, monospace; font-size: 12px;",N.brandTag="[PRIMER]",N.brandStyle="background: #24292e; color: #ffffff; padding: 2px 6px; border-radius: 3px; font-weight: bold; margin-right: 4px; "+N.defaultFont,N.styles={log:"color: #4CAF50; "+N.defaultFont,info:"color: #2196F3; "+N.defaultFont,warn:"color: #FF9800; "+N.defaultFont,error:"color: #F44336; "+N.defaultFont,debug:"color: #9C27B0; "+N.defaultFont};var R=N;function Ss(i,e,t,r){let o=i,n=t;return{dispatch:l=>{let g=e(o,l,n);o=g,r(g)},getState:()=>Object.freeze({...o}),setCallbacks:l=>{n={...n,...l}}}}function Dt(i){return(e,t,r)=>{let o=i[t.type];if(!o)throw new Error(`No handler for action type: ${t.type}`);return o(e,t,r)}}var We=class{constructor(e,t,r,o,n=()=>{this.host.requestUpdate()}){this.host=e;this.stateHandler=n;this.host.addController(this),this._dispatcher=Ss(t,r,o,l=>{this.stateHandler(l)})}get currentState(){return this._dispatcher.getState()}dispatch(e){this._dispatcher.dispatch(e)}setCallbacks(e){this._dispatcher.setCallbacks(e)}hostConnected(){}hostDisconnected(){}},Er=class{constructor(e){this.host=e;this._controllers=[];"addController"in this.host&&this.host.addController(this)}addController(e){this._controllers.push(e)}hostConnected(){this._controllers.forEach(e=>{e.hostConnected&&e.hostConnected()})}hostDisconnected(){this._controllers.forEach(e=>{e.hostDisconnected&&e.hostDisconnected()})}};var xr={isSuccessful:!1,isProcessing:!1,isLoading:!1,error:null,failure:null},Ms={START_LOADING:i=>({...i,isLoading:!0}),START_PROCESSING:i=>({...i,failure:null,isProcessing:!0}),STOP_PROCESSING:i=>({...i,isProcessing:!1}),COMPLETE_PROCESSING:i=>({...i,isProcessing:!1,isSuccessful:!0}),SET_ERROR:(i,e)=>(R.error(e.payload.message),{...i,isProcessing:!1,error:e.payload}),SET_FAILURE:(i,e)=>({...i,isProcessing:!1,failure:e.payload}),COMPLETE_LOADING:i=>({...i,isLoading:!1}),RESET:()=>xr,RESET_ERROR:i=>({...i,error:null,failure:null})},Ps=Dt(Ms),Cr=class extends We{constructor(e){super(e,xr,Ps,null,t=>{e.sdkContextController.setSdkState(t),e.primerEventsController.dispatchSdkState(t)})}startLoading(){this.dispatch({type:"START_LOADING"})}startProcessing(){this.dispatch({type:"START_PROCESSING"})}stopProcessing(){this.dispatch({type:"STOP_PROCESSING"})}completeProcessing(){this.dispatch({type:"COMPLETE_PROCESSING"})}completeLoading(){this.dispatch({type:"COMPLETE_LOADING"})}setError(e){this.dispatch({type:"SET_ERROR",payload:e})}setFailure(e,t,r){this.dispatch({type:"SET_FAILURE",payload:{code:e,message:t,details:r}})}reset(){this.dispatch({type:"RESET"})}resetError(){this.dispatch({type:"RESET_ERROR"})}forceCompleteLoading(){this.currentState.isLoading&&(R.warn("Force completing loading state"),this.completeLoading())}};var Ar=class{constructor(e){this.sdkStateProvider=null;this.paymentMethodsProvider=null;this.paymentManagerProvider=null;this.cardNetworksContext=null;this.vaultManagerCvvProvider=null;this.clientOptionsContext=null;this.headlessUtilsProvider=null;this.klarnaCategoriesProvider=null;this.computedStylesProvider=null;(this.host=e).addController(this),this.sdkStateProvider=new q(e,{context:j,initialValue:xr}),this.paymentMethodsProvider=new q(e,{context:vt,initialValue:null}),this.paymentManagerProvider=new q(e,{context:J,initialValue:new Map}),this.cardNetworksContext=new q(e,{context:yr,initialValue:null}),this.vaultManagerProvider=new q(e,{context:Q,initialValue:null}),this.vaultManagerCvvProvider=new q(e,{context:Re,initialValue:null}),this.clientOptionsContext=new q(e,{context:Le,initialValue:null}),this.klarnaCategoriesProvider=new q(e,{context:br,initialValue:{categories:[],isLoading:!0}}),this.headlessUtilsProvider=new q(e,{context:W,initialValue:null}),this.computedStylesProvider=new q(e,{context:$e,initialValue:null})}hostConnected(){}setSdkState(e){this.sdkStateProvider?.setValue(e)}setPaymentMethods(e){this.paymentMethodsProvider?.setValue(e)}setPaymentManagers(e){this.paymentManagerProvider?.setValue(e)}setCardNetworks(e){this.cardNetworksContext?.setValue(e)}setVaultManager(e){this.vaultManagerProvider?.setValue(e)}setKlarnaCategories(e){this.klarnaCategoriesProvider?.setValue(e)}setClientOptions(e){this.clientOptionsContext?.setValue(e)}setHeadlessUtils(e){this.headlessUtilsProvider?.setValue(e)}setComputedStyles(e){this.computedStylesProvider?.setValue(e)}setVaultManagerCvv(e){this.vaultManagerCvvProvider?.setValue(e)}};var Ze=class Ze{constructor(e){(this.host=e).addController(this)}processCustomStyles(e){try{let t=JSON.parse(e);this.applyStyles(t)}catch(t){R.error("Error parsing customStyles property.",t instanceof Error?t:new Error(String(t)))}}isValidCssProperty(e){return/^[a-zA-Z][a-zA-Z0-9]*$/.test(e)}isValidCssValue(e){let r=/^[\w\s#.,%()\-+/!]+$/.test(e);return r||R.warn(`Rejected potentially unsafe CSS value: ${e}`),r}getCssVarName(e){let t=Ze.cssVarCache.get(e);return t||(t="--"+e.replace(/([A-Z])/g,(r,o)=>"-"+o.toLowerCase()),Ze.cssVarCache.set(e,t)),t}applyStyles(e){let t=[];for(let r of Object.keys(e)){let o=e[r];if(!o)continue;if(!this.isValidCssProperty(r)){R.warn(`Skipping invalid CSS property name: ${r}`);continue}if(!this.isValidCssValue(o))continue;let n=this.getCssVarName(r);t.push([n,o])}if(t.length>0)for(let[r,o]of t)this.host.style.setProperty(r,o)}removeStyle(e){let t=this.getCssVarName(e);this.host.style.removeProperty(t)}clearAllStyles(){for(let e of Ze.cssVarCache.keys()){let t=Ze.cssVarCache.get(e);t&&this.host.style.removeProperty(t)}}hostDisconnected(){}};Ze.cssVarCache=new Map;var _r=Ze;var Sr=globalThis,Mr=Sr.ShadowRoot&&(Sr.ShadyCSS===void 0||Sr.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Ai=Symbol(),Oo=new WeakMap,Vt=class{constructor(e,t,r){if(this._$cssResult$=!0,r!==Ai)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(Mr&&e===void 0){let r=t!==void 0&&t.length===1;r&&(e=Oo.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),r&&Oo.set(t,e))}return e}toString(){return this.cssText}},Do=i=>new Vt(typeof i=="string"?i:i+"",void 0,Ai),f=(i,...e)=>{let t=i.length===1?i[0]:e.reduce((r,o,n)=>r+(l=>{if(l._$cssResult$===!0)return l.cssText;if(typeof l=="number")return l;throw Error("Value passed to 'css' function must be a 'css' function result: "+l+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(o)+i[n+1],i[0]);return new Vt(t,i,Ai)},_i=(i,e)=>{if(Mr)i.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of e){let r=document.createElement("style"),o=Sr.litNonce;o!==void 0&&r.setAttribute("nonce",o),r.textContent=t.cssText,i.appendChild(r)}},Pr=Mr?i=>i:i=>i instanceof CSSStyleSheet?(e=>{let t="";for(let r of e.cssRules)t+=r.cssText;return Do(t)})(i):i;var{is:Ts,defineProperty:ws,getOwnPropertyDescriptor:ks,getOwnPropertyNames:Is,getOwnPropertySymbols:Ns,getPrototypeOf:Ls}=Object,Oe=globalThis,Vo=Oe.trustedTypes,$s=Vo?Vo.emptyScript:"",Rs=Oe.reactiveElementPolyfillSupport,Ht=(i,e)=>i,Ut={toAttribute(i,e){switch(e){case Boolean:i=i?$s:null;break;case Object:case Array:i=i==null?i:JSON.stringify(i)}return i},fromAttribute(i,e){let t=i;switch(e){case Boolean:t=i!==null;break;case Number:t=i===null?null:Number(i);break;case Object:case Array:try{t=JSON.parse(i)}catch{t=null}}return t}},yt=(i,e)=>!Ts(i,e),Ho={attribute:!0,type:String,converter:Ut,reflect:!1,hasChanged:yt};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),Oe.litPropertyMetadata??(Oe.litPropertyMetadata=new WeakMap);var xe=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??(this.l=[])).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=Ho){if(t.state&&(t.attribute=!1),this._$Ei(),this.elementProperties.set(e,t),!t.noAccessor){let r=Symbol(),o=this.getPropertyDescriptor(e,r,t);o!==void 0&&ws(this.prototype,e,o)}}static getPropertyDescriptor(e,t,r){let{get:o,set:n}=ks(this.prototype,e)??{get(){return this[t]},set(l){this[t]=l}};return{get(){return o?.call(this)},set(l){let g=o?.call(this);n.call(this,l),this.requestUpdate(e,g,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??Ho}static _$Ei(){if(this.hasOwnProperty(Ht("elementProperties")))return;let e=Ls(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(Ht("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Ht("properties"))){let t=this.properties,r=[...Is(t),...Ns(t)];for(let o of r)this.createProperty(o,t[o])}let e=this[Symbol.metadata];if(e!==null){let t=litPropertyMetadata.get(e);if(t!==void 0)for(let[r,o]of t)this.elementProperties.set(r,o)}this._$Eh=new Map;for(let[t,r]of this.elementProperties){let o=this._$Eu(t,r);o!==void 0&&this._$Eh.set(o,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let r=new Set(e.flat(1/0).reverse());for(let o of r)t.unshift(Pr(o))}else e!==void 0&&t.push(Pr(e));return t}static _$Eu(e,t){let r=t.attribute;return r===!1?void 0:typeof r=="string"?r:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??(this._$EO=new Set)).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){let e=new Map,t=this.constructor.elementProperties;for(let r of t.keys())this.hasOwnProperty(r)&&(e.set(r,this[r]),delete this[r]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return _i(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,r){this._$AK(e,r)}_$EC(e,t){let r=this.constructor.elementProperties.get(e),o=this.constructor._$Eu(e,r);if(o!==void 0&&r.reflect===!0){let n=(r.converter?.toAttribute!==void 0?r.converter:Ut).toAttribute(t,r.type);this._$Em=e,n==null?this.removeAttribute(o):this.setAttribute(o,n),this._$Em=null}}_$AK(e,t){let r=this.constructor,o=r._$Eh.get(e);if(o!==void 0&&this._$Em!==o){let n=r.getPropertyOptions(o),l=typeof n.converter=="function"?{fromAttribute:n.converter}:n.converter?.fromAttribute!==void 0?n.converter:Ut;this._$Em=o,this[o]=l.fromAttribute(t,n.type),this._$Em=null}}requestUpdate(e,t,r){if(e!==void 0){if(r??(r=this.constructor.getPropertyOptions(e)),!(r.hasChanged??yt)(this[e],t))return;this.P(e,t,r)}this.isUpdatePending===!1&&(this._$ES=this._$ET())}P(e,t,r){this._$AL.has(e)||this._$AL.set(e,t),r.reflect===!0&&this._$Em!==e&&(this._$Ej??(this._$Ej=new Set)).add(e)}async _$ET(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}let e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this._$Ep){for(let[o,n]of this._$Ep)this[o]=n;this._$Ep=void 0}let r=this.constructor.elementProperties;if(r.size>0)for(let[o,n]of r)n.wrapped!==!0||this._$AL.has(o)||this[o]===void 0||this.P(o,this[o],n)}let e=!1,t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(r=>r.hostUpdate?.()),this.update(t)):this._$EU()}catch(r){throw e=!1,this._$EU(),r}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Ej&&(this._$Ej=this._$Ej.forEach(t=>this._$EC(t,this[t]))),this._$EU()}updated(e){}firstUpdated(e){}};xe.elementStyles=[],xe.shadowRootOptions={mode:"open"},xe[Ht("elementProperties")]=new Map,xe[Ht("finalized")]=new Map,Rs?.({ReactiveElement:xe}),(Oe.reactiveElementVersions??(Oe.reactiveElementVersions=[])).push("2.0.4");var De={INITIAL:0,PENDING:1,COMPLETE:2,ERROR:3},L=Symbol(),D=class{get taskComplete(){return this.t||(this.i===1?this.t=new Promise((e,t)=>{this.o=e,this.h=t}):this.i===3?this.t=Promise.reject(this.l):this.t=Promise.resolve(this.u)),this.t}constructor(e,t,r){this.p=0,this.i=0,(this._=e).addController(this);let o=typeof t=="object"?t:{task:t,args:r};this.v=o.task,this.j=o.args,this.m=o.argsEqual??Uo,this.k=o.onComplete,this.A=o.onError,this.autoRun=o.autoRun??!0,"initialValue"in o&&(this.u=o.initialValue,this.i=2,this.O=this.T?.())}hostUpdate(){this.autoRun===!0&&this.S()}hostUpdated(){this.autoRun==="afterUpdate"&&this.S()}T(){if(this.j===void 0)return;let e=this.j();if(!Array.isArray(e))throw Error("The args function must return an array");return e}async S(){let e=this.T(),t=this.O;this.O=e,e===t||e===void 0||t!==void 0&&this.m(t,e)||await this.run(e)}async run(e){let t,r;e??(e=this.T()),this.O=e,this.i===1?this.q?.abort():(this.t=void 0,this.o=void 0,this.h=void 0),this.i=1,this.autoRun==="afterUpdate"?queueMicrotask(()=>this._.requestUpdate()):this._.requestUpdate();let o=++this.p;this.q=new AbortController;let n=!1;try{t=await this.v(e,{signal:this.q.signal})}catch(l){n=!0,r=l}if(this.p===o){if(t===L)this.i=0;else{if(n===!1){try{this.k?.(t)}catch{}this.i=2,this.o?.(t)}else{try{this.A?.(r)}catch{}this.i=3,this.h?.(r)}this.u=t,this.l=r}this._.requestUpdate()}}abort(e){this.i===1&&this.q?.abort(e)}get value(){return this.u}get error(){return this.l}get status(){return this.i}render(e){switch(this.i){case 0:return e.initial?.();case 1:return e.pending?.();case 2:return e.complete?.(this.value);case 3:return e.error?.(this.error);default:throw Error("Unexpected status: "+this.i)}}},Uo=(i,e)=>i===e||i.length===e.length&&i.every((t,r)=>!yt(t,e[r]));var Os={SET_LOADING:(i,e)=>({...i,isLoading:e.payload}),SET_UPDATING:(i,e)=>({...i,isUpdating:e.payload}),INITIALIZE_VAULT_MANAGER:(i,e,t)=>({...i,enabled:e.vaultEnabled,cvvRecapture:e.cvvRecapture,deleteVaultedPaymentMethod:t.deleteVaultedPaymentMethod,startVaultedPaymentFlow:t.startVaultedPaymentFlow,createCvvInput:t.createCvvInput}),UPDATE_PAYMENT_METHODS:(i,e)=>({...i,vaultedPaymentMethods:e.payload,isLoading:!1,isUpdating:!1}),SET_ERROR:i=>({...i,isLoading:!1,isUpdating:!1}),DISABLE:i=>({...i,enabled:!1}),RESET:()=>Yo},Ds={INITIALIZE_CVV:(i,e,t)=>({...i,setCvvInput:t.setCvvInput,setSelectedVaultedPaymentMethod:t.setSelectedVaultedPaymentMethod}),SET_FORM_DIRTY:(i,e)=>({...i,formIsDirty:e.payload}),SET_CVV_INPUT:(i,e)=>({...i,cvvInput:e.payload}),SET_SELECTED_VAULTED_PAYMENT_METHOD:(i,e)=>({...i,selectedVaultedPaymentMethod:e.payload}),RESET_CVV:()=>zo},Vs=Dt(Os),Hs=Dt(Ds),Yo={enabled:!1,isLoading:!1,isUpdating:!1,cvvRecapture:!1,vaultedPaymentMethods:[],createCvvInput:null,deleteVaultedPaymentMethod:()=>Promise.resolve(),startVaultedPaymentFlow:()=>Promise.resolve()},zo={cvvInput:null,formIsDirty:!1,setCvvInput:()=>{},selectedVaultedPaymentMethod:null,setSelectedVaultedPaymentMethod:()=>{}},Si=class extends We{constructor(e,t){super(e,Yo,Vs,t,r=>{e.sdkContextController.setVaultManager(r)})}setLoading(e){this.dispatch({type:"SET_LOADING",payload:e})}setUpdating(e){this.dispatch({type:"SET_UPDATING",payload:e})}initializeVaultManager(e,t,r){this.dispatch({type:"INITIALIZE_VAULT_MANAGER",payload:e,vaultEnabled:t,cvvRecapture:r})}updatePaymentMethods(e){this.dispatch({type:"UPDATE_PAYMENT_METHODS",payload:e})}setError(e){this.dispatch({type:"SET_ERROR",payload:e})}disable(){this.dispatch({type:"DISABLE"})}reset(){this.dispatch({type:"RESET"})}},Mi=class extends We{constructor(e,t){super(e,zo,Hs,t,r=>{e.sdkContextController.setVaultManagerCvv(r)})}initializeCvv(e){this.dispatch({type:"INITIALIZE_CVV",createCvvInput:e})}setFormDirty(e){this.dispatch({type:"SET_FORM_DIRTY",payload:e})}setCvvInputState(e){this.dispatch({type:"SET_CVV_INPUT",payload:e})}setSelectedPaymentMethod(e){this.dispatch({type:"SET_SELECTED_VAULTED_PAYMENT_METHOD",payload:e})}resetCvv(){this.dispatch({type:"RESET_CVV"})}},Yt=class extends Er{constructor(t){super(t);this._vaultManager=null;this._options=null;this.deleteVaultedPaymentMethod=async t=>{if(!this._vaultManager)throw new Error("Vault manager not initialized");try{this.coreController.updatePaymentMethods(this.vaultManagerState.vaultedPaymentMethods),await this._vaultManager.deleteVaultedPaymentMethod(t),await this.fetchVaultedPaymentMethods()}catch(r){throw this.coreController.setError(r instanceof Error?r:new Error("Failed to delete payment method")),r}};this.setCvvInput=t=>{this.itemController.setCvvInputState(t)};this.startVaultedPaymentFlow=async()=>{if(!this._vaultManager)throw new Error("Vault manager not initialized");let t=this.vaultItemState.selectedVaultedPaymentMethod,r=this.vaultManagerState.cvvRecapture,o=this.vaultItemState.cvvInput;if(!t||r&&(!o||o.metadata.error)){this.itemController.setFormDirty(!0);return}this.host.sdkStateController.startProcessing();try{await this._vaultManager.startPaymentFlow(t.id,r?{cvv:o.valueToken}:void 0)}catch(n){R.error("VaultManagerController: Error starting vaulted payment flow",n),this.coreController.setError(n instanceof Error?n:new Error("Failed to start vaulted payment flow")),this.host.sdkStateController.stopProcessing()}};this.setSelectedVaultedPaymentMethod=t=>{this.itemController.setSelectedPaymentMethod(t),this.itemController.setFormDirty(!1)};this.coreController=new Si(t,{deleteVaultedPaymentMethod:this.deleteVaultedPaymentMethod.bind(this),startVaultedPaymentFlow:this.startVaultedPaymentFlow.bind(this),createCvvInput:this.createCvvInput.bind(this)}),this.itemController=new Mi(t,{setCvvInput:this.setCvvInput.bind(this),setSelectedVaultedPaymentMethod:this.setSelectedVaultedPaymentMethod.bind(this)}),this.addController(this.coreController),this.addController(this.itemController),new D(this.host,{task:async([r,o])=>{if(!r||!o?.vaultEnabled)return this.coreController.disable(),L;this.coreController.setLoading(!0);try{this.coreController.initializeVaultManager(r,o.vaultEnabled,!!o.captureVaultedCardCvv),this.itemController.initializeCvv(r.createCvvInput),await this.fetchVaultedPaymentMethods(!0),R.log("VaultManagerController: Vault initialized successfully",{coreState:this.coreController.currentState,cvvState:this.itemController.currentState})}catch(n){R.error("VaultManagerController: Failed to initialize vault",n),this.coreController.setError(n instanceof Error?n:new Error("Unknown error"))}return this._vaultManager},args:()=>[this.vaultManager,this.options]})}initializeVaultManager(t,r){this.vaultManager=t,this.options=r??null}get vaultManager(){return this._vaultManager}set vaultManager(t){this._vaultManager=t,this.host.requestUpdate()}get options(){return this._options}set options(t){this._options=t,this.host.requestUpdate()}get vaultManagerState(){return this.coreController.currentState}get vaultItemState(){return this.itemController.currentState}hostDisconnected(){super.hostDisconnected(),this.vaultManager=null,this.coreController.reset()}async fetchVaultedPaymentMethods(t){if(!this._vaultManager)throw new Error("Vault manager not initialized");try{t||this.coreController.setUpdating(!0);let r=await this._vaultManager.fetchVaultedPaymentMethods();return R.log("VaultManagerController: Fetched payment methods",r),this.coreController.updatePaymentMethods(r),r}catch(r){throw this.coreController.setError(r instanceof Error?r:new Error("Failed to fetch payment methods")),r}}createCvvInput(t){if(!this._vaultManager)throw new Error("Vault manager not initialized");return this._vaultManager.createCvvInput(t)}};var zt="lit-localize-status";var Fo=i=>typeof i!="string"&&"strTag"in i,Tr=(i,e,t)=>{let r=i[0];for(let o=1;o<i.length;o++)r+=e[t?t[o-1]:o-1],r+=i[o];return r};var Ft=i=>Fo(i)?Tr(i.strings,i.values):i;var A=Ft,Bo=!1;function Pi(i){if(Bo)throw new Error("lit-localize can only be configured once");A=i,Bo=!0}var Ti=class{constructor(e){this.__litLocalizeEventHandler=t=>{t.detail.status==="ready"&&this.host.requestUpdate()},this.host=e}hostConnected(){window.addEventListener(zt,this.__litLocalizeEventHandler)}hostDisconnected(){window.removeEventListener(zt,this.__litLocalizeEventHandler)}},Us=i=>i.addController(new Ti(i)),Ko=Us;var $=()=>(i,e)=>(i.addInitializer(Ko),i);var Bt=class{constructor(){this.settled=!1,this.promise=new Promise((e,t)=>{this._resolve=e,this._reject=t})}resolve(e){this.settled=!0,this._resolve(e)}reject(e){this.settled=!0,this._reject(e)}};var Ae=[];for(let i=0;i<256;i++)Ae[i]=(i>>4&15).toString(16)+(i&15).toString(16);function jo(i){let e=0,t=8997,r=0,o=33826,n=0,l=40164,g=0,u=52210;for(let S=0;S<i.length;S++)t^=i.charCodeAt(S),e=t*435,r=o*435,n=l*435,g=u*435,n+=t<<8,g+=o<<8,r+=e>>>16,t=e&65535,n+=r>>>16,o=r&65535,u=g+(n>>>16)&65535,l=n&65535;return Ae[u>>8]+Ae[u&255]+Ae[l>>8]+Ae[l&255]+Ae[o>>8]+Ae[o&255]+Ae[t>>8]+Ae[t&255]}var Ys="",zs="h",Fs="s";function Go(i,e){return(e?zs:Fs)+jo(typeof i=="string"?i:i.join(Ys))}var qo=new WeakMap,Wo=new Map;function Zo(i,e,t){if(i){let r=t?.id??Bs(e),o=i[r];if(o){if(typeof o=="string")return o;if("strTag"in o)return Tr(o.strings,e.values,o.values);{let n=qo.get(o);return n===void 0&&(n=o.values,qo.set(o,n)),{...o,values:n.map(l=>e.values[l])}}}}return Ft(e)}function Bs(i){let e=typeof i=="string"?i:i.strings,t=Wo.get(e);return t===void 0&&(t=Go(e,typeof i!="string"&&!("strTag"in i)),Wo.set(e,t)),t}function wi(i){window.dispatchEvent(new CustomEvent(zt,{detail:i}))}var kr="",ki,Xo,Ir,Ii,Jo,Xe=new Bt;Xe.resolve();var wr=0,Qo=i=>(Pi((e,t)=>Zo(Jo,e,t)),kr=Xo=i.sourceLocale,Ir=new Set(i.targetLocales),Ir.add(i.sourceLocale),Ii=i.loadLocale,{getLocale:Ks,setLocale:js}),Ks=()=>kr,js=i=>{if(i===(ki??kr))return Xe.promise;if(!Ir||!Ii)throw new Error("Internal error");if(!Ir.has(i))throw new Error("Invalid locale code");wr++;let e=wr;return ki=i,Xe.settled&&(Xe=new Bt),wi({status:"loading",loadingLocale:i}),(i===Xo?Promise.resolve({templates:void 0}):Ii(i)).then(r=>{wr===e&&(kr=i,ki=void 0,Jo=r.templates,wi({status:"ready",readyLocale:i}),Xe.resolve())},r=>{wr===e&&(wi({status:"error",errorLocale:i,errorMessage:r.toString()}),Xe.reject(r))}),Xe.promise};var Ni="en",Li=["ar","bg","ca","cs","da","de","el","en-GB","es","es-AR","es-MX","et-EE","fi-FI","fr","he","hr","hu","id","it","ja","ko","lt","lt-LT","lv","lv-LV","ms","nb","nl","nl_NL","pl","pt","pt-BR","ro","ru","sk","sl","sr-RS","sv","th","tr","uk-UA","vi","zf","zh-CN","zh-HK","zh-TW"],ea="You must call `loadLocale` first to set up the localized template.",ta,Nr,ra=i=>{let e=Qo({sourceLocale:Ni,targetLocales:Li,loadLocale:i});ta=e.getLocale,Nr=e.setLocale};var $i=i=>{ra(i)},Ri=i=>{if(!Nr)throw new Error(ea);return Nr(i)};var Kt=new Set(Li);Kt.add(Ni);var Oi=i=>{if(typeof i!="string")return!1;if(i==="en")return!0;let e=i.replace("_","-");if(Kt.has(e))return!0;let t=e.split("-")[0];return!!Kt.has(t)},Di=i=>{if(i==="en")return"en-GB";let e=i.replace("_","-");if(Kt.has(e))return e;let t=e.split("-")[0];return Kt.has(t)?t:"en-GB"};var Gt=globalThis,Lr=Gt.trustedTypes,ia=Lr?Lr.createPolicy("lit-html",{createHTML:i=>i}):void 0,Hi="$lit$",_e=`lit$${Math.random().toFixed(9).slice(2)}$`,Ui="?"+_e,Gs=`<${Ui}>`,et=document,qt=()=>et.createComment(""),Wt=i=>i===null||typeof i!="object"&&typeof i!="function",Yi=Array.isArray,da=i=>Yi(i)||typeof i?.[Symbol.iterator]=="function",Vi=`[
|
|
3
|
+
\f\r]`,jt=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,oa=/-->/g,aa=/>/g,Je=RegExp(`>|${Vi}(?:([^\\s"'>=/]+)(${Vi}*=${Vi}*(?:[^
|
|
4
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),na=/'/g,sa=/"/g,pa=/^(?:script|style|textarea|title)$/i,zi=i=>(e,...t)=>({_$litType$:i,strings:e,values:t}),c=zi(1),Me=zi(2),pc=zi(3),Se=Symbol.for("lit-noChange"),h=Symbol.for("lit-nothing"),la=new WeakMap,Qe=et.createTreeWalker(et,129);function ca(i,e){if(!Yi(i)||!i.hasOwnProperty("raw"))throw Error("invalid template strings array");return ia!==void 0?ia.createHTML(e):e}var ma=(i,e)=>{let t=i.length-1,r=[],o,n=e===2?"<svg>":e===3?"<math>":"",l=jt;for(let g=0;g<t;g++){let u=i[g],S,k,_=-1,H=0;for(;H<u.length&&(l.lastIndex=H,k=l.exec(u),k!==null);)H=l.lastIndex,l===jt?k[1]==="!--"?l=oa:k[1]!==void 0?l=aa:k[2]!==void 0?(pa.test(k[2])&&(o=RegExp("</"+k[2],"g")),l=Je):k[3]!==void 0&&(l=Je):l===Je?k[0]===">"?(l=o??jt,_=-1):k[1]===void 0?_=-2:(_=l.lastIndex-k[2].length,S=k[1],l=k[3]===void 0?Je:k[3]==='"'?sa:na):l===sa||l===na?l=Je:l===oa||l===aa?l=jt:(l=Je,o=void 0);let Y=l===Je&&i[g+1].startsWith("/>")?" ":"";n+=l===jt?u+Gs:_>=0?(r.push(S),u.slice(0,_)+Hi+u.slice(_)+_e+Y):u+_e+(_===-2?g:Y)}return[ca(i,n+(i[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),r]},Zt=class i{constructor({strings:e,_$litType$:t},r){let o;this.parts=[];let n=0,l=0,g=e.length-1,u=this.parts,[S,k]=ma(e,t);if(this.el=i.createElement(S,r),Qe.currentNode=this.el.content,t===2||t===3){let _=this.el.content.firstChild;_.replaceWith(..._.childNodes)}for(;(o=Qe.nextNode())!==null&&u.length<g;){if(o.nodeType===1){if(o.hasAttributes())for(let _ of o.getAttributeNames())if(_.endsWith(Hi)){let H=k[l++],Y=o.getAttribute(_).split(_e),he=/([.?@])?(.*)/.exec(H);u.push({type:1,index:n,name:he[2],strings:Y,ctor:he[1]==="."?Rr:he[1]==="?"?Or:he[1]==="@"?Dr:rt}),o.removeAttribute(_)}else _.startsWith(_e)&&(u.push({type:6,index:n}),o.removeAttribute(_));if(pa.test(o.tagName)){let _=o.textContent.split(_e),H=_.length-1;if(H>0){o.textContent=Lr?Lr.emptyScript:"";for(let Y=0;Y<H;Y++)o.append(_[Y],qt()),Qe.nextNode(),u.push({type:2,index:++n});o.append(_[H],qt())}}}else if(o.nodeType===8)if(o.data===Ui)u.push({type:2,index:n});else{let _=-1;for(;(_=o.data.indexOf(_e,_+1))!==-1;)u.push({type:7,index:n}),_+=_e.length-1}n++}}static createElement(e,t){let r=et.createElement("template");return r.innerHTML=e,r}};function tt(i,e,t=i,r){if(e===Se)return e;let o=r!==void 0?t._$Co?.[r]:t._$Cl,n=Wt(e)?void 0:e._$litDirective$;return o?.constructor!==n&&(o?._$AO?.(!1),n===void 0?o=void 0:(o=new n(i),o._$AT(i,t,r)),r!==void 0?(t._$Co??(t._$Co=[]))[r]=o:t._$Cl=o),o!==void 0&&(e=tt(i,o._$AS(i,e.values),o,r)),e}var $r=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:t},parts:r}=this._$AD,o=(e?.creationScope??et).importNode(t,!0);Qe.currentNode=o;let n=Qe.nextNode(),l=0,g=0,u=r[0];for(;u!==void 0;){if(l===u.index){let S;u.type===2?S=new bt(n,n.nextSibling,this,e):u.type===1?S=new u.ctor(n,u.name,u.strings,this,e):u.type===6&&(S=new Vr(n,this,e)),this._$AV.push(S),u=r[++g]}l!==u?.index&&(n=Qe.nextNode(),l++)}return Qe.currentNode=et,o}p(e){let t=0;for(let r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(e,r,t),t+=r.strings.length-2):r._$AI(e[t])),t++}},bt=class i{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,r,o){this.type=2,this._$AH=h,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=r,this.options=o,this._$Cv=o?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=tt(this,e,t),Wt(e)?e===h||e==null||e===""?(this._$AH!==h&&this._$AR(),this._$AH=h):e!==this._$AH&&e!==Se&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):da(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==h&&Wt(this._$AH)?this._$AA.nextSibling.data=e:this.T(et.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:r}=e,o=typeof r=="number"?this._$AC(e):(r.el===void 0&&(r.el=Zt.createElement(ca(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===o)this._$AH.p(t);else{let n=new $r(o,this),l=n.u(this.options);n.p(t),this.T(l),this._$AH=n}}_$AC(e){let t=la.get(e.strings);return t===void 0&&la.set(e.strings,t=new Zt(e)),t}k(e){Yi(this._$AH)||(this._$AH=[],this._$AR());let t=this._$AH,r,o=0;for(let n of e)o===t.length?t.push(r=new i(this.O(qt()),this.O(qt()),this,this.options)):r=t[o],r._$AI(n),o++;o<t.length&&(this._$AR(r&&r._$AB.nextSibling,o),t.length=o)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e&&e!==this._$AB;){let r=e.nextSibling;e.remove(),e=r}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},rt=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,r,o,n){this.type=1,this._$AH=h,this._$AN=void 0,this.element=e,this.name=t,this._$AM=o,this.options=n,r.length>2||r[0]!==""||r[1]!==""?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=h}_$AI(e,t=this,r,o){let n=this.strings,l=!1;if(n===void 0)e=tt(this,e,t,0),l=!Wt(e)||e!==this._$AH&&e!==Se,l&&(this._$AH=e);else{let g=e,u,S;for(e=n[0],u=0;u<n.length-1;u++)S=tt(this,g[r+u],t,u),S===Se&&(S=this._$AH[u]),l||(l=!Wt(S)||S!==this._$AH[u]),S===h?e=h:e!==h&&(e+=(S??"")+n[u+1]),this._$AH[u]=S}l&&!o&&this.j(e)}j(e){e===h?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},Rr=class extends rt{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===h?void 0:e}},Or=class extends rt{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==h)}},Dr=class extends rt{constructor(e,t,r,o,n){super(e,t,r,o,n),this.type=5}_$AI(e,t=this){if((e=tt(this,e,t,0)??h)===Se)return;let r=this._$AH,o=e===h&&r!==h||e.capture!==r.capture||e.once!==r.once||e.passive!==r.passive,n=e!==h&&(r===h||o);o&&this.element.removeEventListener(this.name,this,r),n&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}},Vr=class{constructor(e,t,r){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(e){tt(this,e)}},ua={M:Hi,P:_e,A:Ui,C:1,L:ma,R:$r,D:da,V:tt,I:bt,H:rt,N:Or,U:Dr,B:Rr,F:Vr},qs=Gt.litHtmlPolyfillSupport;qs?.(Zt,bt),(Gt.litHtmlVersions??(Gt.litHtmlVersions=[])).push("3.2.1");var ha=(i,e,t)=>{let r=t?.renderBefore??e,o=r._$litPart$;if(o===void 0){let n=t?.renderBefore??null;r._$litPart$=o=new bt(e.insertBefore(qt(),n),n,void 0,t??{})}return o._$AI(i),o};var v=class extends xe{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var t;let e=super.createRenderRoot();return(t=this.renderOptions).renderBefore??(t.renderBefore=e.firstChild),e}update(e){let t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=ha(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return Se}};v._$litElement$=!0,v.finalized=!0,globalThis.litElementHydrateSupport?.({LitElement:v});var Ws=globalThis.litElementPolyfillSupport;Ws?.({LitElement:v});(globalThis.litElementVersions??(globalThis.litElementVersions=[])).push("4.1.1");var y=i=>(e,t)=>{t!==void 0?t.addInitializer(()=>{customElements.define(i,e)}):customElements.define(i,e)};var Zs={attribute:!0,type:String,converter:Ut,reflect:!1,hasChanged:yt},Xs=(i=Zs,e,t)=>{let{kind:r,metadata:o}=t,n=globalThis.litPropertyMetadata.get(o);if(n===void 0&&globalThis.litPropertyMetadata.set(o,n=new Map),n.set(t.name,i),r==="accessor"){let{name:l}=t;return{set(g){let u=e.get.call(this);e.set.call(this,g),this.requestUpdate(l,u,i)},init(g){return g!==void 0&&this.P(l,void 0,i),g}}}if(r==="setter"){let{name:l}=t;return function(g){let u=this[l];e.call(this,g),this.requestUpdate(l,u,i)}}throw Error("Unsupported decorator location: "+r)};function p(i){return(e,t)=>typeof t=="object"?Xs(i,e,t):((r,o,n)=>{let l=o.hasOwnProperty(n);return o.constructor.createProperty(n,l?{...r,wrapped:!0}:r),l?Object.getOwnPropertyDescriptor(o,n):void 0})(i,e,t)}function I(i){return p({...i,state:!0,attribute:!1})}var it=(i,e,t)=>(t.configurable=!0,t.enumerable=!0,Reflect.decorate&&typeof e!="object"&&Object.defineProperty(i,e,t),t);function Ve(i,e){return(t,r,o)=>{let n=l=>l.renderRoot?.querySelector(i)??null;if(e){let{get:l,set:g}=typeof r=="object"?t:o??(()=>{let u=Symbol();return{get(){return this[u]},set(S){this[u]=S}}})();return it(t,r,{get(){let u=l.call(this);return u===void 0&&(u=n(this),(u!==null||this.hasUpdated)&&g.call(this,u)),u}})}return it(t,r,{get(){return n(this)}})}}function V(i,e,t){return i?e(i):t?.(i)}var w=f`
|
|
5
5
|
* {
|
|
6
6
|
box-sizing: border-box;
|
|
7
7
|
}
|
|
8
|
-
`,
|
|
8
|
+
`,ga=f`
|
|
9
9
|
:host {
|
|
10
10
|
display: block;
|
|
11
11
|
isolation: isolate;
|
|
@@ -14,14 +14,14 @@ import{a as Gi,b as fn,c as zr,d as n}from"./chunks/chunk.G45OCYEN.js";var wr=fn
|
|
|
14
14
|
//Keep the CSS loader in the same position - check css-loader-inline.ts
|
|
15
15
|
min-height: 64px;
|
|
16
16
|
}
|
|
17
|
-
`;var ko="https://sdk.primer.io/web/v2-latest/Primer.min.js";var vr=class{constructor(t){this._methods=t}get(t){return this._methods.get(t)}toArray(){return Array.from(this._methods.values())}size(){return this._methods.size}};var yr=typeof window<"u"&&typeof window.document<"u";function $n(i){return document.querySelector(`script[src^="${i}"]`)}function Vn(i,t){let e=document.createElement("script");return e.setAttribute("src",i),e.setAttribute("async",""),e.setAttribute("crossorigin","anonymous"),t&&e.setAttribute("type","module"),e}function To(i,t=!1){if(!yr)throw new Error("Cannot load script in server environment");let e=$n(i)??Vn(i,t);return new Promise((r,o)=>{e.onload=()=>{r()},e.onerror=()=>{o()},e.parentNode||document.head.appendChild(e)})}var br=class{constructor(t){this.createPaymentMethodManager=null;this._paymentsList=[];this.currentSdkInstance=null;this.loadingTimeout=null;this.isDisconnected=!1;(this.host=t).addController(this),this.isDisconnected=!1,this.sdkInstanceTask=new R(t,{args:()=>[this.host.clientToken,this.host.options],task:this.initializeHeadless()}),new R(t,{args:()=>[this.sdkInstanceTask.value,this.paymentsList],task:this.initializeLitContext()})}set paymentsList(t){this._paymentsList=t,this.host.requestUpdate()}get paymentsList(){return this._paymentsList}hostConnected(){this.isDisconnected=!1,this.host.sdkStateController.startLoading(),this.setupLoadingTimeout()}hostDisconnected(){this.isDisconnected=!0,this.cleanupResources()}setupLoadingTimeout(){this.clearLoadingTimeout(),this.loadingTimeout=setTimeout(()=>{this.host.sdkStateController.state.isLoading&&(P.warn("Loading timeout reached, resetting SDK state"),this.cleanupResources(),this.host.sdkStateController.completeLoading())},1e4)}clearLoadingTimeout(){this.loadingTimeout!==null&&(clearTimeout(this.loadingTimeout),this.loadingTimeout=null)}cleanupResources(){if(this.clearLoadingTimeout(),this.currentSdkInstance)try{this.paymentsList=[],this.createPaymentMethodManager=null,this.host.sdkStateController.reset(),P.info("SDK instance cleaned up")}catch(t){P.error("Error cleaning up SDK instance:",t)}this.currentSdkInstance=null}async _loadV2Sdk(t=ko){if(window.Primer&&typeof window.Primer.preloadPrimer=="function"){P.info("SDK already loaded, skipping load script"),await window.Primer.preloadPrimer();return}await To(t),await window.Primer.preloadPrimer()}initializeHeadless(){return async([t,e])=>{if(this.isDisconnected)return P.warn("Component disconnected, aborting SDK initialization"),I;if(!t||!e)return I;this.cleanupResources();try{await this._loadV2Sdk();let{Primer:r}=window,o=await r.createHeadless(t,{...e,onAvailablePaymentMethodsLoad:m=>{this.isDisconnected||(P.info("Configuration payment methods:",m),this.paymentsList=m)},onCheckoutComplete:({payment:m})=>{this.isDisconnected||(P.info("Payment completed:",m),this.host.sdkStateController.completeProcessing())},onCheckoutFail:(m,C,v)=>{this.isDisconnected||(P.error("Payment failed:",m),this.host.sdkStateController.setFailure(m.code||"UNKNOWN_ERROR",m.message||"Unknown error occurred"),v&&v.showErrorMessage())},onBeforePaymentCreate:(m,C)=>{this.isDisconnected||(this.host.sdkStateController.startProcessing(),C?.continuePaymentCreation())},onPaymentMethodAction:(m,C)=>{this.isDisconnected||m==="PAYMENT_METHOD_UNSELECTED"&&this.host.sdkStateController.reset()}});if(this.createPaymentMethodManager=o.createPaymentMethodManager.bind(o),this.currentSdkInstance=o,await o.start(),this.isDisconnected)return this.cleanupResources(),I;this.host.sdkContextController.setClientOptions(e),this.host.primerEventsController.dispatchCheckoutInitialized(o);let s=o.getSDKUtilities();return this.host.sdkContextController.setHeadlessUtils(s),this.host.vaultManagerController.initializeVaultManager(o.createVaultManager(),{vaultEnabled:e.vault?.enabled,captureVaultedCardCvv:!!s.getPaymentMethodConfiguration("PAYMENT_CARD")?.options.captureVaultedCardCvv}),o}catch(r){throw r instanceof Error&&(P.error("SDK initialization error:",r),this.host.sdkStateController.setError(r)),this.cleanupResources(),r}}}initializeLitContext(){return async([t,e])=>{if(this.isDisconnected)return I;if(!t||!e.length)return I;let r=new Map,o=new Map;try{for(let m of e){if(this.isDisconnected)break;let C=await this.initializePaymentMethodManager(m)();m&&C&&(r.set(m.type,m),o.set(m.type,C))}if(this.isDisconnected)return I;let s=new vr(r);return this.host.sdkContextController.setPaymentManagers(o),this.host.sdkContextController.setPaymentMethods(s),this.host.primerEventsController.dispatchPaymentMethods(s),P.info("Initialized payment methods:",s.toArray()),r}catch(s){if(s instanceof Error)throw this.host.sdkStateController.setError(s),s;return null}finally{this.clearLoadingTimeout(),this.isDisconnected||this.host.sdkStateController.completeLoading()}}}initializePaymentMethodManager(t){let{type:e,managerType:r}=t;return async()=>{if(this.isDisconnected||!this.createPaymentMethodManager)return null;if(r==="KLARNA"){let o=await this.createPaymentMethodManager(e,{onPaymentMethodCategoriesChange:s=>{this.isDisconnected||this.host.sdkContextController.setKlarnaCategories({categories:s,isLoading:!1})},onPaymentMethodAction:s=>{this.isDisconnected||s==="PAYMENT_METHOD_UNSELECTED"&&this.host.sdkStateController.reset()}});return o?{type:e,manager:o}:null}try{if(r==="CARD"){let s=await this.createPaymentMethodManager(e,{onCardNetworksChange:async m=>{this.isDisconnected||await this.host.cardNetworkController.processCardNetworkChangeEvent(m)},onCardNetworksLoading:()=>{this.isDisconnected||this.host.cardNetworkController.setCardNetworksLoading()}});return s?{type:e,manager:s}:null}let o=await this.createPaymentMethodManager(e);return o?{type:e,manager:o}:null}catch(o){return P.error(`Failed to initialize manager for ${e}:`,o),null}}}};var Er=class{constructor(t){this.host=t,t.addController(this)}_error(t){let{error:e}=t.detail;this.host.sdkStateController.setFailure("UNKNOWN_ERROR",e.message)}_mandateConfirmed(){this.host.sdkStateController.completeProcessing()}_mandateDeclined(){this.host.sdkStateController.setFailure("UNKNOWN_ERROR","Mandate declined")}hostConnected(){this.host.addEventListener("primer-ach-error",this._error.bind(this)),this.host.addEventListener("primer-ach-mandate-confirmed",this._mandateConfirmed.bind(this)),this.host.addEventListener("primer-ach-mandate-declined",this._mandateDeclined.bind(this))}hostDisconnected(){this.host.removeEventListener("primer-ach-error",this._error.bind(this)),this.host.removeEventListener("primer-ach-mandate-confirmed",this._mandateConfirmed.bind(this)),this.host.removeEventListener("primer-ach-mandate-declined",this._mandateDeclined.bind(this))}};var Hn=Gi({"../../localization/lit-localize/locales/ar.ts":()=>import("./chunks/ar.5AY75F5J.js"),"../../localization/lit-localize/locales/bg.ts":()=>import("./chunks/bg.2EL2HTYI.js"),"../../localization/lit-localize/locales/ca.ts":()=>import("./chunks/ca.WZI7CBFW.js"),"../../localization/lit-localize/locales/cs.ts":()=>import("./chunks/cs.GBLLNC3E.js"),"../../localization/lit-localize/locales/da.ts":()=>import("./chunks/da.CDEFQG44.js"),"../../localization/lit-localize/locales/de.ts":()=>import("./chunks/de.UHURA2HV.js"),"../../localization/lit-localize/locales/el.ts":()=>import("./chunks/el.BY5NGYDF.js"),"../../localization/lit-localize/locales/en-GB.ts":()=>import("./chunks/en-GB.UBLLAUVW.js"),"../../localization/lit-localize/locales/en.ts":()=>import("./chunks/en.BKAVPUID.js"),"../../localization/lit-localize/locales/es-AR.ts":()=>import("./chunks/es-AR.EYNC6EAZ.js"),"../../localization/lit-localize/locales/es-MX.ts":()=>import("./chunks/es-MX.OIO2YURF.js"),"../../localization/lit-localize/locales/es.ts":()=>import("./chunks/es.CNNIJYLX.js"),"../../localization/lit-localize/locales/et-EE.ts":()=>import("./chunks/et-EE.4ZF6CLB6.js"),"../../localization/lit-localize/locales/fi-FI.ts":()=>import("./chunks/fi-FI.4ZXWRRYI.js"),"../../localization/lit-localize/locales/fr.ts":()=>import("./chunks/fr.TZM5I4K2.js"),"../../localization/lit-localize/locales/he.ts":()=>import("./chunks/he.DWEZBG4A.js"),"../../localization/lit-localize/locales/hr.ts":()=>import("./chunks/hr.BV4PC324.js"),"../../localization/lit-localize/locales/hu.ts":()=>import("./chunks/hu.MTEKSS3J.js"),"../../localization/lit-localize/locales/id.ts":()=>import("./chunks/id.SJSTOPSC.js"),"../../localization/lit-localize/locales/it.ts":()=>import("./chunks/it.IISTMHN5.js"),"../../localization/lit-localize/locales/ja.ts":()=>import("./chunks/ja.IBQ3ID5C.js"),"../../localization/lit-localize/locales/ko.ts":()=>import("./chunks/ko.KZVQLI4V.js"),"../../localization/lit-localize/locales/lt-LT.ts":()=>import("./chunks/lt-LT.RKBB7CZ6.js"),"../../localization/lit-localize/locales/lt.ts":()=>import("./chunks/lt.TLM7OCXP.js"),"../../localization/lit-localize/locales/lv-LV.ts":()=>import("./chunks/lv-LV.H5TJC2T4.js"),"../../localization/lit-localize/locales/lv.ts":()=>import("./chunks/lv.G4SRVBAC.js"),"../../localization/lit-localize/locales/ms.ts":()=>import("./chunks/ms.ATTITA66.js"),"../../localization/lit-localize/locales/nb.ts":()=>import("./chunks/nb.5EE7XOA7.js"),"../../localization/lit-localize/locales/nl.ts":()=>import("./chunks/nl.TY2SYTKZ.js"),"../../localization/lit-localize/locales/nl_NL.ts":()=>import("./chunks/nl_NL.GB5BQ5PG.js"),"../../localization/lit-localize/locales/pl.ts":()=>import("./chunks/pl.5PRBSG4K.js"),"../../localization/lit-localize/locales/pt-BR.ts":()=>import("./chunks/pt-BR.5XRZB5WW.js"),"../../localization/lit-localize/locales/pt.ts":()=>import("./chunks/pt.TA5H5JUJ.js"),"../../localization/lit-localize/locales/ro.ts":()=>import("./chunks/ro.PSZKGHRP.js"),"../../localization/lit-localize/locales/ru.ts":()=>import("./chunks/ru.3QZY7ZIT.js"),"../../localization/lit-localize/locales/sk.ts":()=>import("./chunks/sk.FAQFYLGM.js"),"../../localization/lit-localize/locales/sl.ts":()=>import("./chunks/sl.QRSCQXJP.js"),"../../localization/lit-localize/locales/sr-RS.ts":()=>import("./chunks/sr-RS.TKMMG7FK.js"),"../../localization/lit-localize/locales/sv.ts":()=>import("./chunks/sv.HZ3E6V5F.js"),"../../localization/lit-localize/locales/th.ts":()=>import("./chunks/th.AY6M42B4.js"),"../../localization/lit-localize/locales/tr.ts":()=>import("./chunks/tr.TFKBPYMO.js"),"../../localization/lit-localize/locales/uk-UA.ts":()=>import("./chunks/uk-UA.3TU67RSI.js"),"../../localization/lit-localize/locales/vi.ts":()=>import("./chunks/vi.NLXELMXV.js"),"../../localization/lit-localize/locales/zf.ts":()=>import("./chunks/zf.U5XPENNR.js"),"../../localization/lit-localize/locales/zh-CN.ts":()=>import("./chunks/zh-CN.VEOQJ3EU.js"),"../../localization/lit-localize/locales/zh-HK.ts":()=>import("./chunks/zh-HK.ZEXSW7FF.js"),"../../localization/lit-localize/locales/zh-TW.ts":()=>import("./chunks/zh-TW.MMVWEQMZ.js")});ti(i=>Hn(`../../localization/lit-localize/locales/${i}.ts`));var se=class extends g{constructor(){super();this.customStyles="";this.clientToken="";this.options={};this._jsInitialized=!1;this.previousLoadingState=!0;this.hasAssignedContent=!1;this._loadingTimeoutId=null;this.locale="en-GB";this.onSlotChange=e=>{let o=e.target.assignedNodes({flatten:!0});this.hasAssignedContent=o.length>0,this.requestUpdate()};this.sdkContextController=new er(this),this.sdkStateController=new Qt(this),this.primerEventsController=new at(this),this.styleProcessingController=new tr(this),this.vaultManagerController=new wt(this),this.cardNetworkController=new qt(this),this.achPaymentEventsController=new Er(this),new br(this)}set jsInitialized(e){this.requestUpdate(),this._jsInitialized=e}get jsInitialized(){return this._jsInitialized}attributeChangedCallback(e,r,o){e==="customstyles"?this.styleProcessingController.processCustomStyles(o):super.attributeChangedCallback(e,r,o)}disconnectedCallback(){this._loadingTimeoutId&&(window.clearTimeout(this._loadingTimeoutId),this._loadingTimeoutId=null),this.sdkStateController?.state.isLoading&&this.sdkStateController.forceCompleteLoading(),super.disconnectedCallback()}willUpdate(e){e.has("options")&&(this.options?.locale&&(ii(this.options?.locale)?this.locale=oi(this.options?.locale):P.warn("\u{1F30E}\u2757 Unsupported locale provided:",this.options?.locale,"- Falling back to default locale `en-GB`")),ri(this.locale||"en-GB"))}updated(){let e=getComputedStyle(this);this.sdkContextController.setComputedStyles(e),this.checkLoadingStateChange()}checkLoadingStateChange(){let e=this.sdkStateController?.state.isLoading||!1;this.previousLoadingState&&!e&&(this.jsInitialized=!0),this.previousLoadingState=e,e&&!this._loadingTimeoutId?this._loadingTimeoutId=window.setTimeout(()=>{this.sdkStateController?.state.isLoading&&(P.warn("Loading timeout in component, forcing completion"),this.sdkStateController.forceCompleteLoading(),this.jsInitialized=!0),this._loadingTimeoutId=null},1e4):!e&&this._loadingTimeoutId&&(window.clearTimeout(this._loadingTimeoutId),this._loadingTimeoutId=null)}render(){let e=this.sdkStateController.state,r=e.isLoading,o=e.error,s=!r&&!o;return p`
|
|
18
|
-
${V(r,()=>
|
|
19
|
-
${V(o,()=>
|
|
20
|
-
${V(
|
|
17
|
+
`;var fa="https://sdk.primer.io/web/v2-latest/Primer.min.js";var Hr=class{constructor(e){this._methods=e}get(e){return this._methods.get(e)}toArray(){return Array.from(this._methods.values())}size(){return this._methods.size}};var Ur=typeof window<"u"&&typeof window.document<"u";function Js(i){return document.querySelector(`script[src^="${i}"]`)}function Qs(i,e){let t=document.createElement("script");return t.setAttribute("src",i),t.setAttribute("async",""),t.setAttribute("crossorigin","anonymous"),e&&t.setAttribute("type","module"),t}function va(i,e=!1){if(!Ur)throw new Error("Cannot load script in server environment");let t=Js(i)??Qs(i,e);return new Promise((r,o)=>{t.onload=()=>{r()},t.onerror=()=>{o()},t.parentNode||document.head.appendChild(t)})}var Yr=class{constructor(e){this.createPaymentMethodManager=null;this._paymentsList=[];this.currentSdkInstance=null;this.loadingTimeout=null;this.isDisconnected=!1;(this.host=e).addController(this),this.isDisconnected=!1,this.sdkInstanceTask=new D(e,{args:()=>[this.host.clientToken,this.host.options],task:this.initializeHeadless()}),new D(e,{args:()=>[this.sdkInstanceTask.value,this.paymentsList],task:this.initializeLitContext()})}set paymentsList(e){this._paymentsList=e,this.host.requestUpdate()}get paymentsList(){return this._paymentsList}hostConnected(){this.isDisconnected=!1,this.host.sdkStateController.startLoading(),this.setupLoadingTimeout()}hostDisconnected(){this.isDisconnected=!0,this.cleanupResources()}setupLoadingTimeout(){this.clearLoadingTimeout(),this.loadingTimeout=setTimeout(()=>{this.host.sdkStateController.currentState.isLoading&&(R.warn("Loading timeout reached, resetting SDK state"),this.cleanupResources(),this.host.sdkStateController.completeLoading())},1e4)}clearLoadingTimeout(){this.loadingTimeout!==null&&(clearTimeout(this.loadingTimeout),this.loadingTimeout=null)}cleanupResources(){if(this.clearLoadingTimeout(),this.currentSdkInstance)try{this.paymentsList=[],this.createPaymentMethodManager=null,this.host.sdkStateController.reset(),R.info("SDK instance cleaned up")}catch(e){R.error("Error cleaning up SDK instance:",e)}this.currentSdkInstance=null}async _loadV2Sdk(e=fa){if(window.Primer&&typeof window.Primer.preloadPrimer=="function"){R.info("SDK already loaded, skipping load script"),await window.Primer.preloadPrimer();return}await va(e),await window.Primer.preloadPrimer()}initializeHeadless(){return async([e,t])=>{if(this.isDisconnected)return R.warn("Component disconnected, aborting SDK initialization"),L;if(!e||!t)return L;this.cleanupResources();try{await this._loadV2Sdk();let{Primer:r}=window,o=await r.createHeadless(e,{...t,onAvailablePaymentMethodsLoad:l=>{this.isDisconnected||(R.info("Configuration payment methods:",l),this.paymentsList=l)},onCheckoutComplete:({payment:l})=>{this.isDisconnected||(R.info("Payment completed:",l),this.host.sdkStateController.completeProcessing(),this.host.primerEventsController.dispatchOnCheckoutComplete(l))},onCheckoutFail:(l,g)=>{this.isDisconnected||(R.error("Payment failed:",l),this.host.sdkStateController.setFailure(l.code||"UNKNOWN_ERROR",l.message||"Unknown error occurred"),this.host.primerEventsController.dispatchOnCheckoutFailure(l,g.payment))},onBeforePaymentCreate:(l,g)=>{this.isDisconnected||(this.host.sdkStateController.startProcessing(),g?.continuePaymentCreation())},onPaymentMethodAction:(l,g)=>{this.isDisconnected||l==="PAYMENT_METHOD_UNSELECTED"&&this.host.sdkStateController.stopProcessing()},onPaymentCreationStart:()=>{this.isDisconnected||this.host.sdkStateController.resetError()}});if(this.createPaymentMethodManager=o.createPaymentMethodManager.bind(o),this.currentSdkInstance=o,await o.start(),this.isDisconnected)return this.cleanupResources(),L;this.host.sdkContextController.setClientOptions(t),this.host.primerEventsController.dispatchCheckoutInitialized(o);let n=o.getSDKUtilities();return this.host.sdkContextController.setHeadlessUtils(n),this.host.vaultManagerController.initializeVaultManager(o.createVaultManager(),{vaultEnabled:t.vault?.enabled,captureVaultedCardCvv:!!n.getPaymentMethodConfiguration("PAYMENT_CARD")?.options.captureVaultedCardCvv}),o}catch(r){throw r instanceof Error&&(R.error("SDK initialization error:",r),this.host.sdkStateController.setError(r)),this.cleanupResources(),r}}}initializeLitContext(){return async([e,t])=>{if(this.isDisconnected)return L;if(!e||!t.length)return L;let r=new Map,o=new Map;try{for(let l of t){if(this.isDisconnected)break;let g=await this.initializePaymentMethodManager(l)();l&&g&&(r.set(l.type,l),o.set(l.type,g))}if(this.isDisconnected)return L;let n=new Hr(r);return this.host.sdkContextController.setPaymentManagers(o),this.host.sdkContextController.setPaymentMethods(n),this.host.primerEventsController.dispatchPaymentMethods(n),R.info("Initialized payment methods:",n.toArray()),r}catch(n){if(n instanceof Error)throw this.host.sdkStateController.setError(n),n;return null}finally{this.clearLoadingTimeout(),this.isDisconnected||this.host.sdkStateController.completeLoading()}}}initializePaymentMethodManager(e){let{type:t,managerType:r}=e;return async()=>{if(this.isDisconnected||!this.createPaymentMethodManager)return null;if(r==="KLARNA"){let o=await this.createPaymentMethodManager("KLARNA",{onPaymentMethodCategoriesChange:n=>{this.isDisconnected||this.host.sdkContextController.setKlarnaCategories({categories:n,isLoading:!1})}});return o?{type:t,manager:o}:null}try{if(r==="CARD"){let n=await this.createPaymentMethodManager(t,{onCardNetworksChange:async l=>{this.isDisconnected||await this.host.cardNetworkController.processCardNetworkChangeEvent(l)},onCardNetworksLoading:()=>{this.isDisconnected||this.host.cardNetworkController.setCardNetworksLoading()}});return n?{type:t,manager:n}:null}let o=await this.createPaymentMethodManager(t);return o?{type:t,manager:o}:null}catch(o){return R.error(`Failed to initialize manager for ${t}:`,o),null}}}};var zr=class{constructor(e){this.host=e,e.addController(this)}_error(e){let{error:t}=e.detail;this.host.sdkStateController.setFailure("UNKNOWN_ERROR",t.message)}_mandateConfirmed(){this.host.sdkStateController.completeProcessing()}_mandateDeclined(){this.host.sdkStateController.setFailure("UNKNOWN_ERROR","Mandate declined")}hostConnected(){this.host.addEventListener("primer-ach-error",this._error.bind(this)),this.host.addEventListener("primer-ach-mandate-confirmed",this._mandateConfirmed.bind(this)),this.host.addEventListener("primer-ach-mandate-declined",this._mandateDeclined.bind(this))}hostDisconnected(){this.host.removeEventListener("primer-ach-error",this._error.bind(this)),this.host.removeEventListener("primer-ach-mandate-confirmed",this._mandateConfirmed.bind(this)),this.host.removeEventListener("primer-ach-mandate-declined",this._mandateDeclined.bind(this))}};var el=$o({"../../localization/lit-localize/locales/ar.ts":()=>import("./chunks/ar.5AY75F5J.js"),"../../localization/lit-localize/locales/bg.ts":()=>import("./chunks/bg.2EL2HTYI.js"),"../../localization/lit-localize/locales/ca.ts":()=>import("./chunks/ca.WZI7CBFW.js"),"../../localization/lit-localize/locales/cs.ts":()=>import("./chunks/cs.GBLLNC3E.js"),"../../localization/lit-localize/locales/da.ts":()=>import("./chunks/da.CDEFQG44.js"),"../../localization/lit-localize/locales/de.ts":()=>import("./chunks/de.UHURA2HV.js"),"../../localization/lit-localize/locales/el.ts":()=>import("./chunks/el.BY5NGYDF.js"),"../../localization/lit-localize/locales/en-GB.ts":()=>import("./chunks/en-GB.UBLLAUVW.js"),"../../localization/lit-localize/locales/en.ts":()=>import("./chunks/en.BKAVPUID.js"),"../../localization/lit-localize/locales/es-AR.ts":()=>import("./chunks/es-AR.EYNC6EAZ.js"),"../../localization/lit-localize/locales/es-MX.ts":()=>import("./chunks/es-MX.OIO2YURF.js"),"../../localization/lit-localize/locales/es.ts":()=>import("./chunks/es.CNNIJYLX.js"),"../../localization/lit-localize/locales/et-EE.ts":()=>import("./chunks/et-EE.4ZF6CLB6.js"),"../../localization/lit-localize/locales/fi-FI.ts":()=>import("./chunks/fi-FI.4ZXWRRYI.js"),"../../localization/lit-localize/locales/fr.ts":()=>import("./chunks/fr.TZM5I4K2.js"),"../../localization/lit-localize/locales/he.ts":()=>import("./chunks/he.DWEZBG4A.js"),"../../localization/lit-localize/locales/hr.ts":()=>import("./chunks/hr.BV4PC324.js"),"../../localization/lit-localize/locales/hu.ts":()=>import("./chunks/hu.MTEKSS3J.js"),"../../localization/lit-localize/locales/id.ts":()=>import("./chunks/id.SJSTOPSC.js"),"../../localization/lit-localize/locales/it.ts":()=>import("./chunks/it.IISTMHN5.js"),"../../localization/lit-localize/locales/ja.ts":()=>import("./chunks/ja.IBQ3ID5C.js"),"../../localization/lit-localize/locales/ko.ts":()=>import("./chunks/ko.KZVQLI4V.js"),"../../localization/lit-localize/locales/lt-LT.ts":()=>import("./chunks/lt-LT.RKBB7CZ6.js"),"../../localization/lit-localize/locales/lt.ts":()=>import("./chunks/lt.TLM7OCXP.js"),"../../localization/lit-localize/locales/lv-LV.ts":()=>import("./chunks/lv-LV.H5TJC2T4.js"),"../../localization/lit-localize/locales/lv.ts":()=>import("./chunks/lv.G4SRVBAC.js"),"../../localization/lit-localize/locales/ms.ts":()=>import("./chunks/ms.ATTITA66.js"),"../../localization/lit-localize/locales/nb.ts":()=>import("./chunks/nb.5EE7XOA7.js"),"../../localization/lit-localize/locales/nl.ts":()=>import("./chunks/nl.TY2SYTKZ.js"),"../../localization/lit-localize/locales/nl_NL.ts":()=>import("./chunks/nl_NL.GB5BQ5PG.js"),"../../localization/lit-localize/locales/pl.ts":()=>import("./chunks/pl.5PRBSG4K.js"),"../../localization/lit-localize/locales/pt-BR.ts":()=>import("./chunks/pt-BR.5XRZB5WW.js"),"../../localization/lit-localize/locales/pt.ts":()=>import("./chunks/pt.TA5H5JUJ.js"),"../../localization/lit-localize/locales/ro.ts":()=>import("./chunks/ro.PSZKGHRP.js"),"../../localization/lit-localize/locales/ru.ts":()=>import("./chunks/ru.3QZY7ZIT.js"),"../../localization/lit-localize/locales/sk.ts":()=>import("./chunks/sk.FAQFYLGM.js"),"../../localization/lit-localize/locales/sl.ts":()=>import("./chunks/sl.QRSCQXJP.js"),"../../localization/lit-localize/locales/sr-RS.ts":()=>import("./chunks/sr-RS.TKMMG7FK.js"),"../../localization/lit-localize/locales/sv.ts":()=>import("./chunks/sv.HZ3E6V5F.js"),"../../localization/lit-localize/locales/th.ts":()=>import("./chunks/th.AY6M42B4.js"),"../../localization/lit-localize/locales/tr.ts":()=>import("./chunks/tr.TFKBPYMO.js"),"../../localization/lit-localize/locales/uk-UA.ts":()=>import("./chunks/uk-UA.3TU67RSI.js"),"../../localization/lit-localize/locales/vi.ts":()=>import("./chunks/vi.NLXELMXV.js"),"../../localization/lit-localize/locales/zf.ts":()=>import("./chunks/zf.U5XPENNR.js"),"../../localization/lit-localize/locales/zh-CN.ts":()=>import("./chunks/zh-CN.VEOQJ3EU.js"),"../../localization/lit-localize/locales/zh-HK.ts":()=>import("./chunks/zh-HK.ZEXSW7FF.js"),"../../localization/lit-localize/locales/zh-TW.ts":()=>import("./chunks/zh-TW.MMVWEQMZ.js")});$i(i=>el(`../../localization/lit-localize/locales/${i}.ts`));var Fr={LOADER_DISABLED:"loader-disabled",CUSTOM_STYLES:"custom-styles",CLIENT_TOKEN:"client-token",JS_INIT:"js-initialized"},le=class extends v{constructor(){super();this.customStyles="";this.clientToken="";this.options={};this._jsInitialized=!1;this.previousLoadingState=!0;this.hasAssignedContent=!1;this._loadingTimeoutId=null;this.locale="en-GB";this.onSlotChange=t=>{let o=t.target.assignedNodes({flatten:!0});this.hasAssignedContent=o.length>0,this.requestUpdate()};this.sdkContextController=new Ar(this),this.sdkStateController=new Cr(this),this.primerEventsController=new gt(this),this.styleProcessingController=new _r(this),this.vaultManagerController=new Yt(this),this.cardNetworkController=new fr(this),this.achPaymentEventsController=new zr(this),new Yr(this)}set jsInitialized(t){this.requestUpdate(),this._jsInitialized=t}get jsInitialized(){return this._jsInitialized}attributeChangedCallback(t,r,o){t===Fr.CUSTOM_STYLES?this.styleProcessingController.processCustomStyles(o):super.attributeChangedCallback(t,r,o)}disconnectedCallback(){this._loadingTimeoutId&&(window.clearTimeout(this._loadingTimeoutId),this._loadingTimeoutId=null),this.sdkStateController?.currentState.isLoading&&this.sdkStateController.forceCompleteLoading(),super.disconnectedCallback()}willUpdate(t){t.has("options")&&(this.options?.locale&&(Oi(this.options?.locale)?this.locale=Di(this.options?.locale):R.warn("\u{1F30E}\u2757 Unsupported locale provided:",this.options?.locale,"- Falling back to default locale `en-GB`")),Ri(this.locale||"en-GB"))}updated(){let t=getComputedStyle(this);this.sdkContextController.setComputedStyles(t),this.checkLoadingStateChange()}checkLoadingStateChange(){let t=this.sdkStateController?.currentState.isLoading||!1;this.previousLoadingState&&!t&&(this.jsInitialized=!0),this.previousLoadingState=t,t&&!this._loadingTimeoutId?this._loadingTimeoutId=window.setTimeout(()=>{this.sdkStateController?.currentState.isLoading&&(R.warn("Loading timeout in component, forcing completion"),this.sdkStateController.forceCompleteLoading(),this.jsInitialized=!0),this._loadingTimeoutId=null},1e4):!t&&this._loadingTimeoutId&&(window.clearTimeout(this._loadingTimeoutId),this._loadingTimeoutId=null)}render(){let t=this.sdkStateController.currentState,r=t.isLoading,o=t.error,n=!r&&!o;return c`
|
|
18
|
+
${V(r,()=>h)}
|
|
19
|
+
${V(o,()=>c`<primer-checkout-error></primer-checkout-error>`)}
|
|
20
|
+
${V(n,()=>c`
|
|
21
21
|
<slot name="main" @slotchange=${this.onSlotChange}></slot>
|
|
22
|
-
${V(this.hasAssignedContent,()=>
|
|
23
|
-
`,()=>
|
|
24
|
-
`}addEventListener(
|
|
22
|
+
${V(this.hasAssignedContent,()=>h,()=>c`<primer-main></primer-main>`)}
|
|
23
|
+
`,()=>h)}
|
|
24
|
+
`}addEventListener(t,r,o){super.addEventListener(t,r,o)}removeEventListener(t,r,o){super.removeEventListener(t,r,o)}};le.styles=[w,ga],s([p({type:String,attribute:Fr.CUSTOM_STYLES})],le.prototype,"customStyles",2),s([p({type:String,attribute:Fr.CLIENT_TOKEN})],le.prototype,"clientToken",2),s([p({type:Object})],le.prototype,"options",2),s([p({type:Boolean,reflect:!0,attribute:Fr.JS_INIT})],le.prototype,"_jsInitialized",2),s([Ve("slot")],le.prototype,"defaultSlot",2),s([I()],le.prototype,"previousLoadingState",2),le=s([$(),y("primer-checkout")],le);function tl(i){return document.querySelector(`#${i}`)}function rl(i,e){let t=document.createElement("style");return t.textContent=i,t.id=e,t}function Xt(i,e,t=!0){if(!Ur||tl(e))return;let o=rl(i,e);t&&document.head.firstChild?document.head.insertBefore(o,document.head.firstChild):document.head.appendChild(o)}var ya=`
|
|
25
25
|
@keyframes primer-css-spinner-rotate {
|
|
26
26
|
0% {
|
|
27
27
|
transform: rotate(0deg);
|
|
@@ -57,7 +57,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
|
|
|
57
57
|
animation: primer-css-spinner-rotate 1.2s linear infinite;
|
|
58
58
|
z-index: 9999;
|
|
59
59
|
}
|
|
60
|
-
`;var
|
|
60
|
+
`;var ba=`/**
|
|
61
61
|
* Do not edit directly, this file was auto-generated.
|
|
62
62
|
*/
|
|
63
63
|
|
|
@@ -165,7 +165,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
|
|
|
165
165
|
--primer-color-border-transparent-focus: var(--primer-color-focus);
|
|
166
166
|
--primer-color-border-transparent-loading: var(--primer-color-border-transparent-disabled);
|
|
167
167
|
}
|
|
168
|
-
`,
|
|
168
|
+
`,Ea=`/**
|
|
169
169
|
* Do not edit directly, this file was auto-generated.
|
|
170
170
|
*/
|
|
171
171
|
|
|
@@ -185,7 +185,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
|
|
|
185
185
|
--primer-color-blue-500: #3f93e4;
|
|
186
186
|
--primer-color-blue-900: #4aaeff;
|
|
187
187
|
}
|
|
188
|
-
`;var
|
|
188
|
+
`;var il="primer-light-theme-css",ol="primer-dark-theme-css";function Fi(){Xt(ba,il,!0)}function Bi(){Xt(Ea,ol,!0)}function Ca(){Fi(),Bi()}function xa(){Xt(ya,"primer-css-loader-styles",!1)}function Aa(){Ca()}function al(){Fi()}function nl(){Bi()}var _a=f`
|
|
189
189
|
:host {
|
|
190
190
|
display: inline-flex;
|
|
191
191
|
align-items: center;
|
|
@@ -230,12 +230,12 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
|
|
|
230
230
|
transform: rotate(360deg);
|
|
231
231
|
}
|
|
232
232
|
}
|
|
233
|
-
`;var
|
|
233
|
+
`;var Ki={small:16,medium:24,large:32},Pe=class extends v{constructor(){super(...arguments);this.color="var(--primer-color-loader)";this.size="medium";this.compact=!1}getSize(){if(this.size in Ki)return Ki[this.size];let t=parseInt(this.size,10);return isNaN(t)?Ki.medium:t}render(){let t=this.getSize(),r=20,o=`0 0 ${r} ${r}`;return this.style.setProperty("--spinner-color",this.color),this.style.setProperty("--spinner-size",`${t}px`),c`
|
|
234
234
|
<div class="spinner-container ${this.compact?"compact":""}">
|
|
235
235
|
<svg
|
|
236
236
|
class="spinner"
|
|
237
|
-
width="${
|
|
238
|
-
height="${
|
|
237
|
+
width="${t}"
|
|
238
|
+
height="${t}"
|
|
239
239
|
viewBox="${o}"
|
|
240
240
|
fill="none"
|
|
241
241
|
xmlns="http://www.w3.org/2000/svg"
|
|
@@ -249,7 +249,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
|
|
|
249
249
|
/>
|
|
250
250
|
</svg>
|
|
251
251
|
</div>
|
|
252
|
-
`}};
|
|
252
|
+
`}};Pe.styles=[_a],s([p({type:String})],Pe.prototype,"color",2),s([p({type:String})],Pe.prototype,"size",2),s([p({type:Boolean})],Pe.prototype,"compact",2),Pe=s([y("primer-spinner")],Pe);var Br={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},Jt=i=>(...e)=>({_$litDirective$:i,values:e}),Et=class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,r){this._$Ct=e,this._$AM=t,this._$Ci=r}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}};var Z=Jt(class extends Et{constructor(i){if(super(i),i.type!==Br.ATTRIBUTE||i.name!=="class"||i.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(i){return" "+Object.keys(i).filter(e=>i[e]).join(" ")+" "}update(i,[e]){if(this.st===void 0){this.st=new Set,i.strings!==void 0&&(this.nt=new Set(i.strings.join(" ").split(/\s/).filter(r=>r!=="")));for(let r in e)e[r]&&!this.nt?.has(r)&&this.st.add(r);return this.render(e)}let t=i.element.classList;for(let r of this.st)r in e||(t.remove(r),this.st.delete(r));for(let r in e){let o=!!e[r];o===this.st.has(r)||this.nt?.has(r)||(o?(t.add(r),this.st.add(r)):(t.remove(r),this.st.delete(r)))}return Se}});var Sa=f`
|
|
253
253
|
* {
|
|
254
254
|
box-sizing: border-box;
|
|
255
255
|
}
|
|
@@ -314,15 +314,15 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
|
|
|
314
314
|
border-color: var(--primer-color-border-outlined-disabled);
|
|
315
315
|
cursor: not-allowed;
|
|
316
316
|
}
|
|
317
|
-
`;var
|
|
317
|
+
`;var Te=class extends v{constructor(){super(...arguments);this.focusWithin=!1;this.hasError=!1}handleWrapperClick(t){if(t.target!==t.currentTarget)return;let r=this.findSlottedPrimerInput();r?r.focus():this.dispatchEvent(new CustomEvent("wrapper-click",{bubbles:!0,composed:!0}))}findSlottedPrimerInput(){if(!this.inputSlot)return null;let t=this.inputSlot.assignedElements({flatten:!0}),r=t.find(o=>o.tagName.toLowerCase()==="primer-input");if(r)return r;for(let o of t){let n=o.querySelector("primer-input");if(n)return n}return null}render(){let t={"input-slot":!0,"focus-within":this.focusWithin};return c`
|
|
318
318
|
<div class="input-wrapper">
|
|
319
319
|
<slot name="label"></slot>
|
|
320
|
-
<div class="${
|
|
320
|
+
<div class="${Z(t)}" @click="${this.handleWrapperClick}">
|
|
321
321
|
<slot name="input"></slot>
|
|
322
322
|
</div>
|
|
323
323
|
<slot name="error"></slot>
|
|
324
324
|
</div>
|
|
325
|
-
`}};
|
|
325
|
+
`}};Te.styles=[Sa],s([p({type:Boolean})],Te.prototype,"focusWithin",2),s([p({type:Boolean,reflect:!0,attribute:"has-error"})],Te.prototype,"hasError",2),s([Ve('slot[name="input"]')],Te.prototype,"inputSlot",2),Te=s([y("primer-input-wrapper")],Te);var Ma=f`
|
|
326
326
|
:host {
|
|
327
327
|
display: inline-block;
|
|
328
328
|
font-weight: var(--primer-typography-body-small-weight);
|
|
@@ -336,7 +336,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
|
|
|
336
336
|
:host([disabled]) {
|
|
337
337
|
color: var(--primer-color-text-disabled);
|
|
338
338
|
}
|
|
339
|
-
`;var
|
|
339
|
+
`;var He=class extends v{constructor(){super(...arguments);this.for="";this.disabled=!1}render(){return c`<label for=${this.for}><slot></slot></label>`}};He.styles=[Ma],s([p({type:String,reflect:!0})],He.prototype,"for",2),s([p({type:Boolean,reflect:!0})],He.prototype,"disabled",2),He=s([y("primer-input-label")],He);var Pa=f`
|
|
340
340
|
:host {
|
|
341
341
|
display: contents;
|
|
342
342
|
}
|
|
@@ -503,19 +503,19 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
|
|
|
503
503
|
:host([variant='tertiary'][loading]) primer-spinner {
|
|
504
504
|
transform: scale(0.85);
|
|
505
505
|
}
|
|
506
|
-
`;var
|
|
506
|
+
`;var de=class extends v{constructor(){super(...arguments);this.variant="primary";this.disabled=!1;this.loading=!1;this.buttonType="button";this.selectionState="default";this.selectable=!1}handleClick(){!this.selectable||this.disabled||this.loading||(this.selectionState=this.selectionState==="default"?"checked":"default",this.dispatchEvent(new CustomEvent("selection-change",{bubbles:!0,composed:!0,detail:{state:this.selectionState}})))}renderCheckmark(){return!this.selectable||this.selectionState!=="checked"||this.loading?h:c`
|
|
507
507
|
<primer-icon
|
|
508
508
|
name="checkmark"
|
|
509
509
|
size="sm"
|
|
510
510
|
color="var(--primer-color-icon-primary)"
|
|
511
511
|
></primer-icon>
|
|
512
|
-
`}renderSpinner(){if(!this.loading)return
|
|
512
|
+
`}renderSpinner(){if(!this.loading)return h;let t;return this.variant==="primary"?t="var(--primer-color-background-outlined-default)":(this.variant==="secondary"||this.variant==="tertiary")&&(t="var(--primer-color-gray-900)"),c`
|
|
513
513
|
<primer-spinner
|
|
514
514
|
size="small"
|
|
515
|
-
color="${
|
|
515
|
+
color="${t}"
|
|
516
516
|
compact
|
|
517
517
|
></primer-spinner>
|
|
518
|
-
`}render(){return
|
|
518
|
+
`}render(){return c`
|
|
519
519
|
<button
|
|
520
520
|
type=${this.buttonType}
|
|
521
521
|
?disabled=${this.disabled||this.loading}
|
|
@@ -530,7 +530,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
|
|
|
530
530
|
</span>
|
|
531
531
|
${this.renderCheckmark()}
|
|
532
532
|
</button>
|
|
533
|
-
`}};
|
|
533
|
+
`}};de.styles=[w,Pa],s([p({type:String,reflect:!0})],de.prototype,"variant",2),s([p({type:Boolean,reflect:!0})],de.prototype,"disabled",2),s([p({type:Boolean,reflect:!0})],de.prototype,"loading",2),s([p({type:String,attribute:"type"})],de.prototype,"buttonType",2),s([p({type:String,reflect:!0})],de.prototype,"selectionState",2),s([p({type:Boolean,reflect:!0})],de.prototype,"selectable",2),de=s([y("primer-button")],de);var Ta=f`
|
|
534
534
|
:host {
|
|
535
535
|
display: contents;
|
|
536
536
|
}
|
|
@@ -546,7 +546,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
|
|
|
546
546
|
display: block;
|
|
547
547
|
font-family: var(--primer-typography-body-small-font);
|
|
548
548
|
}
|
|
549
|
-
`;var
|
|
549
|
+
`;var Ue=class extends v{constructor(){super(...arguments);this.for="";this.active=!0}render(){return c`
|
|
550
550
|
<span
|
|
551
551
|
class="error"
|
|
552
552
|
role="alert"
|
|
@@ -555,17 +555,17 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
|
|
|
555
555
|
>
|
|
556
556
|
<slot></slot>
|
|
557
557
|
</span>
|
|
558
|
-
`}}
|
|
558
|
+
`}};Ue.styles=[Ta],s([p({type:String,reflect:!0})],Ue.prototype,"for",2),s([p({type:Boolean,reflect:!0})],Ue.prototype,"active",2),Ue=s([y("primer-input-error")],Ue);var wa={pencil:Me`
|
|
559
559
|
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
560
560
|
<path d="M12.3292 1.82659C12.142 1.63935 11.8779 1.53418 11.6028 1.53418C11.3277 1.53418 11.0636 1.63935 10.8764 1.82659L2.92969 9.77325V13.0666H6.22306L14.1698 5.11992C14.357 4.93268 14.4622 4.66859 14.4622 4.39352C14.4622 4.11844 14.357 3.85435 14.1698 3.66711L12.3292 1.82659ZM5.77375 11.7333H4.26302V10.2225L10.8764 3.60919L12.3871 5.11992L5.77375 11.7333Z" fill="currentColor"/>
|
|
561
561
|
</svg>
|
|
562
|
-
`,trash:
|
|
562
|
+
`,trash:Me`
|
|
563
563
|
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
564
564
|
<path d="M13.8333 2.99992H11.5V2.49992C11.5 2.05789 11.3244 1.63397 11.0118 1.32141C10.6993 1.00885 10.2754 0.833252 9.83333 0.833252H6.16667C5.72464 0.833252 5.30072 1.00885 4.98816 1.32141C4.67559 1.63397 4.5 2.05789 4.5 2.49992V2.99992H2.16667C1.98986 2.99992 1.82029 3.07015 1.69526 3.19518C1.57024 3.32021 1.5 3.48978 1.5 3.66659C1.5 3.8434 1.57024 4.01297 1.69526 4.138C1.82029 4.26302 1.98986 4.33326 2.16667 4.33326H2.83333V12.4999C2.83333 12.942 3.00893 13.3659 3.32149 13.6784C3.63405 13.991 4.05797 14.1666 4.5 14.1666H11.5C11.942 14.1666 12.3659 13.991 12.6785 13.6784C12.9911 13.3659 13.1667 12.942 13.1667 12.4999V4.33326H13.8333C14.0101 4.33326 14.1797 4.26302 14.3047 4.138C14.4298 4.01297 14.5 3.8434 14.5 3.66659C14.5 3.48978 14.4298 3.32021 14.3047 3.19518C14.1797 3.07015 14.0101 2.99992 13.8333 2.99992ZM5.83333 2.49992C5.83333 2.32311 5.90357 2.15354 6.0286 2.02851C6.15362 1.90349 6.32319 1.83325 6.5 1.83325H9.5C9.67681 1.83325 9.84638 1.90349 9.9714 2.02851C10.0964 2.15354 10.1667 2.32311 10.1667 2.49992V2.99992H5.83333V2.49992ZM11.8333 12.4999C11.8333 12.6767 11.7631 12.8463 11.6381 12.9713C11.513 13.0964 11.3435 13.1666 11.1667 13.1666H4.83333C4.65652 13.1666 4.48695 13.0964 4.36193 12.9713C4.2369 12.8463 4.16667 12.6767 4.16667 12.4999V4.33326H11.8333V12.4999Z" fill="currentColor"/>
|
|
565
565
|
<path d="M6.5 10.9999C6.67681 10.9999 6.84638 10.9297 6.9714 10.8047C7.09643 10.6796 7.16667 10.5101 7.16667 10.3333V7.33325C7.16667 7.15644 7.09643 6.98687 6.9714 6.86184C6.84638 6.73682 6.67681 6.66658 6.5 6.66658C6.32319 6.66658 6.15362 6.73682 6.0286 6.86184C5.90357 6.98687 5.83333 7.15644 5.83333 7.33325V10.3333C5.83333 10.5101 5.90357 10.6796 6.0286 10.8047C6.15362 10.9297 6.32319 10.9999 6.5 10.9999Z" fill="currentColor"/>
|
|
566
566
|
<path d="M9.5 10.9999C9.67681 10.9999 9.84638 10.9297 9.9714 10.8047C10.0964 10.6796 10.1667 10.5101 10.1667 10.3333V7.33325C10.1667 7.15644 10.0964 6.98687 9.9714 6.86184C9.84638 6.73682 9.67681 6.66658 9.5 6.66658C9.32319 6.66658 9.15362 6.73682 9.0286 6.86184C8.90357 6.98687 8.83333 7.15644 8.83333 7.33325V10.3333C8.83333 10.5101 8.90357 10.6796 9.0286 10.8047C9.15362 10.9297 9.32319 10.9999 9.5 10.9999Z" fill="currentColor"/>
|
|
567
567
|
</svg>
|
|
568
|
-
`,"successful-check":
|
|
568
|
+
`,"successful-check":Me`
|
|
569
569
|
<svg
|
|
570
570
|
viewBox="0 0 56 56"
|
|
571
571
|
fill="none"
|
|
@@ -580,7 +580,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
|
|
|
580
580
|
/>
|
|
581
581
|
</g>
|
|
582
582
|
</svg>
|
|
583
|
-
`,"failure-icon":
|
|
583
|
+
`,"failure-icon":Me`
|
|
584
584
|
<svg
|
|
585
585
|
viewBox="0 0 40 40"
|
|
586
586
|
fill="none"
|
|
@@ -592,27 +592,27 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
|
|
|
592
592
|
d="M20.0008 23.3333C20.4614 23.3333 20.7873 22.9606 20.7873 22.5V15C20.7873 14.5394 20.4146 14.1666 20.0008 14.1666C19.587 14.1666 19.1675 14.5416 19.1675 15V22.5C19.1675 22.9583 19.5425 23.3333 20.0008 23.3333ZM32.9331 27.3594L22.5269 9.75935C22.0008 8.86821 21.0529 8.33488 20.0008 8.33331C18.9487 8.33331 18.006 8.8656 17.4748 9.75831L7.06331 27.3625C6.53987 28.2463 6.53206 29.3073 7.04134 30.201C7.568 31.1198 8.51904 31.6666 9.58935 31.6666H30.4175C31.4857 31.6666 32.4357 31.1182 32.9597 30.1995C33.4696 29.3073 33.4591 28.2448 32.9331 27.3594ZM18.7977 26.6666C18.7977 25.976 19.3107 25.4166 20.0008 25.4166C20.6935 25.4166 21.2508 25.9739 21.2039 26.6666C21.2039 27.3568 20.6909 27.9166 20.0008 27.9166C19.3576 27.9166 18.7977 27.3568 18.7977 26.6666Z"
|
|
593
593
|
/>
|
|
594
594
|
</svg>
|
|
595
|
-
`,"payment-card":
|
|
595
|
+
`,"payment-card":Me`
|
|
596
596
|
<svg width="28" height="21" viewBox="0 0 28 21" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
597
597
|
<rect y="0.748047" width="28" height="20" rx="2" fill="#E0E0E0"/>
|
|
598
598
|
<rect y="6.74805" width="28" height="4" fill="#212121"/>
|
|
599
599
|
<rect x="19" y="13.748" width="6" height="4" rx="0.933333" fill="white"/>
|
|
600
600
|
</svg>
|
|
601
|
-
`,"chevron-down":
|
|
601
|
+
`,"chevron-down":Me`
|
|
602
602
|
<svg width="8" height="6" viewBox="0 0 8 6" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
603
603
|
<path d="M4.41978 4.90118C4.32079 5.02361 4.16188 5.08353 4.00037 5.08353C3.83887 5.08353 3.67996 5.02361 3.55753 4.90118L0.63995 1.9836C0.395733 1.73939 0.395733 1.34382 0.63995 1.09947C0.884167 0.855124 1.27973 0.855254 1.52408 1.09947L4.00037 3.57524L6.47589 1.09973C6.72011 0.855515 7.11567 0.855515 7.36002 1.09973C7.60437 1.34395 7.60424 1.73952 7.36002 1.98386L4.41978 4.90118Z" fill="#212121"/>
|
|
604
|
-
</svg>`,checkmark:
|
|
604
|
+
</svg>`,checkmark:Me`
|
|
605
605
|
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
606
606
|
<path d="M15.6326 6.12193C15.8983 6.3668 15.8983 6.76276 15.6326 6.98418L8.75546 13.8613C8.53404 14.127 8.13808 14.127 7.89321 13.8613L4.35119 10.3186C4.10706 10.0971 4.10706 9.70118 4.35119 9.45631C4.59531 9.21404 4.99126 9.21404 5.23535 9.45631L8.33606 12.5588L14.7704 6.12193C15.0152 5.87863 15.4112 5.87863 15.6326 6.12193Z" fill="#212121"/>
|
|
607
607
|
</svg>
|
|
608
|
-
`,close:
|
|
608
|
+
`,close:Me`
|
|
609
609
|
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" fill="none">
|
|
610
610
|
<path
|
|
611
611
|
d="M14.7551 13.734C15.0479 14.0269 15.0479 14.502 14.7551 14.7949C14.4622 15.0879 13.987 15.0878 13.6941 14.7949L10.0005 11.0738L6.28054 14.7937C5.98767 15.0866 5.51249 15.0866 5.21959 14.7937C4.92668 14.5008 4.92671 14.0256 5.21959 13.7327L8.94075 10.0141L5.21856 6.26604C4.92568 5.97316 4.92568 5.49798 5.21856 5.20508C5.51143 4.91217 5.98661 4.91221 6.27951 5.20508L10.0005 8.95438L13.7204 5.23446C14.0132 4.94159 14.4884 4.94159 14.7813 5.23446C15.0742 5.52734 15.0742 6.00252 14.7813 6.29542L11.0602 10.0141L14.7551 13.734Z"
|
|
612
612
|
fill="#212121"
|
|
613
613
|
/>
|
|
614
614
|
</svg>
|
|
615
|
-
`};var
|
|
615
|
+
`};var ka=f`
|
|
616
616
|
:host {
|
|
617
617
|
display: inline-block;
|
|
618
618
|
line-height: 0; /* so you don’t get extra space around the icon */
|
|
@@ -654,11 +654,11 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
|
|
|
654
654
|
/* --internal used for abstracting away the icon component */
|
|
655
655
|
fill: var(--internal-icon-color, currentColor);
|
|
656
656
|
}
|
|
657
|
-
`;var
|
|
657
|
+
`;var we=class extends v{constructor(){super(...arguments);this.color="var(--primer-color-icon-primary)";this.size="lg"}render(){let t=this.name?wa[this.name]:null;return c`
|
|
658
658
|
<div style="--internal-icon-color: ${this.color}">
|
|
659
|
-
${
|
|
659
|
+
${t||c`<slot></slot>`}
|
|
660
660
|
</div>
|
|
661
|
-
`}};
|
|
661
|
+
`}};we.styles=[ka],s([p({type:String,reflect:!0})],we.prototype,"color",2),s([p({type:String,reflect:!0})],we.prototype,"size",2),s([p({reflect:!0})],we.prototype,"name",2),we=s([y("primer-icon")],we);var Ia=f`
|
|
662
662
|
:host {
|
|
663
663
|
display: flex;
|
|
664
664
|
flex-direction: column;
|
|
@@ -687,7 +687,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
|
|
|
687
687
|
line-height: var(--primer-typography-body-medium-line-height);
|
|
688
688
|
letter-spacing: var(--primer-typography-body-medium-letter-spacing);
|
|
689
689
|
}
|
|
690
|
-
`;var
|
|
690
|
+
`;var Ye=class extends v{constructor(){super(...arguments);this.type="complete"}render(){return this.type==="complete"?c`
|
|
691
691
|
<!-- Successful view -->
|
|
692
692
|
<primer-icon
|
|
693
693
|
size="lg"
|
|
@@ -699,7 +699,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
|
|
|
699
699
|
<p class="secondary">
|
|
700
700
|
You'll be redirected to the order confirmation page soon.
|
|
701
701
|
</p>
|
|
702
|
-
`:
|
|
702
|
+
`:c`
|
|
703
703
|
<primer-icon
|
|
704
704
|
size="lg"
|
|
705
705
|
name="failure-icon"
|
|
@@ -707,8 +707,8 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
|
|
|
707
707
|
>
|
|
708
708
|
</primer-icon>
|
|
709
709
|
<p>Payment failed</p>
|
|
710
|
-
${this.description?
|
|
711
|
-
`}};
|
|
710
|
+
${this.description?c`<p class="secondary">${this.description}</p>`:c`<p class="secondary">Something went wrong.</p>`}
|
|
711
|
+
`}};Ye.styles=[Ia],s([p({type:String,reflect:!0})],Ye.prototype,"type",2),s([p({type:String,reflect:!0})],Ye.prototype,"description",2),Ye=s([y("primer-checkout-state")],Ye);var Na=f`
|
|
712
712
|
:host {
|
|
713
713
|
display: contents;
|
|
714
714
|
}
|
|
@@ -739,7 +739,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
|
|
|
739
739
|
:host([disabled]) input::placeholder {
|
|
740
740
|
color: var(--primer-color-text-disabled);
|
|
741
741
|
}
|
|
742
|
-
`;var
|
|
742
|
+
`;var sl=["text","password","email","number","tel","url","search","date","time","datetime-local","month","week","color"];function ll(i){return sl.includes(i)}var F=class extends v{constructor(){super(...arguments);this.value="";this.placeholder="";this.disabled=!1;this.name="";this.type="text";this.required=!1;this.readonly=!1;this.pattern="";this.min="";this.max="";this.step="";this.autocomplete="";this.id="";this.hasFocus=!1;this.hasError=!1}handleInput(t){t.stopPropagation();let r=t.target;this.value=r.value;let o=new CustomEvent("input",{detail:this.value,bubbles:!0,composed:!0});this.dispatchEvent(o)}handleChange(t){t.stopPropagation();let r=t.target;this.value=r.value;let o=new CustomEvent("change",{detail:this.value,bubbles:!0,composed:!0});this.dispatchEvent(o)}handleFocus(){this.hasFocus=!0,this.dispatchEvent(new FocusEvent("focus",{bubbles:!0,composed:!0}))}handleBlur(){this.hasFocus=!1,this.dispatchEvent(new FocusEvent("blur",{bubbles:!0,composed:!0}))}handleInvalid(t){t.stopPropagation(),this.hasError=!0,this.dispatchEvent(new Event("invalid",{bubbles:!0,composed:!0}))}focus(t){this.inputElement?.focus(t)}blur(){this.inputElement?.blur()}select(){this.inputElement?.select()}setSelectionRange(t,r,o){this.inputElement?.setSelectionRange(t,r,o)}get validity(){return this.inputElement?.validity||{}}get validationMessage(){return this.inputElement?.validationMessage||""}checkValidity(){return this.inputElement?.checkValidity()||!1}reportValidity(){return this.inputElement?.reportValidity()||!1}render(){let t={input:!0,"input--focused":this.hasFocus,"input--disabled":this.disabled,"input--error":this.hasError,"input--readonly":this.readonly},r=Object.entries(t).filter(([,o])=>o).map(([o])=>o).join(" ");return c`
|
|
743
743
|
<input
|
|
744
744
|
part="input"
|
|
745
745
|
class=${r}
|
|
@@ -764,7 +764,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
|
|
|
764
764
|
@blur=${this.handleBlur}
|
|
765
765
|
@invalid=${this.handleInvalid}
|
|
766
766
|
/>
|
|
767
|
-
`}addEventListener(
|
|
767
|
+
`}addEventListener(t,r,o){super.addEventListener(t,r,o)}removeEventListener(t,r,o){super.removeEventListener(t,r,o)}};F.styles=[Na],s([Ve("input")],F.prototype,"inputElement",2),s([p({type:String,reflect:!0})],F.prototype,"value",2),s([p({type:String,reflect:!0})],F.prototype,"placeholder",2),s([p({type:Boolean,reflect:!0})],F.prototype,"disabled",2),s([p({type:String,reflect:!0})],F.prototype,"name",2),s([p({type:String,reflect:!0,converter:{fromAttribute:t=>!t||!ll(t)?(t&&t!=="text"&&R.warn(`Invalid input type: ${t}. Defaulting to 'text'.`),"text"):t}})],F.prototype,"type",2),s([p({type:Boolean,reflect:!0})],F.prototype,"required",2),s([p({type:Boolean,reflect:!0})],F.prototype,"readonly",2),s([p({type:String,reflect:!0})],F.prototype,"pattern",2),s([p({type:Number,reflect:!0})],F.prototype,"minlength",2),s([p({type:Number,reflect:!0})],F.prototype,"maxlength",2),s([p({type:String,reflect:!0})],F.prototype,"min",2),s([p({type:String,reflect:!0})],F.prototype,"max",2),s([p({type:String,reflect:!0})],F.prototype,"step",2),s([p({type:String,reflect:!0})],F.prototype,"autocomplete",2),s([p({type:String,reflect:!0})],F.prototype,"id",2),s([I()],F.prototype,"hasFocus",2),s([I()],F.prototype,"hasError",2),F=s([y("primer-input")],F);var La=f`
|
|
768
768
|
:host {
|
|
769
769
|
display: block;
|
|
770
770
|
}
|
|
@@ -818,7 +818,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
|
|
|
818
818
|
transition: none;
|
|
819
819
|
}
|
|
820
820
|
}
|
|
821
|
-
`;var
|
|
821
|
+
`;var ae=class extends v{constructor(){super(...arguments);this.header="";this.expanded=!1;this.expandText="Expand";this.collapseText="Collapse";this.ariaLabel="";this.buttonVariant="primary";this.isExpanded=!1}connectedCallback(){super.connectedCallback(),this.isExpanded=this.expanded}dispatchExpandedChangedEvent(t){this.dispatchEvent(new CustomEvent("expanded-changed",{bubbles:!0,composed:!0,detail:{expanded:t}}))}toggleExpanded(){this.isExpanded=!this.isExpanded,this.dispatchExpandedChangedEvent(this.isExpanded)}expand(){this.isExpanded||(this.isExpanded=!0,this.dispatchExpandedChangedEvent(!0))}collapse(){this.isExpanded&&(this.isExpanded=!1,this.dispatchExpandedChangedEvent(!1))}render(){let t=this.isExpanded?this.collapseText:this.expandText,r=this.ariaLabel||this.header||t,o=this.header||t;return c`
|
|
822
822
|
<div class="collapsable">
|
|
823
823
|
<primer-button
|
|
824
824
|
variant=${this.buttonVariant}
|
|
@@ -842,7 +842,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
|
|
|
842
842
|
</div>
|
|
843
843
|
</div>
|
|
844
844
|
</div>
|
|
845
|
-
`}};
|
|
845
|
+
`}};ae.styles=[La],s([p({type:String})],ae.prototype,"header",2),s([p({type:Boolean})],ae.prototype,"expanded",2),s([p({type:String})],ae.prototype,"expandText",2),s([p({type:String})],ae.prototype,"collapseText",2),s([p({type:String})],ae.prototype,"ariaLabel",2),s([p({type:String})],ae.prototype,"buttonVariant",2),s([I()],ae.prototype,"isExpanded",2),ae=s([y("primer-collapsable")],ae);var $a=f`
|
|
846
846
|
:host {
|
|
847
847
|
display: block;
|
|
848
848
|
width: 100%;
|
|
@@ -902,10 +902,10 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
|
|
|
902
902
|
transform: none;
|
|
903
903
|
}
|
|
904
904
|
}
|
|
905
|
-
`;var
|
|
905
|
+
`;var ye=class extends v{constructor(){super(...arguments);this.message="";this.visible=!1;this.role="alert";this.showMessage=!1}updated(t){t.has("visible")&&this.handleVisibilityChange()}handleVisibilityChange(){this.visible?(this.showMessage=!0,this.setAttribute("aria-hidden","false")):setTimeout(()=>{this.showMessage=!1,this.setAttribute("aria-hidden","true")},200)}render(){if(!this.showMessage&&!this.visible)return h;let t={"error-message":!0,hidden:!this.visible};return c`
|
|
906
906
|
<div
|
|
907
907
|
part="error-message"
|
|
908
|
-
class=${
|
|
908
|
+
class=${Z(t)}
|
|
909
909
|
aria-live="assertive"
|
|
910
910
|
aria-atomic="true"
|
|
911
911
|
>
|
|
@@ -918,11 +918,11 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
|
|
|
918
918
|
</div>
|
|
919
919
|
<div part="error-content" class="error-content">${this.message}</div>
|
|
920
920
|
</div>
|
|
921
|
-
`}};
|
|
921
|
+
`}};ye.styles=[$a],s([p({type:String})],ye.prototype,"message",2),s([p({type:Boolean,reflect:!0})],ye.prototype,"visible",2),s([p({type:String,reflect:!0})],ye.prototype,"role",2),s([I()],ye.prototype,"showMessage",2),ye=s([y("primer-error-message")],ye);var Ra=f`
|
|
922
922
|
:host {
|
|
923
923
|
display: none;
|
|
924
924
|
}
|
|
925
|
-
`;var
|
|
925
|
+
`;var ot=class extends v{constructor(){super(...arguments);this.id="d"+Math.random().toString(36).substring(7)}getContainer(){let t=document.querySelector(`#${this.id}`);return t||(t=document.createElement("div"),t.id=this.id,document.body.appendChild(t),this._setupEventListeners(t)),t}_setupEventListeners(t){["primer-ach-error","primer-ach-bank-details-collected","primer-ach-mandate-confirmed","primer-ach-mandate-declined"].forEach(r=>{t.addEventListener(r,o=>{o.stopPropagation(),this.dispatchEvent(new CustomEvent(r,{bubbles:!0,composed:!0,detail:o.detail}))})})}disconnectedCallback(){super.disconnectedCallback(),this.getContainer().remove()}_handleSlotChange(t){let o=t.target.assignedNodes();if(!o.length)return;let n=this.getContainer();o.forEach(l=>n.appendChild(l))}render(){return c`<slot @slotchange=${this._handleSlotChange}></slot>`}};ot.styles=[Ra],s([I()],ot.prototype,"id",2),ot=s([y("primer-portal")],ot);var Oa=f`
|
|
926
926
|
:host {
|
|
927
927
|
display: contents;
|
|
928
928
|
}
|
|
@@ -951,10 +951,10 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
|
|
|
951
951
|
display: flex;
|
|
952
952
|
justify-content: flex-end;
|
|
953
953
|
}
|
|
954
|
-
`;var
|
|
954
|
+
`;var Ct=class extends v{_handleCloseClick(){this.dispatchEvent(new CustomEvent("primer-dialog-close",{bubbles:!0,composed:!0}))}render(){return c`
|
|
955
955
|
<div
|
|
956
|
-
class=${
|
|
957
|
-
@click=${
|
|
956
|
+
class=${Z({backdrop:!0})}
|
|
957
|
+
@click=${e=>{e.preventDefault()}}
|
|
958
958
|
>
|
|
959
959
|
<div class="dialog">
|
|
960
960
|
<div class="header">
|
|
@@ -967,7 +967,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
|
|
|
967
967
|
</div>
|
|
968
968
|
</div>
|
|
969
969
|
</div>
|
|
970
|
-
`}};
|
|
970
|
+
`}};Ct.styles=[Oa],Ct=s([y("primer-dialog")],Ct);var Da=f`
|
|
971
971
|
:host {
|
|
972
972
|
display: contents;
|
|
973
973
|
}
|
|
@@ -1159,38 +1159,38 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
|
|
|
1159
1159
|
background-color: var(--primer-color-background-outlined-default);
|
|
1160
1160
|
border-radius: var(--primer-radius-small);
|
|
1161
1161
|
}
|
|
1162
|
-
`;var
|
|
1162
|
+
`;var ee=class extends v{constructor(){super(...arguments);this.paymentManagers=new Map;this.sdkState=null;this.headlessUtils=null;this.klarnaCategories=null;this.selectedCategory=null;this.isExpanded=!1;this.headerAriaLabel=A("pay_with",{id:"pay_with"});this._paymentMethodManagerTask=new D(this,{task:async([t,r])=>{if(!t||!r)return L;let o=await r.getCDNAssets("KLARNA");return{manager:t.manager,klarnaIcon:o?.assets?.icon?`${o.goatCdnUrl}/${o.assets.icon}`:""}},args:()=>[this.paymentManagers.get("KLARNA"),this.headlessUtils]})}toggleExpand(){this.isExpanded=!this.isExpanded,this.isExpanded||(this.selectedCategory=null)}async startKlarnaPayment(){if(!(!this._paymentMethodManagerTask.value||!this.selectedCategory))try{await this._paymentMethodManagerTask.value.manager.start({paymentMethodCategoryId:this.selectedCategory})}catch(t){R.error("Failed to start Klarna payment",t)}}async renderSelectedCategory(){if(!(!this._paymentMethodManagerTask.value||!this.selectedCategory||!this.klarnaContainer))try{this.klarnaContainer.innerHTML="",await this._paymentMethodManagerTask.value.manager.renderCategory({containerId:this.klarnaContainer,paymentMethodCategoryId:this.selectedCategory,onHeightChange:t=>{t>0&&(this.klarnaContainer.style.height=`${t}px`)}})}catch(t){R.error("Failed to render Klarna category",t)}}selectCategory(t){this.selectedCategory=t,this.renderSelectedCategory()}updated(t){t.has("selectedCategory")&&this.selectedCategory&&this.renderSelectedCategory()}renderCategorySelection(){let t=this.klarnaCategories?.categories||[];return this.klarnaCategories?.isLoading||!1?c`<div class="loading">
|
|
1163
1163
|
<primer-spinner size="small"></primer-spinner>
|
|
1164
|
-
</div>`:
|
|
1164
|
+
</div>`:c`
|
|
1165
1165
|
<div class="category-selection">
|
|
1166
|
-
${
|
|
1166
|
+
${t.map(o=>c`
|
|
1167
1167
|
<button
|
|
1168
|
-
class=${
|
|
1168
|
+
class=${Z({"category-button":!0,selected:o.id===this.selectedCategory})}
|
|
1169
1169
|
@click=${()=>{this.selectCategory(o.id)}}
|
|
1170
1170
|
>
|
|
1171
1171
|
${o.name}
|
|
1172
1172
|
</button>
|
|
1173
1173
|
`)}
|
|
1174
1174
|
</div>
|
|
1175
|
-
`}renderExpandedContent(){return
|
|
1175
|
+
`}renderExpandedContent(){return c`
|
|
1176
1176
|
${this.renderCategorySelection()}
|
|
1177
|
-
${this.selectedCategory?
|
|
1177
|
+
${this.selectedCategory?c`
|
|
1178
1178
|
<div
|
|
1179
1179
|
id="klarna-category-container"
|
|
1180
1180
|
class="klarna-category-container"
|
|
1181
1181
|
></div>
|
|
1182
|
-
`:
|
|
1182
|
+
`:h}
|
|
1183
1183
|
|
|
1184
1184
|
<button
|
|
1185
|
-
class=${
|
|
1185
|
+
class=${Z({"klarna-pay-button":!0,loading:!!this.sdkState?.isProcessing,disabled:!this.selectedCategory})}
|
|
1186
1186
|
?disabled=${!this.selectedCategory||this.sdkState?.isProcessing}
|
|
1187
1187
|
@click=${()=>this.startKlarnaPayment()}
|
|
1188
1188
|
>
|
|
1189
|
-
${
|
|
1189
|
+
${A("confirm",{id:"confirm"})}
|
|
1190
1190
|
</button>
|
|
1191
|
-
`}render(){return this._paymentMethodManagerTask.render({error:
|
|
1191
|
+
`}render(){return this._paymentMethodManagerTask.render({error:t=>{let r=t instanceof Error?t.message:"Unknown error in Klarna";return c`<div class="error">
|
|
1192
1192
|
Error loading Klarna: ${r}
|
|
1193
|
-
</div>`},complete:({manager:
|
|
1193
|
+
</div>`},complete:({manager:t,klarnaIcon:r})=>t?c`
|
|
1194
1194
|
<div class="klarna-container ${this.isExpanded?"expanded":""}">
|
|
1195
1195
|
<div class="klarna-button-header">
|
|
1196
1196
|
<primer-button
|
|
@@ -1203,7 +1203,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
|
|
|
1203
1203
|
aria-label=${this.headerAriaLabel}
|
|
1204
1204
|
>
|
|
1205
1205
|
<img src=${r} alt="Klarna logo" />
|
|
1206
|
-
<span>${
|
|
1206
|
+
<span>${A("pay_with",{id:"pay_with"})} Klarna</span>
|
|
1207
1207
|
<span
|
|
1208
1208
|
class="klarna-accordion-icon ${this.isExpanded?"expanded":""}"
|
|
1209
1209
|
>
|
|
@@ -1220,19 +1220,19 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
|
|
|
1220
1220
|
</div>
|
|
1221
1221
|
</div>
|
|
1222
1222
|
</div>
|
|
1223
|
-
`:
|
|
1223
|
+
`:h})}};ee.styles=[w,Da],s([b({context:J,subscribe:!0}),p()],ee.prototype,"paymentManagers",2),s([b({context:j,subscribe:!0}),p()],ee.prototype,"sdkState",2),s([b({context:W,subscribe:!0}),p({type:Object})],ee.prototype,"headlessUtils",2),s([b({context:br,subscribe:!0}),p()],ee.prototype,"klarnaCategories",2),s([I()],ee.prototype,"selectedCategory",2),s([I()],ee.prototype,"isExpanded",2),s([I()],ee.prototype,"headerAriaLabel",2),s([Ve("#klarna-category-container")],ee.prototype,"klarnaContainer",2),ee=s([y("primer-klarna"),$()],ee);var Va=f`
|
|
1224
1224
|
:host {
|
|
1225
1225
|
display: contents;
|
|
1226
1226
|
}
|
|
1227
|
-
`;var
|
|
1228
|
-
.paymentMethod=${
|
|
1229
|
-
></primer-native-payment>`;case"REDIRECT":return
|
|
1230
|
-
.paymentMethod=${
|
|
1231
|
-
></primer-redirect-payment>`;case"KLARNA":return
|
|
1227
|
+
`;var ze=class extends v{constructor(){super(...arguments);this.type=void 0;this.paymentMethods=null}render(){if(!this.type)return h;let t=this.paymentMethods?.get(this.type);if(!t)return h;switch(t?.managerType){case"CARD":return c`<primer-card-form></primer-card-form>`;case"NATIVE":return c`<primer-native-payment
|
|
1228
|
+
.paymentMethod=${t}
|
|
1229
|
+
></primer-native-payment>`;case"REDIRECT":return c`<primer-redirect-payment
|
|
1230
|
+
.paymentMethod=${t}
|
|
1231
|
+
></primer-redirect-payment>`;case"KLARNA":return c`<primer-klarna></primer-klarna>`;case"ACH":return c`
|
|
1232
1232
|
<primer-dynamic-payment
|
|
1233
|
-
.paymentMethod=${
|
|
1233
|
+
.paymentMethod=${t}
|
|
1234
1234
|
></primer-dynamic-payment>
|
|
1235
|
-
`;default:return
|
|
1235
|
+
`;default:return h}}};ze.styles=[Va],s([p({type:String})],ze.prototype,"type",2),s([b({context:vt,subscribe:!0}),p()],ze.prototype,"paymentMethods",2),ze=s([y("primer-payment-method")],ze);var Ha=f`
|
|
1236
1236
|
:host {
|
|
1237
1237
|
display: flex;
|
|
1238
1238
|
flex-direction: column;
|
|
@@ -1317,12 +1317,12 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
|
|
|
1317
1317
|
flex-direction: column;
|
|
1318
1318
|
}
|
|
1319
1319
|
}
|
|
1320
|
-
`;function
|
|
1320
|
+
`;function Ua(){return{firstName:{value:"",error:"",pristine:!0,touched:!1,dirty:!1,valid:!1},lastName:{value:"",error:"",pristine:!0,touched:!1,dirty:!1,valid:!1},emailAddress:{value:"",error:"",pristine:!0,touched:!1,dirty:!1,valid:!1}}}var Kr=class{constructor(e,t){this.formState=Ua();this.host=e,this.validate=t,e.addController(this)}get hasError(){return{firstName:this.formState.firstName.dirty&&this.formState.firstName.touched&&!!this.formState.firstName.error,lastName:this.formState.lastName.dirty&&this.formState.lastName.touched&&!!this.formState.lastName.error,emailAddress:this.formState.emailAddress.dirty&&this.formState.emailAddress.touched&&!!this.formState.emailAddress.error}}get formData(){return{firstName:this.formState.firstName.value,lastName:this.formState.lastName.value,emailAddress:this.formState.emailAddress.value}}async setFieldValue(e,t){let r=this.formState[e];r.value=t,r.dirty=!0,r.error="",r.valid=!0;let o=await this.validate(this.formData);this.setValidation(o)}setValidation(e,t=!1){t&&(this.formState.firstName.touched=!0,this.formState.lastName.touched=!0,this.formState.emailAddress.touched=!0,this.formState.firstName.dirty=!0,this.formState.lastName.dirty=!0,this.formState.emailAddress.dirty=!0),e.validationErrors.forEach(r=>{this.isValidFieldName(r.field)&&(this.formState[r.field].error=r.message,this.formState[r.field].valid=r.message==="")}),this.host.dispatchEvent(new CustomEvent("primer-ach-validation",{bubbles:!0,composed:!0,detail:{validation:e}})),this.host.requestUpdate()}setFieldTouched(e){this.formState[e].touched||(this.formState[e].touched=!0,this.host.requestUpdate())}resetForm(){this.formState=Ua(),this.host.requestUpdate()}isValidFieldName(e){return!!e&&["firstName","lastName","emailAddress"].includes(e)}hostConnected(){}hostDisconnected(){}};var pe=class extends v{constructor(){super(...arguments);this.formController=new Kr(this,t=>this._paymentMethodManagerTask.value.setAndValidate(t));this.paymentManagers=new Map;this.sdkState=void 0;this.clientOptions=void 0;this.screen="form";this.isSubmitting=!1;this._paymentMethodManagerTask=new D(this,{task:async([t])=>t!=="STRIPE_ACH"?L:this.paymentManagers.get(t)?.manager,args:()=>[this.paymentMethod?.type]})}_handleInput(t,r){let o=t.target;this.formController.setFieldValue(r,o.value)}_handleBlur(t){this.formController.setFieldTouched(t)}_handleError(t){this.dispatchEvent(new CustomEvent("primer-ach-error",{bubbles:!0,composed:!0,detail:{error:t instanceof Error?t:new Error(typeof t=="string"?t:"Unknown error occurred")}}))}async _handleSubmitButtonClick(t){if(!this.isSubmitting){this.isSubmitting=!0;try{let r=await t.start(this.formController.formData);if(!r||r.valid)return await this._handleCollectBankAccountDetails(t);r&&this.formController.setValidation(r,!0)}catch(r){this._handleError(r)}finally{this.isSubmitting=!1}}}async _handleCollectBankAccountDetails(t){try{await t.collectBankAccountDetails(),this.screen="mandate",this.dispatchEvent(new CustomEvent("primer-ach-bank-details-collected",{bubbles:!0,composed:!0}))}catch(r){this._handleError(r)}}async _handleConfirmMandate(){if(this._paymentMethodManagerTask.value){this.isSubmitting=!0;try{await this._paymentMethodManagerTask.value.confirmMandate(),this.dispatchEvent(new CustomEvent("primer-ach-mandate-confirmed",{bubbles:!0,composed:!0}))}catch(t){this._handleError(t)}finally{this.isSubmitting=!1}}}async _handleDeclineMandate(){if(this._paymentMethodManagerTask.value){this.isSubmitting=!0;try{await this._paymentMethodManagerTask.value.declineMandate(),this.dispatchEvent(new CustomEvent("primer-ach-mandate-declined",{bubbles:!0,composed:!0}))}catch(t){this._handleError(t)}finally{this.isSubmitting=!1}}}renderForm(t){return c`
|
|
1321
1321
|
<h2>
|
|
1322
|
-
${
|
|
1322
|
+
${A("payWithAch",{id:"payWithAch"})}
|
|
1323
1323
|
</h2>
|
|
1324
1324
|
<p>
|
|
1325
|
-
${
|
|
1325
|
+
${A("stripe_ach_user_details_collection_subtitle_label",{id:"stripe_ach_user_details_collection_subtitle_label"})}
|
|
1326
1326
|
</p>
|
|
1327
1327
|
|
|
1328
1328
|
<form @submit=${r=>r.preventDefault()}>
|
|
@@ -1331,7 +1331,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
|
|
|
1331
1331
|
.hasError=${this.formController.hasError.firstName}
|
|
1332
1332
|
>
|
|
1333
1333
|
<primer-input-label slot="label">
|
|
1334
|
-
${
|
|
1334
|
+
${A("stripe_ach_user_details_collection_first_name_label",{id:"stripe_ach_user_details_collection_first_name_label"})}
|
|
1335
1335
|
</primer-input-label>
|
|
1336
1336
|
<primer-input
|
|
1337
1337
|
slot="input"
|
|
@@ -1341,14 +1341,14 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
|
|
|
1341
1341
|
?disabled=${this.isSubmitting}
|
|
1342
1342
|
></primer-input>
|
|
1343
1343
|
<primer-input-error slot="error">
|
|
1344
|
-
${this.formController.hasError.firstName?this.formController.formState.firstName.error:
|
|
1344
|
+
${this.formController.hasError.firstName?this.formController.formState.firstName.error:h}
|
|
1345
1345
|
</primer-input-error>
|
|
1346
1346
|
</primer-input-wrapper>
|
|
1347
1347
|
<primer-input-wrapper
|
|
1348
1348
|
.hasError=${this.formController.hasError.lastName}
|
|
1349
1349
|
>
|
|
1350
1350
|
<primer-input-label slot="label">
|
|
1351
|
-
${
|
|
1351
|
+
${A("stripe_ach_user_details_collection_last_name_label",{id:"stripe_ach_user_details_collection_last_name_label"})}
|
|
1352
1352
|
</primer-input-label>
|
|
1353
1353
|
<primer-input
|
|
1354
1354
|
slot="input"
|
|
@@ -1359,7 +1359,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
|
|
|
1359
1359
|
>
|
|
1360
1360
|
</primer-input>
|
|
1361
1361
|
<primer-input-error slot="error">
|
|
1362
|
-
${this.formController.hasError.lastName?this.formController.formState.lastName.error:
|
|
1362
|
+
${this.formController.hasError.lastName?this.formController.formState.lastName.error:h}
|
|
1363
1363
|
</primer-input-error>
|
|
1364
1364
|
</primer-input-wrapper>
|
|
1365
1365
|
</div>
|
|
@@ -1367,7 +1367,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
|
|
|
1367
1367
|
.hasError=${this.formController.hasError.emailAddress}
|
|
1368
1368
|
>
|
|
1369
1369
|
<primer-input-label slot="label">
|
|
1370
|
-
${
|
|
1370
|
+
${A("stripe_ach_user_details_collection_email_address_label",{id:"stripe_ach_user_details_collection_email_address_label"})}
|
|
1371
1371
|
</primer-input-label>
|
|
1372
1372
|
<primer-input
|
|
1373
1373
|
slot="input"
|
|
@@ -1378,29 +1378,29 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
|
|
|
1378
1378
|
?disabled=${this.isSubmitting}
|
|
1379
1379
|
></primer-input>
|
|
1380
1380
|
<primer-input-error slot="error">
|
|
1381
|
-
${this.formController.hasError.emailAddress?this.formController.formState.emailAddress.error:
|
|
1381
|
+
${this.formController.hasError.emailAddress?this.formController.formState.emailAddress.error:h}
|
|
1382
1382
|
</primer-input-error>
|
|
1383
1383
|
</primer-input-wrapper>
|
|
1384
1384
|
<p>
|
|
1385
|
-
${
|
|
1385
|
+
${A("stripe_ach_user_details_collection_data_usage_label",{id:"stripe_ach_user_details_collection_data_usage_label"})}
|
|
1386
1386
|
</p>
|
|
1387
1387
|
<primer-button
|
|
1388
1388
|
buttonType="submit"
|
|
1389
1389
|
variant="primary"
|
|
1390
|
-
@click=${()=>this._handleSubmitButtonClick(
|
|
1390
|
+
@click=${()=>this._handleSubmitButtonClick(t)}
|
|
1391
1391
|
?disabled=${this.isSubmitting}
|
|
1392
1392
|
?loading=${this.isSubmitting}
|
|
1393
1393
|
>
|
|
1394
|
-
${
|
|
1394
|
+
${A("stripe_ach_user_details_collection_continue_button",{id:"stripe_ach_user_details_collection_continue_button"})}
|
|
1395
1395
|
</primer-button>
|
|
1396
1396
|
</form>
|
|
1397
|
-
`}renderMandate(){return
|
|
1397
|
+
`}renderMandate(){return c`
|
|
1398
1398
|
<h2>
|
|
1399
|
-
${
|
|
1399
|
+
${A("payWithAch",{id:"payWithAch"})}
|
|
1400
1400
|
</h2>
|
|
1401
1401
|
|
|
1402
1402
|
<p>
|
|
1403
|
-
${this.clientOptions?.stripe?.mandateData.fullMandateText??
|
|
1403
|
+
${this.clientOptions?.stripe?.mandateData.fullMandateText??A("stripe_ach_mandate_template_web",{id:"stripe_ach_mandate_template_web"}).replace(/\{merchantName\}/g,this.clientOptions?.stripe?.mandateData.merchantName??"Merchant")}
|
|
1404
1404
|
</p>
|
|
1405
1405
|
|
|
1406
1406
|
<div class="button-group">
|
|
@@ -1410,7 +1410,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
|
|
|
1410
1410
|
?disabled=${this.isSubmitting}
|
|
1411
1411
|
?loading=${this.isSubmitting}
|
|
1412
1412
|
>
|
|
1413
|
-
${
|
|
1413
|
+
${A("stripe_ach_mandate_accept_button",{id:"stripe_ach_mandate_accept_button"})}
|
|
1414
1414
|
</primer-button>
|
|
1415
1415
|
|
|
1416
1416
|
<primer-button
|
|
@@ -1418,10 +1418,10 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
|
|
|
1418
1418
|
@click=${this._handleDeclineMandate.bind(this)}
|
|
1419
1419
|
?disabled=${this.isSubmitting}
|
|
1420
1420
|
>
|
|
1421
|
-
${
|
|
1421
|
+
${A("stripe_ach_mandate_cancel_payment_button",{id:"stripe_ach_mandate_cancel_payment_button"})}
|
|
1422
1422
|
</primer-button>
|
|
1423
1423
|
</div>
|
|
1424
|
-
`}render(){return this._paymentMethodManagerTask.render({complete:
|
|
1424
|
+
`}render(){return this._paymentMethodManagerTask.render({complete:t=>t?this.screen==="form"?this.renderForm(t):this.renderMandate():h})}};pe.styles=[w,Ha],s([p({type:Object})],pe.prototype,"paymentMethod",2),s([b({context:J,subscribe:!0}),p({attribute:!1})],pe.prototype,"paymentManagers",2),s([b({context:j,subscribe:!0}),p({attribute:!1})],pe.prototype,"sdkState",2),s([b({context:Le,subscribe:!0}),p({attribute:!1})],pe.prototype,"clientOptions",2),s([I()],pe.prototype,"screen",2),s([I()],pe.prototype,"isSubmitting",2),pe=s([y("primer-ach-payment"),$()],pe);var Ya=f`
|
|
1425
1425
|
:host {
|
|
1426
1426
|
height: calc(
|
|
1427
1427
|
var(--primer-typography-title-large-line-height) +
|
|
@@ -1457,7 +1457,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
|
|
|
1457
1457
|
img {
|
|
1458
1458
|
height: 100%;
|
|
1459
1459
|
}
|
|
1460
|
-
`;function
|
|
1460
|
+
`;function Qt(i){return i.toLowerCase().replace(/[^a-zA-Z0-9]+(.)/g,(e,t)=>t.toUpperCase())}var fe=class extends v{constructor(){super(...arguments);this.paymentManagers=new Map;this.sdkState=null;this.headlessUtils=null;this.open=!1;this._paymentMethodManagerTask=new D(this,{task:async([t,r])=>!t||!r?L:r.get(t)?.manager,args:()=>[this.paymentMethod?.type,this.paymentManagers]});this._getAssetsTask=new D(this,{task:async([t,r])=>{if(!t||!r)return L;let o=r.getPaymentMethodConfiguration(t);return o?{backgroundColor:o.displayMetadata.button.backgroundColor.colored,name:o.name,displayName:this._legacyGetButtonLabel(o.displayMetadata.button.text),iconUrl:o.displayMetadata.button.iconUrl.colored||o.displayMetadata.button.iconUrl.light||o.displayMetadata.button.iconUrl.dark}:L},args:()=>[this.paymentMethod?.type,this.headlessUtils]});this._setupTasks=new D(this,{task:async([t,r])=>!t||!r?L:{paymentMethodManager:t,assetsConfig:r},args:()=>[this._paymentMethodManagerTask.value,this._getAssetsTask.value]})}_legacyGetButtonLabel(t){if(!t)return;let r=t?Qt(t):"";return r==="payWith"&&(r="pay_with"),A(r,{id:r})}start(){this._paymentMethodManagerTask.value&&(this.open=!0)}renderDialog(){return this.open?c`
|
|
1461
1461
|
<primer-portal>
|
|
1462
1462
|
<primer-dialog @primer-dialog-close="${()=>this.open=!1}">
|
|
1463
1463
|
<primer-ach-payment
|
|
@@ -1468,19 +1468,19 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
|
|
|
1468
1468
|
></primer-ach-payment>
|
|
1469
1469
|
</primer-dialog>
|
|
1470
1470
|
</primer-portal>
|
|
1471
|
-
`:
|
|
1471
|
+
`:h}render(){return this._setupTasks.render({error:()=>h,complete:({assetsConfig:t})=>(this.style.setProperty("--dynamic-payment-button-bg-color",t.backgroundColor),c`
|
|
1472
1472
|
<primer-button
|
|
1473
1473
|
@click="${()=>this.start()}"
|
|
1474
|
-
class=${
|
|
1475
|
-
title="${
|
|
1474
|
+
class=${Z({loading:!!this.sdkState?.isProcessing,reverse:!0})}
|
|
1475
|
+
title="${A("pay_with",{id:"pay_with"})} ${t.name}"
|
|
1476
1476
|
>
|
|
1477
1477
|
<span class="image-container">
|
|
1478
|
-
<img src="${
|
|
1478
|
+
<img src="${t.iconUrl}" alt="${t.name}" />
|
|
1479
1479
|
</span>
|
|
1480
|
-
${
|
|
1480
|
+
${t.displayName}
|
|
1481
1481
|
</primer-button>
|
|
1482
1482
|
${this.renderDialog()}
|
|
1483
|
-
`)})}};
|
|
1483
|
+
`)})}};fe.styles=[w,Ya],s([p({type:Object})],fe.prototype,"paymentMethod",2),s([b({context:J,subscribe:!0})],fe.prototype,"paymentManagers",2),s([b({context:j,subscribe:!0})],fe.prototype,"sdkState",2),s([b({context:W,subscribe:!0})],fe.prototype,"headlessUtils",2),s([I()],fe.prototype,"open",2),fe=s([y("primer-dynamic-payment"),$()],fe);var za=f`
|
|
1484
1484
|
:host {
|
|
1485
1485
|
height: calc(
|
|
1486
1486
|
var(--primer-typography-title-large-line-height) +
|
|
@@ -1504,28 +1504,75 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
|
|
|
1504
1504
|
border: 1px solid var(--primer-color-border-outlined-default);
|
|
1505
1505
|
color: var(--primer-color-text-primary);
|
|
1506
1506
|
flex: 1;
|
|
1507
|
-
padding:
|
|
1507
|
+
padding: var(--primer-space-small);
|
|
1508
|
+
display: flex;
|
|
1509
|
+
align-items: center;
|
|
1510
|
+
justify-content: center;
|
|
1511
|
+
gap: var(--primer-space-small);
|
|
1512
|
+
}
|
|
1513
|
+
|
|
1514
|
+
/* Default layout: icon on the left (START) */
|
|
1515
|
+
primer-button {
|
|
1516
|
+
display: flex;
|
|
1517
|
+
flex-direction: row;
|
|
1518
|
+
}
|
|
1519
|
+
|
|
1520
|
+
/* When icon position is END */
|
|
1521
|
+
primer-button.icon-end {
|
|
1522
|
+
flex-direction: row-reverse;
|
|
1508
1523
|
}
|
|
1509
1524
|
|
|
1510
1525
|
.image-container {
|
|
1511
1526
|
display: flex;
|
|
1512
1527
|
justify-content: center;
|
|
1513
|
-
|
|
1528
|
+
align-items: center;
|
|
1529
|
+
min-width: 100px;
|
|
1514
1530
|
height: 100%;
|
|
1515
1531
|
}
|
|
1532
|
+
|
|
1533
|
+
.button-text {
|
|
1534
|
+
font-family: var(--primer-typography-font-family);
|
|
1535
|
+
font-size: var(--primer-typography-title-small-font-size);
|
|
1536
|
+
font-weight: var(--primer-typography-title-small-font-weight);
|
|
1537
|
+
line-height: var(--primer-typography-title-small-line-height);
|
|
1538
|
+
letter-spacing: var(--primer-typography-title-small-letter-spacing);
|
|
1539
|
+
white-space: nowrap;
|
|
1540
|
+
overflow: hidden;
|
|
1541
|
+
text-overflow: ellipsis;
|
|
1542
|
+
}
|
|
1543
|
+
|
|
1516
1544
|
/* Target the img specifically inside our component */
|
|
1517
1545
|
img {
|
|
1518
|
-
|
|
1546
|
+
max-width: 100px;
|
|
1547
|
+
width: 100%;
|
|
1548
|
+
height: auto;
|
|
1549
|
+
object-fit: cover;
|
|
1550
|
+
max-height: 100%;
|
|
1519
1551
|
}
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1552
|
+
|
|
1553
|
+
/* For image container sizing */
|
|
1554
|
+
.image-container {
|
|
1555
|
+
flex-shrink: 0;
|
|
1556
|
+
flex-grow: 1;
|
|
1557
|
+
}
|
|
1558
|
+
`;var be=class extends v{constructor(){super(...arguments);this.paymentManagers=new Map;this.sdkState=null;this.headlessUtils=null;this._paymentMethodManagerTask=new D(this,{task:async([t,r])=>!t||!r?L:r.get(t)?.manager,args:()=>[this.paymentMethod?.type,this.paymentManagers]});this._getAssetsTask=new D(this,{task:async([t,r])=>{if(!t||!r)return L;let o=r.getPaymentMethodConfiguration(t);if(!o)return L;let n=o.displayMetadata.button.backgroundColor.colored??o.displayMetadata.button.backgroundColor.light,l=o.displayMetadata.button.iconPositionRelativeToText||"START";return{backgroundColor:n,name:o.name,displayName:this._legacyGetButtonLabel(o.displayMetadata.button.text),iconUrl:o.displayMetadata.button.iconUrl.colored??o.displayMetadata.button.iconUrl.light,iconPosition:l}},args:()=>[this.paymentMethod?.type,this.headlessUtils]});this._setupTasks=new D(this,{task:async([t,r])=>!t||!r?L:{paymentMethodManager:t,assetsConfig:r},args:()=>[this._paymentMethodManagerTask.value,this._getAssetsTask.value]})}_legacyGetButtonLabel(t){if(!t)return;let r=t?Qt(t):"";return r==="payWith"&&(r="pay_with"),A(r,{id:r})}startRedirectPayment(){this._paymentMethodManagerTask.value&&this._paymentMethodManagerTask.value.start()}render(){return this._setupTasks.render({error:()=>h,complete:({assetsConfig:t})=>{this.style.setProperty("--redirect-payment-button-bg-color",t.backgroundColor);let r={loading:!!this.sdkState?.isProcessing,"icon-end":t.iconPosition==="END","image-only":!t.displayName},o=t.displayName?c`
|
|
1559
|
+
<span class="image-container">
|
|
1560
|
+
<img src="${t.iconUrl}" alt="${t.name}" />
|
|
1561
|
+
</span>
|
|
1562
|
+
<span class="button-text">${t.displayName}</span>
|
|
1563
|
+
`:c`
|
|
1564
|
+
<span class="image-container">
|
|
1565
|
+
<img src="${t.iconUrl}" alt="${t.name}" />
|
|
1566
|
+
</span>
|
|
1567
|
+
`;return c`
|
|
1568
|
+
<primer-button
|
|
1569
|
+
@click="${()=>this.startRedirectPayment()}"
|
|
1570
|
+
class=${Z(r)}
|
|
1571
|
+
title="${A("pay_with",{id:"pay_with"})} ${t.name}"
|
|
1572
|
+
>
|
|
1573
|
+
${o}
|
|
1574
|
+
</primer-button>
|
|
1575
|
+
`}})}};be.styles=[w,za],s([p({type:Object})],be.prototype,"paymentMethod",2),s([b({context:J,subscribe:!0})],be.prototype,"paymentManagers",2),s([b({context:j,subscribe:!0})],be.prototype,"sdkState",2),s([b({context:W,subscribe:!0})],be.prototype,"headlessUtils",2),be=s([y("primer-redirect-payment"),$()],be);var Fa=f`
|
|
1529
1576
|
:host {
|
|
1530
1577
|
display: contents;
|
|
1531
1578
|
}
|
|
@@ -1544,22 +1591,22 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
|
|
|
1544
1591
|
primer-vault-manager {
|
|
1545
1592
|
margin-bottom: var(--primer-space-xlarge);
|
|
1546
1593
|
}
|
|
1547
|
-
`;var
|
|
1594
|
+
`;var Fe=class extends v{constructor(){super(...arguments);this.hasAssignedContent=!1;this.onSlotChange=t=>{let o=t.target.assignedNodes({flatten:!0});this.hasAssignedContent=o.length>0,this.requestUpdate()};this.paymentMethods=null;this.sdkState=null}render(){return this.sdkState?.isSuccessful?c`
|
|
1548
1595
|
<slot name="checkout-complete">
|
|
1549
1596
|
<primer-checkout-complete></primer-checkout-complete>
|
|
1550
1597
|
</slot>
|
|
1551
|
-
`:
|
|
1598
|
+
`:c`
|
|
1552
1599
|
<slot name="payments" @slotchange=${this.onSlotChange}></slot>
|
|
1553
|
-
${V(this.hasAssignedContent,()=>
|
|
1600
|
+
${V(this.hasAssignedContent,()=>h,()=>c`
|
|
1554
1601
|
<div
|
|
1555
|
-
class=${
|
|
1602
|
+
class=${Z({"primer-is-processing":!!this.sdkState?.isProcessing})}
|
|
1556
1603
|
>
|
|
1557
1604
|
<primer-vault-manager></primer-vault-manager>
|
|
1558
1605
|
<primer-show-other-payments>
|
|
1559
1606
|
<div slot="other-payments" class="primer-main-list">
|
|
1560
|
-
${this.paymentMethods?.toArray().map(
|
|
1607
|
+
${this.paymentMethods?.toArray().map(t=>c`
|
|
1561
1608
|
<primer-payment-method
|
|
1562
|
-
type=${
|
|
1609
|
+
type=${t.type}
|
|
1563
1610
|
></primer-payment-method>
|
|
1564
1611
|
`)}
|
|
1565
1612
|
</div>
|
|
@@ -1567,7 +1614,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
|
|
|
1567
1614
|
<primer-error-message-container></primer-error-message-container>
|
|
1568
1615
|
</div>
|
|
1569
1616
|
`)}
|
|
1570
|
-
`}};
|
|
1617
|
+
`}};Fe.styles=[w,Fa],s([b({context:vt,subscribe:!0}),p()],Fe.prototype,"paymentMethods",2),s([b({context:j,subscribe:!0}),p()],Fe.prototype,"sdkState",2),Fe=s([y("primer-main")],Fe);var Ba=f`
|
|
1571
1618
|
:host {
|
|
1572
1619
|
height: calc(
|
|
1573
1620
|
var(--primer-typography-title-large-line-height) +
|
|
@@ -1581,10 +1628,10 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
|
|
|
1581
1628
|
height: 100%;
|
|
1582
1629
|
flex: 1;
|
|
1583
1630
|
}
|
|
1584
|
-
`;var ke=class extends
|
|
1631
|
+
`;var ke=class extends v{constructor(){super();this.paymentManagers=new Map;this.computedStyles=null;this._buttonId="button-container";this.loadManagerTask=new D(this,{args:()=>[this.paymentMethod?.type],task:async([t])=>{if(!t)return L;let r=this.paymentManagers.get(t)?.manager;if(!r)throw new Error(`No manager found for payment method type ${t}`);return r}}),new D(this,{args:()=>[this.loadManagerTask.value],task:async([t])=>{if(!t)return L;await this.updateComplete;let r=this.shadowRoot?.getElementById(this._buttonId);if(!r)return;let o=this.calculateButtonHeight(),n=t.createButton(),l=this.createRenderOptions(o);return await n.render(this.paymentMethod?.type==="GOOGLE_PAY"?this.shadowRoot?.getRootNode():r,l),t}})}calculateButtonHeight(){if(typeof window>"u"||!this.isConnected||!this.computedStyles)return 0;let t=parseFloat(this.computedStyles.getPropertyValue("--primer-typography-title-large-line-height")),r=parseFloat(this.computedStyles.getPropertyValue("--primer-space-medium"));return t+2*r}createRenderOptions(t){let r=this.paymentMethod?.type;return r==="GOOGLE_PAY"?{style:{shadowRoot:!0}}:r==="APPLE_PAY"?{style:{buttonHeight:t}}:r==="PAYPAL"?{style:{buttonHeight:t}}:{style:{buttonHeight:t}}}updated(t){t.has("paymentMethod")&&this.paymentMethod&&(this._buttonId=`button-container-${this.paymentMethod.type}`)}render(){return this.loadManagerTask.render({error:()=>h,complete:()=>c`
|
|
1585
1632
|
<!-- The native button container is rendered first -->
|
|
1586
1633
|
<div class="native-button-container" id="${this._buttonId}"></div>
|
|
1587
|
-
`,pending:()=>
|
|
1634
|
+
`,pending:()=>h})}};ke.styles=[w,Ba],s([p({type:Object})],ke.prototype,"paymentMethod",2),s([b({context:J,subscribe:!0}),p()],ke.prototype,"paymentManagers",2),s([b({context:$e,subscribe:!0}),p()],ke.prototype,"computedStyles",2),ke=s([y("primer-native-payment")],ke);var jr="card-form-context";var Ka=f`
|
|
1588
1635
|
:host {
|
|
1589
1636
|
display: contents;
|
|
1590
1637
|
}
|
|
@@ -1607,10 +1654,10 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
|
|
|
1607
1654
|
display: flex;
|
|
1608
1655
|
gap: var(--primer-space-small);
|
|
1609
1656
|
}
|
|
1610
|
-
`;var
|
|
1657
|
+
`;var Ee=class extends v{constructor(){super(...arguments);this.hideLabels=!1;this.hasAssignedContent=!1;this.selectedCardNetwork=null;this.paymentManagers=new Map;this.cardFormProvider=new q(this,{context:jr,initialValue:null});this.eventsController=new gt(this);this.setupCardFormTask=new D(this,{task:async([t])=>{if(!t?.manager)return L;let{manager:r}=t,{cardNumberInput:o,expiryInput:n,cvvInput:l}=r.createHostedInputs();return this.cardFormProvider.setValue({cardNumberInput:o,expiryInput:n,cvvInput:l,setCardholderName:g=>r.setCardholderName(g),setCardNetwork:g=>{this.selectedCardNetwork=g},validate:()=>r.validate(),submit:g=>r.submit(g),hideLabels:this.hideLabels}),!0},args:()=>[this.paymentManagers.get("PAYMENT_CARD")]});this.handleSlotButtonClick=t=>{let o=t.target.closest("button, primer-button");if(!o)return;this.isSubmitButton(o)&&(t.preventDefault(),this.submitCardPayment())};this.handleDirectSubmit=t=>{t.stopPropagation(),this.submitCardPayment()};this.onSlotChange=t=>{let o=t.target.assignedNodes({flatten:!0});this.hasAssignedContent=o.length>0};this.handleFormSubmit=t=>{t.preventDefault(),t.stopPropagation(),this.submitCardPayment()}}updated(t){super.updated(t),t.has("hideLabels")&&this.cardFormProvider.value&&this.cardFormProvider.setValue({...this.cardFormProvider.value,hideLabels:this.hideLabels})}connectedCallback(){super.connectedCallback(),this.addEventListener("click",this.handleSlotButtonClick),this.addEventListener("primer-form-submit",this.handleDirectSubmit)}disconnectedCallback(){this.removeEventListener("click",this.handleSlotButtonClick),this.removeEventListener("primer-form-submit",this.handleDirectSubmit),super.disconnectedCallback()}isSubmitButton(t){let r=t.tagName.toLowerCase(),o=r==="button",n=r==="primer-button";return o&&(t.getAttribute("type")==="submit"||t.hasAttribute("data-submit"))||n&&(t.getAttribute("type")==="submit"||t.hasAttribute("data-submit"))}async submitCardPayment(){let t=this.cardFormProvider.value;if(!t)return;let r=await t.validate?.();if(r?.valid){let o=await t.submit?.(this.selectedCardNetwork?{cardNetwork:this.selectedCardNetwork}:void 0);this.eventsController.dispatchFormSubmitSuccess(o)}else{let o=r?.validationErrors;this.cardFormProvider.setValue({...t,errors:o}),this.eventsController.dispatchFormSubmitErrors(o)}}render(){return this.setupCardFormTask.status===De.ERROR||this.setupCardFormTask.status===De.INITIAL?h:c`
|
|
1611
1658
|
<form @submit=${this.handleFormSubmit}>
|
|
1612
1659
|
<slot name="card-form-content" @slotchange=${this.onSlotChange}></slot>
|
|
1613
|
-
${this.setupCardFormTask.render({complete:()=>V(this.hasAssignedContent,()=>
|
|
1660
|
+
${this.setupCardFormTask.render({complete:()=>V(this.hasAssignedContent,()=>h,()=>c`
|
|
1614
1661
|
<div class="card-form">
|
|
1615
1662
|
<primer-input-card-number></primer-input-card-number>
|
|
1616
1663
|
<div class="card-form-row">
|
|
@@ -1622,7 +1669,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
|
|
|
1622
1669
|
<primer-card-form-submit></primer-card-form-submit>
|
|
1623
1670
|
`)})}
|
|
1624
1671
|
</form>
|
|
1625
|
-
`}};
|
|
1672
|
+
`}};Ee.styles=[w,Ka],s([p({type:Boolean,attribute:"hide-labels",reflect:!0})],Ee.prototype,"hideLabels",2),s([I()],Ee.prototype,"hasAssignedContent",2),s([I()],Ee.prototype,"selectedCardNetwork",2),s([b({context:J,subscribe:!0}),p({type:Object})],Ee.prototype,"paymentManagers",2),Ee=s([y("primer-card-form"),$()],Ee);function ja(i,e){if(i.style.cssText="width: 100%; flex:1; padding: 0; border: none; height: var(--primer-typography-body-large-line-height); font-size: var(--primer-typography-body-large-size); font-family: var(--primer-typography-body-large-font); color: var(--primer-color-text-primary); background-color: transparent; outline: none;",i.setAttribute("data-custom-input",""),!e.shadowRoot?.querySelector("style[data-custom-input-style]")){let t=document.createElement("style");t.setAttribute("data-custom-input-style",""),t.textContent=`
|
|
1626
1673
|
input[data-custom-input]::placeholder {
|
|
1627
1674
|
color: var(--primer-color-text-placeholder);
|
|
1628
1675
|
font-size: var(--primer-typography-body-large-size);
|
|
@@ -1631,25 +1678,28 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
|
|
|
1631
1678
|
input[data-custom-input]:focus {
|
|
1632
1679
|
outline: none;
|
|
1633
1680
|
}
|
|
1634
|
-
`,
|
|
1681
|
+
`,e.shadowRoot?e.shadowRoot.appendChild(t):e.appendChild(t)}}function Gr(i){return i?{paddingHorizontal:0,placeholder:{color:i.getPropertyValue("--primer-color-text-placeholder").trim(),fontSize:i.getPropertyValue("--primer-typography-body-large-size").trim(),fontFamily:i.getPropertyValue("--primer-typography-body-large-font").trim()},height:i.getPropertyValue("--primer-typography-body-large-line-height").trim(),fontSize:i.getPropertyValue("--primer-typography-body-large-size").trim(),fontFamily:i.getPropertyValue("--primer-typography-body-large-font").trim(),color:i.getPropertyValue("--primer-color-text-primary").trim()}:null}function Ga(i,e){return i.active===e.active&&i.dirty===e.dirty&&i.error===e.error&&i.errorCode===e.errorCode&&i.submitted===e.submitted&&i.touched===e.touched&&i.valid===e.valid}var qr=class{constructor(e,t){this._isFocused=!1;this._meta={active:!1,dirty:!1,error:null,errorCode:null,submitted:!1,touched:!1,valid:!1};this._hostedInput=null;this._standardInput=null;this.host=e,this.config=t,this.host.addController(this),this.setupTask=new D(this.host,{args:()=>[this.getHostedInput()],task:this.setupHostedInput.bind(this)}),this.host.addEventListener("wrapper-click",()=>{this.focusInput()})}focusInput(){this._hostedInput?this._hostedInput.focus():this._standardInput&&this._standardInput.focus()}getHostedInput(){let{type:e}=this.config,t=this.host.cardFormContext;return t?{cardNumber:t.cardNumberInput,cvv:t.cvvInput,expire:t.expiryInput,cardholderName:"cardholderName"}[e]:void 0}async setupHostedInput([e]){if(!e)return L;await this.host.updateComplete;let t=this.getTargetContainer();return t?e==="cardholderName"?this.setupStandardInput(t):this.setupHostedIframeInput(e,t):L}getTargetContainer(){return this.host.renderRoot.querySelector(this.config.containerSelector)}setupStandardInput(e){let t=document.createElement("input");return t.type="text",t.placeholder=this.host.placeholder,ja(t,this.host),(this.host.ariaLabel||this.host.label)&&t.setAttribute("aria-label",this.host.ariaLabel??this.host.label),this.setupInputEventListeners(t),e.innerHTML="",e.appendChild(t),this._standardInput=t,!0}setupInputEventListeners(e){e.addEventListener("input",t=>{let r=t.target;this.config.onInput?.(r.value)}),e.addEventListener("focus",()=>{this._isFocused=!0,this.host.requestUpdate()}),e.addEventListener("blur",()=>{this._isFocused=!1,this.host.requestUpdate()})}async setupHostedIframeInput(e,t){await new Promise(n=>requestAnimationFrame(()=>n())),this._hostedInput=e;let r=Gr(this.host.computedStyles),o=r?{style:{input:{base:r}}}:void 0;return e.addEventListener("focus",()=>{this._isFocused=!0,this.host.requestUpdate()}),e.addEventListener("blur",()=>{this._isFocused=!1,this.host.requestUpdate()}),e.addEventListener("change",n=>{this._meta=n,Ga(this._meta,n)&&this.host.requestUpdate()}),await e.render(t,{placeholder:this.host.placeholder,ariaLabel:this.host.ariaLabel,...o}),!0}get isFocused(){return this._isFocused}get meta(){return this._meta}hostConnected(){}hostDisconnected(){this._hostedInput=null,this._standardInput=null}};var X=class extends v{constructor(){super();this.cardFormContext=null;this.computedStyles=null;this._userAssignedProps=new Set;this._internalLabel="";this._internalPlaceholder="";this._internalAriaLabel="";this.hostedInputController={}}getTranslatedValue(t){return t?typeof t=="string"?t:A(t.id,{id:t.id}):""}get label(){return this._userAssignedProps.has("label")?this._internalLabel:this.getTranslatedValue(this.config.translations.label)}set label(t){let r=this.label;t!==""?(this._userAssignedProps.add("label"),this._internalLabel=t):(this._userAssignedProps.delete("label"),this._internalLabel=""),this.requestUpdate("label",r)}get placeholder(){return this._userAssignedProps.has("placeholder")?this._internalPlaceholder:this.getTranslatedValue(this.config.translations.placeholder)}set placeholder(t){let r=this.placeholder;this._userAssignedProps.add("placeholder"),this._internalPlaceholder=t,this.requestUpdate("placeholder",r)}get ariaLabel(){return this._userAssignedProps.has("ariaLabel")?this._internalAriaLabel:this.getTranslatedValue(this.config.translations.ariaLabel)||this.getTranslatedValue(this.config.translations.label)}set ariaLabel(t){let r=this.ariaLabel;t!==""?(this._userAssignedProps.add("ariaLabel"),this._internalAriaLabel=t):(this._userAssignedProps.delete("ariaLabel"),this._internalAriaLabel=""),this.requestUpdate("ariaLabel",r)}childUpdated(){Object.defineProperty(this,"hostedInputController",{value:new qr(this,{type:this.config.inputType,containerSelector:this.config.containerSelector,onInput:this.config.onInput}),writable:!1,configurable:!1})}handleWrapperClick(){this.hostedInputController.focusInput()}getError(){let t=this.hostedInputController.meta;return t.submitted||t.dirty&&t.touched?t.errorCode:null}renderInput(){if(this.hostedInputController.setupTask.status===De.ERROR)return h;let t=this.getError();return c`
|
|
1635
1682
|
<primer-input-wrapper
|
|
1636
1683
|
.focusWithin="${this.hostedInputController.isFocused}"
|
|
1637
|
-
.hasError=${!!
|
|
1684
|
+
.hasError=${!!t}
|
|
1638
1685
|
@wrapper-click="${this.handleWrapperClick}"
|
|
1639
1686
|
>
|
|
1640
|
-
|
|
1687
|
+
${V(!this.cardFormContext?.hideLabels,()=>c`<primer-input-label slot="label"
|
|
1688
|
+
>${this.label}</primer-input-label
|
|
1689
|
+
>`,()=>h)}
|
|
1641
1690
|
<div
|
|
1642
1691
|
slot="input"
|
|
1643
1692
|
class="card-input-slot"
|
|
1644
1693
|
id="${this.config.containerSelector.substring(1)}"
|
|
1694
|
+
aria-label="${this.ariaLabel}"
|
|
1645
1695
|
></div>
|
|
1646
|
-
${V(
|
|
1696
|
+
${V(t,()=>c`
|
|
1647
1697
|
<primer-input-error slot="error">
|
|
1648
|
-
${
|
|
1698
|
+
${A(t,{id:t})}
|
|
1649
1699
|
</primer-input-error>
|
|
1650
|
-
`,()=>
|
|
1700
|
+
`,()=>h)}
|
|
1651
1701
|
</primer-input-wrapper>
|
|
1652
|
-
`}};
|
|
1702
|
+
`}};s([b({context:jr,subscribe:!0})],X.prototype,"cardFormContext",2),s([b({context:$e,subscribe:!0}),p()],X.prototype,"computedStyles",2),s([p({type:String})],X.prototype,"label",1),s([p({type:String})],X.prototype,"placeholder",1),s([p({type:String,attribute:"aria-label"})],X.prototype,"ariaLabel",1);var qa=f`
|
|
1653
1703
|
:host {
|
|
1654
1704
|
display: contents;
|
|
1655
1705
|
}
|
|
@@ -1673,17 +1723,23 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
|
|
|
1673
1723
|
align-items: center;
|
|
1674
1724
|
z-index: 2;
|
|
1675
1725
|
}
|
|
1676
|
-
`;var
|
|
1726
|
+
`;var Be=f`
|
|
1677
1727
|
.card-input-slot {
|
|
1678
1728
|
display: flex;
|
|
1679
1729
|
}
|
|
1680
|
-
`;var
|
|
1730
|
+
`;var xt=class extends X{constructor(){super();this.config={inputType:"cardNumber",containerSelector:"#cardNumber",errorName:"cardNumber-card",translations:{label:{id:"cardNumber",defaultMessage:"Card Number"},placeholder:"4111 1111 1111 1111",ariaLabel:{id:"cardNumber",defaultMessage:"Card Number"}}};this.childUpdated()}handleNetworkSelected(t){let{network:r}=t.detail;this.cardFormContext&&this.cardFormContext.setCardNetwork(r)}renderInput(){if(this.hostedInputController.setupTask.status===De.ERROR)return h;let t=this.getError();return c`
|
|
1681
1731
|
<primer-input-wrapper
|
|
1682
1732
|
.focusWithin="${this.hostedInputController.isFocused}"
|
|
1683
|
-
.hasError=${!!
|
|
1733
|
+
.hasError=${!!t}
|
|
1684
1734
|
>
|
|
1685
|
-
|
|
1686
|
-
|
|
1735
|
+
${V(!this.cardFormContext?.hideLabels,()=>c`<primer-input-label slot="label"
|
|
1736
|
+
>${this.label}</primer-input-label
|
|
1737
|
+
>`,()=>h)}
|
|
1738
|
+
<div
|
|
1739
|
+
slot="input"
|
|
1740
|
+
class="card-number-container"
|
|
1741
|
+
aria-label="${this.ariaLabel}"
|
|
1742
|
+
>
|
|
1687
1743
|
<div id="${this.config.containerSelector.substring(1)}"></div>
|
|
1688
1744
|
<div class="network-selector-container">
|
|
1689
1745
|
<primer-card-network-selector
|
|
@@ -1691,31 +1747,31 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
|
|
|
1691
1747
|
></primer-card-network-selector>
|
|
1692
1748
|
</div>
|
|
1693
1749
|
</div>
|
|
1694
|
-
${V(
|
|
1750
|
+
${V(t,r=>c`
|
|
1695
1751
|
<primer-input-error slot="error">
|
|
1696
|
-
${
|
|
1752
|
+
${A(r,{id:r})}
|
|
1697
1753
|
</primer-input-error>
|
|
1698
|
-
`,()=>
|
|
1754
|
+
`,()=>h)}
|
|
1699
1755
|
</primer-input-wrapper>
|
|
1700
|
-
`}render(){return this.renderInput()}};
|
|
1756
|
+
`}render(){return this.renderInput()}};xt.styles=[w,Be,qa],xt=s([y("primer-input-card-number"),$()],xt);var Wa=f`
|
|
1701
1757
|
:host {
|
|
1702
1758
|
display: contents;
|
|
1703
1759
|
}
|
|
1704
|
-
`;var
|
|
1760
|
+
`;var At=class extends X{constructor(){super();this.config={inputType:"cvv",containerSelector:"#cvv",errorName:"cvv-card",translations:{label:"CVV",placeholder:"123"}};this.childUpdated()}render(){return this.renderInput()}};At.styles=[w,Be,Wa],At=s([y("primer-input-cvv"),$()],At);var Za=f`
|
|
1705
1761
|
:host {
|
|
1706
1762
|
display: contents;
|
|
1707
1763
|
}
|
|
1708
|
-
`;var
|
|
1764
|
+
`;var _t=class extends X{constructor(){super();this.config={inputType:"expire",containerSelector:"#expiry",errorName:"expiryDate-card",translations:{label:{id:"cardExpiry",defaultMessage:"Expiry Date"},placeholder:{id:"cardExpiryPlaceholder",defaultMessage:"MM/YY"},ariaLabel:{id:"cardExpiry",defaultMessage:"Expiry Date"}}};this.childUpdated()}render(){return this.renderInput()}};_t.styles=[w,Be,Za],_t=s([y("primer-input-card-expiry"),$()],_t);var Xa=f`
|
|
1709
1765
|
:host {
|
|
1710
1766
|
display: contents;
|
|
1711
1767
|
}
|
|
1712
|
-
`;var
|
|
1768
|
+
`;var St=class extends X{constructor(){super();this.config={inputType:"cardholderName",containerSelector:"#cardFormName",errorName:"cardholderName",translations:{label:{id:"cardholderNameLabel",defaultMessage:"Cardholder Name"},placeholder:{id:"cardholderNamePlaceholder",defaultMessage:"Name on card"},ariaLabel:{id:"cardholderNameLabel",defaultMessage:"Cardholder Name"}},onInput:t=>this.handleInput(t)};this.childUpdated()}handleInput(t){this.cardFormContext?.setCardholderName?.(t)}render(){return this.renderInput()}};St.styles=[w,Be,Xa],St=s([y("primer-input-card-holder-name"),$()],St);var Ja=f`
|
|
1713
1769
|
:host {
|
|
1714
1770
|
display: contents;
|
|
1715
1771
|
}
|
|
1716
|
-
`;var
|
|
1772
|
+
`;var ce=class extends v{constructor(){super(...arguments);this._userAssignedProps=new Set;this._internalButtonText="";this.headlessInstance=null;this.clientOptions=null;this.sdkState=null;this.variant="primary";this.disabled=!1;this.handleClick=t=>{if(t.preventDefault(),this.disabled)return;let r=new CustomEvent("primer-form-submit",{bubbles:!0,composed:!0,detail:{source:"primer-card-form-submit"}});this.dispatchEvent(r)}}get buttonText(){return this._userAssignedProps.has("buttonText")?this._internalButtonText:A("pay",{id:"pay"})}set buttonText(t){let r=this.buttonText;t!==""?(this._userAssignedProps.add("buttonText"),this._internalButtonText=t):(this._userAssignedProps.delete("buttonText"),this._internalButtonText=""),this.requestUpdate("buttonText",r)}render(){let t=this.clientOptions?.submitButton?.amountVisible?this.headlessInstance?.getUIOrderAmount():null,r=t?` ${t}`:h;return c`
|
|
1717
1773
|
<primer-button
|
|
1718
|
-
|
|
1774
|
+
type="submit"
|
|
1719
1775
|
variant=${this.variant}
|
|
1720
1776
|
?disabled=${this.disabled}
|
|
1721
1777
|
@click=${this.handleClick}
|
|
@@ -1724,7 +1780,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
|
|
|
1724
1780
|
>
|
|
1725
1781
|
${this.buttonText}${r}
|
|
1726
1782
|
</primer-button>
|
|
1727
|
-
`}};
|
|
1783
|
+
`}};ce.styles=[w,Ja],s([p({type:String})],ce.prototype,"buttonText",1),s([b({context:W,subscribe:!0}),p({type:Object})],ce.prototype,"headlessInstance",2),s([b({context:Le,subscribe:!0}),p({type:Object})],ce.prototype,"clientOptions",2),s([b({context:j,subscribe:!0}),p()],ce.prototype,"sdkState",2),s([p({type:String})],ce.prototype,"variant",2),s([p({type:Boolean})],ce.prototype,"disabled",2),ce=s([y("primer-card-form-submit"),$()],ce);var{I:rE}=ua;var Qa=i=>i.strings===void 0;var er=(i,e)=>{let t=i._$AN;if(t===void 0)return!1;for(let r of t)r._$AO?.(e,!1),er(r,e);return!0},Wr=i=>{let e,t;do{if((e=i._$AM)===void 0)break;t=e._$AN,t.delete(i),i=e}while(t?.size===0)},en=i=>{for(let e;e=i._$AM;i=e){let t=e._$AN;if(t===void 0)e._$AN=t=new Set;else if(t.has(i))break;t.add(i),cl(e)}};function dl(i){this._$AN!==void 0?(Wr(this),this._$AM=i,en(this)):this._$AM=i}function pl(i,e=!1,t=0){let r=this._$AH,o=this._$AN;if(o!==void 0&&o.size!==0)if(e)if(Array.isArray(r))for(let n=t;n<r.length;n++)er(r[n],!1),Wr(r[n]);else r!=null&&(er(r,!1),Wr(r));else er(this,i)}var cl=i=>{i.type==Br.CHILD&&(i._$AP??(i._$AP=pl),i._$AQ??(i._$AQ=dl))},Zr=class extends Et{constructor(){super(...arguments),this._$AN=void 0}_$AT(e,t,r){super._$AT(e,t,r),en(this),this.isConnected=e._$AU}_$AO(e,t=!0){e!==this.isConnected&&(this.isConnected=e,e?this.reconnected?.():this.disconnected?.()),t&&(er(this,e),Wr(this))}setValue(e){if(Qa(this._$Ct))this._$Ct._$AI(e,this);else{let t=[...this._$Ct._$AH];t[this._$Ci]=e,this._$Ct._$AI(t,this,0)}}disconnected(){}reconnected(){}};var qi=()=>new Gi,Gi=class{},ji=new WeakMap,Xr=Jt(class extends Zr{render(i){return h}update(i,[e]){let t=e!==this.Y;return t&&this.Y!==void 0&&this.rt(void 0),(t||this.lt!==this.ct)&&(this.Y=e,this.ht=i.options?.host,this.rt(this.ct=i.element)),h}rt(i){if(this.isConnected||(i=void 0),typeof this.Y=="function"){let e=this.ht??globalThis,t=ji.get(e);t===void 0&&(t=new WeakMap,ji.set(e,t)),t.get(this.Y)!==void 0&&this.Y.call(this.ht,void 0),t.set(this.Y,i),i!==void 0&&this.Y.call(this.ht,i)}else this.Y.value=i}get lt(){return typeof this.Y=="function"?ji.get(this.ht??globalThis)?.get(this.Y):this.Y?.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}});var tn=f`
|
|
1728
1784
|
:host {
|
|
1729
1785
|
display: flex;
|
|
1730
1786
|
align-items: center;
|
|
@@ -1844,79 +1900,120 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
|
|
|
1844
1900
|
width: var(--primer-size-small);
|
|
1845
1901
|
height: var(--primer-size-small);
|
|
1846
1902
|
}
|
|
1847
|
-
`;var
|
|
1903
|
+
`;var me=class extends v{constructor(){super(...arguments);this.cardNetworks=null;this.headlessUtils=null;this.selectedCardNetwork=null;this.isDropdownOpen=!1;this.focusedNetworkIndex=0;this.isKeyboardNavigation=!1;this.buttonRef=qi();this.dropdownRef=qi();this.networkOptionRefs=[];this.handleClickOutside=t=>{this.isDropdownOpen&&(this.contains(t.target)||(this.isDropdownOpen=!1,this.isKeyboardNavigation=!1))};this.handleMouseMove=()=>{this.isKeyboardNavigation&&(this.isKeyboardNavigation=!1)};this.handleKeyDown=t=>{if(!(!(this.getSelectableNetworks().length>1)||!(this.contains(t.target)||this===t.target||this.isDropdownOpen&&t.target===document.body)))switch(this.isKeyboardNavigation=!0,t.key){case"ArrowDown":t.preventDefault(),this.isDropdownOpen?(this.focusedNetworkIndex=(this.focusedNetworkIndex+1)%this.getSelectableNetworks().length,this.focusNetworkOption()):(this.isDropdownOpen=!0,this.focusedNetworkIndex=this.getSelectedNetworkIndex());break;case"ArrowUp":t.preventDefault(),this.isDropdownOpen?(this.focusedNetworkIndex=(this.focusedNetworkIndex-1+this.getSelectableNetworks().length)%this.getSelectableNetworks().length,this.focusNetworkOption()):(this.isDropdownOpen=!0,this.focusedNetworkIndex=this.getSelectedNetworkIndex());break;case"Enter":case" ":this.isDropdownOpen&&this.focusedNetworkIndex>=0?(t.preventDefault(),this.selectNetwork(t,this.getSelectableNetworks()[this.focusedNetworkIndex])):!this.isDropdownOpen&&this.buttonRef.value===document.activeElement&&(t.preventDefault(),this.isDropdownOpen=!0,this.focusedNetworkIndex=this.getSelectedNetworkIndex());break;case"Escape":this.isDropdownOpen&&(t.preventDefault(),this.isDropdownOpen=!1,this.buttonRef.value?.focus());break;case"Tab":this.isDropdownOpen&&(this.isDropdownOpen=!1);break}};this.handleDocumentKeyDown=t=>{this.isDropdownOpen&&this.handleKeyDown(t)}}toggleDropdown(t){this.isKeyboardNavigation=!1,t.stopPropagation(),this.getSelectableNetworks().length>1&&(this.isDropdownOpen=!this.isDropdownOpen,this.isDropdownOpen&&(this.focusedNetworkIndex=this.getSelectedNetworkIndex()))}getNetworkIconUrl(t){return this.headlessUtils?.getCardNetworkAsset(t.network)?.cardUrl}getSelectableNetworks(){return this.cardNetworks?.selectableCardNetworks||[]}getDetectedNetwork(){return this.selectedCardNetwork??(this.cardNetworks?.detectedCardNetwork||null)}getSelectedNetworkIndex(){let t=this.getDetectedNetwork();if(!t)return 0;let r=this.getSelectableNetworks().findIndex(o=>o.network===t.network);return r>=0?r:0}selectNetwork(t,r){t.stopPropagation(),this.selectedCardNetwork=r,this.isDropdownOpen=!1,this.buttonRef.value?.focus(),this.cardNetworks&&this.dispatchEvent(new CustomEvent("network-selected",{detail:{network:r.network},bubbles:!0,composed:!0}))}focusNetworkOption(){requestAnimationFrame(()=>{this.networkOptionRefs[this.focusedNetworkIndex]&&this.networkOptionRefs[this.focusedNetworkIndex].focus()})}setNetworkOptionRef(t,r){this.networkOptionRefs[r]=t}connectedCallback(){super.connectedCallback(),setTimeout(()=>{document.addEventListener("click",this.handleClickOutside),document.addEventListener("mousemove",this.handleMouseMove),this.addEventListener("keydown",this.handleKeyDown),document.addEventListener("keydown",this.handleDocumentKeyDown)},0)}disconnectedCallback(){document.removeEventListener("click",this.handleClickOutside),document.removeEventListener("keydown",this.handleDocumentKeyDown),document.removeEventListener("mousemove",this.handleMouseMove),this.removeEventListener("keydown",this.handleKeyDown),super.disconnectedCallback()}render(){if(this.cardNetworks?.isLoading)return c`<primer-spinner size="small" compact></primer-spinner>`;let t=this.getSelectableNetworks();if(!this.getDetectedNetwork()&&t.length===0)return c`<primer-icon name="payment-card"></primer-icon>`;let r=this.getDetectedNetwork()||(t.length>0?t[0]:null);if(!r)return c`<primer-icon name="payment-card" size="sm"></primer-icon>`;let o=t.length>1;return c`
|
|
1848
1904
|
<button
|
|
1849
|
-
${
|
|
1905
|
+
${Xr(this.buttonRef)}
|
|
1850
1906
|
class="network-selector"
|
|
1851
1907
|
@click=${this.toggleDropdown}
|
|
1852
|
-
@keydown=${
|
|
1908
|
+
@keydown=${n=>{(n.key===" "||n.key==="Enter")&&o&&(n.preventDefault(),this.isDropdownOpen=!this.isDropdownOpen,this.isDropdownOpen&&(this.focusedNetworkIndex=this.getSelectedNetworkIndex()))}}
|
|
1853
1909
|
aria-label=${o?`Selected card network: ${r.displayName}. Click to change.`:`Card network: ${r.displayName}`}
|
|
1854
|
-
aria-expanded=${o?this.isDropdownOpen:
|
|
1855
|
-
aria-haspopup=${o?"true":
|
|
1856
|
-
aria-controls=${o?"network-dropdown":
|
|
1910
|
+
aria-expanded=${o?this.isDropdownOpen:h}
|
|
1911
|
+
aria-haspopup=${o?"true":h}
|
|
1912
|
+
aria-controls=${o?"network-dropdown":h}
|
|
1857
1913
|
>
|
|
1858
1914
|
<img
|
|
1859
1915
|
class="network-icon"
|
|
1860
1916
|
src=${this.getNetworkIconUrl(r)}
|
|
1861
1917
|
alt=${r.displayName}
|
|
1862
1918
|
/>
|
|
1863
|
-
${V(o,()=>
|
|
1919
|
+
${V(o,()=>c`
|
|
1864
1920
|
<primer-icon
|
|
1865
1921
|
class="caret ${this.isDropdownOpen?"open":""}"
|
|
1866
1922
|
name="chevron-down"
|
|
1867
1923
|
></primer-icon>
|
|
1868
|
-
`,()=>
|
|
1924
|
+
`,()=>h)}
|
|
1869
1925
|
</button>
|
|
1870
1926
|
|
|
1871
|
-
${V(this.isDropdownOpen,()=>
|
|
1927
|
+
${V(this.isDropdownOpen,()=>c`
|
|
1872
1928
|
<div
|
|
1873
|
-
${
|
|
1929
|
+
${Xr(this.dropdownRef)}
|
|
1874
1930
|
id="network-dropdown"
|
|
1875
1931
|
class="dropdown open"
|
|
1876
1932
|
role="listbox"
|
|
1877
1933
|
aria-label="Select card network"
|
|
1878
1934
|
>
|
|
1879
|
-
${
|
|
1935
|
+
${t.map((n,l)=>c`
|
|
1880
1936
|
<div
|
|
1881
|
-
${
|
|
1882
|
-
class="network-option ${this.isKeyboardNavigation&&
|
|
1883
|
-
@click=${
|
|
1884
|
-
@keydown=${
|
|
1937
|
+
${Xr(g=>this.setNetworkOptionRef(g,l))}
|
|
1938
|
+
class="network-option ${this.isKeyboardNavigation&&l===this.focusedNetworkIndex?"focused":""}"
|
|
1939
|
+
@click=${g=>this.selectNetwork(g,n)}
|
|
1940
|
+
@keydown=${g=>{(g.key==="Enter"||g.key===" ")&&this.selectNetwork(g,n)}}
|
|
1885
1941
|
role="option"
|
|
1886
|
-
aria-selected=${
|
|
1887
|
-
tabindex="${
|
|
1942
|
+
aria-selected=${n.network===r.network}
|
|
1943
|
+
tabindex="${l===this.focusedNetworkIndex?"0":"-1"}"
|
|
1888
1944
|
>
|
|
1889
1945
|
<img
|
|
1890
1946
|
class="network-option-icon"
|
|
1891
|
-
src=${this.getNetworkIconUrl(
|
|
1892
|
-
alt=${
|
|
1947
|
+
src=${this.getNetworkIconUrl(n)}
|
|
1948
|
+
alt=${n.displayName}
|
|
1893
1949
|
/>
|
|
1894
|
-
<span class="network-name">${
|
|
1895
|
-
${V(
|
|
1950
|
+
<span class="network-name">${n.displayName}</span>
|
|
1951
|
+
${V(n.network===r.network,()=>c`
|
|
1896
1952
|
<primer-icon
|
|
1897
1953
|
class="checkmark"
|
|
1898
1954
|
name="checkmark"
|
|
1899
1955
|
></primer-icon>
|
|
1900
|
-
`,()=>
|
|
1956
|
+
`,()=>h)}
|
|
1901
1957
|
</div>
|
|
1902
1958
|
`)}
|
|
1903
1959
|
</div>
|
|
1904
|
-
`,()=>
|
|
1905
|
-
`}};
|
|
1960
|
+
`,()=>h)}
|
|
1961
|
+
`}};me.styles=[w,tn],s([b({context:yr,subscribe:!0})],me.prototype,"cardNetworks",2),s([b({context:W,subscribe:!0})],me.prototype,"headlessUtils",2),s([I()],me.prototype,"selectedCardNetwork",2),s([I()],me.prototype,"isDropdownOpen",2),s([I()],me.prototype,"focusedNetworkIndex",2),s([I()],me.prototype,"isKeyboardNavigation",2),me=s([y("primer-card-network-selector")],me);var ml=Ro(Zi(),1),Ke=Ro(Zi(),1);function Xi(i){return i.charAt(0).toUpperCase()+i.slice(1).toLowerCase()}function ul(i){return i?i===i.toUpperCase()?Xi(i):i:""}function rn(i,e){return[i,e].filter(Boolean).join(" ")}function hl(i,e){return!i||!e?"":`Expires ${i}/${e.slice(-2)}`}function on(i){return i?`\u2022\u2022\u2022\u2022 ${i}`:""}function gl(i){let e=i.paymentInstrumentData,t=ul(e.network),r=e.last4Digits,o=`${i.paymentInstrumentData.cardholderName?i.paymentInstrumentData.cardholderName:""}${(r?` ${t} ${on(r)}`:t)||" Card"}`,n=hl(e.expirationMonth,e.expirationYear);return{description:o,secondaryDescription:n}}function fl(i){let e=i.paymentInstrumentData,t=e.externalPayerInfo?.email||"",r=e.externalPayerInfo?.firstName||"",o=e.externalPayerInfo?.lastName||"",n=i.userDescription||t||"PayPal Account",l=rn(r,o);return{description:n,secondaryDescription:l}}function vl(i){let e=i.paymentInstrumentData,t=e.sessionData?.billingAddress?.email||"",r=e.sessionData?.billingAddress?.firstName||"",o=e.sessionData?.billingAddress?.lastName||"",n=i.userDescription||(t?`Klarna - ${t}`:"Klarna Account"),l=rn(r,o);return{description:n,secondaryDescription:l}}function yl(i){let e=i.paymentInstrumentData,t=e.accountNumberLastFourDigits||"",r=e.bankName||"",o=e.accountType||"",n=i.userDescription;n||(r&&t?n=`${r} ${on(t)}`:r?n=r:n="Bank Account");let l=o?`${Xi(o)} Account`:"";return{description:n,secondaryDescription:l}}function bl(i){let e=i.paymentInstrumentType,t=Xi(e.replace(/_/g," "));return{description:i.userDescription||t}}var El={[Ke.PaymentInstrumentType.CARD]:gl,[Ke.PaymentInstrumentType.PAYPAL_VAULTED]:fl,[Ke.PaymentInstrumentType.KLARNA_CUSTOMER_TOKEN]:vl,[Ke.PaymentInstrumentType.AUTOMATED_CLEARING_HOUSE]:yl};function Jr(i){try{let e=El[i.paymentInstrumentType];return e?e(i):bl(i)}catch(e){return R.error("FormatUtils",`Error formatting payment method ${i.id}:`,e),{description:i.userDescription||i.id||"Payment Method"}}}var an=f`
|
|
1906
1962
|
:host {
|
|
1907
1963
|
display: block;
|
|
1908
1964
|
width: 100%;
|
|
1965
|
+
position: relative;
|
|
1909
1966
|
}
|
|
1910
1967
|
|
|
1911
1968
|
.vault-manager {
|
|
1912
1969
|
display: flex;
|
|
1913
1970
|
flex-direction: column;
|
|
1971
|
+
position: relative;
|
|
1914
1972
|
}
|
|
1915
1973
|
|
|
1916
1974
|
.vault-manager-content {
|
|
1917
1975
|
display: flex;
|
|
1918
1976
|
flex-direction: column;
|
|
1919
1977
|
width: 100%;
|
|
1978
|
+
position: relative;
|
|
1979
|
+
}
|
|
1980
|
+
|
|
1981
|
+
/* Content container using CSS Grid for height animation */
|
|
1982
|
+
.content-container {
|
|
1983
|
+
display: grid;
|
|
1984
|
+
grid-template-rows: 1fr;
|
|
1985
|
+
transition: grid-template-rows var(--primer-animation-duration)
|
|
1986
|
+
var(--primer-animation-easing);
|
|
1987
|
+
width: 100%;
|
|
1988
|
+
position: relative;
|
|
1989
|
+
}
|
|
1990
|
+
|
|
1991
|
+
/* Required to make grid animation work - ensures content can expand/collapse properly */
|
|
1992
|
+
.content-container > * {
|
|
1993
|
+
min-height: 0;
|
|
1994
|
+
overflow: hidden;
|
|
1995
|
+
}
|
|
1996
|
+
|
|
1997
|
+
/* Submit button container */
|
|
1998
|
+
.submit-button-container {
|
|
1999
|
+
display: grid;
|
|
2000
|
+
grid-template-rows: 1fr;
|
|
2001
|
+
transition: grid-template-rows var(--primer-animation-duration)
|
|
2002
|
+
var(--primer-animation-easing);
|
|
2003
|
+
overflow: hidden;
|
|
2004
|
+
margin-top: var(--primer-space-small);
|
|
2005
|
+
width: 100%;
|
|
2006
|
+
}
|
|
2007
|
+
|
|
2008
|
+
/* Ensure the submit button has full width */
|
|
2009
|
+
.submit-button {
|
|
2010
|
+
width: 100%;
|
|
2011
|
+
}
|
|
2012
|
+
|
|
2013
|
+
/* Make sure pay button inside the submit component is full width */
|
|
2014
|
+
primer-vault-payment-submit::part(button),
|
|
2015
|
+
::slotted(primer-button) {
|
|
2016
|
+
width: 100%;
|
|
1920
2017
|
}
|
|
1921
2018
|
|
|
1922
2019
|
/* Payment methods list */
|
|
@@ -1925,60 +2022,136 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
|
|
|
1925
2022
|
flex-direction: column;
|
|
1926
2023
|
gap: var(--primer-space-small);
|
|
1927
2024
|
width: 100%;
|
|
2025
|
+
position: relative;
|
|
1928
2026
|
}
|
|
1929
2027
|
|
|
1930
2028
|
/* Delete confirmation container */
|
|
1931
2029
|
.delete-confirmation-container {
|
|
1932
2030
|
width: 100%;
|
|
1933
|
-
|
|
2031
|
+
position: relative;
|
|
2032
|
+
}
|
|
2033
|
+
|
|
2034
|
+
/* Loading overlay styles */
|
|
2035
|
+
.loading-overlay {
|
|
2036
|
+
position: absolute;
|
|
2037
|
+
top: 0;
|
|
2038
|
+
left: 0;
|
|
2039
|
+
width: 100%;
|
|
2040
|
+
height: 100%;
|
|
2041
|
+
display: flex;
|
|
2042
|
+
align-items: center;
|
|
2043
|
+
justify-content: center;
|
|
2044
|
+
background-color: rgba(255, 255, 255, 0.7);
|
|
2045
|
+
z-index: 10;
|
|
2046
|
+
border-radius: var(--primer-radius-medium);
|
|
2047
|
+
backdrop-filter: blur(2px);
|
|
2048
|
+
opacity: 0; /* Start invisible */
|
|
2049
|
+
}
|
|
2050
|
+
|
|
2051
|
+
/* Add styles for when updating is active */
|
|
2052
|
+
.is-updating {
|
|
2053
|
+
pointer-events: none; /* Prevent interaction when updating */
|
|
2054
|
+
}
|
|
2055
|
+
|
|
2056
|
+
/*
|
|
2057
|
+
* Component-specific styles to ensure smooth animations
|
|
2058
|
+
* These components need display:block to work with the grid layout
|
|
2059
|
+
*/
|
|
2060
|
+
primer-vault-payment-method-item,
|
|
2061
|
+
primer-vault-empty-state,
|
|
2062
|
+
primer-vault-delete-confirmation {
|
|
2063
|
+
display: block;
|
|
2064
|
+
width: 100%;
|
|
1934
2065
|
}
|
|
1935
|
-
|
|
2066
|
+
|
|
2067
|
+
/* Disable animations for reduced motion preference */
|
|
2068
|
+
@media (prefers-reduced-motion: reduce) {
|
|
2069
|
+
.content-container,
|
|
2070
|
+
.submit-button-container,
|
|
2071
|
+
primer-vault-payment-method-item,
|
|
2072
|
+
primer-vault-payment-submit,
|
|
2073
|
+
primer-vault-empty-state,
|
|
2074
|
+
primer-vault-delete-confirmation {
|
|
2075
|
+
transition: none;
|
|
2076
|
+
}
|
|
2077
|
+
}
|
|
2078
|
+
`;var ir=globalThis,Qr=ir.trustedTypes,nn=Qr?Qr.createPolicy("lit-html",{createHTML:i=>i}):void 0,Qi="$lit$",Ie=`lit$${Math.random().toFixed(9).slice(2)}$`,eo="?"+Ie,Cl=`<${eo}>`,st=document,ei=()=>st.createComment(""),or=i=>i===null||typeof i!="object"&&typeof i!="function",to=Array.isArray,mn=i=>to(i)||typeof i?.[Symbol.iterator]=="function",Ji=`[
|
|
2079
|
+
\f\r]`,rr=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,sn=/-->/g,ln=/>/g,at=RegExp(`>|${Ji}(?:([^\\s"'>=/]+)(${Ji}*=${Ji}*(?:[^
|
|
2080
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),dn=/'/g,pn=/"/g,un=/^(?:script|style|textarea|title)$/i,ro=i=>(e,...t)=>({_$litType$:i,strings:e,values:t}),eC=ro(1),tC=ro(2),rC=ro(3),ar=Symbol.for("lit-noChange"),K=Symbol.for("lit-nothing"),cn=new WeakMap,nt=st.createTreeWalker(st,129);function hn(i,e){if(!to(i)||!i.hasOwnProperty("raw"))throw Error("invalid template strings array");return nn!==void 0?nn.createHTML(e):e}var gn=(i,e)=>{let t=i.length-1,r=[],o,n=e===2?"<svg>":e===3?"<math>":"",l=rr;for(let g=0;g<t;g++){let u=i[g],S,k,_=-1,H=0;for(;H<u.length&&(l.lastIndex=H,k=l.exec(u),k!==null);)H=l.lastIndex,l===rr?k[1]==="!--"?l=sn:k[1]!==void 0?l=ln:k[2]!==void 0?(un.test(k[2])&&(o=RegExp("</"+k[2],"g")),l=at):k[3]!==void 0&&(l=at):l===at?k[0]===">"?(l=o??rr,_=-1):k[1]===void 0?_=-2:(_=l.lastIndex-k[2].length,S=k[1],l=k[3]===void 0?at:k[3]==='"'?pn:dn):l===pn||l===dn?l=at:l===sn||l===ln?l=rr:(l=at,o=void 0);let Y=l===at&&i[g+1].startsWith("/>")?" ":"";n+=l===rr?u+Cl:_>=0?(r.push(S),u.slice(0,_)+Qi+u.slice(_)+Ie+Y):u+Ie+(_===-2?g:Y)}return[hn(i,n+(i[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),r]},nr=class i{constructor({strings:e,_$litType$:t},r){let o;this.parts=[];let n=0,l=0,g=e.length-1,u=this.parts,[S,k]=gn(e,t);if(this.el=i.createElement(S,r),nt.currentNode=this.el.content,t===2||t===3){let _=this.el.content.firstChild;_.replaceWith(..._.childNodes)}for(;(o=nt.nextNode())!==null&&u.length<g;){if(o.nodeType===1){if(o.hasAttributes())for(let _ of o.getAttributeNames())if(_.endsWith(Qi)){let H=k[l++],Y=o.getAttribute(_).split(Ie),he=/([.?@])?(.*)/.exec(H);u.push({type:1,index:n,name:he[2],strings:Y,ctor:he[1]==="."?ri:he[1]==="?"?ii:he[1]==="@"?oi:dt}),o.removeAttribute(_)}else _.startsWith(Ie)&&(u.push({type:6,index:n}),o.removeAttribute(_));if(un.test(o.tagName)){let _=o.textContent.split(Ie),H=_.length-1;if(H>0){o.textContent=Qr?Qr.emptyScript:"";for(let Y=0;Y<H;Y++)o.append(_[Y],ei()),nt.nextNode(),u.push({type:2,index:++n});o.append(_[H],ei())}}}else if(o.nodeType===8)if(o.data===eo)u.push({type:2,index:n});else{let _=-1;for(;(_=o.data.indexOf(Ie,_+1))!==-1;)u.push({type:7,index:n}),_+=Ie.length-1}n++}}static createElement(e,t){let r=st.createElement("template");return r.innerHTML=e,r}};function lt(i,e,t=i,r){if(e===ar)return e;let o=r!==void 0?t._$Co?.[r]:t._$Cl,n=or(e)?void 0:e._$litDirective$;return o?.constructor!==n&&(o?._$AO?.(!1),n===void 0?o=void 0:(o=new n(i),o._$AT(i,t,r)),r!==void 0?(t._$Co??(t._$Co=[]))[r]=o:t._$Cl=o),o!==void 0&&(e=lt(i,o._$AS(i,e.values),o,r)),e}var ti=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:t},parts:r}=this._$AD,o=(e?.creationScope??st).importNode(t,!0);nt.currentNode=o;let n=nt.nextNode(),l=0,g=0,u=r[0];for(;u!==void 0;){if(l===u.index){let S;u.type===2?S=new sr(n,n.nextSibling,this,e):u.type===1?S=new u.ctor(n,u.name,u.strings,this,e):u.type===6&&(S=new ai(n,this,e)),this._$AV.push(S),u=r[++g]}l!==u?.index&&(n=nt.nextNode(),l++)}return nt.currentNode=st,o}p(e){let t=0;for(let r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(e,r,t),t+=r.strings.length-2):r._$AI(e[t])),t++}},sr=class i{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,r,o){this.type=2,this._$AH=K,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=r,this.options=o,this._$Cv=o?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=lt(this,e,t),or(e)?e===K||e==null||e===""?(this._$AH!==K&&this._$AR(),this._$AH=K):e!==this._$AH&&e!==ar&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):mn(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==K&&or(this._$AH)?this._$AA.nextSibling.data=e:this.T(st.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:r}=e,o=typeof r=="number"?this._$AC(e):(r.el===void 0&&(r.el=nr.createElement(hn(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===o)this._$AH.p(t);else{let n=new ti(o,this),l=n.u(this.options);n.p(t),this.T(l),this._$AH=n}}_$AC(e){let t=cn.get(e.strings);return t===void 0&&cn.set(e.strings,t=new nr(e)),t}k(e){to(this._$AH)||(this._$AH=[],this._$AR());let t=this._$AH,r,o=0;for(let n of e)o===t.length?t.push(r=new i(this.O(ei()),this.O(ei()),this,this.options)):r=t[o],r._$AI(n),o++;o<t.length&&(this._$AR(r&&r._$AB.nextSibling,o),t.length=o)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e&&e!==this._$AB;){let r=e.nextSibling;e.remove(),e=r}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},dt=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,r,o,n){this.type=1,this._$AH=K,this._$AN=void 0,this.element=e,this.name=t,this._$AM=o,this.options=n,r.length>2||r[0]!==""||r[1]!==""?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=K}_$AI(e,t=this,r,o){let n=this.strings,l=!1;if(n===void 0)e=lt(this,e,t,0),l=!or(e)||e!==this._$AH&&e!==ar,l&&(this._$AH=e);else{let g=e,u,S;for(e=n[0],u=0;u<n.length-1;u++)S=lt(this,g[r+u],t,u),S===ar&&(S=this._$AH[u]),l||(l=!or(S)||S!==this._$AH[u]),S===K?e=K:e!==K&&(e+=(S??"")+n[u+1]),this._$AH[u]=S}l&&!o&&this.j(e)}j(e){e===K?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},ri=class extends dt{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===K?void 0:e}},ii=class extends dt{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==K)}},oi=class extends dt{constructor(e,t,r,o,n){super(e,t,r,o,n),this.type=5}_$AI(e,t=this){if((e=lt(this,e,t,0)??K)===ar)return;let r=this._$AH,o=e===K&&r!==K||e.capture!==r.capture||e.once!==r.once||e.passive!==r.passive,n=e!==K&&(r===K||o);o&&this.element.removeEventListener(this.name,this,r),n&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}},ai=class{constructor(e,t,r){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(e){lt(this,e)}},fn={M:Qi,P:Ie,A:eo,C:1,L:gn,R:ti,D:mn,V:lt,I:sr,H:dt,N:ii,U:oi,B:ri,F:ai},xl=ir.litHtmlPolyfillSupport;xl?.(nr,sr),(ir.litHtmlVersions??(ir.litHtmlVersions=[])).push("3.3.0");var Mt={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},lr=i=>(...e)=>({_$litDirective$:i,values:e}),ni=class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,r){this._$Ct=e,this._$AM=t,this._$Ci=r}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}};var{I:pC}=fn;var vn=i=>i.strings===void 0;var dr=(i,e)=>{let t=i._$AN;if(t===void 0)return!1;for(let r of t)r._$AO?.(e,!1),dr(r,e);return!0},si=i=>{let e,t;do{if((e=i._$AM)===void 0)break;t=e._$AN,t.delete(i),i=e}while(t?.size===0)},yn=i=>{for(let e;e=i._$AM;i=e){let t=e._$AN;if(t===void 0)e._$AN=t=new Set;else if(t.has(i))break;t.add(i),Sl(e)}};function Al(i){this._$AN!==void 0?(si(this),this._$AM=i,yn(this)):this._$AM=i}function _l(i,e=!1,t=0){let r=this._$AH,o=this._$AN;if(o!==void 0&&o.size!==0)if(e)if(Array.isArray(r))for(let n=t;n<r.length;n++)dr(r[n],!1),si(r[n]);else r!=null&&(dr(r,!1),si(r));else dr(this,i)}var Sl=i=>{i.type==Mt.CHILD&&(i._$AP??(i._$AP=_l),i._$AQ??(i._$AQ=Al))},Pt=class extends ni{constructor(){super(...arguments),this._$AN=void 0}_$AT(e,t,r){super._$AT(e,t,r),yn(this),this.isConnected=e._$AU}_$AO(e,t=!0){e!==this.isConnected&&(this.isConnected=e,e?this.reconnected?.():this.disconnected?.()),t&&(dr(this,e),si(this))}setValue(e){if(vn(this._$Ct))this._$Ct._$AI(e,this);else{let t=[...this._$Ct._$AH];t[this._$Ci]=e,this._$Ct._$AI(t,this,0)}}disconnected(){}reconnected(){}};var li=new WeakMap,Tt=class{constructor(e,t){this.startPaused=!1,this.disabled=!1,this.clients=new Set,this.pendingComplete=!1,this.host=e,this.defaultOptions=t.defaultOptions||{},this.startPaused=!!t.startPaused,this.disabled=!!t.disabled,this.onComplete=t.onComplete,li.set(this.host,this)}async add(e){this.clients.add(e),this.startPaused&&e.webAnimation?.pause(),this.pendingComplete=!0,await e.finished,this.pendingComplete&&!this.isAnimating&&(this.pendingComplete=!1,this.onComplete?.())}remove(e){this.clients.delete(e)}pause(){this.clients.forEach(e=>e.webAnimation?.pause())}play(){this.clients.forEach(e=>e.webAnimation?.play())}cancel(){this.clients.forEach(e=>e.webAnimation?.cancel()),this.clients.clear()}finish(){this.clients.forEach(e=>e.webAnimation?.finish()),this.clients.clear()}togglePlay(){this.isPlaying?this.pause():this.play()}get isAnimating(){return this.clients.size>0}get isPlaying(){return Array.from(this.clients).some(e=>e.webAnimation?.playState==="running")}async finished(){await Promise.all(Array.from(this.clients).map(e=>e.finished))}};var bn=0,io=new Map,En=new WeakSet,oo=()=>new Promise(i=>requestAnimationFrame(i));var Cn=(i,e)=>{let t=i-e;return t===0?void 0:t},xn=(i,e)=>{let t=i/e;return t===1?void 0:t},di={left:(i,e)=>{let t=Cn(i,e);return{value:t,transform:t==null||isNaN(t)?void 0:`translateX(${t}px)`}},top:(i,e)=>{let t=Cn(i,e);return{value:t,transform:t==null||isNaN(t)?void 0:`translateY(${t}px)`}},width:(i,e)=>{let t;e===0&&(e=1,t={width:"1px"});let r=xn(i,e);return{value:r,overrideFrom:t,transform:r==null||isNaN(r)?void 0:`scaleX(${r})`}},height:(i,e)=>{let t;e===0&&(e=1,t={height:"1px"});let r=xn(i,e);return{value:r,overrideFrom:t,transform:r==null||isNaN(r)?void 0:`scaleY(${r})`}}},_n={duration:333,easing:"ease-in-out"},Sn=["left","top","width","height","opacity","color","background"],An=new WeakMap,pi=class extends Pt{constructor(e){if(super(e),this.t=!1,this.i=null,this.o=null,this.h=!0,this.shouldLog=!1,e.type===Mt.CHILD)throw Error("The `animate` directive must be used in attribute position.");this.createFinished()}createFinished(){this.resolveFinished?.(),this.finished=new Promise(e=>{this.l=e})}async resolveFinished(){this.l?.(),this.l=void 0}render(e){return K}getController(){return li.get(this.u)}isDisabled(){return this.options.disabled||this.getController()?.disabled}update(e,[t]){let r=this.u===void 0;return r&&(this.u=e.options?.host,this.u.addController(this),this.u.updateComplete.then(o=>this.t=!0),this.element=e.element,An.set(this.element,this)),this.optionsOrCallback=t,(r||typeof t!="function")&&this.p(t),this.render(t)}p(e){e=e??{};let t=this.getController();t!==void 0&&((e={...t.defaultOptions,...e}).keyframeOptions={...t.defaultOptions.keyframeOptions,...e.keyframeOptions}),e.properties??(e.properties=Sn),this.options=e}m(){let e={},t=this.element.getBoundingClientRect(),r=getComputedStyle(this.element);return this.options.properties.forEach(o=>{let n=t[o]??(di[o]?void 0:r[o]),l=Number(n);e[o]=isNaN(l)?n+"":l}),e}v(){let e,t=!0;return this.options.guard&&(e=this.options.guard(),t=((r,o)=>{if(Array.isArray(r)){if(Array.isArray(o)&&o.length===r.length&&r.every((n,l)=>n===o[l]))return!1}else if(o===r)return!1;return!0})(e,this._)),this.h=this.t&&!this.isDisabled()&&!this.isAnimating()&&t&&this.element.isConnected,this.h&&(this._=Array.isArray(e)?Array.from(e):e),this.h}hostUpdate(){typeof this.optionsOrCallback=="function"&&this.p(this.optionsOrCallback()),this.v()&&(this.A=this.m(),this.i=this.i??this.element.parentNode,this.o=this.element.nextSibling)}async hostUpdated(){if(!this.h||!this.element.isConnected||this.options.skipInitial&&!this.isHostRendered)return;let e;this.prepare(),await oo;let t=this.O(),r=this.j(this.options.keyframeOptions,t),o=this.m();if(this.A!==void 0){let{from:n,to:l}=this.N(this.A,o,t);this.log("measured",[this.A,o,n,l]),e=this.calculateKeyframes(n,l)}else{let n=io.get(this.options.inId);if(n){io.delete(this.options.inId);let{from:l,to:g}=this.N(n,o,t);e=this.calculateKeyframes(l,g),e=this.options.in?[{...this.options.in[0],...e[0]},...this.options.in.slice(1),e[1]]:e,bn++,e.forEach(u=>u.zIndex=bn)}else this.options.in&&(e=[...this.options.in,{}])}this.animate(e,r)}resetStyles(){this.P!==void 0&&(this.element.setAttribute("style",this.P??""),this.P=void 0)}commitStyles(){this.P=this.element.getAttribute("style"),this.webAnimation?.commitStyles(),this.webAnimation?.cancel()}reconnected(){}async disconnected(){if(!this.h||(this.options.id!==void 0&&io.set(this.options.id,this.A),this.options.out===void 0))return;if(this.prepare(),await oo(),this.i?.isConnected){let t=this.o&&this.o.parentNode===this.i?this.o:null;if(this.i.insertBefore(this.element,t),this.options.stabilizeOut){let r=this.m();this.log("stabilizing out");let o=this.A.left-r.left,n=this.A.top-r.top;getComputedStyle(this.element).position!=="static"||o===0&&n===0||(this.element.style.position="relative"),o!==0&&(this.element.style.left=o+"px"),n!==0&&(this.element.style.top=n+"px")}}let e=this.j(this.options.keyframeOptions);await this.animate(this.options.out,e),this.element.remove()}prepare(){this.createFinished()}start(){this.options.onStart?.(this)}didFinish(e){e&&this.options.onComplete?.(this),this.A=void 0,this.animatingProperties=void 0,this.frames=void 0,this.resolveFinished()}O(){let e=[];for(let t=this.element.parentNode;t;t=t?.parentNode){let r=An.get(t);r&&!r.isDisabled()&&r&&e.push(r)}return e}get isHostRendered(){let e=En.has(this.u);return e||this.u.updateComplete.then(()=>{En.add(this.u)}),e}j(e,t=this.O()){let r={..._n};return t.forEach(o=>Object.assign(r,o.options.keyframeOptions)),Object.assign(r,e),r}N(e,t,r){e={...e},t={...t};let o=r.map(g=>g.animatingProperties).filter(g=>g!==void 0),n=1,l=1;return o.length>0&&(o.forEach(g=>{g.width&&(n/=g.width),g.height&&(l/=g.height)}),e.left!==void 0&&t.left!==void 0&&(e.left=n*e.left,t.left=n*t.left),e.top!==void 0&&t.top!==void 0&&(e.top=l*e.top,t.top=l*t.top)),{from:e,to:t}}calculateKeyframes(e,t,r=!1){let o={},n={},l=!1,g={};for(let u in t){let S=e[u],k=t[u];if(u in di){let _=di[u];if(S===void 0||k===void 0)continue;let H=_(S,k);H.transform!==void 0&&(g[u]=H.value,l=!0,o.transform=`${o.transform??""} ${H.transform}`,H.overrideFrom!==void 0&&Object.assign(o,H.overrideFrom))}else S!==k&&S!==void 0&&k!==void 0&&(l=!0,o[u]=S,n[u]=k)}return o.transformOrigin=n.transformOrigin=r?"center center":"top left",this.animatingProperties=g,l?[o,n]:void 0}async animate(e,t=this.options.keyframeOptions){this.start(),this.frames=e;let r=!1;if(!this.isAnimating()&&!this.isDisabled()&&(this.options.onFrames&&(this.frames=e=this.options.onFrames(this),this.log("modified frames",e)),e!==void 0)){this.log("animate",[e,t]),r=!0,this.webAnimation=this.element.animate(e,t);let o=this.getController();o?.add(this);try{await this.webAnimation.finished}catch{}o?.remove(this)}return this.didFinish(r),r}isAnimating(){return this.webAnimation?.playState==="running"||this.webAnimation?.pending}log(e,t){this.shouldLog&&!this.isDisabled()&&console.log(e,this.options.id,t)}},je=lr(pi);var Ml=["top","right","bottom","left"],ci=class extends Pt{constructor(e){if(super(e),e.type!==Mt.ELEMENT)throw Error("The `position` directive must be used in attribute position.")}render(e,t){return K}update(e,[t,r]){return this.u===void 0&&(this.u=e.options?.host,this.u.addController(this)),this.S=e.element,this.C=t,this.F=r??["left","top","width","height"],this.render(t,r)}hostUpdated(){this.$()}$(){let e=typeof this.C=="function"?this.C():this.C?.value,t=e.offsetParent;if(e===void 0||!t)return;let r=e.getBoundingClientRect(),o=t.getBoundingClientRect();this.F?.forEach(n=>{let l=Ml.includes(n)?r[n]-o[n]:r[n];this.S.style[n]=l+"px"})}},Pl=lr(ci);var ue=class extends v{constructor(){super();this.vaultManagerContext=null;this.isEditMode=!1;this.deletePaymentMethodId=null;this.isDeleting=!1;this.errorMessage="";this.animationDuration=300;new Tt(this,{defaultOptions:{keyframeOptions:{duration:Number(getComputedStyle(document.documentElement).getPropertyValue("--primer-animation-duration").trim().replace("ms","")),easing:getComputedStyle(document.documentElement).getPropertyValue("--primer-animation-easing").trim()}}})}getAnimationConfig(){return{keyframeOptions:{duration:this.animationDuration,easing:getComputedStyle(document.documentElement).getPropertyValue("--primer-animation-easing").trim(),fill:"both"}}}handleToggleEditMode(t){this.isEditMode=t.detail,this.deletePaymentMethodId=null}handleDeletePaymentMethod(t){this.deletePaymentMethodId=t.detail}handleCancelDelete(){this.deletePaymentMethodId=null}async handleConfirmDelete(){if(!this.vaultManagerContext?.deleteVaultedPaymentMethod||!this.deletePaymentMethodId){this.errorMessage=A("something_went_wrong_error",{id:"something_went_wrong_error"});return}try{this.isDeleting=!0,await this.vaultManagerContext.deleteVaultedPaymentMethod(this.deletePaymentMethodId),this.deletePaymentMethodId=null}catch(t){this.errorMessage=t instanceof Error?t.message:A("something_went_wrong_error",{id:"something_went_wrong_error"})}finally{this.isDeleting=!1}}handlePaymentError(t){let r=t.detail?.error;this.errorMessage=r instanceof Error?r.message:A("payment_processing_error",{id:"payment_processing_error"})}handleCloseError(){this.errorMessage=""}getPaymentMethodName(t){if(!this.vaultManagerContext)return"";let r=this.vaultManagerContext.vaultedPaymentMethods.find(o=>o.id===t);if(!r)return"";try{return Jr(r).description||""}catch{return""}}renderLoadingOverlay(){return c`
|
|
2081
|
+
<div
|
|
2082
|
+
class="loading-overlay"
|
|
2083
|
+
${je({...this.getAnimationConfig(),properties:["opacity"],in:[{opacity:0},{opacity:1}],out:[{opacity:1},{opacity:0}]})}
|
|
2084
|
+
>
|
|
2085
|
+
<primer-spinner
|
|
2086
|
+
size="medium"
|
|
2087
|
+
color="var(--primer-color-loader)"
|
|
2088
|
+
></primer-spinner>
|
|
2089
|
+
</div>
|
|
2090
|
+
`}renderDeleteConfirmation(){if(!this.deletePaymentMethodId)return h;let t=this.getPaymentMethodName(this.deletePaymentMethodId);return c`
|
|
1936
2091
|
<div class="delete-confirmation-container">
|
|
1937
2092
|
<primer-vault-delete-confirmation
|
|
1938
2093
|
.isDeleting=${this.isDeleting}
|
|
1939
2094
|
.paymentMethodId=${this.deletePaymentMethodId}
|
|
1940
|
-
.paymentMethodName=${
|
|
2095
|
+
.paymentMethodName=${t}
|
|
1941
2096
|
@confirm-delete=${this.handleConfirmDelete}
|
|
1942
2097
|
@cancel-delete=${this.handleCancelDelete}
|
|
2098
|
+
${je({...this.getAnimationConfig(),properties:["opacity"],in:[{opacity:0},{opacity:1}],out:[{opacity:1},{opacity:0}]})}
|
|
1943
2099
|
></primer-vault-delete-confirmation>
|
|
1944
2100
|
</div>
|
|
1945
|
-
`}renderPaymentMethodItem(
|
|
2101
|
+
`}renderPaymentMethodItem(t){return this.deletePaymentMethodId===t.id?h:c`
|
|
1946
2102
|
<primer-vault-payment-method-item
|
|
1947
|
-
.paymentMethod=${
|
|
2103
|
+
.paymentMethod=${t}
|
|
1948
2104
|
.isEditMode=${this.isEditMode}
|
|
1949
2105
|
@delete-payment-method=${this.handleDeletePaymentMethod}
|
|
2106
|
+
${je({...this.getAnimationConfig(),properties:["opacity"],in:[{opacity:0},{opacity:1}],out:[{opacity:1},{opacity:0}]})}
|
|
1950
2107
|
></primer-vault-payment-method-item>
|
|
1951
|
-
`}
|
|
1952
|
-
<div class="
|
|
2108
|
+
`}renderPaymentMethodList(){let t=this.vaultManagerContext?.vaultedPaymentMethods||[],r=!this.isEditMode&&t.length>0&&!this.deletePaymentMethodId;return c`
|
|
2109
|
+
<div class="payment-methods-list">
|
|
2110
|
+
${t.map(o=>this.renderPaymentMethodItem(o))}
|
|
2111
|
+
${V(r,()=>c`
|
|
2112
|
+
<div class="submit-button-container">
|
|
2113
|
+
<primer-vault-payment-submit
|
|
2114
|
+
class="submit-button"
|
|
2115
|
+
@primer-vault-payment-error=${this.handlePaymentError}
|
|
2116
|
+
${je({...this.getAnimationConfig(),properties:["opacity"],in:[{opacity:0},{opacity:1}],out:[{opacity:1},{opacity:0}]})}
|
|
2117
|
+
></primer-vault-payment-submit>
|
|
2118
|
+
</div>
|
|
2119
|
+
`,()=>h)}
|
|
2120
|
+
</div>
|
|
2121
|
+
`}render(){if(!this.vaultManagerContext?.enabled)return h;let t=this.vaultManagerContext.vaultedPaymentMethods.length>0,r=this.vaultManagerContext.isLoading,o=this.vaultManagerContext.isUpdating;return c`
|
|
2122
|
+
<div class="vault-manager ${o?"is-updating":""}">
|
|
1953
2123
|
<primer-vault-manager-header
|
|
1954
2124
|
.isEditMode=${this.isEditMode}
|
|
1955
|
-
.hasPaymentMethods=${
|
|
2125
|
+
.hasPaymentMethods=${t}
|
|
1956
2126
|
@toggle-edit-mode=${this.handleToggleEditMode}
|
|
1957
2127
|
></primer-vault-manager-header>
|
|
1958
2128
|
|
|
1959
|
-
${V(this.errorMessage,()=>
|
|
2129
|
+
${V(this.errorMessage,()=>c`
|
|
1960
2130
|
<primer-vault-error-message
|
|
1961
2131
|
.errorMessage=${this.errorMessage}
|
|
1962
2132
|
@close-error=${this.handleCloseError}
|
|
2133
|
+
${je({...this.getAnimationConfig(),properties:["opacity"],in:[{opacity:0},{opacity:1}],out:[{opacity:1},{opacity:0}]})}
|
|
1963
2134
|
></primer-vault-error-message>
|
|
1964
|
-
`,()=>
|
|
2135
|
+
`,()=>h)}
|
|
1965
2136
|
|
|
1966
2137
|
<div class="vault-manager-content">
|
|
1967
|
-
${V(!r&&!
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
2138
|
+
${V(!r&&!t,()=>c`
|
|
2139
|
+
<div class="content-container">
|
|
2140
|
+
<primer-vault-empty-state
|
|
2141
|
+
${je({...this.getAnimationConfig(),properties:["opacity"],in:[{opacity:0},{opacity:1}],out:[{opacity:1},{opacity:0}]})}
|
|
2142
|
+
></primer-vault-empty-state>
|
|
2143
|
+
</div>
|
|
2144
|
+
`,()=>h)}
|
|
2145
|
+
${V(!r&&t,()=>c`
|
|
2146
|
+
<div class="content-container">
|
|
2147
|
+
${V(this.deletePaymentMethodId,()=>this.renderDeleteConfirmation(),()=>this.renderPaymentMethodList())}
|
|
1977
2148
|
</div>
|
|
1978
|
-
`,()=>
|
|
2149
|
+
`,()=>h)}
|
|
1979
2150
|
</div>
|
|
2151
|
+
|
|
2152
|
+
${V(o,()=>this.renderLoadingOverlay(),()=>h)}
|
|
1980
2153
|
</div>
|
|
1981
|
-
`}};
|
|
2154
|
+
`}};ue.styles=[w,an],s([b({context:Q,subscribe:!0}),p({type:Object,attribute:!1})],ue.prototype,"vaultManagerContext",2),s([I()],ue.prototype,"isEditMode",2),s([I()],ue.prototype,"deletePaymentMethodId",2),s([I()],ue.prototype,"isDeleting",2),s([I()],ue.prototype,"errorMessage",2),s([p({type:Number})],ue.prototype,"animationDuration",2),ue=s([y("primer-vault-manager"),$()],ue);function Mn(i){return i.paymentInstrumentType===Ke.PaymentInstrumentType.CARD}var Pn=f`
|
|
1982
2155
|
:host {
|
|
1983
2156
|
display: flex;
|
|
1984
2157
|
width: 100%;
|
|
@@ -1991,30 +2164,19 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
|
|
|
1991
2164
|
width: 100%;
|
|
1992
2165
|
}
|
|
1993
2166
|
|
|
1994
|
-
|
|
1995
|
-
.payment-method-item {
|
|
1996
|
-
border: 1px solid var(--primer-color-border-outlined-default);
|
|
1997
|
-
background-color: var(--primer-color-background-outlined-default);
|
|
1998
|
-
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
|
|
1999
|
-
padding: var(--primer-space-medium);
|
|
2000
|
-
border-radius: var(--primer-radius-medium);
|
|
2001
|
-
box-sizing: border-box;
|
|
2167
|
+
.payment-method-container {
|
|
2002
2168
|
display: flex;
|
|
2003
2169
|
width: 100%;
|
|
2004
|
-
}
|
|
2005
|
-
|
|
2006
|
-
/* Hover states */
|
|
2007
|
-
.payment-method-item:hover {
|
|
2008
|
-
border-color: var(--primer-color-border-outlined-hover);
|
|
2009
|
-
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.07);
|
|
2010
|
-
}
|
|
2011
|
-
|
|
2012
|
-
.payment-method-content {
|
|
2013
|
-
display: flex;
|
|
2014
2170
|
align-items: center;
|
|
2015
2171
|
gap: var(--primer-space-small);
|
|
2172
|
+
}
|
|
2173
|
+
|
|
2174
|
+
/* Target the button part from primer-button using ::part selector */
|
|
2175
|
+
primer-button::part(button) {
|
|
2016
2176
|
width: 100%;
|
|
2017
|
-
|
|
2177
|
+
justify-content: flex-start;
|
|
2178
|
+
display: flex;
|
|
2179
|
+
text-align: left;
|
|
2018
2180
|
}
|
|
2019
2181
|
|
|
2020
2182
|
/* Card icons */
|
|
@@ -2038,10 +2200,11 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
|
|
|
2038
2200
|
.payment-method-details {
|
|
2039
2201
|
flex: 1;
|
|
2040
2202
|
display: flex;
|
|
2041
|
-
gap: var(--primer-space-
|
|
2042
|
-
align-items:
|
|
2203
|
+
gap: var(--primer-space-xsmall);
|
|
2204
|
+
align-items: flex-start;
|
|
2043
2205
|
transition: transform var(--primer-animation-duration)
|
|
2044
2206
|
var(--primer-animation-easing);
|
|
2207
|
+
margin-left: var(--primer-space-small);
|
|
2045
2208
|
}
|
|
2046
2209
|
|
|
2047
2210
|
.payment-method-description {
|
|
@@ -2054,12 +2217,15 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
|
|
|
2054
2217
|
.payment-method-secondary-description {
|
|
2055
2218
|
font-size: var(--primer-typography-body-small-size);
|
|
2056
2219
|
color: var(--primer-color-text-secondary);
|
|
2057
|
-
margin-top: var(--primer-space-xxsmall);
|
|
2058
2220
|
transition: color var(--primer-animation-duration)
|
|
2059
2221
|
var(--primer-animation-easing);
|
|
2060
2222
|
}
|
|
2061
2223
|
|
|
2062
|
-
|
|
2224
|
+
.payment-method-button {
|
|
2225
|
+
flex: 1;
|
|
2226
|
+
}
|
|
2227
|
+
|
|
2228
|
+
/* Delete button - for edit mode */
|
|
2063
2229
|
.delete-button {
|
|
2064
2230
|
background-color: transparent;
|
|
2065
2231
|
border: none;
|
|
@@ -2073,15 +2239,11 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
|
|
|
2073
2239
|
justify-content: center;
|
|
2074
2240
|
height: var(--primer-size-medium);
|
|
2075
2241
|
width: var(--primer-size-medium);
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
/* Delete button is fully visible in stable edit mode (not transitioning) */
|
|
2082
|
-
.payment-method-item .delete-button {
|
|
2083
|
-
opacity: 1;
|
|
2084
|
-
transform: translateX(0);
|
|
2242
|
+
margin-left: var(--primer-space-small);
|
|
2243
|
+
transition:
|
|
2244
|
+
background-color var(--primer-animation-duration)
|
|
2245
|
+
var(--primer-animation-easing),
|
|
2246
|
+
transform var(--primer-animation-duration) var(--primer-animation-easing);
|
|
2085
2247
|
}
|
|
2086
2248
|
|
|
2087
2249
|
.delete-button:hover {
|
|
@@ -2096,51 +2258,52 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
|
|
|
2096
2258
|
.delete-button primer-icon {
|
|
2097
2259
|
color: var(--primer-color-red-500);
|
|
2098
2260
|
}
|
|
2099
|
-
`;var
|
|
2261
|
+
`;var ve=class extends v{constructor(){super(...arguments);this.vaultManagerContext=null;this.vaultItemContext=null;this.headlessUtils=null;this.paymentMethod=null;this.isEditMode=!1;this._getAssetsTask=new D(this,{task:async([t,r,o])=>{if(!t||!r||!o)return L;let n="";if(Mn(t))n=r.getCardNetworkAsset(t.paymentInstrumentData.network).cardUrl;else{let u=await r.getCDNAssets(t.paymentMethodType);u&&(n=u.assets?.icon?`${u.goatCdnUrl}/${u.assets.icon}`:"")}let l=o.cvvRecapture,g=Jr(t);return{icon:n,shouldShowCVV:l,...g}},args:()=>[this.paymentMethod,this.headlessUtils,this.vaultManagerContext]})}isSelected(){if(!this.vaultManagerContext||!this.paymentMethod)return!1;let t=this.vaultItemContext?.selectedVaultedPaymentMethod;return!!t&&t.id===this.paymentMethod.id}handleClick(){this.isEditMode||!this.vaultManagerContext||!this.paymentMethod||(this.isSelected()?this.vaultItemContext?.setSelectedVaultedPaymentMethod(null):this.vaultItemContext?.setSelectedVaultedPaymentMethod(this.paymentMethod))}handleDeleteClick(t){t.stopPropagation(),this.dispatchEvent(new CustomEvent("delete-payment-method",{detail:this.paymentMethod?.id,bubbles:!0,composed:!0}))}renderPaymentMethodContent(t){let r=t.icon?c`<img
|
|
2100
2262
|
class="payment-method-icon"
|
|
2101
|
-
src=${
|
|
2102
|
-
alt=${
|
|
2103
|
-
/>`:
|
|
2263
|
+
src=${t.icon}
|
|
2264
|
+
alt=${t.description}
|
|
2265
|
+
/>`:c`
|
|
2104
2266
|
<div class="payment-method-icon payment-method-icon-generic">
|
|
2105
2267
|
<primer-icon name="payment-card" size="sm"></primer-icon>
|
|
2106
2268
|
</div>
|
|
2107
|
-
`;return
|
|
2269
|
+
`;return c`
|
|
2108
2270
|
${r}
|
|
2109
2271
|
<div class="payment-method-details">
|
|
2110
|
-
<div class="payment-method-description">${
|
|
2111
|
-
${
|
|
2112
|
-
${
|
|
2113
|
-
</div>`:
|
|
2272
|
+
<div class="payment-method-description">${t.description}</div>
|
|
2273
|
+
${t.secondaryDescription?c`<div class="payment-method-secondary-description">
|
|
2274
|
+
${t.secondaryDescription}
|
|
2275
|
+
</div>`:h}
|
|
2114
2276
|
</div>
|
|
2115
|
-
`}render(){return this._getAssetsTask.render({error:()=>
|
|
2116
|
-
<div class="payment-method-item" @click=${this.handleClick}>
|
|
2117
|
-
<div class="payment-method-content">
|
|
2118
|
-
${this.renderPaymentMethodContent(e)}
|
|
2119
|
-
<button
|
|
2120
|
-
class="delete-button"
|
|
2121
|
-
@click=${this.handleDeleteClick}
|
|
2122
|
-
aria-label=${`${_("delete",{id:"delete"})} ${e.description}`}
|
|
2123
|
-
>
|
|
2124
|
-
<primer-icon name="trash" size="sm"></primer-icon>
|
|
2125
|
-
</button>
|
|
2126
|
-
</div>
|
|
2127
|
-
</div>
|
|
2128
|
-
`:p`
|
|
2277
|
+
`}render(){return this._getAssetsTask.render({error:()=>h,complete:t=>{let r=this.isSelected()?"checked":"default";return c`
|
|
2129
2278
|
<div class="payment-method-wrapper">
|
|
2130
|
-
<
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2279
|
+
<div class="payment-method-container">
|
|
2280
|
+
<primer-button
|
|
2281
|
+
variant="secondary"
|
|
2282
|
+
class="payment-method-button"
|
|
2283
|
+
selectable
|
|
2284
|
+
?disabled=${this.isEditMode}
|
|
2285
|
+
selectionState=${r}
|
|
2286
|
+
@click=${this.handleClick}
|
|
2287
|
+
>
|
|
2288
|
+
${this.renderPaymentMethodContent(t)}
|
|
2289
|
+
</primer-button>
|
|
2290
|
+
|
|
2291
|
+
${this.isEditMode?c`
|
|
2292
|
+
<button
|
|
2293
|
+
class="delete-button"
|
|
2294
|
+
@click=${this.handleDeleteClick}
|
|
2295
|
+
aria-label=${`${A("delete",{id:"delete"})} ${t.description}`}
|
|
2296
|
+
>
|
|
2297
|
+
<primer-icon name="trash" size="sm"></primer-icon>
|
|
2298
|
+
</button>
|
|
2299
|
+
`:h}
|
|
2300
|
+
</div>
|
|
2301
|
+
|
|
2302
|
+
${V(t.shouldShowCVV&&this.isSelected()&&!this.isEditMode,()=>c`<primer-vault-cvv-input
|
|
2303
|
+
.paymentMethod="${this.paymentMethod}"
|
|
2304
|
+
></primer-vault-cvv-input>`,()=>h)}
|
|
2142
2305
|
</div>
|
|
2143
|
-
`}})}};
|
|
2306
|
+
`}})}};ve.styles=[w,Pn],s([b({context:Q,subscribe:!0}),p({type:Object,attribute:!1,hasChanged(t,r){return t?.cvvRecapture!==r?.cvvRecapture}})],ve.prototype,"vaultManagerContext",2),s([b({context:Re,subscribe:!0}),p({type:Object,attribute:!1,hasChanged(t,r){return t?.selectedVaultedPaymentMethod?.id!==r?.selectedVaultedPaymentMethod?.id}})],ve.prototype,"vaultItemContext",2),s([b({context:W,subscribe:!0}),p({type:Object})],ve.prototype,"headlessUtils",2),s([p({type:Object,attribute:!1})],ve.prototype,"paymentMethod",2),s([p({type:Boolean,reflect:!0})],ve.prototype,"isEditMode",2),ve=s([y("primer-vault-payment-method-item"),$()],ve);var Tn=f`
|
|
2144
2307
|
:host {
|
|
2145
2308
|
display: block;
|
|
2146
2309
|
width: 100%;
|
|
@@ -2170,21 +2333,21 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
|
|
|
2170
2333
|
.edit-button.active {
|
|
2171
2334
|
color: var(--primer-color-brand);
|
|
2172
2335
|
}
|
|
2173
|
-
`;var
|
|
2336
|
+
`;var Ge=class extends v{constructor(){super(...arguments);this.isEditMode=!1;this.hasPaymentMethods=!1}toggleEditMode(){this.dispatchEvent(new CustomEvent("toggle-edit-mode",{detail:!this.isEditMode,bubbles:!0,composed:!0}))}render(){return c`
|
|
2174
2337
|
<div class="vault-manager-header">
|
|
2175
|
-
<h3>${
|
|
2338
|
+
<h3>${A("previouslyUsed",{id:"previouslyUsed"})}</h3>
|
|
2176
2339
|
|
|
2177
|
-
${this.hasPaymentMethods?
|
|
2340
|
+
${this.hasPaymentMethods?c`
|
|
2178
2341
|
<primer-button
|
|
2179
2342
|
class="edit-button ${this.isEditMode?"active":""}"
|
|
2180
2343
|
@click=${this.toggleEditMode}
|
|
2181
|
-
aria-label=${this.isEditMode?
|
|
2344
|
+
aria-label=${this.isEditMode?A("confirm",{id:"confirm"}):A("editPaymentMethods",{id:"editPaymentMethods"})}
|
|
2182
2345
|
>
|
|
2183
|
-
${this.isEditMode?
|
|
2346
|
+
${this.isEditMode?c`<primer-icon name="checkmark" size="sm"></primer-icon>`:c`<primer-icon name="pencil" size="sm"></primer-icon>`}
|
|
2184
2347
|
</primer-button>
|
|
2185
|
-
`:
|
|
2348
|
+
`:h}
|
|
2186
2349
|
</div>
|
|
2187
|
-
`}};
|
|
2350
|
+
`}};Ge.styles=[w,Tn],s([p({type:Boolean})],Ge.prototype,"isEditMode",2),s([p({type:Boolean})],Ge.prototype,"hasPaymentMethods",2),Ge=s([y("primer-vault-manager-header"),$()],Ge);var wn=f`
|
|
2188
2351
|
:host {
|
|
2189
2352
|
display: block;
|
|
2190
2353
|
width: 100%;
|
|
@@ -2255,10 +2418,10 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
|
|
|
2255
2418
|
opacity: 0.7;
|
|
2256
2419
|
cursor: not-allowed;
|
|
2257
2420
|
}
|
|
2258
|
-
`;var
|
|
2421
|
+
`;var Ce=class extends v{constructor(){super(...arguments);this.isDeleting=!1;this.paymentMethodId="";this.paymentMethodName="";this.vaultManager=null}handleConfirmClick(){this.dispatchEvent(new CustomEvent("confirm-delete",{bubbles:!0,composed:!0}))}handleCancelClick(){this.dispatchEvent(new CustomEvent("cancel-delete",{bubbles:!0,composed:!0}))}render(){let t=this.paymentMethodName;return c`
|
|
2259
2422
|
<div class="delete-confirmation">
|
|
2260
2423
|
<div class="delete-message">
|
|
2261
|
-
<p class="delete-text">${
|
|
2424
|
+
<p class="delete-text">${t}</p>
|
|
2262
2425
|
</div>
|
|
2263
2426
|
<div class="delete-actions">
|
|
2264
2427
|
<button
|
|
@@ -2266,18 +2429,18 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
|
|
|
2266
2429
|
@click=${this.handleConfirmClick}
|
|
2267
2430
|
?disabled=${this.isDeleting}
|
|
2268
2431
|
>
|
|
2269
|
-
${this.isDeleting?
|
|
2432
|
+
${this.isDeleting?A("deleting",{id:"deleting"}):A("confirmVaultedPaymentMethodDeletion",{id:"confirmVaultedPaymentMethodDeletion"})}
|
|
2270
2433
|
</button>
|
|
2271
2434
|
<button
|
|
2272
2435
|
class="delete-cancel"
|
|
2273
2436
|
@click=${this.handleCancelClick}
|
|
2274
2437
|
?disabled=${this.isDeleting}
|
|
2275
2438
|
>
|
|
2276
|
-
${
|
|
2439
|
+
${A("cancel",{id:"cancel"})}
|
|
2277
2440
|
</button>
|
|
2278
2441
|
</div>
|
|
2279
2442
|
</div>
|
|
2280
|
-
`}};
|
|
2443
|
+
`}};Ce.styles=[w,wn],s([p({type:Boolean})],Ce.prototype,"isDeleting",2),s([p({type:String})],Ce.prototype,"paymentMethodId",2),s([p({type:String})],Ce.prototype,"paymentMethodName",2),s([b({context:Q,subscribe:!0})],Ce.prototype,"vaultManager",2),Ce=s([y("primer-vault-delete-confirmation"),$()],Ce);var kn=f`
|
|
2281
2444
|
:host {
|
|
2282
2445
|
display: block;
|
|
2283
2446
|
width: 100%;
|
|
@@ -2292,13 +2455,13 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
|
|
|
2292
2455
|
.empty-state p {
|
|
2293
2456
|
margin: 0;
|
|
2294
2457
|
}
|
|
2295
|
-
`;var
|
|
2458
|
+
`;var wt=class extends v{render(){return c`
|
|
2296
2459
|
<div class="empty-state">
|
|
2297
2460
|
<p>
|
|
2298
|
-
${
|
|
2461
|
+
${A("savedPaymentMethodsEmpty",{id:"savedPaymentMethodsEmpty"})}
|
|
2299
2462
|
</p>
|
|
2300
2463
|
</div>
|
|
2301
|
-
`}};
|
|
2464
|
+
`}};wt.styles=[w,kn],wt=s([y("primer-vault-empty-state"),$()],wt);var In=f`
|
|
2302
2465
|
:host {
|
|
2303
2466
|
display: block;
|
|
2304
2467
|
width: 100%;
|
|
@@ -2344,7 +2507,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
|
|
|
2344
2507
|
.error-message button:hover {
|
|
2345
2508
|
background-color: rgba(0, 0, 0, 0.05);
|
|
2346
2509
|
}
|
|
2347
|
-
`;var
|
|
2510
|
+
`;var pt=class extends v{constructor(){super(...arguments);this.errorMessage=""}handleDismiss(){this.dispatchEvent(new CustomEvent("close-error",{bubbles:!0,composed:!0}))}render(){return c`
|
|
2348
2511
|
<div class="error-message">
|
|
2349
2512
|
<div class="error-content">
|
|
2350
2513
|
<primer-icon
|
|
@@ -2356,16 +2519,16 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
|
|
|
2356
2519
|
</div>
|
|
2357
2520
|
<button
|
|
2358
2521
|
@click=${this.handleDismiss}
|
|
2359
|
-
aria-label=${
|
|
2522
|
+
aria-label=${A("closeErrorMessage",{id:"closeErrorMessage"})}
|
|
2360
2523
|
>
|
|
2361
2524
|
<primer-icon name="close" size="sm"></primer-icon>
|
|
2362
2525
|
</button>
|
|
2363
2526
|
</div>
|
|
2364
|
-
`}};
|
|
2527
|
+
`}};pt.styles=[w,In],s([p({type:String})],pt.prototype,"errorMessage",2),pt=s([y("primer-vault-error-message"),$()],pt);var Nn=f`
|
|
2365
2528
|
:host {
|
|
2366
2529
|
display: contents;
|
|
2367
2530
|
}
|
|
2368
|
-
`;var
|
|
2531
|
+
`;var te=class extends v{constructor(){super(...arguments);this._userAssignedProps=new Set;this._internalButtonText="";this.headlessInstance=null;this.sdkState=null;this.vaultItemContext=null;this.vaultManager=null;this.clientOptions=null;this.variant="primary";this.disabled=!1;this.handleClick=async t=>{if(t.preventDefault(),!this.isButtonDisabled)try{await this.vaultManager?.startVaultedPaymentFlow()}catch(r){let o=new CustomEvent("primer-vault-payment-error",{bubbles:!0,composed:!0,detail:{error:r}});this.dispatchEvent(o)}}}get buttonText(){return this._userAssignedProps.has("buttonText")?this._internalButtonText:A("pay",{id:"pay"})}set buttonText(t){let r=this.buttonText;t!==""?(this._userAssignedProps.add("buttonText"),this._internalButtonText=t):(this._userAssignedProps.delete("buttonText"),this._internalButtonText=""),this.requestUpdate("buttonText",r)}get isButtonDisabled(){return!!(this.disabled||!this.vaultItemContext?.selectedVaultedPaymentMethod||this.vaultManager?.isLoading)}render(){let t=this.clientOptions?.submitButton?.amountVisible?this.headlessInstance?.getUIOrderAmount():null,r=t?` ${t}`:h;return c`
|
|
2369
2532
|
<primer-button
|
|
2370
2533
|
buttonType="submit"
|
|
2371
2534
|
variant=${this.variant}
|
|
@@ -2376,7 +2539,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
|
|
|
2376
2539
|
>
|
|
2377
2540
|
${this.buttonText}${r}
|
|
2378
2541
|
</primer-button>
|
|
2379
|
-
`}};
|
|
2542
|
+
`}};te.styles=[w,Nn],s([p({type:String})],te.prototype,"buttonText",1),s([b({context:W,subscribe:!0}),p({type:Object})],te.prototype,"headlessInstance",2),s([b({context:j,subscribe:!0}),p()],te.prototype,"sdkState",2),s([b({context:Re,subscribe:!0}),p({type:Object,attribute:!1,hasChanged(t,r){return t?.selectedVaultedPaymentMethod?.id!==r?.selectedVaultedPaymentMethod?.id}})],te.prototype,"vaultItemContext",2),s([b({context:Q,subscribe:!0}),p({type:Object,attribute:!1})],te.prototype,"vaultManager",2),s([b({context:Le,subscribe:!0}),p({type:Object,attribute:!1,hasChanged(t,r){return t?.submitButton?.amountVisible!==r?.submitButton?.amountVisible}})],te.prototype,"clientOptions",2),s([p({type:String})],te.prototype,"variant",2),s([p({type:Boolean})],te.prototype,"disabled",2),te=s([y("primer-vault-payment-submit"),$()],te);var Ln=f`
|
|
2380
2543
|
:host {
|
|
2381
2544
|
display: block;
|
|
2382
2545
|
margin-top: var(--primer-space-medium);
|
|
@@ -2385,21 +2548,21 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
|
|
|
2385
2548
|
.cvv-input-container {
|
|
2386
2549
|
margin-bottom: var(--primer-space-medium);
|
|
2387
2550
|
}
|
|
2388
|
-
`;var
|
|
2551
|
+
`;var re=class extends v{constructor(){super();this.vaultManagerFormContext=null;this.vaultManagerCvvContext=null;this.computedStyles=null;this.paymentMethod=null;this.cvvError=null;this.cvvInputIsDirty=!1;this.cvvInputIsBlurred=!1;this.cvvInput=null;this._setupCVVIframe=new D(this,{task:async([t,r])=>!t||!r||t.paymentMethodType!=="PAYMENT_CARD"||!t.paymentInstrumentData?.network||r.createCvvInput===null?L:{network:t.paymentInstrumentData.network,createCvvInput:r.createCvvInput},args:()=>[this.paymentMethod,this.vaultManagerFormContext]});this.cvvContainerId=`cvv-container-${Math.random().toString(36).substring(2,9)}`,new D(this,{task:async([t])=>{if(!t)return L;await this.updateComplete;let r=this.renderRoot.querySelector(`#${this.cvvContainerId}`);if(!r)return;let o=Gr(this.computedStyles),n=o?{input:{base:o}}:void 0,l={cardNetwork:t.network,container:r,name:"cvv",placeholder:"123",style:n};this.cvvInput=await t.createCvvInput?.(l)??null,this.cvvInput&&(this.cvvInput.focus(),this.cvvError=this.cvvInput.metadata.error||null,this.vaultManagerCvvContext?.setCvvInput(this.cvvInput),this.cvvInput.addListener("change",()=>{this.onCvvInputChange()}),this.cvvInput.addListener("blur",()=>{this.onBlur()}))},args:()=>[this._setupCVVIframe.value]})}disconnectedCallback(){super.disconnectedCallback(),this.cvvInput&&(this.cvvInput.remove(),this.cvvInput=null,this.cvvError=null,this.vaultManagerCvvContext?.setCvvInput(null))}onCvvInputChange(){!this.cvvInput||!this.vaultManagerCvvContext||(this.cvvInputIsDirty=!0,this.cvvError=this.cvvInput.metadata.error||null)}onBlur(){this.cvvInput&&(this.cvvInputIsBlurred=!0,this.cvvError=this.cvvInput.metadata.error||null)}render(){return this._setupCVVIframe.render({error:()=>h,complete:()=>c`
|
|
2389
2552
|
<div class="cvv-input-container">
|
|
2390
2553
|
<primer-input-wrapper
|
|
2391
2554
|
.hasError=${!!this.cvvError&&(this.vaultManagerCvvContext?.formIsDirty||this.cvvInputIsDirty&&this.cvvInputIsBlurred)}
|
|
2392
2555
|
>
|
|
2393
2556
|
<primer-input-label slot="label">CVV</primer-input-label>
|
|
2394
2557
|
<div slot="input" id="${this.cvvContainerId}"></div>
|
|
2395
|
-
${V(this.cvvError&&(this.vaultManagerCvvContext?.formIsDirty||this.cvvInputIsDirty&&this.cvvInputIsBlurred),()=>
|
|
2558
|
+
${V(this.cvvError&&(this.vaultManagerCvvContext?.formIsDirty||this.cvvInputIsDirty&&this.cvvInputIsBlurred),()=>c`
|
|
2396
2559
|
<primer-input-error slot="error">
|
|
2397
2560
|
${this.cvvError}
|
|
2398
2561
|
</primer-input-error>
|
|
2399
2562
|
`)}
|
|
2400
2563
|
</primer-input-wrapper>
|
|
2401
2564
|
</div>
|
|
2402
|
-
`})}};
|
|
2565
|
+
`})}};re.styles=[w,Ln],s([b({context:Q,subscribe:!0}),p({type:Object,attribute:!1,hasChanged(t,r){return t?.createCvvInput!==r?.createCvvInput}})],re.prototype,"vaultManagerFormContext",2),s([b({context:Re,subscribe:!0}),p({type:Object,attribute:!1})],re.prototype,"vaultManagerCvvContext",2),s([b({context:$e,subscribe:!0}),p()],re.prototype,"computedStyles",2),s([p({type:Object})],re.prototype,"paymentMethod",2),s([I()],re.prototype,"cvvError",2),s([I()],re.prototype,"cvvInputIsDirty",2),s([I()],re.prototype,"cvvInputIsBlurred",2),s([I()],re.prototype,"cvvInput",2),re=s([y("primer-vault-cvv-input"),$()],re);var $n=f`
|
|
2403
2566
|
:host {
|
|
2404
2567
|
display: block;
|
|
2405
2568
|
margin-top: var(--primer-space-medium);
|
|
@@ -2419,37 +2582,36 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
|
|
|
2419
2582
|
justify-content: center;
|
|
2420
2583
|
align-items: center;
|
|
2421
2584
|
}
|
|
2422
|
-
`;var
|
|
2585
|
+
`;var ct=class extends v{constructor(){super(...arguments);this.vaultManager=null}render(){return this.vaultManager?.isLoading?h:!this.vaultManager||!this.vaultManager.enabled?c`<slot name="other-payments"></slot>`:c`
|
|
2423
2586
|
<div class="other-payment-methods-container">
|
|
2424
2587
|
<primer-collapsable
|
|
2425
2588
|
buttonVariant="secondary"
|
|
2426
|
-
.expanded="${this.
|
|
2427
|
-
.header="${
|
|
2428
|
-
@expanded-changed="${this.handleExpandedChanged}"
|
|
2589
|
+
.expanded="${this.vaultManager?.vaultedPaymentMethods.length===0}"
|
|
2590
|
+
.header="${A("navigateToPaymentMethods",{id:"navigateToPaymentMethods"})}"
|
|
2429
2591
|
>
|
|
2430
2592
|
<div class="other-payment-methods-content">
|
|
2431
2593
|
<slot name="other-payments"></slot>
|
|
2432
2594
|
</div>
|
|
2433
2595
|
</primer-collapsable>
|
|
2434
2596
|
</div>
|
|
2435
|
-
`}};
|
|
2597
|
+
`}};ct.styles=[$n],s([b({context:Q,subscribe:!0}),p({type:Object,attribute:!1})],ct.prototype,"vaultManager",2),ct=s([y("primer-show-other-payments")],ct);var pr=class extends v{render(){return c`
|
|
2436
2598
|
<primer-checkout-state type="complete"></primer-checkout-state>
|
|
2437
|
-
`}};
|
|
2599
|
+
`}};pr=s([y("primer-checkout-complete")],pr);var kt=class extends v{constructor(){super(...arguments);this.sdkState=null}render(){return c`
|
|
2438
2600
|
<primer-checkout-state
|
|
2439
2601
|
type="failure"
|
|
2440
2602
|
description=${this.sdkState?.error?.message||""}
|
|
2441
2603
|
></primer-checkout-state>
|
|
2442
|
-
`}};
|
|
2604
|
+
`}};s([b({context:j,subscribe:!0}),p()],kt.prototype,"sdkState",2),kt=s([y("primer-checkout-error")],kt);var Rn=f`
|
|
2443
2605
|
:host {
|
|
2444
2606
|
display: block;
|
|
2445
2607
|
width: 100%;
|
|
2446
2608
|
}
|
|
2447
|
-
`;var
|
|
2609
|
+
`;var qe=class extends v{constructor(){super(...arguments);this.showProcessingErrors=!0}get shouldShowError(){return!this.sdkState||this.sdkState.isProcessing?!1:!!(this.sdkState.failure&&this.showProcessingErrors)}render(){return this.sdkState?c`
|
|
2448
2610
|
<primer-error-message
|
|
2449
|
-
message="${
|
|
2611
|
+
message="${A(this.sdkState.failure?.message??"",{id:"tokenizationError"})}"
|
|
2450
2612
|
?visible="${this.shouldShowError}"
|
|
2451
2613
|
></primer-error-message>
|
|
2452
|
-
`:
|
|
2614
|
+
`:h}};qe.styles=[Rn],s([b({context:j,subscribe:!0}),I()],qe.prototype,"sdkState",2),s([p({type:Boolean,attribute:"show-processing-errors"})],qe.prototype,"showProcessingErrors",2),qe=s([y("primer-error-message-container")],qe);async function M0(){xa(),Aa()}export{pe as AchPayment,de as Button,Ee as CardForm,At as CardFormCVV,me as CardFormCardNetworkSelector,xt as CardFormCardNumber,Ue as CardFormError,_t as CardFormExpiry,St as CardFormName,ce as CardFormSubmit,ae as Collapsable,Ct as Dialog,fe as DynamicPayment,ye as ErrorMessage,qe as ErrorMessageContainer,Hr as InitializedPayments,F as Input,He as InputLabel,Te as InputWrapper,ke as NativePayment,ze as PaymentMethod,ot as Portal,pr as PrimerCheckoutComplete,le as PrimerCheckoutComponent,kt as PrimerCheckoutFailure,Ye as PrimerCheckoutState,we as PrimerIcon,ee as PrimerKlarna,Fe as PrimerMain,be as RedirectPayment,ct as ShowOtherPayments,Pe as Spinner,re as VaultCvvInput,Ce as VaultDeleteConfirmation,wt as VaultEmptyState,pt as VaultErrorMessage,ue as VaultManager,Ge as VaultManagerHeader,ve as VaultPaymentMethodItem,te as VaultPaymentSubmit,nl as injectDarkTheme,al as injectLightTheme,xa as injectLoaderStyles,Aa as injectThemeStyles,M0 as loadPrimer};
|
|
2453
2615
|
/*! Bundled license information:
|
|
2454
2616
|
|
|
2455
2617
|
@lit/context/lib/context-request-event.js:
|
|
@@ -2752,4 +2914,32 @@ lit-html/directives/ref.js:
|
|
|
2752
2914
|
* Copyright 2020 Google LLC
|
|
2753
2915
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
2754
2916
|
*)
|
|
2917
|
+
|
|
2918
|
+
lit-html/lit-html.js:
|
|
2919
|
+
(**
|
|
2920
|
+
* @license
|
|
2921
|
+
* Copyright 2017 Google LLC
|
|
2922
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
2923
|
+
*)
|
|
2924
|
+
|
|
2925
|
+
lit-html/directive.js:
|
|
2926
|
+
(**
|
|
2927
|
+
* @license
|
|
2928
|
+
* Copyright 2017 Google LLC
|
|
2929
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
2930
|
+
*)
|
|
2931
|
+
|
|
2932
|
+
lit-html/directive-helpers.js:
|
|
2933
|
+
(**
|
|
2934
|
+
* @license
|
|
2935
|
+
* Copyright 2020 Google LLC
|
|
2936
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
2937
|
+
*)
|
|
2938
|
+
|
|
2939
|
+
lit-html/async-directive.js:
|
|
2940
|
+
(**
|
|
2941
|
+
* @license
|
|
2942
|
+
* Copyright 2017 Google LLC
|
|
2943
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
2944
|
+
*)
|
|
2755
2945
|
*/
|