@primer-io/primer-js 0.1.8 → 0.2.0
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 +2237 -3279
- package/dist/primer-loader.d.ts +1087 -756
- package/dist/primer-loader.js +780 -1025
- package/dist/primer-react-wrappers.js +426 -671
- package/dist/web-types.json +1 -1
- package/package.json +8 -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 qr,b as s}from"./chunks/chunk.I6YWTZRK.js";var At=class{constructor(t){(this.host=t).addController(this)}hostConnected(){}setCardNetworksLoading(){let t={detectedCardNetwork:null,selectableCardNetworks:[],isLoading:!0};this.updateCardNetworksState(t)}updateCardNetworksState(t){this.host.primerEventsController.dispatchCardNetworkChange(t),this.host.sdkContextController.setCardNetworks(t)}async processCardNetworkChangeEvent(t){let{detectedCardNetworks:e,selectableCardNetworks:r}=t,o=e.preferred??e.items[0],a=r?.items??[];this.updateCardNetworksState({detectedCardNetwork:o,selectableCardNetworks:a,isLoading:!1})}};var Xe=class{constructor(t){(this.host=t).addController(this)}hostConnected(){}dispatchEvent(t,e){this.host.dispatchEvent(new CustomEvent(t,{detail:e,bubbles:!0,composed:!0}))}dispatchSdkState(t){this.dispatchEvent("primer:state-change",t)}dispatchPaymentMethods(t){this.dispatchEvent("primer:methods-update",t)}dispatchCheckoutInitialized(t){this.dispatchEvent("primer:ready",t)}dispatchCardNetworkChange(t){this.dispatchEvent("primer:card-network-change",t)}dispatchFormSubmitSuccess(t){this.dispatchEvent("primer:card-success",{result:t})}dispatchFormSubmitErrors(t){this.dispatchEvent("primer:card-error",{errors:t})}};var Ae=class extends Event{constructor(t,e,r,o){super("context-request",{bubbles:!0,composed:!0}),this.context=t,this.contextTarget=e,this.callback=r,this.subscribe=o??!1}};var Qe=class{constructor(t,e,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=t,e.context!==void 0){let a=e;this.context=a.context,this.callback=a.callback,this.subscribe=a.subscribe??!1}else this.context=e,this.callback=r,this.subscribe=o??!1;this.host.addController(this)}hostConnected(){this.dispatchRequest()}hostDisconnected(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=void 0)}dispatchRequest(){this.host.dispatchEvent(new Ae(this.context,this.host,this.t,this.subscribe))}};var _t=class{get value(){return this.o}set value(t){this.setValue(t)}setValue(t,e=!1){let r=e||!Object.is(t,this.o);this.o=t,r&&this.updateObservers()}constructor(t){this.subscriptions=new Map,this.updateObservers=()=>{for(let[e,{disposer:r}]of this.subscriptions)e(this.o,r)},t!==void 0&&(this.value=t)}addCallback(t,e,r){if(!r)return void t(this.value);this.subscriptions.has(t)||this.subscriptions.set(t,{disposer:()=>{this.subscriptions.delete(t)},consumerHost:e});let{disposer:o}=this.subscriptions.get(t);t(this.value,o)}clearCallbacks(){this.subscriptions.clear()}};var fr=class extends Event{constructor(t,e){super("context-provider",{bubbles:!0,composed:!0}),this.context=t,this.contextTarget=e}},L=class extends _t{constructor(t,e,r){super(e.context!==void 0?e.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:u}]of this.subscriptions)a.has(n)||(a.add(n),u.dispatchEvent(new Ae(this.context,u,n,!0)));o.stopPropagation()},this.host=t,e.context!==void 0?this.context=e.context:this.context=e,this.attachListeners(),this.host.addController?.(this)}attachListeners(){this.host.addEventListener("context-request",this.onContextRequest),this.host.addEventListener("context-provider",this.onProviderRequest)}hostConnected(){this.host.dispatchEvent(new fr(this.context,this.host))}};function f({context:i,subscribe:t}){return(e,r)=>{typeof r=="object"?r.addInitializer(function(){new Qe(this,{context:i,callback:o=>{e.set.call(this,o)},subscribe:t})}):e.constructor.addInitializer(o=>{new Qe(o,{context:i,callback:a=>{o[r]=a},subscribe:t})})}}var Pt="cardNetworksContext";var _e="clientOptionsContext";var Pe="computedStylesContext";var $="headlessInstanceContext";var kt="klarnaCategoriesContext";var Y="managerContext";var et="paymentMethodsContext";var T="sdkStateContext";var U="vaultManagerContext";var ke="vaultManagerCvvContext";var C=class C{static log(t,...e){C.enabled&&console.log(`%c${C.brandTag}%c ${t}`,C.brandStyle,C.styles.log,...e)}static info(t,...e){C.enabled&&console.info(`%c${C.brandTag}%c ${t}`,C.brandStyle,C.styles.info,...e)}static warn(t,...e){C.enabled&&console.warn(`%c${C.brandTag}%c ${t}`,C.brandStyle,C.styles.warn,...e)}static error(t,...e){C.enabled&&console.error(`%c${C.brandTag}%c ${t}`,C.brandStyle,C.styles.error,...e)}static debug(t,...e){C.enabled&&console.debug(`%c${C.brandTag}%c ${t}`,C.brandStyle,C.styles.debug,...e)}static table(t,e){C.enabled&&console.table(t,e)}static time(t){C.enabled&&console.time(`${C.brandTag} ${t}`)}static timeEnd(t){C.enabled&&console.timeEnd(`${C.brandTag} ${t}`)}};C.enabled=!0,C.defaultFont="font-family: Consolas, monospace; font-size: 12px;",C.brandTag="[PRIMER]",C.brandStyle="background: #24292e; color: #ffffff; padding: 2px 6px; border-radius: 3px; font-weight: bold; margin-right: 4px; "+C.defaultFont,C.styles={log:"color: #4CAF50; "+C.defaultFont,info:"color: #2196F3; "+C.defaultFont,warn:"color: #FF9800; "+C.defaultFont,error:"color: #F44336; "+C.defaultFont,debug:"color: #9C27B0; "+C.defaultFont};var b=C;function Uo(i,t,e,r){let o=i,a=e;return{dispatch:n=>{let u=t(o,n,a);o=u,r(u)},getState:()=>Object.freeze({...o}),setCallbacks:n=>{a={...a,...n}}}}function at(i){return(t,e,r)=>{let o=i[e.type];if(!o)throw new Error(`No handler for action type: ${e.type}`);return o(t,e,r)}}var He=class{constructor(t,e,r,o,a=()=>{this.host.requestUpdate()}){this.host=t;this.stateHandler=a;this.host.addController(this),this._dispatcher=Uo(e,r,o,n=>{this.stateHandler(n)})}get currentState(){return this._dispatcher.getState()}dispatch(t){this._dispatcher.dispatch(t)}setCallbacks(t){this._dispatcher.setCallbacks(t)}hostConnected(){}hostDisconnected(){}},wt=class{constructor(t){this.host=t;this._controllers=[];"addController"in this.host&&this.host.addController(this)}addController(t){this._controllers.push(t)}hostConnected(){this._controllers.forEach(t=>{t.hostConnected&&t.hostConnected()})}hostDisconnected(){this._controllers.forEach(t=>{t.hostDisconnected&&t.hostDisconnected()})}};var Lt={isSuccessful:!1,isProcessing:!1,isLoading:!1,error:null,failure:null},Fo={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,t)=>(b.error(t.payload.message),{...i,isProcessing:!1,error:t.payload}),SET_FAILURE:(i,t)=>({...i,isProcessing:!1,failure:t.payload}),COMPLETE_LOADING:i=>({...i,isLoading:!1}),RESET:()=>Lt,RESET_ERROR:i=>({...i,error:null,failure:null})},Bo=at(Fo),Tt=class extends He{constructor(t){super(t,Lt,Bo,null,e=>{t.sdkContextController.setSdkState(e),t.primerEventsController.dispatchSdkState(e)})}startLoading(){this.dispatch({type:"START_LOADING"})}startProcessing(){this.dispatch({type:"START_PROCESSING"})}stopProcessing(){this.dispatch({type:"STOP_PROCESSING"})}completeProcessing(){this.dispatch({type:"COMPLETE_PROCESSING"})}completeLoading(){this.dispatch({type:"COMPLETE_LOADING"})}setError(t){this.dispatch({type:"SET_ERROR",payload:t})}setFailure(t,e,r){this.dispatch({type:"SET_FAILURE",payload:{code:t,message:e,details:r}})}reset(){this.dispatch({type:"RESET"})}resetError(){this.dispatch({type:"RESET_ERROR"})}forceCompleteLoading(){this.currentState.isLoading&&(b.warn("Force completing loading state"),this.completeLoading())}};var It=class{constructor(t){this.sdkStateProvider=null;this.paymentMethodsProvider=null;this.paymentManagerProvider=null;this.cardNetworksContext=null;this.vaultManagerCvvProvider=null;this.clientOptionsContext=null;this.headlessUtilsProvider=null;this.klarnaCategoriesProvider=null;this.computedStylesProvider=null;(this.host=t).addController(this),this.sdkStateProvider=new L(t,{context:T,initialValue:Lt}),this.paymentMethodsProvider=new L(t,{context:et,initialValue:null}),this.paymentManagerProvider=new L(t,{context:Y,initialValue:new Map}),this.cardNetworksContext=new L(t,{context:Pt,initialValue:null}),this.vaultManagerProvider=new L(t,{context:U,initialValue:null}),this.vaultManagerCvvProvider=new L(t,{context:ke,initialValue:null}),this.clientOptionsContext=new L(t,{context:_e,initialValue:null}),this.klarnaCategoriesProvider=new L(t,{context:kt,initialValue:{categories:[],isLoading:!0}}),this.headlessUtilsProvider=new L(t,{context:$,initialValue:null}),this.computedStylesProvider=new L(t,{context:Pe,initialValue:null})}hostConnected(){}setSdkState(t){this.sdkStateProvider?.setValue(t)}setPaymentMethods(t){this.paymentMethodsProvider?.setValue(t)}setPaymentManagers(t){this.paymentManagerProvider?.setValue(t)}setCardNetworks(t){this.cardNetworksContext?.setValue(t)}setVaultManager(t){this.vaultManagerProvider?.setValue(t)}setKlarnaCategories(t){this.klarnaCategoriesProvider?.setValue(t)}setClientOptions(t){this.clientOptionsContext?.setValue(t)}setHeadlessUtils(t){this.headlessUtilsProvider?.setValue(t)}setComputedStyles(t){this.computedStylesProvider?.setValue(t)}setVaultManagerCvv(t){this.vaultManagerCvvProvider?.setValue(t)}};var ze=class ze{constructor(t){(this.host=t).addController(this)}processCustomStyles(t){try{let e=JSON.parse(t);this.applyStyles(e)}catch(e){b.error("Error parsing customStyles property.",e instanceof Error?e:new Error(String(e)))}}isValidCssProperty(t){return/^[a-zA-Z][a-zA-Z0-9]*$/.test(t)}isValidCssValue(t){let r=/^[\w\s#.,%()\-+/!]+$/.test(t);return r||b.warn(`Rejected potentially unsafe CSS value: ${t}`),r}getCssVarName(t){let e=ze.cssVarCache.get(t);return e||(e="--"+t.replace(/([A-Z])/g,(r,o)=>"-"+o.toLowerCase()),ze.cssVarCache.set(t,e)),e}applyStyles(t){let e=[];for(let r of Object.keys(t)){let o=t[r];if(!o)continue;if(!this.isValidCssProperty(r)){b.warn(`Skipping invalid CSS property name: ${r}`);continue}if(!this.isValidCssValue(o))continue;let a=this.getCssVarName(r);e.push([a,o])}if(e.length>0)for(let[r,o]of e)this.host.style.setProperty(r,o)}removeStyle(t){let e=this.getCssVarName(t);this.host.style.removeProperty(e)}clearAllStyles(){for(let t of ze.cssVarCache.keys()){let e=ze.cssVarCache.get(t);e&&this.host.style.removeProperty(e)}}hostDisconnected(){}};ze.cssVarCache=new Map;var Nt=ze;var $t=globalThis,Rt=$t.ShadowRoot&&($t.ShadyCSS===void 0||$t.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Jr=Symbol(),Wr=new WeakMap,Ot=class{constructor(t,e,r){if(this._$cssResult$=!0,r!==Jr)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o,e=this.t;if(Rt&&t===void 0){let r=e!==void 0&&e.length===1;r&&(t=Wr.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),r&&Wr.set(e,t))}return t}toString(){return this.cssText}},Zr=i=>new Ot(typeof i=="string"?i:i+"",void 0,Jr);var yr=(i,t)=>{if(Rt)i.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let e of t){let r=document.createElement("style"),o=$t.litNonce;o!==void 0&&r.setAttribute("nonce",o),r.textContent=e.cssText,i.appendChild(r)}},Dt=Rt?i=>i:i=>i instanceof CSSStyleSheet?(t=>{let e="";for(let r of t.cssRules)e+=r.cssText;return Zr(e)})(i):i;var{is:Ko,defineProperty:jo,getOwnPropertyDescriptor:Go,getOwnPropertyNames:qo,getOwnPropertySymbols:Wo,getPrototypeOf:Jo}=Object,we=globalThis,Xr=we.trustedTypes,Zo=Xr?Xr.emptyScript:"",Xo=we.reactiveElementPolyfillSupport,st=(i,t)=>i,vr={toAttribute(i,t){switch(t){case Boolean:i=i?Zo:null;break;case Object:case Array:i=i==null?i:JSON.stringify(i)}return i},fromAttribute(i,t){let e=i;switch(t){case Boolean:e=i!==null;break;case Number:e=i===null?null:Number(i);break;case Object:case Array:try{e=JSON.parse(i)}catch{e=null}}return e}},Vt=(i,t)=>!Ko(i,t),Qr={attribute:!0,type:String,converter:vr,reflect:!1,hasChanged:Vt};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),we.litPropertyMetadata??(we.litPropertyMetadata=new WeakMap);var Ye=class extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??(this.l=[])).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=Qr){if(e.state&&(e.attribute=!1),this._$Ei(),this.elementProperties.set(t,e),!e.noAccessor){let r=Symbol(),o=this.getPropertyDescriptor(t,r,e);o!==void 0&&jo(this.prototype,t,o)}}static getPropertyDescriptor(t,e,r){let{get:o,set:a}=Go(this.prototype,t)??{get(){return this[e]},set(n){this[e]=n}};return{get(){return o?.call(this)},set(n){let u=o?.call(this);a.call(this,n),this.requestUpdate(t,u,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??Qr}static _$Ei(){if(this.hasOwnProperty(st("elementProperties")))return;let t=Jo(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(st("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(st("properties"))){let e=this.properties,r=[...qo(e),...Wo(e)];for(let o of r)this.createProperty(o,e[o])}let t=this[Symbol.metadata];if(t!==null){let e=litPropertyMetadata.get(t);if(e!==void 0)for(let[r,o]of e)this.elementProperties.set(r,o)}this._$Eh=new Map;for(let[e,r]of this.elementProperties){let o=this._$Eu(e,r);o!==void 0&&this._$Eh.set(o,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){let e=[];if(Array.isArray(t)){let r=new Set(t.flat(1/0).reverse());for(let o of r)e.unshift(Dt(o))}else t!==void 0&&e.push(Dt(t));return e}static _$Eu(t,e){let r=e.attribute;return r===!1?void 0:typeof r=="string"?r:typeof t=="string"?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(t=>t(this))}addController(t){(this._$EO??(this._$EO=new Set)).add(t),this.renderRoot!==void 0&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){let t=new Map,e=this.constructor.elementProperties;for(let r of e.keys())this.hasOwnProperty(r)&&(t.set(r,this[r]),delete this[r]);t.size>0&&(this._$Ep=t)}createRenderRoot(){let t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return yr(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),this._$EO?.forEach(t=>t.hostConnected?.())}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.())}attributeChangedCallback(t,e,r){this._$AK(t,r)}_$EC(t,e){let r=this.constructor.elementProperties.get(t),o=this.constructor._$Eu(t,r);if(o!==void 0&&r.reflect===!0){let a=(r.converter?.toAttribute!==void 0?r.converter:vr).toAttribute(e,r.type);this._$Em=t,a==null?this.removeAttribute(o):this.setAttribute(o,a),this._$Em=null}}_$AK(t,e){let r=this.constructor,o=r._$Eh.get(t);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:vr;this._$Em=o,this[o]=n.fromAttribute(e,a.type),this._$Em=null}}requestUpdate(t,e,r){if(t!==void 0){if(r??(r=this.constructor.getPropertyOptions(t)),!(r.hasChanged??Vt)(this[t],e))return;this.P(t,e,r)}this.isUpdatePending===!1&&(this._$ES=this._$ET())}P(t,e,r){this._$AL.has(t)||this._$AL.set(t,e),r.reflect===!0&&this._$Em!==t&&(this._$Ej??(this._$Ej=new Set)).add(t)}async _$ET(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}let t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this._$Ep){for(let[o,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 t=!1,e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach(r=>r.hostUpdate?.()),this.update(e)):this._$EU()}catch(r){throw t=!1,this._$EU(),r}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Ej&&(this._$Ej=this._$Ej.forEach(e=>this._$EC(e,this[e]))),this._$EU()}updated(t){}firstUpdated(t){}};Ye.elementStyles=[],Ye.shadowRootOptions={mode:"open"},Ye[st("elementProperties")]=new Map,Ye[st("finalized")]=new Map,Xo?.({ReactiveElement:Ye}),(we.reactiveElementVersions??(we.reactiveElementVersions=[])).push("2.0.4");var Te={INITIAL:0,PENDING:1,COMPLETE:2,ERROR:3},E=Symbol(),M=class{get taskComplete(){return this.t||(this.i===1?this.t=new Promise((t,e)=>{this.o=t,this.h=e}):this.i===3?this.t=Promise.reject(this.l):this.t=Promise.resolve(this.u)),this.t}constructor(t,e,r){this.p=0,this.i=0,(this._=t).addController(this);let o=typeof e=="object"?e:{task:e,args:r};this.v=o.task,this.j=o.args,this.m=o.argsEqual??ei,this.k=o.onComplete,this.A=o.onError,this.autoRun=o.autoRun??!0,"initialValue"in o&&(this.u=o.initialValue,this.i=2,this.O=this.T?.())}hostUpdate(){this.autoRun===!0&&this.S()}hostUpdated(){this.autoRun==="afterUpdate"&&this.S()}T(){if(this.j===void 0)return;let t=this.j();if(!Array.isArray(t))throw Error("The args function must return an array");return t}async S(){let t=this.T(),e=this.O;this.O=t,t===e||t===void 0||e!==void 0&&this.m(e,t)||await this.run(t)}async run(t){let e,r;t??(t=this.T()),this.O=t,this.i===1?this.q?.abort():(this.t=void 0,this.o=void 0,this.h=void 0),this.i=1,this.autoRun==="afterUpdate"?queueMicrotask(()=>this._.requestUpdate()):this._.requestUpdate();let o=++this.p;this.q=new AbortController;let a=!1;try{e=await this.v(t,{signal:this.q.signal})}catch(n){a=!0,r=n}if(this.p===o){if(e===E)this.i=0;else{if(a===!1){try{this.k?.(e)}catch{}this.i=2,this.o?.(e)}else{try{this.A?.(r)}catch{}this.i=3,this.h?.(r)}this.u=e,this.l=r}this._.requestUpdate()}}abort(t){this.i===1&&this.q?.abort(t)}get value(){return this.u}get error(){return this.l}get status(){return this.i}render(t){switch(this.i){case 0:return t.initial?.();case 1:return t.pending?.();case 2:return t.complete?.(this.value);case 3:return t.error?.(this.error);default:throw Error("Unexpected status: "+this.i)}}},ei=(i,t)=>i===t||i.length===t.length&&i.every((e,r)=>!Vt(e,t[r]));var Qo={SET_LOADING:(i,t)=>({...i,isLoading:t.payload}),SET_UPDATING:(i,t)=>({...i,isUpdating:t.payload}),INITIALIZE_VAULT_MANAGER:(i,t,e)=>({...i,enabled:t.vaultEnabled,cvvRecapture:t.cvvRecapture,deleteVaultedPaymentMethod:e.deleteVaultedPaymentMethod,startVaultedPaymentFlow:e.startVaultedPaymentFlow,createCvvInput:e.createCvvInput}),UPDATE_PAYMENT_METHODS:(i,t)=>({...i,vaultedPaymentMethods:t.payload,isLoading:!1,isUpdating:!1}),SET_ERROR:i=>({...i,isLoading:!1,isUpdating:!1}),DISABLE:i=>({...i,enabled:!1}),RESET:()=>ti},ea={INITIALIZE_CVV:(i,t,e)=>({...i,setCvvInput:e.setCvvInput,setSelectedVaultedPaymentMethod:e.setSelectedVaultedPaymentMethod}),SET_FORM_DIRTY:(i,t)=>({...i,formIsDirty:t.payload}),SET_CVV_INPUT:(i,t)=>({...i,cvvInput:t.payload}),SET_SELECTED_VAULTED_PAYMENT_METHOD:(i,t)=>({...i,selectedVaultedPaymentMethod:t.payload}),RESET_CVV:()=>ri},ta=at(Qo),ra=at(ea),ti={enabled:!1,isLoading:!1,isUpdating:!1,cvvRecapture:!1,vaultedPaymentMethods:[],createCvvInput:null,deleteVaultedPaymentMethod:()=>Promise.resolve(),startVaultedPaymentFlow:()=>Promise.resolve()},ri={cvvInput:null,formIsDirty:!1,setCvvInput:()=>{},selectedVaultedPaymentMethod:null,setSelectedVaultedPaymentMethod:()=>{}},br=class extends He{constructor(t,e){super(t,ti,ta,e,r=>{t.sdkContextController.setVaultManager(r)})}setLoading(t){this.dispatch({type:"SET_LOADING",payload:t})}setUpdating(t){this.dispatch({type:"SET_UPDATING",payload:t})}initializeVaultManager(t,e,r){this.dispatch({type:"INITIALIZE_VAULT_MANAGER",payload:t,vaultEnabled:e,cvvRecapture:r})}updatePaymentMethods(t){this.dispatch({type:"UPDATE_PAYMENT_METHODS",payload:t})}setError(t){this.dispatch({type:"SET_ERROR",payload:t})}disable(){this.dispatch({type:"DISABLE"})}reset(){this.dispatch({type:"RESET"})}},xr=class extends He{constructor(t,e){super(t,ri,ra,e,r=>{t.sdkContextController.setVaultManagerCvv(r)})}initializeCvv(t){this.dispatch({type:"INITIALIZE_CVV",createCvvInput:t})}setFormDirty(t){this.dispatch({type:"SET_FORM_DIRTY",payload:t})}setCvvInputState(t){this.dispatch({type:"SET_CVV_INPUT",payload:t})}setSelectedPaymentMethod(t){this.dispatch({type:"SET_SELECTED_VAULTED_PAYMENT_METHOD",payload:t})}resetCvv(){this.dispatch({type:"RESET_CVV"})}},nt=class extends wt{constructor(e){super(e);this._vaultManager=null;this._options=null;this.deleteVaultedPaymentMethod=async e=>{if(!this._vaultManager)throw new Error("Vault manager not initialized");try{this.coreController.updatePaymentMethods(this.vaultManagerState.vaultedPaymentMethods),await this._vaultManager.deleteVaultedPaymentMethod(e),await this.fetchVaultedPaymentMethods()}catch(r){throw this.coreController.setError(r instanceof Error?r:new Error("Failed to delete payment method")),r}};this.setCvvInput=e=>{this.itemController.setCvvInputState(e)};this.startVaultedPaymentFlow=async()=>{if(!this._vaultManager)throw new Error("Vault manager not initialized");let e=this.vaultItemState.selectedVaultedPaymentMethod,r=this.vaultManagerState.cvvRecapture,o=this.vaultItemState.cvvInput;if(!e||r&&(!o||o.metadata.error)){this.itemController.setFormDirty(!0);return}this.host.sdkStateController.startProcessing();try{await this._vaultManager.startPaymentFlow(e.id,r?{cvv:o.valueToken}:void 0)}catch(a){b.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=e=>{this.itemController.setSelectedPaymentMethod(e),this.itemController.setFormDirty(!1)};this.coreController=new br(e,{deleteVaultedPaymentMethod:this.deleteVaultedPaymentMethod.bind(this),startVaultedPaymentFlow:this.startVaultedPaymentFlow.bind(this),createCvvInput:this.createCvvInput.bind(this)}),this.itemController=new xr(e,{setCvvInput:this.setCvvInput.bind(this),setSelectedVaultedPaymentMethod:this.setSelectedVaultedPaymentMethod.bind(this)}),this.addController(this.coreController),this.addController(this.itemController),new M(this.host,{task:async([r,o])=>{if(!r||!o?.vaultEnabled)return this.coreController.disable(),E;this.coreController.setLoading(!0);try{this.coreController.initializeVaultManager(r,o.vaultEnabled,!!o.captureVaultedCardCvv),this.itemController.initializeCvv(r.createCvvInput),await this.fetchVaultedPaymentMethods(!0),b.log("VaultManagerController: Vault initialized successfully",{coreState:this.coreController.currentState,cvvState:this.itemController.currentState})}catch(a){b.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(e,r){this.vaultManager=e,this.options=r??null}get vaultManager(){return this._vaultManager}set vaultManager(e){this._vaultManager=e,this.host.requestUpdate()}get options(){return this._options}set options(e){this._options=e,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(e){if(!this._vaultManager)throw new Error("Vault manager not initialized");try{e||this.coreController.setUpdating(!0);let r=await this._vaultManager.fetchVaultedPaymentMethods();return b.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(e){if(!this._vaultManager)throw new Error("Vault manager not initialized");return this._vaultManager.createCvvInput(e)}};var lt="lit-localize-status";var ii=i=>typeof i!="string"&&"strTag"in i,Ht=(i,t,e)=>{let r=i[0];for(let o=1;o<i.length;o++)r+=t[e?e[o-1]:o-1],r+=i[o];return r};var dt=i=>ii(i)?Ht(i.strings,i.values):i;var y=dt,oi=!1;function Cr(i){if(oi)throw new Error("lit-localize can only be configured once");y=i,oi=!0}var Er=class{constructor(t){this.__litLocalizeEventHandler=e=>{e.detail.status==="ready"&&this.host.requestUpdate()},this.host=t}hostConnected(){window.addEventListener(lt,this.__litLocalizeEventHandler)}hostDisconnected(){window.removeEventListener(lt,this.__litLocalizeEventHandler)}},ia=i=>i.addController(new Er(i)),ai=ia;var S=()=>(i,t)=>(i.addInitializer(ai),i);var pt=class{constructor(){this.settled=!1,this.promise=new Promise((t,e)=>{this._resolve=t,this._reject=e})}resolve(t){this.settled=!0,this._resolve(t)}reject(t){this.settled=!0,this._reject(t)}};var ne=[];for(let i=0;i<256;i++)ne[i]=(i>>4&15).toString(16)+(i&15).toString(16);function si(i){let t=0,e=8997,r=0,o=33826,a=0,n=40164,u=0,g=52210;for(let A=0;A<i.length;A++)e^=i.charCodeAt(A),t=e*435,r=o*435,a=n*435,u=g*435,a+=e<<8,u+=o<<8,r+=t>>>16,e=t&65535,a+=r>>>16,o=r&65535,g=u+(a>>>16)&65535,n=a&65535;return ne[g>>8]+ne[g&255]+ne[n>>8]+ne[n&255]+ne[o>>8]+ne[o&255]+ne[e>>8]+ne[e&255]}var oa="",aa="h",sa="s";function ni(i,t){return(t?aa:sa)+si(typeof i=="string"?i:i.join(oa))}var li=new WeakMap,di=new Map;function pi(i,t,e){if(i){let r=e?.id??na(t),o=i[r];if(o){if(typeof o=="string")return o;if("strTag"in o)return Ht(o.strings,t.values,o.values);{let a=li.get(o);return a===void 0&&(a=o.values,li.set(o,a)),{...o,values:a.map(n=>t.values[n])}}}}return dt(t)}function na(i){let t=typeof i=="string"?i:i.strings,e=di.get(t);return e===void 0&&(e=ni(t,typeof i!="string"&&!("strTag"in i)),di.set(t,e)),e}function Sr(i){window.dispatchEvent(new CustomEvent(lt,{detail:i}))}var Yt="",Mr,ci,Ut,Ar,mi,Ue=new pt;Ue.resolve();var zt=0,hi=i=>(Cr((t,e)=>pi(mi,t,e)),Yt=ci=i.sourceLocale,Ut=new Set(i.targetLocales),Ut.add(i.sourceLocale),Ar=i.loadLocale,{getLocale:la,setLocale:da}),la=()=>Yt,da=i=>{if(i===(Mr??Yt))return Ue.promise;if(!Ut||!Ar)throw new Error("Internal error");if(!Ut.has(i))throw new Error("Invalid locale code");zt++;let t=zt;return Mr=i,Ue.settled&&(Ue=new pt),Sr({status:"loading",loadingLocale:i}),(i===ci?Promise.resolve({templates:void 0}):Ar(i)).then(r=>{zt===t&&(Yt=i,Mr=void 0,mi=r.templates,Sr({status:"ready",readyLocale:i}),Ue.resolve())},r=>{zt===t&&(Sr({status:"error",errorLocale:i,errorMessage:r.toString()}),Ue.reject(r))}),Ue.promise};var _r="en",Pr=["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"],ui="You must call `loadLocale` first to set up the localized template.",gi,Ft,fi=i=>{let t=hi({sourceLocale:_r,targetLocales:Pr,loadLocale:i});gi=t.getLocale,Ft=t.setLocale};var kr=i=>{fi(i)},wr=i=>{if(!Ft)throw new Error(ui);return Ft(i)};var ct=new Set(Pr);ct.add(_r);var Tr=i=>{if(typeof i!="string")return!1;if(i==="en")return!0;let t=i.replace("_","-");if(ct.has(t))return!0;let e=t.split("-")[0];return!!ct.has(e)},Lr=i=>{if(i==="en")return"en-GB";let t=i.replace("_","-");if(ct.has(t))return t;let e=t.split("-")[0];return ct.has(e)?e:"en-GB"};var Bt=globalThis,Kt=Bt.ShadowRoot&&(Bt.ShadyCSS===void 0||Bt.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Ir=Symbol(),yi=new WeakMap,mt=class{constructor(t,e,r){if(this._$cssResult$=!0,r!==Ir)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o,e=this.t;if(Kt&&t===void 0){let r=e!==void 0&&e.length===1;r&&(t=yi.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),r&&yi.set(e,t))}return t}toString(){return this.cssText}},vi=i=>new mt(typeof i=="string"?i:i+"",void 0,Ir),c=(i,...t)=>{let e=i.length===1?i[0]:t.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(e,i,Ir)},bi=(i,t)=>{if(Kt)i.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let e of t){let r=document.createElement("style"),o=Bt.litNonce;o!==void 0&&r.setAttribute("nonce",o),r.textContent=e.cssText,i.appendChild(r)}},Nr=Kt?i=>i:i=>i instanceof CSSStyleSheet?(t=>{let e="";for(let r of t.cssRules)e+=r.cssText;return vi(e)})(i):i;var{is:pa,defineProperty:ca,getOwnPropertyDescriptor:ma,getOwnPropertyNames:ha,getOwnPropertySymbols:ua,getPrototypeOf:ga}=Object,Le=globalThis,xi=Le.trustedTypes,fa=xi?xi.emptyScript:"",ya=Le.reactiveElementPolyfillSupport,ht=(i,t)=>i,ut={toAttribute(i,t){switch(t){case Boolean:i=i?fa:null;break;case Object:case Array:i=i==null?i:JSON.stringify(i)}return i},fromAttribute(i,t){let e=i;switch(t){case Boolean:e=i!==null;break;case Number:e=i===null?null:Number(i);break;case Object:case Array:try{e=JSON.parse(i)}catch{e=null}}return e}},jt=(i,t)=>!pa(i,t),Ci={attribute:!0,type:String,converter:ut,reflect:!1,useDefault:!1,hasChanged:jt};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),Le.litPropertyMetadata??(Le.litPropertyMetadata=new WeakMap);var le=class extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??(this.l=[])).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=Ci){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(t,e),!e.noAccessor){let r=Symbol(),o=this.getPropertyDescriptor(t,r,e);o!==void 0&&ca(this.prototype,t,o)}}static getPropertyDescriptor(t,e,r){let{get:o,set:a}=ma(this.prototype,t)??{get(){return this[e]},set(n){this[e]=n}};return{get:o,set(n){let u=o?.call(this);a?.call(this,n),this.requestUpdate(t,u,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??Ci}static _$Ei(){if(this.hasOwnProperty(ht("elementProperties")))return;let t=ga(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(ht("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(ht("properties"))){let e=this.properties,r=[...ha(e),...ua(e)];for(let o of r)this.createProperty(o,e[o])}let t=this[Symbol.metadata];if(t!==null){let e=litPropertyMetadata.get(t);if(e!==void 0)for(let[r,o]of e)this.elementProperties.set(r,o)}this._$Eh=new Map;for(let[e,r]of this.elementProperties){let o=this._$Eu(e,r);o!==void 0&&this._$Eh.set(o,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){let e=[];if(Array.isArray(t)){let r=new Set(t.flat(1/0).reverse());for(let o of r)e.unshift(Nr(o))}else t!==void 0&&e.push(Nr(t));return e}static _$Eu(t,e){let r=e.attribute;return r===!1?void 0:typeof r=="string"?r:typeof t=="string"?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(t=>t(this))}addController(t){(this._$EO??(this._$EO=new Set)).add(t),this.renderRoot!==void 0&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){let t=new Map,e=this.constructor.elementProperties;for(let r of e.keys())this.hasOwnProperty(r)&&(t.set(r,this[r]),delete this[r]);t.size>0&&(this._$Ep=t)}createRenderRoot(){let t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return bi(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),this._$EO?.forEach(t=>t.hostConnected?.())}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.())}attributeChangedCallback(t,e,r){this._$AK(t,r)}_$ET(t,e){let r=this.constructor.elementProperties.get(t),o=this.constructor._$Eu(t,r);if(o!==void 0&&r.reflect===!0){let a=(r.converter?.toAttribute!==void 0?r.converter:ut).toAttribute(e,r.type);this._$Em=t,a==null?this.removeAttribute(o):this.setAttribute(o,a),this._$Em=null}}_$AK(t,e){let r=this.constructor,o=r._$Eh.get(t);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:ut;this._$Em=o,this[o]=n.fromAttribute(e,a.type)??this._$Ej?.get(o)??null,this._$Em=null}}requestUpdate(t,e,r){if(t!==void 0){let o=this.constructor,a=this[t];if(r??(r=o.getPropertyOptions(t)),!((r.hasChanged??jt)(a,e)||r.useDefault&&r.reflect&&a===this._$Ej?.get(t)&&!this.hasAttribute(o._$Eu(t,r))))return;this.C(t,e,r)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(t,e,{useDefault:r,reflect:o,wrapped:a},n){r&&!(this._$Ej??(this._$Ej=new Map)).has(t)&&(this._$Ej.set(t,n??e??this[t]),a!==!0||n!==void 0)||(this._$AL.has(t)||(this.hasUpdated||r||(e=void 0),this._$AL.set(t,e)),o===!0&&this._$Em!==t&&(this._$Eq??(this._$Eq=new Set)).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}let t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this._$Ep){for(let[o,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){let{wrapped:n}=a,u=this[o];n!==!0||this._$AL.has(o)||u===void 0||this.C(o,void 0,a,u)}}let t=!1,e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach(r=>r.hostUpdate?.()),this.update(e)):this._$EM()}catch(r){throw t=!1,this._$EM(),r}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&(this._$Eq=this._$Eq.forEach(e=>this._$ET(e,this[e]))),this._$EM()}updated(t){}firstUpdated(t){}};le.elementStyles=[],le.shadowRootOptions={mode:"open"},le[ht("elementProperties")]=new Map,le[ht("finalized")]=new Map,ya?.({ReactiveElement:le}),(Le.reactiveElementVersions??(Le.reactiveElementVersions=[])).push("2.1.0");var ft=globalThis,Gt=ft.trustedTypes,Ei=Gt?Gt.createPolicy("lit-html",{createHTML:i=>i}):void 0,Or="$lit$",de=`lit$${Math.random().toFixed(9).slice(2)}$`,Rr="?"+de,va=`<${Rr}>`,Ke=document,yt=()=>Ke.createComment(""),vt=i=>i===null||typeof i!="object"&&typeof i!="function",Dr=Array.isArray,ki=i=>Dr(i)||typeof i?.[Symbol.iterator]=="function",$r=`[
|
|
2
|
+
\f\r]`,gt=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Si=/-->/g,Mi=/>/g,Fe=RegExp(`>|${$r}(?:([^\\s"'>=/]+)(${$r}*=${$r}*(?:[^
|
|
3
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),Ai=/'/g,_i=/"/g,wi=/^(?:script|style|textarea|title)$/i,Vr=i=>(t,...e)=>({_$litType$:i,strings:t,values:e}),d=Vr(1),ce=Vr(2),_l=Vr(3),pe=Symbol.for("lit-noChange"),p=Symbol.for("lit-nothing"),Pi=new WeakMap,Be=Ke.createTreeWalker(Ke,129);function Ti(i,t){if(!Dr(i)||!i.hasOwnProperty("raw"))throw Error("invalid template strings array");return Ei!==void 0?Ei.createHTML(t):t}var Li=(i,t)=>{let e=i.length-1,r=[],o,a=t===2?"<svg>":t===3?"<math>":"",n=gt;for(let u=0;u<e;u++){let g=i[u],A,w,P=-1,O=0;for(;O<g.length&&(n.lastIndex=O,w=n.exec(g),w!==null);)O=n.lastIndex,n===gt?w[1]==="!--"?n=Si:w[1]!==void 0?n=Mi:w[2]!==void 0?(wi.test(w[2])&&(o=RegExp("</"+w[2],"g")),n=Fe):w[3]!==void 0&&(n=Fe):n===Fe?w[0]===">"?(n=o??gt,P=-1):w[1]===void 0?P=-2:(P=n.lastIndex-w[2].length,A=w[1],n=w[3]===void 0?Fe:w[3]==='"'?_i:Ai):n===_i||n===Ai?n=Fe:n===Si||n===Mi?n=gt:(n=Fe,o=void 0);let Me=n===Fe&&i[u+1].startsWith("/>")?" ":"";a+=n===gt?g+va:P>=0?(r.push(A),g.slice(0,P)+Or+g.slice(P)+de+Me):g+de+(P===-2?u:Me)}return[Ti(i,a+(i[e]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),r]},bt=class i{constructor({strings:t,_$litType$:e},r){let o;this.parts=[];let a=0,n=0,u=t.length-1,g=this.parts,[A,w]=Li(t,e);if(this.el=i.createElement(A,r),Be.currentNode=this.el.content,e===2||e===3){let P=this.el.content.firstChild;P.replaceWith(...P.childNodes)}for(;(o=Be.nextNode())!==null&&g.length<u;){if(o.nodeType===1){if(o.hasAttributes())for(let P of o.getAttributeNames())if(P.endsWith(Or)){let O=w[n++],Me=o.getAttribute(P).split(de),Mt=/([.?@])?(.*)/.exec(O);g.push({type:1,index:a,name:Mt[2],strings:Me,ctor:Mt[1]==="."?Wt:Mt[1]==="?"?Jt:Mt[1]==="@"?Zt:Ge}),o.removeAttribute(P)}else P.startsWith(de)&&(g.push({type:6,index:a}),o.removeAttribute(P));if(wi.test(o.tagName)){let P=o.textContent.split(de),O=P.length-1;if(O>0){o.textContent=Gt?Gt.emptyScript:"";for(let Me=0;Me<O;Me++)o.append(P[Me],yt()),Be.nextNode(),g.push({type:2,index:++a});o.append(P[O],yt())}}}else if(o.nodeType===8)if(o.data===Rr)g.push({type:2,index:a});else{let P=-1;for(;(P=o.data.indexOf(de,P+1))!==-1;)g.push({type:7,index:a}),P+=de.length-1}a++}}static createElement(t,e){let r=Ke.createElement("template");return r.innerHTML=t,r}};function je(i,t,e=i,r){if(t===pe)return t;let o=r!==void 0?e._$Co?.[r]:e._$Cl,a=vt(t)?void 0:t._$litDirective$;return o?.constructor!==a&&(o?._$AO?.(!1),a===void 0?o=void 0:(o=new a(i),o._$AT(i,e,r)),r!==void 0?(e._$Co??(e._$Co=[]))[r]=o:e._$Cl=o),o!==void 0&&(t=je(i,o._$AS(i,t.values),o,r)),t}var qt=class{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){let{el:{content:e},parts:r}=this._$AD,o=(t?.creationScope??Ke).importNode(e,!0);Be.currentNode=o;let a=Be.nextNode(),n=0,u=0,g=r[0];for(;g!==void 0;){if(n===g.index){let A;g.type===2?A=new tt(a,a.nextSibling,this,t):g.type===1?A=new g.ctor(a,g.name,g.strings,this,t):g.type===6&&(A=new Xt(a,this,t)),this._$AV.push(A),g=r[++u]}n!==g?.index&&(a=Be.nextNode(),n++)}return Be.currentNode=Ke,o}p(t){let e=0;for(let r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(t,r,e),e+=r.strings.length-2):r._$AI(t[e])),e++}},tt=class i{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,r,o){this.type=2,this._$AH=p,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=r,this.options=o,this._$Cv=o?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode,e=this._$AM;return e!==void 0&&t?.nodeType===11&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=je(this,t,e),vt(t)?t===p||t==null||t===""?(this._$AH!==p&&this._$AR(),this._$AH=p):t!==this._$AH&&t!==pe&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):ki(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==p&&vt(this._$AH)?this._$AA.nextSibling.data=t:this.T(Ke.createTextNode(t)),this._$AH=t}$(t){let{values:e,_$litType$:r}=t,o=typeof r=="number"?this._$AC(t):(r.el===void 0&&(r.el=bt.createElement(Ti(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===o)this._$AH.p(e);else{let a=new qt(o,this),n=a.u(this.options);a.p(e),this.T(n),this._$AH=a}}_$AC(t){let e=Pi.get(t.strings);return e===void 0&&Pi.set(t.strings,e=new bt(t)),e}k(t){Dr(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,r,o=0;for(let a of t)o===e.length?e.push(r=new i(this.O(yt()),this.O(yt()),this,this.options)):r=e[o],r._$AI(a),o++;o<e.length&&(this._$AR(r&&r._$AB.nextSibling,o),e.length=o)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t&&t!==this._$AB;){let r=t.nextSibling;t.remove(),t=r}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}},Ge=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,r,o,a){this.type=1,this._$AH=p,this._$AN=void 0,this.element=t,this.name=e,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=p}_$AI(t,e=this,r,o){let a=this.strings,n=!1;if(a===void 0)t=je(this,t,e,0),n=!vt(t)||t!==this._$AH&&t!==pe,n&&(this._$AH=t);else{let u=t,g,A;for(t=a[0],g=0;g<a.length-1;g++)A=je(this,u[r+g],e,g),A===pe&&(A=this._$AH[g]),n||(n=!vt(A)||A!==this._$AH[g]),A===p?t=p:t!==p&&(t+=(A??"")+a[g+1]),this._$AH[g]=A}n&&!o&&this.j(t)}j(t){t===p?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},Wt=class extends Ge{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===p?void 0:t}},Jt=class extends Ge{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==p)}},Zt=class extends Ge{constructor(t,e,r,o,a){super(t,e,r,o,a),this.type=5}_$AI(t,e=this){if((t=je(this,t,e,0)??p)===pe)return;let r=this._$AH,o=t===p&&r!==p||t.capture!==r.capture||t.once!==r.once||t.passive!==r.passive,a=t!==p&&(r===p||o);o&&this.element.removeEventListener(this.name,this,r),a&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}},Xt=class{constructor(t,e,r){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(t){je(this,t)}},Ii={M:Or,P:de,A:Rr,C:1,L:Li,R:qt,D:ki,V:je,I:tt,H:Ge,N:Jt,U:Zt,B:Wt,F:Xt},ba=ft.litHtmlPolyfillSupport;ba?.(bt,tt),(ft.litHtmlVersions??(ft.litHtmlVersions=[])).push("3.3.0");var Ni=(i,t,e)=>{let r=e?.renderBefore??t,o=r._$litPart$;if(o===void 0){let a=e?.renderBefore??null;r._$litPart$=o=new tt(t.insertBefore(yt(),a),a,void 0,e??{})}return o._$AI(i),o};var xt=globalThis,m=class extends le{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var e;let t=super.createRenderRoot();return(e=this.renderOptions).renderBefore??(e.renderBefore=t.firstChild),t}update(t){let e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=Ni(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return pe}};m._$litElement$=!0,m.finalized=!0,xt.litElementHydrateSupport?.({LitElement:m});var xa=xt.litElementPolyfillSupport;xa?.({LitElement:m});(xt.litElementVersions??(xt.litElementVersions=[])).push("4.2.0");var h=i=>(t,e)=>{e!==void 0?e.addInitializer(()=>{customElements.define(i,t)}):customElements.define(i,t)};var Ca={attribute:!0,type:String,converter:ut,reflect:!1,hasChanged:jt},Ea=(i=Ca,t,e)=>{let{kind:r,metadata:o}=e,a=globalThis.litPropertyMetadata.get(o);if(a===void 0&&globalThis.litPropertyMetadata.set(o,a=new Map),r==="setter"&&((i=Object.create(i)).wrapped=!0),a.set(e.name,i),r==="accessor"){let{name:n}=e;return{set(u){let g=t.get.call(this);t.set.call(this,u),this.requestUpdate(n,g,i)},init(u){return u!==void 0&&this.C(n,void 0,i,u),u}}}if(r==="setter"){let{name:n}=e;return function(u){let g=this[n];t.call(this,u),this.requestUpdate(n,g,i)}}throw Error("Unsupported decorator location: "+r)};function l(i){return(t,e)=>typeof e=="object"?Ea(i,t,e):((r,o,a)=>{let n=o.hasOwnProperty(a);return o.constructor.createProperty(a,r),n?Object.getOwnPropertyDescriptor(o,a):void 0})(i,t,e)}function x(i){return l({...i,state:!0,attribute:!1})}var qe=(i,t,e)=>(e.configurable=!0,e.enumerable=!0,Reflect.decorate&&typeof t!="object"&&Object.defineProperty(i,t,e),e);function Ie(i,t){return(e,r,o)=>{let a=n=>n.renderRoot?.querySelector(i)??null;if(t){let{get:n,set:u}=typeof r=="object"?e:o??(()=>{let g=Symbol();return{get(){return this[g]},set(A){this[g]=A}}})();return qe(e,r,{get(){let g=n.call(this);return g===void 0&&(g=a(this),(g!==null||this.hasUpdated)&&u.call(this,g)),g}})}return qe(e,r,{get(){return a(this)}})}}function _(i,t,e){return i?t(i):e?.(i)}var v=c`
|
|
5
4
|
* {
|
|
6
5
|
box-sizing: border-box;
|
|
7
6
|
}
|
|
8
|
-
|
|
7
|
+
`,$i=c`
|
|
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 Oi="https://sdk.primer.io/web/v2-latest/Primer.min.js";var Qt=class{constructor(t){this._methods=t}get(t){return this._methods.get(t)}toArray(){return Array.from(this._methods.values())}size(){return this._methods.size}};var er=class{constructor(t){this.paymentMethods=null;this.headlessInstance=t}setPaymentMethods(t){this.paymentMethods=t}async refreshSession(){if(!this.headlessInstance){b.error("PrimerJS: Cannot refresh session: Headless instance not available");return}try{await this.headlessInstance.refreshClientSession()}catch(t){throw b.error("PrimerJS: Error refreshing client session:",t),t}}getPaymentMethods(){return this.paymentMethods?this.paymentMethods.toArray():(b.warn("PrimerJS: Payment methods not available"),[])}handlePaymentStart(){this.onPaymentStart&&this.onPaymentStart()}handleBeforePaymentCreate(t,e){if(this.onPaymentPrepare){let r={continuePaymentCreation:()=>{b.info("PrimerJS: Payment creation continuing"),e.continuePaymentCreation()},abortPaymentCreation:()=>{b.info("PrimerJS: Payment creation aborted"),e.abortPaymentCreation()}};this.onPaymentPrepare(t,r)}else b.info("PrimerJS: No payment prepare handler, continuing by default"),e.continuePaymentCreation()}handlePaymentComplete(t){this.onPaymentComplete&&this.onPaymentComplete({payment:t,status:"success"})}handlePaymentFailure(t,e){this.onPaymentComplete&&this.onPaymentComplete({payment:e||null,status:"error",error:t})}};var tr=typeof window<"u"&&typeof window.document<"u";function Sa(i){return document.querySelector(`script[src^="${i}"]`)}function Ma(i,t){let e=document.createElement("script");return e.setAttribute("src",i),e.setAttribute("async",""),e.setAttribute("crossorigin","anonymous"),t&&e.setAttribute("type","module"),e}function Ri(i,t=!1){if(!tr)throw new Error("Cannot load script in server environment");let e=Sa(i)??Ma(i,t);return new Promise((r,o)=>{e.onload=()=>{r()},e.onerror=()=>{o()},e.parentNode||document.head.appendChild(e)})}var rr=class{constructor(t){this.createPaymentMethodManager=null;this._paymentsList=[];this.currentSdkInstance=null;this.primerJS=null;this.loadingTimeout=null;this.isDisconnected=!1;(this.host=t).addController(this),this.isDisconnected=!1,this.sdkInstanceTask=new M(t,{args:()=>[this.host.clientToken,this.host.options],task:this.initializeHeadless()}),new M(t,{args:()=>[this.sdkInstanceTask.value,this.paymentsList],task:this.initializeLitContext()})}set paymentsList(t){this._paymentsList=t,this.host.requestUpdate()}get paymentsList(){return this._paymentsList}hostConnected(){this.isDisconnected=!1,this.host.sdkStateController.startLoading(),this.setupLoadingTimeout()}hostDisconnected(){this.isDisconnected=!0,this.cleanupResources()}setupLoadingTimeout(){this.clearLoadingTimeout(),this.loadingTimeout=setTimeout(()=>{this.host.sdkStateController.currentState.isLoading&&(b.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(),b.info("SDK instance cleaned up")}catch(t){b.error("Error cleaning up SDK instance:",t)}this.currentSdkInstance=null,this.primerJS=null}async _loadV2Sdk(t=Oi){if(window.Primer&&typeof window.Primer.preloadPrimer=="function"){b.info("SDK already loaded, skipping load script"),await window.Primer.preloadPrimer();return}await Ri(t),await window.Primer.preloadPrimer()}initializeHeadless(){return async([t,e])=>{if(this.isDisconnected)return b.warn("Component disconnected, aborting SDK initialization"),E;if(!t||!e)return E;this.cleanupResources();try{await this._loadV2Sdk();let{Primer:r}=window;this.primerJS=new er(null);let o=await r.createHeadless(t,{...e,onAvailablePaymentMethodsLoad:n=>{this.isDisconnected||(b.info("Configuration payment methods:",n),this.paymentsList=n)},onCheckoutComplete:({payment:n})=>{this.isDisconnected||(b.info("Payment completed:",n),this.host.sdkStateController.completeProcessing(),this.primerJS&&this.primerJS.handlePaymentComplete(n))},onCheckoutFail:(n,u)=>{this.isDisconnected||(b.error("Payment failed:",n),this.host.sdkStateController.setFailure(n.code||"UNKNOWN_ERROR",n.message||"Unknown error occurred"),this.primerJS&&this.primerJS.handlePaymentFailure(n,u.payment))},onBeforePaymentCreate:(n,u)=>{this.isDisconnected||(this.host.sdkStateController.startProcessing(),this.primerJS?this.primerJS.handleBeforePaymentCreate(n,u):u?.continuePaymentCreation())},onPaymentMethodAction:(n,u)=>{this.isDisconnected||n==="PAYMENT_METHOD_UNSELECTED"&&this.host.sdkStateController.stopProcessing()},onPaymentCreationStart:()=>{this.isDisconnected||(this.host.sdkStateController.resetError(),this.primerJS&&this.primerJS.handlePaymentStart())}});if(this.createPaymentMethodManager=o.createPaymentMethodManager.bind(o),this.currentSdkInstance=o,this.primerJS&&Object.defineProperty(this.primerJS,"headlessInstance",{value:o,writable:!1}),await o.start(),this.isDisconnected)return this.cleanupResources(),E;this.host.sdkContextController.setClientOptions(e),this.primerJS&&this.host.primerEventsController.dispatchCheckoutInitialized(this.primerJS);let a=o.getSDKUtilities();return this.host.sdkContextController.setHeadlessUtils(a),this.host.vaultManagerController.initializeVaultManager(o.createVaultManager(),{vaultEnabled:e.vault?.enabled,captureVaultedCardCvv:!!a.getPaymentMethodConfiguration("PAYMENT_CARD")?.options.captureVaultedCardCvv}),o}catch(r){throw r instanceof Error&&(b.error("SDK initialization error:",r),this.host.sdkStateController.setError(r)),this.cleanupResources(),r}}}initializeLitContext(){return async([t,e])=>{if(this.isDisconnected)return E;if(!t||!e.length)return E;let r=new Map,o=new Map;try{for(let n of e){if(this.isDisconnected)break;let u=await this.initializePaymentMethodManager(n)();n&&u&&(r.set(n.type,n),o.set(n.type,u))}if(this.isDisconnected)return E;let a=new Qt(r);return this.host.sdkContextController.setPaymentManagers(o),this.host.sdkContextController.setPaymentMethods(a),this.primerJS&&this.primerJS.setPaymentMethods(a),this.host.primerEventsController.dispatchPaymentMethods(a),b.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(t){let{type:e,managerType:r}=t;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:e,manager:o}:null}try{if(r==="CARD"){let a=await this.createPaymentMethodManager(e,{onCardNetworksChange:async n=>{this.isDisconnected||await this.host.cardNetworkController.processCardNetworkChangeEvent(n)},onCardNetworksLoading:()=>{this.isDisconnected||this.host.cardNetworkController.setCardNetworksLoading()}});return a?{type:e,manager:a}:null}let o=await this.createPaymentMethodManager(e);return o?{type:e,manager:o}:null}catch(o){return b.error(`Failed to initialize manager for ${e}:`,o),null}}}};var ir=class{constructor(t){this.host=t,t.addController(this)}_error(t){let{error:e}=t.detail;this.host.sdkStateController.setFailure("UNKNOWN_ERROR",e.message)}_mandateConfirmed(){this.host.sdkStateController.completeProcessing()}_mandateDeclined(){this.host.sdkStateController.setFailure("UNKNOWN_ERROR","Mandate declined")}hostConnected(){this.host.addEventListener("primer-ach-error",this._error.bind(this)),this.host.addEventListener("primer-ach-mandate-confirmed",this._mandateConfirmed.bind(this)),this.host.addEventListener("primer-ach-mandate-declined",this._mandateDeclined.bind(this))}hostDisconnected(){this.host.removeEventListener("primer-ach-error",this._error.bind(this)),this.host.removeEventListener("primer-ach-mandate-confirmed",this._mandateConfirmed.bind(this)),this.host.removeEventListener("primer-ach-mandate-declined",this._mandateDeclined.bind(this))}};var Aa=qr({"../../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=>Aa(`../../localization/lit-localize/locales/${i}.ts`));var or={LOADER_DISABLED:"loader-disabled",CUSTOM_STYLES:"custom-styles",CLIENT_TOKEN:"client-token",JS_INIT:"js-initialized"},W=class extends m{constructor(){super();this.customStyles="";this.clientToken="";this.options={};this._jsInitialized=!1;this.previousLoadingState=!0;this.hasAssignedContent=!1;this._loadingTimeoutId=null;this.locale="en-GB";this.onSlotChange=e=>{let o=e.target.assignedNodes({flatten:!0});this.hasAssignedContent=o.length>0,this.requestUpdate()};this.sdkContextController=new It(this),this.sdkStateController=new Tt(this),this.primerEventsController=new Xe(this),this.styleProcessingController=new Nt(this),this.vaultManagerController=new nt(this),this.cardNetworkController=new At(this),this.achPaymentEventsController=new ir(this),new rr(this)}set jsInitialized(e){this.requestUpdate(),this._jsInitialized=e}get jsInitialized(){return this._jsInitialized}attributeChangedCallback(e,r,o){e===or.CUSTOM_STYLES?this.styleProcessingController.processCustomStyles(o):super.attributeChangedCallback(e,r,o)}disconnectedCallback(){this._loadingTimeoutId&&(window.clearTimeout(this._loadingTimeoutId),this._loadingTimeoutId=null),this.sdkStateController?.currentState.isLoading&&this.sdkStateController.forceCompleteLoading(),super.disconnectedCallback()}willUpdate(e){e.has("options")&&(this.options?.locale&&(Tr(this.options?.locale)?this.locale=Lr(this.options?.locale):b.warn("\u{1F30E}\u2757 Unsupported locale provided:",this.options?.locale,"- Falling back to default locale `en-GB`")),wr(this.locale||"en-GB"))}updated(){let e=getComputedStyle(this);this.sdkContextController.setComputedStyles(e),this.checkLoadingStateChange()}checkLoadingStateChange(){let e=this.sdkStateController?.currentState.isLoading||!1;this.previousLoadingState&&!e&&(this.jsInitialized=!0),this.previousLoadingState=e,e&&!this._loadingTimeoutId?this._loadingTimeoutId=window.setTimeout(()=>{this.sdkStateController?.currentState.isLoading&&(b.warn("Loading timeout in component, forcing completion"),this.sdkStateController.forceCompleteLoading(),this.jsInitialized=!0),this._loadingTimeoutId=null},1e4):!e&&this._loadingTimeoutId&&(window.clearTimeout(this._loadingTimeoutId),this._loadingTimeoutId=null)}render(){let e=this.sdkStateController.currentState,r=e.isLoading,o=e.error,a=!r&&!o;return d`
|
|
17
|
+
${_(r,()=>p)}
|
|
18
|
+
${_(o,()=>d`<primer-checkout-error></primer-checkout-error>`)}
|
|
19
|
+
${_(a,()=>d`
|
|
21
20
|
<slot name="main" @slotchange=${this.onSlotChange}></slot>
|
|
22
|
-
${
|
|
23
|
-
`,()=>
|
|
24
|
-
`}addEventListener(
|
|
21
|
+
${_(this.hasAssignedContent,()=>p,()=>d`<primer-main></primer-main>`)}
|
|
22
|
+
`,()=>p)}
|
|
23
|
+
`}addEventListener(e,r,o){super.addEventListener(e,r,o)}removeEventListener(e,r,o){super.removeEventListener(e,r,o)}};W.styles=[v,$i],s([l({type:String,attribute:or.CUSTOM_STYLES})],W.prototype,"customStyles",2),s([l({type:String,attribute:or.CLIENT_TOKEN})],W.prototype,"clientToken",2),s([l({type:Object})],W.prototype,"options",2),s([l({type:Boolean,reflect:!0,attribute:or.JS_INIT})],W.prototype,"_jsInitialized",2),s([Ie("slot")],W.prototype,"defaultSlot",2),s([x()],W.prototype,"previousLoadingState",2),W=s([S(),h("primer-checkout")],W);function _a(i){return document.querySelector(`#${i}`)}function Pa(i,t){let e=document.createElement("style");return e.textContent=i,e.id=t,e}function Ct(i,t,e=!0){if(!tr||_a(t))return;let o=Pa(i,t);e&&document.head.firstChild?document.head.insertBefore(o,document.head.firstChild):document.head.appendChild(o)}var Di=`
|
|
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 Vi=`/**
|
|
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
|
+
`,Hi=`/**
|
|
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 ka="primer-light-theme-css",wa="primer-dark-theme-css";function Hr(){Ct(Vi,ka,!0)}function zr(){Ct(Hi,wa,!0)}function zi(){Hr(),zr()}function Yi(){Ct(Di,"primer-css-loader-styles",!1)}function Ui(){zi()}function Ta(){Hr()}function La(){zr()}var Fi=c`
|
|
189
188
|
:host {
|
|
190
189
|
display: inline-flex;
|
|
191
190
|
align-items: center;
|
|
@@ -230,12 +229,12 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
|
|
|
230
229
|
transform: rotate(360deg);
|
|
231
230
|
}
|
|
232
231
|
}
|
|
233
|
-
`;var
|
|
232
|
+
`;var Yr={small:16,medium:24,large:32},re=class extends m{constructor(){super(...arguments);this.color="var(--primer-color-loader)";this.size="medium";this.compact=!1}getSize(){if(this.size in Yr)return Yr[this.size];let e=parseInt(this.size,10);return isNaN(e)?Yr.medium:e}render(){let e=this.getSize(),r=20,o=`0 0 ${r} ${r}`;return this.style.setProperty("--spinner-color",this.color),this.style.setProperty("--spinner-size",`${e}px`),d`
|
|
234
233
|
<div class="spinner-container ${this.compact?"compact":""}">
|
|
235
234
|
<svg
|
|
236
235
|
class="spinner"
|
|
237
|
-
width="${
|
|
238
|
-
height="${
|
|
236
|
+
width="${e}"
|
|
237
|
+
height="${e}"
|
|
239
238
|
viewBox="${o}"
|
|
240
239
|
fill="none"
|
|
241
240
|
xmlns="http://www.w3.org/2000/svg"
|
|
@@ -249,7 +248,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
|
|
|
249
248
|
/>
|
|
250
249
|
</svg>
|
|
251
250
|
</div>
|
|
252
|
-
`}};
|
|
251
|
+
`}};re.styles=[Fi],s([l({type:String})],re.prototype,"color",2),s([l({type:String})],re.prototype,"size",2),s([l({type:Boolean})],re.prototype,"compact",2),re=s([h("primer-spinner")],re);var Ne={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},me=i=>(...t)=>({_$litDirective$:i,values:t}),rt=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,r){this._$Ct=t,this._$AM=e,this._$Ci=r}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}};var R=me(class extends rt{constructor(i){if(super(i),i.type!==Ne.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(t=>i[t]).join(" ")+" "}update(i,[t]){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 t)t[r]&&!this.nt?.has(r)&&this.st.add(r);return this.render(t)}let e=i.element.classList;for(let r of this.st)r in t||(e.remove(r),this.st.delete(r));for(let r in t){let o=!!t[r];o===this.st.has(r)||this.nt?.has(r)||(o?(e.add(r),this.st.add(r)):(e.remove(r),this.st.delete(r)))}return pe}});var Bi=c`
|
|
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 ie=class extends m{constructor(){super(...arguments);this.focusWithin=!1;this.hasError=!1}handleWrapperClick(e){if(e.target!==e.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 e=this.inputSlot.assignedElements({flatten:!0}),r=e.find(o=>o.tagName.toLowerCase()==="primer-input");if(r)return r;for(let o of e){let a=o.querySelector("primer-input");if(a)return a}return null}render(){let e={"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="${R(e)}" @click="${this.handleWrapperClick}">
|
|
321
320
|
<slot name="input"></slot>
|
|
322
321
|
</div>
|
|
323
322
|
<slot name="error"></slot>
|
|
324
323
|
</div>
|
|
325
|
-
`}};
|
|
324
|
+
`}};ie.styles=[Bi],s([l({type:Boolean})],ie.prototype,"focusWithin",2),s([l({type:Boolean,reflect:!0,attribute:"has-error"})],ie.prototype,"hasError",2),s([Ie('slot[name="input"]')],ie.prototype,"inputSlot",2),ie=s([h("primer-input-wrapper")],ie);var Ki=c`
|
|
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 he=class extends m{constructor(){super(...arguments);this.for="";this.disabled=!1}render(){return d`<label for=${this.for}><slot></slot></label>`}};he.styles=[Ki],s([l({type:String,reflect:!0})],he.prototype,"for",2),s([l({type:Boolean,reflect:!0})],he.prototype,"disabled",2),he=s([h("primer-input-label")],he);var ji=c`
|
|
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 K=class extends m{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?p: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 p;let e;return this.variant==="primary"?e="var(--primer-color-background-outlined-default)":(this.variant==="secondary"||this.variant==="tertiary")&&(e="var(--primer-color-gray-900)"),d`
|
|
513
512
|
<primer-spinner
|
|
514
513
|
size="small"
|
|
515
|
-
color="${
|
|
514
|
+
color="${e}"
|
|
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
|
+
`}};K.styles=[v,ji],s([l({type:String,reflect:!0})],K.prototype,"variant",2),s([l({type:Boolean,reflect:!0})],K.prototype,"disabled",2),s([l({type:Boolean,reflect:!0})],K.prototype,"loading",2),s([l({type:String,attribute:"type"})],K.prototype,"buttonType",2),s([l({type:String,reflect:!0})],K.prototype,"selectionState",2),s([l({type:Boolean,reflect:!0})],K.prototype,"selectable",2),K=s([h("primer-button")],K);var Gi=c`
|
|
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 ue=class extends m{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
|
+
`}};ue.styles=[Gi],s([l({type:String,reflect:!0})],ue.prototype,"for",2),s([l({type:Boolean,reflect:!0})],ue.prototype,"active",2),ue=s([h("primer-input-error")],ue);var qi={pencil:ce`
|
|
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:ce`
|
|
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":ce`
|
|
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":ce`
|
|
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":ce`
|
|
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":ce`
|
|
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:ce`
|
|
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:ce`
|
|
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 Wi=c`
|
|
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 oe=class extends m{constructor(){super(...arguments);this.color="var(--primer-color-icon-primary)";this.size="lg"}render(){let e=this.name?qi[this.name]:null;return d`
|
|
658
657
|
<div style="--internal-icon-color: ${this.color}">
|
|
659
|
-
${
|
|
658
|
+
${e||d`<slot></slot>`}
|
|
660
659
|
</div>
|
|
661
|
-
`}};
|
|
660
|
+
`}};oe.styles=[Wi],s([l({type:String,reflect:!0})],oe.prototype,"color",2),s([l({type:String,reflect:!0})],oe.prototype,"size",2),s([l({reflect:!0})],oe.prototype,"name",2),oe=s([h("primer-icon")],oe);var Ji=c`
|
|
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 ge=class extends m{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
|
+
`}};ge.styles=[Ji],s([l({type:String,reflect:!0})],ge.prototype,"type",2),s([l({type:String,reflect:!0})],ge.prototype,"description",2),ge=s([h("primer-checkout-state")],ge);var Zi=c`
|
|
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 Ia=["text","password","email","number","tel","url","search","date","time","datetime-local","month","week","color"];function Na(i){return Ia.includes(i)}var k=class extends m{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(e){e.stopPropagation();let r=e.target;this.value=r.value;let o=new CustomEvent("input",{detail:this.value,bubbles:!0,composed:!0});this.dispatchEvent(o)}handleChange(e){e.stopPropagation();let r=e.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(e){e.stopPropagation(),this.hasError=!0,this.dispatchEvent(new Event("invalid",{bubbles:!0,composed:!0}))}focus(e){this.inputElement?.focus(e)}blur(){this.inputElement?.blur()}select(){this.inputElement?.select()}setSelectionRange(e,r,o){this.inputElement?.setSelectionRange(e,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 e={input:!0,"input--focused":this.hasFocus,"input--disabled":this.disabled,"input--error":this.hasError,"input--readonly":this.readonly},r=Object.entries(e).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(
|
|
766
|
+
`}addEventListener(e,r,o){super.addEventListener(e,r,o)}removeEventListener(e,r,o){super.removeEventListener(e,r,o)}};k.styles=[Zi],s([Ie("input")],k.prototype,"inputElement",2),s([l({type:String,reflect:!0})],k.prototype,"value",2),s([l({type:String,reflect:!0})],k.prototype,"placeholder",2),s([l({type:Boolean,reflect:!0})],k.prototype,"disabled",2),s([l({type:String,reflect:!0})],k.prototype,"name",2),s([l({type:String,reflect:!0,converter:{fromAttribute:e=>!e||!Na(e)?(e&&e!=="text"&&b.warn(`Invalid input type: ${e}. Defaulting to 'text'.`),"text"):e}})],k.prototype,"type",2),s([l({type:Boolean,reflect:!0})],k.prototype,"required",2),s([l({type:Boolean,reflect:!0})],k.prototype,"readonly",2),s([l({type:String,reflect:!0})],k.prototype,"pattern",2),s([l({type:Number,reflect:!0})],k.prototype,"minlength",2),s([l({type:Number,reflect:!0})],k.prototype,"maxlength",2),s([l({type:String,reflect:!0})],k.prototype,"min",2),s([l({type:String,reflect:!0})],k.prototype,"max",2),s([l({type:String,reflect:!0})],k.prototype,"step",2),s([l({type:String,reflect:!0})],k.prototype,"autocomplete",2),s([l({type:String,reflect:!0})],k.prototype,"id",2),s([x()],k.prototype,"hasFocus",2),s([x()],k.prototype,"hasError",2),k=s([h("primer-input")],k);var Xi=c`
|
|
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 F=class extends m{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(e){this.dispatchEvent(new CustomEvent("expanded-changed",{bubbles:!0,composed:!0,detail:{expanded:e}}))}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 e=this.isExpanded?this.collapseText:this.expandText,r=this.ariaLabel||this.header||e,o=this.header||e;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
|
+
`}};F.styles=[Xi],s([l({type:String})],F.prototype,"header",2),s([l({type:Boolean})],F.prototype,"expanded",2),s([l({type:String})],F.prototype,"expandText",2),s([l({type:String})],F.prototype,"collapseText",2),s([l({type:String})],F.prototype,"ariaLabel",2),s([l({type:String})],F.prototype,"buttonVariant",2),s([x()],F.prototype,"isExpanded",2),F=s([h("primer-collapsable")],F);var Qi=c`
|
|
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 X=class extends m{constructor(){super(...arguments);this.message="";this.visible=!1;this.role="alert";this.showMessage=!1}updated(e){e.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 p;let e={"error-message":!0,hidden:!this.visible};return d`
|
|
906
905
|
<div
|
|
907
906
|
part="error-message"
|
|
908
|
-
class=${
|
|
907
|
+
class=${R(e)}
|
|
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
|
+
`}};X.styles=[Qi],s([l({type:String})],X.prototype,"message",2),s([l({type:Boolean,reflect:!0})],X.prototype,"visible",2),s([l({type:String,reflect:!0})],X.prototype,"role",2),s([x()],X.prototype,"showMessage",2),X=s([h("primer-error-message")],X);var eo=c`
|
|
922
921
|
:host {
|
|
923
922
|
display: none;
|
|
924
923
|
}
|
|
925
|
-
`;var
|
|
924
|
+
`;var $e=class extends m{constructor(){super(...arguments);this.id="d"+Math.random().toString(36).substring(7)}getContainer(){let e=document.querySelector(`#${this.id}`);return e||(e=document.createElement("div"),e.id=this.id,document.body.appendChild(e),this._setupEventListeners(e)),e}_setupEventListeners(e){["primer-ach-error","primer-ach-bank-details-collected","primer-ach-mandate-confirmed","primer-ach-mandate-declined"].forEach(r=>{e.addEventListener(r,o=>{o.stopPropagation(),this.dispatchEvent(new CustomEvent(r,{bubbles:!0,composed:!0,detail:o.detail}))})})}disconnectedCallback(){super.disconnectedCallback(),this.getContainer().remove()}_handleSlotChange(e){let o=e.target.assignedNodes();if(!o.length)return;let a=this.getContainer();o.forEach(n=>a.appendChild(n))}render(){return d`<slot @slotchange=${this._handleSlotChange}></slot>`}};$e.styles=[eo],s([x()],$e.prototype,"id",2),$e=s([h("primer-portal")],$e);var to=c`
|
|
926
925
|
:host {
|
|
927
926
|
display: contents;
|
|
928
927
|
}
|
|
@@ -951,10 +950,10 @@ 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 We=class extends m{_handleCloseClick(){this.dispatchEvent(new CustomEvent("primer-dialog-close",{bubbles:!0,composed:!0}))}render(){return d`
|
|
955
954
|
<div
|
|
956
|
-
class=${
|
|
957
|
-
@click=${
|
|
955
|
+
class=${R({backdrop:!0})}
|
|
956
|
+
@click=${t=>{t.preventDefault()}}
|
|
958
957
|
>
|
|
959
958
|
<div class="dialog">
|
|
960
959
|
<div class="header">
|
|
@@ -967,7 +966,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
|
|
|
967
966
|
</div>
|
|
968
967
|
</div>
|
|
969
968
|
</div>
|
|
970
|
-
`}};
|
|
969
|
+
`}};We.styles=[to],We=s([h("primer-dialog")],We);var ro=c`
|
|
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 D=class extends m{constructor(){super(...arguments);this.paymentManagers=new Map;this.sdkState=null;this.headlessUtils=null;this.klarnaCategories=null;this.selectedCategory=null;this.isExpanded=!1;this.headerAriaLabel=y("pay_with",{id:"pay_with"});this._paymentMethodManagerTask=new M(this,{task:async([e,r])=>{if(!e||!r)return E;let o=await r.getCDNAssets("KLARNA");return{manager:e.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(e){b.error("Failed to start Klarna payment",e)}}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:e=>{e>0&&(this.klarnaContainer.style.height=`${e}px`)}})}catch(e){b.error("Failed to render Klarna category",e)}}selectCategory(e){this.selectedCategory=e,this.renderSelectedCategory()}updated(e){e.has("selectedCategory")&&this.selectedCategory&&this.renderSelectedCategory()}renderCategorySelection(){let e=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
|
-
${
|
|
1165
|
+
${e.map(o=>d`
|
|
1167
1166
|
<button
|
|
1168
|
-
class=${
|
|
1167
|
+
class=${R({"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
|
+
`:p}
|
|
1183
1182
|
|
|
1184
1183
|
<button
|
|
1185
|
-
class=${
|
|
1184
|
+
class=${R({"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
|
+
${y("confirm",{id:"confirm"})}
|
|
1190
1189
|
</button>
|
|
1191
|
-
`}render(){return this._paymentMethodManagerTask.render({error:
|
|
1190
|
+
`}render(){return this._paymentMethodManagerTask.render({error:e=>{let r=e instanceof Error?e.message:"Unknown error in Klarna";return d`<div class="error">
|
|
1192
1191
|
Error loading Klarna: ${r}
|
|
1193
|
-
</div>`},complete:({manager:
|
|
1192
|
+
</div>`},complete:({manager:e,klarnaIcon:r})=>e?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>${y("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
|
+
`:p})}};D.styles=[v,ro],s([f({context:Y,subscribe:!0}),l()],D.prototype,"paymentManagers",2),s([f({context:T,subscribe:!0}),l()],D.prototype,"sdkState",2),s([f({context:$,subscribe:!0}),l({type:Object})],D.prototype,"headlessUtils",2),s([f({context:kt,subscribe:!0}),l()],D.prototype,"klarnaCategories",2),s([x()],D.prototype,"selectedCategory",2),s([x()],D.prototype,"isExpanded",2),s([x()],D.prototype,"headerAriaLabel",2),s([Ie("#klarna-category-container")],D.prototype,"klarnaContainer",2),D=s([h("primer-klarna"),S()],D);var io=c`
|
|
1224
1223
|
:host {
|
|
1225
1224
|
display: contents;
|
|
1226
1225
|
}
|
|
1227
|
-
`;var
|
|
1228
|
-
.paymentMethod=${
|
|
1229
|
-
></primer-native-payment>`;case"REDIRECT":return
|
|
1230
|
-
.paymentMethod=${
|
|
1231
|
-
></primer-redirect-payment>`;case"KLARNA":return
|
|
1226
|
+
`;var fe=class extends m{constructor(){super(...arguments);this.type=void 0;this.paymentMethods=null}render(){if(!this.type)return p;let e=this.paymentMethods?.get(this.type);if(!e)return p;switch(e?.managerType){case"CARD":return d`<primer-card-form></primer-card-form>`;case"NATIVE":return d`<primer-native-payment
|
|
1227
|
+
.paymentMethod=${e}
|
|
1228
|
+
></primer-native-payment>`;case"REDIRECT":return d`<primer-redirect-payment
|
|
1229
|
+
.paymentMethod=${e}
|
|
1230
|
+
></primer-redirect-payment>`;case"KLARNA":return d`<primer-klarna></primer-klarna>`;case"ACH":return d`
|
|
1232
1231
|
<primer-dynamic-payment
|
|
1233
|
-
.paymentMethod=${
|
|
1232
|
+
.paymentMethod=${e}
|
|
1234
1233
|
></primer-dynamic-payment>
|
|
1235
|
-
`;default:return
|
|
1234
|
+
`;default:return p}}};fe.styles=[io],s([l({type:String})],fe.prototype,"type",2),s([f({context:et,subscribe:!0}),l()],fe.prototype,"paymentMethods",2),fe=s([h("primer-payment-method")],fe);var oo=c`
|
|
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 ao(){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 ar=class{constructor(t,e){this.formState=ao();this.host=t,this.validate=e,t.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(t,e){let r=this.formState[t];r.value=e,r.dirty=!0,r.error="",r.valid=!0;let o=await this.validate(this.formData);this.setValidation(o)}setValidation(t,e=!1){e&&(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),t.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:t}})),this.host.requestUpdate()}setFieldTouched(t){this.formState[t].touched||(this.formState[t].touched=!0,this.host.requestUpdate())}resetForm(){this.formState=ao(),this.host.requestUpdate()}isValidFieldName(t){return!!t&&["firstName","lastName","emailAddress"].includes(t)}hostConnected(){}hostDisconnected(){}};var j=class extends m{constructor(){super(...arguments);this.formController=new ar(this,e=>this._paymentMethodManagerTask.value.setAndValidate(e));this.paymentManagers=new Map;this.sdkState=void 0;this.clientOptions=void 0;this.screen="form";this.isSubmitting=!1;this._paymentMethodManagerTask=new M(this,{task:async([e])=>e!=="STRIPE_ACH"?E:this.paymentManagers.get(e)?.manager,args:()=>[this.paymentMethod?.type]})}_handleInput(e,r){let o=e.target;this.formController.setFieldValue(r,o.value)}_handleBlur(e){this.formController.setFieldTouched(e)}_handleError(e){this.dispatchEvent(new CustomEvent("primer-ach-error",{bubbles:!0,composed:!0,detail:{error:e instanceof Error?e:new Error(typeof e=="string"?e:"Unknown error occurred")}}))}async _handleSubmitButtonClick(e){if(!this.isSubmitting){this.isSubmitting=!0;try{let r=await e.start(this.formController.formData);if(!r||r.valid)return await this._handleCollectBankAccountDetails(e);r&&this.formController.setValidation(r,!0)}catch(r){this._handleError(r)}finally{this.isSubmitting=!1}}}async _handleCollectBankAccountDetails(e){try{await e.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(e){this._handleError(e)}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(e){this._handleError(e)}finally{this.isSubmitting=!1}}}renderForm(e){return d`
|
|
1321
1320
|
<h2>
|
|
1322
|
-
${
|
|
1321
|
+
${y("payWithAch",{id:"payWithAch"})}
|
|
1323
1322
|
</h2>
|
|
1324
1323
|
<p>
|
|
1325
|
-
${
|
|
1324
|
+
${y("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
|
+
${y("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:p}
|
|
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
|
+
${y("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:p}
|
|
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
|
+
${y("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,29 +1377,29 @@ 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:p}
|
|
1382
1381
|
</primer-input-error>
|
|
1383
1382
|
</primer-input-wrapper>
|
|
1384
1383
|
<p>
|
|
1385
|
-
${
|
|
1384
|
+
${y("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"
|
|
1389
1388
|
variant="primary"
|
|
1390
|
-
@click=${()=>this._handleSubmitButtonClick(
|
|
1389
|
+
@click=${()=>this._handleSubmitButtonClick(e)}
|
|
1391
1390
|
?disabled=${this.isSubmitting}
|
|
1392
1391
|
?loading=${this.isSubmitting}
|
|
1393
1392
|
>
|
|
1394
|
-
${
|
|
1393
|
+
${y("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
|
+
${y("payWithAch",{id:"payWithAch"})}
|
|
1400
1399
|
</h2>
|
|
1401
1400
|
|
|
1402
1401
|
<p>
|
|
1403
|
-
${this.clientOptions?.stripe?.mandateData.fullMandateText??
|
|
1402
|
+
${this.clientOptions?.stripe?.mandateData.fullMandateText??y("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
|
+
${y("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
|
+
${y("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:
|
|
1423
|
+
`}render(){return this._paymentMethodManagerTask.render({complete:e=>e?this.screen==="form"?this.renderForm(e):this.renderMandate():p})}};j.styles=[v,oo],s([l({type:Object})],j.prototype,"paymentMethod",2),s([f({context:Y,subscribe:!0}),l({attribute:!1})],j.prototype,"paymentManagers",2),s([f({context:T,subscribe:!0}),l({attribute:!1})],j.prototype,"sdkState",2),s([f({context:_e,subscribe:!0}),l({attribute:!1})],j.prototype,"clientOptions",2),s([x()],j.prototype,"screen",2),s([x()],j.prototype,"isSubmitting",2),j=s([h("primer-ach-payment"),S()],j);var so=c`
|
|
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 Et(i){return i.toLowerCase().replace(/[^a-zA-Z0-9]+(.)/g,(t,e)=>e.toUpperCase())}var J=class extends m{constructor(){super(...arguments);this.paymentManagers=new Map;this.sdkState=null;this.headlessUtils=null;this.open=!1;this._paymentMethodManagerTask=new M(this,{task:async([e,r])=>!e||!r?E:r.get(e)?.manager,args:()=>[this.paymentMethod?.type,this.paymentManagers]});this._getAssetsTask=new M(this,{task:async([e,r])=>{if(!e||!r)return E;let o=r.getPaymentMethodConfiguration(e);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}:E},args:()=>[this.paymentMethod?.type,this.headlessUtils]});this._setupTasks=new M(this,{task:async([e,r])=>!e||!r?E:{paymentMethodManager:e,assetsConfig:r},args:()=>[this._paymentMethodManagerTask.value,this._getAssetsTask.value]})}_legacyGetButtonLabel(e){if(!e)return;let r=e?Et(e):"";return r==="payWith"&&(r="pay_with"),y(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,19 +1467,19 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
|
|
|
1468
1467
|
></primer-ach-payment>
|
|
1469
1468
|
</primer-dialog>
|
|
1470
1469
|
</primer-portal>
|
|
1471
|
-
`:
|
|
1470
|
+
`:p}render(){return this._setupTasks.render({error:()=>p,complete:({assetsConfig:e})=>(this.style.setProperty("--dynamic-payment-button-bg-color",e.backgroundColor),d`
|
|
1472
1471
|
<primer-button
|
|
1473
1472
|
@click="${()=>this.start()}"
|
|
1474
|
-
class=${
|
|
1475
|
-
title="${
|
|
1473
|
+
class=${R({loading:!!this.sdkState?.isProcessing,reverse:!0})}
|
|
1474
|
+
title="${y("pay_with",{id:"pay_with"})} ${e.name}"
|
|
1476
1475
|
>
|
|
1477
1476
|
<span class="image-container">
|
|
1478
|
-
<img src="${
|
|
1477
|
+
<img src="${e.iconUrl}" alt="${e.name}" />
|
|
1479
1478
|
</span>
|
|
1480
|
-
${
|
|
1479
|
+
${e.displayName}
|
|
1481
1480
|
</primer-button>
|
|
1482
1481
|
${this.renderDialog()}
|
|
1483
|
-
`)})}};
|
|
1482
|
+
`)})}};J.styles=[v,so],s([l({type:Object})],J.prototype,"paymentMethod",2),s([f({context:Y,subscribe:!0})],J.prototype,"paymentManagers",2),s([f({context:T,subscribe:!0})],J.prototype,"sdkState",2),s([f({context:$,subscribe:!0})],J.prototype,"headlessUtils",2),s([x()],J.prototype,"open",2),J=s([h("primer-dynamic-payment"),S()],J);var no=c`
|
|
1484
1483
|
:host {
|
|
1485
1484
|
height: calc(
|
|
1486
1485
|
var(--primer-typography-title-large-line-height) +
|
|
@@ -1555,415 +1554,24 @@ 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 Q=class extends m{constructor(){super(...arguments);this.paymentManagers=new Map;this.sdkState=null;this.headlessUtils=null;this._paymentMethodManagerTask=new M(this,{task:async([e,r])=>!e||!r?E:r.get(e)?.manager,args:()=>[this.paymentMethod?.type,this.paymentManagers]});this._getAssetsTask=new M(this,{task:async([e,r])=>{if(!e||!r)return E;let o=r.getPaymentMethodConfiguration(e);if(!o)return E;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 M(this,{task:async([e,r])=>!e||!r?E:{paymentMethodManager:e,assetsConfig:r},args:()=>[this._paymentMethodManagerTask.value,this._getAssetsTask.value]})}_legacyGetButtonLabel(e){if(!e)return;let r=e?Et(e):"";return r==="payWith"&&(r="pay_with"),y(r,{id:r})}startRedirectPayment(){this._paymentMethodManagerTask.value&&this._paymentMethodManagerTask.value.start()}render(){return this._setupTasks.render({error:()=>p,complete:({assetsConfig:e})=>{this.style.setProperty("--redirect-payment-button-bg-color",e.backgroundColor);let r={loading:!!this.sdkState?.isProcessing,"icon-end":e.iconPosition==="END","image-only":!e.displayName},o=e.displayName?d`
|
|
1559
1558
|
<span class="image-container">
|
|
1560
|
-
<img src="${
|
|
1559
|
+
<img src="${e.iconUrl}" alt="${e.name}" />
|
|
1561
1560
|
</span>
|
|
1562
|
-
<span class="button-text">${
|
|
1563
|
-
`:
|
|
1561
|
+
<span class="button-text">${e.displayName}</span>
|
|
1562
|
+
`:d`
|
|
1564
1563
|
<span class="image-container">
|
|
1565
|
-
<img src="${
|
|
1564
|
+
<img src="${e.iconUrl}" alt="${e.name}" />
|
|
1566
1565
|
</span>
|
|
1567
|
-
`;return
|
|
1566
|
+
`;return d`
|
|
1568
1567
|
<primer-button
|
|
1569
1568
|
@click="${()=>this.startRedirectPayment()}"
|
|
1570
|
-
class=${
|
|
1571
|
-
title="${
|
|
1569
|
+
class=${R(r)}
|
|
1570
|
+
title="${y("pay_with",{id:"pay_with"})} ${e.name}"
|
|
1572
1571
|
>
|
|
1573
1572
|
${o}
|
|
1574
1573
|
</primer-button>
|
|
1575
|
-
`}})}};
|
|
1576
|
-
:host {
|
|
1577
|
-
display: contents;
|
|
1578
|
-
}
|
|
1579
|
-
|
|
1580
|
-
.primer-main-list {
|
|
1581
|
-
display: flex;
|
|
1582
|
-
flex-direction: column;
|
|
1583
|
-
gap: var(--primer-space-small);
|
|
1584
|
-
}
|
|
1585
|
-
|
|
1586
|
-
.primer-is-processing {
|
|
1587
|
-
opacity: 0.5;
|
|
1588
|
-
pointer-events: none;
|
|
1589
|
-
}
|
|
1590
|
-
|
|
1591
|
-
primer-vault-manager {
|
|
1592
|
-
margin-bottom: var(--primer-space-xlarge);
|
|
1593
|
-
}
|
|
1594
|
-
`;var Fe=class extends v{constructor(){super(...arguments);this.hasAssignedContent=!1;this.onSlotChange=t=>{let o=t.target.assignedNodes({flatten:!0});this.hasAssignedContent=o.length>0,this.requestUpdate()};this.paymentMethods=null;this.sdkState=null}render(){return this.sdkState?.isSuccessful?c`
|
|
1595
|
-
<slot name="checkout-complete">
|
|
1596
|
-
<primer-checkout-complete></primer-checkout-complete>
|
|
1597
|
-
</slot>
|
|
1598
|
-
`:c`
|
|
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;
|
|
1624
|
-
}
|
|
1625
|
-
|
|
1626
|
-
.native-button-container {
|
|
1627
|
-
width: 100%;
|
|
1628
|
-
height: 100%;
|
|
1629
|
-
flex: 1;
|
|
1630
|
-
}
|
|
1631
|
-
`;var ke=class extends v{constructor(){super();this.paymentManagers=new Map;this.computedStyles=null;this._buttonId="button-container";this.loadManagerTask=new D(this,{args:()=>[this.paymentMethod?.type],task:async([t])=>{if(!t)return L;let r=this.paymentManagers.get(t)?.manager;if(!r)throw new Error(`No manager found for payment method type ${t}`);return r}}),new D(this,{args:()=>[this.loadManagerTask.value],task:async([t])=>{if(!t)return L;await this.updateComplete;let r=this.shadowRoot?.getElementById(this._buttonId);if(!r)return;let o=this.calculateButtonHeight(),n=t.createButton(),l=this.createRenderOptions(o);return await n.render(this.paymentMethod?.type==="GOOGLE_PAY"?this.shadowRoot?.getRootNode():r,l),t}})}calculateButtonHeight(){if(typeof window>"u"||!this.isConnected||!this.computedStyles)return 0;let t=parseFloat(this.computedStyles.getPropertyValue("--primer-typography-title-large-line-height")),r=parseFloat(this.computedStyles.getPropertyValue("--primer-space-medium"));return t+2*r}createRenderOptions(t){let r=this.paymentMethod?.type;return r==="GOOGLE_PAY"?{style:{shadowRoot:!0}}:r==="APPLE_PAY"?{style:{buttonHeight:t}}:r==="PAYPAL"?{style:{buttonHeight:t}}:{style:{buttonHeight:t}}}updated(t){t.has("paymentMethod")&&this.paymentMethod&&(this._buttonId=`button-container-${this.paymentMethod.type}`)}render(){return this.loadManagerTask.render({error:()=>h,complete:()=>c`
|
|
1632
|
-
<!-- The native button container is rendered first -->
|
|
1633
|
-
<div class="native-button-container" id="${this._buttonId}"></div>
|
|
1634
|
-
`,pending:()=>h})}};ke.styles=[w,Ba],s([p({type:Object})],ke.prototype,"paymentMethod",2),s([b({context:J,subscribe:!0}),p()],ke.prototype,"paymentManagers",2),s([b({context:$e,subscribe:!0}),p()],ke.prototype,"computedStyles",2),ke=s([y("primer-native-payment")],ke);var jr="card-form-context";var Ka=f`
|
|
1635
|
-
:host {
|
|
1636
|
-
display: contents;
|
|
1637
|
-
}
|
|
1638
|
-
|
|
1639
|
-
form {
|
|
1640
|
-
display: flex;
|
|
1641
|
-
flex-direction: column;
|
|
1642
|
-
gap: var(--primer-space-medium);
|
|
1643
|
-
width: 100%;
|
|
1644
|
-
}
|
|
1645
|
-
|
|
1646
|
-
.card-form {
|
|
1647
|
-
display: flex;
|
|
1648
|
-
flex-direction: column;
|
|
1649
|
-
gap: var(--primer-space-medium);
|
|
1650
|
-
margin-bottom: var(--primer-space-medium);
|
|
1651
|
-
}
|
|
1652
|
-
|
|
1653
|
-
.card-form-row {
|
|
1654
|
-
display: flex;
|
|
1655
|
-
gap: var(--primer-space-small);
|
|
1656
|
-
}
|
|
1657
|
-
`;var Ee=class extends v{constructor(){super(...arguments);this.hideLabels=!1;this.hasAssignedContent=!1;this.selectedCardNetwork=null;this.paymentManagers=new Map;this.cardFormProvider=new q(this,{context:jr,initialValue:null});this.eventsController=new gt(this);this.setupCardFormTask=new D(this,{task:async([t])=>{if(!t?.manager)return L;let{manager:r}=t,{cardNumberInput:o,expiryInput:n,cvvInput:l}=r.createHostedInputs();return this.cardFormProvider.setValue({cardNumberInput:o,expiryInput:n,cvvInput:l,setCardholderName:g=>r.setCardholderName(g),setCardNetwork:g=>{this.selectedCardNetwork=g},validate:()=>r.validate(),submit:g=>r.submit(g),hideLabels:this.hideLabels}),!0},args:()=>[this.paymentManagers.get("PAYMENT_CARD")]});this.handleSlotButtonClick=t=>{let o=t.target.closest("button, primer-button");if(!o)return;this.isSubmitButton(o)&&(t.preventDefault(),this.submitCardPayment())};this.handleDirectSubmit=t=>{t.stopPropagation(),this.submitCardPayment()};this.onSlotChange=t=>{let o=t.target.assignedNodes({flatten:!0});this.hasAssignedContent=o.length>0};this.handleFormSubmit=t=>{t.preventDefault(),t.stopPropagation(),this.submitCardPayment()}}updated(t){super.updated(t),t.has("hideLabels")&&this.cardFormProvider.value&&this.cardFormProvider.setValue({...this.cardFormProvider.value,hideLabels:this.hideLabels})}connectedCallback(){super.connectedCallback(),this.addEventListener("click",this.handleSlotButtonClick),this.addEventListener("primer-form-submit",this.handleDirectSubmit)}disconnectedCallback(){this.removeEventListener("click",this.handleSlotButtonClick),this.removeEventListener("primer-form-submit",this.handleDirectSubmit),super.disconnectedCallback()}isSubmitButton(t){let r=t.tagName.toLowerCase(),o=r==="button",n=r==="primer-button";return o&&(t.getAttribute("type")==="submit"||t.hasAttribute("data-submit"))||n&&(t.getAttribute("type")==="submit"||t.hasAttribute("data-submit"))}async submitCardPayment(){let t=this.cardFormProvider.value;if(!t)return;let r=await t.validate?.();if(r?.valid){let o=await t.submit?.(this.selectedCardNetwork?{cardNetwork:this.selectedCardNetwork}:void 0);this.eventsController.dispatchFormSubmitSuccess(o)}else{let o=r?.validationErrors;this.cardFormProvider.setValue({...t,errors:o}),this.eventsController.dispatchFormSubmitErrors(o)}}render(){return this.setupCardFormTask.status===De.ERROR||this.setupCardFormTask.status===De.INITIAL?h:c`
|
|
1658
|
-
<form @submit=${this.handleFormSubmit}>
|
|
1659
|
-
<slot name="card-form-content" @slotchange=${this.onSlotChange}></slot>
|
|
1660
|
-
${this.setupCardFormTask.render({complete:()=>V(this.hasAssignedContent,()=>h,()=>c`
|
|
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;
|
|
1705
|
-
}
|
|
1706
|
-
|
|
1707
|
-
.card-number-container {
|
|
1708
|
-
display: flex;
|
|
1709
|
-
align-items: center;
|
|
1710
|
-
width: 100%;
|
|
1711
|
-
position: relative;
|
|
1712
|
-
gap: var(--primer-space-small);
|
|
1713
|
-
}
|
|
1714
|
-
|
|
1715
|
-
#cardNumber {
|
|
1716
|
-
flex: 1;
|
|
1717
|
-
display: flex;
|
|
1718
|
-
width: 100%;
|
|
1719
|
-
}
|
|
1720
|
-
|
|
1721
|
-
.network-selector-container {
|
|
1722
|
-
display: flex;
|
|
1723
|
-
align-items: center;
|
|
1724
|
-
z-index: 2;
|
|
1725
|
-
}
|
|
1726
|
-
`;var Be=f`
|
|
1727
|
-
.card-input-slot {
|
|
1728
|
-
display: flex;
|
|
1729
|
-
}
|
|
1730
|
-
`;var xt=class extends X{constructor(){super();this.config={inputType:"cardNumber",containerSelector:"#cardNumber",errorName:"cardNumber-card",translations:{label:{id:"cardNumber",defaultMessage:"Card Number"},placeholder:"4111 1111 1111 1111",ariaLabel:{id:"cardNumber",defaultMessage:"Card Number"}}};this.childUpdated()}handleNetworkSelected(t){let{network:r}=t.detail;this.cardFormContext&&this.cardFormContext.setCardNetwork(r)}renderInput(){if(this.hostedInputController.setupTask.status===De.ERROR)return h;let t=this.getError();return c`
|
|
1731
|
-
<primer-input-wrapper
|
|
1732
|
-
.focusWithin="${this.hostedInputController.isFocused}"
|
|
1733
|
-
.hasError=${!!t}
|
|
1734
|
-
>
|
|
1735
|
-
${V(!this.cardFormContext?.hideLabels,()=>c`<primer-input-label slot="label"
|
|
1736
|
-
>${this.label}</primer-input-label
|
|
1737
|
-
>`,()=>h)}
|
|
1738
|
-
<div
|
|
1739
|
-
slot="input"
|
|
1740
|
-
class="card-number-container"
|
|
1741
|
-
aria-label="${this.ariaLabel}"
|
|
1742
|
-
>
|
|
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;
|
|
1771
|
-
}
|
|
1772
|
-
`;var ce=class extends v{constructor(){super(...arguments);this._userAssignedProps=new Set;this._internalButtonText="";this.headlessInstance=null;this.clientOptions=null;this.sdkState=null;this.variant="primary";this.disabled=!1;this.handleClick=t=>{if(t.preventDefault(),this.disabled)return;let r=new CustomEvent("primer-form-submit",{bubbles:!0,composed:!0,detail:{source:"primer-card-form-submit"}});this.dispatchEvent(r)}}get buttonText(){return this._userAssignedProps.has("buttonText")?this._internalButtonText:A("pay",{id:"pay"})}set buttonText(t){let r=this.buttonText;t!==""?(this._userAssignedProps.add("buttonText"),this._internalButtonText=t):(this._userAssignedProps.delete("buttonText"),this._internalButtonText=""),this.requestUpdate("buttonText",r)}render(){let t=this.clientOptions?.submitButton?.amountVisible?this.headlessInstance?.getUIOrderAmount():null,r=t?` ${t}`:h;return c`
|
|
1773
|
-
<primer-button
|
|
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 {
|
|
1785
|
-
display: flex;
|
|
1786
|
-
align-items: center;
|
|
1787
|
-
position: relative;
|
|
1788
|
-
}
|
|
1789
|
-
|
|
1790
|
-
.network-selector {
|
|
1791
|
-
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
|
-
gap: var(--primer-space-xsmall);
|
|
1801
|
-
}
|
|
1802
|
-
|
|
1803
|
-
.network-selector:hover {
|
|
1804
|
-
opacity: 0.8;
|
|
1805
|
-
}
|
|
1806
|
-
|
|
1807
|
-
.network-selector:focus-visible {
|
|
1808
|
-
outline: 2px solid var(--primer-color-focus);
|
|
1809
|
-
border-radius: var(--primer-radius-xsmall);
|
|
1810
|
-
}
|
|
1811
|
-
|
|
1812
|
-
.network-icon {
|
|
1813
|
-
width: var(--primer-size-large);
|
|
1814
|
-
height: var(
|
|
1815
|
-
--primer-size-medium
|
|
1816
|
-
); /* Added explicit height to maintain aspect ratio */
|
|
1817
|
-
object-fit: contain;
|
|
1818
|
-
}
|
|
1819
|
-
|
|
1820
|
-
.caret {
|
|
1821
|
-
margin-left: var(--primer-space-xsmall);
|
|
1822
|
-
transition: transform var(--primer-animation-duration)
|
|
1823
|
-
var(--primer-animation-easing);
|
|
1824
|
-
color: var(--primer-color-icon-primary);
|
|
1825
|
-
}
|
|
1826
|
-
|
|
1827
|
-
.caret.open {
|
|
1828
|
-
transform: rotate(180deg);
|
|
1829
|
-
}
|
|
1830
|
-
|
|
1831
|
-
.dropdown {
|
|
1832
|
-
position: absolute;
|
|
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);
|
|
1844
|
-
}
|
|
1845
|
-
|
|
1846
|
-
.dropdown:not(.open) {
|
|
1847
|
-
display: none;
|
|
1848
|
-
}
|
|
1849
|
-
|
|
1850
|
-
.dropdown.open {
|
|
1851
|
-
display: block;
|
|
1852
|
-
max-height: calc(var(--primer-size-xxxlarge) * 4);
|
|
1853
|
-
overflow-y: auto;
|
|
1854
|
-
}
|
|
1855
|
-
|
|
1856
|
-
.network-option {
|
|
1857
|
-
display: flex;
|
|
1858
|
-
align-items: center;
|
|
1859
|
-
padding: var(--primer-space-small) var(--primer-space-medium);
|
|
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;
|
|
1866
|
-
}
|
|
1867
|
-
|
|
1868
|
-
/* Only apply hover effect when not in keyboard navigation mode */
|
|
1869
|
-
.network-option:hover {
|
|
1870
|
-
background-color: var(--primer-color-gray-100);
|
|
1871
|
-
}
|
|
1872
|
-
|
|
1873
|
-
/* Apply focused style only when the focused class is present (keyboard navigation) */
|
|
1874
|
-
.network-option.focused {
|
|
1875
|
-
background-color: var(--primer-color-gray-100);
|
|
1876
|
-
}
|
|
1877
|
-
|
|
1878
|
-
.network-option:focus-visible {
|
|
1879
|
-
outline: 2px solid var(--primer-color-focus);
|
|
1880
|
-
outline-offset: -2px;
|
|
1881
|
-
}
|
|
1882
|
-
|
|
1883
|
-
.network-option-icon {
|
|
1884
|
-
width: var(--primer-size-medium);
|
|
1885
|
-
height: var(--primer-size-small);
|
|
1886
|
-
margin-right: var(--primer-space-small);
|
|
1887
|
-
object-fit: contain;
|
|
1888
|
-
}
|
|
1889
|
-
|
|
1890
|
-
.network-name {
|
|
1891
|
-
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
|
-
}
|
|
1899
|
-
|
|
1900
|
-
.checkmark {
|
|
1901
|
-
margin-left: var(--primer-space-small);
|
|
1902
|
-
color: var(--primer-color-brand);
|
|
1903
|
-
width: var(--primer-size-small);
|
|
1904
|
-
height: var(--primer-size-small);
|
|
1905
|
-
}
|
|
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
|
-
size="sm"
|
|
1926
|
-
name="chevron-down"
|
|
1927
|
-
></primer-icon>
|
|
1928
|
-
`,()=>h)}
|
|
1929
|
-
</button>
|
|
1930
|
-
|
|
1931
|
-
${V(this.isDropdownOpen,()=>c`
|
|
1932
|
-
<div
|
|
1933
|
-
${Xr(this.dropdownRef)}
|
|
1934
|
-
id="network-dropdown"
|
|
1935
|
-
class="dropdown open"
|
|
1936
|
-
role="listbox"
|
|
1937
|
-
aria-label="Select card network"
|
|
1938
|
-
>
|
|
1939
|
-
${t.map((n,l)=>c`
|
|
1940
|
-
<div
|
|
1941
|
-
${Xr(g=>this.setNetworkOptionRef(g,l))}
|
|
1942
|
-
class="network-option ${this.isKeyboardNavigation&&l===this.focusedNetworkIndex?"focused":""}"
|
|
1943
|
-
@click=${g=>this.selectNetwork(g,n)}
|
|
1944
|
-
@keydown=${g=>{(g.key==="Enter"||g.key===" ")&&this.selectNetwork(g,n)}}
|
|
1945
|
-
role="option"
|
|
1946
|
-
aria-selected=${n.network===r.network}
|
|
1947
|
-
tabindex="${l===this.focusedNetworkIndex?"0":"-1"}"
|
|
1948
|
-
>
|
|
1949
|
-
<img
|
|
1950
|
-
class="network-option-icon"
|
|
1951
|
-
src=${this.getNetworkIconUrl(n)}
|
|
1952
|
-
alt=${n.displayName}
|
|
1953
|
-
/>
|
|
1954
|
-
<span class="network-name">${n.displayName}</span>
|
|
1955
|
-
${V(n.network===r.network,()=>c`
|
|
1956
|
-
<primer-icon
|
|
1957
|
-
class="checkmark"
|
|
1958
|
-
name="checkmark"
|
|
1959
|
-
size="sm"
|
|
1960
|
-
></primer-icon>
|
|
1961
|
-
`,()=>h)}
|
|
1962
|
-
</div>
|
|
1963
|
-
`)}
|
|
1964
|
-
</div>
|
|
1965
|
-
`,()=>h)}
|
|
1966
|
-
`}};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`
|
|
1574
|
+
`}})}};Q.styles=[v,no],s([l({type:Object})],Q.prototype,"paymentMethod",2),s([f({context:Y,subscribe:!0})],Q.prototype,"paymentManagers",2),s([f({context:T,subscribe:!0})],Q.prototype,"sdkState",2),s([f({context:$,subscribe:!0})],Q.prototype,"headlessUtils",2),Q=s([h("primer-redirect-payment"),S()],Q);var Je={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 Ur(i){return i.charAt(0).toUpperCase()+i.slice(1).toLowerCase()}function $a(i){return i?i===i.toUpperCase()?Ur(i):i:""}function lo(i,t){return[i,t].filter(Boolean).join(" ")}function Oa(i,t){return!i||!t?"":`Expires ${i}/${t.slice(-2)}`}function po(i){return i?`\u2022\u2022\u2022\u2022 ${i}`:""}function Ra(i){let t=i.paymentInstrumentData,e=$a(t.network),r=t.last4Digits,o=`${i.paymentInstrumentData.cardholderName?i.paymentInstrumentData.cardholderName:""}${(r?` ${e} ${po(r)}`:e)||" Card"}`,a=Oa(t.expirationMonth,t.expirationYear);return{description:o,secondaryDescription:a}}function Da(i){let t=i.paymentInstrumentData,e=t.externalPayerInfo?.email||"",r=t.externalPayerInfo?.firstName||"",o=t.externalPayerInfo?.lastName||"",a=i.userDescription||e||"PayPal Account",n=lo(r,o);return{description:a,secondaryDescription:n}}function Va(i){let t=i.paymentInstrumentData,e=t.sessionData?.billingAddress?.email||"",r=t.sessionData?.billingAddress?.firstName||"",o=t.sessionData?.billingAddress?.lastName||"",a=i.userDescription||(e?`Klarna - ${e}`:"Klarna Account"),n=lo(r,o);return{description:a,secondaryDescription:n}}function Ha(i){let t=i.paymentInstrumentData,e=t.accountNumberLastFourDigits||"",r=t.bankName||"",o=t.accountType||"",a=i.userDescription;a||(r&&e?a=`${r} ${po(e)}`:r?a=r:a="Bank Account");let n=o?`${Ur(o)} Account`:"";return{description:a,secondaryDescription:n}}function za(i){let t=i.paymentInstrumentType,e=Ur(t.replace(/_/g," "));return{description:i.userDescription||e}}var Ya={[Je.CARD]:Ra,[Je.PAYPAL_VAULTED]:Da,[Je.KLARNA_CUSTOMER_TOKEN]:Va,[Je.AUTOMATED_CLEARING_HOUSE]:Ha};function sr(i){try{let t=Ya[i.paymentInstrumentType];return t?t(i):za(i)}catch(t){return b.error("FormatUtils",`Error formatting payment method ${i.id}:`,t),{description:i.userDescription||i.id||"Payment Method"}}}var co=c`
|
|
1967
1575
|
:host {
|
|
1968
1576
|
display: block;
|
|
1969
1577
|
width: 100%;
|
|
@@ -2080,83 +1688,81 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
|
|
|
2080
1688
|
transition: none;
|
|
2081
1689
|
}
|
|
2082
1690
|
}
|
|
2083
|
-
`;var ir=globalThis,Qr=ir.trustedTypes,nn=Qr?Qr.createPolicy("lit-html",{createHTML:i=>i}):void 0,Qi="$lit$",Ie=`lit$${Math.random().toFixed(9).slice(2)}$`,eo="?"+Ie,Cl=`<${eo}>`,st=document,ei=()=>st.createComment(""),or=i=>i===null||typeof i!="object"&&typeof i!="function",to=Array.isArray,mn=i=>to(i)||typeof i?.[Symbol.iterator]=="function",Ji=`[
|
|
2084
|
-
\f\r]`,rr=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,sn=/-->/g,ln=/>/g,at=RegExp(`>|${Ji}(?:([^\\s"'>=/]+)(${Ji}*=${Ji}*(?:[^
|
|
2085
|
-
\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`
|
|
1691
|
+
`;var{I:ju}=Ii;var mo=i=>i.strings===void 0;var St=(i,t)=>{let e=i._$AN;if(e===void 0)return!1;for(let r of e)r._$AO?.(t,!1),St(r,t);return!0},nr=i=>{let t,e;do{if((t=i._$AM)===void 0)break;e=t._$AN,e.delete(i),i=t}while(e?.size===0)},ho=i=>{for(let t;t=i._$AM;i=t){let e=t._$AN;if(e===void 0)t._$AN=e=new Set;else if(e.has(i))break;e.add(i),Ba(t)}};function Ua(i){this._$AN!==void 0?(nr(this),this._$AM=i,ho(this)):this._$AM=i}function Fa(i,t=!1,e=0){let r=this._$AH,o=this._$AN;if(o!==void 0&&o.size!==0)if(t)if(Array.isArray(r))for(let a=e;a<r.length;a++)St(r[a],!1),nr(r[a]);else r!=null&&(St(r,!1),nr(r));else St(this,i)}var Ba=i=>{i.type==Ne.CHILD&&(i._$AP??(i._$AP=Fa),i._$AQ??(i._$AQ=Ua))},Oe=class extends rt{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,r){super._$AT(t,e,r),ho(this),this.isConnected=t._$AU}_$AO(t,e=!0){t!==this.isConnected&&(this.isConnected=t,t?this.reconnected?.():this.disconnected?.()),e&&(St(this,t),nr(this))}setValue(t){if(mo(this._$Ct))this._$Ct._$AI(t,this);else{let e=[...this._$Ct._$AH];e[this._$Ci]=t,this._$Ct._$AI(e,this,0)}}disconnected(){}reconnected(){}};var lr=new WeakMap,it=class{constructor(t,e){this.startPaused=!1,this.disabled=!1,this.clients=new Set,this.pendingComplete=!1,this.host=t,this.defaultOptions=e.defaultOptions||{},this.startPaused=!!e.startPaused,this.disabled=!!e.disabled,this.onComplete=e.onComplete,lr.set(this.host,this)}async add(t){this.clients.add(t),this.startPaused&&t.webAnimation?.pause(),this.pendingComplete=!0,await t.finished,this.pendingComplete&&!this.isAnimating&&(this.pendingComplete=!1,this.onComplete?.())}remove(t){this.clients.delete(t)}pause(){this.clients.forEach(t=>t.webAnimation?.pause())}play(){this.clients.forEach(t=>t.webAnimation?.play())}cancel(){this.clients.forEach(t=>t.webAnimation?.cancel()),this.clients.clear()}finish(){this.clients.forEach(t=>t.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(t=>t.webAnimation?.playState==="running")}async finished(){await Promise.all(Array.from(this.clients).map(t=>t.finished))}};var uo=0,Fr=new Map,go=new WeakSet,Br=()=>new Promise(i=>requestAnimationFrame(i));var fo=(i,t)=>{let e=i-t;return e===0?void 0:e},yo=(i,t)=>{let e=i/t;return e===1?void 0:e},dr={left:(i,t)=>{let e=fo(i,t);return{value:e,transform:e==null||isNaN(e)?void 0:`translateX(${e}px)`}},top:(i,t)=>{let e=fo(i,t);return{value:e,transform:e==null||isNaN(e)?void 0:`translateY(${e}px)`}},width:(i,t)=>{let e;t===0&&(t=1,e={width:"1px"});let r=yo(i,t);return{value:r,overrideFrom:e,transform:r==null||isNaN(r)?void 0:`scaleX(${r})`}},height:(i,t)=>{let e;t===0&&(t=1,e={height:"1px"});let r=yo(i,t);return{value:r,overrideFrom:e,transform:r==null||isNaN(r)?void 0:`scaleY(${r})`}}},bo={duration:333,easing:"ease-in-out"},xo=["left","top","width","height","opacity","color","background"],vo=new WeakMap,pr=class extends Oe{constructor(t){if(super(t),this.t=!1,this.i=null,this.o=null,this.h=!0,this.shouldLog=!1,t.type===Ne.CHILD)throw Error("The `animate` directive must be used in attribute position.");this.createFinished()}createFinished(){this.resolveFinished?.(),this.finished=new Promise(t=>{this.l=t})}async resolveFinished(){this.l?.(),this.l=void 0}render(t){return p}getController(){return lr.get(this.u)}isDisabled(){return this.options.disabled||this.getController()?.disabled}update(t,[e]){let r=this.u===void 0;return r&&(this.u=t.options?.host,this.u.addController(this),this.u.updateComplete.then(o=>this.t=!0),this.element=t.element,vo.set(this.element,this)),this.optionsOrCallback=e,(r||typeof e!="function")&&this.p(e),this.render(e)}p(t){t=t??{};let e=this.getController();e!==void 0&&((t={...e.defaultOptions,...t}).keyframeOptions={...e.defaultOptions.keyframeOptions,...t.keyframeOptions}),t.properties??(t.properties=xo),this.options=t}m(){let t={},e=this.element.getBoundingClientRect(),r=getComputedStyle(this.element);return this.options.properties.forEach(o=>{let a=e[o]??(dr[o]?void 0:r[o]),n=Number(a);t[o]=isNaN(n)?a+"":n}),t}v(){let t,e=!0;return this.options.guard&&(t=this.options.guard(),e=((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})(t,this._)),this.h=this.t&&!this.isDisabled()&&!this.isAnimating()&&e&&this.element.isConnected,this.h&&(this._=Array.isArray(t)?Array.from(t):t),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 t;this.prepare(),await Br;let e=this.O(),r=this.j(this.options.keyframeOptions,e),o=this.m();if(this.A!==void 0){let{from:a,to:n}=this.N(this.A,o,e);this.log("measured",[this.A,o,a,n]),t=this.calculateKeyframes(a,n)}else{let a=Fr.get(this.options.inId);if(a){Fr.delete(this.options.inId);let{from:n,to:u}=this.N(a,o,e);t=this.calculateKeyframes(n,u),t=this.options.in?[{...this.options.in[0],...t[0]},...this.options.in.slice(1),t[1]]:t,uo++,t.forEach(g=>g.zIndex=uo)}else this.options.in&&(t=[...this.options.in,{}])}this.animate(t,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&&Fr.set(this.options.id,this.A),this.options.out===void 0))return;if(this.prepare(),await Br(),this.i?.isConnected){let e=this.o&&this.o.parentNode===this.i?this.o:null;if(this.i.insertBefore(this.element,e),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 t=this.j(this.options.keyframeOptions);await this.animate(this.options.out,t),this.element.remove()}prepare(){this.createFinished()}start(){this.options.onStart?.(this)}didFinish(t){t&&this.options.onComplete?.(this),this.A=void 0,this.animatingProperties=void 0,this.frames=void 0,this.resolveFinished()}O(){let t=[];for(let e=this.element.parentNode;e;e=e?.parentNode){let r=vo.get(e);r&&!r.isDisabled()&&r&&t.push(r)}return t}get isHostRendered(){let t=go.has(this.u);return t||this.u.updateComplete.then(()=>{go.add(this.u)}),t}j(t,e=this.O()){let r={...bo};return e.forEach(o=>Object.assign(r,o.options.keyframeOptions)),Object.assign(r,t),r}N(t,e,r){t={...t},e={...e};let o=r.map(u=>u.animatingProperties).filter(u=>u!==void 0),a=1,n=1;return o.length>0&&(o.forEach(u=>{u.width&&(a/=u.width),u.height&&(n/=u.height)}),t.left!==void 0&&e.left!==void 0&&(t.left=a*t.left,e.left=a*e.left),t.top!==void 0&&e.top!==void 0&&(t.top=n*t.top,e.top=n*e.top)),{from:t,to:e}}calculateKeyframes(t,e,r=!1){let o={},a={},n=!1,u={};for(let g in e){let A=t[g],w=e[g];if(g in dr){let P=dr[g];if(A===void 0||w===void 0)continue;let O=P(A,w);O.transform!==void 0&&(u[g]=O.value,n=!0,o.transform=`${o.transform??""} ${O.transform}`,O.overrideFrom!==void 0&&Object.assign(o,O.overrideFrom))}else A!==w&&A!==void 0&&w!==void 0&&(n=!0,o[g]=A,a[g]=w)}return o.transformOrigin=a.transformOrigin=r?"center center":"top left",this.animatingProperties=u,n?[o,a]:void 0}async animate(t,e=this.options.keyframeOptions){this.start(),this.frames=t;let r=!1;if(!this.isAnimating()&&!this.isDisabled()&&(this.options.onFrames&&(this.frames=t=this.options.onFrames(this),this.log("modified frames",t)),t!==void 0)){this.log("animate",[t,e]),r=!0,this.webAnimation=this.element.animate(t,e);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(t,e){this.shouldLog&&!this.isDisabled()&&console.log(t,this.options.id,e)}},Re=me(pr);var Ka=["top","right","bottom","left"],cr=class extends Oe{constructor(t){if(super(t),t.type!==Ne.ELEMENT)throw Error("The `position` directive must be used in attribute position.")}render(t,e){return p}update(t,[e,r]){return this.u===void 0&&(this.u=t.options?.host,this.u.addController(this)),this.S=t.element,this.C=e,this.F=r??["left","top","width","height"],this.render(e,r)}hostUpdated(){this.$()}$(){let t=typeof this.C=="function"?this.C():this.C?.value,e=t.offsetParent;if(t===void 0||!e)return;let r=t.getBoundingClientRect(),o=e.getBoundingClientRect();this.F?.forEach(a=>{let n=Ka.includes(a)?r[a]-o[a]:r[a];this.S.style[a]=n+"px"})}},ja=me(cr);var G=class extends m{constructor(){super();this.vaultManagerContext=null;this.isEditMode=!1;this.deletePaymentMethodId=null;this.isDeleting=!1;this.errorMessage="";this.animationDuration=300;new it(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(e){this.isEditMode=e.detail,this.deletePaymentMethodId=null}handleDeletePaymentMethod(e){this.deletePaymentMethodId=e.detail}handleCancelDelete(){this.deletePaymentMethodId=null}async handleConfirmDelete(){if(!this.vaultManagerContext?.deleteVaultedPaymentMethod||!this.deletePaymentMethodId){this.errorMessage=y("something_went_wrong_error",{id:"something_went_wrong_error"});return}try{this.isDeleting=!0,await this.vaultManagerContext.deleteVaultedPaymentMethod(this.deletePaymentMethodId),this.deletePaymentMethodId=null}catch(e){this.errorMessage=e instanceof Error?e.message:y("something_went_wrong_error",{id:"something_went_wrong_error"})}finally{this.isDeleting=!1}}handlePaymentError(e){let r=e.detail?.error;this.errorMessage=r instanceof Error?r.message:y("payment_processing_error",{id:"payment_processing_error"})}handleCloseError(){this.errorMessage=""}getPaymentMethodName(e){if(!this.vaultManagerContext)return"";let r=this.vaultManagerContext.vaultedPaymentMethods.find(o=>o.id===e);if(!r)return"";try{return sr(r).description||""}catch{return""}}renderLoadingOverlay(){return d`
|
|
2086
1692
|
<div
|
|
2087
1693
|
class="loading-overlay"
|
|
2088
|
-
${
|
|
1694
|
+
${Re({...this.getAnimationConfig(),properties:["opacity"],in:[{opacity:0},{opacity:1}],out:[{opacity:1},{opacity:0}]})}
|
|
2089
1695
|
>
|
|
2090
1696
|
<primer-spinner
|
|
2091
1697
|
size="medium"
|
|
2092
1698
|
color="var(--primer-color-loader)"
|
|
2093
1699
|
></primer-spinner>
|
|
2094
1700
|
</div>
|
|
2095
|
-
`}renderDeleteConfirmation(){if(!this.deletePaymentMethodId)return
|
|
1701
|
+
`}renderDeleteConfirmation(){if(!this.deletePaymentMethodId)return p;let e=this.getPaymentMethodName(this.deletePaymentMethodId);return d`
|
|
2096
1702
|
<div class="delete-confirmation-container">
|
|
2097
1703
|
<primer-vault-delete-confirmation
|
|
2098
1704
|
.isDeleting=${this.isDeleting}
|
|
2099
1705
|
.paymentMethodId=${this.deletePaymentMethodId}
|
|
2100
|
-
.paymentMethodName=${
|
|
1706
|
+
.paymentMethodName=${e}
|
|
2101
1707
|
@confirm-delete=${this.handleConfirmDelete}
|
|
2102
1708
|
@cancel-delete=${this.handleCancelDelete}
|
|
2103
|
-
${
|
|
1709
|
+
${Re({...this.getAnimationConfig(),properties:["opacity"],in:[{opacity:0},{opacity:1}],out:[{opacity:1},{opacity:0}]})}
|
|
2104
1710
|
></primer-vault-delete-confirmation>
|
|
2105
1711
|
</div>
|
|
2106
|
-
`}renderPaymentMethodItem(
|
|
1712
|
+
`}renderPaymentMethodItem(e){return this.deletePaymentMethodId===e.id?p:d`
|
|
2107
1713
|
<primer-vault-payment-method-item
|
|
2108
|
-
.paymentMethod=${
|
|
1714
|
+
.paymentMethod=${e}
|
|
2109
1715
|
.isEditMode=${this.isEditMode}
|
|
2110
1716
|
@delete-payment-method=${this.handleDeletePaymentMethod}
|
|
2111
|
-
${
|
|
1717
|
+
${Re({...this.getAnimationConfig(),properties:["opacity"],in:[{opacity:0},{opacity:1}],out:[{opacity:1},{opacity:0}]})}
|
|
2112
1718
|
></primer-vault-payment-method-item>
|
|
2113
|
-
`}renderPaymentMethodList(){let
|
|
1719
|
+
`}renderPaymentMethodList(){let e=this.vaultManagerContext?.vaultedPaymentMethods||[],r=!this.isEditMode&&e.length>0&&!this.deletePaymentMethodId;return d`
|
|
2114
1720
|
<div class="payment-methods-list">
|
|
2115
|
-
${
|
|
2116
|
-
${
|
|
1721
|
+
${e.map(o=>this.renderPaymentMethodItem(o))}
|
|
1722
|
+
${_(r,()=>d`
|
|
2117
1723
|
<div class="submit-button-container">
|
|
2118
1724
|
<primer-vault-payment-submit
|
|
2119
1725
|
class="submit-button"
|
|
2120
1726
|
@primer-vault-payment-error=${this.handlePaymentError}
|
|
2121
|
-
${
|
|
1727
|
+
${Re({...this.getAnimationConfig(),properties:["opacity"],in:[{opacity:0},{opacity:1}],out:[{opacity:1},{opacity:0}]})}
|
|
2122
1728
|
></primer-vault-payment-submit>
|
|
2123
1729
|
</div>
|
|
2124
|
-
`,()=>
|
|
1730
|
+
`,()=>p)}
|
|
2125
1731
|
</div>
|
|
2126
|
-
`}render(){if(!this.vaultManagerContext?.enabled)return
|
|
1732
|
+
`}render(){if(!this.vaultManagerContext?.enabled)return p;let e=this.vaultManagerContext.vaultedPaymentMethods.length>0,r=this.vaultManagerContext.isLoading,o=this.vaultManagerContext.isUpdating;return d`
|
|
2127
1733
|
<div class="vault-manager ${o?"is-updating":""}">
|
|
2128
1734
|
<primer-vault-manager-header
|
|
2129
1735
|
.isEditMode=${this.isEditMode}
|
|
2130
|
-
.hasPaymentMethods=${
|
|
1736
|
+
.hasPaymentMethods=${e}
|
|
2131
1737
|
@toggle-edit-mode=${this.handleToggleEditMode}
|
|
2132
1738
|
></primer-vault-manager-header>
|
|
2133
1739
|
|
|
2134
|
-
${
|
|
1740
|
+
${_(this.errorMessage,()=>d`
|
|
2135
1741
|
<primer-vault-error-message
|
|
2136
1742
|
.errorMessage=${this.errorMessage}
|
|
2137
1743
|
@close-error=${this.handleCloseError}
|
|
2138
|
-
${
|
|
1744
|
+
${Re({...this.getAnimationConfig(),properties:["opacity"],in:[{opacity:0},{opacity:1}],out:[{opacity:1},{opacity:0}]})}
|
|
2139
1745
|
></primer-vault-error-message>
|
|
2140
|
-
`,()=>
|
|
1746
|
+
`,()=>p)}
|
|
2141
1747
|
|
|
2142
1748
|
<div class="vault-manager-content">
|
|
2143
|
-
${
|
|
1749
|
+
${_(!r&&!e,()=>d`
|
|
2144
1750
|
<div class="content-container">
|
|
2145
1751
|
<primer-vault-empty-state
|
|
2146
|
-
${
|
|
1752
|
+
${Re({...this.getAnimationConfig(),properties:["opacity"],in:[{opacity:0},{opacity:1}],out:[{opacity:1},{opacity:0}]})}
|
|
2147
1753
|
></primer-vault-empty-state>
|
|
2148
1754
|
</div>
|
|
2149
|
-
`,()=>
|
|
2150
|
-
${
|
|
1755
|
+
`,()=>p)}
|
|
1756
|
+
${_(!r&&e,()=>d`
|
|
2151
1757
|
<div class="content-container">
|
|
2152
|
-
${
|
|
1758
|
+
${_(this.deletePaymentMethodId,()=>this.renderDeleteConfirmation(),()=>this.renderPaymentMethodList())}
|
|
2153
1759
|
</div>
|
|
2154
|
-
`,()=>
|
|
1760
|
+
`,()=>p)}
|
|
2155
1761
|
</div>
|
|
2156
1762
|
|
|
2157
|
-
${
|
|
1763
|
+
${_(o,()=>this.renderLoadingOverlay(),()=>p)}
|
|
2158
1764
|
</div>
|
|
2159
|
-
`}};
|
|
1765
|
+
`}};G.styles=[v,co],s([f({context:U,subscribe:!0}),l({type:Object,attribute:!1})],G.prototype,"vaultManagerContext",2),s([x()],G.prototype,"isEditMode",2),s([x()],G.prototype,"deletePaymentMethodId",2),s([x()],G.prototype,"isDeleting",2),s([x()],G.prototype,"errorMessage",2),s([l({type:Number})],G.prototype,"animationDuration",2),G=s([h("primer-vault-manager"),S()],G);function Co(i){return i.paymentInstrumentType===Je.CARD}var Eo=c`
|
|
2160
1766
|
:host {
|
|
2161
1767
|
display: flex;
|
|
2162
1768
|
width: 100%;
|
|
@@ -2263,23 +1869,23 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
|
|
|
2263
1869
|
.delete-button primer-icon {
|
|
2264
1870
|
color: var(--primer-color-red-500);
|
|
2265
1871
|
}
|
|
2266
|
-
`;var
|
|
1872
|
+
`;var B=class extends m{constructor(){super(...arguments);this.vaultManagerContext=null;this.vaultItemContext=null;this.headlessUtils=null;this.paymentMethod=null;this.isEditMode=!1;this._getAssetsTask=new M(this,{task:async([e,r,o])=>{if(!e||!r||!o)return E;let a="";if(Co(e))a=r.getCardNetworkAsset(e.paymentInstrumentData.network).cardUrl;else{let g=await r.getCDNAssets(e.paymentMethodType);g&&(a=g.assets?.icon?`${g.goatCdnUrl}/${g.assets.icon}`:"")}let n=o.cvvRecapture,u=sr(e);return{icon:a,shouldShowCVV:n,...u}},args:()=>[this.paymentMethod,this.headlessUtils,this.vaultManagerContext]})}isSelected(){if(!this.vaultManagerContext||!this.paymentMethod)return!1;let e=this.vaultItemContext?.selectedVaultedPaymentMethod;return!!e&&e.id===this.paymentMethod.id}handleClick(){this.isEditMode||!this.vaultManagerContext||!this.paymentMethod||(this.isSelected()?this.vaultItemContext?.setSelectedVaultedPaymentMethod(null):this.vaultItemContext?.setSelectedVaultedPaymentMethod(this.paymentMethod))}handleDeleteClick(e){e.stopPropagation(),this.dispatchEvent(new CustomEvent("delete-payment-method",{detail:this.paymentMethod?.id,bubbles:!0,composed:!0}))}renderPaymentMethodContent(e){let r=e.icon?d`<img
|
|
2267
1873
|
class="payment-method-icon"
|
|
2268
|
-
src=${
|
|
2269
|
-
alt=${
|
|
2270
|
-
/>`:
|
|
1874
|
+
src=${e.icon}
|
|
1875
|
+
alt=${e.description}
|
|
1876
|
+
/>`:d`
|
|
2271
1877
|
<div class="payment-method-icon payment-method-icon-generic">
|
|
2272
1878
|
<primer-icon name="payment-card" size="sm"></primer-icon>
|
|
2273
1879
|
</div>
|
|
2274
|
-
`;return
|
|
1880
|
+
`;return d`
|
|
2275
1881
|
${r}
|
|
2276
1882
|
<div class="payment-method-details">
|
|
2277
|
-
<div class="payment-method-description">${
|
|
2278
|
-
${
|
|
2279
|
-
${
|
|
2280
|
-
</div>`:
|
|
1883
|
+
<div class="payment-method-description">${e.description}</div>
|
|
1884
|
+
${e.secondaryDescription?d`<div class="payment-method-secondary-description">
|
|
1885
|
+
${e.secondaryDescription}
|
|
1886
|
+
</div>`:p}
|
|
2281
1887
|
</div>
|
|
2282
|
-
`}render(){return this._getAssetsTask.render({error:()=>
|
|
1888
|
+
`}render(){return this._getAssetsTask.render({error:()=>p,complete:e=>{let r=this.isSelected()?"checked":"default";return d`
|
|
2283
1889
|
<div class="payment-method-wrapper">
|
|
2284
1890
|
<div class="payment-method-container">
|
|
2285
1891
|
<primer-button
|
|
@@ -2290,284 +1896,616 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
|
|
|
2290
1896
|
selectionState=${r}
|
|
2291
1897
|
@click=${this.handleClick}
|
|
2292
1898
|
>
|
|
2293
|
-
${this.renderPaymentMethodContent(
|
|
1899
|
+
${this.renderPaymentMethodContent(e)}
|
|
2294
1900
|
</primer-button>
|
|
2295
1901
|
|
|
2296
|
-
${this.isEditMode?
|
|
1902
|
+
${this.isEditMode?d`
|
|
2297
1903
|
<button
|
|
2298
1904
|
class="delete-button"
|
|
2299
1905
|
@click=${this.handleDeleteClick}
|
|
2300
|
-
aria-label=${`${
|
|
1906
|
+
aria-label=${`${y("delete",{id:"delete"})} ${e.description}`}
|
|
2301
1907
|
>
|
|
2302
1908
|
<primer-icon name="trash" size="sm"></primer-icon>
|
|
2303
1909
|
</button>
|
|
2304
|
-
`:
|
|
1910
|
+
`:p}
|
|
2305
1911
|
</div>
|
|
2306
1912
|
|
|
2307
|
-
${
|
|
2308
|
-
.paymentMethod="${this.paymentMethod}"
|
|
2309
|
-
></primer-vault-cvv-input>`,()=>
|
|
1913
|
+
${_(e.shouldShowCVV&&this.isSelected()&&!this.isEditMode,()=>d`<primer-vault-cvv-input
|
|
1914
|
+
.paymentMethod="${this.paymentMethod}"
|
|
1915
|
+
></primer-vault-cvv-input>`,()=>p)}
|
|
1916
|
+
</div>
|
|
1917
|
+
`}})}};B.styles=[v,Eo],s([f({context:U,subscribe:!0}),l({type:Object,attribute:!1,hasChanged(e,r){return e?.cvvRecapture!==r?.cvvRecapture}})],B.prototype,"vaultManagerContext",2),s([f({context:ke,subscribe:!0}),l({type:Object,attribute:!1,hasChanged(e,r){return e?.selectedVaultedPaymentMethod?.id!==r?.selectedVaultedPaymentMethod?.id}})],B.prototype,"vaultItemContext",2),s([f({context:$,subscribe:!0}),l({type:Object})],B.prototype,"headlessUtils",2),s([l({type:Object,attribute:!1})],B.prototype,"paymentMethod",2),s([l({type:Boolean,reflect:!0})],B.prototype,"isEditMode",2),B=s([h("primer-vault-payment-method-item"),S()],B);var So=c`
|
|
1918
|
+
:host {
|
|
1919
|
+
display: block;
|
|
1920
|
+
width: 100%;
|
|
1921
|
+
}
|
|
1922
|
+
|
|
1923
|
+
.vault-manager-header {
|
|
1924
|
+
display: flex;
|
|
1925
|
+
justify-content: space-between;
|
|
1926
|
+
align-items: center;
|
|
1927
|
+
margin-bottom: var(--primer-space-medium);
|
|
1928
|
+
}
|
|
1929
|
+
|
|
1930
|
+
.vault-manager-header h3 {
|
|
1931
|
+
font-size: var(--primer-typography-title-large-size);
|
|
1932
|
+
font-weight: var(--primer-typography-title-large-weight);
|
|
1933
|
+
font-family: var(--primer-typography-title-large-font);
|
|
1934
|
+
color: var(--primer-color-text-primary);
|
|
1935
|
+
margin: 0;
|
|
1936
|
+
}
|
|
1937
|
+
|
|
1938
|
+
.edit-button {
|
|
1939
|
+
display: flex;
|
|
1940
|
+
align-items: center;
|
|
1941
|
+
justify-content: center;
|
|
1942
|
+
}
|
|
1943
|
+
|
|
1944
|
+
.edit-button.active {
|
|
1945
|
+
color: var(--primer-color-brand);
|
|
1946
|
+
}
|
|
1947
|
+
`;var ee=class extends m{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`
|
|
1948
|
+
<div class="vault-manager-header">
|
|
1949
|
+
<h3>${y("previouslyUsed",{id:"previouslyUsed"})}</h3>
|
|
1950
|
+
|
|
1951
|
+
${this.hasPaymentMethods?d`
|
|
1952
|
+
<primer-button
|
|
1953
|
+
class="edit-button ${this.isEditMode?"active":""}"
|
|
1954
|
+
@click=${this.toggleEditMode}
|
|
1955
|
+
aria-label=${this.isEditMode?y("confirm",{id:"confirm"}):y("editPaymentMethods",{id:"editPaymentMethods"})}
|
|
1956
|
+
>
|
|
1957
|
+
${this.isEditMode?d`<primer-icon name="checkmark" size="sm"></primer-icon>`:d`<primer-icon name="pencil" size="sm"></primer-icon>`}
|
|
1958
|
+
</primer-button>
|
|
1959
|
+
`:p}
|
|
1960
|
+
</div>
|
|
1961
|
+
`}};ee.styles=[v,So],s([l({type:Boolean})],ee.prototype,"isEditMode",2),s([l({type:Boolean})],ee.prototype,"hasPaymentMethods",2),ee=s([h("primer-vault-manager-header"),S()],ee);var Mo=c`
|
|
1962
|
+
:host {
|
|
1963
|
+
display: block;
|
|
1964
|
+
width: 100%;
|
|
1965
|
+
}
|
|
1966
|
+
|
|
1967
|
+
.delete-confirmation {
|
|
1968
|
+
margin-top: var(--primer-space-small);
|
|
1969
|
+
padding: var(--primer-space-medium);
|
|
1970
|
+
background-color: var(--primer-color-gray-000);
|
|
1971
|
+
border: 1px solid var(--primer-color-red-500);
|
|
1972
|
+
border-radius: var(--primer-radius-medium);
|
|
1973
|
+
}
|
|
1974
|
+
|
|
1975
|
+
.delete-message {
|
|
1976
|
+
margin-bottom: var(--primer-space-medium);
|
|
1977
|
+
}
|
|
1978
|
+
|
|
1979
|
+
.delete-text {
|
|
1980
|
+
margin: 0;
|
|
1981
|
+
color: var(--primer-color-text-secondary);
|
|
1982
|
+
font-size: var(--primer-typography-body-medium-size);
|
|
1983
|
+
}
|
|
1984
|
+
|
|
1985
|
+
.delete-actions {
|
|
1986
|
+
display: flex;
|
|
1987
|
+
justify-content: flex-end;
|
|
1988
|
+
gap: var(--primer-space-small);
|
|
1989
|
+
}
|
|
1990
|
+
|
|
1991
|
+
.delete-confirm {
|
|
1992
|
+
background-color: var(--primer-color-red-500);
|
|
1993
|
+
color: var(--primer-color-gray-000);
|
|
1994
|
+
border: none;
|
|
1995
|
+
padding: var(--primer-space-small) var(--primer-space-medium);
|
|
1996
|
+
border-radius: var(--primer-radius-small);
|
|
1997
|
+
font-weight: var(--primer-typography-body-medium-weight);
|
|
1998
|
+
cursor: pointer;
|
|
1999
|
+
transition: background-color var(--primer-animation-duration)
|
|
2000
|
+
var(--primer-animation-easing);
|
|
2001
|
+
}
|
|
2002
|
+
|
|
2003
|
+
.delete-confirm:hover:not(:disabled) {
|
|
2004
|
+
background-color: var(--primer-color-red-900);
|
|
2005
|
+
}
|
|
2006
|
+
|
|
2007
|
+
.delete-confirm:disabled {
|
|
2008
|
+
opacity: 0.7;
|
|
2009
|
+
cursor: not-allowed;
|
|
2010
|
+
}
|
|
2011
|
+
|
|
2012
|
+
.delete-cancel {
|
|
2013
|
+
background-color: transparent;
|
|
2014
|
+
border: 1px solid var(--primer-color-border-outlined-default);
|
|
2015
|
+
padding: var(--primer-space-small) var(--primer-space-medium);
|
|
2016
|
+
border-radius: var(--primer-radius-small);
|
|
2017
|
+
color: var(--primer-color-text-primary);
|
|
2018
|
+
font-weight: var(--primer-typography-body-medium-weight);
|
|
2019
|
+
cursor: pointer;
|
|
2020
|
+
transition: background-color var(--primer-animation-duration)
|
|
2021
|
+
var(--primer-animation-easing);
|
|
2022
|
+
}
|
|
2023
|
+
|
|
2024
|
+
.delete-cancel:hover:not(:disabled) {
|
|
2025
|
+
background-color: var(--primer-color-gray-100);
|
|
2026
|
+
}
|
|
2027
|
+
|
|
2028
|
+
.delete-cancel:disabled {
|
|
2029
|
+
opacity: 0.7;
|
|
2030
|
+
cursor: not-allowed;
|
|
2031
|
+
}
|
|
2032
|
+
`;var q=class extends m{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 e=this.paymentMethodName;return d`
|
|
2033
|
+
<div class="delete-confirmation">
|
|
2034
|
+
<div class="delete-message">
|
|
2035
|
+
<p class="delete-text">${e}</p>
|
|
2036
|
+
</div>
|
|
2037
|
+
<div class="delete-actions">
|
|
2038
|
+
<button
|
|
2039
|
+
class="delete-confirm"
|
|
2040
|
+
@click=${this.handleConfirmClick}
|
|
2041
|
+
?disabled=${this.isDeleting}
|
|
2042
|
+
>
|
|
2043
|
+
${this.isDeleting?y("deleting",{id:"deleting"}):y("confirmVaultedPaymentMethodDeletion",{id:"confirmVaultedPaymentMethodDeletion"})}
|
|
2044
|
+
</button>
|
|
2045
|
+
<button
|
|
2046
|
+
class="delete-cancel"
|
|
2047
|
+
@click=${this.handleCancelClick}
|
|
2048
|
+
?disabled=${this.isDeleting}
|
|
2049
|
+
>
|
|
2050
|
+
${y("cancel",{id:"cancel"})}
|
|
2051
|
+
</button>
|
|
2052
|
+
</div>
|
|
2053
|
+
</div>
|
|
2054
|
+
`}};q.styles=[v,Mo],s([l({type:Boolean})],q.prototype,"isDeleting",2),s([l({type:String})],q.prototype,"paymentMethodId",2),s([l({type:String})],q.prototype,"paymentMethodName",2),s([f({context:U,subscribe:!0})],q.prototype,"vaultManager",2),q=s([h("primer-vault-delete-confirmation"),S()],q);var Ao=c`
|
|
2055
|
+
:host {
|
|
2056
|
+
display: block;
|
|
2057
|
+
width: 100%;
|
|
2058
|
+
}
|
|
2059
|
+
|
|
2060
|
+
.empty-state {
|
|
2061
|
+
padding: var(--primer-space-xlarge) 0;
|
|
2062
|
+
text-align: center;
|
|
2063
|
+
color: var(--primer-color-text-secondary);
|
|
2064
|
+
}
|
|
2065
|
+
|
|
2066
|
+
.empty-state p {
|
|
2067
|
+
margin: 0;
|
|
2068
|
+
}
|
|
2069
|
+
`;var ye=class extends m{render(){return d`
|
|
2070
|
+
<div class="empty-state">
|
|
2071
|
+
<p>
|
|
2072
|
+
${y("savedPaymentMethodsEmpty",{id:"savedPaymentMethodsEmpty"})}
|
|
2073
|
+
</p>
|
|
2074
|
+
</div>
|
|
2075
|
+
`}};ye.styles=[v,Ao],ye=s([h("primer-vault-empty-state"),S()],ye);var _o=c`
|
|
2076
|
+
:host {
|
|
2077
|
+
display: block;
|
|
2078
|
+
width: 100%;
|
|
2079
|
+
}
|
|
2080
|
+
|
|
2081
|
+
.error-message {
|
|
2082
|
+
display: flex;
|
|
2083
|
+
background-color: var(--primer-color-red-100);
|
|
2084
|
+
padding: var(--primer-space-medium);
|
|
2085
|
+
border-radius: var(--primer-radius-small);
|
|
2086
|
+
margin-bottom: var(--primer-space-medium);
|
|
2087
|
+
justify-content: space-between;
|
|
2088
|
+
align-items: center;
|
|
2089
|
+
border: 1px solid var(--primer-color-red-500);
|
|
2090
|
+
}
|
|
2091
|
+
|
|
2092
|
+
.error-content {
|
|
2093
|
+
display: flex;
|
|
2094
|
+
align-items: center;
|
|
2095
|
+
gap: var(--primer-space-small);
|
|
2096
|
+
}
|
|
2097
|
+
|
|
2098
|
+
.error-message p {
|
|
2099
|
+
margin: 0;
|
|
2100
|
+
color: var(--primer-color-text-negative);
|
|
2101
|
+
font-size: var(--primer-typography-body-medium-size);
|
|
2102
|
+
}
|
|
2103
|
+
|
|
2104
|
+
.error-message button {
|
|
2105
|
+
background: transparent;
|
|
2106
|
+
border: none;
|
|
2107
|
+
color: var(--primer-color-text-negative);
|
|
2108
|
+
cursor: pointer;
|
|
2109
|
+
padding: var(--primer-space-xsmall);
|
|
2110
|
+
display: flex;
|
|
2111
|
+
align-items: center;
|
|
2112
|
+
justify-content: center;
|
|
2113
|
+
border-radius: var(--primer-radius-small);
|
|
2114
|
+
transition: background-color var(--primer-animation-duration)
|
|
2115
|
+
var(--primer-animation-easing);
|
|
2116
|
+
}
|
|
2117
|
+
|
|
2118
|
+
.error-message button:hover {
|
|
2119
|
+
background-color: rgba(0, 0, 0, 0.05);
|
|
2120
|
+
}
|
|
2121
|
+
`;var ae=class extends m{constructor(){super(...arguments);this.errorMessage=""}handleDismiss(){this.dispatchEvent(new CustomEvent("close-error",{bubbles:!0,composed:!0}))}render(){return d`
|
|
2122
|
+
<div class="error-message">
|
|
2123
|
+
<div class="error-content">
|
|
2124
|
+
<primer-icon
|
|
2125
|
+
name="warning"
|
|
2126
|
+
size="sm"
|
|
2127
|
+
color="var(--primer-color-red-500)"
|
|
2128
|
+
></primer-icon>
|
|
2129
|
+
<p>${this.errorMessage}</p>
|
|
2130
|
+
</div>
|
|
2131
|
+
<button
|
|
2132
|
+
@click=${this.handleDismiss}
|
|
2133
|
+
aria-label=${y("closeErrorMessage",{id:"closeErrorMessage"})}
|
|
2134
|
+
>
|
|
2135
|
+
<primer-icon name="close" size="sm"></primer-icon>
|
|
2136
|
+
</button>
|
|
2137
|
+
</div>
|
|
2138
|
+
`}};ae.styles=[v,_o],s([l({type:String})],ae.prototype,"errorMessage",2),ae=s([h("primer-vault-error-message"),S()],ae);var Po=c`
|
|
2139
|
+
:host {
|
|
2140
|
+
display: contents;
|
|
2141
|
+
}
|
|
2142
|
+
`;var I=class extends m{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 e=>{if(e.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:y("pay",{id:"pay"})}set buttonText(e){let r=this.buttonText;e!==""?(this._userAssignedProps.add("buttonText"),this._internalButtonText=e):(this._userAssignedProps.delete("buttonText"),this._internalButtonText=""),this.requestUpdate("buttonText",r)}get isButtonDisabled(){return!!(this.disabled||!this.vaultItemContext?.selectedVaultedPaymentMethod||this.vaultManager?.isLoading)}render(){let e=this.clientOptions?.submitButton?.amountVisible?this.headlessInstance?.getUIOrderAmount():null,r=e?` ${e}`:p;return d`
|
|
2143
|
+
<primer-button
|
|
2144
|
+
buttonType="submit"
|
|
2145
|
+
variant=${this.variant}
|
|
2146
|
+
@click=${this.handleClick}
|
|
2147
|
+
.disabled=${this.isButtonDisabled}
|
|
2148
|
+
.loading=${this.sdkState?.isProcessing}
|
|
2149
|
+
data-submit
|
|
2150
|
+
>
|
|
2151
|
+
${this.buttonText}${r}
|
|
2152
|
+
</primer-button>
|
|
2153
|
+
`}};I.styles=[v,Po],s([l({type:String})],I.prototype,"buttonText",1),s([f({context:$,subscribe:!0}),l({type:Object})],I.prototype,"headlessInstance",2),s([f({context:T,subscribe:!0}),l()],I.prototype,"sdkState",2),s([f({context:ke,subscribe:!0}),l({type:Object,attribute:!1,hasChanged(e,r){return e?.selectedVaultedPaymentMethod?.id!==r?.selectedVaultedPaymentMethod?.id}})],I.prototype,"vaultItemContext",2),s([f({context:U,subscribe:!0}),l({type:Object,attribute:!1})],I.prototype,"vaultManager",2),s([f({context:_e,subscribe:!0}),l({type:Object,attribute:!1,hasChanged(e,r){return e?.submitButton?.amountVisible!==r?.submitButton?.amountVisible}})],I.prototype,"clientOptions",2),s([l({type:String})],I.prototype,"variant",2),s([l({type:Boolean})],I.prototype,"disabled",2),I=s([h("primer-vault-payment-submit"),S()],I);function mr(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 ko=c`
|
|
2154
|
+
:host {
|
|
2155
|
+
display: block;
|
|
2156
|
+
margin-top: var(--primer-space-medium);
|
|
2157
|
+
}
|
|
2158
|
+
|
|
2159
|
+
.cvv-input-container {
|
|
2160
|
+
margin-bottom: var(--primer-space-medium);
|
|
2161
|
+
}
|
|
2162
|
+
`;var N=class extends m{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 M(this,{task:async([e,r])=>!e||!r||e.paymentMethodType!=="PAYMENT_CARD"||!e.paymentInstrumentData?.network||r.createCvvInput===null?E:{network:e.paymentInstrumentData.network,createCvvInput:r.createCvvInput},args:()=>[this.paymentMethod,this.vaultManagerFormContext]});this.cvvContainerId=`cvv-container-${Math.random().toString(36).substring(2,9)}`,new M(this,{task:async([e])=>{if(!e)return E;await this.updateComplete;let r=this.renderRoot.querySelector(`#${this.cvvContainerId}`);if(!r)return;let o=mr(this.computedStyles),a=o?{input:{base:o}}:void 0,n={cardNetwork:e.network,container:r,name:"cvv",placeholder:"123",style:a};this.cvvInput=await e.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:()=>p,complete:()=>d`
|
|
2163
|
+
<div class="cvv-input-container">
|
|
2164
|
+
<primer-input-wrapper
|
|
2165
|
+
.hasError=${!!this.cvvError&&(this.vaultManagerCvvContext?.formIsDirty||this.cvvInputIsDirty&&this.cvvInputIsBlurred)}
|
|
2166
|
+
>
|
|
2167
|
+
<primer-input-label slot="label">CVV</primer-input-label>
|
|
2168
|
+
<div slot="input" id="${this.cvvContainerId}"></div>
|
|
2169
|
+
${_(this.cvvError&&(this.vaultManagerCvvContext?.formIsDirty||this.cvvInputIsDirty&&this.cvvInputIsBlurred),()=>d`
|
|
2170
|
+
<primer-input-error slot="error">
|
|
2171
|
+
${this.cvvError}
|
|
2172
|
+
</primer-input-error>
|
|
2173
|
+
`)}
|
|
2174
|
+
</primer-input-wrapper>
|
|
2310
2175
|
</div>
|
|
2311
|
-
`}
|
|
2176
|
+
`})}};N.styles=[v,ko],s([f({context:U,subscribe:!0}),l({type:Object,attribute:!1,hasChanged(e,r){return e?.createCvvInput!==r?.createCvvInput}})],N.prototype,"vaultManagerFormContext",2),s([f({context:ke,subscribe:!0}),l({type:Object,attribute:!1})],N.prototype,"vaultManagerCvvContext",2),s([f({context:Pe,subscribe:!0}),l()],N.prototype,"computedStyles",2),s([l({type:Object})],N.prototype,"paymentMethod",2),s([x()],N.prototype,"cvvError",2),s([x()],N.prototype,"cvvInputIsDirty",2),s([x()],N.prototype,"cvvInputIsBlurred",2),s([x()],N.prototype,"cvvInput",2),N=s([h("primer-vault-cvv-input"),S()],N);var hr="card-form-context";var wo=c`
|
|
2312
2177
|
:host {
|
|
2313
|
-
display:
|
|
2178
|
+
display: contents;
|
|
2179
|
+
}
|
|
2180
|
+
|
|
2181
|
+
form {
|
|
2182
|
+
display: flex;
|
|
2183
|
+
flex-direction: column;
|
|
2184
|
+
gap: var(--primer-space-medium);
|
|
2314
2185
|
width: 100%;
|
|
2315
2186
|
}
|
|
2316
2187
|
|
|
2317
|
-
.
|
|
2188
|
+
.card-form {
|
|
2318
2189
|
display: flex;
|
|
2319
|
-
|
|
2320
|
-
|
|
2190
|
+
flex-direction: column;
|
|
2191
|
+
gap: var(--primer-space-medium);
|
|
2321
2192
|
margin-bottom: var(--primer-space-medium);
|
|
2322
2193
|
}
|
|
2323
2194
|
|
|
2324
|
-
.
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2195
|
+
.card-form-row {
|
|
2196
|
+
display: flex;
|
|
2197
|
+
gap: var(--primer-space-small);
|
|
2198
|
+
}
|
|
2199
|
+
`;var te=class extends m{constructor(){super(...arguments);this.hideLabels=!1;this.hasAssignedContent=!1;this.selectedCardNetwork=null;this.paymentManagers=new Map;this.cardFormProvider=new L(this,{context:hr,initialValue:null});this.eventsController=new Xe(this);this.setupCardFormTask=new M(this,{task:async([e])=>{if(!e?.manager)return E;let{manager:r}=e,{cardNumberInput:o,expiryInput:a,cvvInput:n}=r.createHostedInputs();return this.cardFormProvider.setValue({cardNumberInput:o,expiryInput:a,cvvInput:n,setCardholderName:u=>r.setCardholderName(u),setCardNetwork:u=>{this.selectedCardNetwork=u},validate:()=>r.validate(),submit:u=>r.submit(u),hideLabels:this.hideLabels}),!0},args:()=>[this.paymentManagers.get("PAYMENT_CARD")]});this.handleSlotButtonClick=e=>{let o=e.target.closest("button, primer-button");if(!o)return;this.isSubmitButton(o)&&(e.preventDefault(),this.submitCardPayment())};this.handleDirectSubmit=e=>{e.stopPropagation(),this.submitCardPayment()};this.onSlotChange=e=>{let o=e.target.assignedNodes({flatten:!0});this.hasAssignedContent=o.length>0};this.handleFormSubmit=e=>{e.preventDefault(),e.stopPropagation(),this.submitCardPayment()}}updated(e){super.updated(e),e.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(e){let r=e.tagName.toLowerCase(),o=r==="button",a=r==="primer-button";return o&&(e.getAttribute("type")==="submit"||e.hasAttribute("data-submit"))||a&&(e.getAttribute("type")==="submit"||e.hasAttribute("data-submit"))}async submitCardPayment(){let e=this.cardFormProvider.value;if(!e)return;let r=await e.validate?.();if(r?.valid){let o=await e.submit?.(this.selectedCardNetwork?{cardNetwork:this.selectedCardNetwork}:void 0);this.eventsController.dispatchFormSubmitSuccess(o)}else{let o=r?.validationErrors;this.cardFormProvider.setValue({...e,errors:o}),this.eventsController.dispatchFormSubmitErrors(o)}}render(){return this.setupCardFormTask.status===Te.ERROR||this.setupCardFormTask.status===Te.INITIAL?p:d`
|
|
2200
|
+
<form @submit=${this.handleFormSubmit}>
|
|
2201
|
+
<slot name="card-form-content" @slotchange=${this.onSlotChange}></slot>
|
|
2202
|
+
${this.setupCardFormTask.render({complete:()=>_(this.hasAssignedContent,()=>p,()=>d`
|
|
2203
|
+
<div class="card-form">
|
|
2204
|
+
<primer-input-card-number></primer-input-card-number>
|
|
2205
|
+
<div class="card-form-row">
|
|
2206
|
+
<primer-input-card-expiry></primer-input-card-expiry>
|
|
2207
|
+
<primer-input-cvv></primer-input-cvv>
|
|
2208
|
+
</div>
|
|
2209
|
+
<primer-input-card-holder-name></primer-input-card-holder-name>
|
|
2210
|
+
</div>
|
|
2211
|
+
<primer-card-form-submit></primer-card-form-submit>
|
|
2212
|
+
`)})}
|
|
2213
|
+
</form>
|
|
2214
|
+
`}};te.styles=[v,wo],s([l({type:Boolean,attribute:"hide-labels",reflect:!0})],te.prototype,"hideLabels",2),s([x()],te.prototype,"hasAssignedContent",2),s([x()],te.prototype,"selectedCardNetwork",2),s([f({context:Y,subscribe:!0}),l({type:Object})],te.prototype,"paymentManagers",2),te=s([h("primer-card-form"),S()],te);function To(i,t){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",""),!t.shadowRoot?.querySelector("style[data-custom-input-style]")){let e=document.createElement("style");e.setAttribute("data-custom-input-style",""),e.textContent=`
|
|
2215
|
+
input[data-custom-input]::placeholder {
|
|
2216
|
+
color: var(--primer-color-text-placeholder);
|
|
2217
|
+
font-size: var(--primer-typography-body-large-size);
|
|
2218
|
+
font-family: var(--primer-typography-body-large-font);
|
|
2219
|
+
}
|
|
2220
|
+
input[data-custom-input]:focus {
|
|
2221
|
+
outline: none;
|
|
2222
|
+
}
|
|
2223
|
+
`,t.shadowRoot?t.shadowRoot.appendChild(e):t.appendChild(e)}}function Lo(i,t){return i.active===t.active&&i.dirty===t.dirty&&i.error===t.error&&i.errorCode===t.errorCode&&i.submitted===t.submitted&&i.touched===t.touched&&i.valid===t.valid}var ur=class{constructor(t,e){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=t,this.config=e,this.host.addController(this),this.setupTask=new M(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:t}=this.config,e=this.host.cardFormContext;return e?{cardNumber:e.cardNumberInput,cvv:e.cvvInput,expire:e.expiryInput,cardholderName:"cardholderName"}[t]:void 0}async setupHostedInput([t]){if(!t)return E;await this.host.updateComplete;let e=this.getTargetContainer();return e?t==="cardholderName"?this.setupStandardInput(e):this.setupHostedIframeInput(t,e):E}getTargetContainer(){return this.host.renderRoot.querySelector(this.config.containerSelector)}setupStandardInput(t){let e=document.createElement("input");return e.type="text",e.placeholder=this.host.placeholder,To(e,this.host),(this.host.ariaLabel||this.host.label)&&e.setAttribute("aria-label",this.host.ariaLabel??this.host.label),this.setupInputEventListeners(e),t.innerHTML="",t.appendChild(e),this._standardInput=e,!0}setupInputEventListeners(t){t.addEventListener("input",e=>{let r=e.target;this.config.onInput?.(r.value)}),t.addEventListener("focus",()=>{this._isFocused=!0,this.host.requestUpdate()}),t.addEventListener("blur",()=>{this._isFocused=!1,this.host.requestUpdate()})}async setupHostedIframeInput(t,e){await new Promise(a=>requestAnimationFrame(()=>a())),this._hostedInput=t;let r=mr(this.host.computedStyles),o=r?{style:{input:{base:r}}}:void 0;return t.addEventListener("focus",()=>{this._isFocused=!0,this.host.requestUpdate()}),t.addEventListener("blur",()=>{this._isFocused=!1,this.host.requestUpdate()}),t.addEventListener("change",a=>{this._meta=a,Lo(this._meta,a)&&this.host.requestUpdate()}),await t.render(e,{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 V=class extends m{constructor(){super();this.cardFormContext=null;this.computedStyles=null;this._userAssignedProps=new Set;this._internalLabel="";this._internalPlaceholder="";this._internalAriaLabel="";this.hostedInputController={}}getTranslatedValue(e){return e?typeof e=="string"?e:y(e.id,{id:e.id}):""}get label(){return this._userAssignedProps.has("label")?this._internalLabel:this.getTranslatedValue(this.config.translations.label)}set label(e){let r=this.label;e!==""?(this._userAssignedProps.add("label"),this._internalLabel=e):(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(e){let r=this.placeholder;this._userAssignedProps.add("placeholder"),this._internalPlaceholder=e,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(e){let r=this.ariaLabel;e!==""?(this._userAssignedProps.add("ariaLabel"),this._internalAriaLabel=e):(this._userAssignedProps.delete("ariaLabel"),this._internalAriaLabel=""),this.requestUpdate("ariaLabel",r)}childUpdated(){Object.defineProperty(this,"hostedInputController",{value:new ur(this,{type:this.config.inputType,containerSelector:this.config.containerSelector,onInput:this.config.onInput}),writable:!1,configurable:!1})}handleWrapperClick(){this.hostedInputController.focusInput()}getError(){let e=this.hostedInputController.meta;return e.submitted||e.dirty&&e.touched?e.errorCode:null}renderInput(){if(this.hostedInputController.setupTask.status===Te.ERROR)return p;let e=this.getError();return d`
|
|
2224
|
+
<primer-input-wrapper
|
|
2225
|
+
.focusWithin="${this.hostedInputController.isFocused}"
|
|
2226
|
+
.hasError=${!!e}
|
|
2227
|
+
@wrapper-click="${this.handleWrapperClick}"
|
|
2228
|
+
>
|
|
2229
|
+
${_(!this.cardFormContext?.hideLabels,()=>d`<primer-input-label slot="label"
|
|
2230
|
+
>${this.label}</primer-input-label
|
|
2231
|
+
>`,()=>p)}
|
|
2232
|
+
<div
|
|
2233
|
+
slot="input"
|
|
2234
|
+
class="card-input-slot"
|
|
2235
|
+
id="${this.config.containerSelector.substring(1)}"
|
|
2236
|
+
aria-label="${this.ariaLabel}"
|
|
2237
|
+
></div>
|
|
2238
|
+
${_(e,()=>d`
|
|
2239
|
+
<primer-input-error slot="error">
|
|
2240
|
+
${y(e,{id:e})}
|
|
2241
|
+
</primer-input-error>
|
|
2242
|
+
`,()=>p)}
|
|
2243
|
+
</primer-input-wrapper>
|
|
2244
|
+
`}};s([f({context:hr,subscribe:!0})],V.prototype,"cardFormContext",2),s([f({context:Pe,subscribe:!0}),l()],V.prototype,"computedStyles",2),s([l({type:String})],V.prototype,"label",1),s([l({type:String})],V.prototype,"placeholder",1),s([l({type:String,attribute:"aria-label"})],V.prototype,"ariaLabel",1);var Io=c`
|
|
2245
|
+
:host {
|
|
2246
|
+
display: contents;
|
|
2330
2247
|
}
|
|
2331
2248
|
|
|
2332
|
-
.
|
|
2249
|
+
.card-number-container {
|
|
2333
2250
|
display: flex;
|
|
2334
2251
|
align-items: center;
|
|
2335
|
-
|
|
2252
|
+
width: 100%;
|
|
2253
|
+
position: relative;
|
|
2254
|
+
gap: var(--primer-space-small);
|
|
2336
2255
|
}
|
|
2337
2256
|
|
|
2338
|
-
|
|
2339
|
-
|
|
2257
|
+
#cardNumber {
|
|
2258
|
+
flex: 1;
|
|
2259
|
+
display: flex;
|
|
2260
|
+
width: 100%;
|
|
2340
2261
|
}
|
|
2341
|
-
`;var Ge=class extends v{constructor(){super(...arguments);this.isEditMode=!1;this.hasPaymentMethods=!1}toggleEditMode(){this.dispatchEvent(new CustomEvent("toggle-edit-mode",{detail:!this.isEditMode,bubbles:!0,composed:!0}))}render(){return c`
|
|
2342
|
-
<div class="vault-manager-header">
|
|
2343
|
-
<h3>${A("previouslyUsed",{id:"previouslyUsed"})}</h3>
|
|
2344
2262
|
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2263
|
+
.network-selector-container {
|
|
2264
|
+
display: flex;
|
|
2265
|
+
align-items: center;
|
|
2266
|
+
z-index: 2;
|
|
2267
|
+
}
|
|
2268
|
+
`;var De=c`
|
|
2269
|
+
.card-input-slot {
|
|
2270
|
+
display: flex;
|
|
2271
|
+
}
|
|
2272
|
+
`;var ve=class extends V{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(e){let{network:r}=e.detail;this.cardFormContext&&this.cardFormContext.setCardNetwork(r)}renderInput(){if(this.hostedInputController.setupTask.status===Te.ERROR)return p;let e=this.getError();return d`
|
|
2273
|
+
<primer-input-wrapper
|
|
2274
|
+
.focusWithin="${this.hostedInputController.isFocused}"
|
|
2275
|
+
.hasError=${!!e}
|
|
2276
|
+
>
|
|
2277
|
+
${_(!this.cardFormContext?.hideLabels,()=>d`<primer-input-label slot="label"
|
|
2278
|
+
>${this.label}</primer-input-label
|
|
2279
|
+
>`,()=>p)}
|
|
2280
|
+
<div
|
|
2281
|
+
slot="input"
|
|
2282
|
+
class="card-number-container"
|
|
2283
|
+
aria-label="${this.ariaLabel}"
|
|
2284
|
+
>
|
|
2285
|
+
<div id="${this.config.containerSelector.substring(1)}"></div>
|
|
2286
|
+
<div class="network-selector-container">
|
|
2287
|
+
<primer-card-network-selector
|
|
2288
|
+
@network-selected=${this.handleNetworkSelected}
|
|
2289
|
+
></primer-card-network-selector>
|
|
2290
|
+
</div>
|
|
2291
|
+
</div>
|
|
2292
|
+
${_(e,r=>d`
|
|
2293
|
+
<primer-input-error slot="error">
|
|
2294
|
+
${y(r,{id:r})}
|
|
2295
|
+
</primer-input-error>
|
|
2296
|
+
`,()=>p)}
|
|
2297
|
+
</primer-input-wrapper>
|
|
2298
|
+
`}render(){return this.renderInput()}};ve.styles=[v,De,Io],ve=s([h("primer-input-card-number"),S()],ve);var No=c`
|
|
2356
2299
|
:host {
|
|
2357
|
-
display:
|
|
2358
|
-
width: 100%;
|
|
2300
|
+
display: contents;
|
|
2359
2301
|
}
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
padding: var(--primer-space-medium);
|
|
2364
|
-
background-color: var(--primer-color-gray-000);
|
|
2365
|
-
border: 1px solid var(--primer-color-red-500);
|
|
2366
|
-
border-radius: var(--primer-radius-medium);
|
|
2302
|
+
`;var be=class extends V{constructor(){super();this.config={inputType:"cvv",containerSelector:"#cvv",errorName:"cvv-card",translations:{label:"CVV",placeholder:"123"}};this.childUpdated()}render(){return this.renderInput()}};be.styles=[v,De,No],be=s([h("primer-input-cvv"),S()],be);var $o=c`
|
|
2303
|
+
:host {
|
|
2304
|
+
display: contents;
|
|
2367
2305
|
}
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2306
|
+
`;var xe=class extends V{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()}};xe.styles=[v,De,$o],xe=s([h("primer-input-card-expiry"),S()],xe);var Oo=c`
|
|
2307
|
+
:host {
|
|
2308
|
+
display: contents;
|
|
2371
2309
|
}
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
color: var(--primer-color-text-secondary);
|
|
2376
|
-
font-size: var(--primer-typography-body-medium-size);
|
|
2310
|
+
`;var Ce=class extends V{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:e=>this.handleInput(e)};this.childUpdated()}handleInput(e){this.cardFormContext?.setCardholderName?.(e)}render(){return this.renderInput()}};Ce.styles=[v,De,Oo],Ce=s([h("primer-input-card-holder-name"),S()],Ce);var Ro=c`
|
|
2311
|
+
:host {
|
|
2312
|
+
display: contents;
|
|
2377
2313
|
}
|
|
2378
|
-
|
|
2379
|
-
|
|
2314
|
+
`;var H=class extends m{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=e=>{if(e.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:y("pay",{id:"pay"})}set buttonText(e){let r=this.buttonText;e!==""?(this._userAssignedProps.add("buttonText"),this._internalButtonText=e):(this._userAssignedProps.delete("buttonText"),this._internalButtonText=""),this.requestUpdate("buttonText",r)}render(){let e=this.clientOptions?.submitButton?.amountVisible?this.headlessInstance?.getUIOrderAmount():null,r=e?` ${e}`:p;return d`
|
|
2315
|
+
<primer-button
|
|
2316
|
+
type="submit"
|
|
2317
|
+
variant=${this.variant}
|
|
2318
|
+
?disabled=${this.disabled}
|
|
2319
|
+
@click=${this.handleClick}
|
|
2320
|
+
.loading=${!!this.sdkState?.isProcessing}
|
|
2321
|
+
data-submit
|
|
2322
|
+
>
|
|
2323
|
+
${this.buttonText}${r}
|
|
2324
|
+
</primer-button>
|
|
2325
|
+
`}};H.styles=[v,Ro],s([l({type:String})],H.prototype,"buttonText",1),s([f({context:$,subscribe:!0}),l({type:Object})],H.prototype,"headlessInstance",2),s([f({context:_e,subscribe:!0}),l({type:Object})],H.prototype,"clientOptions",2),s([f({context:T,subscribe:!0}),l()],H.prototype,"sdkState",2),s([l({type:String})],H.prototype,"variant",2),s([l({type:Boolean})],H.prototype,"disabled",2),H=s([h("primer-card-form-submit"),S()],H);var Gr=()=>new jr,jr=class{},Kr=new WeakMap,gr=me(class extends Oe{render(i){return p}update(i,[t]){let e=t!==this.G;return e&&this.G!==void 0&&this.rt(void 0),(e||this.lt!==this.ct)&&(this.G=t,this.ht=i.options?.host,this.rt(this.ct=i.element)),p}rt(i){if(this.isConnected||(i=void 0),typeof this.G=="function"){let t=this.ht??globalThis,e=Kr.get(t);e===void 0&&(e=new WeakMap,Kr.set(t,e)),e.get(this.G)!==void 0&&this.G.call(this.ht,void 0),e.set(this.G,i),i!==void 0&&this.G.call(this.ht,i)}else this.G.value=i}get lt(){return typeof this.G=="function"?Kr.get(this.ht??globalThis)?.get(this.G):this.G?.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}});var Do=c`
|
|
2326
|
+
:host {
|
|
2380
2327
|
display: flex;
|
|
2381
|
-
|
|
2382
|
-
|
|
2328
|
+
align-items: center;
|
|
2329
|
+
position: relative;
|
|
2383
2330
|
}
|
|
2384
2331
|
|
|
2385
|
-
.
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
border: none;
|
|
2389
|
-
padding: var(--primer-space-small) var(--primer-space-medium);
|
|
2390
|
-
border-radius: var(--primer-radius-small);
|
|
2391
|
-
font-weight: var(--primer-typography-body-medium-weight);
|
|
2332
|
+
.network-selector {
|
|
2333
|
+
display: flex;
|
|
2334
|
+
align-items: center;
|
|
2392
2335
|
cursor: pointer;
|
|
2393
|
-
|
|
2336
|
+
background: none;
|
|
2337
|
+
padding: unset;
|
|
2338
|
+
border: none;
|
|
2339
|
+
transition: opacity var(--primer-animation-duration)
|
|
2394
2340
|
var(--primer-animation-easing);
|
|
2341
|
+
outline: none;
|
|
2342
|
+
gap: var(--primer-space-xsmall);
|
|
2395
2343
|
}
|
|
2396
2344
|
|
|
2397
|
-
.
|
|
2398
|
-
|
|
2345
|
+
.network-selector:hover {
|
|
2346
|
+
opacity: 0.8;
|
|
2399
2347
|
}
|
|
2400
2348
|
|
|
2401
|
-
.
|
|
2402
|
-
|
|
2403
|
-
|
|
2349
|
+
.network-selector:focus-visible {
|
|
2350
|
+
outline: 2px solid var(--primer-color-focus);
|
|
2351
|
+
border-radius: var(--primer-radius-xsmall);
|
|
2404
2352
|
}
|
|
2405
2353
|
|
|
2406
|
-
.
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
font-weight: var(--primer-typography-body-medium-weight);
|
|
2413
|
-
cursor: pointer;
|
|
2414
|
-
transition: background-color var(--primer-animation-duration)
|
|
2415
|
-
var(--primer-animation-easing);
|
|
2354
|
+
.network-icon {
|
|
2355
|
+
width: var(--primer-size-large);
|
|
2356
|
+
height: var(
|
|
2357
|
+
--primer-size-medium
|
|
2358
|
+
); /* Added explicit height to maintain aspect ratio */
|
|
2359
|
+
object-fit: contain;
|
|
2416
2360
|
}
|
|
2417
2361
|
|
|
2418
|
-
.
|
|
2419
|
-
|
|
2362
|
+
.caret {
|
|
2363
|
+
margin-left: var(--primer-space-xsmall);
|
|
2364
|
+
transition: transform var(--primer-animation-duration)
|
|
2365
|
+
var(--primer-animation-easing);
|
|
2366
|
+
color: var(--primer-color-icon-primary);
|
|
2420
2367
|
}
|
|
2421
2368
|
|
|
2422
|
-
.
|
|
2423
|
-
|
|
2424
|
-
cursor: not-allowed;
|
|
2369
|
+
.caret.open {
|
|
2370
|
+
transform: rotate(180deg);
|
|
2425
2371
|
}
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
class="delete-cancel"
|
|
2441
|
-
@click=${this.handleCancelClick}
|
|
2442
|
-
?disabled=${this.isDeleting}
|
|
2443
|
-
>
|
|
2444
|
-
${A("cancel",{id:"cancel"})}
|
|
2445
|
-
</button>
|
|
2446
|
-
</div>
|
|
2447
|
-
</div>
|
|
2448
|
-
`}};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`
|
|
2449
|
-
:host {
|
|
2450
|
-
display: block;
|
|
2451
|
-
width: 100%;
|
|
2372
|
+
|
|
2373
|
+
.dropdown {
|
|
2374
|
+
position: absolute;
|
|
2375
|
+
top: 100%;
|
|
2376
|
+
right: 0;
|
|
2377
|
+
width: max-content;
|
|
2378
|
+
min-width: calc(var(--primer-size-xxxlarge) * 3);
|
|
2379
|
+
background: var(--primer-color-gray-000);
|
|
2380
|
+
border-radius: var(--primer-radius-small);
|
|
2381
|
+
box-shadow: 0 var(--primer-space-xxsmall) var(--primer-space-large)
|
|
2382
|
+
rgba(0, 0, 0, 0.15);
|
|
2383
|
+
z-index: 10;
|
|
2384
|
+
overflow: hidden;
|
|
2385
|
+
border: 1px solid var(--primer-color-border-outlined-default);
|
|
2452
2386
|
}
|
|
2453
2387
|
|
|
2454
|
-
.
|
|
2455
|
-
|
|
2456
|
-
text-align: center;
|
|
2457
|
-
color: var(--primer-color-text-secondary);
|
|
2388
|
+
.dropdown:not(.open) {
|
|
2389
|
+
display: none;
|
|
2458
2390
|
}
|
|
2459
2391
|
|
|
2460
|
-
.
|
|
2461
|
-
margin: 0;
|
|
2462
|
-
}
|
|
2463
|
-
`;var wt=class extends v{render(){return c`
|
|
2464
|
-
<div class="empty-state">
|
|
2465
|
-
<p>
|
|
2466
|
-
${A("savedPaymentMethodsEmpty",{id:"savedPaymentMethodsEmpty"})}
|
|
2467
|
-
</p>
|
|
2468
|
-
</div>
|
|
2469
|
-
`}};wt.styles=[w,kn],wt=s([y("primer-vault-empty-state"),$()],wt);var In=f`
|
|
2470
|
-
:host {
|
|
2392
|
+
.dropdown.open {
|
|
2471
2393
|
display: block;
|
|
2472
|
-
|
|
2394
|
+
max-height: calc(var(--primer-size-xxxlarge) * 4);
|
|
2395
|
+
overflow-y: auto;
|
|
2473
2396
|
}
|
|
2474
2397
|
|
|
2475
|
-
.
|
|
2398
|
+
.network-option {
|
|
2476
2399
|
display: flex;
|
|
2477
|
-
background-color: var(--primer-color-red-100);
|
|
2478
|
-
padding: var(--primer-space-medium);
|
|
2479
|
-
border-radius: var(--primer-radius-small);
|
|
2480
|
-
margin-bottom: var(--primer-space-medium);
|
|
2481
|
-
justify-content: space-between;
|
|
2482
2400
|
align-items: center;
|
|
2483
|
-
|
|
2401
|
+
padding: var(--primer-space-small) var(--primer-space-medium);
|
|
2402
|
+
cursor: pointer;
|
|
2403
|
+
transition: background-color var(--primer-animation-duration)
|
|
2404
|
+
var(--primer-animation-easing);
|
|
2405
|
+
position: relative;
|
|
2406
|
+
outline: none;
|
|
2407
|
+
background-color: transparent;
|
|
2484
2408
|
}
|
|
2485
2409
|
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
gap: var(--primer-space-small);
|
|
2410
|
+
/* Only apply hover effect when not in keyboard navigation mode */
|
|
2411
|
+
.network-option:hover {
|
|
2412
|
+
background-color: var(--primer-color-gray-100);
|
|
2490
2413
|
}
|
|
2491
2414
|
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
color: var(--primer-color-
|
|
2495
|
-
font-size: var(--primer-typography-body-medium-size);
|
|
2415
|
+
/* Apply focused style only when the focused class is present (keyboard navigation) */
|
|
2416
|
+
.network-option.focused {
|
|
2417
|
+
background-color: var(--primer-color-gray-100);
|
|
2496
2418
|
}
|
|
2497
2419
|
|
|
2498
|
-
.
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
color: var(--primer-color-text-negative);
|
|
2502
|
-
cursor: pointer;
|
|
2503
|
-
padding: var(--primer-space-xsmall);
|
|
2504
|
-
display: flex;
|
|
2505
|
-
align-items: center;
|
|
2506
|
-
justify-content: center;
|
|
2507
|
-
border-radius: var(--primer-radius-small);
|
|
2508
|
-
transition: background-color var(--primer-animation-duration)
|
|
2509
|
-
var(--primer-animation-easing);
|
|
2420
|
+
.network-option:focus-visible {
|
|
2421
|
+
outline: 2px solid var(--primer-color-focus);
|
|
2422
|
+
outline-offset: -2px;
|
|
2510
2423
|
}
|
|
2511
2424
|
|
|
2512
|
-
.
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
<div class="error-content">
|
|
2518
|
-
<primer-icon
|
|
2519
|
-
name="warning"
|
|
2520
|
-
size="sm"
|
|
2521
|
-
color="var(--primer-color-red-500)"
|
|
2522
|
-
></primer-icon>
|
|
2523
|
-
<p>${this.errorMessage}</p>
|
|
2524
|
-
</div>
|
|
2525
|
-
<button
|
|
2526
|
-
@click=${this.handleDismiss}
|
|
2527
|
-
aria-label=${A("closeErrorMessage",{id:"closeErrorMessage"})}
|
|
2528
|
-
>
|
|
2529
|
-
<primer-icon name="close" size="sm"></primer-icon>
|
|
2530
|
-
</button>
|
|
2531
|
-
</div>
|
|
2532
|
-
`}};pt.styles=[w,In],s([p({type:String})],pt.prototype,"errorMessage",2),pt=s([y("primer-vault-error-message"),$()],pt);var Nn=f`
|
|
2533
|
-
:host {
|
|
2534
|
-
display: contents;
|
|
2425
|
+
.network-option-icon {
|
|
2426
|
+
width: var(--primer-size-medium);
|
|
2427
|
+
height: var(--primer-size-small);
|
|
2428
|
+
margin-right: var(--primer-space-small);
|
|
2429
|
+
object-fit: contain;
|
|
2535
2430
|
}
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
${this.buttonText}${r}
|
|
2546
|
-
</primer-button>
|
|
2547
|
-
`}};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`
|
|
2548
|
-
:host {
|
|
2549
|
-
display: block;
|
|
2550
|
-
margin-top: var(--primer-space-medium);
|
|
2431
|
+
|
|
2432
|
+
.network-name {
|
|
2433
|
+
font-size: var(--primer-typography-body-medium-size);
|
|
2434
|
+
font-family: var(--primer-typography-body-medium-font);
|
|
2435
|
+
line-height: var(--primer-typography-body-medium-line-height);
|
|
2436
|
+
letter-spacing: var(--primer-typography-body-medium-letter-spacing);
|
|
2437
|
+
white-space: nowrap;
|
|
2438
|
+
color: var(--primer-color-text-primary);
|
|
2439
|
+
flex: 1;
|
|
2551
2440
|
}
|
|
2552
2441
|
|
|
2553
|
-
.
|
|
2554
|
-
margin-
|
|
2442
|
+
.checkmark {
|
|
2443
|
+
margin-left: var(--primer-space-small);
|
|
2444
|
+
color: var(--primer-color-brand);
|
|
2445
|
+
width: var(--primer-size-small);
|
|
2446
|
+
height: var(--primer-size-small);
|
|
2555
2447
|
}
|
|
2556
|
-
`;var
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2448
|
+
`;var z=class extends m{constructor(){super(...arguments);this.cardNetworks=null;this.headlessUtils=null;this.selectedCardNetwork=null;this.isDropdownOpen=!1;this.focusedNetworkIndex=0;this.isKeyboardNavigation=!1;this.buttonRef=Gr();this.dropdownRef=Gr();this.networkOptionRefs=[];this.handleClickOutside=e=>{this.isDropdownOpen&&(this.contains(e.target)||(this.isDropdownOpen=!1,this.isKeyboardNavigation=!1))};this.handleMouseMove=()=>{this.isKeyboardNavigation&&(this.isKeyboardNavigation=!1)};this.handleKeyDown=e=>{if(!(!(this.getSelectableNetworks().length>1)||!(this.contains(e.target)||this===e.target||this.isDropdownOpen&&e.target===document.body)))switch(this.isKeyboardNavigation=!0,e.key){case"ArrowDown":e.preventDefault(),this.isDropdownOpen?(this.focusedNetworkIndex=(this.focusedNetworkIndex+1)%this.getSelectableNetworks().length,this.focusNetworkOption()):(this.isDropdownOpen=!0,this.focusedNetworkIndex=this.getSelectedNetworkIndex());break;case"ArrowUp":e.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?(e.preventDefault(),this.selectNetwork(e,this.getSelectableNetworks()[this.focusedNetworkIndex])):!this.isDropdownOpen&&this.buttonRef.value===document.activeElement&&(e.preventDefault(),this.isDropdownOpen=!0,this.focusedNetworkIndex=this.getSelectedNetworkIndex());break;case"Escape":this.isDropdownOpen&&(e.preventDefault(),this.isDropdownOpen=!1,this.buttonRef.value?.focus());break;case"Tab":this.isDropdownOpen&&(this.isDropdownOpen=!1);break}};this.handleDocumentKeyDown=e=>{this.isDropdownOpen&&this.handleKeyDown(e)}}toggleDropdown(e){this.isKeyboardNavigation=!1,e.stopPropagation(),this.getSelectableNetworks().length>1&&(this.isDropdownOpen=!this.isDropdownOpen,this.isDropdownOpen&&(this.focusedNetworkIndex=this.getSelectedNetworkIndex()))}getNetworkIconUrl(e){return this.headlessUtils?.getCardNetworkAsset(e.network)?.cardUrl}getSelectableNetworks(){return this.cardNetworks?.selectableCardNetworks||[]}getDetectedNetwork(){return this.selectedCardNetwork??(this.cardNetworks?.detectedCardNetwork||null)}getSelectedNetworkIndex(){let e=this.getDetectedNetwork();if(!e)return 0;let r=this.getSelectableNetworks().findIndex(o=>o.network===e.network);return r>=0?r:0}selectNetwork(e,r){e.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(e,r){this.networkOptionRefs[r]=e}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 e=this.getSelectableNetworks();if(!this.getDetectedNetwork()&&e.length===0)return d`<primer-icon name="payment-card" size="sm"></primer-icon>`;let r=this.getDetectedNetwork()||(e.length>0?e[0]:null);if(!r)return d`<primer-icon name="payment-card" size="sm"></primer-icon>`;let o=e.length>1;return d`
|
|
2449
|
+
<button
|
|
2450
|
+
${gr(this.buttonRef)}
|
|
2451
|
+
class="network-selector"
|
|
2452
|
+
@click=${this.toggleDropdown}
|
|
2453
|
+
@keydown=${a=>{(a.key===" "||a.key==="Enter")&&o&&(a.preventDefault(),this.isDropdownOpen=!this.isDropdownOpen,this.isDropdownOpen&&(this.focusedNetworkIndex=this.getSelectedNetworkIndex()))}}
|
|
2454
|
+
aria-label=${o?`Selected card network: ${r.displayName}. Click to change.`:`Card network: ${r.displayName}`}
|
|
2455
|
+
aria-expanded=${o?this.isDropdownOpen:p}
|
|
2456
|
+
aria-haspopup=${o?"true":p}
|
|
2457
|
+
aria-controls=${o?"network-dropdown":p}
|
|
2458
|
+
>
|
|
2459
|
+
<img
|
|
2460
|
+
class="network-icon"
|
|
2461
|
+
src=${this.getNetworkIconUrl(r)}
|
|
2462
|
+
alt=${r.displayName}
|
|
2463
|
+
/>
|
|
2464
|
+
${_(o,()=>d`
|
|
2465
|
+
<primer-icon
|
|
2466
|
+
class="caret ${this.isDropdownOpen?"open":""}"
|
|
2467
|
+
size="sm"
|
|
2468
|
+
name="chevron-down"
|
|
2469
|
+
></primer-icon>
|
|
2470
|
+
`,()=>p)}
|
|
2471
|
+
</button>
|
|
2472
|
+
|
|
2473
|
+
${_(this.isDropdownOpen,()=>d`
|
|
2474
|
+
<div
|
|
2475
|
+
${gr(this.dropdownRef)}
|
|
2476
|
+
id="network-dropdown"
|
|
2477
|
+
class="dropdown open"
|
|
2478
|
+
role="listbox"
|
|
2479
|
+
aria-label="Select card network"
|
|
2480
|
+
>
|
|
2481
|
+
${e.map((a,n)=>d`
|
|
2482
|
+
<div
|
|
2483
|
+
${gr(u=>this.setNetworkOptionRef(u,n))}
|
|
2484
|
+
class="network-option ${this.isKeyboardNavigation&&n===this.focusedNetworkIndex?"focused":""}"
|
|
2485
|
+
@click=${u=>this.selectNetwork(u,a)}
|
|
2486
|
+
@keydown=${u=>{(u.key==="Enter"||u.key===" ")&&this.selectNetwork(u,a)}}
|
|
2487
|
+
role="option"
|
|
2488
|
+
aria-selected=${a.network===r.network}
|
|
2489
|
+
tabindex="${n===this.focusedNetworkIndex?"0":"-1"}"
|
|
2490
|
+
>
|
|
2491
|
+
<img
|
|
2492
|
+
class="network-option-icon"
|
|
2493
|
+
src=${this.getNetworkIconUrl(a)}
|
|
2494
|
+
alt=${a.displayName}
|
|
2495
|
+
/>
|
|
2496
|
+
<span class="network-name">${a.displayName}</span>
|
|
2497
|
+
${_(a.network===r.network,()=>d`
|
|
2498
|
+
<primer-icon
|
|
2499
|
+
class="checkmark"
|
|
2500
|
+
name="checkmark"
|
|
2501
|
+
size="sm"
|
|
2502
|
+
></primer-icon>
|
|
2503
|
+
`,()=>p)}
|
|
2504
|
+
</div>
|
|
2505
|
+
`)}
|
|
2569
2506
|
</div>
|
|
2570
|
-
|
|
2507
|
+
`,()=>p)}
|
|
2508
|
+
`}};z.styles=[v,Do],s([f({context:Pt,subscribe:!0})],z.prototype,"cardNetworks",2),s([f({context:$,subscribe:!0})],z.prototype,"headlessUtils",2),s([x()],z.prototype,"selectedCardNetwork",2),s([x()],z.prototype,"isDropdownOpen",2),s([x()],z.prototype,"focusedNetworkIndex",2),s([x()],z.prototype,"isKeyboardNavigation",2),z=s([h("primer-card-network-selector")],z);var Vo=c`
|
|
2571
2509
|
:host {
|
|
2572
2510
|
display: block;
|
|
2573
2511
|
margin-top: var(--primer-space-medium);
|
|
@@ -2587,332 +2525,163 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
|
|
|
2587
2525
|
justify-content: center;
|
|
2588
2526
|
align-items: center;
|
|
2589
2527
|
}
|
|
2590
|
-
`;var
|
|
2528
|
+
`;var Ve=class extends m{constructor(){super(...arguments);this.vaultManager=null}render(){return this.vaultManager?.isLoading?p:!this.vaultManager||!this.vaultManager.enabled?d`<slot name="other-payments"></slot>`:d`
|
|
2591
2529
|
<div class="other-payment-methods-container">
|
|
2592
2530
|
<primer-collapsable
|
|
2593
2531
|
buttonVariant="secondary"
|
|
2594
2532
|
.expanded="${this.vaultManager?.vaultedPaymentMethods.length===0}"
|
|
2595
|
-
.header="${
|
|
2533
|
+
.header="${y("navigateToPaymentMethods",{id:"navigateToPaymentMethods"})}"
|
|
2596
2534
|
>
|
|
2597
2535
|
<div class="other-payment-methods-content">
|
|
2598
2536
|
<slot name="other-payments"></slot>
|
|
2599
2537
|
</div>
|
|
2600
2538
|
</primer-collapsable>
|
|
2601
2539
|
</div>
|
|
2602
|
-
`}};
|
|
2540
|
+
`}};Ve.styles=[Vo],s([f({context:U,subscribe:!0}),l({type:Object,attribute:!1})],Ve.prototype,"vaultManager",2),Ve=s([h("primer-show-other-payments")],Ve);var Ho=c`
|
|
2541
|
+
:host {
|
|
2542
|
+
height: calc(
|
|
2543
|
+
var(--primer-typography-title-large-line-height) +
|
|
2544
|
+
calc(2 * var(--primer-space-medium))
|
|
2545
|
+
);
|
|
2546
|
+
display: flex;
|
|
2547
|
+
}
|
|
2548
|
+
|
|
2549
|
+
.native-button-container {
|
|
2550
|
+
width: 100%;
|
|
2551
|
+
height: 100%;
|
|
2552
|
+
flex: 1;
|
|
2553
|
+
}
|
|
2554
|
+
`;var se=class extends m{constructor(){super();this.paymentManagers=new Map;this.computedStyles=null;this._buttonId="button-container";this.loadManagerTask=new M(this,{args:()=>[this.paymentMethod?.type],task:async([e])=>{if(!e)return E;let r=this.paymentManagers.get(e)?.manager;if(!r)throw new Error(`No manager found for payment method type ${e}`);return r}}),new M(this,{args:()=>[this.loadManagerTask.value],task:async([e])=>{if(!e)return E;await this.updateComplete;let r=this.shadowRoot?.getElementById(this._buttonId);if(!r)return;let o=this.calculateButtonHeight(),a=e.createButton(),n=this.createRenderOptions(o);return await a.render(this.paymentMethod?.type==="GOOGLE_PAY"?this.shadowRoot?.getRootNode():r,n),e}})}calculateButtonHeight(){if(typeof window>"u"||!this.isConnected||!this.computedStyles)return 0;let e=parseFloat(this.computedStyles.getPropertyValue("--primer-typography-title-large-line-height")),r=parseFloat(this.computedStyles.getPropertyValue("--primer-space-medium"));return e+2*r}createRenderOptions(e){let r=this.paymentMethod?.type;return r==="GOOGLE_PAY"?{style:{shadowRoot:!0}}:r==="APPLE_PAY"?{style:{buttonHeight:e}}:r==="PAYPAL"?{style:{buttonHeight:e}}:{style:{buttonHeight:e}}}updated(e){e.has("paymentMethod")&&this.paymentMethod&&(this._buttonId=`button-container-${this.paymentMethod.type}`)}render(){return this.loadManagerTask.render({error:()=>p,complete:()=>d`
|
|
2555
|
+
<!-- The native button container is rendered first -->
|
|
2556
|
+
<div class="native-button-container" id="${this._buttonId}"></div>
|
|
2557
|
+
`,pending:()=>p})}};se.styles=[v,Ho],s([l({type:Object})],se.prototype,"paymentMethod",2),s([f({context:Y,subscribe:!0}),l()],se.prototype,"paymentManagers",2),s([f({context:Pe,subscribe:!0}),l()],se.prototype,"computedStyles",2),se=s([h("primer-native-payment")],se);var ot=class extends m{render(){return d`
|
|
2603
2558
|
<primer-checkout-state type="complete"></primer-checkout-state>
|
|
2604
|
-
`}};
|
|
2559
|
+
`}};ot=s([h("primer-checkout-complete")],ot);var Ze=class extends m{constructor(){super(...arguments);this.sdkState=null}render(){return d`
|
|
2605
2560
|
<primer-checkout-state
|
|
2606
2561
|
type="failure"
|
|
2607
2562
|
description=${this.sdkState?.error?.message||""}
|
|
2608
2563
|
></primer-checkout-state>
|
|
2609
|
-
`}};s([
|
|
2564
|
+
`}};s([f({context:T,subscribe:!0}),l()],Ze.prototype,"sdkState",2),Ze=s([h("primer-checkout-error")],Ze);var zo=c`
|
|
2610
2565
|
:host {
|
|
2611
2566
|
display: block;
|
|
2612
2567
|
width: 100%;
|
|
2613
2568
|
}
|
|
2614
|
-
`;var
|
|
2569
|
+
`;var Ee=class extends m{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`
|
|
2615
2570
|
<primer-error-message
|
|
2616
|
-
message="${
|
|
2571
|
+
message="${y(this.sdkState.failure?.message??"",{id:"tokenizationError"})}"
|
|
2617
2572
|
?visible="${this.shouldShowError}"
|
|
2618
2573
|
></primer-error-message>
|
|
2619
|
-
`:
|
|
2620
|
-
|
|
2621
|
-
|
|
2622
|
-
|
|
2623
|
-
(**
|
|
2624
|
-
* @license
|
|
2625
|
-
* Copyright 2021 Google LLC
|
|
2626
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
2627
|
-
*)
|
|
2628
|
-
|
|
2629
|
-
@lit/context/lib/create-context.js:
|
|
2630
|
-
(**
|
|
2631
|
-
* @license
|
|
2632
|
-
* Copyright 2021 Google LLC
|
|
2633
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
2634
|
-
*)
|
|
2635
|
-
|
|
2636
|
-
@lit/context/lib/controllers/context-consumer.js:
|
|
2637
|
-
(**
|
|
2638
|
-
* @license
|
|
2639
|
-
* Copyright 2021 Google LLC
|
|
2640
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
2641
|
-
*)
|
|
2642
|
-
|
|
2643
|
-
@lit/context/lib/value-notifier.js:
|
|
2644
|
-
(**
|
|
2645
|
-
* @license
|
|
2646
|
-
* Copyright 2021 Google LLC
|
|
2647
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
2648
|
-
*)
|
|
2649
|
-
|
|
2650
|
-
@lit/context/lib/controllers/context-provider.js:
|
|
2651
|
-
(**
|
|
2652
|
-
* @license
|
|
2653
|
-
* Copyright 2021 Google LLC
|
|
2654
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
2655
|
-
*)
|
|
2656
|
-
|
|
2657
|
-
@lit/context/lib/context-root.js:
|
|
2658
|
-
(**
|
|
2659
|
-
* @license
|
|
2660
|
-
* Copyright 2021 Google LLC
|
|
2661
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
2662
|
-
*)
|
|
2663
|
-
|
|
2664
|
-
@lit/context/lib/decorators/provide.js:
|
|
2665
|
-
(**
|
|
2666
|
-
* @license
|
|
2667
|
-
* Copyright 2017 Google LLC
|
|
2668
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
2669
|
-
*)
|
|
2670
|
-
|
|
2671
|
-
@lit/context/lib/decorators/consume.js:
|
|
2672
|
-
(**
|
|
2673
|
-
* @license
|
|
2674
|
-
* Copyright 2022 Google LLC
|
|
2675
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
2676
|
-
*)
|
|
2677
|
-
|
|
2678
|
-
@lit/reactive-element/css-tag.js:
|
|
2679
|
-
(**
|
|
2680
|
-
* @license
|
|
2681
|
-
* Copyright 2019 Google LLC
|
|
2682
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
2683
|
-
*)
|
|
2574
|
+
`:p}};Ee.styles=[zo],s([f({context:T,subscribe:!0}),x()],Ee.prototype,"sdkState",2),s([l({type:Boolean,attribute:"show-processing-errors"})],Ee.prototype,"showProcessingErrors",2),Ee=s([h("primer-error-message-container")],Ee);var Yo=c`
|
|
2575
|
+
:host {
|
|
2576
|
+
display: contents;
|
|
2577
|
+
}
|
|
2684
2578
|
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
*)
|
|
2579
|
+
.primer-main-list {
|
|
2580
|
+
display: flex;
|
|
2581
|
+
flex-direction: column;
|
|
2582
|
+
gap: var(--primer-space-small);
|
|
2583
|
+
}
|
|
2691
2584
|
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
2697
|
-
*)
|
|
2585
|
+
.primer-is-processing {
|
|
2586
|
+
opacity: 0.5;
|
|
2587
|
+
pointer-events: none;
|
|
2588
|
+
}
|
|
2698
2589
|
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
|
|
2704
|
-
|
|
2590
|
+
primer-vault-manager {
|
|
2591
|
+
margin-bottom: var(--primer-space-xlarge);
|
|
2592
|
+
}
|
|
2593
|
+
`;var Se=class extends m{constructor(){super(...arguments);this.hasAssignedContent=!1;this.onSlotChange=e=>{let o=e.target.assignedNodes({flatten:!0});this.hasAssignedContent=o.length>0,this.requestUpdate()};this.paymentMethods=null;this.sdkState=null}render(){return this.sdkState?.isSuccessful?d`
|
|
2594
|
+
<slot name="checkout-complete">
|
|
2595
|
+
<primer-checkout-complete></primer-checkout-complete>
|
|
2596
|
+
</slot>
|
|
2597
|
+
`:d`
|
|
2598
|
+
<slot name="payments" @slotchange=${this.onSlotChange}></slot>
|
|
2599
|
+
${_(this.hasAssignedContent,()=>p,()=>d`
|
|
2600
|
+
<div
|
|
2601
|
+
class=${R({"primer-is-processing":!!this.sdkState?.isProcessing})}
|
|
2602
|
+
>
|
|
2603
|
+
<primer-vault-manager></primer-vault-manager>
|
|
2604
|
+
<primer-show-other-payments>
|
|
2605
|
+
<div slot="other-payments" class="primer-main-list">
|
|
2606
|
+
${this.paymentMethods?.toArray().map(e=>d`
|
|
2607
|
+
<primer-payment-method
|
|
2608
|
+
type=${e.type}
|
|
2609
|
+
></primer-payment-method>
|
|
2610
|
+
`)}
|
|
2611
|
+
</div>
|
|
2612
|
+
</primer-show-other-payments>
|
|
2613
|
+
<primer-error-message-container></primer-error-message-container>
|
|
2614
|
+
</div>
|
|
2615
|
+
`)}
|
|
2616
|
+
`}};Se.styles=[v,Yo],s([f({context:et,subscribe:!0}),l()],Se.prototype,"paymentMethods",2),s([f({context:T,subscribe:!0}),l()],Se.prototype,"sdkState",2),Se=s([h("primer-main")],Se);async function CE(){Yi(),Ui()}export{j as AchPayment,K as Button,te as CardForm,be as CardFormCVV,z as CardFormCardNetworkSelector,ve as CardFormCardNumber,ue as CardFormError,xe as CardFormExpiry,Ce as CardFormName,H as CardFormSubmit,F as Collapsable,We as Dialog,J as DynamicPayment,X as ErrorMessage,Ee as ErrorMessageContainer,Qt as InitializedPayments,k as Input,he as InputLabel,ie as InputWrapper,se as NativePayment,fe as PaymentMethod,$e as Portal,ot as PrimerCheckoutComplete,W as PrimerCheckoutComponent,Ze as PrimerCheckoutFailure,ge as PrimerCheckoutState,oe as PrimerIcon,D as PrimerKlarna,Se as PrimerMain,Q as RedirectPayment,Ve as ShowOtherPayments,re as Spinner,N as VaultCvvInput,q as VaultDeleteConfirmation,ye as VaultEmptyState,ae as VaultErrorMessage,G as VaultManager,ee as VaultManagerHeader,B as VaultPaymentMethodItem,I as VaultPaymentSubmit,La as injectDarkTheme,Ta as injectLightTheme,Yi as injectLoaderStyles,Ui as injectThemeStyles,CE as loadPrimer};
|
|
2617
|
+
/*! Bundled license information:
|
|
2705
2618
|
|
|
2619
|
+
@lit/context/lib/context-request-event.js:
|
|
2620
|
+
@lit/context/lib/create-context.js:
|
|
2621
|
+
@lit/context/lib/controllers/context-consumer.js:
|
|
2622
|
+
@lit/context/lib/value-notifier.js:
|
|
2623
|
+
@lit/context/lib/controllers/context-provider.js:
|
|
2624
|
+
@lit/context/lib/context-root.js:
|
|
2625
|
+
@lit/localize/internal/locale-status-event.js:
|
|
2706
2626
|
@lit/localize/internal/str-tag.js:
|
|
2707
|
-
(**
|
|
2708
|
-
* @license
|
|
2709
|
-
* Copyright 2021 Google LLC
|
|
2710
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
2711
|
-
*)
|
|
2712
|
-
|
|
2713
2627
|
@lit/localize/internal/types.js:
|
|
2714
|
-
(**
|
|
2715
|
-
* @license
|
|
2716
|
-
* Copyright 2021 Google LLC
|
|
2717
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
2718
|
-
*)
|
|
2719
|
-
|
|
2720
2628
|
@lit/localize/internal/default-msg.js:
|
|
2721
|
-
(**
|
|
2722
|
-
* @license
|
|
2723
|
-
* Copyright 2021 Google LLC
|
|
2724
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
2725
|
-
*)
|
|
2726
|
-
|
|
2727
2629
|
@lit/localize/internal/localized-controller.js:
|
|
2728
|
-
(**
|
|
2729
|
-
* @license
|
|
2730
|
-
* Copyright 2021 Google LLC
|
|
2731
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
2732
|
-
*)
|
|
2733
|
-
|
|
2734
2630
|
@lit/localize/internal/localized-decorator.js:
|
|
2735
|
-
(**
|
|
2736
|
-
* @license
|
|
2737
|
-
* Copyright 2021 Google LLC
|
|
2738
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
2739
|
-
*)
|
|
2740
|
-
|
|
2741
|
-
@lit/localize/internal/deferred.js:
|
|
2742
|
-
(**
|
|
2743
|
-
* @license
|
|
2744
|
-
* Copyright 2020 Google LLC
|
|
2745
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
2746
|
-
*)
|
|
2747
|
-
|
|
2748
|
-
@lit/localize/internal/fnv1a64.js:
|
|
2749
|
-
(**
|
|
2750
|
-
* @license
|
|
2751
|
-
* Copyright 2014 Travis Webb
|
|
2752
|
-
* SPDX-License-Identifier: MIT
|
|
2753
|
-
*)
|
|
2754
|
-
|
|
2755
|
-
@lit/localize/internal/id-generation.js:
|
|
2756
|
-
(**
|
|
2757
|
-
* @license
|
|
2758
|
-
* Copyright 2020 Google LLC
|
|
2759
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
2760
|
-
*)
|
|
2761
|
-
|
|
2762
2631
|
@lit/localize/internal/runtime-msg.js:
|
|
2763
|
-
(**
|
|
2764
|
-
* @license
|
|
2765
|
-
* Copyright 2021 Google LLC
|
|
2766
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
2767
|
-
*)
|
|
2768
|
-
|
|
2769
2632
|
@lit/localize/init/runtime.js:
|
|
2770
|
-
(**
|
|
2771
|
-
* @license
|
|
2772
|
-
* Copyright 2021 Google LLC
|
|
2773
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
2774
|
-
*)
|
|
2775
|
-
|
|
2776
2633
|
@lit/localize/init/transform.js:
|
|
2634
|
+
@lit/reactive-element/decorators/query-assigned-elements.js:
|
|
2635
|
+
lit-html/directives/when.js:
|
|
2777
2636
|
(**
|
|
2778
2637
|
* @license
|
|
2779
2638
|
* Copyright 2021 Google LLC
|
|
2780
2639
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
2781
2640
|
*)
|
|
2782
2641
|
|
|
2783
|
-
@lit/
|
|
2784
|
-
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
2788
|
-
*)
|
|
2789
|
-
|
|
2642
|
+
@lit/context/lib/decorators/provide.js:
|
|
2643
|
+
@lit/reactive-element/reactive-element.js:
|
|
2644
|
+
@lit/task/task.js:
|
|
2645
|
+
@lit/reactive-element/reactive-element.js:
|
|
2790
2646
|
lit-html/lit-html.js:
|
|
2791
|
-
(**
|
|
2792
|
-
* @license
|
|
2793
|
-
* Copyright 2017 Google LLC
|
|
2794
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
2795
|
-
*)
|
|
2796
|
-
|
|
2797
2647
|
lit-element/lit-element.js:
|
|
2798
|
-
(**
|
|
2799
|
-
* @license
|
|
2800
|
-
* Copyright 2017 Google LLC
|
|
2801
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
2802
|
-
*)
|
|
2803
|
-
|
|
2804
|
-
lit-html/is-server.js:
|
|
2805
|
-
(**
|
|
2806
|
-
* @license
|
|
2807
|
-
* Copyright 2022 Google LLC
|
|
2808
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
2809
|
-
*)
|
|
2810
|
-
|
|
2811
2648
|
@lit/reactive-element/decorators/custom-element.js:
|
|
2812
|
-
(**
|
|
2813
|
-
* @license
|
|
2814
|
-
* Copyright 2017 Google LLC
|
|
2815
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
2816
|
-
*)
|
|
2817
|
-
|
|
2818
2649
|
@lit/reactive-element/decorators/property.js:
|
|
2819
|
-
(**
|
|
2820
|
-
* @license
|
|
2821
|
-
* Copyright 2017 Google LLC
|
|
2822
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
2823
|
-
*)
|
|
2824
|
-
|
|
2825
2650
|
@lit/reactive-element/decorators/state.js:
|
|
2826
|
-
(**
|
|
2827
|
-
* @license
|
|
2828
|
-
* Copyright 2017 Google LLC
|
|
2829
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
2830
|
-
*)
|
|
2831
|
-
|
|
2832
2651
|
@lit/reactive-element/decorators/event-options.js:
|
|
2833
|
-
(**
|
|
2834
|
-
* @license
|
|
2835
|
-
* Copyright 2017 Google LLC
|
|
2836
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
2837
|
-
*)
|
|
2838
|
-
|
|
2839
2652
|
@lit/reactive-element/decorators/base.js:
|
|
2840
|
-
(**
|
|
2841
|
-
* @license
|
|
2842
|
-
* Copyright 2017 Google LLC
|
|
2843
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
2844
|
-
*)
|
|
2845
|
-
|
|
2846
2653
|
@lit/reactive-element/decorators/query.js:
|
|
2847
|
-
(**
|
|
2848
|
-
* @license
|
|
2849
|
-
* Copyright 2017 Google LLC
|
|
2850
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
2851
|
-
*)
|
|
2852
|
-
|
|
2853
2654
|
@lit/reactive-element/decorators/query-all.js:
|
|
2854
|
-
(**
|
|
2855
|
-
* @license
|
|
2856
|
-
* Copyright 2017 Google LLC
|
|
2857
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
2858
|
-
*)
|
|
2859
|
-
|
|
2860
2655
|
@lit/reactive-element/decorators/query-async.js:
|
|
2861
|
-
(**
|
|
2862
|
-
* @license
|
|
2863
|
-
* Copyright 2017 Google LLC
|
|
2864
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
2865
|
-
*)
|
|
2866
|
-
|
|
2867
|
-
@lit/reactive-element/decorators/query-assigned-elements.js:
|
|
2868
|
-
(**
|
|
2869
|
-
* @license
|
|
2870
|
-
* Copyright 2021 Google LLC
|
|
2871
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
2872
|
-
*)
|
|
2873
|
-
|
|
2874
2656
|
@lit/reactive-element/decorators/query-assigned-nodes.js:
|
|
2875
|
-
(**
|
|
2876
|
-
* @license
|
|
2877
|
-
* Copyright 2017 Google LLC
|
|
2878
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
2879
|
-
*)
|
|
2880
|
-
|
|
2881
|
-
lit-html/directives/when.js:
|
|
2882
|
-
(**
|
|
2883
|
-
* @license
|
|
2884
|
-
* Copyright 2021 Google LLC
|
|
2885
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
2886
|
-
*)
|
|
2887
|
-
|
|
2888
2657
|
lit-html/directive.js:
|
|
2658
|
+
lit-html/async-directive.js:
|
|
2889
2659
|
(**
|
|
2890
2660
|
* @license
|
|
2891
2661
|
* Copyright 2017 Google LLC
|
|
2892
2662
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
2893
2663
|
*)
|
|
2894
2664
|
|
|
2895
|
-
lit
|
|
2896
|
-
|
|
2897
|
-
* @license
|
|
2898
|
-
* Copyright 2018 Google LLC
|
|
2899
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
2900
|
-
*)
|
|
2901
|
-
|
|
2902
|
-
lit-html/directive-helpers.js:
|
|
2665
|
+
@lit/context/lib/decorators/consume.js:
|
|
2666
|
+
lit-html/is-server.js:
|
|
2903
2667
|
(**
|
|
2904
2668
|
* @license
|
|
2905
|
-
* Copyright
|
|
2669
|
+
* Copyright 2022 Google LLC
|
|
2906
2670
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
2907
2671
|
*)
|
|
2908
2672
|
|
|
2909
|
-
lit-
|
|
2673
|
+
@lit/reactive-element/css-tag.js:
|
|
2674
|
+
@lit/reactive-element/css-tag.js:
|
|
2910
2675
|
(**
|
|
2911
2676
|
* @license
|
|
2912
|
-
* Copyright
|
|
2677
|
+
* Copyright 2019 Google LLC
|
|
2913
2678
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
2914
2679
|
*)
|
|
2915
2680
|
|
|
2681
|
+
@lit/localize/internal/deferred.js:
|
|
2682
|
+
@lit/localize/internal/id-generation.js:
|
|
2683
|
+
@lit/localize/lit-localize.js:
|
|
2684
|
+
lit-html/directive-helpers.js:
|
|
2916
2685
|
lit-html/directives/ref.js:
|
|
2917
2686
|
(**
|
|
2918
2687
|
* @license
|
|
@@ -2920,31 +2689,17 @@ lit-html/directives/ref.js:
|
|
|
2920
2689
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
2921
2690
|
*)
|
|
2922
2691
|
|
|
2923
|
-
lit
|
|
2924
|
-
(**
|
|
2925
|
-
* @license
|
|
2926
|
-
* Copyright 2017 Google LLC
|
|
2927
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
2928
|
-
*)
|
|
2929
|
-
|
|
2930
|
-
lit-html/directive.js:
|
|
2931
|
-
(**
|
|
2932
|
-
* @license
|
|
2933
|
-
* Copyright 2017 Google LLC
|
|
2934
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
2935
|
-
*)
|
|
2936
|
-
|
|
2937
|
-
lit-html/directive-helpers.js:
|
|
2692
|
+
@lit/localize/internal/fnv1a64.js:
|
|
2938
2693
|
(**
|
|
2939
2694
|
* @license
|
|
2940
|
-
* Copyright
|
|
2941
|
-
* SPDX-License-Identifier:
|
|
2695
|
+
* Copyright 2014 Travis Webb
|
|
2696
|
+
* SPDX-License-Identifier: MIT
|
|
2942
2697
|
*)
|
|
2943
2698
|
|
|
2944
|
-
lit-html/
|
|
2699
|
+
lit-html/directives/class-map.js:
|
|
2945
2700
|
(**
|
|
2946
2701
|
* @license
|
|
2947
|
-
* Copyright
|
|
2702
|
+
* Copyright 2018 Google LLC
|
|
2948
2703
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
2949
2704
|
*)
|
|
2950
2705
|
*/
|