@primer-io/primer-js 0.1.7 → 0.1.9
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/chunks/{ar.5AY75F5J.js → ar.6MRFCKX4.js} +1 -1
- package/dist/chunks/{bg.2EL2HTYI.js → bg.HRSMU7Y5.js} +1 -1
- package/dist/chunks/{ca.WZI7CBFW.js → ca.3FSHJL7U.js} +1 -1
- package/dist/chunks/chunk.I6YWTZRK.js +1 -0
- package/dist/chunks/{cs.GBLLNC3E.js → cs.WAO4WFS3.js} +1 -1
- package/dist/chunks/{da.CDEFQG44.js → da.4OFYGDVA.js} +1 -1
- package/dist/chunks/{de.UHURA2HV.js → de.3FZS52IN.js} +1 -1
- package/dist/chunks/{el.BY5NGYDF.js → el.A4R7VG5T.js} +1 -1
- package/dist/chunks/en-GB.ILZ7SXSW.js +1 -0
- package/dist/chunks/en.7GZJA7MN.js +1 -0
- package/dist/chunks/{es-AR.EYNC6EAZ.js → es-AR.QKHDL4JV.js} +1 -1
- package/dist/chunks/{es-MX.OIO2YURF.js → es-MX.GG7MJMG2.js} +1 -1
- package/dist/chunks/{es.CNNIJYLX.js → es.FEZ6BF3S.js} +1 -1
- package/dist/chunks/{et-EE.4ZF6CLB6.js → et-EE.FJLPTMF3.js} +1 -1
- package/dist/chunks/{fi-FI.4ZXWRRYI.js → fi-FI.DM5R27A5.js} +1 -1
- package/dist/chunks/{fr.TZM5I4K2.js → fr.YZV52NTA.js} +1 -1
- package/dist/chunks/{he.DWEZBG4A.js → he.6SCF3XZZ.js} +1 -1
- package/dist/chunks/{hr.BV4PC324.js → hr.PPDZ7AAS.js} +1 -1
- package/dist/chunks/{hu.MTEKSS3J.js → hu.6WOPSGLW.js} +1 -1
- package/dist/chunks/{id.SJSTOPSC.js → id.NS22WGWL.js} +1 -1
- package/dist/chunks/{it.IISTMHN5.js → it.42TO3R4G.js} +1 -1
- package/dist/chunks/{ja.IBQ3ID5C.js → ja.UEGHEUAP.js} +1 -1
- package/dist/chunks/{ko.KZVQLI4V.js → ko.HTMDY6RY.js} +1 -1
- package/dist/chunks/{lt-LT.RKBB7CZ6.js → lt-LT.4U3GBQTQ.js} +1 -1
- package/dist/chunks/{lt.TLM7OCXP.js → lt.73ME4TDM.js} +1 -1
- package/dist/chunks/{lv-LV.H5TJC2T4.js → lv-LV.JRWO2BF6.js} +1 -1
- package/dist/chunks/{lv.G4SRVBAC.js → lv.KROS45TV.js} +1 -1
- package/dist/chunks/{ms.ATTITA66.js → ms.HE3SWJFQ.js} +1 -1
- package/dist/chunks/{nb.5EE7XOA7.js → nb.TR6TEKBY.js} +1 -1
- package/dist/chunks/{nl.TY2SYTKZ.js → nl.V5QP6OXL.js} +1 -1
- package/dist/chunks/{nl_NL.GB5BQ5PG.js → nl_NL.FCVWIF3Y.js} +1 -1
- package/dist/chunks/{pl.5PRBSG4K.js → pl.DQZDG7LR.js} +1 -1
- package/dist/chunks/{pt-BR.5XRZB5WW.js → pt-BR.CR4ROBVE.js} +1 -1
- package/dist/chunks/{pt.TA5H5JUJ.js → pt.JRWVFJPX.js} +1 -1
- package/dist/chunks/{ro.PSZKGHRP.js → ro.NRMWYY3F.js} +1 -1
- package/dist/chunks/{ru.3QZY7ZIT.js → ru.OWSKHXVO.js} +1 -1
- package/dist/chunks/{sk.FAQFYLGM.js → sk.YGBRNNWT.js} +1 -1
- package/dist/chunks/{sl.QRSCQXJP.js → sl.IRTDTNTP.js} +1 -1
- package/dist/chunks/{sr-RS.TKMMG7FK.js → sr-RS.AWGLHKVE.js} +1 -1
- package/dist/chunks/{sv.HZ3E6V5F.js → sv.O4BXFGNF.js} +1 -1
- package/dist/chunks/{th.AY6M42B4.js → th.GZCEBRT2.js} +1 -1
- package/dist/chunks/{tr.TFKBPYMO.js → tr.ZDILMEEO.js} +1 -1
- package/dist/chunks/{uk-UA.3TU67RSI.js → uk-UA.JUUBOEW3.js} +1 -1
- package/dist/chunks/{vi.NLXELMXV.js → vi.IN7CFTLL.js} +1 -1
- package/dist/chunks/zf.YT47ULXR.js +1 -0
- package/dist/chunks/{zh-CN.VEOQJ3EU.js → zh-CN.RBRAS4RP.js} +1 -1
- package/dist/chunks/{zh-HK.ZEXSW7FF.js → zh-HK.4CK7LBWM.js} +1 -1
- package/dist/chunks/{zh-TW.MMVWEQMZ.js → zh-TW.374TMWNJ.js} +1 -1
- package/dist/custom-elements.json +1477 -1342
- package/dist/primer-loader.d.ts +815 -741
- package/dist/primer-loader.js +923 -922
- package/dist/primer-react-wrappers.js +387 -386
- package/dist/web-types.json +1 -1
- package/package.json +9 -1
- package/dist/chunks/chunk.G45OCYEN.js +0 -1
- package/dist/chunks/en-GB.UBLLAUVW.js +0 -1
- package/dist/chunks/en.BKAVPUID.js +0 -1
- package/dist/chunks/zf.U5XPENNR.js +0 -1
package/dist/primer-loader.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
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]`,
|
|
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`
|
|
1
|
+
import{a as hi,b as s}from"./chunks/chunk.I6YWTZRK.js";var Dt=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],a=r?.items??[];this.updateCardNetworksState({detectedCardNetwork:o,selectableCardNetworks:a,isLoading:!1})}};var tt=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 ke=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 rt=class{constructor(e,t,r,o){if(this.subscribe=!1,this.provided=!1,this.value=void 0,this.t=(a,n)=>{this.unsubscribe&&(this.unsubscribe!==n&&(this.provided=!1,this.unsubscribe()),this.subscribe||this.unsubscribe()),this.value=a,this.host.requestUpdate(),this.provided&&!this.subscribe||(this.provided=!0,this.callback&&this.callback(a,n)),this.unsubscribe=n},this.host=e,t.context!==void 0){let a=t;this.context=a.context,this.callback=a.callback,this.subscribe=a.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 ke(this.context,this.host,this.t,this.subscribe))}};var Vt=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 Ir=class extends Event{constructor(e,t){super("context-provider",{bubbles:!0,composed:!0}),this.context=e,this.contextTarget=t}},N=class extends Vt{constructor(e,t,r){super(t.context!==void 0?t.initialValue:r),this.onContextRequest=o=>{if(o.context!==this.context)return;let a=o.contextTarget??o.composedPath()[0];a!==this.host&&(o.stopPropagation(),this.addCallback(o.callback,a,o.subscribe))},this.onProviderRequest=o=>{if(o.context!==this.context||(o.contextTarget??o.composedPath()[0])===this.host)return;let a=new Set;for(let[n,{consumerHost:m}]of this.subscriptions)a.has(n)||(a.add(n),m.dispatchEvent(new ke(this.context,m,n,!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 Ir(this.context,this.host))}};function f({context:i,subscribe:e}){return(t,r)=>{typeof r=="object"?r.addInitializer(function(){new rt(this,{context:i,callback:o=>{t.set.call(this,o)},subscribe:e})}):t.constructor.addInitializer(o=>{new rt(o,{context:i,callback:a=>{o[r]=a},subscribe:e})})}}var Ht="cardNetworksContext";var Pe="clientOptionsContext";var we="computedStylesContext";var D="headlessInstanceContext";var Yt="klarnaCategoriesContext";var F="managerContext";var it="paymentMethodsContext";var $="sdkStateContext";var B="vaultManagerContext";var Te="vaultManagerCvvContext";var A=class A{static log(e,...t){A.enabled&&console.log(`%c${A.brandTag}%c ${e}`,A.brandStyle,A.styles.log,...t)}static info(e,...t){A.enabled&&console.info(`%c${A.brandTag}%c ${e}`,A.brandStyle,A.styles.info,...t)}static warn(e,...t){A.enabled&&console.warn(`%c${A.brandTag}%c ${e}`,A.brandStyle,A.styles.warn,...t)}static error(e,...t){A.enabled&&console.error(`%c${A.brandTag}%c ${e}`,A.brandStyle,A.styles.error,...t)}static debug(e,...t){A.enabled&&console.debug(`%c${A.brandTag}%c ${e}`,A.brandStyle,A.styles.debug,...t)}static table(e,t){A.enabled&&console.table(e,t)}static time(e){A.enabled&&console.time(`${A.brandTag} ${e}`)}static timeEnd(e){A.enabled&&console.timeEnd(`${A.brandTag} ${e}`)}};A.enabled=!0,A.defaultFont="font-family: Consolas, monospace; font-size: 12px;",A.brandTag="[PRIMER]",A.brandStyle="background: #24292e; color: #ffffff; padding: 2px 6px; border-radius: 3px; font-weight: bold; margin-right: 4px; "+A.defaultFont,A.styles={log:"color: #4CAF50; "+A.defaultFont,info:"color: #2196F3; "+A.defaultFont,warn:"color: #FF9800; "+A.defaultFont,error:"color: #F44336; "+A.defaultFont,debug:"color: #9C27B0; "+A.defaultFont};var S=A;function ga(i,e,t,r){let o=i,a=t;return{dispatch:n=>{let m=e(o,n,a);o=m,r(m)},getState:()=>Object.freeze({...o}),setCallbacks:n=>{a={...a,...n}}}}function ct(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 Ve=class{constructor(e,t,r,o,a=()=>{this.host.requestUpdate()}){this.host=e;this.stateHandler=a;this.host.addController(this),this._dispatcher=ga(t,r,o,n=>{this.stateHandler(n)})}get currentState(){return this._dispatcher.getState()}dispatch(e){this._dispatcher.dispatch(e)}setCallbacks(e){this._dispatcher.setCallbacks(e)}hostConnected(){}hostDisconnected(){}},zt=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 Ft={isSuccessful:!1,isProcessing:!1,isLoading:!1,error:null,failure:null},fa={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)=>(S.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:()=>Ft,RESET_ERROR:i=>({...i,error:null,failure:null})},va=ct(fa),Ut=class extends Ve{constructor(e){super(e,Ft,va,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&&(S.warn("Force completing loading state"),this.completeLoading())}};var Bt=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 N(e,{context:$,initialValue:Ft}),this.paymentMethodsProvider=new N(e,{context:it,initialValue:null}),this.paymentManagerProvider=new N(e,{context:F,initialValue:new Map}),this.cardNetworksContext=new N(e,{context:Ht,initialValue:null}),this.vaultManagerProvider=new N(e,{context:B,initialValue:null}),this.vaultManagerCvvProvider=new N(e,{context:Te,initialValue:null}),this.clientOptionsContext=new N(e,{context:Pe,initialValue:null}),this.klarnaCategoriesProvider=new N(e,{context:Yt,initialValue:{categories:[],isLoading:!0}}),this.headlessUtilsProvider=new N(e,{context:D,initialValue:null}),this.computedStylesProvider=new N(e,{context:we,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 He=class He{constructor(e){(this.host=e).addController(this)}processCustomStyles(e){try{let t=JSON.parse(e);this.applyStyles(t)}catch(t){S.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||S.warn(`Rejected potentially unsafe CSS value: ${e}`),r}getCssVarName(e){let t=He.cssVarCache.get(e);return t||(t="--"+e.replace(/([A-Z])/g,(r,o)=>"-"+o.toLowerCase()),He.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)){S.warn(`Skipping invalid CSS property name: ${r}`);continue}if(!this.isValidCssValue(o))continue;let a=this.getCssVarName(r);t.push([a,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 He.cssVarCache.keys()){let t=He.cssVarCache.get(e);t&&this.host.style.removeProperty(t)}}hostDisconnected(){}};He.cssVarCache=new Map;var Kt=He;var jt=globalThis,Gt=jt.ShadowRoot&&(jt.ShadyCSS===void 0||jt.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Nr=Symbol(),gi=new WeakMap,mt=class{constructor(e,t,r){if(this._$cssResult$=!0,r!==Nr)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(Gt&&e===void 0){let r=t!==void 0&&t.length===1;r&&(e=gi.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),r&&gi.set(t,e))}return e}toString(){return this.cssText}},fi=i=>new mt(typeof i=="string"?i:i+"",void 0,Nr),u=(i,...e)=>{let t=i.length===1?i[0]:e.reduce((r,o,a)=>r+(n=>{if(n._$cssResult$===!0)return n.cssText;if(typeof n=="number")return n;throw Error("Value passed to 'css' function must be a 'css' function result: "+n+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(o)+i[a+1],i[0]);return new mt(t,i,Nr)},Or=(i,e)=>{if(Gt)i.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of e){let r=document.createElement("style"),o=jt.litNonce;o!==void 0&&r.setAttribute("nonce",o),r.textContent=t.cssText,i.appendChild(r)}},qt=Gt?i=>i:i=>i instanceof CSSStyleSheet?(e=>{let t="";for(let r of e.cssRules)t+=r.cssText;return fi(t)})(i):i;var{is:ya,defineProperty:ba,getOwnPropertyDescriptor:xa,getOwnPropertyNames:Ca,getOwnPropertySymbols:Ea,getPrototypeOf:Aa}=Object,Le=globalThis,vi=Le.trustedTypes,_a=vi?vi.emptyScript:"",Ma=Le.reactiveElementPolyfillSupport,ut=(i,e)=>i,ht={toAttribute(i,e){switch(e){case Boolean:i=i?_a: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}},ot=(i,e)=>!ya(i,e),yi={attribute:!0,type:String,converter:ht,reflect:!1,hasChanged:ot};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),Le.litPropertyMetadata??(Le.litPropertyMetadata=new WeakMap);var pe=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=yi){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&&ba(this.prototype,e,o)}}static getPropertyDescriptor(e,t,r){let{get:o,set:a}=xa(this.prototype,e)??{get(){return this[t]},set(n){this[t]=n}};return{get(){return o?.call(this)},set(n){let m=o?.call(this);a.call(this,n),this.requestUpdate(e,m,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??yi}static _$Ei(){if(this.hasOwnProperty(ut("elementProperties")))return;let e=Aa(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(ut("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(ut("properties"))){let t=this.properties,r=[...Ca(t),...Ea(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(qt(o))}else e!==void 0&&t.push(qt(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 Or(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 a=(r.converter?.toAttribute!==void 0?r.converter:ht).toAttribute(t,r.type);this._$Em=e,a==null?this.removeAttribute(o):this.setAttribute(o,a),this._$Em=null}}_$AK(e,t){let r=this.constructor,o=r._$Eh.get(e);if(o!==void 0&&this._$Em!==o){let a=r.getPropertyOptions(o),n=typeof a.converter=="function"?{fromAttribute:a.converter}:a.converter?.fromAttribute!==void 0?a.converter:ht;this._$Em=o,this[o]=n.fromAttribute(t,a.type),this._$Em=null}}requestUpdate(e,t,r){if(e!==void 0){if(r??(r=this.constructor.getPropertyOptions(e)),!(r.hasChanged??ot)(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,a]of this._$Ep)this[o]=a;this._$Ep=void 0}let r=this.constructor.elementProperties;if(r.size>0)for(let[o,a]of r)a.wrapped!==!0||this._$AL.has(o)||this[o]===void 0||this.P(o,this[o],a)}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){}};pe.elementStyles=[],pe.shadowRootOptions={mode:"open"},pe[ut("elementProperties")]=new Map,pe[ut("finalized")]=new Map,Ma?.({ReactiveElement:pe}),(Le.reactiveElementVersions??(Le.reactiveElementVersions=[])).push("2.0.4");var $e={INITIAL:0,PENDING:1,COMPLETE:2,ERROR:3},_=Symbol(),k=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??bi,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 a=!1;try{t=await this.v(e,{signal:this.q.signal})}catch(n){a=!0,r=n}if(this.p===o){if(t===_)this.i=0;else{if(a===!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)}}},bi=(i,e)=>i===e||i.length===e.length&&i.every((t,r)=>!ot(t,e[r]));var Sa={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:()=>xi},ka={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:()=>Ci},Pa=ct(Sa),wa=ct(ka),xi={enabled:!1,isLoading:!1,isUpdating:!1,cvvRecapture:!1,vaultedPaymentMethods:[],createCvvInput:null,deleteVaultedPaymentMethod:()=>Promise.resolve(),startVaultedPaymentFlow:()=>Promise.resolve()},Ci={cvvInput:null,formIsDirty:!1,setCvvInput:()=>{},selectedVaultedPaymentMethod:null,setSelectedVaultedPaymentMethod:()=>{}},Rr=class extends Ve{constructor(e,t){super(e,xi,Pa,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"})}},Dr=class extends Ve{constructor(e,t){super(e,Ci,wa,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"})}},gt=class extends zt{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(a){S.error("VaultManagerController: Error starting vaulted payment flow",a),this.coreController.setError(a instanceof Error?a: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 Rr(t,{deleteVaultedPaymentMethod:this.deleteVaultedPaymentMethod.bind(this),startVaultedPaymentFlow:this.startVaultedPaymentFlow.bind(this),createCvvInput:this.createCvvInput.bind(this)}),this.itemController=new Dr(t,{setCvvInput:this.setCvvInput.bind(this),setSelectedVaultedPaymentMethod:this.setSelectedVaultedPaymentMethod.bind(this)}),this.addController(this.coreController),this.addController(this.itemController),new k(this.host,{task:async([r,o])=>{if(!r||!o?.vaultEnabled)return this.coreController.disable(),_;this.coreController.setLoading(!0);try{this.coreController.initializeVaultManager(r,o.vaultEnabled,!!o.captureVaultedCardCvv),this.itemController.initializeCvv(r.createCvvInput),await this.fetchVaultedPaymentMethods(!0),S.log("VaultManagerController: Vault initialized successfully",{coreState:this.coreController.currentState,cvvState:this.itemController.currentState})}catch(a){S.error("VaultManagerController: Failed to initialize vault",a),this.coreController.setError(a instanceof Error?a: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 S.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 ft="lit-localize-status";var Ei=i=>typeof i!="string"&&"strTag"in i,Wt=(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 vt=i=>Ei(i)?Wt(i.strings,i.values):i;var v=vt,Ai=!1;function Vr(i){if(Ai)throw new Error("lit-localize can only be configured once");v=i,Ai=!0}var Hr=class{constructor(e){this.__litLocalizeEventHandler=t=>{t.detail.status==="ready"&&this.host.requestUpdate()},this.host=e}hostConnected(){window.addEventListener(ft,this.__litLocalizeEventHandler)}hostDisconnected(){window.removeEventListener(ft,this.__litLocalizeEventHandler)}},Ta=i=>i.addController(new Hr(i)),_i=Ta;var M=()=>(i,e)=>(i.addInitializer(_i),i);var yt=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 ce=[];for(let i=0;i<256;i++)ce[i]=(i>>4&15).toString(16)+(i&15).toString(16);function Mi(i){let e=0,t=8997,r=0,o=33826,a=0,n=40164,m=0,p=52210;for(let b=0;b<i.length;b++)t^=i.charCodeAt(b),e=t*435,r=o*435,a=n*435,m=p*435,a+=t<<8,m+=o<<8,r+=e>>>16,t=e&65535,a+=r>>>16,o=r&65535,p=m+(a>>>16)&65535,n=a&65535;return ce[p>>8]+ce[p&255]+ce[n>>8]+ce[n&255]+ce[o>>8]+ce[o&255]+ce[t>>8]+ce[t&255]}var La="",$a="h",Ia="s";function Si(i,e){return(e?$a:Ia)+Mi(typeof i=="string"?i:i.join(La))}var ki=new WeakMap,Pi=new Map;function wi(i,e,t){if(i){let r=t?.id??Na(e),o=i[r];if(o){if(typeof o=="string")return o;if("strTag"in o)return Wt(o.strings,e.values,o.values);{let a=ki.get(o);return a===void 0&&(a=o.values,ki.set(o,a)),{...o,values:a.map(n=>e.values[n])}}}}return vt(e)}function Na(i){let e=typeof i=="string"?i:i.strings,t=Pi.get(e);return t===void 0&&(t=Si(e,typeof i!="string"&&!("strTag"in i)),Pi.set(e,t)),t}function Yr(i){window.dispatchEvent(new CustomEvent(ft,{detail:i}))}var Xt="",zr,Ti,Qt,Ur,Li,Ye=new yt;Ye.resolve();var Zt=0,$i=i=>(Vr((e,t)=>wi(Li,e,t)),Xt=Ti=i.sourceLocale,Qt=new Set(i.targetLocales),Qt.add(i.sourceLocale),Ur=i.loadLocale,{getLocale:Oa,setLocale:Ra}),Oa=()=>Xt,Ra=i=>{if(i===(zr??Xt))return Ye.promise;if(!Qt||!Ur)throw new Error("Internal error");if(!Qt.has(i))throw new Error("Invalid locale code");Zt++;let e=Zt;return zr=i,Ye.settled&&(Ye=new yt),Yr({status:"loading",loadingLocale:i}),(i===Ti?Promise.resolve({templates:void 0}):Ur(i)).then(r=>{Zt===e&&(Xt=i,zr=void 0,Li=r.templates,Yr({status:"ready",readyLocale:i}),Ye.resolve())},r=>{Zt===e&&(Yr({status:"error",errorLocale:i,errorMessage:r.toString()}),Ye.reject(r))}),Ye.promise};var Fr="en",Br=["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"],Ii="You must call `loadLocale` first to set up the localized template.",Ni,Jt,Oi=i=>{let e=$i({sourceLocale:Fr,targetLocales:Br,loadLocale:i});Ni=e.getLocale,Jt=e.setLocale};var Kr=i=>{Oi(i)},jr=i=>{if(!Jt)throw new Error(Ii);return Jt(i)};var bt=new Set(Br);bt.add(Fr);var Gr=i=>{if(typeof i!="string")return!1;if(i==="en")return!0;let e=i.replace("_","-");if(bt.has(e))return!0;let t=e.split("-")[0];return!!bt.has(t)},qr=i=>{if(i==="en")return"en-GB";let e=i.replace("_","-");if(bt.has(e))return e;let t=e.split("-")[0];return bt.has(t)?t:"en-GB"};var Ct=globalThis,er=Ct.trustedTypes,Ri=er?er.createPolicy("lit-html",{createHTML:i=>i}):void 0,Zr="$lit$",me=`lit$${Math.random().toFixed(9).slice(2)}$`,Xr="?"+me,Da=`<${Xr}>`,Fe=document,Et=()=>Fe.createComment(""),At=i=>i===null||typeof i!="object"&&typeof i!="function",Qr=Array.isArray,Ui=i=>Qr(i)||typeof i?.[Symbol.iterator]=="function",Wr=`[
|
|
2
|
+
\f\r]`,xt=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Di=/-->/g,Vi=/>/g,ze=RegExp(`>|${Wr}(?:([^\\s"'>=/]+)(${Wr}*=${Wr}*(?:[^
|
|
3
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),Hi=/'/g,Yi=/"/g,Fi=/^(?:script|style|textarea|title)$/i,Jr=i=>(e,...t)=>({_$litType$:i,strings:e,values:t}),d=Jr(1),he=Jr(2),Kl=Jr(3),ue=Symbol.for("lit-noChange"),c=Symbol.for("lit-nothing"),zi=new WeakMap,Ue=Fe.createTreeWalker(Fe,129);function Bi(i,e){if(!Qr(i)||!i.hasOwnProperty("raw"))throw Error("invalid template strings array");return Ri!==void 0?Ri.createHTML(e):e}var Ki=(i,e)=>{let t=i.length-1,r=[],o,a=e===2?"<svg>":e===3?"<math>":"",n=xt;for(let m=0;m<t;m++){let p=i[m],b,E,y=-1,w=0;for(;w<p.length&&(n.lastIndex=w,E=n.exec(p),E!==null);)w=n.lastIndex,n===xt?E[1]==="!--"?n=Di:E[1]!==void 0?n=Vi:E[2]!==void 0?(Fi.test(E[2])&&(o=RegExp("</"+E[2],"g")),n=ze):E[3]!==void 0&&(n=ze):n===ze?E[0]===">"?(n=o??xt,y=-1):E[1]===void 0?y=-2:(y=n.lastIndex-E[2].length,b=E[1],n=E[3]===void 0?ze:E[3]==='"'?Yi:Hi):n===Yi||n===Hi?n=ze:n===Di||n===Vi?n=xt:(n=ze,o=void 0);let I=n===ze&&i[m+1].startsWith("/>")?" ":"";a+=n===xt?p+Da:y>=0?(r.push(b),p.slice(0,y)+Zr+p.slice(y)+me+I):p+me+(y===-2?m:I)}return[Bi(i,a+(i[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),r]},_t=class i{constructor({strings:e,_$litType$:t},r){let o;this.parts=[];let a=0,n=0,m=e.length-1,p=this.parts,[b,E]=Ki(e,t);if(this.el=i.createElement(b,r),Ue.currentNode=this.el.content,t===2||t===3){let y=this.el.content.firstChild;y.replaceWith(...y.childNodes)}for(;(o=Ue.nextNode())!==null&&p.length<m;){if(o.nodeType===1){if(o.hasAttributes())for(let y of o.getAttributeNames())if(y.endsWith(Zr)){let w=E[n++],I=o.getAttribute(y).split(me),de=/([.?@])?(.*)/.exec(w);p.push({type:1,index:a,name:de[2],strings:I,ctor:de[1]==="."?rr:de[1]==="?"?ir:de[1]==="@"?or:Ke}),o.removeAttribute(y)}else y.startsWith(me)&&(p.push({type:6,index:a}),o.removeAttribute(y));if(Fi.test(o.tagName)){let y=o.textContent.split(me),w=y.length-1;if(w>0){o.textContent=er?er.emptyScript:"";for(let I=0;I<w;I++)o.append(y[I],Et()),Ue.nextNode(),p.push({type:2,index:++a});o.append(y[w],Et())}}}else if(o.nodeType===8)if(o.data===Xr)p.push({type:2,index:a});else{let y=-1;for(;(y=o.data.indexOf(me,y+1))!==-1;)p.push({type:7,index:a}),y+=me.length-1}a++}}static createElement(e,t){let r=Fe.createElement("template");return r.innerHTML=e,r}};function Be(i,e,t=i,r){if(e===ue)return e;let o=r!==void 0?t._$Co?.[r]:t._$Cl,a=At(e)?void 0:e._$litDirective$;return o?.constructor!==a&&(o?._$AO?.(!1),a===void 0?o=void 0:(o=new a(i),o._$AT(i,t,r)),r!==void 0?(t._$Co??(t._$Co=[]))[r]=o:t._$Cl=o),o!==void 0&&(e=Be(i,o._$AS(i,e.values),o,r)),e}var tr=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??Fe).importNode(t,!0);Ue.currentNode=o;let a=Ue.nextNode(),n=0,m=0,p=r[0];for(;p!==void 0;){if(n===p.index){let b;p.type===2?b=new at(a,a.nextSibling,this,e):p.type===1?b=new p.ctor(a,p.name,p.strings,this,e):p.type===6&&(b=new ar(a,this,e)),this._$AV.push(b),p=r[++m]}n!==p?.index&&(a=Ue.nextNode(),n++)}return Ue.currentNode=Fe,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++}},at=class i{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,r,o){this.type=2,this._$AH=c,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=Be(this,e,t),At(e)?e===c||e==null||e===""?(this._$AH!==c&&this._$AR(),this._$AH=c):e!==this._$AH&&e!==ue&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):Ui(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!==c&&At(this._$AH)?this._$AA.nextSibling.data=e:this.T(Fe.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=_t.createElement(Bi(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===o)this._$AH.p(t);else{let a=new tr(o,this),n=a.u(this.options);a.p(t),this.T(n),this._$AH=a}}_$AC(e){let t=zi.get(e.strings);return t===void 0&&zi.set(e.strings,t=new _t(e)),t}k(e){Qr(this._$AH)||(this._$AH=[],this._$AR());let t=this._$AH,r,o=0;for(let a of e)o===t.length?t.push(r=new i(this.O(Et()),this.O(Et()),this,this.options)):r=t[o],r._$AI(a),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))}},Ke=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,r,o,a){this.type=1,this._$AH=c,this._$AN=void 0,this.element=e,this.name=t,this._$AM=o,this.options=a,r.length>2||r[0]!==""||r[1]!==""?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=c}_$AI(e,t=this,r,o){let a=this.strings,n=!1;if(a===void 0)e=Be(this,e,t,0),n=!At(e)||e!==this._$AH&&e!==ue,n&&(this._$AH=e);else{let m=e,p,b;for(e=a[0],p=0;p<a.length-1;p++)b=Be(this,m[r+p],t,p),b===ue&&(b=this._$AH[p]),n||(n=!At(b)||b!==this._$AH[p]),b===c?e=c:e!==c&&(e+=(b??"")+a[p+1]),this._$AH[p]=b}n&&!o&&this.j(e)}j(e){e===c?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},rr=class extends Ke{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===c?void 0:e}},ir=class extends Ke{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==c)}},or=class extends Ke{constructor(e,t,r,o,a){super(e,t,r,o,a),this.type=5}_$AI(e,t=this){if((e=Be(this,e,t,0)??c)===ue)return;let r=this._$AH,o=e===c&&r!==c||e.capture!==r.capture||e.once!==r.once||e.passive!==r.passive,a=e!==c&&(r===c||o);o&&this.element.removeEventListener(this.name,this,r),a&&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)}},ar=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){Be(this,e)}},ji={M:Zr,P:me,A:Xr,C:1,L:Ki,R:tr,D:Ui,V:Be,I:at,H:Ke,N:ir,U:or,B:rr,F:ar},Va=Ct.litHtmlPolyfillSupport;Va?.(_t,at),(Ct.litHtmlVersions??(Ct.litHtmlVersions=[])).push("3.2.1");var Gi=(i,e,t)=>{let r=t?.renderBefore??e,o=r._$litPart$;if(o===void 0){let a=t?.renderBefore??null;r._$litPart$=o=new at(e.insertBefore(Et(),a),a,void 0,t??{})}return o._$AI(i),o};var h=class extends pe{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=Gi(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return ue}};h._$litElement$=!0,h.finalized=!0,globalThis.litElementHydrateSupport?.({LitElement:h});var Ha=globalThis.litElementPolyfillSupport;Ha?.({LitElement:h});(globalThis.litElementVersions??(globalThis.litElementVersions=[])).push("4.1.1");var g=i=>(e,t)=>{t!==void 0?t.addInitializer(()=>{customElements.define(i,e)}):customElements.define(i,e)};var Ya={attribute:!0,type:String,converter:ht,reflect:!1,hasChanged:ot},za=(i=Ya,e,t)=>{let{kind:r,metadata:o}=t,a=globalThis.litPropertyMetadata.get(o);if(a===void 0&&globalThis.litPropertyMetadata.set(o,a=new Map),a.set(t.name,i),r==="accessor"){let{name:n}=t;return{set(m){let p=e.get.call(this);e.set.call(this,m),this.requestUpdate(n,p,i)},init(m){return m!==void 0&&this.P(n,void 0,i),m}}}if(r==="setter"){let{name:n}=t;return function(m){let p=this[n];e.call(this,m),this.requestUpdate(n,p,i)}}throw Error("Unsupported decorator location: "+r)};function l(i){return(e,t)=>typeof t=="object"?za(i,e,t):((r,o,a)=>{let n=o.hasOwnProperty(a);return o.constructor.createProperty(a,n?{...r,wrapped:!0}:r),n?Object.getOwnPropertyDescriptor(o,a):void 0})(i,e,t)}function C(i){return l({...i,state:!0,attribute:!1})}var je=(i,e,t)=>(t.configurable=!0,t.enumerable=!0,Reflect.decorate&&typeof e!="object"&&Object.defineProperty(i,e,t),t);function Ie(i,e){return(t,r,o)=>{let a=n=>n.renderRoot?.querySelector(i)??null;if(e){let{get:n,set:m}=typeof r=="object"?t:o??(()=>{let p=Symbol();return{get(){return this[p]},set(b){this[p]=b}}})();return je(t,r,{get(){let p=n.call(this);return p===void 0&&(p=a(this),(p!==null||this.hasUpdated)&&m.call(this,p)),p}})}return je(t,r,{get(){return a(this)}})}}function P(i,e,t){return i?e(i):t?.(i)}var x=u`
|
|
5
4
|
* {
|
|
6
5
|
box-sizing: border-box;
|
|
7
6
|
}
|
|
8
|
-
`,
|
|
7
|
+
`,qi=u`
|
|
9
8
|
:host {
|
|
10
9
|
display: block;
|
|
11
10
|
isolation: isolate;
|
|
@@ -14,14 +13,14 @@ import{a as $o,b as _s,c as Ro,d as s}from"./chunks/chunk.G45OCYEN.js";var Zi=_s
|
|
|
14
13
|
//Keep the CSS loader in the same position - check css-loader-inline.ts
|
|
15
14
|
min-height: 64px;
|
|
16
15
|
}
|
|
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
|
-
${
|
|
19
|
-
${
|
|
20
|
-
${
|
|
16
|
+
`;var Wi="https://sdk.primer.io/web/v2-latest/Primer.min.js";var sr=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 nr=typeof window<"u"&&typeof window.document<"u";function Ua(i){return document.querySelector(`script[src^="${i}"]`)}function Fa(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 Zi(i,e=!1){if(!nr)throw new Error("Cannot load script in server environment");let t=Ua(i)??Fa(i,e);return new Promise((r,o)=>{t.onload=()=>{r()},t.onerror=()=>{o()},t.parentNode||document.head.appendChild(t)})}var lr=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 k(e,{args:()=>[this.host.clientToken,this.host.options],task:this.initializeHeadless()}),new k(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&&(S.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(),S.info("SDK instance cleaned up")}catch(e){S.error("Error cleaning up SDK instance:",e)}this.currentSdkInstance=null}async _loadV2Sdk(e=Wi){if(window.Primer&&typeof window.Primer.preloadPrimer=="function"){S.info("SDK already loaded, skipping load script"),await window.Primer.preloadPrimer();return}await Zi(e),await window.Primer.preloadPrimer()}initializeHeadless(){return async([e,t])=>{if(this.isDisconnected)return S.warn("Component disconnected, aborting SDK initialization"),_;if(!e||!t)return _;this.cleanupResources();try{await this._loadV2Sdk();let{Primer:r}=window,o=await r.createHeadless(e,{...t,onAvailablePaymentMethodsLoad:n=>{this.isDisconnected||(S.info("Configuration payment methods:",n),this.paymentsList=n)},onCheckoutComplete:({payment:n})=>{this.isDisconnected||(S.info("Payment completed:",n),this.host.sdkStateController.completeProcessing(),this.host.primerEventsController.dispatchOnCheckoutComplete(n))},onCheckoutFail:(n,m)=>{this.isDisconnected||(S.error("Payment failed:",n),this.host.sdkStateController.setFailure(n.code||"UNKNOWN_ERROR",n.message||"Unknown error occurred"),this.host.primerEventsController.dispatchOnCheckoutFailure(n,m.payment))},onBeforePaymentCreate:(n,m)=>{this.isDisconnected||(this.host.sdkStateController.startProcessing(),m?.continuePaymentCreation())},onPaymentMethodAction:(n,m)=>{this.isDisconnected||n==="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(),_;this.host.sdkContextController.setClientOptions(t),this.host.primerEventsController.dispatchCheckoutInitialized(o);let a=o.getSDKUtilities();return this.host.sdkContextController.setHeadlessUtils(a),this.host.vaultManagerController.initializeVaultManager(o.createVaultManager(),{vaultEnabled:t.vault?.enabled,captureVaultedCardCvv:!!a.getPaymentMethodConfiguration("PAYMENT_CARD")?.options.captureVaultedCardCvv}),o}catch(r){throw r instanceof Error&&(S.error("SDK initialization error:",r),this.host.sdkStateController.setError(r)),this.cleanupResources(),r}}}initializeLitContext(){return async([e,t])=>{if(this.isDisconnected)return _;if(!e||!t.length)return _;let r=new Map,o=new Map;try{for(let n of t){if(this.isDisconnected)break;let m=await this.initializePaymentMethodManager(n)();n&&m&&(r.set(n.type,n),o.set(n.type,m))}if(this.isDisconnected)return _;let a=new sr(r);return this.host.sdkContextController.setPaymentManagers(o),this.host.sdkContextController.setPaymentMethods(a),this.host.primerEventsController.dispatchPaymentMethods(a),S.info("Initialized payment methods:",a.toArray()),r}catch(a){if(a instanceof Error)throw this.host.sdkStateController.setError(a),a;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:a=>{this.isDisconnected||this.host.sdkContextController.setKlarnaCategories({categories:a,isLoading:!1})}});return o?{type:t,manager:o}:null}try{if(r==="CARD"){let a=await this.createPaymentMethodManager(t,{onCardNetworksChange:async n=>{this.isDisconnected||await this.host.cardNetworkController.processCardNetworkChangeEvent(n)},onCardNetworksLoading:()=>{this.isDisconnected||this.host.cardNetworkController.setCardNetworksLoading()}});return a?{type:t,manager:a}:null}let o=await this.createPaymentMethodManager(t);return o?{type:t,manager:o}:null}catch(o){return S.error(`Failed to initialize manager for ${t}:`,o),null}}}};var dr=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 Ba=hi({"../../localization/lit-localize/locales/ar.ts":()=>import("./chunks/ar.6MRFCKX4.js"),"../../localization/lit-localize/locales/bg.ts":()=>import("./chunks/bg.HRSMU7Y5.js"),"../../localization/lit-localize/locales/ca.ts":()=>import("./chunks/ca.3FSHJL7U.js"),"../../localization/lit-localize/locales/cs.ts":()=>import("./chunks/cs.WAO4WFS3.js"),"../../localization/lit-localize/locales/da.ts":()=>import("./chunks/da.4OFYGDVA.js"),"../../localization/lit-localize/locales/de.ts":()=>import("./chunks/de.3FZS52IN.js"),"../../localization/lit-localize/locales/el.ts":()=>import("./chunks/el.A4R7VG5T.js"),"../../localization/lit-localize/locales/en-GB.ts":()=>import("./chunks/en-GB.ILZ7SXSW.js"),"../../localization/lit-localize/locales/en.ts":()=>import("./chunks/en.7GZJA7MN.js"),"../../localization/lit-localize/locales/es-AR.ts":()=>import("./chunks/es-AR.QKHDL4JV.js"),"../../localization/lit-localize/locales/es-MX.ts":()=>import("./chunks/es-MX.GG7MJMG2.js"),"../../localization/lit-localize/locales/es.ts":()=>import("./chunks/es.FEZ6BF3S.js"),"../../localization/lit-localize/locales/et-EE.ts":()=>import("./chunks/et-EE.FJLPTMF3.js"),"../../localization/lit-localize/locales/fi-FI.ts":()=>import("./chunks/fi-FI.DM5R27A5.js"),"../../localization/lit-localize/locales/fr.ts":()=>import("./chunks/fr.YZV52NTA.js"),"../../localization/lit-localize/locales/he.ts":()=>import("./chunks/he.6SCF3XZZ.js"),"../../localization/lit-localize/locales/hr.ts":()=>import("./chunks/hr.PPDZ7AAS.js"),"../../localization/lit-localize/locales/hu.ts":()=>import("./chunks/hu.6WOPSGLW.js"),"../../localization/lit-localize/locales/id.ts":()=>import("./chunks/id.NS22WGWL.js"),"../../localization/lit-localize/locales/it.ts":()=>import("./chunks/it.42TO3R4G.js"),"../../localization/lit-localize/locales/ja.ts":()=>import("./chunks/ja.UEGHEUAP.js"),"../../localization/lit-localize/locales/ko.ts":()=>import("./chunks/ko.HTMDY6RY.js"),"../../localization/lit-localize/locales/lt-LT.ts":()=>import("./chunks/lt-LT.4U3GBQTQ.js"),"../../localization/lit-localize/locales/lt.ts":()=>import("./chunks/lt.73ME4TDM.js"),"../../localization/lit-localize/locales/lv-LV.ts":()=>import("./chunks/lv-LV.JRWO2BF6.js"),"../../localization/lit-localize/locales/lv.ts":()=>import("./chunks/lv.KROS45TV.js"),"../../localization/lit-localize/locales/ms.ts":()=>import("./chunks/ms.HE3SWJFQ.js"),"../../localization/lit-localize/locales/nb.ts":()=>import("./chunks/nb.TR6TEKBY.js"),"../../localization/lit-localize/locales/nl.ts":()=>import("./chunks/nl.V5QP6OXL.js"),"../../localization/lit-localize/locales/nl_NL.ts":()=>import("./chunks/nl_NL.FCVWIF3Y.js"),"../../localization/lit-localize/locales/pl.ts":()=>import("./chunks/pl.DQZDG7LR.js"),"../../localization/lit-localize/locales/pt-BR.ts":()=>import("./chunks/pt-BR.CR4ROBVE.js"),"../../localization/lit-localize/locales/pt.ts":()=>import("./chunks/pt.JRWVFJPX.js"),"../../localization/lit-localize/locales/ro.ts":()=>import("./chunks/ro.NRMWYY3F.js"),"../../localization/lit-localize/locales/ru.ts":()=>import("./chunks/ru.OWSKHXVO.js"),"../../localization/lit-localize/locales/sk.ts":()=>import("./chunks/sk.YGBRNNWT.js"),"../../localization/lit-localize/locales/sl.ts":()=>import("./chunks/sl.IRTDTNTP.js"),"../../localization/lit-localize/locales/sr-RS.ts":()=>import("./chunks/sr-RS.AWGLHKVE.js"),"../../localization/lit-localize/locales/sv.ts":()=>import("./chunks/sv.O4BXFGNF.js"),"../../localization/lit-localize/locales/th.ts":()=>import("./chunks/th.GZCEBRT2.js"),"../../localization/lit-localize/locales/tr.ts":()=>import("./chunks/tr.ZDILMEEO.js"),"../../localization/lit-localize/locales/uk-UA.ts":()=>import("./chunks/uk-UA.JUUBOEW3.js"),"../../localization/lit-localize/locales/vi.ts":()=>import("./chunks/vi.IN7CFTLL.js"),"../../localization/lit-localize/locales/zf.ts":()=>import("./chunks/zf.YT47ULXR.js"),"../../localization/lit-localize/locales/zh-CN.ts":()=>import("./chunks/zh-CN.RBRAS4RP.js"),"../../localization/lit-localize/locales/zh-HK.ts":()=>import("./chunks/zh-HK.4CK7LBWM.js"),"../../localization/lit-localize/locales/zh-TW.ts":()=>import("./chunks/zh-TW.374TMWNJ.js")});Kr(i=>Ba(`../../localization/lit-localize/locales/${i}.ts`));var pr={LOADER_DISABLED:"loader-disabled",CUSTOM_STYLES:"custom-styles",CLIENT_TOKEN:"client-token",JS_INIT:"js-initialized"},X=class extends h{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 Bt(this),this.sdkStateController=new Ut(this),this.primerEventsController=new tt(this),this.styleProcessingController=new Kt(this),this.vaultManagerController=new gt(this),this.cardNetworkController=new Dt(this),this.achPaymentEventsController=new dr(this),new lr(this)}set jsInitialized(t){this.requestUpdate(),this._jsInitialized=t}get jsInitialized(){return this._jsInitialized}attributeChangedCallback(t,r,o){t===pr.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&&(Gr(this.options?.locale)?this.locale=qr(this.options?.locale):S.warn("\u{1F30E}\u2757 Unsupported locale provided:",this.options?.locale,"- Falling back to default locale `en-GB`")),jr(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&&(S.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,a=!r&&!o;return d`
|
|
17
|
+
${P(r,()=>c)}
|
|
18
|
+
${P(o,()=>d`<primer-checkout-error></primer-checkout-error>`)}
|
|
19
|
+
${P(a,()=>d`
|
|
21
20
|
<slot name="main" @slotchange=${this.onSlotChange}></slot>
|
|
22
|
-
${
|
|
23
|
-
`,()=>
|
|
24
|
-
`}addEventListener(t,r,o){super.addEventListener(t,r,o)}removeEventListener(t,r,o){super.removeEventListener(t,r,o)}};
|
|
21
|
+
${P(this.hasAssignedContent,()=>c,()=>d`<primer-main></primer-main>`)}
|
|
22
|
+
`,()=>c)}
|
|
23
|
+
`}addEventListener(t,r,o){super.addEventListener(t,r,o)}removeEventListener(t,r,o){super.removeEventListener(t,r,o)}};X.styles=[x,qi],s([l({type:String,attribute:pr.CUSTOM_STYLES})],X.prototype,"customStyles",2),s([l({type:String,attribute:pr.CLIENT_TOKEN})],X.prototype,"clientToken",2),s([l({type:Object})],X.prototype,"options",2),s([l({type:Boolean,reflect:!0,attribute:pr.JS_INIT})],X.prototype,"_jsInitialized",2),s([Ie("slot")],X.prototype,"defaultSlot",2),s([C()],X.prototype,"previousLoadingState",2),X=s([M(),g("primer-checkout")],X);function Ka(i){return document.querySelector(`#${i}`)}function ja(i,e){let t=document.createElement("style");return t.textContent=i,t.id=e,t}function Mt(i,e,t=!0){if(!nr||Ka(e))return;let o=ja(i,e);t&&document.head.firstChild?document.head.insertBefore(o,document.head.firstChild):document.head.appendChild(o)}var Xi=`
|
|
25
24
|
@keyframes primer-css-spinner-rotate {
|
|
26
25
|
0% {
|
|
27
26
|
transform: rotate(0deg);
|
|
@@ -57,7 +56,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
|
|
|
57
56
|
animation: primer-css-spinner-rotate 1.2s linear infinite;
|
|
58
57
|
z-index: 9999;
|
|
59
58
|
}
|
|
60
|
-
`;var
|
|
59
|
+
`;var Qi=`/**
|
|
61
60
|
* Do not edit directly, this file was auto-generated.
|
|
62
61
|
*/
|
|
63
62
|
|
|
@@ -165,7 +164,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
|
|
|
165
164
|
--primer-color-border-transparent-focus: var(--primer-color-focus);
|
|
166
165
|
--primer-color-border-transparent-loading: var(--primer-color-border-transparent-disabled);
|
|
167
166
|
}
|
|
168
|
-
`,
|
|
167
|
+
`,Ji=`/**
|
|
169
168
|
* Do not edit directly, this file was auto-generated.
|
|
170
169
|
*/
|
|
171
170
|
|
|
@@ -185,7 +184,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
|
|
|
185
184
|
--primer-color-blue-500: #3f93e4;
|
|
186
185
|
--primer-color-blue-900: #4aaeff;
|
|
187
186
|
}
|
|
188
|
-
`;var
|
|
187
|
+
`;var Ga="primer-light-theme-css",qa="primer-dark-theme-css";function ei(){Mt(Qi,Ga,!0)}function ti(){Mt(Ji,qa,!0)}function eo(){ei(),ti()}function to(){Mt(Xi,"primer-css-loader-styles",!1)}function ro(){eo()}function Wa(){ei()}function Za(){ti()}var io=u`
|
|
189
188
|
:host {
|
|
190
189
|
display: inline-flex;
|
|
191
190
|
align-items: center;
|
|
@@ -230,7 +229,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
|
|
|
230
229
|
transform: rotate(360deg);
|
|
231
230
|
}
|
|
232
231
|
}
|
|
233
|
-
`;var
|
|
232
|
+
`;var ri={small:16,medium:24,large:32},oe=class extends h{constructor(){super(...arguments);this.color="var(--primer-color-loader)";this.size="medium";this.compact=!1}getSize(){if(this.size in ri)return ri[this.size];let t=parseInt(this.size,10);return isNaN(t)?ri.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`),d`
|
|
234
233
|
<div class="spinner-container ${this.compact?"compact":""}">
|
|
235
234
|
<svg
|
|
236
235
|
class="spinner"
|
|
@@ -249,7 +248,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
|
|
|
249
248
|
/>
|
|
250
249
|
</svg>
|
|
251
250
|
</div>
|
|
252
|
-
`}};
|
|
251
|
+
`}};oe.styles=[io],s([l({type:String})],oe.prototype,"color",2),s([l({type:String})],oe.prototype,"size",2),s([l({type:Boolean})],oe.prototype,"compact",2),oe=s([g("primer-spinner")],oe);var cr={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},St=i=>(...e)=>({_$litDirective$:i,values:e}),st=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 V=St(class extends st{constructor(i){if(super(i),i.type!==cr.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 ue}});var oo=u`
|
|
253
252
|
* {
|
|
254
253
|
box-sizing: border-box;
|
|
255
254
|
}
|
|
@@ -314,15 +313,15 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
|
|
|
314
313
|
border-color: var(--primer-color-border-outlined-disabled);
|
|
315
314
|
cursor: not-allowed;
|
|
316
315
|
}
|
|
317
|
-
`;var
|
|
316
|
+
`;var ae=class extends h{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 a=o.querySelector("primer-input");if(a)return a}return null}render(){let t={"input-slot":!0,"focus-within":this.focusWithin};return d`
|
|
318
317
|
<div class="input-wrapper">
|
|
319
318
|
<slot name="label"></slot>
|
|
320
|
-
<div class="${
|
|
319
|
+
<div class="${V(t)}" @click="${this.handleWrapperClick}">
|
|
321
320
|
<slot name="input"></slot>
|
|
322
321
|
</div>
|
|
323
322
|
<slot name="error"></slot>
|
|
324
323
|
</div>
|
|
325
|
-
`}};
|
|
324
|
+
`}};ae.styles=[oo],s([l({type:Boolean})],ae.prototype,"focusWithin",2),s([l({type:Boolean,reflect:!0,attribute:"has-error"})],ae.prototype,"hasError",2),s([Ie('slot[name="input"]')],ae.prototype,"inputSlot",2),ae=s([g("primer-input-wrapper")],ae);var ao=u`
|
|
326
325
|
:host {
|
|
327
326
|
display: inline-block;
|
|
328
327
|
font-weight: var(--primer-typography-body-small-weight);
|
|
@@ -336,7 +335,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
|
|
|
336
335
|
:host([disabled]) {
|
|
337
336
|
color: var(--primer-color-text-disabled);
|
|
338
337
|
}
|
|
339
|
-
`;var
|
|
338
|
+
`;var ge=class extends h{constructor(){super(...arguments);this.for="";this.disabled=!1}render(){return d`<label for=${this.for}><slot></slot></label>`}};ge.styles=[ao],s([l({type:String,reflect:!0})],ge.prototype,"for",2),s([l({type:Boolean,reflect:!0})],ge.prototype,"disabled",2),ge=s([g("primer-input-label")],ge);var so=u`
|
|
340
339
|
:host {
|
|
341
340
|
display: contents;
|
|
342
341
|
}
|
|
@@ -503,19 +502,19 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
|
|
|
503
502
|
:host([variant='tertiary'][loading]) primer-spinner {
|
|
504
503
|
transform: scale(0.85);
|
|
505
504
|
}
|
|
506
|
-
`;var
|
|
505
|
+
`;var G=class extends h{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?c:d`
|
|
507
506
|
<primer-icon
|
|
508
507
|
name="checkmark"
|
|
509
508
|
size="sm"
|
|
510
509
|
color="var(--primer-color-icon-primary)"
|
|
511
510
|
></primer-icon>
|
|
512
|
-
`}renderSpinner(){if(!this.loading)return
|
|
511
|
+
`}renderSpinner(){if(!this.loading)return c;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)"),d`
|
|
513
512
|
<primer-spinner
|
|
514
513
|
size="small"
|
|
515
514
|
color="${t}"
|
|
516
515
|
compact
|
|
517
516
|
></primer-spinner>
|
|
518
|
-
`}render(){return
|
|
517
|
+
`}render(){return d`
|
|
519
518
|
<button
|
|
520
519
|
type=${this.buttonType}
|
|
521
520
|
?disabled=${this.disabled||this.loading}
|
|
@@ -530,7 +529,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
|
|
|
530
529
|
</span>
|
|
531
530
|
${this.renderCheckmark()}
|
|
532
531
|
</button>
|
|
533
|
-
`}};
|
|
532
|
+
`}};G.styles=[x,so],s([l({type:String,reflect:!0})],G.prototype,"variant",2),s([l({type:Boolean,reflect:!0})],G.prototype,"disabled",2),s([l({type:Boolean,reflect:!0})],G.prototype,"loading",2),s([l({type:String,attribute:"type"})],G.prototype,"buttonType",2),s([l({type:String,reflect:!0})],G.prototype,"selectionState",2),s([l({type:Boolean,reflect:!0})],G.prototype,"selectable",2),G=s([g("primer-button")],G);var no=u`
|
|
534
533
|
:host {
|
|
535
534
|
display: contents;
|
|
536
535
|
}
|
|
@@ -546,7 +545,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
|
|
|
546
545
|
display: block;
|
|
547
546
|
font-family: var(--primer-typography-body-small-font);
|
|
548
547
|
}
|
|
549
|
-
`;var
|
|
548
|
+
`;var fe=class extends h{constructor(){super(...arguments);this.for="";this.active=!0}render(){return d`
|
|
550
549
|
<span
|
|
551
550
|
class="error"
|
|
552
551
|
role="alert"
|
|
@@ -555,17 +554,17 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
|
|
|
555
554
|
>
|
|
556
555
|
<slot></slot>
|
|
557
556
|
</span>
|
|
558
|
-
`}};
|
|
557
|
+
`}};fe.styles=[no],s([l({type:String,reflect:!0})],fe.prototype,"for",2),s([l({type:Boolean,reflect:!0})],fe.prototype,"active",2),fe=s([g("primer-input-error")],fe);var lo={pencil:he`
|
|
559
558
|
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
560
559
|
<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
560
|
</svg>
|
|
562
|
-
`,trash:
|
|
561
|
+
`,trash:he`
|
|
563
562
|
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
564
563
|
<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
564
|
<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
565
|
<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
566
|
</svg>
|
|
568
|
-
`,"successful-check":
|
|
567
|
+
`,"successful-check":he`
|
|
569
568
|
<svg
|
|
570
569
|
viewBox="0 0 56 56"
|
|
571
570
|
fill="none"
|
|
@@ -580,7 +579,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
|
|
|
580
579
|
/>
|
|
581
580
|
</g>
|
|
582
581
|
</svg>
|
|
583
|
-
`,"failure-icon":
|
|
582
|
+
`,"failure-icon":he`
|
|
584
583
|
<svg
|
|
585
584
|
viewBox="0 0 40 40"
|
|
586
585
|
fill="none"
|
|
@@ -592,27 +591,27 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
|
|
|
592
591
|
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
592
|
/>
|
|
594
593
|
</svg>
|
|
595
|
-
`,"payment-card":
|
|
594
|
+
`,"payment-card":he`
|
|
596
595
|
<svg width="28" height="21" viewBox="0 0 28 21" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
597
596
|
<rect y="0.748047" width="28" height="20" rx="2" fill="#E0E0E0"/>
|
|
598
597
|
<rect y="6.74805" width="28" height="4" fill="#212121"/>
|
|
599
598
|
<rect x="19" y="13.748" width="6" height="4" rx="0.933333" fill="white"/>
|
|
600
599
|
</svg>
|
|
601
|
-
`,"chevron-down":
|
|
600
|
+
`,"chevron-down":he`
|
|
602
601
|
<svg width="8" height="6" viewBox="0 0 8 6" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
603
602
|
<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:
|
|
603
|
+
</svg>`,checkmark:he`
|
|
605
604
|
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
606
605
|
<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
606
|
</svg>
|
|
608
|
-
`,close:
|
|
607
|
+
`,close:he`
|
|
609
608
|
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" fill="none">
|
|
610
609
|
<path
|
|
611
610
|
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
611
|
fill="#212121"
|
|
613
612
|
/>
|
|
614
613
|
</svg>
|
|
615
|
-
`};var
|
|
614
|
+
`};var po=u`
|
|
616
615
|
:host {
|
|
617
616
|
display: inline-block;
|
|
618
617
|
line-height: 0; /* so you don’t get extra space around the icon */
|
|
@@ -654,11 +653,11 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
|
|
|
654
653
|
/* --internal used for abstracting away the icon component */
|
|
655
654
|
fill: var(--internal-icon-color, currentColor);
|
|
656
655
|
}
|
|
657
|
-
`;var
|
|
656
|
+
`;var se=class extends h{constructor(){super(...arguments);this.color="var(--primer-color-icon-primary)";this.size="lg"}render(){let t=this.name?lo[this.name]:null;return d`
|
|
658
657
|
<div style="--internal-icon-color: ${this.color}">
|
|
659
|
-
${t||
|
|
658
|
+
${t||d`<slot></slot>`}
|
|
660
659
|
</div>
|
|
661
|
-
`}};
|
|
660
|
+
`}};se.styles=[po],s([l({type:String,reflect:!0})],se.prototype,"color",2),s([l({type:String,reflect:!0})],se.prototype,"size",2),s([l({reflect:!0})],se.prototype,"name",2),se=s([g("primer-icon")],se);var co=u`
|
|
662
661
|
:host {
|
|
663
662
|
display: flex;
|
|
664
663
|
flex-direction: column;
|
|
@@ -687,7 +686,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
|
|
|
687
686
|
line-height: var(--primer-typography-body-medium-line-height);
|
|
688
687
|
letter-spacing: var(--primer-typography-body-medium-letter-spacing);
|
|
689
688
|
}
|
|
690
|
-
`;var
|
|
689
|
+
`;var ve=class extends h{constructor(){super(...arguments);this.type="complete"}render(){return this.type==="complete"?d`
|
|
691
690
|
<!-- Successful view -->
|
|
692
691
|
<primer-icon
|
|
693
692
|
size="lg"
|
|
@@ -699,7 +698,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
|
|
|
699
698
|
<p class="secondary">
|
|
700
699
|
You'll be redirected to the order confirmation page soon.
|
|
701
700
|
</p>
|
|
702
|
-
`:
|
|
701
|
+
`:d`
|
|
703
702
|
<primer-icon
|
|
704
703
|
size="lg"
|
|
705
704
|
name="failure-icon"
|
|
@@ -707,8 +706,8 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
|
|
|
707
706
|
>
|
|
708
707
|
</primer-icon>
|
|
709
708
|
<p>Payment failed</p>
|
|
710
|
-
${this.description?
|
|
711
|
-
`}};
|
|
709
|
+
${this.description?d`<p class="secondary">${this.description}</p>`:d`<p class="secondary">Something went wrong.</p>`}
|
|
710
|
+
`}};ve.styles=[co],s([l({type:String,reflect:!0})],ve.prototype,"type",2),s([l({type:String,reflect:!0})],ve.prototype,"description",2),ve=s([g("primer-checkout-state")],ve);var mo=u`
|
|
712
711
|
:host {
|
|
713
712
|
display: contents;
|
|
714
713
|
}
|
|
@@ -739,7 +738,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
|
|
|
739
738
|
:host([disabled]) input::placeholder {
|
|
740
739
|
color: var(--primer-color-text-disabled);
|
|
741
740
|
}
|
|
742
|
-
`;var
|
|
741
|
+
`;var Xa=["text","password","email","number","tel","url","search","date","time","datetime-local","month","week","color"];function Qa(i){return Xa.includes(i)}var T=class extends h{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 d`
|
|
743
742
|
<input
|
|
744
743
|
part="input"
|
|
745
744
|
class=${r}
|
|
@@ -764,7 +763,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
|
|
|
764
763
|
@blur=${this.handleBlur}
|
|
765
764
|
@invalid=${this.handleInvalid}
|
|
766
765
|
/>
|
|
767
|
-
`}addEventListener(t,r,o){super.addEventListener(t,r,o)}removeEventListener(t,r,o){super.removeEventListener(t,r,o)}};
|
|
766
|
+
`}addEventListener(t,r,o){super.addEventListener(t,r,o)}removeEventListener(t,r,o){super.removeEventListener(t,r,o)}};T.styles=[mo],s([Ie("input")],T.prototype,"inputElement",2),s([l({type:String,reflect:!0})],T.prototype,"value",2),s([l({type:String,reflect:!0})],T.prototype,"placeholder",2),s([l({type:Boolean,reflect:!0})],T.prototype,"disabled",2),s([l({type:String,reflect:!0})],T.prototype,"name",2),s([l({type:String,reflect:!0,converter:{fromAttribute:t=>!t||!Qa(t)?(t&&t!=="text"&&S.warn(`Invalid input type: ${t}. Defaulting to 'text'.`),"text"):t}})],T.prototype,"type",2),s([l({type:Boolean,reflect:!0})],T.prototype,"required",2),s([l({type:Boolean,reflect:!0})],T.prototype,"readonly",2),s([l({type:String,reflect:!0})],T.prototype,"pattern",2),s([l({type:Number,reflect:!0})],T.prototype,"minlength",2),s([l({type:Number,reflect:!0})],T.prototype,"maxlength",2),s([l({type:String,reflect:!0})],T.prototype,"min",2),s([l({type:String,reflect:!0})],T.prototype,"max",2),s([l({type:String,reflect:!0})],T.prototype,"step",2),s([l({type:String,reflect:!0})],T.prototype,"autocomplete",2),s([l({type:String,reflect:!0})],T.prototype,"id",2),s([C()],T.prototype,"hasFocus",2),s([C()],T.prototype,"hasError",2),T=s([g("primer-input")],T);var uo=u`
|
|
768
767
|
:host {
|
|
769
768
|
display: block;
|
|
770
769
|
}
|
|
@@ -818,7 +817,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
|
|
|
818
817
|
transition: none;
|
|
819
818
|
}
|
|
820
819
|
}
|
|
821
|
-
`;var
|
|
820
|
+
`;var K=class extends h{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 d`
|
|
822
821
|
<div class="collapsable">
|
|
823
822
|
<primer-button
|
|
824
823
|
variant=${this.buttonVariant}
|
|
@@ -842,7 +841,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
|
|
|
842
841
|
</div>
|
|
843
842
|
</div>
|
|
844
843
|
</div>
|
|
845
|
-
`}};
|
|
844
|
+
`}};K.styles=[uo],s([l({type:String})],K.prototype,"header",2),s([l({type:Boolean})],K.prototype,"expanded",2),s([l({type:String})],K.prototype,"expandText",2),s([l({type:String})],K.prototype,"collapseText",2),s([l({type:String})],K.prototype,"ariaLabel",2),s([l({type:String})],K.prototype,"buttonVariant",2),s([C()],K.prototype,"isExpanded",2),K=s([g("primer-collapsable")],K);var ho=u`
|
|
846
845
|
:host {
|
|
847
846
|
display: block;
|
|
848
847
|
width: 100%;
|
|
@@ -902,10 +901,10 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
|
|
|
902
901
|
transform: none;
|
|
903
902
|
}
|
|
904
903
|
}
|
|
905
|
-
`;var
|
|
904
|
+
`;var ee=class extends h{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 c;let t={"error-message":!0,hidden:!this.visible};return d`
|
|
906
905
|
<div
|
|
907
906
|
part="error-message"
|
|
908
|
-
class=${
|
|
907
|
+
class=${V(t)}
|
|
909
908
|
aria-live="assertive"
|
|
910
909
|
aria-atomic="true"
|
|
911
910
|
>
|
|
@@ -918,11 +917,11 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
|
|
|
918
917
|
</div>
|
|
919
918
|
<div part="error-content" class="error-content">${this.message}</div>
|
|
920
919
|
</div>
|
|
921
|
-
`}};
|
|
920
|
+
`}};ee.styles=[ho],s([l({type:String})],ee.prototype,"message",2),s([l({type:Boolean,reflect:!0})],ee.prototype,"visible",2),s([l({type:String,reflect:!0})],ee.prototype,"role",2),s([C()],ee.prototype,"showMessage",2),ee=s([g("primer-error-message")],ee);var go=u`
|
|
922
921
|
:host {
|
|
923
922
|
display: none;
|
|
924
923
|
}
|
|
925
|
-
`;var
|
|
924
|
+
`;var Ne=class extends h{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 a=this.getContainer();o.forEach(n=>a.appendChild(n))}render(){return d`<slot @slotchange=${this._handleSlotChange}></slot>`}};Ne.styles=[go],s([C()],Ne.prototype,"id",2),Ne=s([g("primer-portal")],Ne);var fo=u`
|
|
926
925
|
:host {
|
|
927
926
|
display: contents;
|
|
928
927
|
}
|
|
@@ -951,9 +950,9 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
|
|
|
951
950
|
display: flex;
|
|
952
951
|
justify-content: flex-end;
|
|
953
952
|
}
|
|
954
|
-
`;var
|
|
953
|
+
`;var Ge=class extends h{_handleCloseClick(){this.dispatchEvent(new CustomEvent("primer-dialog-close",{bubbles:!0,composed:!0}))}render(){return d`
|
|
955
954
|
<div
|
|
956
|
-
class=${
|
|
955
|
+
class=${V({backdrop:!0})}
|
|
957
956
|
@click=${e=>{e.preventDefault()}}
|
|
958
957
|
>
|
|
959
958
|
<div class="dialog">
|
|
@@ -967,7 +966,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
|
|
|
967
966
|
</div>
|
|
968
967
|
</div>
|
|
969
968
|
</div>
|
|
970
|
-
`}};
|
|
969
|
+
`}};Ge.styles=[fo],Ge=s([g("primer-dialog")],Ge);var vo=u`
|
|
971
970
|
:host {
|
|
972
971
|
display: contents;
|
|
973
972
|
}
|
|
@@ -1159,38 +1158,38 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
|
|
|
1159
1158
|
background-color: var(--primer-color-background-outlined-default);
|
|
1160
1159
|
border-radius: var(--primer-radius-small);
|
|
1161
1160
|
}
|
|
1162
|
-
`;var
|
|
1161
|
+
`;var H=class extends h{constructor(){super(...arguments);this.paymentManagers=new Map;this.sdkState=null;this.headlessUtils=null;this.klarnaCategories=null;this.selectedCategory=null;this.isExpanded=!1;this.headerAriaLabel=v("pay_with",{id:"pay_with"});this._paymentMethodManagerTask=new k(this,{task:async([t,r])=>{if(!t||!r)return _;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){S.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){S.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?d`<div class="loading">
|
|
1163
1162
|
<primer-spinner size="small"></primer-spinner>
|
|
1164
|
-
</div>`:
|
|
1163
|
+
</div>`:d`
|
|
1165
1164
|
<div class="category-selection">
|
|
1166
|
-
${t.map(o=>
|
|
1165
|
+
${t.map(o=>d`
|
|
1167
1166
|
<button
|
|
1168
|
-
class=${
|
|
1167
|
+
class=${V({"category-button":!0,selected:o.id===this.selectedCategory})}
|
|
1169
1168
|
@click=${()=>{this.selectCategory(o.id)}}
|
|
1170
1169
|
>
|
|
1171
1170
|
${o.name}
|
|
1172
1171
|
</button>
|
|
1173
1172
|
`)}
|
|
1174
1173
|
</div>
|
|
1175
|
-
`}renderExpandedContent(){return
|
|
1174
|
+
`}renderExpandedContent(){return d`
|
|
1176
1175
|
${this.renderCategorySelection()}
|
|
1177
|
-
${this.selectedCategory?
|
|
1176
|
+
${this.selectedCategory?d`
|
|
1178
1177
|
<div
|
|
1179
1178
|
id="klarna-category-container"
|
|
1180
1179
|
class="klarna-category-container"
|
|
1181
1180
|
></div>
|
|
1182
|
-
`:
|
|
1181
|
+
`:c}
|
|
1183
1182
|
|
|
1184
1183
|
<button
|
|
1185
|
-
class=${
|
|
1184
|
+
class=${V({"klarna-pay-button":!0,loading:!!this.sdkState?.isProcessing,disabled:!this.selectedCategory})}
|
|
1186
1185
|
?disabled=${!this.selectedCategory||this.sdkState?.isProcessing}
|
|
1187
1186
|
@click=${()=>this.startKlarnaPayment()}
|
|
1188
1187
|
>
|
|
1189
|
-
${
|
|
1188
|
+
${v("confirm",{id:"confirm"})}
|
|
1190
1189
|
</button>
|
|
1191
|
-
`}render(){return this._paymentMethodManagerTask.render({error:t=>{let r=t instanceof Error?t.message:"Unknown error in Klarna";return
|
|
1190
|
+
`}render(){return this._paymentMethodManagerTask.render({error:t=>{let r=t instanceof Error?t.message:"Unknown error in Klarna";return d`<div class="error">
|
|
1192
1191
|
Error loading Klarna: ${r}
|
|
1193
|
-
</div>`},complete:({manager:t,klarnaIcon:r})=>t?
|
|
1192
|
+
</div>`},complete:({manager:t,klarnaIcon:r})=>t?d`
|
|
1194
1193
|
<div class="klarna-container ${this.isExpanded?"expanded":""}">
|
|
1195
1194
|
<div class="klarna-button-header">
|
|
1196
1195
|
<primer-button
|
|
@@ -1203,7 +1202,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
|
|
|
1203
1202
|
aria-label=${this.headerAriaLabel}
|
|
1204
1203
|
>
|
|
1205
1204
|
<img src=${r} alt="Klarna logo" />
|
|
1206
|
-
<span>${
|
|
1205
|
+
<span>${v("pay_with",{id:"pay_with"})} Klarna</span>
|
|
1207
1206
|
<span
|
|
1208
1207
|
class="klarna-accordion-icon ${this.isExpanded?"expanded":""}"
|
|
1209
1208
|
>
|
|
@@ -1220,19 +1219,19 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
|
|
|
1220
1219
|
</div>
|
|
1221
1220
|
</div>
|
|
1222
1221
|
</div>
|
|
1223
|
-
`:
|
|
1222
|
+
`:c})}};H.styles=[x,vo],s([f({context:F,subscribe:!0}),l()],H.prototype,"paymentManagers",2),s([f({context:$,subscribe:!0}),l()],H.prototype,"sdkState",2),s([f({context:D,subscribe:!0}),l({type:Object})],H.prototype,"headlessUtils",2),s([f({context:Yt,subscribe:!0}),l()],H.prototype,"klarnaCategories",2),s([C()],H.prototype,"selectedCategory",2),s([C()],H.prototype,"isExpanded",2),s([C()],H.prototype,"headerAriaLabel",2),s([Ie("#klarna-category-container")],H.prototype,"klarnaContainer",2),H=s([g("primer-klarna"),M()],H);var yo=u`
|
|
1224
1223
|
:host {
|
|
1225
1224
|
display: contents;
|
|
1226
1225
|
}
|
|
1227
|
-
`;var
|
|
1226
|
+
`;var ye=class extends h{constructor(){super(...arguments);this.type=void 0;this.paymentMethods=null}render(){if(!this.type)return c;let t=this.paymentMethods?.get(this.type);if(!t)return c;switch(t?.managerType){case"CARD":return d`<primer-card-form></primer-card-form>`;case"NATIVE":return d`<primer-native-payment
|
|
1228
1227
|
.paymentMethod=${t}
|
|
1229
|
-
></primer-native-payment>`;case"REDIRECT":return
|
|
1228
|
+
></primer-native-payment>`;case"REDIRECT":return d`<primer-redirect-payment
|
|
1230
1229
|
.paymentMethod=${t}
|
|
1231
|
-
></primer-redirect-payment>`;case"KLARNA":return
|
|
1230
|
+
></primer-redirect-payment>`;case"KLARNA":return d`<primer-klarna></primer-klarna>`;case"ACH":return d`
|
|
1232
1231
|
<primer-dynamic-payment
|
|
1233
1232
|
.paymentMethod=${t}
|
|
1234
1233
|
></primer-dynamic-payment>
|
|
1235
|
-
`;default:return
|
|
1234
|
+
`;default:return c}}};ye.styles=[yo],s([l({type:String})],ye.prototype,"type",2),s([f({context:it,subscribe:!0}),l()],ye.prototype,"paymentMethods",2),ye=s([g("primer-payment-method")],ye);var bo=u`
|
|
1236
1235
|
:host {
|
|
1237
1236
|
display: flex;
|
|
1238
1237
|
flex-direction: column;
|
|
@@ -1317,12 +1316,12 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
|
|
|
1317
1316
|
flex-direction: column;
|
|
1318
1317
|
}
|
|
1319
1318
|
}
|
|
1320
|
-
`;function
|
|
1319
|
+
`;function xo(){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 mr=class{constructor(e,t){this.formState=xo();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=xo(),this.host.requestUpdate()}isValidFieldName(e){return!!e&&["firstName","lastName","emailAddress"].includes(e)}hostConnected(){}hostDisconnected(){}};var q=class extends h{constructor(){super(...arguments);this.formController=new mr(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 k(this,{task:async([t])=>t!=="STRIPE_ACH"?_: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 d`
|
|
1321
1320
|
<h2>
|
|
1322
|
-
${
|
|
1321
|
+
${v("payWithAch",{id:"payWithAch"})}
|
|
1323
1322
|
</h2>
|
|
1324
1323
|
<p>
|
|
1325
|
-
${
|
|
1324
|
+
${v("stripe_ach_user_details_collection_subtitle_label",{id:"stripe_ach_user_details_collection_subtitle_label"})}
|
|
1326
1325
|
</p>
|
|
1327
1326
|
|
|
1328
1327
|
<form @submit=${r=>r.preventDefault()}>
|
|
@@ -1331,7 +1330,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
|
|
|
1331
1330
|
.hasError=${this.formController.hasError.firstName}
|
|
1332
1331
|
>
|
|
1333
1332
|
<primer-input-label slot="label">
|
|
1334
|
-
${
|
|
1333
|
+
${v("stripe_ach_user_details_collection_first_name_label",{id:"stripe_ach_user_details_collection_first_name_label"})}
|
|
1335
1334
|
</primer-input-label>
|
|
1336
1335
|
<primer-input
|
|
1337
1336
|
slot="input"
|
|
@@ -1341,14 +1340,14 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
|
|
|
1341
1340
|
?disabled=${this.isSubmitting}
|
|
1342
1341
|
></primer-input>
|
|
1343
1342
|
<primer-input-error slot="error">
|
|
1344
|
-
${this.formController.hasError.firstName?this.formController.formState.firstName.error:
|
|
1343
|
+
${this.formController.hasError.firstName?this.formController.formState.firstName.error:c}
|
|
1345
1344
|
</primer-input-error>
|
|
1346
1345
|
</primer-input-wrapper>
|
|
1347
1346
|
<primer-input-wrapper
|
|
1348
1347
|
.hasError=${this.formController.hasError.lastName}
|
|
1349
1348
|
>
|
|
1350
1349
|
<primer-input-label slot="label">
|
|
1351
|
-
${
|
|
1350
|
+
${v("stripe_ach_user_details_collection_last_name_label",{id:"stripe_ach_user_details_collection_last_name_label"})}
|
|
1352
1351
|
</primer-input-label>
|
|
1353
1352
|
<primer-input
|
|
1354
1353
|
slot="input"
|
|
@@ -1359,7 +1358,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
|
|
|
1359
1358
|
>
|
|
1360
1359
|
</primer-input>
|
|
1361
1360
|
<primer-input-error slot="error">
|
|
1362
|
-
${this.formController.hasError.lastName?this.formController.formState.lastName.error:
|
|
1361
|
+
${this.formController.hasError.lastName?this.formController.formState.lastName.error:c}
|
|
1363
1362
|
</primer-input-error>
|
|
1364
1363
|
</primer-input-wrapper>
|
|
1365
1364
|
</div>
|
|
@@ -1367,7 +1366,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
|
|
|
1367
1366
|
.hasError=${this.formController.hasError.emailAddress}
|
|
1368
1367
|
>
|
|
1369
1368
|
<primer-input-label slot="label">
|
|
1370
|
-
${
|
|
1369
|
+
${v("stripe_ach_user_details_collection_email_address_label",{id:"stripe_ach_user_details_collection_email_address_label"})}
|
|
1371
1370
|
</primer-input-label>
|
|
1372
1371
|
<primer-input
|
|
1373
1372
|
slot="input"
|
|
@@ -1378,11 +1377,11 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
|
|
|
1378
1377
|
?disabled=${this.isSubmitting}
|
|
1379
1378
|
></primer-input>
|
|
1380
1379
|
<primer-input-error slot="error">
|
|
1381
|
-
${this.formController.hasError.emailAddress?this.formController.formState.emailAddress.error:
|
|
1380
|
+
${this.formController.hasError.emailAddress?this.formController.formState.emailAddress.error:c}
|
|
1382
1381
|
</primer-input-error>
|
|
1383
1382
|
</primer-input-wrapper>
|
|
1384
1383
|
<p>
|
|
1385
|
-
${
|
|
1384
|
+
${v("stripe_ach_user_details_collection_data_usage_label",{id:"stripe_ach_user_details_collection_data_usage_label"})}
|
|
1386
1385
|
</p>
|
|
1387
1386
|
<primer-button
|
|
1388
1387
|
buttonType="submit"
|
|
@@ -1391,16 +1390,16 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
|
|
|
1391
1390
|
?disabled=${this.isSubmitting}
|
|
1392
1391
|
?loading=${this.isSubmitting}
|
|
1393
1392
|
>
|
|
1394
|
-
${
|
|
1393
|
+
${v("stripe_ach_user_details_collection_continue_button",{id:"stripe_ach_user_details_collection_continue_button"})}
|
|
1395
1394
|
</primer-button>
|
|
1396
1395
|
</form>
|
|
1397
|
-
`}renderMandate(){return
|
|
1396
|
+
`}renderMandate(){return d`
|
|
1398
1397
|
<h2>
|
|
1399
|
-
${
|
|
1398
|
+
${v("payWithAch",{id:"payWithAch"})}
|
|
1400
1399
|
</h2>
|
|
1401
1400
|
|
|
1402
1401
|
<p>
|
|
1403
|
-
${this.clientOptions?.stripe?.mandateData.fullMandateText??
|
|
1402
|
+
${this.clientOptions?.stripe?.mandateData.fullMandateText??v("stripe_ach_mandate_template_web",{id:"stripe_ach_mandate_template_web"}).replace(/\{merchantName\}/g,this.clientOptions?.stripe?.mandateData.merchantName??"Merchant")}
|
|
1404
1403
|
</p>
|
|
1405
1404
|
|
|
1406
1405
|
<div class="button-group">
|
|
@@ -1410,7 +1409,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
|
|
|
1410
1409
|
?disabled=${this.isSubmitting}
|
|
1411
1410
|
?loading=${this.isSubmitting}
|
|
1412
1411
|
>
|
|
1413
|
-
${
|
|
1412
|
+
${v("stripe_ach_mandate_accept_button",{id:"stripe_ach_mandate_accept_button"})}
|
|
1414
1413
|
</primer-button>
|
|
1415
1414
|
|
|
1416
1415
|
<primer-button
|
|
@@ -1418,10 +1417,10 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
|
|
|
1418
1417
|
@click=${this._handleDeclineMandate.bind(this)}
|
|
1419
1418
|
?disabled=${this.isSubmitting}
|
|
1420
1419
|
>
|
|
1421
|
-
${
|
|
1420
|
+
${v("stripe_ach_mandate_cancel_payment_button",{id:"stripe_ach_mandate_cancel_payment_button"})}
|
|
1422
1421
|
</primer-button>
|
|
1423
1422
|
</div>
|
|
1424
|
-
`}render(){return this._paymentMethodManagerTask.render({complete:t=>t?this.screen==="form"?this.renderForm(t):this.renderMandate():
|
|
1423
|
+
`}render(){return this._paymentMethodManagerTask.render({complete:t=>t?this.screen==="form"?this.renderForm(t):this.renderMandate():c})}};q.styles=[x,bo],s([l({type:Object})],q.prototype,"paymentMethod",2),s([f({context:F,subscribe:!0}),l({attribute:!1})],q.prototype,"paymentManagers",2),s([f({context:$,subscribe:!0}),l({attribute:!1})],q.prototype,"sdkState",2),s([f({context:Pe,subscribe:!0}),l({attribute:!1})],q.prototype,"clientOptions",2),s([C()],q.prototype,"screen",2),s([C()],q.prototype,"isSubmitting",2),q=s([g("primer-ach-payment"),M()],q);var Co=u`
|
|
1425
1424
|
:host {
|
|
1426
1425
|
height: calc(
|
|
1427
1426
|
var(--primer-typography-title-large-line-height) +
|
|
@@ -1457,7 +1456,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
|
|
|
1457
1456
|
img {
|
|
1458
1457
|
height: 100%;
|
|
1459
1458
|
}
|
|
1460
|
-
`;function
|
|
1459
|
+
`;function kt(i){return i.toLowerCase().replace(/[^a-zA-Z0-9]+(.)/g,(e,t)=>t.toUpperCase())}var Q=class extends h{constructor(){super(...arguments);this.paymentManagers=new Map;this.sdkState=null;this.headlessUtils=null;this.open=!1;this._paymentMethodManagerTask=new k(this,{task:async([t,r])=>!t||!r?_:r.get(t)?.manager,args:()=>[this.paymentMethod?.type,this.paymentManagers]});this._getAssetsTask=new k(this,{task:async([t,r])=>{if(!t||!r)return _;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}:_},args:()=>[this.paymentMethod?.type,this.headlessUtils]});this._setupTasks=new k(this,{task:async([t,r])=>!t||!r?_:{paymentMethodManager:t,assetsConfig:r},args:()=>[this._paymentMethodManagerTask.value,this._getAssetsTask.value]})}_legacyGetButtonLabel(t){if(!t)return;let r=t?kt(t):"";return r==="payWith"&&(r="pay_with"),v(r,{id:r})}start(){this._paymentMethodManagerTask.value&&(this.open=!0)}renderDialog(){return this.open?d`
|
|
1461
1460
|
<primer-portal>
|
|
1462
1461
|
<primer-dialog @primer-dialog-close="${()=>this.open=!1}">
|
|
1463
1462
|
<primer-ach-payment
|
|
@@ -1468,11 +1467,11 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
|
|
|
1468
1467
|
></primer-ach-payment>
|
|
1469
1468
|
</primer-dialog>
|
|
1470
1469
|
</primer-portal>
|
|
1471
|
-
`:
|
|
1470
|
+
`:c}render(){return this._setupTasks.render({error:()=>c,complete:({assetsConfig:t})=>(this.style.setProperty("--dynamic-payment-button-bg-color",t.backgroundColor),d`
|
|
1472
1471
|
<primer-button
|
|
1473
1472
|
@click="${()=>this.start()}"
|
|
1474
|
-
class=${
|
|
1475
|
-
title="${
|
|
1473
|
+
class=${V({loading:!!this.sdkState?.isProcessing,reverse:!0})}
|
|
1474
|
+
title="${v("pay_with",{id:"pay_with"})} ${t.name}"
|
|
1476
1475
|
>
|
|
1477
1476
|
<span class="image-container">
|
|
1478
1477
|
<img src="${t.iconUrl}" alt="${t.name}" />
|
|
@@ -1480,7 +1479,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
|
|
|
1480
1479
|
${t.displayName}
|
|
1481
1480
|
</primer-button>
|
|
1482
1481
|
${this.renderDialog()}
|
|
1483
|
-
`)})}};
|
|
1482
|
+
`)})}};Q.styles=[x,Co],s([l({type:Object})],Q.prototype,"paymentMethod",2),s([f({context:F,subscribe:!0})],Q.prototype,"paymentManagers",2),s([f({context:$,subscribe:!0})],Q.prototype,"sdkState",2),s([f({context:D,subscribe:!0})],Q.prototype,"headlessUtils",2),s([C()],Q.prototype,"open",2),Q=s([g("primer-dynamic-payment"),M()],Q);var Eo=u`
|
|
1484
1483
|
:host {
|
|
1485
1484
|
height: calc(
|
|
1486
1485
|
var(--primer-typography-title-large-line-height) +
|
|
@@ -1555,1017 +1554,960 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
|
|
|
1555
1554
|
flex-shrink: 0;
|
|
1556
1555
|
flex-grow: 1;
|
|
1557
1556
|
}
|
|
1558
|
-
`;var
|
|
1557
|
+
`;var te=class extends h{constructor(){super(...arguments);this.paymentManagers=new Map;this.sdkState=null;this.headlessUtils=null;this._paymentMethodManagerTask=new k(this,{task:async([t,r])=>!t||!r?_:r.get(t)?.manager,args:()=>[this.paymentMethod?.type,this.paymentManagers]});this._getAssetsTask=new k(this,{task:async([t,r])=>{if(!t||!r)return _;let o=r.getPaymentMethodConfiguration(t);if(!o)return _;let a=o.displayMetadata.button.backgroundColor.colored??o.displayMetadata.button.backgroundColor.light,n=o.displayMetadata.button.iconPositionRelativeToText||"START";return{backgroundColor:a,name:o.name,displayName:this._legacyGetButtonLabel(o.displayMetadata.button.text),iconUrl:o.displayMetadata.button.iconUrl.colored??o.displayMetadata.button.iconUrl.light,iconPosition:n}},args:()=>[this.paymentMethod?.type,this.headlessUtils]});this._setupTasks=new k(this,{task:async([t,r])=>!t||!r?_:{paymentMethodManager:t,assetsConfig:r},args:()=>[this._paymentMethodManagerTask.value,this._getAssetsTask.value]})}_legacyGetButtonLabel(t){if(!t)return;let r=t?kt(t):"";return r==="payWith"&&(r="pay_with"),v(r,{id:r})}startRedirectPayment(){this._paymentMethodManagerTask.value&&this._paymentMethodManagerTask.value.start()}render(){return this._setupTasks.render({error:()=>c,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?d`
|
|
1559
1558
|
<span class="image-container">
|
|
1560
1559
|
<img src="${t.iconUrl}" alt="${t.name}" />
|
|
1561
1560
|
</span>
|
|
1562
1561
|
<span class="button-text">${t.displayName}</span>
|
|
1563
|
-
`:
|
|
1562
|
+
`:d`
|
|
1564
1563
|
<span class="image-container">
|
|
1565
1564
|
<img src="${t.iconUrl}" alt="${t.name}" />
|
|
1566
1565
|
</span>
|
|
1567
|
-
`;return
|
|
1566
|
+
`;return d`
|
|
1568
1567
|
<primer-button
|
|
1569
1568
|
@click="${()=>this.startRedirectPayment()}"
|
|
1570
|
-
class=${
|
|
1571
|
-
title="${
|
|
1569
|
+
class=${V(r)}
|
|
1570
|
+
title="${v("pay_with",{id:"pay_with"})} ${t.name}"
|
|
1572
1571
|
>
|
|
1573
1572
|
${o}
|
|
1574
1573
|
</primer-button>
|
|
1575
|
-
`}})}};
|
|
1574
|
+
`}})}};te.styles=[x,Eo],s([l({type:Object})],te.prototype,"paymentMethod",2),s([f({context:F,subscribe:!0})],te.prototype,"paymentManagers",2),s([f({context:$,subscribe:!0})],te.prototype,"sdkState",2),s([f({context:D,subscribe:!0})],te.prototype,"headlessUtils",2),te=s([g("primer-redirect-payment"),M()],te);var qe={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"};function ii(i){return i.charAt(0).toUpperCase()+i.slice(1).toLowerCase()}function Ja(i){return i?i===i.toUpperCase()?ii(i):i:""}function Ao(i,e){return[i,e].filter(Boolean).join(" ")}function es(i,e){return!i||!e?"":`Expires ${i}/${e.slice(-2)}`}function _o(i){return i?`\u2022\u2022\u2022\u2022 ${i}`:""}function ts(i){let e=i.paymentInstrumentData,t=Ja(e.network),r=e.last4Digits,o=`${i.paymentInstrumentData.cardholderName?i.paymentInstrumentData.cardholderName:""}${(r?` ${t} ${_o(r)}`:t)||" Card"}`,a=es(e.expirationMonth,e.expirationYear);return{description:o,secondaryDescription:a}}function rs(i){let e=i.paymentInstrumentData,t=e.externalPayerInfo?.email||"",r=e.externalPayerInfo?.firstName||"",o=e.externalPayerInfo?.lastName||"",a=i.userDescription||t||"PayPal Account",n=Ao(r,o);return{description:a,secondaryDescription:n}}function is(i){let e=i.paymentInstrumentData,t=e.sessionData?.billingAddress?.email||"",r=e.sessionData?.billingAddress?.firstName||"",o=e.sessionData?.billingAddress?.lastName||"",a=i.userDescription||(t?`Klarna - ${t}`:"Klarna Account"),n=Ao(r,o);return{description:a,secondaryDescription:n}}function os(i){let e=i.paymentInstrumentData,t=e.accountNumberLastFourDigits||"",r=e.bankName||"",o=e.accountType||"",a=i.userDescription;a||(r&&t?a=`${r} ${_o(t)}`:r?a=r:a="Bank Account");let n=o?`${ii(o)} Account`:"";return{description:a,secondaryDescription:n}}function as(i){let e=i.paymentInstrumentType,t=ii(e.replace(/_/g," "));return{description:i.userDescription||t}}var ss={[qe.CARD]:ts,[qe.PAYPAL_VAULTED]:rs,[qe.KLARNA_CUSTOMER_TOKEN]:is,[qe.AUTOMATED_CLEARING_HOUSE]:os};function ur(i){try{let e=ss[i.paymentInstrumentType];return e?e(i):as(i)}catch(e){return S.error("FormatUtils",`Error formatting payment method ${i.id}:`,e),{description:i.userDescription||i.id||"Payment Method"}}}var Mo=u`
|
|
1576
1575
|
:host {
|
|
1577
|
-
display:
|
|
1576
|
+
display: block;
|
|
1577
|
+
width: 100%;
|
|
1578
|
+
position: relative;
|
|
1578
1579
|
}
|
|
1579
1580
|
|
|
1580
|
-
.
|
|
1581
|
+
.vault-manager {
|
|
1581
1582
|
display: flex;
|
|
1582
1583
|
flex-direction: column;
|
|
1583
|
-
|
|
1584
|
+
position: relative;
|
|
1584
1585
|
}
|
|
1585
1586
|
|
|
1586
|
-
.
|
|
1587
|
-
|
|
1588
|
-
|
|
1587
|
+
.vault-manager-content {
|
|
1588
|
+
display: flex;
|
|
1589
|
+
flex-direction: column;
|
|
1590
|
+
width: 100%;
|
|
1591
|
+
position: relative;
|
|
1589
1592
|
}
|
|
1590
1593
|
|
|
1591
|
-
|
|
1592
|
-
|
|
1594
|
+
/* Content container using CSS Grid for height animation */
|
|
1595
|
+
.content-container {
|
|
1596
|
+
display: grid;
|
|
1597
|
+
grid-template-rows: 1fr;
|
|
1598
|
+
transition: grid-template-rows var(--primer-animation-duration)
|
|
1599
|
+
var(--primer-animation-easing);
|
|
1600
|
+
width: 100%;
|
|
1601
|
+
position: relative;
|
|
1593
1602
|
}
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
<slot name="payments" @slotchange=${this.onSlotChange}></slot>
|
|
1600
|
-
${V(this.hasAssignedContent,()=>h,()=>c`
|
|
1601
|
-
<div
|
|
1602
|
-
class=${Z({"primer-is-processing":!!this.sdkState?.isProcessing})}
|
|
1603
|
-
>
|
|
1604
|
-
<primer-vault-manager></primer-vault-manager>
|
|
1605
|
-
<primer-show-other-payments>
|
|
1606
|
-
<div slot="other-payments" class="primer-main-list">
|
|
1607
|
-
${this.paymentMethods?.toArray().map(t=>c`
|
|
1608
|
-
<primer-payment-method
|
|
1609
|
-
type=${t.type}
|
|
1610
|
-
></primer-payment-method>
|
|
1611
|
-
`)}
|
|
1612
|
-
</div>
|
|
1613
|
-
</primer-show-other-payments>
|
|
1614
|
-
<primer-error-message-container></primer-error-message-container>
|
|
1615
|
-
</div>
|
|
1616
|
-
`)}
|
|
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`
|
|
1618
|
-
:host {
|
|
1619
|
-
height: calc(
|
|
1620
|
-
var(--primer-typography-title-large-line-height) +
|
|
1621
|
-
calc(2 * var(--primer-space-medium))
|
|
1622
|
-
);
|
|
1623
|
-
display: flex;
|
|
1603
|
+
|
|
1604
|
+
/* Required to make grid animation work - ensures content can expand/collapse properly */
|
|
1605
|
+
.content-container > * {
|
|
1606
|
+
min-height: 0;
|
|
1607
|
+
overflow: hidden;
|
|
1624
1608
|
}
|
|
1625
1609
|
|
|
1626
|
-
|
|
1610
|
+
/* Submit button container */
|
|
1611
|
+
.submit-button-container {
|
|
1612
|
+
display: grid;
|
|
1613
|
+
grid-template-rows: 1fr;
|
|
1614
|
+
transition: grid-template-rows var(--primer-animation-duration)
|
|
1615
|
+
var(--primer-animation-easing);
|
|
1616
|
+
overflow: hidden;
|
|
1617
|
+
margin-top: var(--primer-space-small);
|
|
1627
1618
|
width: 100%;
|
|
1628
|
-
height: 100%;
|
|
1629
|
-
flex: 1;
|
|
1630
1619
|
}
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
:host {
|
|
1636
|
-
display: contents;
|
|
1620
|
+
|
|
1621
|
+
/* Ensure the submit button has full width */
|
|
1622
|
+
.submit-button {
|
|
1623
|
+
width: 100%;
|
|
1637
1624
|
}
|
|
1638
1625
|
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
gap: var(--primer-space-medium);
|
|
1626
|
+
/* Make sure pay button inside the submit component is full width */
|
|
1627
|
+
primer-vault-payment-submit::part(button),
|
|
1628
|
+
::slotted(primer-button) {
|
|
1643
1629
|
width: 100%;
|
|
1644
1630
|
}
|
|
1645
1631
|
|
|
1646
|
-
|
|
1632
|
+
/* Payment methods list */
|
|
1633
|
+
.payment-methods-list {
|
|
1647
1634
|
display: flex;
|
|
1648
1635
|
flex-direction: column;
|
|
1649
|
-
gap: var(--primer-space-
|
|
1650
|
-
|
|
1636
|
+
gap: var(--primer-space-small);
|
|
1637
|
+
width: 100%;
|
|
1638
|
+
position: relative;
|
|
1651
1639
|
}
|
|
1652
1640
|
|
|
1653
|
-
|
|
1641
|
+
/* Delete confirmation container */
|
|
1642
|
+
.delete-confirmation-container {
|
|
1643
|
+
width: 100%;
|
|
1644
|
+
position: relative;
|
|
1645
|
+
}
|
|
1646
|
+
|
|
1647
|
+
/* Loading overlay styles */
|
|
1648
|
+
.loading-overlay {
|
|
1649
|
+
position: absolute;
|
|
1650
|
+
top: 0;
|
|
1651
|
+
left: 0;
|
|
1652
|
+
width: 100%;
|
|
1653
|
+
height: 100%;
|
|
1654
1654
|
display: flex;
|
|
1655
|
-
|
|
1655
|
+
align-items: center;
|
|
1656
|
+
justify-content: center;
|
|
1657
|
+
background-color: rgba(255, 255, 255, 0.7);
|
|
1658
|
+
z-index: 10;
|
|
1659
|
+
border-radius: var(--primer-radius-medium);
|
|
1660
|
+
backdrop-filter: blur(2px);
|
|
1661
|
+
opacity: 0; /* Start invisible */
|
|
1656
1662
|
}
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
<div class="card-form">
|
|
1662
|
-
<primer-input-card-number></primer-input-card-number>
|
|
1663
|
-
<div class="card-form-row">
|
|
1664
|
-
<primer-input-card-expiry></primer-input-card-expiry>
|
|
1665
|
-
<primer-input-cvv></primer-input-cvv>
|
|
1666
|
-
</div>
|
|
1667
|
-
<primer-input-card-holder-name></primer-input-card-holder-name>
|
|
1668
|
-
</div>
|
|
1669
|
-
<primer-card-form-submit></primer-card-form-submit>
|
|
1670
|
-
`)})}
|
|
1671
|
-
</form>
|
|
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=`
|
|
1673
|
-
input[data-custom-input]::placeholder {
|
|
1674
|
-
color: var(--primer-color-text-placeholder);
|
|
1675
|
-
font-size: var(--primer-typography-body-large-size);
|
|
1676
|
-
font-family: var(--primer-typography-body-large-font);
|
|
1677
|
-
}
|
|
1678
|
-
input[data-custom-input]:focus {
|
|
1679
|
-
outline: none;
|
|
1680
|
-
}
|
|
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`
|
|
1682
|
-
<primer-input-wrapper
|
|
1683
|
-
.focusWithin="${this.hostedInputController.isFocused}"
|
|
1684
|
-
.hasError=${!!t}
|
|
1685
|
-
@wrapper-click="${this.handleWrapperClick}"
|
|
1686
|
-
>
|
|
1687
|
-
${V(!this.cardFormContext?.hideLabels,()=>c`<primer-input-label slot="label"
|
|
1688
|
-
>${this.label}</primer-input-label
|
|
1689
|
-
>`,()=>h)}
|
|
1690
|
-
<div
|
|
1691
|
-
slot="input"
|
|
1692
|
-
class="card-input-slot"
|
|
1693
|
-
id="${this.config.containerSelector.substring(1)}"
|
|
1694
|
-
aria-label="${this.ariaLabel}"
|
|
1695
|
-
></div>
|
|
1696
|
-
${V(t,()=>c`
|
|
1697
|
-
<primer-input-error slot="error">
|
|
1698
|
-
${A(t,{id:t})}
|
|
1699
|
-
</primer-input-error>
|
|
1700
|
-
`,()=>h)}
|
|
1701
|
-
</primer-input-wrapper>
|
|
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`
|
|
1703
|
-
:host {
|
|
1704
|
-
display: contents;
|
|
1663
|
+
|
|
1664
|
+
/* Add styles for when updating is active */
|
|
1665
|
+
.is-updating {
|
|
1666
|
+
pointer-events: none; /* Prevent interaction when updating */
|
|
1705
1667
|
}
|
|
1706
1668
|
|
|
1707
|
-
|
|
1669
|
+
/*
|
|
1670
|
+
* Component-specific styles to ensure smooth animations
|
|
1671
|
+
* These components need display:block to work with the grid layout
|
|
1672
|
+
*/
|
|
1673
|
+
primer-vault-payment-method-item,
|
|
1674
|
+
primer-vault-empty-state,
|
|
1675
|
+
primer-vault-delete-confirmation {
|
|
1676
|
+
display: block;
|
|
1677
|
+
width: 100%;
|
|
1678
|
+
}
|
|
1679
|
+
|
|
1680
|
+
/* Disable animations for reduced motion preference */
|
|
1681
|
+
@media (prefers-reduced-motion: reduce) {
|
|
1682
|
+
.content-container,
|
|
1683
|
+
.submit-button-container,
|
|
1684
|
+
primer-vault-payment-method-item,
|
|
1685
|
+
primer-vault-payment-submit,
|
|
1686
|
+
primer-vault-empty-state,
|
|
1687
|
+
primer-vault-delete-confirmation {
|
|
1688
|
+
transition: none;
|
|
1689
|
+
}
|
|
1690
|
+
}
|
|
1691
|
+
`;var wt=globalThis,hr=wt.trustedTypes,So=hr?hr.createPolicy("lit-html",{createHTML:i=>i}):void 0,ai="$lit$",be=`lit$${Math.random().toFixed(9).slice(2)}$`,si="?"+be,ns=`<${si}>`,Xe=document,gr=()=>Xe.createComment(""),Tt=i=>i===null||typeof i!="object"&&typeof i!="function",ni=Array.isArray,$o=i=>ni(i)||typeof i?.[Symbol.iterator]=="function",oi=`[
|
|
1692
|
+
\f\r]`,Pt=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,ko=/-->/g,Po=/>/g,We=RegExp(`>|${oi}(?:([^\\s"'>=/]+)(${oi}*=${oi}*(?:[^
|
|
1693
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),wo=/'/g,To=/"/g,Io=/^(?:script|style|textarea|title)$/i,li=i=>(e,...t)=>({_$litType$:i,strings:e,values:t}),rg=li(1),ig=li(2),og=li(3),Lt=Symbol.for("lit-noChange"),L=Symbol.for("lit-nothing"),Lo=new WeakMap,Ze=Xe.createTreeWalker(Xe,129);function No(i,e){if(!ni(i)||!i.hasOwnProperty("raw"))throw Error("invalid template strings array");return So!==void 0?So.createHTML(e):e}var Oo=(i,e)=>{let t=i.length-1,r=[],o,a=e===2?"<svg>":e===3?"<math>":"",n=Pt;for(let m=0;m<t;m++){let p=i[m],b,E,y=-1,w=0;for(;w<p.length&&(n.lastIndex=w,E=n.exec(p),E!==null);)w=n.lastIndex,n===Pt?E[1]==="!--"?n=ko:E[1]!==void 0?n=Po:E[2]!==void 0?(Io.test(E[2])&&(o=RegExp("</"+E[2],"g")),n=We):E[3]!==void 0&&(n=We):n===We?E[0]===">"?(n=o??Pt,y=-1):E[1]===void 0?y=-2:(y=n.lastIndex-E[2].length,b=E[1],n=E[3]===void 0?We:E[3]==='"'?To:wo):n===To||n===wo?n=We:n===ko||n===Po?n=Pt:(n=We,o=void 0);let I=n===We&&i[m+1].startsWith("/>")?" ":"";a+=n===Pt?p+ns:y>=0?(r.push(b),p.slice(0,y)+ai+p.slice(y)+be+I):p+be+(y===-2?m:I)}return[No(i,a+(i[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),r]},$t=class i{constructor({strings:e,_$litType$:t},r){let o;this.parts=[];let a=0,n=0,m=e.length-1,p=this.parts,[b,E]=Oo(e,t);if(this.el=i.createElement(b,r),Ze.currentNode=this.el.content,t===2||t===3){let y=this.el.content.firstChild;y.replaceWith(...y.childNodes)}for(;(o=Ze.nextNode())!==null&&p.length<m;){if(o.nodeType===1){if(o.hasAttributes())for(let y of o.getAttributeNames())if(y.endsWith(ai)){let w=E[n++],I=o.getAttribute(y).split(be),de=/([.?@])?(.*)/.exec(w);p.push({type:1,index:a,name:de[2],strings:I,ctor:de[1]==="."?vr:de[1]==="?"?yr:de[1]==="@"?br:Je}),o.removeAttribute(y)}else y.startsWith(be)&&(p.push({type:6,index:a}),o.removeAttribute(y));if(Io.test(o.tagName)){let y=o.textContent.split(be),w=y.length-1;if(w>0){o.textContent=hr?hr.emptyScript:"";for(let I=0;I<w;I++)o.append(y[I],gr()),Ze.nextNode(),p.push({type:2,index:++a});o.append(y[w],gr())}}}else if(o.nodeType===8)if(o.data===si)p.push({type:2,index:a});else{let y=-1;for(;(y=o.data.indexOf(be,y+1))!==-1;)p.push({type:7,index:a}),y+=be.length-1}a++}}static createElement(e,t){let r=Xe.createElement("template");return r.innerHTML=e,r}};function Qe(i,e,t=i,r){if(e===Lt)return e;let o=r!==void 0?t._$Co?.[r]:t._$Cl,a=Tt(e)?void 0:e._$litDirective$;return o?.constructor!==a&&(o?._$AO?.(!1),a===void 0?o=void 0:(o=new a(i),o._$AT(i,t,r)),r!==void 0?(t._$Co??(t._$Co=[]))[r]=o:t._$Cl=o),o!==void 0&&(e=Qe(i,o._$AS(i,e.values),o,r)),e}var fr=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??Xe).importNode(t,!0);Ze.currentNode=o;let a=Ze.nextNode(),n=0,m=0,p=r[0];for(;p!==void 0;){if(n===p.index){let b;p.type===2?b=new It(a,a.nextSibling,this,e):p.type===1?b=new p.ctor(a,p.name,p.strings,this,e):p.type===6&&(b=new xr(a,this,e)),this._$AV.push(b),p=r[++m]}n!==p?.index&&(a=Ze.nextNode(),n++)}return Ze.currentNode=Xe,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++}},It=class i{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,r,o){this.type=2,this._$AH=L,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=Qe(this,e,t),Tt(e)?e===L||e==null||e===""?(this._$AH!==L&&this._$AR(),this._$AH=L):e!==this._$AH&&e!==Lt&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):$o(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!==L&&Tt(this._$AH)?this._$AA.nextSibling.data=e:this.T(Xe.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=$t.createElement(No(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===o)this._$AH.p(t);else{let a=new fr(o,this),n=a.u(this.options);a.p(t),this.T(n),this._$AH=a}}_$AC(e){let t=Lo.get(e.strings);return t===void 0&&Lo.set(e.strings,t=new $t(e)),t}k(e){ni(this._$AH)||(this._$AH=[],this._$AR());let t=this._$AH,r,o=0;for(let a of e)o===t.length?t.push(r=new i(this.O(gr()),this.O(gr()),this,this.options)):r=t[o],r._$AI(a),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))}},Je=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,r,o,a){this.type=1,this._$AH=L,this._$AN=void 0,this.element=e,this.name=t,this._$AM=o,this.options=a,r.length>2||r[0]!==""||r[1]!==""?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=L}_$AI(e,t=this,r,o){let a=this.strings,n=!1;if(a===void 0)e=Qe(this,e,t,0),n=!Tt(e)||e!==this._$AH&&e!==Lt,n&&(this._$AH=e);else{let m=e,p,b;for(e=a[0],p=0;p<a.length-1;p++)b=Qe(this,m[r+p],t,p),b===Lt&&(b=this._$AH[p]),n||(n=!Tt(b)||b!==this._$AH[p]),b===L?e=L:e!==L&&(e+=(b??"")+a[p+1]),this._$AH[p]=b}n&&!o&&this.j(e)}j(e){e===L?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},vr=class extends Je{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===L?void 0:e}},yr=class extends Je{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==L)}},br=class extends Je{constructor(e,t,r,o,a){super(e,t,r,o,a),this.type=5}_$AI(e,t=this){if((e=Qe(this,e,t,0)??L)===Lt)return;let r=this._$AH,o=e===L&&r!==L||e.capture!==r.capture||e.once!==r.once||e.passive!==r.passive,a=e!==L&&(r===L||o);o&&this.element.removeEventListener(this.name,this,r),a&&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)}},xr=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){Qe(this,e)}},Ro={M:ai,P:be,A:si,C:1,L:Oo,R:fr,D:$o,V:Qe,I:It,H:Je,N:yr,U:br,B:vr,F:xr},ls=wt.litHtmlPolyfillSupport;ls?.($t,It),(wt.litHtmlVersions??(wt.litHtmlVersions=[])).push("3.3.0");var nt={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},Nt=i=>(...e)=>({_$litDirective$:i,values:e}),Cr=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:mg}=Ro;var Do=i=>i.strings===void 0;var Ot=(i,e)=>{let t=i._$AN;if(t===void 0)return!1;for(let r of t)r._$AO?.(e,!1),Ot(r,e);return!0},Er=i=>{let e,t;do{if((e=i._$AM)===void 0)break;t=e._$AN,t.delete(i),i=e}while(t?.size===0)},Vo=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),cs(e)}};function ds(i){this._$AN!==void 0?(Er(this),this._$AM=i,Vo(this)):this._$AM=i}function ps(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 a=t;a<r.length;a++)Ot(r[a],!1),Er(r[a]);else r!=null&&(Ot(r,!1),Er(r));else Ot(this,i)}var cs=i=>{i.type==nt.CHILD&&(i._$AP??(i._$AP=ps),i._$AQ??(i._$AQ=ds))},lt=class extends Cr{constructor(){super(...arguments),this._$AN=void 0}_$AT(e,t,r){super._$AT(e,t,r),Vo(this),this.isConnected=e._$AU}_$AO(e,t=!0){e!==this.isConnected&&(this.isConnected=e,e?this.reconnected?.():this.disconnected?.()),t&&(Ot(this,e),Er(this))}setValue(e){if(Do(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 Ar=new WeakMap,dt=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,Ar.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 Ho=0,di=new Map,Yo=new WeakSet,pi=()=>new Promise(i=>requestAnimationFrame(i));var zo=(i,e)=>{let t=i-e;return t===0?void 0:t},Uo=(i,e)=>{let t=i/e;return t===1?void 0:t},_r={left:(i,e)=>{let t=zo(i,e);return{value:t,transform:t==null||isNaN(t)?void 0:`translateX(${t}px)`}},top:(i,e)=>{let t=zo(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=Uo(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=Uo(i,e);return{value:r,overrideFrom:t,transform:r==null||isNaN(r)?void 0:`scaleY(${r})`}}},Bo={duration:333,easing:"ease-in-out"},Ko=["left","top","width","height","opacity","color","background"],Fo=new WeakMap,Mr=class extends lt{constructor(e){if(super(e),this.t=!1,this.i=null,this.o=null,this.h=!0,this.shouldLog=!1,e.type===nt.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 L}getController(){return Ar.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,Fo.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=Ko),this.options=e}m(){let e={},t=this.element.getBoundingClientRect(),r=getComputedStyle(this.element);return this.options.properties.forEach(o=>{let a=t[o]??(_r[o]?void 0:r[o]),n=Number(a);e[o]=isNaN(n)?a+"":n}),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((a,n)=>a===o[n]))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 pi;let t=this.O(),r=this.j(this.options.keyframeOptions,t),o=this.m();if(this.A!==void 0){let{from:a,to:n}=this.N(this.A,o,t);this.log("measured",[this.A,o,a,n]),e=this.calculateKeyframes(a,n)}else{let a=di.get(this.options.inId);if(a){di.delete(this.options.inId);let{from:n,to:m}=this.N(a,o,t);e=this.calculateKeyframes(n,m),e=this.options.in?[{...this.options.in[0],...e[0]},...this.options.in.slice(1),e[1]]:e,Ho++,e.forEach(p=>p.zIndex=Ho)}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&&di.set(this.options.id,this.A),this.options.out===void 0))return;if(this.prepare(),await pi(),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,a=this.A.top-r.top;getComputedStyle(this.element).position!=="static"||o===0&&a===0||(this.element.style.position="relative"),o!==0&&(this.element.style.left=o+"px"),a!==0&&(this.element.style.top=a+"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=Fo.get(t);r&&!r.isDisabled()&&r&&e.push(r)}return e}get isHostRendered(){let e=Yo.has(this.u);return e||this.u.updateComplete.then(()=>{Yo.add(this.u)}),e}j(e,t=this.O()){let r={...Bo};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(m=>m.animatingProperties).filter(m=>m!==void 0),a=1,n=1;return o.length>0&&(o.forEach(m=>{m.width&&(a/=m.width),m.height&&(n/=m.height)}),e.left!==void 0&&t.left!==void 0&&(e.left=a*e.left,t.left=a*t.left),e.top!==void 0&&t.top!==void 0&&(e.top=n*e.top,t.top=n*t.top)),{from:e,to:t}}calculateKeyframes(e,t,r=!1){let o={},a={},n=!1,m={};for(let p in t){let b=e[p],E=t[p];if(p in _r){let y=_r[p];if(b===void 0||E===void 0)continue;let w=y(b,E);w.transform!==void 0&&(m[p]=w.value,n=!0,o.transform=`${o.transform??""} ${w.transform}`,w.overrideFrom!==void 0&&Object.assign(o,w.overrideFrom))}else b!==E&&b!==void 0&&E!==void 0&&(n=!0,o[p]=b,a[p]=E)}return o.transformOrigin=a.transformOrigin=r?"center center":"top left",this.animatingProperties=m,n?[o,a]: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)}},Oe=Nt(Mr);var ms=["top","right","bottom","left"],Sr=class extends lt{constructor(e){if(super(e),e.type!==nt.ELEMENT)throw Error("The `position` directive must be used in attribute position.")}render(e,t){return L}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(a=>{let n=ms.includes(a)?r[a]-o[a]:r[a];this.S.style[a]=n+"px"})}},us=Nt(Sr);var W=class extends h{constructor(){super();this.vaultManagerContext=null;this.isEditMode=!1;this.deletePaymentMethodId=null;this.isDeleting=!1;this.errorMessage="";this.animationDuration=300;new dt(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=v("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:v("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:v("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 ur(r).description||""}catch{return""}}renderLoadingOverlay(){return d`
|
|
1694
|
+
<div
|
|
1695
|
+
class="loading-overlay"
|
|
1696
|
+
${Oe({...this.getAnimationConfig(),properties:["opacity"],in:[{opacity:0},{opacity:1}],out:[{opacity:1},{opacity:0}]})}
|
|
1697
|
+
>
|
|
1698
|
+
<primer-spinner
|
|
1699
|
+
size="medium"
|
|
1700
|
+
color="var(--primer-color-loader)"
|
|
1701
|
+
></primer-spinner>
|
|
1702
|
+
</div>
|
|
1703
|
+
`}renderDeleteConfirmation(){if(!this.deletePaymentMethodId)return c;let t=this.getPaymentMethodName(this.deletePaymentMethodId);return d`
|
|
1704
|
+
<div class="delete-confirmation-container">
|
|
1705
|
+
<primer-vault-delete-confirmation
|
|
1706
|
+
.isDeleting=${this.isDeleting}
|
|
1707
|
+
.paymentMethodId=${this.deletePaymentMethodId}
|
|
1708
|
+
.paymentMethodName=${t}
|
|
1709
|
+
@confirm-delete=${this.handleConfirmDelete}
|
|
1710
|
+
@cancel-delete=${this.handleCancelDelete}
|
|
1711
|
+
${Oe({...this.getAnimationConfig(),properties:["opacity"],in:[{opacity:0},{opacity:1}],out:[{opacity:1},{opacity:0}]})}
|
|
1712
|
+
></primer-vault-delete-confirmation>
|
|
1713
|
+
</div>
|
|
1714
|
+
`}renderPaymentMethodItem(t){return this.deletePaymentMethodId===t.id?c:d`
|
|
1715
|
+
<primer-vault-payment-method-item
|
|
1716
|
+
.paymentMethod=${t}
|
|
1717
|
+
.isEditMode=${this.isEditMode}
|
|
1718
|
+
@delete-payment-method=${this.handleDeletePaymentMethod}
|
|
1719
|
+
${Oe({...this.getAnimationConfig(),properties:["opacity"],in:[{opacity:0},{opacity:1}],out:[{opacity:1},{opacity:0}]})}
|
|
1720
|
+
></primer-vault-payment-method-item>
|
|
1721
|
+
`}renderPaymentMethodList(){let t=this.vaultManagerContext?.vaultedPaymentMethods||[],r=!this.isEditMode&&t.length>0&&!this.deletePaymentMethodId;return d`
|
|
1722
|
+
<div class="payment-methods-list">
|
|
1723
|
+
${t.map(o=>this.renderPaymentMethodItem(o))}
|
|
1724
|
+
${P(r,()=>d`
|
|
1725
|
+
<div class="submit-button-container">
|
|
1726
|
+
<primer-vault-payment-submit
|
|
1727
|
+
class="submit-button"
|
|
1728
|
+
@primer-vault-payment-error=${this.handlePaymentError}
|
|
1729
|
+
${Oe({...this.getAnimationConfig(),properties:["opacity"],in:[{opacity:0},{opacity:1}],out:[{opacity:1},{opacity:0}]})}
|
|
1730
|
+
></primer-vault-payment-submit>
|
|
1731
|
+
</div>
|
|
1732
|
+
`,()=>c)}
|
|
1733
|
+
</div>
|
|
1734
|
+
`}render(){if(!this.vaultManagerContext?.enabled)return c;let t=this.vaultManagerContext.vaultedPaymentMethods.length>0,r=this.vaultManagerContext.isLoading,o=this.vaultManagerContext.isUpdating;return d`
|
|
1735
|
+
<div class="vault-manager ${o?"is-updating":""}">
|
|
1736
|
+
<primer-vault-manager-header
|
|
1737
|
+
.isEditMode=${this.isEditMode}
|
|
1738
|
+
.hasPaymentMethods=${t}
|
|
1739
|
+
@toggle-edit-mode=${this.handleToggleEditMode}
|
|
1740
|
+
></primer-vault-manager-header>
|
|
1741
|
+
|
|
1742
|
+
${P(this.errorMessage,()=>d`
|
|
1743
|
+
<primer-vault-error-message
|
|
1744
|
+
.errorMessage=${this.errorMessage}
|
|
1745
|
+
@close-error=${this.handleCloseError}
|
|
1746
|
+
${Oe({...this.getAnimationConfig(),properties:["opacity"],in:[{opacity:0},{opacity:1}],out:[{opacity:1},{opacity:0}]})}
|
|
1747
|
+
></primer-vault-error-message>
|
|
1748
|
+
`,()=>c)}
|
|
1749
|
+
|
|
1750
|
+
<div class="vault-manager-content">
|
|
1751
|
+
${P(!r&&!t,()=>d`
|
|
1752
|
+
<div class="content-container">
|
|
1753
|
+
<primer-vault-empty-state
|
|
1754
|
+
${Oe({...this.getAnimationConfig(),properties:["opacity"],in:[{opacity:0},{opacity:1}],out:[{opacity:1},{opacity:0}]})}
|
|
1755
|
+
></primer-vault-empty-state>
|
|
1756
|
+
</div>
|
|
1757
|
+
`,()=>c)}
|
|
1758
|
+
${P(!r&&t,()=>d`
|
|
1759
|
+
<div class="content-container">
|
|
1760
|
+
${P(this.deletePaymentMethodId,()=>this.renderDeleteConfirmation(),()=>this.renderPaymentMethodList())}
|
|
1761
|
+
</div>
|
|
1762
|
+
`,()=>c)}
|
|
1763
|
+
</div>
|
|
1764
|
+
|
|
1765
|
+
${P(o,()=>this.renderLoadingOverlay(),()=>c)}
|
|
1766
|
+
</div>
|
|
1767
|
+
`}};W.styles=[x,Mo],s([f({context:B,subscribe:!0}),l({type:Object,attribute:!1})],W.prototype,"vaultManagerContext",2),s([C()],W.prototype,"isEditMode",2),s([C()],W.prototype,"deletePaymentMethodId",2),s([C()],W.prototype,"isDeleting",2),s([C()],W.prototype,"errorMessage",2),s([l({type:Number})],W.prototype,"animationDuration",2),W=s([g("primer-vault-manager"),M()],W);function jo(i){return i.paymentInstrumentType===qe.CARD}var Go=u`
|
|
1768
|
+
:host {
|
|
1708
1769
|
display: flex;
|
|
1709
|
-
align-items: center;
|
|
1710
1770
|
width: 100%;
|
|
1711
|
-
|
|
1712
|
-
gap: var(--primer-space-small);
|
|
1771
|
+
flex-direction: column;
|
|
1713
1772
|
}
|
|
1714
1773
|
|
|
1715
|
-
|
|
1716
|
-
flex: 1;
|
|
1774
|
+
.payment-method-wrapper {
|
|
1717
1775
|
display: flex;
|
|
1776
|
+
flex-direction: column;
|
|
1718
1777
|
width: 100%;
|
|
1719
1778
|
}
|
|
1720
1779
|
|
|
1721
|
-
.
|
|
1780
|
+
.payment-method-container {
|
|
1722
1781
|
display: flex;
|
|
1782
|
+
width: 100%;
|
|
1723
1783
|
align-items: center;
|
|
1724
|
-
|
|
1784
|
+
gap: var(--primer-space-small);
|
|
1725
1785
|
}
|
|
1726
|
-
|
|
1727
|
-
|
|
1786
|
+
|
|
1787
|
+
/* Target the button part from primer-button using ::part selector */
|
|
1788
|
+
primer-button::part(button) {
|
|
1789
|
+
width: 100%;
|
|
1790
|
+
justify-content: flex-start;
|
|
1728
1791
|
display: flex;
|
|
1792
|
+
text-align: left;
|
|
1729
1793
|
}
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
<div
|
|
1739
|
-
slot="input"
|
|
1740
|
-
class="card-number-container"
|
|
1741
|
-
aria-label="${this.ariaLabel}"
|
|
1742
|
-
>
|
|
1743
|
-
<div id="${this.config.containerSelector.substring(1)}"></div>
|
|
1744
|
-
<div class="network-selector-container">
|
|
1745
|
-
<primer-card-network-selector
|
|
1746
|
-
@network-selected=${this.handleNetworkSelected}
|
|
1747
|
-
></primer-card-network-selector>
|
|
1748
|
-
</div>
|
|
1749
|
-
</div>
|
|
1750
|
-
${V(t,r=>c`
|
|
1751
|
-
<primer-input-error slot="error">
|
|
1752
|
-
${A(r,{id:r})}
|
|
1753
|
-
</primer-input-error>
|
|
1754
|
-
`,()=>h)}
|
|
1755
|
-
</primer-input-wrapper>
|
|
1756
|
-
`}render(){return this.renderInput()}};xt.styles=[w,Be,qa],xt=s([y("primer-input-card-number"),$()],xt);var Wa=f`
|
|
1757
|
-
:host {
|
|
1758
|
-
display: contents;
|
|
1759
|
-
}
|
|
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`
|
|
1761
|
-
:host {
|
|
1762
|
-
display: contents;
|
|
1763
|
-
}
|
|
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`
|
|
1765
|
-
:host {
|
|
1766
|
-
display: contents;
|
|
1767
|
-
}
|
|
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`
|
|
1769
|
-
:host {
|
|
1770
|
-
display: contents;
|
|
1794
|
+
|
|
1795
|
+
/* Card icons */
|
|
1796
|
+
.payment-method-icon {
|
|
1797
|
+
height: var(--primer-space-xlarge);
|
|
1798
|
+
object-fit: contain;
|
|
1799
|
+
flex-shrink: 0;
|
|
1800
|
+
transition: transform var(--primer-animation-duration)
|
|
1801
|
+
var(--primer-animation-easing);
|
|
1771
1802
|
}
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
type="submit"
|
|
1775
|
-
variant=${this.variant}
|
|
1776
|
-
?disabled=${this.disabled}
|
|
1777
|
-
@click=${this.handleClick}
|
|
1778
|
-
.loading=${!!this.sdkState?.isProcessing}
|
|
1779
|
-
data-submit
|
|
1780
|
-
>
|
|
1781
|
-
${this.buttonText}${r}
|
|
1782
|
-
</primer-button>
|
|
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`
|
|
1784
|
-
:host {
|
|
1803
|
+
|
|
1804
|
+
.payment-method-icon-generic {
|
|
1785
1805
|
display: flex;
|
|
1786
1806
|
align-items: center;
|
|
1787
|
-
|
|
1807
|
+
justify-content: center;
|
|
1808
|
+
color: var(--primer-color-gray-500);
|
|
1809
|
+
height: var(--primer-space-xlarge);
|
|
1810
|
+
flex-shrink: 0;
|
|
1788
1811
|
}
|
|
1789
1812
|
|
|
1790
|
-
.
|
|
1813
|
+
.payment-method-details {
|
|
1814
|
+
flex: 1;
|
|
1791
1815
|
display: flex;
|
|
1792
|
-
align-items: center;
|
|
1793
|
-
cursor: pointer;
|
|
1794
|
-
background: none;
|
|
1795
|
-
padding: unset;
|
|
1796
|
-
border: none;
|
|
1797
|
-
transition: opacity var(--primer-animation-duration)
|
|
1798
|
-
var(--primer-animation-easing);
|
|
1799
|
-
outline: none;
|
|
1800
1816
|
gap: var(--primer-space-xsmall);
|
|
1817
|
+
align-items: flex-start;
|
|
1818
|
+
transition: transform var(--primer-animation-duration)
|
|
1819
|
+
var(--primer-animation-easing);
|
|
1820
|
+
margin-left: var(--primer-space-small);
|
|
1801
1821
|
}
|
|
1802
1822
|
|
|
1803
|
-
.
|
|
1804
|
-
|
|
1823
|
+
.payment-method-description {
|
|
1824
|
+
font-weight: var(--primer-typography-title-large-weight);
|
|
1825
|
+
color: var(--primer-color-text-primary);
|
|
1826
|
+
transition: color var(--primer-animation-duration)
|
|
1827
|
+
var(--primer-animation-easing);
|
|
1805
1828
|
}
|
|
1806
1829
|
|
|
1807
|
-
.
|
|
1808
|
-
|
|
1809
|
-
|
|
1830
|
+
.payment-method-secondary-description {
|
|
1831
|
+
font-size: var(--primer-typography-body-small-size);
|
|
1832
|
+
color: var(--primer-color-text-secondary);
|
|
1833
|
+
transition: color var(--primer-animation-duration)
|
|
1834
|
+
var(--primer-animation-easing);
|
|
1810
1835
|
}
|
|
1811
1836
|
|
|
1812
|
-
.
|
|
1813
|
-
|
|
1814
|
-
height: var(
|
|
1815
|
-
--primer-size-medium
|
|
1816
|
-
); /* Added explicit height to maintain aspect ratio */
|
|
1817
|
-
object-fit: contain;
|
|
1837
|
+
.payment-method-button {
|
|
1838
|
+
flex: 1;
|
|
1818
1839
|
}
|
|
1819
1840
|
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
color: var(--primer-color-
|
|
1841
|
+
/* Delete button - for edit mode */
|
|
1842
|
+
.delete-button {
|
|
1843
|
+
background-color: transparent;
|
|
1844
|
+
border: none;
|
|
1845
|
+
color: var(--primer-color-red-500);
|
|
1846
|
+
cursor: pointer;
|
|
1847
|
+
padding: var(--primer-space-xsmall);
|
|
1848
|
+
border-radius: var(--primer-radius-small);
|
|
1849
|
+
flex-shrink: 0;
|
|
1850
|
+
display: flex;
|
|
1851
|
+
align-items: center;
|
|
1852
|
+
justify-content: center;
|
|
1853
|
+
height: var(--primer-size-medium);
|
|
1854
|
+
width: var(--primer-size-medium);
|
|
1855
|
+
margin-left: var(--primer-space-small);
|
|
1856
|
+
transition:
|
|
1857
|
+
background-color var(--primer-animation-duration)
|
|
1858
|
+
var(--primer-animation-easing),
|
|
1859
|
+
transform var(--primer-animation-duration) var(--primer-animation-easing);
|
|
1825
1860
|
}
|
|
1826
1861
|
|
|
1827
|
-
.
|
|
1828
|
-
|
|
1862
|
+
.delete-button:hover {
|
|
1863
|
+
background-color: var(--primer-color-red-100);
|
|
1864
|
+
transform: scale(1.05);
|
|
1829
1865
|
}
|
|
1830
1866
|
|
|
1831
|
-
.
|
|
1832
|
-
|
|
1833
|
-
top: 100%;
|
|
1834
|
-
right: 0;
|
|
1835
|
-
width: max-content;
|
|
1836
|
-
min-width: calc(var(--primer-size-xxxlarge) * 3);
|
|
1837
|
-
background: var(--primer-color-gray-000);
|
|
1838
|
-
border-radius: var(--primer-radius-small);
|
|
1839
|
-
box-shadow: 0 var(--primer-space-xxsmall) var(--primer-space-large)
|
|
1840
|
-
rgba(0, 0, 0, 0.15);
|
|
1841
|
-
z-index: 10;
|
|
1842
|
-
overflow: hidden;
|
|
1843
|
-
border: 1px solid var(--primer-color-border-outlined-default);
|
|
1867
|
+
.delete-button:active {
|
|
1868
|
+
transform: scale(0.95);
|
|
1844
1869
|
}
|
|
1845
1870
|
|
|
1846
|
-
.
|
|
1847
|
-
|
|
1871
|
+
.delete-button primer-icon {
|
|
1872
|
+
color: var(--primer-color-red-500);
|
|
1848
1873
|
}
|
|
1874
|
+
`;var j=class extends h{constructor(){super(...arguments);this.vaultManagerContext=null;this.vaultItemContext=null;this.headlessUtils=null;this.paymentMethod=null;this.isEditMode=!1;this._getAssetsTask=new k(this,{task:async([t,r,o])=>{if(!t||!r||!o)return _;let a="";if(jo(t))a=r.getCardNetworkAsset(t.paymentInstrumentData.network).cardUrl;else{let p=await r.getCDNAssets(t.paymentMethodType);p&&(a=p.assets?.icon?`${p.goatCdnUrl}/${p.assets.icon}`:"")}let n=o.cvvRecapture,m=ur(t);return{icon:a,shouldShowCVV:n,...m}},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?d`<img
|
|
1875
|
+
class="payment-method-icon"
|
|
1876
|
+
src=${t.icon}
|
|
1877
|
+
alt=${t.description}
|
|
1878
|
+
/>`:d`
|
|
1879
|
+
<div class="payment-method-icon payment-method-icon-generic">
|
|
1880
|
+
<primer-icon name="payment-card" size="sm"></primer-icon>
|
|
1881
|
+
</div>
|
|
1882
|
+
`;return d`
|
|
1883
|
+
${r}
|
|
1884
|
+
<div class="payment-method-details">
|
|
1885
|
+
<div class="payment-method-description">${t.description}</div>
|
|
1886
|
+
${t.secondaryDescription?d`<div class="payment-method-secondary-description">
|
|
1887
|
+
${t.secondaryDescription}
|
|
1888
|
+
</div>`:c}
|
|
1889
|
+
</div>
|
|
1890
|
+
`}render(){return this._getAssetsTask.render({error:()=>c,complete:t=>{let r=this.isSelected()?"checked":"default";return d`
|
|
1891
|
+
<div class="payment-method-wrapper">
|
|
1892
|
+
<div class="payment-method-container">
|
|
1893
|
+
<primer-button
|
|
1894
|
+
variant="secondary"
|
|
1895
|
+
class="payment-method-button"
|
|
1896
|
+
selectable
|
|
1897
|
+
?disabled=${this.isEditMode}
|
|
1898
|
+
selectionState=${r}
|
|
1899
|
+
@click=${this.handleClick}
|
|
1900
|
+
>
|
|
1901
|
+
${this.renderPaymentMethodContent(t)}
|
|
1902
|
+
</primer-button>
|
|
1849
1903
|
|
|
1850
|
-
|
|
1904
|
+
${this.isEditMode?d`
|
|
1905
|
+
<button
|
|
1906
|
+
class="delete-button"
|
|
1907
|
+
@click=${this.handleDeleteClick}
|
|
1908
|
+
aria-label=${`${v("delete",{id:"delete"})} ${t.description}`}
|
|
1909
|
+
>
|
|
1910
|
+
<primer-icon name="trash" size="sm"></primer-icon>
|
|
1911
|
+
</button>
|
|
1912
|
+
`:c}
|
|
1913
|
+
</div>
|
|
1914
|
+
|
|
1915
|
+
${P(t.shouldShowCVV&&this.isSelected()&&!this.isEditMode,()=>d`<primer-vault-cvv-input
|
|
1916
|
+
.paymentMethod="${this.paymentMethod}"
|
|
1917
|
+
></primer-vault-cvv-input>`,()=>c)}
|
|
1918
|
+
</div>
|
|
1919
|
+
`}})}};j.styles=[x,Go],s([f({context:B,subscribe:!0}),l({type:Object,attribute:!1,hasChanged(t,r){return t?.cvvRecapture!==r?.cvvRecapture}})],j.prototype,"vaultManagerContext",2),s([f({context:Te,subscribe:!0}),l({type:Object,attribute:!1,hasChanged(t,r){return t?.selectedVaultedPaymentMethod?.id!==r?.selectedVaultedPaymentMethod?.id}})],j.prototype,"vaultItemContext",2),s([f({context:D,subscribe:!0}),l({type:Object})],j.prototype,"headlessUtils",2),s([l({type:Object,attribute:!1})],j.prototype,"paymentMethod",2),s([l({type:Boolean,reflect:!0})],j.prototype,"isEditMode",2),j=s([g("primer-vault-payment-method-item"),M()],j);var qo=u`
|
|
1920
|
+
:host {
|
|
1851
1921
|
display: block;
|
|
1852
|
-
|
|
1853
|
-
overflow-y: auto;
|
|
1922
|
+
width: 100%;
|
|
1854
1923
|
}
|
|
1855
1924
|
|
|
1856
|
-
.
|
|
1925
|
+
.vault-manager-header {
|
|
1857
1926
|
display: flex;
|
|
1927
|
+
justify-content: space-between;
|
|
1858
1928
|
align-items: center;
|
|
1859
|
-
|
|
1860
|
-
cursor: pointer;
|
|
1861
|
-
transition: background-color var(--primer-animation-duration)
|
|
1862
|
-
var(--primer-animation-easing);
|
|
1863
|
-
position: relative;
|
|
1864
|
-
outline: none;
|
|
1865
|
-
background-color: transparent;
|
|
1929
|
+
margin-bottom: var(--primer-space-medium);
|
|
1866
1930
|
}
|
|
1867
1931
|
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1932
|
+
.vault-manager-header h3 {
|
|
1933
|
+
font-size: var(--primer-typography-title-large-size);
|
|
1934
|
+
font-weight: var(--primer-typography-title-large-weight);
|
|
1935
|
+
font-family: var(--primer-typography-title-large-font);
|
|
1936
|
+
color: var(--primer-color-text-primary);
|
|
1937
|
+
margin: 0;
|
|
1871
1938
|
}
|
|
1872
1939
|
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1940
|
+
.edit-button {
|
|
1941
|
+
display: flex;
|
|
1942
|
+
align-items: center;
|
|
1943
|
+
justify-content: center;
|
|
1876
1944
|
}
|
|
1877
1945
|
|
|
1878
|
-
.
|
|
1879
|
-
|
|
1880
|
-
outline-offset: -2px;
|
|
1946
|
+
.edit-button.active {
|
|
1947
|
+
color: var(--primer-color-brand);
|
|
1881
1948
|
}
|
|
1949
|
+
`;var re=class extends h{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 d`
|
|
1950
|
+
<div class="vault-manager-header">
|
|
1951
|
+
<h3>${v("previouslyUsed",{id:"previouslyUsed"})}</h3>
|
|
1882
1952
|
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1953
|
+
${this.hasPaymentMethods?d`
|
|
1954
|
+
<primer-button
|
|
1955
|
+
class="edit-button ${this.isEditMode?"active":""}"
|
|
1956
|
+
@click=${this.toggleEditMode}
|
|
1957
|
+
aria-label=${this.isEditMode?v("confirm",{id:"confirm"}):v("editPaymentMethods",{id:"editPaymentMethods"})}
|
|
1958
|
+
>
|
|
1959
|
+
${this.isEditMode?d`<primer-icon name="checkmark" size="sm"></primer-icon>`:d`<primer-icon name="pencil" size="sm"></primer-icon>`}
|
|
1960
|
+
</primer-button>
|
|
1961
|
+
`:c}
|
|
1962
|
+
</div>
|
|
1963
|
+
`}};re.styles=[x,qo],s([l({type:Boolean})],re.prototype,"isEditMode",2),s([l({type:Boolean})],re.prototype,"hasPaymentMethods",2),re=s([g("primer-vault-manager-header"),M()],re);var Wo=u`
|
|
1964
|
+
:host {
|
|
1965
|
+
display: block;
|
|
1966
|
+
width: 100%;
|
|
1888
1967
|
}
|
|
1889
1968
|
|
|
1890
|
-
.
|
|
1969
|
+
.delete-confirmation {
|
|
1970
|
+
margin-top: var(--primer-space-small);
|
|
1971
|
+
padding: var(--primer-space-medium);
|
|
1972
|
+
background-color: var(--primer-color-gray-000);
|
|
1973
|
+
border: 1px solid var(--primer-color-red-500);
|
|
1974
|
+
border-radius: var(--primer-radius-medium);
|
|
1975
|
+
}
|
|
1976
|
+
|
|
1977
|
+
.delete-message {
|
|
1978
|
+
margin-bottom: var(--primer-space-medium);
|
|
1979
|
+
}
|
|
1980
|
+
|
|
1981
|
+
.delete-text {
|
|
1982
|
+
margin: 0;
|
|
1983
|
+
color: var(--primer-color-text-secondary);
|
|
1891
1984
|
font-size: var(--primer-typography-body-medium-size);
|
|
1892
|
-
font-family: var(--primer-typography-body-medium-font);
|
|
1893
|
-
line-height: var(--primer-typography-body-medium-line-height);
|
|
1894
|
-
letter-spacing: var(--primer-typography-body-medium-letter-spacing);
|
|
1895
|
-
white-space: nowrap;
|
|
1896
|
-
color: var(--primer-color-text-primary);
|
|
1897
|
-
flex: 1;
|
|
1898
1985
|
}
|
|
1899
1986
|
|
|
1900
|
-
.
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
height: var(--primer-size-small);
|
|
1987
|
+
.delete-actions {
|
|
1988
|
+
display: flex;
|
|
1989
|
+
justify-content: flex-end;
|
|
1990
|
+
gap: var(--primer-space-small);
|
|
1905
1991
|
}
|
|
1906
|
-
`;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" size="sm"></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`
|
|
1907
|
-
<button
|
|
1908
|
-
${Xr(this.buttonRef)}
|
|
1909
|
-
class="network-selector"
|
|
1910
|
-
@click=${this.toggleDropdown}
|
|
1911
|
-
@keydown=${n=>{(n.key===" "||n.key==="Enter")&&o&&(n.preventDefault(),this.isDropdownOpen=!this.isDropdownOpen,this.isDropdownOpen&&(this.focusedNetworkIndex=this.getSelectedNetworkIndex()))}}
|
|
1912
|
-
aria-label=${o?`Selected card network: ${r.displayName}. Click to change.`:`Card network: ${r.displayName}`}
|
|
1913
|
-
aria-expanded=${o?this.isDropdownOpen:h}
|
|
1914
|
-
aria-haspopup=${o?"true":h}
|
|
1915
|
-
aria-controls=${o?"network-dropdown":h}
|
|
1916
|
-
>
|
|
1917
|
-
<img
|
|
1918
|
-
class="network-icon"
|
|
1919
|
-
src=${this.getNetworkIconUrl(r)}
|
|
1920
|
-
alt=${r.displayName}
|
|
1921
|
-
/>
|
|
1922
|
-
${V(o,()=>c`
|
|
1923
|
-
<primer-icon
|
|
1924
|
-
class="caret ${this.isDropdownOpen?"open":""}"
|
|
1925
|
-
name="chevron-down"
|
|
1926
|
-
></primer-icon>
|
|
1927
|
-
`,()=>h)}
|
|
1928
|
-
</button>
|
|
1929
1992
|
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
${Xr(g=>this.setNetworkOptionRef(g,l))}
|
|
1941
|
-
class="network-option ${this.isKeyboardNavigation&&l===this.focusedNetworkIndex?"focused":""}"
|
|
1942
|
-
@click=${g=>this.selectNetwork(g,n)}
|
|
1943
|
-
@keydown=${g=>{(g.key==="Enter"||g.key===" ")&&this.selectNetwork(g,n)}}
|
|
1944
|
-
role="option"
|
|
1945
|
-
aria-selected=${n.network===r.network}
|
|
1946
|
-
tabindex="${l===this.focusedNetworkIndex?"0":"-1"}"
|
|
1947
|
-
>
|
|
1948
|
-
<img
|
|
1949
|
-
class="network-option-icon"
|
|
1950
|
-
src=${this.getNetworkIconUrl(n)}
|
|
1951
|
-
alt=${n.displayName}
|
|
1952
|
-
/>
|
|
1953
|
-
<span class="network-name">${n.displayName}</span>
|
|
1954
|
-
${V(n.network===r.network,()=>c`
|
|
1955
|
-
<primer-icon
|
|
1956
|
-
class="checkmark"
|
|
1957
|
-
name="checkmark"
|
|
1958
|
-
></primer-icon>
|
|
1959
|
-
`,()=>h)}
|
|
1960
|
-
</div>
|
|
1961
|
-
`)}
|
|
1962
|
-
</div>
|
|
1963
|
-
`,()=>h)}
|
|
1964
|
-
`}};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`
|
|
1965
|
-
:host {
|
|
1966
|
-
display: block;
|
|
1967
|
-
width: 100%;
|
|
1968
|
-
position: relative;
|
|
1993
|
+
.delete-confirm {
|
|
1994
|
+
background-color: var(--primer-color-red-500);
|
|
1995
|
+
color: var(--primer-color-gray-000);
|
|
1996
|
+
border: none;
|
|
1997
|
+
padding: var(--primer-space-small) var(--primer-space-medium);
|
|
1998
|
+
border-radius: var(--primer-radius-small);
|
|
1999
|
+
font-weight: var(--primer-typography-body-medium-weight);
|
|
2000
|
+
cursor: pointer;
|
|
2001
|
+
transition: background-color var(--primer-animation-duration)
|
|
2002
|
+
var(--primer-animation-easing);
|
|
1969
2003
|
}
|
|
1970
2004
|
|
|
1971
|
-
.
|
|
1972
|
-
|
|
1973
|
-
flex-direction: column;
|
|
1974
|
-
position: relative;
|
|
2005
|
+
.delete-confirm:hover:not(:disabled) {
|
|
2006
|
+
background-color: var(--primer-color-red-900);
|
|
1975
2007
|
}
|
|
1976
2008
|
|
|
1977
|
-
.
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
width: 100%;
|
|
1981
|
-
position: relative;
|
|
2009
|
+
.delete-confirm:disabled {
|
|
2010
|
+
opacity: 0.7;
|
|
2011
|
+
cursor: not-allowed;
|
|
1982
2012
|
}
|
|
1983
2013
|
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
2014
|
+
.delete-cancel {
|
|
2015
|
+
background-color: transparent;
|
|
2016
|
+
border: 1px solid var(--primer-color-border-outlined-default);
|
|
2017
|
+
padding: var(--primer-space-small) var(--primer-space-medium);
|
|
2018
|
+
border-radius: var(--primer-radius-small);
|
|
2019
|
+
color: var(--primer-color-text-primary);
|
|
2020
|
+
font-weight: var(--primer-typography-body-medium-weight);
|
|
2021
|
+
cursor: pointer;
|
|
2022
|
+
transition: background-color var(--primer-animation-duration)
|
|
1989
2023
|
var(--primer-animation-easing);
|
|
1990
|
-
width: 100%;
|
|
1991
|
-
position: relative;
|
|
1992
2024
|
}
|
|
1993
2025
|
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
min-height: 0;
|
|
1997
|
-
overflow: hidden;
|
|
2026
|
+
.delete-cancel:hover:not(:disabled) {
|
|
2027
|
+
background-color: var(--primer-color-gray-100);
|
|
1998
2028
|
}
|
|
1999
2029
|
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2030
|
+
.delete-cancel:disabled {
|
|
2031
|
+
opacity: 0.7;
|
|
2032
|
+
cursor: not-allowed;
|
|
2033
|
+
}
|
|
2034
|
+
`;var Z=class extends h{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 d`
|
|
2035
|
+
<div class="delete-confirmation">
|
|
2036
|
+
<div class="delete-message">
|
|
2037
|
+
<p class="delete-text">${t}</p>
|
|
2038
|
+
</div>
|
|
2039
|
+
<div class="delete-actions">
|
|
2040
|
+
<button
|
|
2041
|
+
class="delete-confirm"
|
|
2042
|
+
@click=${this.handleConfirmClick}
|
|
2043
|
+
?disabled=${this.isDeleting}
|
|
2044
|
+
>
|
|
2045
|
+
${this.isDeleting?v("deleting",{id:"deleting"}):v("confirmVaultedPaymentMethodDeletion",{id:"confirmVaultedPaymentMethodDeletion"})}
|
|
2046
|
+
</button>
|
|
2047
|
+
<button
|
|
2048
|
+
class="delete-cancel"
|
|
2049
|
+
@click=${this.handleCancelClick}
|
|
2050
|
+
?disabled=${this.isDeleting}
|
|
2051
|
+
>
|
|
2052
|
+
${v("cancel",{id:"cancel"})}
|
|
2053
|
+
</button>
|
|
2054
|
+
</div>
|
|
2055
|
+
</div>
|
|
2056
|
+
`}};Z.styles=[x,Wo],s([l({type:Boolean})],Z.prototype,"isDeleting",2),s([l({type:String})],Z.prototype,"paymentMethodId",2),s([l({type:String})],Z.prototype,"paymentMethodName",2),s([f({context:B,subscribe:!0})],Z.prototype,"vaultManager",2),Z=s([g("primer-vault-delete-confirmation"),M()],Z);var Zo=u`
|
|
2057
|
+
:host {
|
|
2058
|
+
display: block;
|
|
2008
2059
|
width: 100%;
|
|
2009
2060
|
}
|
|
2010
2061
|
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2062
|
+
.empty-state {
|
|
2063
|
+
padding: var(--primer-space-xlarge) 0;
|
|
2064
|
+
text-align: center;
|
|
2065
|
+
color: var(--primer-color-text-secondary);
|
|
2014
2066
|
}
|
|
2015
2067
|
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2068
|
+
.empty-state p {
|
|
2069
|
+
margin: 0;
|
|
2070
|
+
}
|
|
2071
|
+
`;var xe=class extends h{render(){return d`
|
|
2072
|
+
<div class="empty-state">
|
|
2073
|
+
<p>
|
|
2074
|
+
${v("savedPaymentMethodsEmpty",{id:"savedPaymentMethodsEmpty"})}
|
|
2075
|
+
</p>
|
|
2076
|
+
</div>
|
|
2077
|
+
`}};xe.styles=[x,Zo],xe=s([g("primer-vault-empty-state"),M()],xe);var Xo=u`
|
|
2078
|
+
:host {
|
|
2079
|
+
display: block;
|
|
2019
2080
|
width: 100%;
|
|
2020
2081
|
}
|
|
2021
2082
|
|
|
2022
|
-
|
|
2023
|
-
.payment-methods-list {
|
|
2083
|
+
.error-message {
|
|
2024
2084
|
display: flex;
|
|
2025
|
-
|
|
2085
|
+
background-color: var(--primer-color-red-100);
|
|
2086
|
+
padding: var(--primer-space-medium);
|
|
2087
|
+
border-radius: var(--primer-radius-small);
|
|
2088
|
+
margin-bottom: var(--primer-space-medium);
|
|
2089
|
+
justify-content: space-between;
|
|
2090
|
+
align-items: center;
|
|
2091
|
+
border: 1px solid var(--primer-color-red-500);
|
|
2092
|
+
}
|
|
2093
|
+
|
|
2094
|
+
.error-content {
|
|
2095
|
+
display: flex;
|
|
2096
|
+
align-items: center;
|
|
2026
2097
|
gap: var(--primer-space-small);
|
|
2027
|
-
width: 100%;
|
|
2028
|
-
position: relative;
|
|
2029
2098
|
}
|
|
2030
2099
|
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2100
|
+
.error-message p {
|
|
2101
|
+
margin: 0;
|
|
2102
|
+
color: var(--primer-color-text-negative);
|
|
2103
|
+
font-size: var(--primer-typography-body-medium-size);
|
|
2035
2104
|
}
|
|
2036
2105
|
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
height: 100%;
|
|
2106
|
+
.error-message button {
|
|
2107
|
+
background: transparent;
|
|
2108
|
+
border: none;
|
|
2109
|
+
color: var(--primer-color-text-negative);
|
|
2110
|
+
cursor: pointer;
|
|
2111
|
+
padding: var(--primer-space-xsmall);
|
|
2044
2112
|
display: flex;
|
|
2045
2113
|
align-items: center;
|
|
2046
2114
|
justify-content: center;
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
backdrop-filter: blur(2px);
|
|
2051
|
-
opacity: 0; /* Start invisible */
|
|
2115
|
+
border-radius: var(--primer-radius-small);
|
|
2116
|
+
transition: background-color var(--primer-animation-duration)
|
|
2117
|
+
var(--primer-animation-easing);
|
|
2052
2118
|
}
|
|
2053
2119
|
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
pointer-events: none; /* Prevent interaction when updating */
|
|
2120
|
+
.error-message button:hover {
|
|
2121
|
+
background-color: rgba(0, 0, 0, 0.05);
|
|
2057
2122
|
}
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2123
|
+
`;var ne=class extends h{constructor(){super(...arguments);this.errorMessage=""}handleDismiss(){this.dispatchEvent(new CustomEvent("close-error",{bubbles:!0,composed:!0}))}render(){return d`
|
|
2124
|
+
<div class="error-message">
|
|
2125
|
+
<div class="error-content">
|
|
2126
|
+
<primer-icon
|
|
2127
|
+
name="warning"
|
|
2128
|
+
size="sm"
|
|
2129
|
+
color="var(--primer-color-red-500)"
|
|
2130
|
+
></primer-icon>
|
|
2131
|
+
<p>${this.errorMessage}</p>
|
|
2132
|
+
</div>
|
|
2133
|
+
<button
|
|
2134
|
+
@click=${this.handleDismiss}
|
|
2135
|
+
aria-label=${v("closeErrorMessage",{id:"closeErrorMessage"})}
|
|
2136
|
+
>
|
|
2137
|
+
<primer-icon name="close" size="sm"></primer-icon>
|
|
2138
|
+
</button>
|
|
2139
|
+
</div>
|
|
2140
|
+
`}};ne.styles=[x,Xo],s([l({type:String})],ne.prototype,"errorMessage",2),ne=s([g("primer-vault-error-message"),M()],ne);var Qo=u`
|
|
2141
|
+
:host {
|
|
2142
|
+
display: contents;
|
|
2143
|
+
}
|
|
2144
|
+
`;var O=class extends h{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:v("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}`:c;return d`
|
|
2145
|
+
<primer-button
|
|
2146
|
+
buttonType="submit"
|
|
2147
|
+
variant=${this.variant}
|
|
2148
|
+
@click=${this.handleClick}
|
|
2149
|
+
.disabled=${this.isButtonDisabled}
|
|
2150
|
+
.loading=${this.sdkState?.isProcessing}
|
|
2151
|
+
data-submit
|
|
2152
|
+
>
|
|
2153
|
+
${this.buttonText}${r}
|
|
2154
|
+
</primer-button>
|
|
2155
|
+
`}};O.styles=[x,Qo],s([l({type:String})],O.prototype,"buttonText",1),s([f({context:D,subscribe:!0}),l({type:Object})],O.prototype,"headlessInstance",2),s([f({context:$,subscribe:!0}),l()],O.prototype,"sdkState",2),s([f({context:Te,subscribe:!0}),l({type:Object,attribute:!1,hasChanged(t,r){return t?.selectedVaultedPaymentMethod?.id!==r?.selectedVaultedPaymentMethod?.id}})],O.prototype,"vaultItemContext",2),s([f({context:B,subscribe:!0}),l({type:Object,attribute:!1})],O.prototype,"vaultManager",2),s([f({context:Pe,subscribe:!0}),l({type:Object,attribute:!1,hasChanged(t,r){return t?.submitButton?.amountVisible!==r?.submitButton?.amountVisible}})],O.prototype,"clientOptions",2),s([l({type:String})],O.prototype,"variant",2),s([l({type:Boolean})],O.prototype,"disabled",2),O=s([g("primer-vault-payment-submit"),M()],O);function kr(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}var Jo=u`
|
|
2156
|
+
:host {
|
|
2066
2157
|
display: block;
|
|
2067
|
-
|
|
2158
|
+
margin-top: var(--primer-space-medium);
|
|
2068
2159
|
}
|
|
2069
2160
|
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
.content-container,
|
|
2073
|
-
.submit-button-container,
|
|
2074
|
-
primer-vault-payment-method-item,
|
|
2075
|
-
primer-vault-payment-submit,
|
|
2076
|
-
primer-vault-empty-state,
|
|
2077
|
-
primer-vault-delete-confirmation {
|
|
2078
|
-
transition: none;
|
|
2079
|
-
}
|
|
2161
|
+
.cvv-input-container {
|
|
2162
|
+
margin-bottom: var(--primer-space-medium);
|
|
2080
2163
|
}
|
|
2081
|
-
`;var
|
|
2082
|
-
|
|
2083
|
-
\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`
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
.isDeleting=${this.isDeleting}
|
|
2097
|
-
.paymentMethodId=${this.deletePaymentMethodId}
|
|
2098
|
-
.paymentMethodName=${t}
|
|
2099
|
-
@confirm-delete=${this.handleConfirmDelete}
|
|
2100
|
-
@cancel-delete=${this.handleCancelDelete}
|
|
2101
|
-
${je({...this.getAnimationConfig(),properties:["opacity"],in:[{opacity:0},{opacity:1}],out:[{opacity:1},{opacity:0}]})}
|
|
2102
|
-
></primer-vault-delete-confirmation>
|
|
2103
|
-
</div>
|
|
2104
|
-
`}renderPaymentMethodItem(t){return this.deletePaymentMethodId===t.id?h:c`
|
|
2105
|
-
<primer-vault-payment-method-item
|
|
2106
|
-
.paymentMethod=${t}
|
|
2107
|
-
.isEditMode=${this.isEditMode}
|
|
2108
|
-
@delete-payment-method=${this.handleDeletePaymentMethod}
|
|
2109
|
-
${je({...this.getAnimationConfig(),properties:["opacity"],in:[{opacity:0},{opacity:1}],out:[{opacity:1},{opacity:0}]})}
|
|
2110
|
-
></primer-vault-payment-method-item>
|
|
2111
|
-
`}renderPaymentMethodList(){let t=this.vaultManagerContext?.vaultedPaymentMethods||[],r=!this.isEditMode&&t.length>0&&!this.deletePaymentMethodId;return c`
|
|
2112
|
-
<div class="payment-methods-list">
|
|
2113
|
-
${t.map(o=>this.renderPaymentMethodItem(o))}
|
|
2114
|
-
${V(r,()=>c`
|
|
2115
|
-
<div class="submit-button-container">
|
|
2116
|
-
<primer-vault-payment-submit
|
|
2117
|
-
class="submit-button"
|
|
2118
|
-
@primer-vault-payment-error=${this.handlePaymentError}
|
|
2119
|
-
${je({...this.getAnimationConfig(),properties:["opacity"],in:[{opacity:0},{opacity:1}],out:[{opacity:1},{opacity:0}]})}
|
|
2120
|
-
></primer-vault-payment-submit>
|
|
2121
|
-
</div>
|
|
2122
|
-
`,()=>h)}
|
|
2123
|
-
</div>
|
|
2124
|
-
`}render(){if(!this.vaultManagerContext?.enabled)return h;let t=this.vaultManagerContext.vaultedPaymentMethods.length>0,r=this.vaultManagerContext.isLoading,o=this.vaultManagerContext.isUpdating;return c`
|
|
2125
|
-
<div class="vault-manager ${o?"is-updating":""}">
|
|
2126
|
-
<primer-vault-manager-header
|
|
2127
|
-
.isEditMode=${this.isEditMode}
|
|
2128
|
-
.hasPaymentMethods=${t}
|
|
2129
|
-
@toggle-edit-mode=${this.handleToggleEditMode}
|
|
2130
|
-
></primer-vault-manager-header>
|
|
2131
|
-
|
|
2132
|
-
${V(this.errorMessage,()=>c`
|
|
2133
|
-
<primer-vault-error-message
|
|
2134
|
-
.errorMessage=${this.errorMessage}
|
|
2135
|
-
@close-error=${this.handleCloseError}
|
|
2136
|
-
${je({...this.getAnimationConfig(),properties:["opacity"],in:[{opacity:0},{opacity:1}],out:[{opacity:1},{opacity:0}]})}
|
|
2137
|
-
></primer-vault-error-message>
|
|
2138
|
-
`,()=>h)}
|
|
2139
|
-
|
|
2140
|
-
<div class="vault-manager-content">
|
|
2141
|
-
${V(!r&&!t,()=>c`
|
|
2142
|
-
<div class="content-container">
|
|
2143
|
-
<primer-vault-empty-state
|
|
2144
|
-
${je({...this.getAnimationConfig(),properties:["opacity"],in:[{opacity:0},{opacity:1}],out:[{opacity:1},{opacity:0}]})}
|
|
2145
|
-
></primer-vault-empty-state>
|
|
2146
|
-
</div>
|
|
2147
|
-
`,()=>h)}
|
|
2148
|
-
${V(!r&&t,()=>c`
|
|
2149
|
-
<div class="content-container">
|
|
2150
|
-
${V(this.deletePaymentMethodId,()=>this.renderDeleteConfirmation(),()=>this.renderPaymentMethodList())}
|
|
2151
|
-
</div>
|
|
2152
|
-
`,()=>h)}
|
|
2153
|
-
</div>
|
|
2154
|
-
|
|
2155
|
-
${V(o,()=>this.renderLoadingOverlay(),()=>h)}
|
|
2156
|
-
</div>
|
|
2157
|
-
`}};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`
|
|
2164
|
+
`;var R=class extends h{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 k(this,{task:async([t,r])=>!t||!r||t.paymentMethodType!=="PAYMENT_CARD"||!t.paymentInstrumentData?.network||r.createCvvInput===null?_:{network:t.paymentInstrumentData.network,createCvvInput:r.createCvvInput},args:()=>[this.paymentMethod,this.vaultManagerFormContext]});this.cvvContainerId=`cvv-container-${Math.random().toString(36).substring(2,9)}`,new k(this,{task:async([t])=>{if(!t)return _;await this.updateComplete;let r=this.renderRoot.querySelector(`#${this.cvvContainerId}`);if(!r)return;let o=kr(this.computedStyles),a=o?{input:{base:o}}:void 0,n={cardNetwork:t.network,container:r,name:"cvv",placeholder:"123",style:a};this.cvvInput=await t.createCvvInput?.(n)??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:()=>c,complete:()=>d`
|
|
2165
|
+
<div class="cvv-input-container">
|
|
2166
|
+
<primer-input-wrapper
|
|
2167
|
+
.hasError=${!!this.cvvError&&(this.vaultManagerCvvContext?.formIsDirty||this.cvvInputIsDirty&&this.cvvInputIsBlurred)}
|
|
2168
|
+
>
|
|
2169
|
+
<primer-input-label slot="label">CVV</primer-input-label>
|
|
2170
|
+
<div slot="input" id="${this.cvvContainerId}"></div>
|
|
2171
|
+
${P(this.cvvError&&(this.vaultManagerCvvContext?.formIsDirty||this.cvvInputIsDirty&&this.cvvInputIsBlurred),()=>d`
|
|
2172
|
+
<primer-input-error slot="error">
|
|
2173
|
+
${this.cvvError}
|
|
2174
|
+
</primer-input-error>
|
|
2175
|
+
`)}
|
|
2176
|
+
</primer-input-wrapper>
|
|
2177
|
+
</div>
|
|
2178
|
+
`})}};R.styles=[x,Jo],s([f({context:B,subscribe:!0}),l({type:Object,attribute:!1,hasChanged(t,r){return t?.createCvvInput!==r?.createCvvInput}})],R.prototype,"vaultManagerFormContext",2),s([f({context:Te,subscribe:!0}),l({type:Object,attribute:!1})],R.prototype,"vaultManagerCvvContext",2),s([f({context:we,subscribe:!0}),l()],R.prototype,"computedStyles",2),s([l({type:Object})],R.prototype,"paymentMethod",2),s([C()],R.prototype,"cvvError",2),s([C()],R.prototype,"cvvInputIsDirty",2),s([C()],R.prototype,"cvvInputIsBlurred",2),s([C()],R.prototype,"cvvInput",2),R=s([g("primer-vault-cvv-input"),M()],R);var Pr="card-form-context";var ea=u`
|
|
2158
2179
|
:host {
|
|
2159
|
-
display:
|
|
2160
|
-
width: 100%;
|
|
2161
|
-
flex-direction: column;
|
|
2180
|
+
display: contents;
|
|
2162
2181
|
}
|
|
2163
2182
|
|
|
2164
|
-
|
|
2183
|
+
form {
|
|
2165
2184
|
display: flex;
|
|
2166
2185
|
flex-direction: column;
|
|
2186
|
+
gap: var(--primer-space-medium);
|
|
2167
2187
|
width: 100%;
|
|
2168
2188
|
}
|
|
2169
2189
|
|
|
2170
|
-
.
|
|
2190
|
+
.card-form {
|
|
2171
2191
|
display: flex;
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2192
|
+
flex-direction: column;
|
|
2193
|
+
gap: var(--primer-space-medium);
|
|
2194
|
+
margin-bottom: var(--primer-space-medium);
|
|
2175
2195
|
}
|
|
2176
2196
|
|
|
2177
|
-
|
|
2178
|
-
primer-button::part(button) {
|
|
2179
|
-
width: 100%;
|
|
2180
|
-
justify-content: flex-start;
|
|
2197
|
+
.card-form-row {
|
|
2181
2198
|
display: flex;
|
|
2182
|
-
|
|
2199
|
+
gap: var(--primer-space-small);
|
|
2183
2200
|
}
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2201
|
+
`;var ie=class extends h{constructor(){super(...arguments);this.hideLabels=!1;this.hasAssignedContent=!1;this.selectedCardNetwork=null;this.paymentManagers=new Map;this.cardFormProvider=new N(this,{context:Pr,initialValue:null});this.eventsController=new tt(this);this.setupCardFormTask=new k(this,{task:async([t])=>{if(!t?.manager)return _;let{manager:r}=t,{cardNumberInput:o,expiryInput:a,cvvInput:n}=r.createHostedInputs();return this.cardFormProvider.setValue({cardNumberInput:o,expiryInput:a,cvvInput:n,setCardholderName:m=>r.setCardholderName(m),setCardNetwork:m=>{this.selectedCardNetwork=m},validate:()=>r.validate(),submit:m=>r.submit(m),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",a=r==="primer-button";return o&&(t.getAttribute("type")==="submit"||t.hasAttribute("data-submit"))||a&&(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===$e.ERROR||this.setupCardFormTask.status===$e.INITIAL?c:d`
|
|
2202
|
+
<form @submit=${this.handleFormSubmit}>
|
|
2203
|
+
<slot name="card-form-content" @slotchange=${this.onSlotChange}></slot>
|
|
2204
|
+
${this.setupCardFormTask.render({complete:()=>P(this.hasAssignedContent,()=>c,()=>d`
|
|
2205
|
+
<div class="card-form">
|
|
2206
|
+
<primer-input-card-number></primer-input-card-number>
|
|
2207
|
+
<div class="card-form-row">
|
|
2208
|
+
<primer-input-card-expiry></primer-input-card-expiry>
|
|
2209
|
+
<primer-input-cvv></primer-input-cvv>
|
|
2210
|
+
</div>
|
|
2211
|
+
<primer-input-card-holder-name></primer-input-card-holder-name>
|
|
2212
|
+
</div>
|
|
2213
|
+
<primer-card-form-submit></primer-card-form-submit>
|
|
2214
|
+
`)})}
|
|
2215
|
+
</form>
|
|
2216
|
+
`}};ie.styles=[x,ea],s([l({type:Boolean,attribute:"hide-labels",reflect:!0})],ie.prototype,"hideLabels",2),s([C()],ie.prototype,"hasAssignedContent",2),s([C()],ie.prototype,"selectedCardNetwork",2),s([f({context:F,subscribe:!0}),l({type:Object})],ie.prototype,"paymentManagers",2),ie=s([g("primer-card-form"),M()],ie);function ta(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=`
|
|
2217
|
+
input[data-custom-input]::placeholder {
|
|
2218
|
+
color: var(--primer-color-text-placeholder);
|
|
2219
|
+
font-size: var(--primer-typography-body-large-size);
|
|
2220
|
+
font-family: var(--primer-typography-body-large-font);
|
|
2221
|
+
}
|
|
2222
|
+
input[data-custom-input]:focus {
|
|
2223
|
+
outline: none;
|
|
2224
|
+
}
|
|
2225
|
+
`,e.shadowRoot?e.shadowRoot.appendChild(t):e.appendChild(t)}}function ra(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 wr=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 k(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 _;await this.host.updateComplete;let t=this.getTargetContainer();return t?e==="cardholderName"?this.setupStandardInput(t):this.setupHostedIframeInput(e,t):_}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,ta(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(a=>requestAnimationFrame(()=>a())),this._hostedInput=e;let r=kr(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",a=>{this._meta=a,ra(this._meta,a)&&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 Y=class extends h{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:v(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 wr(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===$e.ERROR)return c;let t=this.getError();return d`
|
|
2226
|
+
<primer-input-wrapper
|
|
2227
|
+
.focusWithin="${this.hostedInputController.isFocused}"
|
|
2228
|
+
.hasError=${!!t}
|
|
2229
|
+
@wrapper-click="${this.handleWrapperClick}"
|
|
2230
|
+
>
|
|
2231
|
+
${P(!this.cardFormContext?.hideLabels,()=>d`<primer-input-label slot="label"
|
|
2232
|
+
>${this.label}</primer-input-label
|
|
2233
|
+
>`,()=>c)}
|
|
2234
|
+
<div
|
|
2235
|
+
slot="input"
|
|
2236
|
+
class="card-input-slot"
|
|
2237
|
+
id="${this.config.containerSelector.substring(1)}"
|
|
2238
|
+
aria-label="${this.ariaLabel}"
|
|
2239
|
+
></div>
|
|
2240
|
+
${P(t,()=>d`
|
|
2241
|
+
<primer-input-error slot="error">
|
|
2242
|
+
${v(t,{id:t})}
|
|
2243
|
+
</primer-input-error>
|
|
2244
|
+
`,()=>c)}
|
|
2245
|
+
</primer-input-wrapper>
|
|
2246
|
+
`}};s([f({context:Pr,subscribe:!0})],Y.prototype,"cardFormContext",2),s([f({context:we,subscribe:!0}),l()],Y.prototype,"computedStyles",2),s([l({type:String})],Y.prototype,"label",1),s([l({type:String})],Y.prototype,"placeholder",1),s([l({type:String,attribute:"aria-label"})],Y.prototype,"ariaLabel",1);var ia=u`
|
|
2247
|
+
:host {
|
|
2248
|
+
display: contents;
|
|
2192
2249
|
}
|
|
2193
2250
|
|
|
2194
|
-
.
|
|
2251
|
+
.card-number-container {
|
|
2195
2252
|
display: flex;
|
|
2196
2253
|
align-items: center;
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
flex-shrink: 0;
|
|
2201
|
-
}
|
|
2202
|
-
|
|
2203
|
-
.payment-method-details {
|
|
2204
|
-
flex: 1;
|
|
2205
|
-
display: flex;
|
|
2206
|
-
gap: var(--primer-space-xsmall);
|
|
2207
|
-
align-items: flex-start;
|
|
2208
|
-
transition: transform var(--primer-animation-duration)
|
|
2209
|
-
var(--primer-animation-easing);
|
|
2210
|
-
margin-left: var(--primer-space-small);
|
|
2211
|
-
}
|
|
2212
|
-
|
|
2213
|
-
.payment-method-description {
|
|
2214
|
-
font-weight: var(--primer-typography-title-large-weight);
|
|
2215
|
-
color: var(--primer-color-text-primary);
|
|
2216
|
-
transition: color var(--primer-animation-duration)
|
|
2217
|
-
var(--primer-animation-easing);
|
|
2218
|
-
}
|
|
2219
|
-
|
|
2220
|
-
.payment-method-secondary-description {
|
|
2221
|
-
font-size: var(--primer-typography-body-small-size);
|
|
2222
|
-
color: var(--primer-color-text-secondary);
|
|
2223
|
-
transition: color var(--primer-animation-duration)
|
|
2224
|
-
var(--primer-animation-easing);
|
|
2254
|
+
width: 100%;
|
|
2255
|
+
position: relative;
|
|
2256
|
+
gap: var(--primer-space-small);
|
|
2225
2257
|
}
|
|
2226
2258
|
|
|
2227
|
-
|
|
2259
|
+
#cardNumber {
|
|
2228
2260
|
flex: 1;
|
|
2229
|
-
}
|
|
2230
|
-
|
|
2231
|
-
/* Delete button - for edit mode */
|
|
2232
|
-
.delete-button {
|
|
2233
|
-
background-color: transparent;
|
|
2234
|
-
border: none;
|
|
2235
|
-
color: var(--primer-color-red-500);
|
|
2236
|
-
cursor: pointer;
|
|
2237
|
-
padding: var(--primer-space-xsmall);
|
|
2238
|
-
border-radius: var(--primer-radius-small);
|
|
2239
|
-
flex-shrink: 0;
|
|
2240
2261
|
display: flex;
|
|
2241
|
-
align-items: center;
|
|
2242
|
-
justify-content: center;
|
|
2243
|
-
height: var(--primer-size-medium);
|
|
2244
|
-
width: var(--primer-size-medium);
|
|
2245
|
-
margin-left: var(--primer-space-small);
|
|
2246
|
-
transition:
|
|
2247
|
-
background-color var(--primer-animation-duration)
|
|
2248
|
-
var(--primer-animation-easing),
|
|
2249
|
-
transform var(--primer-animation-duration) var(--primer-animation-easing);
|
|
2250
|
-
}
|
|
2251
|
-
|
|
2252
|
-
.delete-button:hover {
|
|
2253
|
-
background-color: var(--primer-color-red-100);
|
|
2254
|
-
transform: scale(1.05);
|
|
2255
|
-
}
|
|
2256
|
-
|
|
2257
|
-
.delete-button:active {
|
|
2258
|
-
transform: scale(0.95);
|
|
2259
|
-
}
|
|
2260
|
-
|
|
2261
|
-
.delete-button primer-icon {
|
|
2262
|
-
color: var(--primer-color-red-500);
|
|
2263
|
-
}
|
|
2264
|
-
`;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
|
|
2265
|
-
class="payment-method-icon"
|
|
2266
|
-
src=${t.icon}
|
|
2267
|
-
alt=${t.description}
|
|
2268
|
-
/>`:c`
|
|
2269
|
-
<div class="payment-method-icon payment-method-icon-generic">
|
|
2270
|
-
<primer-icon name="payment-card" size="sm"></primer-icon>
|
|
2271
|
-
</div>
|
|
2272
|
-
`;return c`
|
|
2273
|
-
${r}
|
|
2274
|
-
<div class="payment-method-details">
|
|
2275
|
-
<div class="payment-method-description">${t.description}</div>
|
|
2276
|
-
${t.secondaryDescription?c`<div class="payment-method-secondary-description">
|
|
2277
|
-
${t.secondaryDescription}
|
|
2278
|
-
</div>`:h}
|
|
2279
|
-
</div>
|
|
2280
|
-
`}render(){return this._getAssetsTask.render({error:()=>h,complete:t=>{let r=this.isSelected()?"checked":"default";return c`
|
|
2281
|
-
<div class="payment-method-wrapper">
|
|
2282
|
-
<div class="payment-method-container">
|
|
2283
|
-
<primer-button
|
|
2284
|
-
variant="secondary"
|
|
2285
|
-
class="payment-method-button"
|
|
2286
|
-
selectable
|
|
2287
|
-
?disabled=${this.isEditMode}
|
|
2288
|
-
selectionState=${r}
|
|
2289
|
-
@click=${this.handleClick}
|
|
2290
|
-
>
|
|
2291
|
-
${this.renderPaymentMethodContent(t)}
|
|
2292
|
-
</primer-button>
|
|
2293
|
-
|
|
2294
|
-
${this.isEditMode?c`
|
|
2295
|
-
<button
|
|
2296
|
-
class="delete-button"
|
|
2297
|
-
@click=${this.handleDeleteClick}
|
|
2298
|
-
aria-label=${`${A("delete",{id:"delete"})} ${t.description}`}
|
|
2299
|
-
>
|
|
2300
|
-
<primer-icon name="trash" size="sm"></primer-icon>
|
|
2301
|
-
</button>
|
|
2302
|
-
`:h}
|
|
2303
|
-
</div>
|
|
2304
|
-
|
|
2305
|
-
${V(t.shouldShowCVV&&this.isSelected()&&!this.isEditMode,()=>c`<primer-vault-cvv-input
|
|
2306
|
-
.paymentMethod="${this.paymentMethod}"
|
|
2307
|
-
></primer-vault-cvv-input>`,()=>h)}
|
|
2308
|
-
</div>
|
|
2309
|
-
`}})}};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`
|
|
2310
|
-
:host {
|
|
2311
|
-
display: block;
|
|
2312
2262
|
width: 100%;
|
|
2313
2263
|
}
|
|
2314
2264
|
|
|
2315
|
-
.
|
|
2265
|
+
.network-selector-container {
|
|
2316
2266
|
display: flex;
|
|
2317
|
-
justify-content: space-between;
|
|
2318
2267
|
align-items: center;
|
|
2319
|
-
|
|
2320
|
-
}
|
|
2321
|
-
|
|
2322
|
-
.vault-manager-header h3 {
|
|
2323
|
-
font-size: var(--primer-typography-title-large-size);
|
|
2324
|
-
font-weight: var(--primer-typography-title-large-weight);
|
|
2325
|
-
font-family: var(--primer-typography-title-large-font);
|
|
2326
|
-
color: var(--primer-color-text-primary);
|
|
2327
|
-
margin: 0;
|
|
2268
|
+
z-index: 2;
|
|
2328
2269
|
}
|
|
2329
|
-
|
|
2330
|
-
.
|
|
2270
|
+
`;var Re=u`
|
|
2271
|
+
.card-input-slot {
|
|
2331
2272
|
display: flex;
|
|
2332
|
-
align-items: center;
|
|
2333
|
-
justify-content: center;
|
|
2334
|
-
}
|
|
2335
|
-
|
|
2336
|
-
.edit-button.active {
|
|
2337
|
-
color: var(--primer-color-brand);
|
|
2338
2273
|
}
|
|
2339
|
-
`;var
|
|
2340
|
-
<
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2274
|
+
`;var Ce=class extends Y{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===$e.ERROR)return c;let t=this.getError();return d`
|
|
2275
|
+
<primer-input-wrapper
|
|
2276
|
+
.focusWithin="${this.hostedInputController.isFocused}"
|
|
2277
|
+
.hasError=${!!t}
|
|
2278
|
+
>
|
|
2279
|
+
${P(!this.cardFormContext?.hideLabels,()=>d`<primer-input-label slot="label"
|
|
2280
|
+
>${this.label}</primer-input-label
|
|
2281
|
+
>`,()=>c)}
|
|
2282
|
+
<div
|
|
2283
|
+
slot="input"
|
|
2284
|
+
class="card-number-container"
|
|
2285
|
+
aria-label="${this.ariaLabel}"
|
|
2286
|
+
>
|
|
2287
|
+
<div id="${this.config.containerSelector.substring(1)}"></div>
|
|
2288
|
+
<div class="network-selector-container">
|
|
2289
|
+
<primer-card-network-selector
|
|
2290
|
+
@network-selected=${this.handleNetworkSelected}
|
|
2291
|
+
></primer-card-network-selector>
|
|
2292
|
+
</div>
|
|
2293
|
+
</div>
|
|
2294
|
+
${P(t,r=>d`
|
|
2295
|
+
<primer-input-error slot="error">
|
|
2296
|
+
${v(r,{id:r})}
|
|
2297
|
+
</primer-input-error>
|
|
2298
|
+
`,()=>c)}
|
|
2299
|
+
</primer-input-wrapper>
|
|
2300
|
+
`}render(){return this.renderInput()}};Ce.styles=[x,Re,ia],Ce=s([g("primer-input-card-number"),M()],Ce);var oa=u`
|
|
2354
2301
|
:host {
|
|
2355
|
-
display:
|
|
2356
|
-
width: 100%;
|
|
2302
|
+
display: contents;
|
|
2357
2303
|
}
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
padding: var(--primer-space-medium);
|
|
2362
|
-
background-color: var(--primer-color-gray-000);
|
|
2363
|
-
border: 1px solid var(--primer-color-red-500);
|
|
2364
|
-
border-radius: var(--primer-radius-medium);
|
|
2304
|
+
`;var Ee=class extends Y{constructor(){super();this.config={inputType:"cvv",containerSelector:"#cvv",errorName:"cvv-card",translations:{label:"CVV",placeholder:"123"}};this.childUpdated()}render(){return this.renderInput()}};Ee.styles=[x,Re,oa],Ee=s([g("primer-input-cvv"),M()],Ee);var aa=u`
|
|
2305
|
+
:host {
|
|
2306
|
+
display: contents;
|
|
2365
2307
|
}
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2308
|
+
`;var Ae=class extends Y{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()}};Ae.styles=[x,Re,aa],Ae=s([g("primer-input-card-expiry"),M()],Ae);var sa=u`
|
|
2309
|
+
:host {
|
|
2310
|
+
display: contents;
|
|
2369
2311
|
}
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
color: var(--primer-color-text-secondary);
|
|
2374
|
-
font-size: var(--primer-typography-body-medium-size);
|
|
2312
|
+
`;var _e=class extends Y{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()}};_e.styles=[x,Re,sa],_e=s([g("primer-input-card-holder-name"),M()],_e);var na=u`
|
|
2313
|
+
:host {
|
|
2314
|
+
display: contents;
|
|
2375
2315
|
}
|
|
2376
|
-
|
|
2377
|
-
|
|
2316
|
+
`;var z=class extends h{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:v("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}`:c;return d`
|
|
2317
|
+
<primer-button
|
|
2318
|
+
type="submit"
|
|
2319
|
+
variant=${this.variant}
|
|
2320
|
+
?disabled=${this.disabled}
|
|
2321
|
+
@click=${this.handleClick}
|
|
2322
|
+
.loading=${!!this.sdkState?.isProcessing}
|
|
2323
|
+
data-submit
|
|
2324
|
+
>
|
|
2325
|
+
${this.buttonText}${r}
|
|
2326
|
+
</primer-button>
|
|
2327
|
+
`}};z.styles=[x,na],s([l({type:String})],z.prototype,"buttonText",1),s([f({context:D,subscribe:!0}),l({type:Object})],z.prototype,"headlessInstance",2),s([f({context:Pe,subscribe:!0}),l({type:Object})],z.prototype,"clientOptions",2),s([f({context:$,subscribe:!0}),l()],z.prototype,"sdkState",2),s([l({type:String})],z.prototype,"variant",2),s([l({type:Boolean})],z.prototype,"disabled",2),z=s([g("primer-card-form-submit"),M()],z);var{I:Sx}=ji;var la=i=>i.strings===void 0;var Rt=(i,e)=>{let t=i._$AN;if(t===void 0)return!1;for(let r of t)r._$AO?.(e,!1),Rt(r,e);return!0},Tr=i=>{let e,t;do{if((e=i._$AM)===void 0)break;t=e._$AN,t.delete(i),i=e}while(t?.size===0)},da=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),fs(e)}};function hs(i){this._$AN!==void 0?(Tr(this),this._$AM=i,da(this)):this._$AM=i}function gs(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 a=t;a<r.length;a++)Rt(r[a],!1),Tr(r[a]);else r!=null&&(Rt(r,!1),Tr(r));else Rt(this,i)}var fs=i=>{i.type==cr.CHILD&&(i._$AP??(i._$AP=gs),i._$AQ??(i._$AQ=hs))},Lr=class extends st{constructor(){super(...arguments),this._$AN=void 0}_$AT(e,t,r){super._$AT(e,t,r),da(this),this.isConnected=e._$AU}_$AO(e,t=!0){e!==this.isConnected&&(this.isConnected=e,e?this.reconnected?.():this.disconnected?.()),t&&(Rt(this,e),Tr(this))}setValue(e){if(la(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 ui=()=>new mi,mi=class{},ci=new WeakMap,$r=St(class extends Lr{render(i){return c}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)),c}rt(i){if(this.isConnected||(i=void 0),typeof this.Y=="function"){let e=this.ht??globalThis,t=ci.get(e);t===void 0&&(t=new WeakMap,ci.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"?ci.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 pa=u`
|
|
2328
|
+
:host {
|
|
2378
2329
|
display: flex;
|
|
2379
|
-
|
|
2380
|
-
|
|
2330
|
+
align-items: center;
|
|
2331
|
+
position: relative;
|
|
2381
2332
|
}
|
|
2382
2333
|
|
|
2383
|
-
.
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
border: none;
|
|
2387
|
-
padding: var(--primer-space-small) var(--primer-space-medium);
|
|
2388
|
-
border-radius: var(--primer-radius-small);
|
|
2389
|
-
font-weight: var(--primer-typography-body-medium-weight);
|
|
2334
|
+
.network-selector {
|
|
2335
|
+
display: flex;
|
|
2336
|
+
align-items: center;
|
|
2390
2337
|
cursor: pointer;
|
|
2391
|
-
|
|
2338
|
+
background: none;
|
|
2339
|
+
padding: unset;
|
|
2340
|
+
border: none;
|
|
2341
|
+
transition: opacity var(--primer-animation-duration)
|
|
2392
2342
|
var(--primer-animation-easing);
|
|
2343
|
+
outline: none;
|
|
2344
|
+
gap: var(--primer-space-xsmall);
|
|
2393
2345
|
}
|
|
2394
2346
|
|
|
2395
|
-
.
|
|
2396
|
-
|
|
2397
|
-
}
|
|
2398
|
-
|
|
2399
|
-
.delete-confirm:disabled {
|
|
2400
|
-
opacity: 0.7;
|
|
2401
|
-
cursor: not-allowed;
|
|
2402
|
-
}
|
|
2403
|
-
|
|
2404
|
-
.delete-cancel {
|
|
2405
|
-
background-color: transparent;
|
|
2406
|
-
border: 1px solid var(--primer-color-border-outlined-default);
|
|
2407
|
-
padding: var(--primer-space-small) var(--primer-space-medium);
|
|
2408
|
-
border-radius: var(--primer-radius-small);
|
|
2409
|
-
color: var(--primer-color-text-primary);
|
|
2410
|
-
font-weight: var(--primer-typography-body-medium-weight);
|
|
2411
|
-
cursor: pointer;
|
|
2412
|
-
transition: background-color var(--primer-animation-duration)
|
|
2413
|
-
var(--primer-animation-easing);
|
|
2347
|
+
.network-selector:hover {
|
|
2348
|
+
opacity: 0.8;
|
|
2414
2349
|
}
|
|
2415
2350
|
|
|
2416
|
-
.
|
|
2417
|
-
|
|
2351
|
+
.network-selector:focus-visible {
|
|
2352
|
+
outline: 2px solid var(--primer-color-focus);
|
|
2353
|
+
border-radius: var(--primer-radius-xsmall);
|
|
2418
2354
|
}
|
|
2419
2355
|
|
|
2420
|
-
.
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
<div class="delete-message">
|
|
2427
|
-
<p class="delete-text">${t}</p>
|
|
2428
|
-
</div>
|
|
2429
|
-
<div class="delete-actions">
|
|
2430
|
-
<button
|
|
2431
|
-
class="delete-confirm"
|
|
2432
|
-
@click=${this.handleConfirmClick}
|
|
2433
|
-
?disabled=${this.isDeleting}
|
|
2434
|
-
>
|
|
2435
|
-
${this.isDeleting?A("deleting",{id:"deleting"}):A("confirmVaultedPaymentMethodDeletion",{id:"confirmVaultedPaymentMethodDeletion"})}
|
|
2436
|
-
</button>
|
|
2437
|
-
<button
|
|
2438
|
-
class="delete-cancel"
|
|
2439
|
-
@click=${this.handleCancelClick}
|
|
2440
|
-
?disabled=${this.isDeleting}
|
|
2441
|
-
>
|
|
2442
|
-
${A("cancel",{id:"cancel"})}
|
|
2443
|
-
</button>
|
|
2444
|
-
</div>
|
|
2445
|
-
</div>
|
|
2446
|
-
`}};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`
|
|
2447
|
-
:host {
|
|
2448
|
-
display: block;
|
|
2449
|
-
width: 100%;
|
|
2356
|
+
.network-icon {
|
|
2357
|
+
width: var(--primer-size-large);
|
|
2358
|
+
height: var(
|
|
2359
|
+
--primer-size-medium
|
|
2360
|
+
); /* Added explicit height to maintain aspect ratio */
|
|
2361
|
+
object-fit: contain;
|
|
2450
2362
|
}
|
|
2451
2363
|
|
|
2452
|
-
.
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2364
|
+
.caret {
|
|
2365
|
+
margin-left: var(--primer-space-xsmall);
|
|
2366
|
+
transition: transform var(--primer-animation-duration)
|
|
2367
|
+
var(--primer-animation-easing);
|
|
2368
|
+
color: var(--primer-color-icon-primary);
|
|
2456
2369
|
}
|
|
2457
2370
|
|
|
2458
|
-
.
|
|
2459
|
-
|
|
2460
|
-
}
|
|
2461
|
-
`;var wt=class extends v{render(){return c`
|
|
2462
|
-
<div class="empty-state">
|
|
2463
|
-
<p>
|
|
2464
|
-
${A("savedPaymentMethodsEmpty",{id:"savedPaymentMethodsEmpty"})}
|
|
2465
|
-
</p>
|
|
2466
|
-
</div>
|
|
2467
|
-
`}};wt.styles=[w,kn],wt=s([y("primer-vault-empty-state"),$()],wt);var In=f`
|
|
2468
|
-
:host {
|
|
2469
|
-
display: block;
|
|
2470
|
-
width: 100%;
|
|
2371
|
+
.caret.open {
|
|
2372
|
+
transform: rotate(180deg);
|
|
2471
2373
|
}
|
|
2472
2374
|
|
|
2473
|
-
.
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2375
|
+
.dropdown {
|
|
2376
|
+
position: absolute;
|
|
2377
|
+
top: 100%;
|
|
2378
|
+
right: 0;
|
|
2379
|
+
width: max-content;
|
|
2380
|
+
min-width: calc(var(--primer-size-xxxlarge) * 3);
|
|
2381
|
+
background: var(--primer-color-gray-000);
|
|
2477
2382
|
border-radius: var(--primer-radius-small);
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2383
|
+
box-shadow: 0 var(--primer-space-xxsmall) var(--primer-space-large)
|
|
2384
|
+
rgba(0, 0, 0, 0.15);
|
|
2385
|
+
z-index: 10;
|
|
2386
|
+
overflow: hidden;
|
|
2387
|
+
border: 1px solid var(--primer-color-border-outlined-default);
|
|
2482
2388
|
}
|
|
2483
2389
|
|
|
2484
|
-
.
|
|
2485
|
-
display:
|
|
2486
|
-
align-items: center;
|
|
2487
|
-
gap: var(--primer-space-small);
|
|
2390
|
+
.dropdown:not(.open) {
|
|
2391
|
+
display: none;
|
|
2488
2392
|
}
|
|
2489
2393
|
|
|
2490
|
-
.
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
|
|
2394
|
+
.dropdown.open {
|
|
2395
|
+
display: block;
|
|
2396
|
+
max-height: calc(var(--primer-size-xxxlarge) * 4);
|
|
2397
|
+
overflow-y: auto;
|
|
2494
2398
|
}
|
|
2495
2399
|
|
|
2496
|
-
.
|
|
2497
|
-
background: transparent;
|
|
2498
|
-
border: none;
|
|
2499
|
-
color: var(--primer-color-text-negative);
|
|
2500
|
-
cursor: pointer;
|
|
2501
|
-
padding: var(--primer-space-xsmall);
|
|
2400
|
+
.network-option {
|
|
2502
2401
|
display: flex;
|
|
2503
2402
|
align-items: center;
|
|
2504
|
-
|
|
2505
|
-
|
|
2403
|
+
padding: var(--primer-space-small) var(--primer-space-medium);
|
|
2404
|
+
cursor: pointer;
|
|
2506
2405
|
transition: background-color var(--primer-animation-duration)
|
|
2507
2406
|
var(--primer-animation-easing);
|
|
2407
|
+
position: relative;
|
|
2408
|
+
outline: none;
|
|
2409
|
+
background-color: transparent;
|
|
2508
2410
|
}
|
|
2509
2411
|
|
|
2510
|
-
|
|
2511
|
-
|
|
2412
|
+
/* Only apply hover effect when not in keyboard navigation mode */
|
|
2413
|
+
.network-option:hover {
|
|
2414
|
+
background-color: var(--primer-color-gray-100);
|
|
2512
2415
|
}
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
name="warning"
|
|
2518
|
-
size="sm"
|
|
2519
|
-
color="var(--primer-color-red-500)"
|
|
2520
|
-
></primer-icon>
|
|
2521
|
-
<p>${this.errorMessage}</p>
|
|
2522
|
-
</div>
|
|
2523
|
-
<button
|
|
2524
|
-
@click=${this.handleDismiss}
|
|
2525
|
-
aria-label=${A("closeErrorMessage",{id:"closeErrorMessage"})}
|
|
2526
|
-
>
|
|
2527
|
-
<primer-icon name="close" size="sm"></primer-icon>
|
|
2528
|
-
</button>
|
|
2529
|
-
</div>
|
|
2530
|
-
`}};pt.styles=[w,In],s([p({type:String})],pt.prototype,"errorMessage",2),pt=s([y("primer-vault-error-message"),$()],pt);var Nn=f`
|
|
2531
|
-
:host {
|
|
2532
|
-
display: contents;
|
|
2416
|
+
|
|
2417
|
+
/* Apply focused style only when the focused class is present (keyboard navigation) */
|
|
2418
|
+
.network-option.focused {
|
|
2419
|
+
background-color: var(--primer-color-gray-100);
|
|
2533
2420
|
}
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
@click=${this.handleClick}
|
|
2539
|
-
.disabled=${this.isButtonDisabled}
|
|
2540
|
-
.loading=${this.sdkState?.isProcessing}
|
|
2541
|
-
data-submit
|
|
2542
|
-
>
|
|
2543
|
-
${this.buttonText}${r}
|
|
2544
|
-
</primer-button>
|
|
2545
|
-
`}};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`
|
|
2546
|
-
:host {
|
|
2547
|
-
display: block;
|
|
2548
|
-
margin-top: var(--primer-space-medium);
|
|
2421
|
+
|
|
2422
|
+
.network-option:focus-visible {
|
|
2423
|
+
outline: 2px solid var(--primer-color-focus);
|
|
2424
|
+
outline-offset: -2px;
|
|
2549
2425
|
}
|
|
2550
2426
|
|
|
2551
|
-
.
|
|
2552
|
-
|
|
2427
|
+
.network-option-icon {
|
|
2428
|
+
width: var(--primer-size-medium);
|
|
2429
|
+
height: var(--primer-size-small);
|
|
2430
|
+
margin-right: var(--primer-space-small);
|
|
2431
|
+
object-fit: contain;
|
|
2553
2432
|
}
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2433
|
+
|
|
2434
|
+
.network-name {
|
|
2435
|
+
font-size: var(--primer-typography-body-medium-size);
|
|
2436
|
+
font-family: var(--primer-typography-body-medium-font);
|
|
2437
|
+
line-height: var(--primer-typography-body-medium-line-height);
|
|
2438
|
+
letter-spacing: var(--primer-typography-body-medium-letter-spacing);
|
|
2439
|
+
white-space: nowrap;
|
|
2440
|
+
color: var(--primer-color-text-primary);
|
|
2441
|
+
flex: 1;
|
|
2442
|
+
}
|
|
2443
|
+
|
|
2444
|
+
.checkmark {
|
|
2445
|
+
margin-left: var(--primer-space-small);
|
|
2446
|
+
color: var(--primer-color-brand);
|
|
2447
|
+
width: var(--primer-size-small);
|
|
2448
|
+
height: var(--primer-size-small);
|
|
2449
|
+
}
|
|
2450
|
+
`;var U=class extends h{constructor(){super(...arguments);this.cardNetworks=null;this.headlessUtils=null;this.selectedCardNetwork=null;this.isDropdownOpen=!1;this.focusedNetworkIndex=0;this.isKeyboardNavigation=!1;this.buttonRef=ui();this.dropdownRef=ui();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 d`<primer-spinner size="small" compact></primer-spinner>`;let t=this.getSelectableNetworks();if(!this.getDetectedNetwork()&&t.length===0)return d`<primer-icon name="payment-card" size="sm"></primer-icon>`;let r=this.getDetectedNetwork()||(t.length>0?t[0]:null);if(!r)return d`<primer-icon name="payment-card" size="sm"></primer-icon>`;let o=t.length>1;return d`
|
|
2451
|
+
<button
|
|
2452
|
+
${$r(this.buttonRef)}
|
|
2453
|
+
class="network-selector"
|
|
2454
|
+
@click=${this.toggleDropdown}
|
|
2455
|
+
@keydown=${a=>{(a.key===" "||a.key==="Enter")&&o&&(a.preventDefault(),this.isDropdownOpen=!this.isDropdownOpen,this.isDropdownOpen&&(this.focusedNetworkIndex=this.getSelectedNetworkIndex()))}}
|
|
2456
|
+
aria-label=${o?`Selected card network: ${r.displayName}. Click to change.`:`Card network: ${r.displayName}`}
|
|
2457
|
+
aria-expanded=${o?this.isDropdownOpen:c}
|
|
2458
|
+
aria-haspopup=${o?"true":c}
|
|
2459
|
+
aria-controls=${o?"network-dropdown":c}
|
|
2460
|
+
>
|
|
2461
|
+
<img
|
|
2462
|
+
class="network-icon"
|
|
2463
|
+
src=${this.getNetworkIconUrl(r)}
|
|
2464
|
+
alt=${r.displayName}
|
|
2465
|
+
/>
|
|
2466
|
+
${P(o,()=>d`
|
|
2467
|
+
<primer-icon
|
|
2468
|
+
class="caret ${this.isDropdownOpen?"open":""}"
|
|
2469
|
+
size="sm"
|
|
2470
|
+
name="chevron-down"
|
|
2471
|
+
></primer-icon>
|
|
2472
|
+
`,()=>c)}
|
|
2473
|
+
</button>
|
|
2474
|
+
|
|
2475
|
+
${P(this.isDropdownOpen,()=>d`
|
|
2476
|
+
<div
|
|
2477
|
+
${$r(this.dropdownRef)}
|
|
2478
|
+
id="network-dropdown"
|
|
2479
|
+
class="dropdown open"
|
|
2480
|
+
role="listbox"
|
|
2481
|
+
aria-label="Select card network"
|
|
2482
|
+
>
|
|
2483
|
+
${t.map((a,n)=>d`
|
|
2484
|
+
<div
|
|
2485
|
+
${$r(m=>this.setNetworkOptionRef(m,n))}
|
|
2486
|
+
class="network-option ${this.isKeyboardNavigation&&n===this.focusedNetworkIndex?"focused":""}"
|
|
2487
|
+
@click=${m=>this.selectNetwork(m,a)}
|
|
2488
|
+
@keydown=${m=>{(m.key==="Enter"||m.key===" ")&&this.selectNetwork(m,a)}}
|
|
2489
|
+
role="option"
|
|
2490
|
+
aria-selected=${a.network===r.network}
|
|
2491
|
+
tabindex="${n===this.focusedNetworkIndex?"0":"-1"}"
|
|
2492
|
+
>
|
|
2493
|
+
<img
|
|
2494
|
+
class="network-option-icon"
|
|
2495
|
+
src=${this.getNetworkIconUrl(a)}
|
|
2496
|
+
alt=${a.displayName}
|
|
2497
|
+
/>
|
|
2498
|
+
<span class="network-name">${a.displayName}</span>
|
|
2499
|
+
${P(a.network===r.network,()=>d`
|
|
2500
|
+
<primer-icon
|
|
2501
|
+
class="checkmark"
|
|
2502
|
+
name="checkmark"
|
|
2503
|
+
size="sm"
|
|
2504
|
+
></primer-icon>
|
|
2505
|
+
`,()=>c)}
|
|
2506
|
+
</div>
|
|
2507
|
+
`)}
|
|
2567
2508
|
</div>
|
|
2568
|
-
|
|
2509
|
+
`,()=>c)}
|
|
2510
|
+
`}};U.styles=[x,pa],s([f({context:Ht,subscribe:!0})],U.prototype,"cardNetworks",2),s([f({context:D,subscribe:!0})],U.prototype,"headlessUtils",2),s([C()],U.prototype,"selectedCardNetwork",2),s([C()],U.prototype,"isDropdownOpen",2),s([C()],U.prototype,"focusedNetworkIndex",2),s([C()],U.prototype,"isKeyboardNavigation",2),U=s([g("primer-card-network-selector")],U);var ca=u`
|
|
2569
2511
|
:host {
|
|
2570
2512
|
display: block;
|
|
2571
2513
|
margin-top: var(--primer-space-medium);
|
|
@@ -2585,36 +2527,95 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
|
|
|
2585
2527
|
justify-content: center;
|
|
2586
2528
|
align-items: center;
|
|
2587
2529
|
}
|
|
2588
|
-
`;var
|
|
2530
|
+
`;var De=class extends h{constructor(){super(...arguments);this.vaultManager=null}render(){return this.vaultManager?.isLoading?c:!this.vaultManager||!this.vaultManager.enabled?d`<slot name="other-payments"></slot>`:d`
|
|
2589
2531
|
<div class="other-payment-methods-container">
|
|
2590
2532
|
<primer-collapsable
|
|
2591
2533
|
buttonVariant="secondary"
|
|
2592
2534
|
.expanded="${this.vaultManager?.vaultedPaymentMethods.length===0}"
|
|
2593
|
-
.header="${
|
|
2535
|
+
.header="${v("navigateToPaymentMethods",{id:"navigateToPaymentMethods"})}"
|
|
2594
2536
|
>
|
|
2595
2537
|
<div class="other-payment-methods-content">
|
|
2596
2538
|
<slot name="other-payments"></slot>
|
|
2597
2539
|
</div>
|
|
2598
2540
|
</primer-collapsable>
|
|
2599
2541
|
</div>
|
|
2600
|
-
`}};
|
|
2542
|
+
`}};De.styles=[ca],s([f({context:B,subscribe:!0}),l({type:Object,attribute:!1})],De.prototype,"vaultManager",2),De=s([g("primer-show-other-payments")],De);var ma=u`
|
|
2543
|
+
:host {
|
|
2544
|
+
height: calc(
|
|
2545
|
+
var(--primer-typography-title-large-line-height) +
|
|
2546
|
+
calc(2 * var(--primer-space-medium))
|
|
2547
|
+
);
|
|
2548
|
+
display: flex;
|
|
2549
|
+
}
|
|
2550
|
+
|
|
2551
|
+
.native-button-container {
|
|
2552
|
+
width: 100%;
|
|
2553
|
+
height: 100%;
|
|
2554
|
+
flex: 1;
|
|
2555
|
+
}
|
|
2556
|
+
`;var le=class extends h{constructor(){super();this.paymentManagers=new Map;this.computedStyles=null;this._buttonId="button-container";this.loadManagerTask=new k(this,{args:()=>[this.paymentMethod?.type],task:async([t])=>{if(!t)return _;let r=this.paymentManagers.get(t)?.manager;if(!r)throw new Error(`No manager found for payment method type ${t}`);return r}}),new k(this,{args:()=>[this.loadManagerTask.value],task:async([t])=>{if(!t)return _;await this.updateComplete;let r=this.shadowRoot?.getElementById(this._buttonId);if(!r)return;let o=this.calculateButtonHeight(),a=t.createButton(),n=this.createRenderOptions(o);return await a.render(this.paymentMethod?.type==="GOOGLE_PAY"?this.shadowRoot?.getRootNode():r,n),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:()=>c,complete:()=>d`
|
|
2557
|
+
<!-- The native button container is rendered first -->
|
|
2558
|
+
<div class="native-button-container" id="${this._buttonId}"></div>
|
|
2559
|
+
`,pending:()=>c})}};le.styles=[x,ma],s([l({type:Object})],le.prototype,"paymentMethod",2),s([f({context:F,subscribe:!0}),l()],le.prototype,"paymentManagers",2),s([f({context:we,subscribe:!0}),l()],le.prototype,"computedStyles",2),le=s([g("primer-native-payment")],le);var pt=class extends h{render(){return d`
|
|
2601
2560
|
<primer-checkout-state type="complete"></primer-checkout-state>
|
|
2602
|
-
`}};
|
|
2561
|
+
`}};pt=s([g("primer-checkout-complete")],pt);var et=class extends h{constructor(){super(...arguments);this.sdkState=null}render(){return d`
|
|
2603
2562
|
<primer-checkout-state
|
|
2604
2563
|
type="failure"
|
|
2605
2564
|
description=${this.sdkState?.error?.message||""}
|
|
2606
2565
|
></primer-checkout-state>
|
|
2607
|
-
`}};s([
|
|
2566
|
+
`}};s([f({context:$,subscribe:!0}),l()],et.prototype,"sdkState",2),et=s([g("primer-checkout-error")],et);var ua=u`
|
|
2608
2567
|
:host {
|
|
2609
2568
|
display: block;
|
|
2610
2569
|
width: 100%;
|
|
2611
2570
|
}
|
|
2612
|
-
`;var
|
|
2571
|
+
`;var Me=class extends h{constructor(){super(...arguments);this.showProcessingErrors=!0}get shouldShowError(){return!this.sdkState||this.sdkState.isProcessing?!1:!!(this.sdkState.failure&&this.showProcessingErrors)}render(){return this.sdkState?d`
|
|
2613
2572
|
<primer-error-message
|
|
2614
|
-
message="${
|
|
2573
|
+
message="${v(this.sdkState.failure?.message??"",{id:"tokenizationError"})}"
|
|
2615
2574
|
?visible="${this.shouldShowError}"
|
|
2616
2575
|
></primer-error-message>
|
|
2617
|
-
`:
|
|
2576
|
+
`:c}};Me.styles=[ua],s([f({context:$,subscribe:!0}),C()],Me.prototype,"sdkState",2),s([l({type:Boolean,attribute:"show-processing-errors"})],Me.prototype,"showProcessingErrors",2),Me=s([g("primer-error-message-container")],Me);var ha=u`
|
|
2577
|
+
:host {
|
|
2578
|
+
display: contents;
|
|
2579
|
+
}
|
|
2580
|
+
|
|
2581
|
+
.primer-main-list {
|
|
2582
|
+
display: flex;
|
|
2583
|
+
flex-direction: column;
|
|
2584
|
+
gap: var(--primer-space-small);
|
|
2585
|
+
}
|
|
2586
|
+
|
|
2587
|
+
.primer-is-processing {
|
|
2588
|
+
opacity: 0.5;
|
|
2589
|
+
pointer-events: none;
|
|
2590
|
+
}
|
|
2591
|
+
|
|
2592
|
+
primer-vault-manager {
|
|
2593
|
+
margin-bottom: var(--primer-space-xlarge);
|
|
2594
|
+
}
|
|
2595
|
+
`;var Se=class extends h{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?d`
|
|
2596
|
+
<slot name="checkout-complete">
|
|
2597
|
+
<primer-checkout-complete></primer-checkout-complete>
|
|
2598
|
+
</slot>
|
|
2599
|
+
`:d`
|
|
2600
|
+
<slot name="payments" @slotchange=${this.onSlotChange}></slot>
|
|
2601
|
+
${P(this.hasAssignedContent,()=>c,()=>d`
|
|
2602
|
+
<div
|
|
2603
|
+
class=${V({"primer-is-processing":!!this.sdkState?.isProcessing})}
|
|
2604
|
+
>
|
|
2605
|
+
<primer-vault-manager></primer-vault-manager>
|
|
2606
|
+
<primer-show-other-payments>
|
|
2607
|
+
<div slot="other-payments" class="primer-main-list">
|
|
2608
|
+
${this.paymentMethods?.toArray().map(t=>d`
|
|
2609
|
+
<primer-payment-method
|
|
2610
|
+
type=${t.type}
|
|
2611
|
+
></primer-payment-method>
|
|
2612
|
+
`)}
|
|
2613
|
+
</div>
|
|
2614
|
+
</primer-show-other-payments>
|
|
2615
|
+
<primer-error-message-container></primer-error-message-container>
|
|
2616
|
+
</div>
|
|
2617
|
+
`)}
|
|
2618
|
+
`}};Se.styles=[x,ha],s([f({context:it,subscribe:!0}),l()],Se.prototype,"paymentMethods",2),s([f({context:$,subscribe:!0}),l()],Se.prototype,"sdkState",2),Se=s([g("primer-main")],Se);async function qE(){to(),ro()}export{q as AchPayment,G as Button,ie as CardForm,Ee as CardFormCVV,U as CardFormCardNetworkSelector,Ce as CardFormCardNumber,fe as CardFormError,Ae as CardFormExpiry,_e as CardFormName,z as CardFormSubmit,K as Collapsable,Ge as Dialog,Q as DynamicPayment,ee as ErrorMessage,Me as ErrorMessageContainer,sr as InitializedPayments,T as Input,ge as InputLabel,ae as InputWrapper,le as NativePayment,ye as PaymentMethod,Ne as Portal,pt as PrimerCheckoutComplete,X as PrimerCheckoutComponent,et as PrimerCheckoutFailure,ve as PrimerCheckoutState,se as PrimerIcon,H as PrimerKlarna,Se as PrimerMain,te as RedirectPayment,De as ShowOtherPayments,oe as Spinner,R as VaultCvvInput,Z as VaultDeleteConfirmation,xe as VaultEmptyState,ne as VaultErrorMessage,W as VaultManager,re as VaultManagerHeader,j as VaultPaymentMethodItem,O as VaultPaymentSubmit,Za as injectDarkTheme,Wa as injectLightTheme,to as injectLoaderStyles,ro as injectThemeStyles,qE as loadPrimer};
|
|
2618
2619
|
/*! Bundled license information:
|
|
2619
2620
|
|
|
2620
2621
|
@lit/context/lib/context-request-event.js:
|
|
@@ -2897,52 +2898,52 @@ lit-html/directives/class-map.js:
|
|
|
2897
2898
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
2898
2899
|
*)
|
|
2899
2900
|
|
|
2900
|
-
lit-html/
|
|
2901
|
+
lit-html/lit-html.js:
|
|
2901
2902
|
(**
|
|
2902
2903
|
* @license
|
|
2903
|
-
* Copyright
|
|
2904
|
+
* Copyright 2017 Google LLC
|
|
2904
2905
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
2905
2906
|
*)
|
|
2906
2907
|
|
|
2907
|
-
lit-html/
|
|
2908
|
+
lit-html/directive.js:
|
|
2908
2909
|
(**
|
|
2909
2910
|
* @license
|
|
2910
2911
|
* Copyright 2017 Google LLC
|
|
2911
2912
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
2912
2913
|
*)
|
|
2913
2914
|
|
|
2914
|
-
lit-html/
|
|
2915
|
+
lit-html/directive-helpers.js:
|
|
2915
2916
|
(**
|
|
2916
2917
|
* @license
|
|
2917
2918
|
* Copyright 2020 Google LLC
|
|
2918
2919
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
2919
2920
|
*)
|
|
2920
2921
|
|
|
2921
|
-
lit-html/
|
|
2922
|
+
lit-html/async-directive.js:
|
|
2922
2923
|
(**
|
|
2923
2924
|
* @license
|
|
2924
2925
|
* Copyright 2017 Google LLC
|
|
2925
2926
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
2926
2927
|
*)
|
|
2927
2928
|
|
|
2928
|
-
lit-html/directive.js:
|
|
2929
|
+
lit-html/directive-helpers.js:
|
|
2929
2930
|
(**
|
|
2930
2931
|
* @license
|
|
2931
|
-
* Copyright
|
|
2932
|
+
* Copyright 2020 Google LLC
|
|
2932
2933
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
2933
2934
|
*)
|
|
2934
2935
|
|
|
2935
|
-
lit-html/directive
|
|
2936
|
+
lit-html/async-directive.js:
|
|
2936
2937
|
(**
|
|
2937
2938
|
* @license
|
|
2938
|
-
* Copyright
|
|
2939
|
+
* Copyright 2017 Google LLC
|
|
2939
2940
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
2940
2941
|
*)
|
|
2941
2942
|
|
|
2942
|
-
lit-html/
|
|
2943
|
+
lit-html/directives/ref.js:
|
|
2943
2944
|
(**
|
|
2944
2945
|
* @license
|
|
2945
|
-
* Copyright
|
|
2946
|
+
* Copyright 2020 Google LLC
|
|
2946
2947
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
2947
2948
|
*)
|
|
2948
2949
|
*/
|