@primer-io/primer-js 0.1.0 → 0.1.2
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 +1 -0
- package/dist/chunks/bg.2EL2HTYI.js +1 -0
- package/dist/chunks/ca.WZI7CBFW.js +1 -0
- package/dist/chunks/chunk.G45OCYEN.js +1 -0
- package/dist/chunks/chunk.QMLIEEKM.js +2 -0
- package/dist/chunks/cs.GBLLNC3E.js +1 -0
- package/dist/chunks/da.CDEFQG44.js +1 -0
- package/dist/chunks/de.UHURA2HV.js +1 -0
- package/dist/chunks/el.BY5NGYDF.js +1 -0
- package/dist/chunks/en-GB.UBLLAUVW.js +1 -0
- package/dist/chunks/en.BKAVPUID.js +1 -0
- package/dist/chunks/es-AR.EYNC6EAZ.js +1 -0
- package/dist/chunks/es-MX.OIO2YURF.js +1 -0
- package/dist/chunks/es.CNNIJYLX.js +1 -0
- package/dist/chunks/et-EE.4ZF6CLB6.js +1 -0
- package/dist/chunks/fi-FI.4ZXWRRYI.js +1 -0
- package/dist/chunks/fr.TZM5I4K2.js +1 -0
- package/dist/chunks/he.DWEZBG4A.js +1 -0
- package/dist/chunks/hr.BV4PC324.js +1 -0
- package/dist/chunks/hu.MTEKSS3J.js +1 -0
- package/dist/chunks/id.SJSTOPSC.js +1 -0
- package/dist/chunks/it.IISTMHN5.js +1 -0
- package/dist/chunks/ja.IBQ3ID5C.js +1 -0
- package/dist/chunks/ko.KZVQLI4V.js +1 -0
- package/dist/chunks/lt-LT.RKBB7CZ6.js +1 -0
- package/dist/chunks/lt.TLM7OCXP.js +1 -0
- package/dist/chunks/lv-LV.H5TJC2T4.js +1 -0
- package/dist/chunks/lv.G4SRVBAC.js +1 -0
- package/dist/chunks/ms.ATTITA66.js +1 -0
- package/dist/chunks/nb.5EE7XOA7.js +1 -0
- package/dist/chunks/nl.TY2SYTKZ.js +1 -0
- package/dist/chunks/nl_NL.GB5BQ5PG.js +1 -0
- package/dist/chunks/pl.5PRBSG4K.js +3 -0
- package/dist/chunks/pt-BR.5XRZB5WW.js +1 -0
- package/dist/chunks/pt.TA5H5JUJ.js +1 -0
- package/dist/chunks/ro.PSZKGHRP.js +1 -0
- package/dist/chunks/ru.3QZY7ZIT.js +1 -0
- package/dist/chunks/sk.FAQFYLGM.js +1 -0
- package/dist/chunks/sl.QRSCQXJP.js +1 -0
- package/dist/chunks/sr-RS.TKMMG7FK.js +1 -0
- package/dist/chunks/sv.HZ3E6V5F.js +1 -0
- package/dist/chunks/th.AY6M42B4.js +1 -0
- package/dist/chunks/tr.TFKBPYMO.js +1 -0
- package/dist/chunks/uk-UA.3TU67RSI.js +1 -0
- package/dist/chunks/vi.NLXELMXV.js +1 -0
- package/dist/chunks/zf.U5XPENNR.js +1 -0
- package/dist/chunks/zh-CN.VEOQJ3EU.js +1 -0
- package/dist/chunks/zh-HK.ZEXSW7FF.js +1 -0
- package/dist/chunks/zh-TW.MMVWEQMZ.js +1 -0
- package/dist/custom-elements.json +2893 -1230
- package/dist/primer-loader.d.ts +228 -36
- package/dist/primer-loader.js +2287 -5
- package/dist/web-types.json +1 -1
- package/package.json +1 -1
package/dist/primer-loader.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
var c="https://sdk.primer.io/web/v2-latest/Primer.min.js",d="https://sdk.primer.io/web/primer-js/v0-latest/primer-components.js";var p=typeof window<"u"&&typeof window.document<"u";function h(r){return document.querySelector(`script[src^="${r}"]`)}function v(r,o){let e=document.createElement("script");return e.setAttribute("src",r),e.setAttribute("async",""),e.setAttribute("crossorigin","anonymous"),o&&e.setAttribute("type","module"),e}function a(r,o=!1){if(!p)throw new Error("Cannot load script in server environment");let e=h(r)??v(r,o);return new Promise((m,t)=>{e.onload=()=>{m()},e.onerror=()=>{t()},e.parentNode||document.head.appendChild(e)})}function x(r){return document.querySelector(`#${r}`)}function S(r,o){let e=document.createElement("style");return e.textContent=r,e.id=o,e}function i(r,o,e=!0){if(!p||x(o))return;let t=S(r,o);e&&document.head.firstChild?document.head.insertBefore(t,document.head.firstChild):document.head.appendChild(t)}var s=`
|
|
1
|
+
import{a as Uo,b as tn,c as Dr,d as n}from"./chunks/chunk.G45OCYEN.js";var Ar=tn((Vt,co)=>{(function(o,t){typeof Vt=="object"&&typeof co=="object"?co.exports=t():typeof define=="function"&&define.amd?define([],t):typeof Vt=="object"?Vt.Primer=t():o.Primer=t()})(Vt,()=>(()=>{"use strict";let o;var t,e,r={};r.d=(a,l)=>{for(var p in l)r.o(l,p)&&!r.o(a,p)&&Object.defineProperty(a,p,{enumerable:!0,get:l[p]})},r.o=(a,l)=>Object.prototype.hasOwnProperty.call(a,l),r.r=a=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(a,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(a,"__esModule",{value:!0})};var i={};r.r(i),r.d(i,{SuccessScreenType:()=>Wa,PaymentFlow:()=>Ka,ThreeDSecureStatus:()=>ja,TokenType:()=>Ga,isStripeOptionsDropInWithFullMandateText:()=>Za,PaymentInstrumentType:()=>yt,ErrorCode:()=>qa,EventTypes:()=>Xa,CheckoutUXFlow:()=>Fa,HeadlessManagerType:()=>Ja,PaymentMethodType:()=>bt,Primer:()=>Qa});let s={LEGACY:"legacy",V_2_4:"2.4"},c=s.V_2_4,x=c;class h extends Error{static from(l,p=!1){if(l instanceof h)return l;let b=new h(l instanceof Error?l.message:String(l),p);return l instanceof Error&&l.stack&&(b.stack=l.stack,Object.assign(b,l)),b}markAsReported(){this.isReported=!0}constructor(l,p=!1){super(l),function(b,A,E){A in b?Object.defineProperty(b,A,{value:E,enumerable:!0,configurable:!0,writable:!0}):b[A]=E}(this,"isReported",void 0),this.isReported=p,this.name=this.constructor.name,Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}}let R="https://analytics.production.data.primer.io/sdk-logs";var z=function(a){return a.REQUEST_START="REQUEST_START",a.REQUEST_END="REQUEST_END",a}({}),O=function(a){return a.START="START",a.END="END",a}({});let Q={createHeadless:"HEADLESS_LOADING",showUniversalCheckout:"DROP_IN_LOADING",showVaultManager:"VAULT_MANAGER_LOADING",preloadPrimer:"PRELOAD_PRIMER_LOADING"};var B=function(a){return a.NETWORK_CALL_EVENT="NETWORK_CALL_EVENT",a.CRASH_EVENT="CRASH_EVENT",a.TIMER_EVENT="TIMER_EVENT",a.MESSAGE_EVENT="MESSAGE_EVENT",a.V1_EVENT="V1_EVENT",a.SDK_FUNCTION_EVENT="SDK_FUNCTION_EVENT",a}({});async function Xe(){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 ua={get(a,l){let p;try{switch(a){case"PRIMER_SDK_VERSION":p="v2.53.2";break;case"PRIMER_ASSETS_URL":p=process.env.PRIMER_ASSETS_URL;break;case"PRIMER_BUILD_INTEGRATION_BUILDER":p=process.env.PRIMER_BUILD_INTEGRATION_BUILDER}}catch{}return p||l}}.get("PRIMER_SDK_VERSION");async function uo(a,l,p){return{...p,createdAt:Date.now(),device:await Xe(),eventType:a,properties:l,sdkVersion:ua,sdkType:"WEB"}}let ho=Symbol.for("__primerAnalytics__"),gt={providers:new Map,timers:new Map,eventsQueue:new Map};if(typeof window<"u"){let a=window[ho];a?gt=a:window[ho]=gt}let go=()=>gt.providers,_r=()=>gt.timers,ft=()=>gt.eventsQueue,Yt=new Map;function Sr(a,l=!1,p=1){Yt.has(a)&&(clearTimeout(Yt.get(a)),Yt.delete(a));let b=()=>{let E=ft().get(a);if(E?.length){let y=!0,M=[],k=0,_=0;for(;_<E.length;){let L=E[_],H=new Blob([JSON.stringify(L)]).size;if(H>64e3){console.error("Event size exceeds maximum payload size and will be skipped:",L),_++;continue}if(k+H>64e3&&M.length>0){try{y=navigator.sendBeacon(a,JSON.stringify(M))}catch(U){y=!1,console.error("Unable to send events",U)}if(!y)break;M=[],k=0}M.push(L),k+=H,_++}if(M.length>0&&y)try{y=navigator.sendBeacon(a,JSON.stringify(M))}catch(L){y=!1,console.error("Unable to send events",L)}y?ft().delete(a):p<5?setTimeout(()=>Sr(a,l,p+1),500*Math.pow(2,p)):console.error("Max retry attempts reached. Events will not be sent.")}};if(l)return void b();let A=setTimeout(b,500);Yt.set(a,A)}let fo=!1;function Pr({url:a=R,...l}){typeof document>"u"||fo||(document.addEventListener("visibilitychange",()=>{if(document.visibilityState==="hidden"){let A=Je(l.checkoutSessionId);A.messageEvent({messageType:"VISIBILITY_CHANGE",message:"Checkout visibility is hidden (tab or window change, redirect or being closed)."}),Sr(A.url,!0)}}),fo=!0);let p=A=>async E=>{if(typeof navigator>"u")return;let y=function k(_,L,H=new WeakSet,U=0,oe=10){if(U>oe||H.has(_))return _;H.add(_);let ie=te=>typeof te=="object"&&te!==null?k(te,L,H,U+1,oe):L(te);return Array.isArray(_)?_.map(ie):Object.fromEntries(Object.entries(_).map(([te,et])=>[te,ie(et)]))}(await uo(A,E,l),k=>{var _;return typeof(_=typeof k=="function"?k.name||"function":k)=="string"&&_.length>5120?`${_.slice(0,5120)}...`:_});ft().has(a)||ft().set(a,[]),ft().get(a)?.push(y),Sr(a)},b={crashEvent:p(B.CRASH_EVENT),messageEvent:p(B.MESSAGE_EVENT),networkCallEvent:p(B.NETWORK_CALL_EVENT),sdkFunctionEvent:p(B.SDK_FUNCTION_EVENT),timerStart:({id:A,...E})=>{let y=`${l.checkoutSessionId}|${A}`,M=performance?.now?performance.now():Date.now();return _r().set(y,{start:M}),p(B.TIMER_EVENT)({...E,id:A,timerType:O.START})},timerEnd:({id:A,...E})=>{let y=`${l.checkoutSessionId}|${A}`,{start:M}=_r().get(y)??{};_r().delete(y);let k=performance?.now?performance.now():Date.now();return p(B.TIMER_EVENT)({...E,id:A,timerType:O.END,duration:M?k-M:void 0})},v1Event:p(B.V1_EVENT),url:a};return go().set(l.checkoutSessionId,b),Je(l.checkoutSessionId)}function Je(a){return new Proxy({},{get:(l,p)=>(go().get(a)??Pr({checkoutSessionId:a}))[p]})}let Tr=(a,l,p,b)=>({callType:p?z.REQUEST_END:z.REQUEST_START,id:a,errorBody:p?.error&&JSON.stringify(p.error,Object.getOwnPropertyNames(p.error)),method:l.method,responseCode:p?.status,url:l.url,duration:b});function ha(a){return a?new Promise(l=>{setTimeout(l,a)}):Promise.resolve()}async function vo(a,l,p,b=ha){let A=0,E={enabled:l?.enabled??!1,maxRetries:8,initialBackoff:100,retryNetworkErrors:!0,retry500Errors:!1,maxJitter:100};if(!E.enabled)return a();for(;;)try{let y=await a();if(A){let M=`Request succeeded after ${A} retries.`;typeof y=="object"&&y&&"status"in y&&(M+=` Status code: ${y.status}`),p?.({messageType:"RETRY_SUCCESS",message:M,severity:"INFO"})}return y}catch(y){let M=A>=E.maxRetries,k=y.isNetworkError&&!E.retryNetworkErrors,_=y.status&&y.status>=500&&!E.retry500Errors;if(M||k||_){let U=`Failed after ${A} retries. `;throw M?U+=`Reached maximum retries (${E.maxRetries}).`:k?U+="Network error encountered and retryNetworkErrors is disabled.":_&&(U+="HTTP 500 error encountered and retry500Errors is disabled."),U+=` Last error: ${y.message}`,p?.({messageType:"RETRY_FAILED",message:U,severity:"ERROR",errorBody:JSON.stringify(y,Object.getOwnPropertyNames(y))}),Error(U,{cause:y})}A++;let L=Math.min(E.initialBackoff*Math.pow(2,A-1)+Math.random()*E.maxJitter,Number.MAX_SAFE_INTEGER),H="Unknown error";y.isNetworkError?H="Network error":y.status&&(H=`HTTP ${y.status} error`),p?.({messageType:"RETRY",message:`Retry attempt ${A}/${E.maxRetries} due to: ${H}. Error details: ${y.message}. Waiting for ${L.toFixed(2)}ms before next attempt.`,severity:"WARN",errorBody:JSON.stringify(y,Object.getOwnPropertyNames(y))}),await b(L)}}let wr={cache:new Map};typeof window<"u"&&((t=window)[e="__primerCache__"]??(t[e]=wr),wr=window.__primerCache__);let ee=()=>wr.cache;function yo(){if(ee().size<=30)return;let a=Date.now();for(let[l,p]of ee())p.exp<a&&ee().delete(l);if(ee().size>50)for(let[l]of ee()){if(ee().size<=50)break;ee().delete(l)}}let kr=()=>bo.randomUUID?.()||ga(),ga=()=>"10000000-1000-4000-8000-100000000000".replace(/[018]/g,a=>(a^fa()>>a/4).toString(16)),fa=()=>(bo.getRandomValues?.(new Uint8Array(1))[0]??16*Math.random())&15,bo=typeof crypto<"u"?crypto:{},va=(a,l,p)=>ya(a,"get",l,p),ya=async(a,l,p,b,A)=>{let E=kr(),y=performance?.now(),M=Je(a),k={method:l,url:p,body:A};M.networkCallEvent(Tr(E,k));try{let _=await fetch(p,{body:A,method:l,headers:{"content-type":"application/json","x-request-id":E,...b}});if(!_.ok){let U=Error(`HTTP error! status: ${_.status}`);throw U.status=_.status,U}let L=await _.json();if(p.includes("client-sdk/configuration")){let{primerAccountId:U,clientSession:{clientSessionId:oe,customer:ie}}=L;M=Pr({checkoutSessionId:a,clientSessionId:oe,customerId:ie?.customerId,primerAccountId:U,url:M.url})}let H=performance?.now();return M.networkCallEvent(Tr(E,k,{data:L},H-y)),{data:L,headers:_.headers,status:_.status,source:"NETWORK"}}catch(_){let L=performance?.now();throw Object.assign(_,{isNetworkError:_ instanceof TypeError}),M.networkCallEvent(Tr(E,k,{error:_},L-y)),_}},ba=(a,l)=>new Promise((p,b)=>{let A=setTimeout(()=>{let E=Error("Request timed out");E.isNetworkError=!0,b(E)},l);a.then(p).catch(b).finally(()=>clearTimeout(A))}),Ea=(a,l)=>{let{headers:p,retryConfig:b,cacheConfig:A,timeout:E=15e3,checkoutSessionId:y}=l,M=Je(y);return function(k){if(!k)return oe=>oe();let{key:_,refresh:L=!1,usePrimerSessionCacheTtlHeader:H=!1,ttl:U=36e5}=k;return async oe=>{let ie=Date.now(),te=ee().get(_);if(!L&&te&&te.exp>ie)return te.promise;te&&ee().delete(_);let et=oe().then(Et=>{let Vo=U;return H&&(Vo=1e3*(Number(Et.headers.get("x-primer-session-cache-ttl"))||0)),function({key:Ho,ttl:Yo=36e5},en){Yo?ee().set(Ho,{promise:Promise.resolve({...en,source:"CACHE"}),exp:Date.now()+Yo}):ee().delete(Ho)}({key:_,ttl:Vo},Et),yo(),Et},Et=>{throw ee().delete(_),Et});return ee().set(_,{promise:et,exp:ie+U}),yo(),et}}(A)(()=>vo(()=>ba(va(y,a,p),E),b,k=>M.messageEvent({...k,url:a})))},Qe=typeof Buffer=="function",Eo=typeof TextDecoder=="function"?new TextDecoder:void 0,xo=typeof TextEncoder=="function"?new TextEncoder:void 0,vt=Array.prototype.slice.call("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="),Ut=(a=>{let l={};return a.forEach((p,b)=>l[p]=b),l})(vt),xa=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,F=String.fromCharCode.bind(String),Co=typeof Uint8Array.from=="function"?Uint8Array.from.bind(Uint8Array):a=>new Uint8Array(Array.prototype.slice.call(a,0)),Ao=a=>a.replace(/=/g,"").replace(/[+\/]/g,l=>l=="+"?"-":"_"),Mo=a=>a.replace(/[^A-Za-z0-9\+\/]/g,""),_o=typeof btoa=="function"?a=>btoa(a):Qe?a=>Buffer.from(a,"binary").toString("base64"):a=>{let l,p,b,A,E="",y=a.length%3;for(let M=0;M<a.length;){if((p=a.charCodeAt(M++))>255||(b=a.charCodeAt(M++))>255||(A=a.charCodeAt(M++))>255)throw TypeError("invalid character found");E+=vt[(l=p<<16|b<<8|A)>>18&63]+vt[l>>12&63]+vt[l>>6&63]+vt[63&l]}return y?E.slice(0,y-3)+"===".substring(y):E},Ir=Qe?a=>Buffer.from(a).toString("base64"):a=>{let l=[];for(let p=0,b=a.length;p<b;p+=4096)l.push(F.apply(null,a.subarray(p,p+4096)));return _o(l.join(""))},jn=(a,l=!1)=>l?Ao(Ir(a)):Ir(a),Ca=a=>{if(a.length<2){var l=a.charCodeAt(0);return l<128?a:l<2048?F(192|l>>>6)+F(128|63&l):F(224|l>>>12&15)+F(128|l>>>6&63)+F(128|63&l)}var l=65536+(a.charCodeAt(0)-55296)*1024+(a.charCodeAt(1)-56320);return F(240|l>>>18&7)+F(128|l>>>12&63)+F(128|l>>>6&63)+F(128|63&l)},Aa=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,Ma=a=>a.replace(Aa,Ca),So=Qe?a=>Buffer.from(a,"utf8").toString("base64"):xo?a=>Ir(xo.encode(a)):a=>_o(Ma(a)),_a=(a,l=!1)=>l?Ao(So(a)):So(a),Sa=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,Pa=a=>{switch(a.length){case 4:var l=((7&a.charCodeAt(0))<<18|(63&a.charCodeAt(1))<<12|(63&a.charCodeAt(2))<<6|63&a.charCodeAt(3))-65536;return F((l>>>10)+55296)+F((1023&l)+56320);case 3:return F((15&a.charCodeAt(0))<<12|(63&a.charCodeAt(1))<<6|63&a.charCodeAt(2));default:return F((31&a.charCodeAt(0))<<6|63&a.charCodeAt(1))}},Ta=a=>a.replace(Sa,Pa),Po=typeof atob=="function"?a=>atob(Mo(a)):Qe?a=>Buffer.from(a,"base64").toString("binary"):a=>{if(a=a.replace(/\s+/g,""),!xa.test(a))throw TypeError("malformed base64.");a+="==".slice(2-(3&a.length));let l,p="",b,A;for(let E=0;E<a.length;)l=Ut[a.charAt(E++)]<<18|Ut[a.charAt(E++)]<<12|(b=Ut[a.charAt(E++)])<<6|(A=Ut[a.charAt(E++)]),p+=b===64?F(l>>16&255):A===64?F(l>>16&255,l>>8&255):F(l>>16&255,l>>8&255,255&l);return p},To=Qe?a=>Co(Buffer.from(a,"base64")):a=>Co(Po(a).split("").map(l=>l.charCodeAt(0))),Gn=a=>To(wo(a)),wa=Qe?a=>Buffer.from(a,"base64").toString("utf8"):Eo?a=>Eo.decode(To(a)):a=>Ta(Po(a)),wo=a=>Mo(a.replace(/[-_]/g,l=>l=="-"?"+":"/")),ka=a=>wa(wo(a)),qn=a=>({value:a,enumerable:!1,writable:!0,configurable:!0}),ko={encode:_a,decode:ka},Ia={encode:function(a,l={}){let{urlSafe:p=!1}=l;return ko.encode(a,p)},decode:ko.decode},Io="The provided `clientToken`",Na=`${Io} has expired`,La=`${Io} is malformed`,Ra=(a,l,p)=>({"primer-client-token":a,"primer-sdk-client":"WEB","primer-sdk-version":"v2.53.2","primer-sdk-checkout-session-id":l,...p&&{"x-api-version":p}});async function Oa(a,l,p){let{accessToken:b,configurationUrl:A,analyticsUrlV2:E}=function(_){let L=function(U){try{let[oe,ie]=U.split(".");return JSON.parse(Ia.decode(ie||oe))}catch{throw Error(La)}}(_),H=1e3*L.exp;if(Date.now()>H)throw Error(`${Na}. Expiration date: ${new Date(H).toISOString()}`);return L}(a),y=Pr({checkoutSessionId:l,url:E}),M=x,k=M!==s.LEGACY?M:"2.3";y.timerStart({id:"CONFIGURATION_LOADING"});try{let{data:_,source:L}=await Ea(`${A}/?withDisplayMetadata=true`,{checkoutSessionId:l,headers:Ra(b,l,k),retryConfig:{enabled:!0},cacheConfig:p});return y.timerEnd({id:"CONFIGURATION_LOADING",context:{source:L}}),_}catch(_){let L=_ instanceof Error?_.message:"Unknown error occurred";throw Error(`Failed to initialize client: ${L}`)}}function No(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 zt({checkoutSessionId:a,analytics:l,error:p,reporter:b}){l?.crashEvent?l.crashEvent({...No(p),reporter:b}):a&&Nr(a,p,b)}async function Nr(a,l,p){let b=await uo(B.CRASH_EVENT,{...No(l),reporter:p},{checkoutSessionId:a});try{await fetch(R,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(b)})}catch(A){console.error("Failed to post crash event",A)}}let Lo=Symbol.for("initGlobalErrorMonitoringLoaded"),Ro=(a,l)=>{typeof window<"u"&&window[Lo]||(window[Lo]=!0,window.addEventListener("error",p=>{!Da(p)&&$a(p)&&zt({checkoutSessionId:a,analytics:l,error:p.error,reporter:"window.onerror"})}),window.addEventListener("unhandledrejection",p=>{let b=p.reason||Error("Unhandled promise rejection");Va(b)&&zt({checkoutSessionId:a,analytics:l,error:b,reporter:"unhandledrejection"})}))},Da=a=>a.message==="Script error."||!a.filename||a.lineno===0,$a=a=>{let l=a.filename;return!!(l&&Lr(l))&&!!new h(a.error).isReported||!1},Va=a=>{if(a&&typeof a=="object"&&"stack"in a&&typeof a.stack=="string"){let l=h.from(a);return!l.isReported&&(!!("fileName"in a&&typeof a.fileName=="string"&&Lr(a.fileName))||Ha(l.stack).some(Lr))}return!1},Lr=a=>{try{return new URL(a,window.location.origin).hostname.endsWith(".primer.io")}catch{return!1}},Ha=a=>{if(!a)return[];let l=a.split(`
|
|
2
|
+
`),p=[],b=/^\s*at\s+(?:.*?\s+)?\(?(.+?):\d+:\d+\)?$/;for(let A of l){let E=A.match(b);if(E&&E[1])p.push(E[1]);else{let y=/@(.*?):\d+:\d+$/,M=A.match(y);M&&M[1]&&p.push(M[1])}}return p};function Oo(a,l,p){return document.querySelector(`${a}[${l}^="${p}"]`)}async function Do(a,l,p,b,A,E){let{analytics:y,name:M=l,retryConfig:k}=E;await vo(()=>new Promise((_,L)=>{let H=Oo(a,p,l)||function(U,oe){let ie=document.createElement(U);return Object.entries(oe).forEach(([te,et])=>ie.setAttribute(te,et)),ie}(a,{...b,[p]:l});H.onload=()=>{y?.sdkFunctionEvent({name:M,params:[`${a.charAt(0).toUpperCase()+a.slice(1)} loaded successfully: ${l}`]}),_()},H.onerror=()=>{H.remove(),L(Error(`${A}: ${l}`))},H.parentNode||document.head.appendChild(H)}),k,_=>y?.messageEvent({..._,url:l}))}async function $o(a){return o||(o=Promise.all([function(l,p={}){return Oo("script","src",l)&&window.__Primer?(p.analytics?.sdkFunctionEvent({name:p.name??l,params:["Script already loaded"]}),Promise.resolve()):Do("script",l,"src",{...p.attributes,async:"",crossorigin:"anonymous"},"Can't load Primer SDK",p)}("https://sdk.primer.io/web/v2.53.2/PrimerCoreSDK.min.js",{analytics:a,name:"loadPrimerScript"}),function(l,p={}){return Array.from(document.styleSheets).some(b=>b.href===l)?(p.analytics?.sdkFunctionEvent({name:p.name??l,params:["Stylesheet already loaded"]}),Promise.resolve()):Do("link",l,"href",{...p.attributes,rel:"stylesheet"},"Can't load Primer SDK's Stylesheet",p)}("https://sdk.primer.io/web/v2.53.2/Checkout.css",{analytics:a,name:"loadPrimerCss"})]).then(()=>{let l=window.__Primer;return delete window.__Primer,l}).catch(l=>{throw o=void 0,l}))}let Ya=async()=>{let a=kr();try{let l=Je(a);try{Ro(a,l),l.sdkFunctionEvent({name:"preloadPrimer"}),l.timerStart({id:Q.preloadPrimer}),await $o(l),l.timerEnd({id:Q.preloadPrimer})}catch(p){let b=h.from(p);throw b.isReported||(zt({checkoutSessionId:a,analytics:l,error:b,reporter:"preloadPrimer level 1"}),b.markAsReported()),b}}catch(l){let p=h.from(l);throw p.isReported||(Nr(a,p,"preloadPrimer level 0"),p.markAsReported()),p}},Ua=Rr("createHeadless"),za=Rr("showUniversalCheckout"),Ba=Rr("showVaultManager");function Rr(a){return async(...[l,p,...b])=>{var A;(A=p?.apiVersion)||console.warn(`[Primer SDK] No API version was explicitly set. Defaulting to '${c}'.`),x=A??c;let E=kr();try{let y=Je(E);try{Ro(E,y),y.sdkFunctionEvent({name:a,params:[l,p,...b]}),y.timerStart({id:Q[a]});let[M,k]=await Promise.all([Oa(l,E,p?.clientSessionCachingEnabled?{key:l,usePrimerSessionCacheTtlHeader:!0}:void 0),$o(y)]);return k[a](M,E,l,p,...b)}catch(M){let k=h.from(M);throw k.isReported||(zt({checkoutSessionId:E,analytics:y,error:k,reporter:"lazyLoad level 1"}),k.markAsReported()),k}}catch(y){let M=h.from(y);throw M.isReported||(Nr(E,M,"lazyLoad level 0"),M.markAsReported()),M}}}var Fa=function(a){return a.CHECKOUT="CHECKOUT",a.HEADLESS_CHECKOUT="HEADLESS_CHECKOUT",a.MANAGE_PAYMENT_METHODS="MANAGE_PAYMENT_METHODS",a}({}),Ka=function(a){return a.DEFAULT="DEFAULT",a.PREFER_VAULT="PREFER_VAULT",a}({}),ja=function(a){return a.SUCCESS="AUTH_SUCCESS",a.FAILED="AUTH_FAILED",a.SKIPPED="SKIPPED",a.CHALLENGE="CHALLENGE",a}({});let yt={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"},bt={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"},Ga={SINGLE_USE:"SINGLE_USE",MULTI_USE:"MULTI_USE"};yt.PAYPAL_VAULTED,bt.PAYPAL,yt.KLARNA_CUSTOMER_TOKEN,bt.KLARNA,yt.AUTOMATED_CLEARING_HOUSE,bt.STRIPE_ACH,yt.CARD,bt.PAYMENT_CARD;var qa=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 Bt(a,l,p){return l in a?Object.defineProperty(a,l,{value:p,enumerable:!0,configurable:!0,writable:!0}):a[l]=p,a}class Or extends h{static fromErrorCode(l,p){return new Or(l,p)}constructor(l,p){super(p.message),Bt(this,"code",void 0),Bt(this,"diagnosticsId",void 0),Bt(this,"data",void 0),Bt(this,"isFromDeveloper",void 0),this.code=l,this.diagnosticsId=p.diagnosticsId??null,this.data=p.data,this.isFromDeveloper=p.isFromDeveloper??!1,this.name="PrimerClientError",Error.captureStackTrace&&Error.captureStackTrace(this,Or)}}var Wa=function(a){return a.PAYMENT_METHOD="PAYMENT_METHOD",a.CHECK="CHECK",a}({});let Za=a=>{let l=a?.mandateData;return!!l&&"fullMandateText"in l};var Xa=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}({}),Ja=function(a){return a.CARD="CARD",a.NATIVE="NATIVE",a.REDIRECT="REDIRECT",a.KLARNA="KLARNA",a.ACH="ACH",a}({});let Qa={SDK_VERSION:"v2.53.2",createHeadless:Ua,showUniversalCheckout:za,showVaultManager:Ba,preloadPrimer:Ya};return i})())});var Ft=typeof window<"u"&&typeof window.document<"u";function rn(o){return document.querySelector(`#${o}`)}function on(o,t){let e=document.createElement("style");return e.textContent=o,e.id=t,e}function xt(o,t,e=!0){if(!Ft||rn(t))return;let i=on(o,t);e&&document.head.firstChild?document.head.insertBefore(i,document.head.firstChild):document.head.appendChild(i)}var zo=`
|
|
2
3
|
@keyframes primer-css-spinner-rotate {
|
|
3
4
|
0% {
|
|
4
5
|
transform: rotate(0deg);
|
|
@@ -34,7 +35,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
|
|
|
34
35
|
animation: primer-css-spinner-rotate 1.2s linear infinite;
|
|
35
36
|
z-index: 9999;
|
|
36
37
|
}
|
|
37
|
-
`;var
|
|
38
|
+
`;var Bo=`/**
|
|
38
39
|
* Do not edit directly, this file was auto-generated.
|
|
39
40
|
*/
|
|
40
41
|
|
|
@@ -56,7 +57,7 @@ primer-checkout {
|
|
|
56
57
|
--primer-color-blue-500: #399dff;
|
|
57
58
|
--primer-color-blue-900: #2270f4;
|
|
58
59
|
--primer-radius-base: 4px;
|
|
59
|
-
--primer-typography-brand:
|
|
60
|
+
--primer-typography-brand: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
|
|
60
61
|
--primer-typography-title-xlarge-letter-spacing: -0.6px;
|
|
61
62
|
--primer-typography-title-xlarge-weight: 550;
|
|
62
63
|
--primer-typography-title-xlarge-size: 24px;
|
|
@@ -142,7 +143,7 @@ primer-checkout {
|
|
|
142
143
|
--primer-color-border-transparent-focus: var(--primer-color-focus);
|
|
143
144
|
--primer-color-border-transparent-loading: var(--primer-color-border-transparent-disabled);
|
|
144
145
|
}
|
|
145
|
-
`,
|
|
146
|
+
`,Fo=`/**
|
|
146
147
|
* Do not edit directly, this file was auto-generated.
|
|
147
148
|
*/
|
|
148
149
|
|
|
@@ -162,4 +163,2285 @@ primer-checkout.primer-dark-theme {
|
|
|
162
163
|
--primer-color-blue-500: #3f93e4;
|
|
163
164
|
--primer-color-blue-900: #4aaeff;
|
|
164
165
|
}
|
|
165
|
-
`;var k="primer-light-theme-css",E="primer-dark-theme-css";function l(){i(g,k,!0)}function n(){i(y,E,!0)}function u(){l(),n()}function b(){i(s,"primer-css-loader-styles",!1)}function f(){u()}function B(){l()}function Q(){n()}async function w(r=c){await a(r),await window.Primer.preloadPrimer()}async function T(r=d){b(),f(),await a(r,!0)}async function $(){b(),f(),await w(),await T()}export{Q as injectDarkTheme,B as injectLightTheme,b as injectLoaderStyles,f as injectThemeStyles,$ as loadPrimer};
|
|
166
|
+
`;var an="primer-light-theme-css",nn="primer-dark-theme-css";function $r(){xt(Bo,an,!0)}function Vr(){xt(Fo,nn,!0)}function Ko(){$r(),Vr()}var Kt=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,i=e.preferred??e.items[0],s=r?.items??[];this.updateCardNetworksState({detectedCardNetwork:i,selectableCardNetworks:s,isLoading:!1})}};var tt=class{constructor(t){(this.host=t).addController(this)}hostConnected(){}dispatchEvent(t,e){this.host.dispatchEvent(new CustomEvent(t,{detail:e,bubbles:!0,composed:!0}))}dispatchSdkState(t){this.dispatchEvent("primer-state-changed",t)}dispatchPaymentMethods(t){this.dispatchEvent("primer-payment-methods-updated",t)}dispatchCheckoutInitialized(t){this.dispatchEvent("primer-checkout-initialized",t)}dispatchCardNetworkChange(t){this.dispatchEvent("primer-card-network-change",t)}dispatchFormSubmitSuccess(t){this.dispatchEvent("primer-card-submit-success",{result:t})}dispatchFormSubmitErrors(t){this.dispatchEvent("primer-card-submit-errors",{errors:t})}};var Se=class extends Event{constructor(t,e,r,i){super("context-request",{bubbles:!0,composed:!0}),this.context=t,this.contextTarget=e,this.callback=r,this.subscribe=i??!1}};var rt=class{constructor(t,e,r,i){if(this.subscribe=!1,this.provided=!1,this.value=void 0,this.t=(s,c)=>{this.unsubscribe&&(this.unsubscribe!==c&&(this.provided=!1,this.unsubscribe()),this.subscribe||this.unsubscribe()),this.value=s,this.host.requestUpdate(),this.provided&&!this.subscribe||(this.provided=!0,this.callback&&this.callback(s,c)),this.unsubscribe=c},this.host=t,e.context!==void 0){let s=e;this.context=s.context,this.callback=s.callback,this.subscribe=s.subscribe??!1}else this.context=e,this.callback=r,this.subscribe=i??!1;this.host.addController(this)}hostConnected(){this.dispatchRequest()}hostDisconnected(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=void 0)}dispatchRequest(){this.host.dispatchEvent(new Se(this.context,this.host,this.t,this.subscribe))}};var jt=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:i}=this.subscriptions.get(t);t(this.value,i)}clearCallbacks(){this.subscriptions.clear()}};var Hr=class extends Event{constructor(t,e){super("context-provider",{bubbles:!0,composed:!0}),this.context=t,this.contextTarget=e}},K=class extends jt{constructor(t,e,r){super(e.context!==void 0?e.initialValue:r),this.onContextRequest=i=>{if(i.context!==this.context)return;let s=i.contextTarget??i.composedPath()[0];s!==this.host&&(i.stopPropagation(),this.addCallback(i.callback,s,i.subscribe))},this.onProviderRequest=i=>{if(i.context!==this.context||(i.contextTarget??i.composedPath()[0])===this.host)return;let s=new Set;for(let[c,{consumerHost:x}]of this.subscriptions)s.has(c)||(s.add(c),x.dispatchEvent(new Se(this.context,x,c,!0)));i.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 Hr(this.context,this.host))}};function C({context:o,subscribe:t}){return(e,r)=>{typeof r=="object"?r.addInitializer(function(){new rt(this,{context:o,callback:i=>{e.set.call(this,i)},subscribe:t})}):e.constructor.addInitializer(i=>{new rt(i,{context:o,callback:s=>{i[r]=s},subscribe:t})})}}var Gt="cardNetworksContext";var ot="clientOptionsContext";var Pe="computedStylesContext";var q="headlessInstanceContext";var qt="klarnaCategoriesContext";var ue="managerContext";var it="paymentMethodsContext";var j="sdkStateContext";var W="vaultManagerContext";var Te="vaultManagerCvvContext";var T=class T{static log(t,...e){T.enabled&&console.log(`%c${T.brandTag}%c ${t}`,T.brandStyle,T.styles.log,...e)}static info(t,...e){T.enabled&&console.info(`%c${T.brandTag}%c ${t}`,T.brandStyle,T.styles.info,...e)}static warn(t,...e){T.enabled&&console.warn(`%c${T.brandTag}%c ${t}`,T.brandStyle,T.styles.warn,...e)}static error(t,...e){T.enabled&&console.error(`%c${T.brandTag}%c ${t}`,T.brandStyle,T.styles.error,...e)}static debug(t,...e){T.enabled&&console.debug(`%c${T.brandTag}%c ${t}`,T.brandStyle,T.styles.debug,...e)}static table(t,e){T.enabled&&console.table(t,e)}static time(t){T.enabled&&console.time(`${T.brandTag} ${t}`)}static timeEnd(t){T.enabled&&console.timeEnd(`${T.brandTag} ${t}`)}};T.enabled=!0,T.defaultFont="font-family: Consolas, monospace; font-size: 12px;",T.brandTag="[PRIMER]",T.brandStyle="background: #24292e; color: #ffffff; padding: 2px 6px; border-radius: 3px; font-weight: bold; margin-right: 4px; "+T.defaultFont,T.styles={log:"color: #4CAF50; "+T.defaultFont,info:"color: #2196F3; "+T.defaultFont,warn:"color: #FF9800; "+T.defaultFont,error:"color: #F44336; "+T.defaultFont,debug:"color: #9C27B0; "+T.defaultFont};var N=T;var Wt={isSuccessful:!1,isProcessing:!1,isLoading:!1,error:null,failure:null},Zt=class{constructor(t){(this.host=t).addController(this),this._state=Wt}hostConnected(){}reducer(t,e){switch(e.type){case"START_LOADING":return{...t,isLoading:!0};case"START_PROCESSING":return{...t,failure:null,isProcessing:!0};case"STOP_PROCESSING":return{...t,isProcessing:!1};case"COMPLETE_PROCESSING":return{...t,isProcessing:!1,isSuccessful:!0};case"SET_ERROR":return N.error(e.payload.message),{...t,isProcessing:!1,error:e.payload};case"SET_FAILURE":return{...t,isProcessing:!1,failure:e.payload};case"COMPLETE_LOADING":return{...t,isLoading:!1};case"RESET":return Wt;default:return t}}dispatch(t){let e=this.reducer(this._state,t);this._state=e,this.host.sdkContextController.setSdkState(e),this.host.primerEventsController.dispatchSdkState(e)}startLoading(){this.dispatch({type:"START_LOADING"})}startProcessing(){this.dispatch({type:"START_PROCESSING"})}stopProcessing(){this.dispatch({type:"STOP_PROCESSING"})}completeProcessing(){this.dispatch({type:"COMPLETE_PROCESSING"})}completeLoading(){this.dispatch({type:"COMPLETE_LOADING"})}setError(t){this.dispatch({type:"SET_ERROR",payload:t})}setFailure(t,e,r){this.dispatch({type:"SET_FAILURE",payload:{code:t,message:e,details:r}})}reset(){this.dispatch({type:"RESET"})}get state(){return this._state}};var Xt=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 K(t,{context:j,initialValue:Wt}),this.paymentMethodsProvider=new K(t,{context:it,initialValue:null}),this.paymentManagerProvider=new K(t,{context:ue,initialValue:new Map}),this.cardNetworksContext=new K(t,{context:Gt,initialValue:null}),this.vaultManagerProvider=new K(t,{context:W,initialValue:null}),this.vaultManagerCvvProvider=new K(t,{context:Te,initialValue:null}),this.clientOptionsContext=new K(t,{context:ot,initialValue:null}),this.klarnaCategoriesProvider=new K(t,{context:qt,initialValue:{categories:[],isLoading:!0}}),this.headlessUtilsProvider=new K(t,{context:q,initialValue:null}),this.computedStylesProvider=new K(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){N.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||N.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,i)=>"-"+i.toLowerCase()),ze.cssVarCache.set(t,e)),e}applyStyles(t){let e=[];for(let r of Object.keys(t)){let i=t[r];if(!i)continue;if(!this.isValidCssProperty(r)){N.warn(`Skipping invalid CSS property name: ${r}`);continue}if(!this.isValidCssValue(i))continue;let s=this.getCssVarName(r);e.push([s,i])}if(e.length>0)for(let[r,i]of e)this.host.style.setProperty(r,i)}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 Jt=ze;var Qt=globalThis,er=Qt.ShadowRoot&&(Qt.ShadyCSS===void 0||Qt.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Yr=Symbol(),jo=new WeakMap,Ct=class{constructor(t,e,r){if(this._$cssResult$=!0,r!==Yr)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(er&&t===void 0){let r=e!==void 0&&e.length===1;r&&(t=jo.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),r&&jo.set(e,t))}return t}toString(){return this.cssText}},Go=o=>new Ct(typeof o=="string"?o:o+"",void 0,Yr),g=(o,...t)=>{let e=o.length===1?o[0]:t.reduce((r,i,s)=>r+(c=>{if(c._$cssResult$===!0)return c.cssText;if(typeof c=="number")return c;throw Error("Value passed to 'css' function must be a 'css' function result: "+c+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+o[s+1],o[0]);return new Ct(e,o,Yr)},Ur=(o,t)=>{if(er)o.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let e of t){let r=document.createElement("style"),i=Qt.litNonce;i!==void 0&&r.setAttribute("nonce",i),r.textContent=e.cssText,o.appendChild(r)}},tr=er?o=>o:o=>o instanceof CSSStyleSheet?(t=>{let e="";for(let r of t.cssRules)e+=r.cssText;return Go(e)})(o):o;var{is:sn,defineProperty:ln,getOwnPropertyDescriptor:dn,getOwnPropertyNames:pn,getOwnPropertySymbols:cn,getPrototypeOf:mn}=Object,we=globalThis,qo=we.trustedTypes,un=qo?qo.emptyScript:"",hn=we.reactiveElementPolyfillSupport,At=(o,t)=>o,Mt={toAttribute(o,t){switch(t){case Boolean:o=o?un:null;break;case Object:case Array:o=o==null?o:JSON.stringify(o)}return o},fromAttribute(o,t){let e=o;switch(t){case Boolean:e=o!==null;break;case Number:e=o===null?null:Number(o);break;case Object:case Array:try{e=JSON.parse(o)}catch{e=null}}return e}},at=(o,t)=>!sn(o,t),Wo={attribute:!0,type:String,converter:Mt,reflect:!1,hasChanged:at};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),we.litPropertyMetadata??(we.litPropertyMetadata=new WeakMap);var ve=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=Wo){if(e.state&&(e.attribute=!1),this._$Ei(),this.elementProperties.set(t,e),!e.noAccessor){let r=Symbol(),i=this.getPropertyDescriptor(t,r,e);i!==void 0&&ln(this.prototype,t,i)}}static getPropertyDescriptor(t,e,r){let{get:i,set:s}=dn(this.prototype,t)??{get(){return this[e]},set(c){this[e]=c}};return{get(){return i?.call(this)},set(c){let x=i?.call(this);s.call(this,c),this.requestUpdate(t,x,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??Wo}static _$Ei(){if(this.hasOwnProperty(At("elementProperties")))return;let t=mn(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(At("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(At("properties"))){let e=this.properties,r=[...pn(e),...cn(e)];for(let i of r)this.createProperty(i,e[i])}let t=this[Symbol.metadata];if(t!==null){let e=litPropertyMetadata.get(t);if(e!==void 0)for(let[r,i]of e)this.elementProperties.set(r,i)}this._$Eh=new Map;for(let[e,r]of this.elementProperties){let i=this._$Eu(e,r);i!==void 0&&this._$Eh.set(i,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 i of r)e.unshift(tr(i))}else t!==void 0&&e.push(tr(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 Ur(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),i=this.constructor._$Eu(t,r);if(i!==void 0&&r.reflect===!0){let s=(r.converter?.toAttribute!==void 0?r.converter:Mt).toAttribute(e,r.type);this._$Em=t,s==null?this.removeAttribute(i):this.setAttribute(i,s),this._$Em=null}}_$AK(t,e){let r=this.constructor,i=r._$Eh.get(t);if(i!==void 0&&this._$Em!==i){let s=r.getPropertyOptions(i),c=typeof s.converter=="function"?{fromAttribute:s.converter}:s.converter?.fromAttribute!==void 0?s.converter:Mt;this._$Em=i,this[i]=c.fromAttribute(e,s.type),this._$Em=null}}requestUpdate(t,e,r){if(t!==void 0){if(r??(r=this.constructor.getPropertyOptions(t)),!(r.hasChanged??at)(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[i,s]of this._$Ep)this[i]=s;this._$Ep=void 0}let r=this.constructor.elementProperties;if(r.size>0)for(let[i,s]of r)s.wrapped!==!0||this._$AL.has(i)||this[i]===void 0||this.P(i,this[i],s)}let t=!1,e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach(r=>r.hostUpdate?.()),this.update(e)):this._$EU()}catch(r){throw t=!1,this._$EU(),r}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Ej&&(this._$Ej=this._$Ej.forEach(e=>this._$EC(e,this[e]))),this._$EU()}updated(t){}firstUpdated(t){}};ve.elementStyles=[],ve.shadowRootOptions={mode:"open"},ve[At("elementProperties")]=new Map,ve[At("finalized")]=new Map,hn?.({ReactiveElement:ve}),(we.reactiveElementVersions??(we.reactiveElementVersions=[])).push("2.0.4");var ke={INITIAL:0,PENDING:1,COMPLETE:2,ERROR:3},D=Symbol(),V=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 i=typeof e=="object"?e:{task:e,args:r};this.v=i.task,this.j=i.args,this.m=i.argsEqual??Zo,this.k=i.onComplete,this.A=i.onError,this.autoRun=i.autoRun??!0,"initialValue"in i&&(this.u=i.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 i=++this.p;this.q=new AbortController;let s=!1;try{e=await this.v(t,{signal:this.q.signal})}catch(c){s=!0,r=c}if(this.p===i){if(e===D)this.i=0;else{if(s===!1){try{this.k?.(e)}catch{}this.i=2,this.o?.(e)}else{try{this.A?.(r)}catch{}this.i=3,this.h?.(r)}this.u=e,this.l=r}this._.requestUpdate()}}abort(t){this.i===1&&this.q?.abort(t)}get value(){return this.u}get error(){return this.l}get status(){return this.i}render(t){switch(this.i){case 0:return t.initial?.();case 1:return t.pending?.();case 2:return t.complete?.(this.value);case 3:return t.error?.(this.error);default:throw Error("Unexpected status: "+this.i)}}},Zo=(o,t)=>o===t||o.length===t.length&&o.every((e,r)=>!at(e,t[r]));var _t={enabled:!1,isLoading:!1,cvvRecapture:!1,vaultedPaymentMethods:[],createCvvInput:void 0,deleteVaultedPaymentMethod:()=>Promise.resolve(),startVaultedPaymentFlow:()=>Promise.resolve()},rr={cvvInput:null,formIsDirty:!1,setCvvInput:()=>{},selectedVaultedPaymentMethod:null,setSelectedVaultedPaymentMethod:()=>{}};function zr(o,t,e){switch(t.type){case"SET_LOADING":return{...o,isLoading:t.payload};case"INITIALIZE_VAULT_MANAGER":return{...o,enabled:t.vaultEnabled,cvvRecapture:t.cvvRecapture,deleteVaultedPaymentMethod:e.deleteVaultedPaymentMethod,startVaultedPaymentFlow:e.startVaultedPaymentFlow,createCvvInput:e.createCvvInput};case"UPDATE_PAYMENT_METHODS":return{...o,vaultedPaymentMethods:t.payload,isLoading:t.isLoading??!1};case"SET_ERROR":return N.error("VaultManagerController",t.payload.message),{...o,isLoading:!1};case"DISABLE":return{..._t,enabled:!1};case"RESET":return _t;default:return o}}function Br(o,t,e){switch(t.type){case"INITIALIZE_CVV":return{...o,setCvvInput:e.setCvvInput,setSelectedVaultedPaymentMethod:e.setSelectedVaultedPaymentMethod};case"SET_FORM_DIRTY":return{...o,formIsDirty:t.payload};case"SET_CVV_INPUT":return{...o,cvvInput:t.payload};case"SET_SELECTED_VAULTED_PAYMENT_METHOD":return{...o,selectedVaultedPaymentMethod:t.payload};case"RESET_CVV":return rr;default:return o}}var St=class{constructor(t){this._vaultManager=null;this._options=null;this.deleteVaultedPaymentMethod=async t=>{if(!this._vaultManager)throw new Error("Vault manager not initialized");try{this.dispatchVaultManager({type:"UPDATE_PAYMENT_METHODS",payload:this._vaultManagerState.vaultedPaymentMethods,isLoading:!0}),await this._vaultManager.deleteVaultedPaymentMethod(t),await this.fetchVaultedPaymentMethods()}catch(e){throw this.dispatchVaultManager({type:"SET_ERROR",payload:e instanceof Error?e:new Error("Failed to delete payment method")}),e}};this.setCvvInput=t=>{this.dispatchVaultItem({type:"SET_CVV_INPUT",payload:t})};this.startVaultedPaymentFlow=async()=>{if(!this._vaultManager)throw new Error("Vault manager not initialized");let t=this._vaultItemState.selectedVaultedPaymentMethod,e=this._vaultManagerState.cvvRecapture,r=this._vaultItemState.cvvInput;if(!t||e&&(!r||r.metadata.error)){this.dispatchVaultItem({type:"SET_FORM_DIRTY",payload:!0});return}this.host.sdkStateController.startProcessing();try{await this._vaultManager.startPaymentFlow(t.id,e?{cvv:r.valueToken}:void 0)}catch(i){N.error("VaultManagerController: Error starting vaulted payment flow",i),this.dispatchVaultManager({type:"SET_ERROR",payload:i instanceof Error?i:new Error("Failed to start vaulted payment flow")}),this.host.sdkStateController.stopProcessing()}};this.setSelectedVaultedPaymentMethod=t=>{this.dispatchVaultItem({type:"SET_SELECTED_VAULTED_PAYMENT_METHOD",payload:t}),this.dispatchVaultItem({type:"SET_FORM_DIRTY",payload:!1})};(this.host=t).addController(this),this._vaultManagerState=_t,this._vaultItemState=rr,new V(this.host,{task:async([e,r])=>{if(!e||!r?.vaultEnabled)return this.dispatchVaultManager({type:"DISABLE"}),D;this.dispatchVaultManager({type:"SET_LOADING",payload:!0});try{this.dispatchVaultManager({type:"INITIALIZE_VAULT_MANAGER",payload:e,vaultEnabled:r.vaultEnabled,cvvRecapture:!!r.captureVaultedCardCvv}),this.dispatchVaultItem({type:"INITIALIZE_CVV",createCvvInput:e.createCvvInput}),await this.fetchVaultedPaymentMethods(),N.log("VaultManagerController: Vault initialized successfully",{coreState:this._vaultManagerState,cvvState:this._vaultItemState})}catch(i){N.error("VaultManagerController: Failed to initialize vault",i),this.dispatchVaultManager({type:"SET_ERROR",payload:i instanceof Error?i:new Error("Unknown error")})}return this._vaultManager},args:()=>[this.vaultManager,this.options]})}initializeVaultManager(t,e){this.vaultManager=t,this.options=e??null}get vaultManager(){return this._vaultManager}set vaultManager(t){this._vaultManager=t,this.host.requestUpdate()}get options(){return this._options}set options(t){this._options=t,this.host.requestUpdate()}hostDisconnected(){this.vaultManager=null,this.dispatchVaultManager({type:"RESET"})}dispatchVaultManager(t){let e={deleteVaultedPaymentMethod:this.deleteVaultedPaymentMethod,startVaultedPaymentFlow:this.startVaultedPaymentFlow,createCvvInput:this.vaultManager?.createCvvInput},r=zr(this._vaultManagerState,t,e);this._vaultManagerState=r,this.host.sdkContextController.setVaultManager(r)}dispatchVaultItem(t){let e={setCvvInput:this.setCvvInput,setSelectedVaultedPaymentMethod:this.setSelectedVaultedPaymentMethod},r=Br(this._vaultItemState,t,e);this._vaultItemState=r,this.host.sdkContextController.setVaultManagerCvv(r)}async fetchVaultedPaymentMethods(){if(!this._vaultManager)throw new Error("Vault manager not initialized");try{this.dispatchVaultManager({type:"UPDATE_PAYMENT_METHODS",payload:this._vaultManagerState.vaultedPaymentMethods,isLoading:!0});let t=await this._vaultManager.fetchVaultedPaymentMethods();return N.log("VaultManagerController: Fetched payment methods",t),this.dispatchVaultManager({type:"UPDATE_PAYMENT_METHODS",payload:t,isLoading:!1}),t}catch(t){throw this.dispatchVaultManager({type:"SET_ERROR",payload:t instanceof Error?t:new Error("Failed to fetch payment methods")}),t}}};var Pt="lit-localize-status";var Xo=o=>typeof o!="string"&&"strTag"in o,or=(o,t,e)=>{let r=o[0];for(let i=1;i<o.length;i++)r+=t[e?e[i-1]:i-1],r+=o[i];return r};var Tt=o=>Xo(o)?or(o.strings,o.values):o;var P=Tt,Jo=!1;function Fr(o){if(Jo)throw new Error("lit-localize can only be configured once");P=o,Jo=!0}var Kr=class{constructor(t){this.__litLocalizeEventHandler=e=>{e.detail.status==="ready"&&this.host.requestUpdate()},this.host=t}hostConnected(){window.addEventListener(Pt,this.__litLocalizeEventHandler)}hostDisconnected(){window.removeEventListener(Pt,this.__litLocalizeEventHandler)}},gn=o=>o.addController(new Kr(o)),Qo=gn;var I=()=>(o,t)=>(o.addInitializer(Qo),o);var wt=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 ye=[];for(let o=0;o<256;o++)ye[o]=(o>>4&15).toString(16)+(o&15).toString(16);function ei(o){let t=0,e=8997,r=0,i=33826,s=0,c=40164,x=0,h=52210;for(let R=0;R<o.length;R++)e^=o.charCodeAt(R),t=e*435,r=i*435,s=c*435,x=h*435,s+=e<<8,x+=i<<8,r+=t>>>16,e=t&65535,s+=r>>>16,i=r&65535,h=x+(s>>>16)&65535,c=s&65535;return ye[h>>8]+ye[h&255]+ye[c>>8]+ye[c&255]+ye[i>>8]+ye[i&255]+ye[e>>8]+ye[e&255]}var fn="",vn="h",yn="s";function ti(o,t){return(t?vn:yn)+ei(typeof o=="string"?o:o.join(fn))}var ri=new WeakMap,oi=new Map;function ii(o,t,e){if(o){let r=e?.id??bn(t),i=o[r];if(i){if(typeof i=="string")return i;if("strTag"in i)return or(i.strings,t.values,i.values);{let s=ri.get(i);return s===void 0&&(s=i.values,ri.set(i,s)),{...i,values:s.map(c=>t.values[c])}}}}return Tt(t)}function bn(o){let t=typeof o=="string"?o:o.strings,e=oi.get(t);return e===void 0&&(e=ti(t,typeof o!="string"&&!("strTag"in o)),oi.set(t,e)),e}function jr(o){window.dispatchEvent(new CustomEvent(Pt,{detail:o}))}var ar="",Gr,ai,nr,qr,ni,Be=new wt;Be.resolve();var ir=0,si=o=>(Fr((t,e)=>ii(ni,t,e)),ar=ai=o.sourceLocale,nr=new Set(o.targetLocales),nr.add(o.sourceLocale),qr=o.loadLocale,{getLocale:En,setLocale:xn}),En=()=>ar,xn=o=>{if(o===(Gr??ar))return Be.promise;if(!nr||!qr)throw new Error("Internal error");if(!nr.has(o))throw new Error("Invalid locale code");ir++;let t=ir;return Gr=o,Be.settled&&(Be=new wt),jr({status:"loading",loadingLocale:o}),(o===ai?Promise.resolve({templates:void 0}):qr(o)).then(r=>{ir===t&&(ar=o,Gr=void 0,ni=r.templates,jr({status:"ready",readyLocale:o}),Be.resolve())},r=>{ir===t&&(jr({status:"error",errorLocale:o,errorMessage:r.toString()}),Be.reject(r))}),Be.promise};var Wr="en",Zr=["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"],li="You must call `loadLocale` first to set up the localized template.",di,sr,pi=o=>{let t=si({sourceLocale:Wr,targetLocales:Zr,loadLocale:o});di=t.getLocale,sr=t.setLocale};var Xr=o=>{pi(o)},Jr=o=>{if(!sr)throw new Error(li);return sr(o)};var kt=new Set(Zr);kt.add(Wr);var Qr=o=>{if(typeof o!="string")return!1;if(o==="en")return!0;let t=o.replace("_","-");if(kt.has(t))return!0;let e=t.split("-")[0];return!!kt.has(e)},eo=o=>{if(o==="en")return"en-GB";let t=o.replace("_","-");if(kt.has(t))return t;let e=t.split("-")[0];return kt.has(e)?e:"en-GB"};var Nt=globalThis,lr=Nt.trustedTypes,ci=lr?lr.createPolicy("lit-html",{createHTML:o=>o}):void 0,ro="$lit$",be=`lit$${Math.random().toFixed(9).slice(2)}$`,oo="?"+be,Cn=`<${oo}>`,je=document,Lt=()=>je.createComment(""),Rt=o=>o===null||typeof o!="object"&&typeof o!="function",io=Array.isArray,vi=o=>io(o)||typeof o?.[Symbol.iterator]=="function",to=`[
|
|
167
|
+
\f\r]`,It=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,mi=/-->/g,ui=/>/g,Fe=RegExp(`>|${to}(?:([^\\s"'>=/]+)(${to}*=${to}*(?:[^
|
|
168
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),hi=/'/g,gi=/"/g,yi=/^(?:script|style|textarea|title)$/i,ao=o=>(t,...e)=>({_$litType$:o,strings:t,values:e}),m=ao(1),Ie=ao(2),wd=ao(3),Ee=Symbol.for("lit-noChange"),u=Symbol.for("lit-nothing"),fi=new WeakMap,Ke=je.createTreeWalker(je,129);function bi(o,t){if(!io(o)||!o.hasOwnProperty("raw"))throw Error("invalid template strings array");return ci!==void 0?ci.createHTML(t):t}var Ei=(o,t)=>{let e=o.length-1,r=[],i,s=t===2?"<svg>":t===3?"<math>":"",c=It;for(let x=0;x<e;x++){let h=o[x],R,z,O=-1,Q=0;for(;Q<h.length&&(c.lastIndex=Q,z=c.exec(h),z!==null);)Q=c.lastIndex,c===It?z[1]==="!--"?c=mi:z[1]!==void 0?c=ui:z[2]!==void 0?(yi.test(z[2])&&(i=RegExp("</"+z[2],"g")),c=Fe):z[3]!==void 0&&(c=Fe):c===Fe?z[0]===">"?(c=i??It,O=-1):z[1]===void 0?O=-2:(O=c.lastIndex-z[2].length,R=z[1],c=z[3]===void 0?Fe:z[3]==='"'?gi:hi):c===gi||c===hi?c=Fe:c===mi||c===ui?c=It:(c=Fe,i=void 0);let B=c===Fe&&o[x+1].startsWith("/>")?" ":"";s+=c===It?h+Cn:O>=0?(r.push(R),h.slice(0,O)+ro+h.slice(O)+be+B):h+be+(O===-2?x:B)}return[bi(o,s+(o[e]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),r]},Ot=class o{constructor({strings:t,_$litType$:e},r){let i;this.parts=[];let s=0,c=0,x=t.length-1,h=this.parts,[R,z]=Ei(t,e);if(this.el=o.createElement(R,r),Ke.currentNode=this.el.content,e===2||e===3){let O=this.el.content.firstChild;O.replaceWith(...O.childNodes)}for(;(i=Ke.nextNode())!==null&&h.length<x;){if(i.nodeType===1){if(i.hasAttributes())for(let O of i.getAttributeNames())if(O.endsWith(ro)){let Q=z[c++],B=i.getAttribute(O).split(be),Xe=/([.?@])?(.*)/.exec(Q);h.push({type:1,index:s,name:Xe[2],strings:B,ctor:Xe[1]==="."?pr:Xe[1]==="?"?cr:Xe[1]==="@"?mr:qe}),i.removeAttribute(O)}else O.startsWith(be)&&(h.push({type:6,index:s}),i.removeAttribute(O));if(yi.test(i.tagName)){let O=i.textContent.split(be),Q=O.length-1;if(Q>0){i.textContent=lr?lr.emptyScript:"";for(let B=0;B<Q;B++)i.append(O[B],Lt()),Ke.nextNode(),h.push({type:2,index:++s});i.append(O[Q],Lt())}}}else if(i.nodeType===8)if(i.data===oo)h.push({type:2,index:s});else{let O=-1;for(;(O=i.data.indexOf(be,O+1))!==-1;)h.push({type:7,index:s}),O+=be.length-1}s++}}static createElement(t,e){let r=je.createElement("template");return r.innerHTML=t,r}};function Ge(o,t,e=o,r){if(t===Ee)return t;let i=r!==void 0?e._$Co?.[r]:e._$Cl,s=Rt(t)?void 0:t._$litDirective$;return i?.constructor!==s&&(i?._$AO?.(!1),s===void 0?i=void 0:(i=new s(o),i._$AT(o,e,r)),r!==void 0?(e._$Co??(e._$Co=[]))[r]=i:e._$Cl=i),i!==void 0&&(t=Ge(o,i._$AS(o,t.values),i,r)),t}var dr=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,i=(t?.creationScope??je).importNode(e,!0);Ke.currentNode=i;let s=Ke.nextNode(),c=0,x=0,h=r[0];for(;h!==void 0;){if(c===h.index){let R;h.type===2?R=new nt(s,s.nextSibling,this,t):h.type===1?R=new h.ctor(s,h.name,h.strings,this,t):h.type===6&&(R=new ur(s,this,t)),this._$AV.push(R),h=r[++x]}c!==h?.index&&(s=Ke.nextNode(),c++)}return Ke.currentNode=je,i}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++}},nt=class o{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,r,i){this.type=2,this._$AH=u,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=r,this.options=i,this._$Cv=i?.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=Ge(this,t,e),Rt(t)?t===u||t==null||t===""?(this._$AH!==u&&this._$AR(),this._$AH=u):t!==this._$AH&&t!==Ee&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):vi(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!==u&&Rt(this._$AH)?this._$AA.nextSibling.data=t:this.T(je.createTextNode(t)),this._$AH=t}$(t){let{values:e,_$litType$:r}=t,i=typeof r=="number"?this._$AC(t):(r.el===void 0&&(r.el=Ot.createElement(bi(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===i)this._$AH.p(e);else{let s=new dr(i,this),c=s.u(this.options);s.p(e),this.T(c),this._$AH=s}}_$AC(t){let e=fi.get(t.strings);return e===void 0&&fi.set(t.strings,e=new Ot(t)),e}k(t){io(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,r,i=0;for(let s of t)i===e.length?e.push(r=new o(this.O(Lt()),this.O(Lt()),this,this.options)):r=e[i],r._$AI(s),i++;i<e.length&&(this._$AR(r&&r._$AB.nextSibling,i),e.length=i)}_$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))}},qe=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,r,i,s){this.type=1,this._$AH=u,this._$AN=void 0,this.element=t,this.name=e,this._$AM=i,this.options=s,r.length>2||r[0]!==""||r[1]!==""?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=u}_$AI(t,e=this,r,i){let s=this.strings,c=!1;if(s===void 0)t=Ge(this,t,e,0),c=!Rt(t)||t!==this._$AH&&t!==Ee,c&&(this._$AH=t);else{let x=t,h,R;for(t=s[0],h=0;h<s.length-1;h++)R=Ge(this,x[r+h],e,h),R===Ee&&(R=this._$AH[h]),c||(c=!Rt(R)||R!==this._$AH[h]),R===u?t=u:t!==u&&(t+=(R??"")+s[h+1]),this._$AH[h]=R}c&&!i&&this.j(t)}j(t){t===u?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},pr=class extends qe{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===u?void 0:t}},cr=class extends qe{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==u)}},mr=class extends qe{constructor(t,e,r,i,s){super(t,e,r,i,s),this.type=5}_$AI(t,e=this){if((t=Ge(this,t,e,0)??u)===Ee)return;let r=this._$AH,i=t===u&&r!==u||t.capture!==r.capture||t.once!==r.once||t.passive!==r.passive,s=t!==u&&(r===u||i);i&&this.element.removeEventListener(this.name,this,r),s&&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)}},ur=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){Ge(this,t)}},xi={M:ro,P:be,A:oo,C:1,L:Ei,R:dr,D:vi,V:Ge,I:nt,H:qe,N:cr,U:mr,B:pr,F:ur},An=Nt.litHtmlPolyfillSupport;An?.(Ot,nt),(Nt.litHtmlVersions??(Nt.litHtmlVersions=[])).push("3.2.1");var Ci=(o,t,e)=>{let r=e?.renderBefore??t,i=r._$litPart$;if(i===void 0){let s=e?.renderBefore??null;r._$litPart$=i=new nt(t.insertBefore(Lt(),s),s,void 0,e??{})}return i._$AI(o),i};var f=class extends ve{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=Ci(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return Ee}};f._$litElement$=!0,f.finalized=!0,globalThis.litElementHydrateSupport?.({LitElement:f});var Mn=globalThis.litElementPolyfillSupport;Mn?.({LitElement:f});(globalThis.litElementVersions??(globalThis.litElementVersions=[])).push("4.1.1");var v=o=>(t,e)=>{e!==void 0?e.addInitializer(()=>{customElements.define(o,t)}):customElements.define(o,t)};var _n={attribute:!0,type:String,converter:Mt,reflect:!1,hasChanged:at},Sn=(o=_n,t,e)=>{let{kind:r,metadata:i}=e,s=globalThis.litPropertyMetadata.get(i);if(s===void 0&&globalThis.litPropertyMetadata.set(i,s=new Map),s.set(e.name,o),r==="accessor"){let{name:c}=e;return{set(x){let h=t.get.call(this);t.set.call(this,x),this.requestUpdate(c,h,o)},init(x){return x!==void 0&&this.P(c,void 0,o),x}}}if(r==="setter"){let{name:c}=e;return function(x){let h=this[c];t.call(this,x),this.requestUpdate(c,h,o)}}throw Error("Unsupported decorator location: "+r)};function d(o){return(t,e)=>typeof e=="object"?Sn(o,t,e):((r,i,s)=>{let c=i.hasOwnProperty(s);return i.constructor.createProperty(s,c?{...r,wrapped:!0}:r),c?Object.getOwnPropertyDescriptor(i,s):void 0})(o,t,e)}function w(o){return d({...o,state:!0,attribute:!1})}var We=(o,t,e)=>(e.configurable=!0,e.enumerable=!0,Reflect.decorate&&typeof t!="object"&&Object.defineProperty(o,t,e),e);function Ne(o,t){return(e,r,i)=>{let s=c=>c.renderRoot?.querySelector(o)??null;if(t){let{get:c,set:x}=typeof r=="object"?e:i??(()=>{let h=Symbol();return{get(){return this[h]},set(R){this[h]=R}}})();return We(e,r,{get(){let h=c.call(this);return h===void 0&&(h=s(this),(h!==null||this.hasUpdated)&&x.call(this,h)),h}})}return We(e,r,{get(){return s(this)}})}}function $(o,t,e){return o?t(o):e?.(o)}var S=g`
|
|
169
|
+
* {
|
|
170
|
+
box-sizing: border-box;
|
|
171
|
+
}
|
|
172
|
+
`,Ai=g`
|
|
173
|
+
:host {
|
|
174
|
+
display: block;
|
|
175
|
+
isolation: isolate;
|
|
176
|
+
position: relative;
|
|
177
|
+
width: 100%;
|
|
178
|
+
//Keep the CSS loader in the same position - check css-loader-inline.ts
|
|
179
|
+
min-height: 64px;
|
|
180
|
+
}
|
|
181
|
+
`;var Mi="https://sdk.primer.io/web/v2-latest/Primer.min.js";var hr=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}};function Pn(o){return document.querySelector(`script[src^="${o}"]`)}function Tn(o,t){let e=document.createElement("script");return e.setAttribute("src",o),e.setAttribute("async",""),e.setAttribute("crossorigin","anonymous"),t&&e.setAttribute("type","module"),e}function _i(o,t=!1){if(!Ft)throw new Error("Cannot load script in server environment");let e=Pn(o)??Tn(o,t);return new Promise((r,i)=>{e.onload=()=>{r()},e.onerror=()=>{i()},e.parentNode||document.head.appendChild(e)})}var gr=class{constructor(t){this.createPaymentMethodManager=null;this._paymentsList=[];(this.host=t).addController(this),this.sdkInstanceTask=new V(t,{args:()=>[this.host.clientToken,this.host.options],task:this.initializeHeadless()}),new V(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.host.sdkStateController.startLoading()}async _loadV2Sdk(t=Mi){await _i(t),await window.Primer.preloadPrimer()}initializeHeadless(){return async([t,e])=>{if(!t||!e)return D;try{await this._loadV2Sdk();let{Primer:r}=window,i=await r.createHeadless(t,{...e,onAvailablePaymentMethodsLoad:c=>{N.info("Configuration payment methods:",c),this.paymentsList=c},onCheckoutComplete:({payment:c})=>{N.info("Payment completed:",c),this.host.sdkStateController.completeProcessing()},onCheckoutFail:(c,x,h)=>{N.error("Payment failed:",c),this.host.sdkStateController.setFailure(c.code||"UNKNOWN_ERROR",c.message||"Unknown error occurred"),h&&h.showErrorMessage()},onBeforePaymentCreate:(c,x)=>{this.host.sdkStateController.startProcessing(),x?.continuePaymentCreation()},onPaymentMethodAction:(c,x)=>{c==="PAYMENT_METHOD_UNSELECTED"&&this.host.sdkStateController.reset()}});this.createPaymentMethodManager=i.createPaymentMethodManager.bind(i),await i.start(),this.host.sdkContextController.setClientOptions(e),this.host.primerEventsController.dispatchCheckoutInitialized(i);let s=i.getSDKUtilities();return this.host.sdkContextController.setHeadlessUtils(s),this.host.vaultManagerController.initializeVaultManager(i.createVaultManager(),{vaultEnabled:e.vault?.enabled,captureVaultedCardCvv:!!s.getPaymentMethodConfiguration("PAYMENT_CARD")?.options.captureVaultedCardCvv}),i}catch(r){throw r instanceof Error&&this.host.sdkStateController.setError(r),r}}}initializeLitContext(){return async([t,e])=>{if(!t||!e.length)return D;let r=new Map,i=new Map;try{for(let c of e){let x=await this.initializePaymentMethodManager(c)();c&&x&&(r.set(c.type,c),i.set(c.type,x))}let s=new hr(r);return this.host.sdkContextController.setPaymentManagers(i),this.host.sdkContextController.setPaymentMethods(s),this.host.primerEventsController.dispatchPaymentMethods(s),N.info("Initialized payment methods:",s.toArray()),r}catch(s){if(s instanceof Error)throw this.host.sdkStateController.setError(s),s;return null}finally{this.host.sdkStateController.completeLoading()}}}initializePaymentMethodManager(t){let{type:e,managerType:r}=t;return async()=>{if(!this.createPaymentMethodManager)return null;if(r==="KLARNA"){let i=await this.createPaymentMethodManager(e,{onPaymentMethodCategoriesChange:s=>{this.host.sdkContextController.setKlarnaCategories({categories:s,isLoading:!1})},onPaymentMethodAction:s=>{s==="PAYMENT_METHOD_UNSELECTED"&&this.host.sdkStateController.reset()}});return i?{type:e,manager:i}:null}try{if(r==="CARD"){let s=await this.createPaymentMethodManager(e,{onCardNetworksChange:async c=>{await this.host.cardNetworkController.processCardNetworkChangeEvent(c)},onCardNetworksLoading:()=>{this.host.cardNetworkController.setCardNetworksLoading()}});return s?{type:e,manager:s}:null}let i=await this.createPaymentMethodManager(e);return i?{type:e,manager:i}:null}catch(i){return N.error(`Failed to initialize manager for ${e}:`,i),null}}}};var wn=Uo({"../../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")});Xr(o=>wn(`../../localization/lit-localize/locales/${o}.ts`));var ae=class extends f{constructor(){super();this.customStyles="";this.clientToken="";this.options={};this._jsInitialized=!1;this.previousLoadingState=!0;this.hasAssignedContent=!1;this.locale="en-GB";this.onSlotChange=e=>{let i=e.target.assignedNodes({flatten:!0});this.hasAssignedContent=i.length>0,this.requestUpdate()};this.sdkContextController=new Xt(this),this.sdkStateController=new Zt(this),this.primerEventsController=new tt(this),this.styleProcessingController=new Jt(this),this.vaultManagerController=new St(this),this.cardNetworkController=new Kt(this),new gr(this)}set jsInitialized(e){this.requestUpdate(),this._jsInitialized=e}get jsInitialized(){return this._jsInitialized}attributeChangedCallback(e,r,i){e==="customstyles"?this.styleProcessingController.processCustomStyles(i):super.attributeChangedCallback(e,r,i)}willUpdate(e){e.has("options")&&(this.options?.locale&&(Qr(this.options?.locale)?this.locale=eo(this.options?.locale):N.warn("\u{1F30E}\u2757 Unsupported locale provided:",this.options?.locale,"- Falling back to default locale `en-GB`")),Jr(this.locale||"en-GB"))}updated(){let e=getComputedStyle(this);this.sdkContextController.setComputedStyles(e),this.checkLoadingStateChange()}checkLoadingStateChange(){let e=this.sdkStateController?.state.isLoading||!1;this.previousLoadingState&&!e&&(this.jsInitialized=!0),this.previousLoadingState=e}render(){let e=this.sdkStateController.state,r=e.isLoading,i=e.error,s=!r&&!i;return m`
|
|
182
|
+
${$(r,()=>u)}
|
|
183
|
+
${$(i,()=>m`<primer-checkout-error></primer-checkout-error>`)}
|
|
184
|
+
${$(s,()=>m`
|
|
185
|
+
<slot name="main" @slotchange=${this.onSlotChange}></slot>
|
|
186
|
+
${$(this.hasAssignedContent,()=>u,()=>m`<primer-main></primer-main>`)}
|
|
187
|
+
`,()=>u)}
|
|
188
|
+
`}addEventListener(e,r,i){super.addEventListener(e,r,i)}};ae.styles=[S,Ai],n([d({type:String,attribute:"custom-styles"})],ae.prototype,"customStyles",2),n([d({type:String,attribute:"client-token"})],ae.prototype,"clientToken",2),n([d({type:Object})],ae.prototype,"options",2),n([d({type:Boolean,reflect:!0,attribute:"js-initialized"})],ae.prototype,"_jsInitialized",2),n([Ne("slot")],ae.prototype,"defaultSlot",2),n([w()],ae.prototype,"previousLoadingState",2),ae=n([I(),v("primer-checkout")],ae);var Si=g`
|
|
189
|
+
:host {
|
|
190
|
+
display: inline-flex;
|
|
191
|
+
align-items: center;
|
|
192
|
+
justify-content: center;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
.spinner-container {
|
|
196
|
+
display: flex;
|
|
197
|
+
align-items: center;
|
|
198
|
+
justify-content: center;
|
|
199
|
+
width: var(--spinner-size, var(--primer-size-medium));
|
|
200
|
+
height: var(--spinner-size, var(--primer-size-medium));
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
.spinner-container:not(.compact) {
|
|
204
|
+
margin: var(--primer-space-small) 0;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
.spinner-container.compact {
|
|
208
|
+
margin: 0;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
.spinner {
|
|
212
|
+
animation: spinner-rotate 1.2s linear infinite;
|
|
213
|
+
width: 100%;
|
|
214
|
+
height: 100%;
|
|
215
|
+
color: var(--spinner-color, var(--primer-color-loader));
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
.path {
|
|
219
|
+
fill: currentColor;
|
|
220
|
+
transform-origin: center;
|
|
221
|
+
transition: fill var(--primer-animation-duration, 200ms)
|
|
222
|
+
var(--primer-animation-easing, ease);
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
@keyframes spinner-rotate {
|
|
226
|
+
0% {
|
|
227
|
+
transform: rotate(0deg);
|
|
228
|
+
}
|
|
229
|
+
100% {
|
|
230
|
+
transform: rotate(360deg);
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
`;var no={small:16,medium:24,large:32},xe=class extends f{constructor(){super(...arguments);this.color="var(--primer-color-loader)";this.size="medium";this.compact=!1}getSize(){if(this.size in no)return no[this.size];let e=parseInt(this.size,10);return isNaN(e)?no.medium:e}render(){let e=this.getSize(),r=20,i=`0 0 ${r} ${r}`;return this.style.setProperty("--spinner-color",this.color),this.style.setProperty("--spinner-size",`${e}px`),m`
|
|
234
|
+
<div class="spinner-container ${this.compact?"compact":""}">
|
|
235
|
+
<svg
|
|
236
|
+
class="spinner"
|
|
237
|
+
width="${e}"
|
|
238
|
+
height="${e}"
|
|
239
|
+
viewBox="${i}"
|
|
240
|
+
fill="none"
|
|
241
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
242
|
+
role="status"
|
|
243
|
+
aria-label="Loading"
|
|
244
|
+
>
|
|
245
|
+
<path
|
|
246
|
+
d="M4.27827 10.002C4.27827 6.84166 6.84019 4.27973 10.0005 4.27973C10.7676 4.27973 11.3894 3.6579 11.3894 2.89084C11.3894 2.12378 10.7676 1.50195 10.0005 1.50195C5.30607 1.50195 1.50049 5.30753 1.50049 10.002C1.50049 14.6964 5.30607 18.502 10.0005 18.502C14.6949 18.502 18.5005 14.6964 18.5005 10.002C18.5005 9.23489 17.8787 8.61306 17.1116 8.61306C16.3445 8.61306 15.7227 9.23489 15.7227 10.002C15.7227 13.1622 13.1608 15.7242 10.0005 15.7242C6.84019 15.7242 4.27827 13.1622 4.27827 10.002Z"
|
|
247
|
+
fill="currentColor"
|
|
248
|
+
class="path"
|
|
249
|
+
/>
|
|
250
|
+
</svg>
|
|
251
|
+
</div>
|
|
252
|
+
`}};xe.styles=[Si],n([d({type:String})],xe.prototype,"color",2),n([d({type:String})],xe.prototype,"size",2),n([d({type:Boolean})],xe.prototype,"compact",2),xe=n([v("primer-spinner")],xe);var fr={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},Dt=o=>(...t)=>({_$litDirective$:o,values:t}),st=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 pe=Dt(class extends st{constructor(o){if(super(o),o.type!==fr.ATTRIBUTE||o.name!=="class"||o.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(o){return" "+Object.keys(o).filter(t=>o[t]).join(" ")+" "}update(o,[t]){if(this.st===void 0){this.st=new Set,o.strings!==void 0&&(this.nt=new Set(o.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=o.element.classList;for(let r of this.st)r in t||(e.remove(r),this.st.delete(r));for(let r in t){let i=!!t[r];i===this.st.has(r)||this.nt?.has(r)||(i?(e.add(r),this.st.add(r)):(e.remove(r),this.st.delete(r)))}return Ee}});var Pi=g`
|
|
253
|
+
* {
|
|
254
|
+
box-sizing: border-box;
|
|
255
|
+
}
|
|
256
|
+
:host {
|
|
257
|
+
display: block;
|
|
258
|
+
width: 100%;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
.input-slot.focus-within,
|
|
262
|
+
.input-slot:focus-within {
|
|
263
|
+
outline: 2px solid var(--primer-color-border-outlined-focus);
|
|
264
|
+
outline-offset: -2px;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
:host([has-error]) .input-slot.focus-within,
|
|
268
|
+
:host([has-error]) .input-slot:focus-within {
|
|
269
|
+
outline: 2px solid var(--primer-color-border-outlined-error);
|
|
270
|
+
background-color: var(--primer-color-background-outlined-error);
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
:host([has-error]) .input-slot {
|
|
274
|
+
border-color: var(--primer-color-border-outlined-error);
|
|
275
|
+
background-color: var(--primer-color-background-outlined-error);
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
.input-wrapper {
|
|
279
|
+
display: flex;
|
|
280
|
+
flex-direction: column;
|
|
281
|
+
gap: var(--primer-space-xsmall);
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
.input-slot {
|
|
285
|
+
padding: var(--primer-space-medium) var(--primer-space-medium);
|
|
286
|
+
border: 1px solid var(--primer-color-border-outlined-default);
|
|
287
|
+
border-radius: var(--primer-radius-small);
|
|
288
|
+
background-color: var(--primer-color-background-outlined-default);
|
|
289
|
+
height: calc(
|
|
290
|
+
var(--primer-typography-body-large-line-height) +
|
|
291
|
+
var(--primer-space-medium) + var(--primer-space-medium) + 2px
|
|
292
|
+
);
|
|
293
|
+
display: flex;
|
|
294
|
+
cursor: text; /* Indicate text input interactivity */
|
|
295
|
+
/* 2px is the border width */
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
.input-slot ::slotted(*) {
|
|
299
|
+
width: 100%;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
.input-slot:hover {
|
|
303
|
+
border-color: var(--primer-color-border-outlined-hover);
|
|
304
|
+
background-color: var(--primer-color-background-outlined-hover);
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
.input-slot:active {
|
|
308
|
+
border-color: var(--primer-color-border-outlined-active);
|
|
309
|
+
background-color: var(--primer-color-background-outlined-active);
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
.input-slot:disabled {
|
|
313
|
+
background-color: var(--primer-color-background-outlined-disabled);
|
|
314
|
+
border-color: var(--primer-color-border-outlined-disabled);
|
|
315
|
+
cursor: not-allowed;
|
|
316
|
+
}
|
|
317
|
+
`;var Ce=class extends f{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(i=>i.tagName.toLowerCase()==="primer-input");if(r)return r;for(let i of e){let s=i.querySelector("primer-input");if(s)return s}return null}render(){let e={"input-slot":!0,"focus-within":this.focusWithin};return m`
|
|
318
|
+
<div class="input-wrapper">
|
|
319
|
+
<slot name="label"></slot>
|
|
320
|
+
<div class="${pe(e)}" @click="${this.handleWrapperClick}">
|
|
321
|
+
<slot name="input"></slot>
|
|
322
|
+
</div>
|
|
323
|
+
<slot name="error"></slot>
|
|
324
|
+
</div>
|
|
325
|
+
`}};Ce.styles=[Pi],n([d({type:Boolean})],Ce.prototype,"focusWithin",2),n([d({type:Boolean,reflect:!0,attribute:"has-error"})],Ce.prototype,"hasError",2),n([Ne('slot[name="input"]')],Ce.prototype,"inputSlot",2),Ce=n([v("primer-input-wrapper")],Ce);var Ti=g`
|
|
326
|
+
:host {
|
|
327
|
+
display: inline-block;
|
|
328
|
+
font-weight: var(--primer-typography-body-small-weight);
|
|
329
|
+
font-size: var(--primer-typography-body-small-size);
|
|
330
|
+
letter-spacing: var(--primer-typography-body-small-letter-spacing);
|
|
331
|
+
line-height: var(--primer-typography-body-small-line-height);
|
|
332
|
+
color: var(--primer-color-text-primary);
|
|
333
|
+
font-family: var(--primer-typography-body-small-font);
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
:host([disabled]) {
|
|
337
|
+
color: var(--primer-color-text-disabled);
|
|
338
|
+
}
|
|
339
|
+
`;var Le=class extends f{constructor(){super(...arguments);this.for="";this.disabled=!1}render(){return m`<label for=${this.for}><slot></slot></label>`}};Le.styles=[Ti],n([d({type:String,reflect:!0})],Le.prototype,"for",2),n([d({type:Boolean,reflect:!0})],Le.prototype,"disabled",2),Le=n([v("primer-input-label")],Le);var wi=g`
|
|
340
|
+
:host {
|
|
341
|
+
display: contents;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
button {
|
|
345
|
+
align-items: center;
|
|
346
|
+
border-radius: var(--primer-radius-medium);
|
|
347
|
+
border: none;
|
|
348
|
+
cursor: pointer;
|
|
349
|
+
display: flex;
|
|
350
|
+
font-family: var(--primer-typography-title-large-font);
|
|
351
|
+
font-size: var(--primer-typography-title-large-size);
|
|
352
|
+
font-weight: var(--primer-typography-title-large-weight);
|
|
353
|
+
gap: var(--primer-space-small);
|
|
354
|
+
justify-content: center;
|
|
355
|
+
letter-spacing: var(--primer-typography-title-large-letter-spacing);
|
|
356
|
+
line-height: var(--primer-typography-title-large-line-height);
|
|
357
|
+
outline: none;
|
|
358
|
+
padding: var(--primer-space-medium) var(--primer-space-medium);
|
|
359
|
+
position: relative;
|
|
360
|
+
transition: all 0.2s ease-in-out;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
.button-content {
|
|
364
|
+
display: flex;
|
|
365
|
+
height: 100%;
|
|
366
|
+
align-items: center;
|
|
367
|
+
gap: var(--primer-space-small);
|
|
368
|
+
justify-content: center;
|
|
369
|
+
transition: opacity var(--primer-animation-duration)
|
|
370
|
+
var(--primer-animation-easing);
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
/* Reduce opacity of text during loading for better focus on the spinner */
|
|
374
|
+
.button-content.loading {
|
|
375
|
+
opacity: 0.65;
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
:host([selectable]) button {
|
|
379
|
+
justify-content: space-between;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
/* Primary variant */
|
|
383
|
+
:host([variant='primary']) button {
|
|
384
|
+
background-color: var(--primer-color-brand);
|
|
385
|
+
/* This is correct (color-background for color) because Button is kind of a special component */
|
|
386
|
+
color: var(--primer-color-background-outlined-default);
|
|
387
|
+
}
|
|
388
|
+
:host([variant='primary']:not([disabled]):not([loading])) button:hover {
|
|
389
|
+
filter: brightness(105%);
|
|
390
|
+
}
|
|
391
|
+
:host([variant='primary']:not([disabled]):not([loading])) button:active {
|
|
392
|
+
filter: brightness(98%);
|
|
393
|
+
}
|
|
394
|
+
:host([variant='primary']) button:focus-visible {
|
|
395
|
+
outline: 2px solid var(--primer-color-brand);
|
|
396
|
+
outline-offset: 2px;
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
/* Disabled state for primary button */
|
|
400
|
+
:host([variant='primary'][disabled]:not([loading])) button,
|
|
401
|
+
:host([variant='primary']:not([loading])) button:disabled {
|
|
402
|
+
color: var(--primer-color-text-disabled);
|
|
403
|
+
background-color: var(--primer-color-background-outlined-disabled);
|
|
404
|
+
cursor: not-allowed;
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
/* Loading state for primary button - OVERRIDES disabled styles with higher specificity */
|
|
408
|
+
:host([variant='primary'][loading]) button {
|
|
409
|
+
background-color: var(--primer-color-brand);
|
|
410
|
+
opacity: 0.8;
|
|
411
|
+
color: var(--primer-color-background-outlined-default);
|
|
412
|
+
cursor: wait;
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
/* Secondary variant */
|
|
416
|
+
:host([variant='secondary']) button {
|
|
417
|
+
background-color: var(--primer-color-background-outlined-default);
|
|
418
|
+
color: var(--primer-color-text-primary);
|
|
419
|
+
border: 1px solid var(--primer-color-border-outlined-default);
|
|
420
|
+
}
|
|
421
|
+
:host([variant='secondary']:not([disabled]):not([loading])) button:hover {
|
|
422
|
+
background-color: var(--primer-color-background-outlined-hover);
|
|
423
|
+
}
|
|
424
|
+
:host([variant='secondary']:not([disabled]):not([loading])) button:active {
|
|
425
|
+
background-color: var(--primer-color-background-outlined-active);
|
|
426
|
+
}
|
|
427
|
+
:host([variant='secondary']) button:focus-visible {
|
|
428
|
+
outline: 2px solid var(--primer-color-border-outlined-focus);
|
|
429
|
+
outline-offset: 2px;
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
/* Disabled state for secondary button */
|
|
433
|
+
:host([variant='secondary'][disabled]:not([loading])) button,
|
|
434
|
+
:host([variant='secondary']:not([loading])) button:disabled {
|
|
435
|
+
background-color: var(--primer-color-background-outlined-disabled);
|
|
436
|
+
border-color: var(--primer-color-border-outlined-disabled);
|
|
437
|
+
color: var(--primer-color-text-disabled);
|
|
438
|
+
cursor: not-allowed;
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
/* Loading state for secondary button - OVERRIDES disabled styles */
|
|
442
|
+
:host([variant='secondary'][loading]) button {
|
|
443
|
+
background-color: var(--primer-color-gray-100);
|
|
444
|
+
border-color: var(--primer-color-gray-300);
|
|
445
|
+
color: var(--primer-color-gray-600);
|
|
446
|
+
cursor: wait;
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
/* Tertiary variant */
|
|
450
|
+
:host([variant='tertiary']) button {
|
|
451
|
+
background-color: var(--primer-color-background-transparent-default);
|
|
452
|
+
border: 1px solid var(--primer-color-border-transparent-default);
|
|
453
|
+
color: var(--primer-color-text-primary);
|
|
454
|
+
border-radius: var(--primer-radius-small);
|
|
455
|
+
padding: var(--primer-space-xxsmall) var(--primer-space-xxsmall);
|
|
456
|
+
}
|
|
457
|
+
:host([variant='tertiary']:not([disabled]):not([loading])) button:hover {
|
|
458
|
+
border-radius: var(--primer-radius-small);
|
|
459
|
+
background-color: var(--primer-color-background-transparent-hover);
|
|
460
|
+
border: 1px solid var(--primer-color-border-transparent-hover);
|
|
461
|
+
color: var(--primer-color-text-primary);
|
|
462
|
+
}
|
|
463
|
+
:host([variant='tertiary']:not([disabled]):not([loading])) button:active {
|
|
464
|
+
background-color: var(--primer-color-background-transparent-active);
|
|
465
|
+
border-color: var(--primer-color-border-transparent-active);
|
|
466
|
+
border-radius: var(--primer-radius-small);
|
|
467
|
+
color: var(--primer-color-text-primary);
|
|
468
|
+
}
|
|
469
|
+
:host([variant='tertiary']) button:focus-visible {
|
|
470
|
+
border-radius: var(--primer-radius-small);
|
|
471
|
+
background-color: var(--primer-color-background-transparent-focus);
|
|
472
|
+
outline: 2px solid var(--primer-color-border-transparent-focus);
|
|
473
|
+
outline-offset: 2px;
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
/* Disabled state for tertiary button */
|
|
477
|
+
:host([variant='tertiary'][disabled]:not([loading])) button,
|
|
478
|
+
:host([variant='tertiary']:not([loading])) button:disabled {
|
|
479
|
+
background-color: var(--primer-color-border-transparent-disabled);
|
|
480
|
+
color: var(--primer-color-text-disabled);
|
|
481
|
+
cursor: not-allowed;
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
/* Loading state for tertiary button - OVERRIDES disabled styles */
|
|
485
|
+
:host([variant='tertiary'][loading]) button {
|
|
486
|
+
background-color: var(--primer-color-gray-100);
|
|
487
|
+
color: var(--primer-color-gray-600);
|
|
488
|
+
cursor: wait;
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
/* Checked state styling */
|
|
492
|
+
:host([selectionState='checked']) button {
|
|
493
|
+
border: 1px solid var(--primer-color-brand);
|
|
494
|
+
background-color: var(--primer-color-gray-100);
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
/* Loading state - center spinner with content */
|
|
498
|
+
:host([loading]) primer-spinner {
|
|
499
|
+
margin-right: var(--primer-space-xsmall);
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
/* Special case for tertiary variant loading state spinner size */
|
|
503
|
+
:host([variant='tertiary'][loading]) primer-spinner {
|
|
504
|
+
transform: scale(0.85);
|
|
505
|
+
}
|
|
506
|
+
`;var ne=class extends f{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?u:m`
|
|
507
|
+
<primer-icon
|
|
508
|
+
name="checkmark"
|
|
509
|
+
size="sm"
|
|
510
|
+
color="var(--primer-color-icon-primary)"
|
|
511
|
+
></primer-icon>
|
|
512
|
+
`}renderSpinner(){if(!this.loading)return u;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)"),m`
|
|
513
|
+
<primer-spinner
|
|
514
|
+
size="small"
|
|
515
|
+
color="${e}"
|
|
516
|
+
compact
|
|
517
|
+
></primer-spinner>
|
|
518
|
+
`}render(){return m`
|
|
519
|
+
<button
|
|
520
|
+
type=${this.buttonType}
|
|
521
|
+
?disabled=${this.disabled||this.loading}
|
|
522
|
+
@click=${this.handleClick}
|
|
523
|
+
part="button"
|
|
524
|
+
aria-checked=${this.selectionState==="checked"}
|
|
525
|
+
aria-busy=${this.loading}
|
|
526
|
+
>
|
|
527
|
+
${this.renderSpinner()}
|
|
528
|
+
<span class="button-content ${this.loading?"loading":""}">
|
|
529
|
+
<slot></slot>
|
|
530
|
+
</span>
|
|
531
|
+
${this.renderCheckmark()}
|
|
532
|
+
</button>
|
|
533
|
+
`}};ne.styles=[S,wi],n([d({type:String})],ne.prototype,"variant",2),n([d({type:Boolean,reflect:!0})],ne.prototype,"disabled",2),n([d({type:Boolean,reflect:!0})],ne.prototype,"loading",2),n([d({type:String})],ne.prototype,"buttonType",2),n([d({type:String,reflect:!0})],ne.prototype,"selectionState",2),n([d({type:Boolean,reflect:!0})],ne.prototype,"selectable",2),ne=n([v("primer-button")],ne);var ki=g`
|
|
534
|
+
:host {
|
|
535
|
+
display: contents;
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
:host(:not([active])) {
|
|
539
|
+
display: none;
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
.error {
|
|
543
|
+
color: var(--primer-color-text-negative);
|
|
544
|
+
font-size: var(--primer-typography-body-small-size);
|
|
545
|
+
line-height: var(--primer-typography-body-small-line-height);
|
|
546
|
+
display: block;
|
|
547
|
+
font-family: var(--primer-typography-body-small-font);
|
|
548
|
+
}
|
|
549
|
+
`;var Re=class extends f{constructor(){super(...arguments);this.for="";this.active=!0}render(){return m`
|
|
550
|
+
<span
|
|
551
|
+
class="error"
|
|
552
|
+
role="alert"
|
|
553
|
+
aria-live="polite"
|
|
554
|
+
id="${this.for||""}"
|
|
555
|
+
>
|
|
556
|
+
<slot></slot>
|
|
557
|
+
</span>
|
|
558
|
+
`}};Re.styles=[ki],n([d({type:String,reflect:!0})],Re.prototype,"for",2),n([d({type:Boolean,reflect:!0})],Re.prototype,"active",2),Re=n([v("primer-input-error")],Re);var Ii={pencil:Ie`
|
|
559
|
+
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
560
|
+
<path d="M12.3292 1.82659C12.142 1.63935 11.8779 1.53418 11.6028 1.53418C11.3277 1.53418 11.0636 1.63935 10.8764 1.82659L2.92969 9.77325V13.0666H6.22306L14.1698 5.11992C14.357 4.93268 14.4622 4.66859 14.4622 4.39352C14.4622 4.11844 14.357 3.85435 14.1698 3.66711L12.3292 1.82659ZM5.77375 11.7333H4.26302V10.2225L10.8764 3.60919L12.3871 5.11992L5.77375 11.7333Z" fill="currentColor"/>
|
|
561
|
+
</svg>
|
|
562
|
+
`,trash:Ie`
|
|
563
|
+
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
564
|
+
<path d="M13.8333 2.99992H11.5V2.49992C11.5 2.05789 11.3244 1.63397 11.0118 1.32141C10.6993 1.00885 10.2754 0.833252 9.83333 0.833252H6.16667C5.72464 0.833252 5.30072 1.00885 4.98816 1.32141C4.67559 1.63397 4.5 2.05789 4.5 2.49992V2.99992H2.16667C1.98986 2.99992 1.82029 3.07015 1.69526 3.19518C1.57024 3.32021 1.5 3.48978 1.5 3.66659C1.5 3.8434 1.57024 4.01297 1.69526 4.138C1.82029 4.26302 1.98986 4.33326 2.16667 4.33326H2.83333V12.4999C2.83333 12.942 3.00893 13.3659 3.32149 13.6784C3.63405 13.991 4.05797 14.1666 4.5 14.1666H11.5C11.942 14.1666 12.3659 13.991 12.6785 13.6784C12.9911 13.3659 13.1667 12.942 13.1667 12.4999V4.33326H13.8333C14.0101 4.33326 14.1797 4.26302 14.3047 4.138C14.4298 4.01297 14.5 3.8434 14.5 3.66659C14.5 3.48978 14.4298 3.32021 14.3047 3.19518C14.1797 3.07015 14.0101 2.99992 13.8333 2.99992ZM5.83333 2.49992C5.83333 2.32311 5.90357 2.15354 6.0286 2.02851C6.15362 1.90349 6.32319 1.83325 6.5 1.83325H9.5C9.67681 1.83325 9.84638 1.90349 9.9714 2.02851C10.0964 2.15354 10.1667 2.32311 10.1667 2.49992V2.99992H5.83333V2.49992ZM11.8333 12.4999C11.8333 12.6767 11.7631 12.8463 11.6381 12.9713C11.513 13.0964 11.3435 13.1666 11.1667 13.1666H4.83333C4.65652 13.1666 4.48695 13.0964 4.36193 12.9713C4.2369 12.8463 4.16667 12.6767 4.16667 12.4999V4.33326H11.8333V12.4999Z" fill="currentColor"/>
|
|
565
|
+
<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
|
+
<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
|
+
</svg>
|
|
568
|
+
`,"successful-check":Ie`
|
|
569
|
+
<svg
|
|
570
|
+
viewBox="0 0 56 56"
|
|
571
|
+
fill="none"
|
|
572
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
573
|
+
>
|
|
574
|
+
<g id="icon/check-circle-large">
|
|
575
|
+
<path
|
|
576
|
+
id="vector"
|
|
577
|
+
fill-rule="evenodd"
|
|
578
|
+
clip-rule="evenodd"
|
|
579
|
+
d="M20.1762 29.5746L24.8429 34.2413C25.295 34.7007 26.0387 34.7007 26.4908 34.2413L35.8241 24.9079C36.2835 24.4559 36.2835 23.7121 35.8241 23.26C35.372 22.8007 34.6283 22.8007 34.1762 23.26L25.6668 31.7694L21.8241 27.9267C21.372 27.4673 20.6283 27.4673 20.1762 27.9267C19.7168 28.3788 19.7168 29.1225 20.1762 29.5746ZM28.0002 47.4173C38.3106 47.4173 46.6668 39.0611 46.6668 28.7507C46.6668 18.4402 38.3106 10.084 28.0002 10.084C17.6897 10.084 9.3335 18.4402 9.3335 28.7507C9.3335 39.0611 17.6897 47.4173 28.0002 47.4173Z"
|
|
580
|
+
/>
|
|
581
|
+
</g>
|
|
582
|
+
</svg>
|
|
583
|
+
`,"failure-icon":Ie`
|
|
584
|
+
<svg
|
|
585
|
+
viewBox="0 0 40 40"
|
|
586
|
+
fill="none"
|
|
587
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
588
|
+
>
|
|
589
|
+
<path
|
|
590
|
+
fill-rule="evenodd"
|
|
591
|
+
clip-rule="evenodd"
|
|
592
|
+
d="M20.0008 23.3333C20.4614 23.3333 20.7873 22.9606 20.7873 22.5V15C20.7873 14.5394 20.4146 14.1666 20.0008 14.1666C19.587 14.1666 19.1675 14.5416 19.1675 15V22.5C19.1675 22.9583 19.5425 23.3333 20.0008 23.3333ZM32.9331 27.3594L22.5269 9.75935C22.0008 8.86821 21.0529 8.33488 20.0008 8.33331C18.9487 8.33331 18.006 8.8656 17.4748 9.75831L7.06331 27.3625C6.53987 28.2463 6.53206 29.3073 7.04134 30.201C7.568 31.1198 8.51904 31.6666 9.58935 31.6666H30.4175C31.4857 31.6666 32.4357 31.1182 32.9597 30.1995C33.4696 29.3073 33.4591 28.2448 32.9331 27.3594ZM18.7977 26.6666C18.7977 25.976 19.3107 25.4166 20.0008 25.4166C20.6935 25.4166 21.2508 25.9739 21.2039 26.6666C21.2039 27.3568 20.6909 27.9166 20.0008 27.9166C19.3576 27.9166 18.7977 27.3568 18.7977 26.6666Z"
|
|
593
|
+
/>
|
|
594
|
+
</svg>
|
|
595
|
+
`,"payment-card":Ie`
|
|
596
|
+
<svg width="28" height="21" viewBox="0 0 28 21" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
597
|
+
<rect y="0.748047" width="28" height="20" rx="2" fill="#E0E0E0"/>
|
|
598
|
+
<rect y="6.74805" width="28" height="4" fill="#212121"/>
|
|
599
|
+
<rect x="19" y="13.748" width="6" height="4" rx="0.933333" fill="white"/>
|
|
600
|
+
</svg>
|
|
601
|
+
`,"chevron-down":Ie`
|
|
602
|
+
<svg width="8" height="6" viewBox="0 0 8 6" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
603
|
+
<path d="M4.41978 4.90118C4.32079 5.02361 4.16188 5.08353 4.00037 5.08353C3.83887 5.08353 3.67996 5.02361 3.55753 4.90118L0.63995 1.9836C0.395733 1.73939 0.395733 1.34382 0.63995 1.09947C0.884167 0.855124 1.27973 0.855254 1.52408 1.09947L4.00037 3.57524L6.47589 1.09973C6.72011 0.855515 7.11567 0.855515 7.36002 1.09973C7.60437 1.34395 7.60424 1.73952 7.36002 1.98386L4.41978 4.90118Z" fill="#212121"/>
|
|
604
|
+
</svg>`,checkmark:Ie`
|
|
605
|
+
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
606
|
+
<path d="M15.6326 6.12193C15.8983 6.3668 15.8983 6.76276 15.6326 6.98418L8.75546 13.8613C8.53404 14.127 8.13808 14.127 7.89321 13.8613L4.35119 10.3186C4.10706 10.0971 4.10706 9.70118 4.35119 9.45631C4.59531 9.21404 4.99126 9.21404 5.23535 9.45631L8.33606 12.5588L14.7704 6.12193C15.0152 5.87863 15.4112 5.87863 15.6326 6.12193Z" fill="#212121"/>
|
|
607
|
+
</svg>
|
|
608
|
+
`};var Ni=g`
|
|
609
|
+
:host {
|
|
610
|
+
display: inline-block;
|
|
611
|
+
line-height: 0; /* so you don’t get extra space around the icon */
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
/* Styling svgs rendered by passing *name* attribute - from our library file */
|
|
615
|
+
:host([size='sm']) svg {
|
|
616
|
+
width: 20px;
|
|
617
|
+
height: 20px;
|
|
618
|
+
}
|
|
619
|
+
|
|
620
|
+
:host([size='md']) svg {
|
|
621
|
+
width: 42px;
|
|
622
|
+
height: 42px;
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
:host([size='lg']) svg {
|
|
626
|
+
width: 56px;
|
|
627
|
+
height: 56px;
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
svg {
|
|
631
|
+
/* --internal used for abstracting away the icon component */
|
|
632
|
+
fill: var(--internal-icon-color, currentColor);
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
/* For slotted icons */
|
|
636
|
+
:host([size='sm']) ::slotted(svg) {
|
|
637
|
+
width: 20px;
|
|
638
|
+
height: 20px;
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
:host([size='lg']) ::slotted(svg) {
|
|
642
|
+
width: 56px;
|
|
643
|
+
height: 56px;
|
|
644
|
+
}
|
|
645
|
+
|
|
646
|
+
::slotted(svg) {
|
|
647
|
+
/* --internal used for abstracting away the icon component */
|
|
648
|
+
fill: var(--internal-icon-color, currentColor);
|
|
649
|
+
}
|
|
650
|
+
`;var Ae=class extends f{constructor(){super(...arguments);this.color="var(--primer-color-icon-primary)";this.size="lg"}render(){let e=this.name?Ii[this.name]:null;return m`
|
|
651
|
+
<div style="--internal-icon-color: ${this.color}">
|
|
652
|
+
${e||m`<slot></slot>`}
|
|
653
|
+
</div>
|
|
654
|
+
`}};Ae.styles=[Ni],n([d({type:String})],Ae.prototype,"color",2),n([d({type:String})],Ae.prototype,"size",2),n([d({reflect:!0})],Ae.prototype,"name",2),Ae=n([v("primer-icon")],Ae);var Li=g`
|
|
655
|
+
:host {
|
|
656
|
+
display: flex;
|
|
657
|
+
flex-direction: column;
|
|
658
|
+
align-items: center;
|
|
659
|
+
gap: var(--primer-space-xsmall);
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
p {
|
|
663
|
+
margin: 0;
|
|
664
|
+
|
|
665
|
+
color: var(--primer-color-text-primary);
|
|
666
|
+
text-align: center;
|
|
667
|
+
font-size: var(--primer-typography-body-large-size);
|
|
668
|
+
font-family: var(--primer-typography-body-large-font);
|
|
669
|
+
font-weight: var(--primer-typography-body-large-weight);
|
|
670
|
+
line-height: var(--primer-typography-body-large-line-height);
|
|
671
|
+
letter-spacing: var(--primer-typography-body-large-letter-spacing);
|
|
672
|
+
}
|
|
673
|
+
|
|
674
|
+
p.secondary {
|
|
675
|
+
color: var(--primer-color-text-secondary);
|
|
676
|
+
text-align: center;
|
|
677
|
+
font-family: var(--primer-typography-body-medium-font, Inter);
|
|
678
|
+
font-size: var(--primer-typography-body-medium-size);
|
|
679
|
+
font-weight: var(--primer-typography-body-medium-weight);
|
|
680
|
+
line-height: var(--primer-typography-body-medium-line-height);
|
|
681
|
+
letter-spacing: var(--primer-typography-body-medium-letter-spacing);
|
|
682
|
+
}
|
|
683
|
+
`;var Oe=class extends f{constructor(){super(...arguments);this.type="complete"}render(){return this.type==="complete"?m`
|
|
684
|
+
<!-- Successful view -->
|
|
685
|
+
<primer-icon
|
|
686
|
+
size="lg"
|
|
687
|
+
name="successful-check"
|
|
688
|
+
color="var(--primer-color-icon-positive)"
|
|
689
|
+
>
|
|
690
|
+
</primer-icon>
|
|
691
|
+
<p>Checkout complete!</p>
|
|
692
|
+
<p class="secondary">
|
|
693
|
+
You'll be redirected to the order confirmation page soon.
|
|
694
|
+
</p>
|
|
695
|
+
`:m`
|
|
696
|
+
<primer-icon
|
|
697
|
+
size="lg"
|
|
698
|
+
name="failure-icon"
|
|
699
|
+
color="var(--primer-color-icon-negative)"
|
|
700
|
+
>
|
|
701
|
+
</primer-icon>
|
|
702
|
+
<p>Payment failed</p>
|
|
703
|
+
${this.description?m`<p class="secondary">${this.description}</p>`:m`<p class="secondary">Something went wrong.</p>`}
|
|
704
|
+
`}};Oe.styles=[Li],n([d({type:String})],Oe.prototype,"type",2),n([d({type:String})],Oe.prototype,"description",2),Oe=n([v("primer-checkout-state")],Oe);var Ri=g`
|
|
705
|
+
:host {
|
|
706
|
+
display: contents;
|
|
707
|
+
}
|
|
708
|
+
|
|
709
|
+
input {
|
|
710
|
+
width: 100%;
|
|
711
|
+
padding: 0;
|
|
712
|
+
border: none;
|
|
713
|
+
height: var(--primer-typography-body-large-line-height);
|
|
714
|
+
font-size: var(--primer-typography-body-large-size);
|
|
715
|
+
font-family: var(--primer-typography-body-large-font);
|
|
716
|
+
color: var(--primer-color-text-primary);
|
|
717
|
+
background-color: transparent;
|
|
718
|
+
outline: none;
|
|
719
|
+
}
|
|
720
|
+
|
|
721
|
+
input::placeholder {
|
|
722
|
+
color: var(--primer-color-text-placeholder);
|
|
723
|
+
font-size: var(--primer-typography-body-large-size);
|
|
724
|
+
font-family: var(--primer-typography-body-large-font);
|
|
725
|
+
}
|
|
726
|
+
|
|
727
|
+
:host([disabled]) input {
|
|
728
|
+
color: var(--primer-color-text-disabled);
|
|
729
|
+
cursor: not-allowed;
|
|
730
|
+
}
|
|
731
|
+
|
|
732
|
+
:host([disabled]) input::placeholder {
|
|
733
|
+
color: var(--primer-color-text-disabled);
|
|
734
|
+
}
|
|
735
|
+
`;var kn=["text","password","email","number","tel","url","search","date","time","datetime-local","month","week","color"];function In(o){return kn.includes(o)}var Y=class extends f{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 i=new CustomEvent("input",{detail:this.value,bubbles:!0,composed:!0});this.dispatchEvent(i)}handleChange(e){e.stopPropagation();let r=e.target;this.value=r.value;let i=new CustomEvent("change",{detail:this.value,bubbles:!0,composed:!0});this.dispatchEvent(i)}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,i){this.inputElement?.setSelectionRange(e,r,i)}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(([,i])=>i).map(([i])=>i).join(" ");return m`
|
|
736
|
+
<input
|
|
737
|
+
part="input"
|
|
738
|
+
class=${r}
|
|
739
|
+
.value=${this.value}
|
|
740
|
+
.type=${this.type}
|
|
741
|
+
?disabled=${this.disabled}
|
|
742
|
+
?required=${this.required}
|
|
743
|
+
?readonly=${this.readonly}
|
|
744
|
+
placeholder=${this.placeholder}
|
|
745
|
+
pattern=${this.pattern}
|
|
746
|
+
minlength=${this.minlength??""}
|
|
747
|
+
maxlength=${this.maxlength??""}
|
|
748
|
+
min=${this.min}
|
|
749
|
+
max=${this.max}
|
|
750
|
+
step=${this.step}
|
|
751
|
+
autocomplete=${this.autocomplete}
|
|
752
|
+
name=${this.name}
|
|
753
|
+
id=${this.id}
|
|
754
|
+
@input=${this.handleInput}
|
|
755
|
+
@change=${this.handleChange}
|
|
756
|
+
@focus=${this.handleFocus}
|
|
757
|
+
@blur=${this.handleBlur}
|
|
758
|
+
@invalid=${this.handleInvalid}
|
|
759
|
+
/>
|
|
760
|
+
`}addEventListener(e,r,i){super.addEventListener(e,r,i)}removeEventListener(e,r,i){super.removeEventListener(e,r,i)}};Y.styles=[Ri],n([Ne("input")],Y.prototype,"inputElement",2),n([d({type:String,reflect:!0})],Y.prototype,"value",2),n([d({type:String,reflect:!0})],Y.prototype,"placeholder",2),n([d({type:Boolean,reflect:!0})],Y.prototype,"disabled",2),n([d({type:String,reflect:!0})],Y.prototype,"name",2),n([d({type:String,reflect:!0,converter:{fromAttribute:e=>!e||!In(e)?(e&&e!=="text"&&N.warn(`Invalid input type: ${e}. Defaulting to 'text'.`),"text"):e}})],Y.prototype,"type",2),n([d({type:Boolean,reflect:!0})],Y.prototype,"required",2),n([d({type:Boolean,reflect:!0})],Y.prototype,"readonly",2),n([d({type:String,reflect:!0})],Y.prototype,"pattern",2),n([d({type:Number,reflect:!0})],Y.prototype,"minlength",2),n([d({type:Number,reflect:!0})],Y.prototype,"maxlength",2),n([d({type:String,reflect:!0})],Y.prototype,"min",2),n([d({type:String,reflect:!0})],Y.prototype,"max",2),n([d({type:String,reflect:!0})],Y.prototype,"step",2),n([d({type:String,reflect:!0})],Y.prototype,"autocomplete",2),n([d({type:String,reflect:!0})],Y.prototype,"id",2),n([w()],Y.prototype,"hasFocus",2),n([w()],Y.prototype,"hasError",2),Y=n([v("primer-input")],Y);var Oi=g`
|
|
761
|
+
:host {
|
|
762
|
+
display: block;
|
|
763
|
+
}
|
|
764
|
+
|
|
765
|
+
.collapsable {
|
|
766
|
+
width: 100%;
|
|
767
|
+
}
|
|
768
|
+
|
|
769
|
+
/* Make the button display with full width */
|
|
770
|
+
primer-button::part(button) {
|
|
771
|
+
width: 100%;
|
|
772
|
+
}
|
|
773
|
+
|
|
774
|
+
.collapsable-wrapper {
|
|
775
|
+
display: grid;
|
|
776
|
+
grid-template-rows: 0fr;
|
|
777
|
+
transition: grid-template-rows var(--primer-animation-duration)
|
|
778
|
+
var(--primer-animation-easing);
|
|
779
|
+
overflow: hidden;
|
|
780
|
+
border-top: none;
|
|
781
|
+
margin-top: -1px;
|
|
782
|
+
}
|
|
783
|
+
|
|
784
|
+
.collapsable-wrapper.expanded {
|
|
785
|
+
grid-template-rows: 1fr;
|
|
786
|
+
}
|
|
787
|
+
|
|
788
|
+
.collapsable-content {
|
|
789
|
+
min-height: 0;
|
|
790
|
+
overflow: hidden;
|
|
791
|
+
padding: var(--primer-space-medium, 12px) 0;
|
|
792
|
+
}
|
|
793
|
+
|
|
794
|
+
.icon-container {
|
|
795
|
+
display: flex;
|
|
796
|
+
align-items: center;
|
|
797
|
+
justify-content: center;
|
|
798
|
+
transition: transform var(--primer-animation-duration)
|
|
799
|
+
var(--primer-animation-easing);
|
|
800
|
+
font-size: 0.75em;
|
|
801
|
+
}
|
|
802
|
+
|
|
803
|
+
.icon-container.expanded {
|
|
804
|
+
transform: rotate(180deg);
|
|
805
|
+
}
|
|
806
|
+
|
|
807
|
+
/* Disable animation for users who prefer reduced motion */
|
|
808
|
+
@media (prefers-reduced-motion: reduce) {
|
|
809
|
+
.collapsable-wrapper,
|
|
810
|
+
.icon-container {
|
|
811
|
+
transition: none;
|
|
812
|
+
}
|
|
813
|
+
}
|
|
814
|
+
`;var re=class extends f{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,i=this.header||e;return m`
|
|
815
|
+
<div class="collapsable">
|
|
816
|
+
<primer-button
|
|
817
|
+
variant=${this.buttonVariant}
|
|
818
|
+
buttonType="button"
|
|
819
|
+
@click=${this.toggleExpanded}
|
|
820
|
+
aria-expanded=${this.isExpanded}
|
|
821
|
+
aria-controls="collapsable-content"
|
|
822
|
+
aria-label=${r}
|
|
823
|
+
>
|
|
824
|
+
<span>${i}</span>
|
|
825
|
+
</primer-button>
|
|
826
|
+
|
|
827
|
+
<div
|
|
828
|
+
class="collapsable-wrapper ${this.isExpanded?"expanded":""}"
|
|
829
|
+
id="collapsable-content"
|
|
830
|
+
role="region"
|
|
831
|
+
aria-labelledby="collapsable-header"
|
|
832
|
+
>
|
|
833
|
+
<div class="collapsable-content">
|
|
834
|
+
<slot></slot>
|
|
835
|
+
</div>
|
|
836
|
+
</div>
|
|
837
|
+
</div>
|
|
838
|
+
`}};re.styles=[Oi],n([d({type:String})],re.prototype,"header",2),n([d({type:Boolean})],re.prototype,"expanded",2),n([d({type:String})],re.prototype,"expandText",2),n([d({type:String})],re.prototype,"collapseText",2),n([d({type:String})],re.prototype,"ariaLabel",2),n([d({type:String})],re.prototype,"buttonVariant",2),n([w()],re.prototype,"isExpanded",2),re=n([v("primer-collapsable")],re);var Di=g`
|
|
839
|
+
:host {
|
|
840
|
+
display: block;
|
|
841
|
+
width: 100%;
|
|
842
|
+
box-sizing: border-box;
|
|
843
|
+
}
|
|
844
|
+
|
|
845
|
+
.error-message {
|
|
846
|
+
display: flex;
|
|
847
|
+
align-items: flex-start;
|
|
848
|
+
padding: var(--primer-space-medium);
|
|
849
|
+
background-color: var(--primer-color-red-100);
|
|
850
|
+
border-radius: var(--primer-radius-medium);
|
|
851
|
+
border: 1px solid var(--primer-color-border-outlined-error);
|
|
852
|
+
margin-top: var(--primer-space-small);
|
|
853
|
+
box-sizing: border-box;
|
|
854
|
+
width: 100%;
|
|
855
|
+
|
|
856
|
+
/* Add animation properties */
|
|
857
|
+
opacity: 1;
|
|
858
|
+
transform: translateY(0);
|
|
859
|
+
transition:
|
|
860
|
+
opacity var(--primer-animation-duration) var(--primer-animation-easing),
|
|
861
|
+
transform var(--primer-animation-duration) var(--primer-animation-easing);
|
|
862
|
+
}
|
|
863
|
+
|
|
864
|
+
.error-message.hidden {
|
|
865
|
+
opacity: 0;
|
|
866
|
+
transform: translateY(-var(--primer-space-medium));
|
|
867
|
+
pointer-events: none;
|
|
868
|
+
}
|
|
869
|
+
|
|
870
|
+
.error-icon {
|
|
871
|
+
flex-shrink: 0;
|
|
872
|
+
margin-right: var(--primer-space-medium);
|
|
873
|
+
color: var(--primer-color-icon-negative);
|
|
874
|
+
}
|
|
875
|
+
|
|
876
|
+
.error-content {
|
|
877
|
+
flex: 1;
|
|
878
|
+
font-family: var(--primer-typography-body-medium-font);
|
|
879
|
+
font-size: var(--primer-typography-body-medium-size);
|
|
880
|
+
font-weight: var(--primer-typography-body-medium-weight);
|
|
881
|
+
line-height: var(--primer-typography-body-medium-line-height);
|
|
882
|
+
letter-spacing: var(--primer-typography-body-medium-letter-spacing);
|
|
883
|
+
color: var(--primer-color-text-negative);
|
|
884
|
+
}
|
|
885
|
+
|
|
886
|
+
/* Respect user's preference for reduced motion */
|
|
887
|
+
@media (prefers-reduced-motion: reduce) {
|
|
888
|
+
.error-message {
|
|
889
|
+
transition: opacity var(--primer-animation-duration)
|
|
890
|
+
var(--primer-animation-easing);
|
|
891
|
+
transform: none;
|
|
892
|
+
}
|
|
893
|
+
|
|
894
|
+
.error-message.hidden {
|
|
895
|
+
transform: none;
|
|
896
|
+
}
|
|
897
|
+
}
|
|
898
|
+
`;var he=class extends f{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 u;let e={"error-message":!0,hidden:!this.visible};return m`
|
|
899
|
+
<div
|
|
900
|
+
part="error-message"
|
|
901
|
+
class=${pe(e)}
|
|
902
|
+
aria-live="assertive"
|
|
903
|
+
aria-atomic="true"
|
|
904
|
+
>
|
|
905
|
+
<div part="error-icon" class="error-icon">
|
|
906
|
+
<primer-icon
|
|
907
|
+
name="failure-icon"
|
|
908
|
+
size="sm"
|
|
909
|
+
color="var(--primer-color-icon-negative)"
|
|
910
|
+
></primer-icon>
|
|
911
|
+
</div>
|
|
912
|
+
<div part="error-content" class="error-content">${this.message}</div>
|
|
913
|
+
</div>
|
|
914
|
+
`}};he.styles=[Di],n([d({type:String})],he.prototype,"message",2),n([d({type:Boolean,reflect:!0})],he.prototype,"visible",2),n([d({type:String,reflect:!0})],he.prototype,"role",2),n([w()],he.prototype,"showMessage",2),he=n([v("primer-error-message")],he);var $i=g`
|
|
915
|
+
:host {
|
|
916
|
+
display: contents;
|
|
917
|
+
}
|
|
918
|
+
|
|
919
|
+
.klarna-container {
|
|
920
|
+
display: flex;
|
|
921
|
+
flex-direction: column;
|
|
922
|
+
width: 100%;
|
|
923
|
+
transition: all var(--primer-animation-duration)
|
|
924
|
+
var(--primer-animation-easing);
|
|
925
|
+
}
|
|
926
|
+
|
|
927
|
+
.klarna-container.expanded {
|
|
928
|
+
border-radius: var(--primer-radius-medium);
|
|
929
|
+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
|
930
|
+
background-color: var(--primer-color-background-outlined-default);
|
|
931
|
+
border: 1px solid var(--primer-color-border-outlined-default);
|
|
932
|
+
padding: var(--primer-space-large);
|
|
933
|
+
}
|
|
934
|
+
|
|
935
|
+
.klarna-button-header {
|
|
936
|
+
padding: 0;
|
|
937
|
+
display: flex;
|
|
938
|
+
align-items: center;
|
|
939
|
+
justify-content: space-between;
|
|
940
|
+
width: 100%;
|
|
941
|
+
gap: var(--primer-space-small);
|
|
942
|
+
}
|
|
943
|
+
|
|
944
|
+
.klarna-accordion-icon {
|
|
945
|
+
position: absolute;
|
|
946
|
+
right: var(--primer-space-medium);
|
|
947
|
+
font-size: var(--primer-typography-body-small-size);
|
|
948
|
+
font-weight: var(--primer-typography-title-large-weight);
|
|
949
|
+
color: var(--primer-color-text-secondary);
|
|
950
|
+
transition: all var(--primer-animation-duration)
|
|
951
|
+
var(--primer-animation-easing);
|
|
952
|
+
display: inline-flex;
|
|
953
|
+
align-items: center;
|
|
954
|
+
justify-content: center;
|
|
955
|
+
width: 24px;
|
|
956
|
+
height: 24px;
|
|
957
|
+
margin-left: var(--primer-space-small);
|
|
958
|
+
}
|
|
959
|
+
|
|
960
|
+
.klarna-accordion-icon.expanded {
|
|
961
|
+
transform: rotate(180deg);
|
|
962
|
+
}
|
|
963
|
+
|
|
964
|
+
.klarna-expanded-content {
|
|
965
|
+
width: 100%;
|
|
966
|
+
display: grid;
|
|
967
|
+
grid-template-rows: 0fr;
|
|
968
|
+
transition: grid-template-rows var(--primer-animation-duration)
|
|
969
|
+
var(--primer-animation-easing);
|
|
970
|
+
}
|
|
971
|
+
|
|
972
|
+
.klarna-expanded-content.visible {
|
|
973
|
+
margin-top: var(--primer-space-large);
|
|
974
|
+
border-top: 1px solid var(--primer-color-border-outlined-default);
|
|
975
|
+
grid-template-rows: 1fr;
|
|
976
|
+
}
|
|
977
|
+
|
|
978
|
+
.klarna-accordion-content {
|
|
979
|
+
overflow: hidden;
|
|
980
|
+
}
|
|
981
|
+
|
|
982
|
+
@keyframes fadeIn {
|
|
983
|
+
from {
|
|
984
|
+
opacity: 0;
|
|
985
|
+
transform: translateY(-10px);
|
|
986
|
+
}
|
|
987
|
+
to {
|
|
988
|
+
opacity: 1;
|
|
989
|
+
transform: translateY(0);
|
|
990
|
+
}
|
|
991
|
+
}
|
|
992
|
+
|
|
993
|
+
.category-selection {
|
|
994
|
+
display: flex;
|
|
995
|
+
flex-wrap: wrap;
|
|
996
|
+
gap: var(--primer-space-small);
|
|
997
|
+
margin: var(--primer-space-large) 0;
|
|
998
|
+
}
|
|
999
|
+
|
|
1000
|
+
.category-button {
|
|
1001
|
+
padding: var(--primer-space-medium) var(--primer-space-large);
|
|
1002
|
+
border-radius: var(--primer-radius-base);
|
|
1003
|
+
background-color: var(--primer-color-background-outlined-loading);
|
|
1004
|
+
border: 1px solid var(--primer-color-border-outlined-default);
|
|
1005
|
+
font-size: var(--primer-typography-body-medium-size);
|
|
1006
|
+
cursor: pointer;
|
|
1007
|
+
transition: all var(--primer-animation-duration)
|
|
1008
|
+
var(--primer-animation-easing);
|
|
1009
|
+
flex: 1;
|
|
1010
|
+
min-width: 100px;
|
|
1011
|
+
text-align: center;
|
|
1012
|
+
}
|
|
1013
|
+
|
|
1014
|
+
.category-button.selected {
|
|
1015
|
+
background-color: var(--primer-color-background-outlined-default);
|
|
1016
|
+
border-color: var(--primer-color-brand);
|
|
1017
|
+
color: var(--primer-color-brand);
|
|
1018
|
+
font-weight: var(--primer-typography-title-large-weight);
|
|
1019
|
+
}
|
|
1020
|
+
|
|
1021
|
+
.category-button:hover:not(.selected) {
|
|
1022
|
+
background-color: var(--primer-color-background-outlined-hover);
|
|
1023
|
+
}
|
|
1024
|
+
|
|
1025
|
+
.klarna-category-container {
|
|
1026
|
+
min-height: 74px;
|
|
1027
|
+
width: 100%;
|
|
1028
|
+
border-radius: var(--primer-radius-small);
|
|
1029
|
+
border: 1px solid var(--primer-color-border-outlined-default);
|
|
1030
|
+
background-color: var(--primer-color-background-outlined-default);
|
|
1031
|
+
padding: var(--primer-space-medium);
|
|
1032
|
+
margin-bottom: var(--primer-space-large);
|
|
1033
|
+
transition: height var(--primer-animation-duration)
|
|
1034
|
+
var(--primer-animation-easing);
|
|
1035
|
+
overflow: hidden;
|
|
1036
|
+
}
|
|
1037
|
+
|
|
1038
|
+
.klarna-button::part(button) {
|
|
1039
|
+
display: flex;
|
|
1040
|
+
flex: 1;
|
|
1041
|
+
gap: var(--primer-space-small);
|
|
1042
|
+
height: calc(
|
|
1043
|
+
var(--primer-typography-title-large-line-height) +
|
|
1044
|
+
calc(2 * var(--primer-space-medium))
|
|
1045
|
+
);
|
|
1046
|
+
width: 100%;
|
|
1047
|
+
}
|
|
1048
|
+
|
|
1049
|
+
.klarna-button primer-icon {
|
|
1050
|
+
margin-right: var(--primer-space-medium);
|
|
1051
|
+
}
|
|
1052
|
+
|
|
1053
|
+
.klarna-button:hover {
|
|
1054
|
+
background-color: var(--primer-color-background-outlined-hover);
|
|
1055
|
+
border-color: var(--primer-color-border-outlined-hover);
|
|
1056
|
+
}
|
|
1057
|
+
|
|
1058
|
+
.klarna-pay-button {
|
|
1059
|
+
padding: var(--primer-space-medium) var(--primer-space-large);
|
|
1060
|
+
display: flex;
|
|
1061
|
+
align-items: center;
|
|
1062
|
+
justify-content: center;
|
|
1063
|
+
border-radius: var(--primer-radius-small);
|
|
1064
|
+
background-color: var(--primer-color-brand);
|
|
1065
|
+
color: var(--primer-color-background-outlined-default);
|
|
1066
|
+
border: none;
|
|
1067
|
+
font-size: var(--primer-typography-body-medium-size);
|
|
1068
|
+
font-weight: var(--primer-typography-body-medium-weight);
|
|
1069
|
+
width: 100%;
|
|
1070
|
+
cursor: pointer;
|
|
1071
|
+
transition: all var(--primer-animation-duration)
|
|
1072
|
+
var(--primer-animation-easing);
|
|
1073
|
+
}
|
|
1074
|
+
|
|
1075
|
+
.klarna-pay-button:hover:not(.disabled) {
|
|
1076
|
+
filter: brightness(105%);
|
|
1077
|
+
}
|
|
1078
|
+
|
|
1079
|
+
.klarna-pay-button.loading {
|
|
1080
|
+
opacity: 0.7;
|
|
1081
|
+
pointer-events: none;
|
|
1082
|
+
}
|
|
1083
|
+
|
|
1084
|
+
.klarna-pay-button.disabled {
|
|
1085
|
+
opacity: 0.5;
|
|
1086
|
+
cursor: not-allowed;
|
|
1087
|
+
filter: brightness(85%);
|
|
1088
|
+
}
|
|
1089
|
+
|
|
1090
|
+
.loading {
|
|
1091
|
+
text-align: center;
|
|
1092
|
+
font-size: var(--primer-typography-body-medium-size);
|
|
1093
|
+
color: var(--primer-color-text-secondary);
|
|
1094
|
+
padding: var(--primer-space-medium);
|
|
1095
|
+
}
|
|
1096
|
+
|
|
1097
|
+
.error {
|
|
1098
|
+
color: var(--primer-color-text-negative);
|
|
1099
|
+
font-size: var(--primer-typography-body-medium-size);
|
|
1100
|
+
padding: var(--primer-space-medium);
|
|
1101
|
+
text-align: center;
|
|
1102
|
+
border: 1px solid var(--primer-color-border-outlined-error);
|
|
1103
|
+
background-color: var(--primer-color-background-outlined-default);
|
|
1104
|
+
border-radius: var(--primer-radius-small);
|
|
1105
|
+
}
|
|
1106
|
+
`;var Z=class extends f{constructor(){super(...arguments);this.paymentManagers=new Map;this.sdkState=null;this.headlessUtils=null;this.klarnaCategories=null;this.selectedCategory=null;this.isExpanded=!1;this.headerAriaLabel=P("pay_with",{id:"pay_with"});this._paymentMethodManagerTask=new V(this,{task:async([e,r])=>{if(!e||!r)return D;let i=await r.getCDNAssets("KLARNA");return{manager:e.manager,klarnaIcon:i?.assets?.icon?`${i.goatCdnUrl}/${i.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){N.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){N.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?m`<div class="loading">
|
|
1107
|
+
<primer-spinner size="small"></primer-spinner>
|
|
1108
|
+
</div>`:e.length<=1?u:m`
|
|
1109
|
+
<div class="category-selection">
|
|
1110
|
+
${e.map(i=>m`
|
|
1111
|
+
<button
|
|
1112
|
+
class=${pe({"category-button":!0,selected:i.id===this.selectedCategory})}
|
|
1113
|
+
@click=${()=>{this.selectCategory(i.id)}}
|
|
1114
|
+
>
|
|
1115
|
+
${i.name}
|
|
1116
|
+
</button>
|
|
1117
|
+
`)}
|
|
1118
|
+
</div>
|
|
1119
|
+
`}renderExpandedContent(){return m`
|
|
1120
|
+
${this.renderCategorySelection()}
|
|
1121
|
+
${this.selectedCategory?m`
|
|
1122
|
+
<div
|
|
1123
|
+
id="klarna-category-container"
|
|
1124
|
+
class="klarna-category-container"
|
|
1125
|
+
></div>
|
|
1126
|
+
`:u}
|
|
1127
|
+
|
|
1128
|
+
<button
|
|
1129
|
+
class=${pe({"klarna-pay-button":!0,loading:!!this.sdkState?.isProcessing,disabled:!this.selectedCategory})}
|
|
1130
|
+
?disabled=${!this.selectedCategory||this.sdkState?.isProcessing}
|
|
1131
|
+
@click=${()=>this.startKlarnaPayment()}
|
|
1132
|
+
>
|
|
1133
|
+
${P("confirm",{id:"confirm"})}
|
|
1134
|
+
</button>
|
|
1135
|
+
`}render(){return this._paymentMethodManagerTask.render({error:e=>{let r=e instanceof Error?e.message:"Unknown error in Klarna";return m`<div class="error">
|
|
1136
|
+
Error loading Klarna: ${r}
|
|
1137
|
+
</div>`},complete:({manager:e,klarnaIcon:r})=>e?m`
|
|
1138
|
+
<div class="klarna-container ${this.isExpanded?"expanded":""}">
|
|
1139
|
+
<div class="klarna-button-header">
|
|
1140
|
+
<primer-button
|
|
1141
|
+
buttonType="button"
|
|
1142
|
+
variant="secondary"
|
|
1143
|
+
class="klarna-button"
|
|
1144
|
+
@click=${this.toggleExpand}
|
|
1145
|
+
aria-expanded=${this.isExpanded}
|
|
1146
|
+
aria-controls="collapsable-content"
|
|
1147
|
+
aria-label=${this.headerAriaLabel}
|
|
1148
|
+
>
|
|
1149
|
+
<img src=${r} alt="Klarna logo" />
|
|
1150
|
+
<span>${P("pay_with",{id:"pay_with"})} Klarna</span>
|
|
1151
|
+
<span
|
|
1152
|
+
class="klarna-accordion-icon ${this.isExpanded?"expanded":""}"
|
|
1153
|
+
>
|
|
1154
|
+
▼
|
|
1155
|
+
</span>
|
|
1156
|
+
</primer-button>
|
|
1157
|
+
</div>
|
|
1158
|
+
|
|
1159
|
+
<div
|
|
1160
|
+
class="klarna-expanded-content ${this.isExpanded?"visible":""}"
|
|
1161
|
+
>
|
|
1162
|
+
<div class="klarna-accordion-content">
|
|
1163
|
+
${this.renderExpandedContent()}
|
|
1164
|
+
</div>
|
|
1165
|
+
</div>
|
|
1166
|
+
</div>
|
|
1167
|
+
`:u})}};Z.styles=[S,$i],n([C({context:ue,subscribe:!0}),d()],Z.prototype,"paymentManagers",2),n([C({context:j,subscribe:!0}),d()],Z.prototype,"sdkState",2),n([C({context:q,subscribe:!0}),d({type:Object})],Z.prototype,"headlessUtils",2),n([C({context:qt,subscribe:!0}),d()],Z.prototype,"klarnaCategories",2),n([w()],Z.prototype,"selectedCategory",2),n([w()],Z.prototype,"isExpanded",2),n([w()],Z.prototype,"headerAriaLabel",2),n([Ne("#klarna-category-container")],Z.prototype,"klarnaContainer",2),Z=n([v("primer-klarna"),I()],Z);var Vi=g`
|
|
1168
|
+
:host {
|
|
1169
|
+
display: contents;
|
|
1170
|
+
}
|
|
1171
|
+
`;var De=class extends f{constructor(){super(...arguments);this.type=void 0;this.paymentMethods=null}render(){if(!this.type)return u;let e=this.paymentMethods?.get(this.type);if(!e)return u;switch(e?.managerType){case"CARD":return m`<primer-card-form></primer-card-form>`;case"NATIVE":return m`<primer-native-payment
|
|
1172
|
+
.paymentMethod=${e}
|
|
1173
|
+
></primer-native-payment>`;case"REDIRECT":return m`<primer-redirect-payment
|
|
1174
|
+
.paymentMethod=${e}
|
|
1175
|
+
></primer-redirect-payment>`;case"KLARNA":return m`<primer-klarna></primer-klarna>`;default:return u}}};De.styles=[Vi],n([d({type:String})],De.prototype,"type",2),n([C({context:it,subscribe:!0}),d()],De.prototype,"paymentMethods",2),De=n([v("primer-payment-method")],De);var Hi=g`
|
|
1176
|
+
:host {
|
|
1177
|
+
height: calc(
|
|
1178
|
+
var(--primer-typography-title-large-line-height) +
|
|
1179
|
+
calc(2 * var(--primer-space-medium))
|
|
1180
|
+
);
|
|
1181
|
+
display: flex;
|
|
1182
|
+
|
|
1183
|
+
/* Default value for the background color CSS variable */
|
|
1184
|
+
--redirect-payment-button-bg-color: var(
|
|
1185
|
+
--primer-color-background-outlined-default
|
|
1186
|
+
);
|
|
1187
|
+
}
|
|
1188
|
+
|
|
1189
|
+
primer-button {
|
|
1190
|
+
width: 100%;
|
|
1191
|
+
height: 100%;
|
|
1192
|
+
}
|
|
1193
|
+
|
|
1194
|
+
primer-button::part(button) {
|
|
1195
|
+
background-color: var(--redirect-payment-button-bg-color);
|
|
1196
|
+
border: 1px solid var(--primer-color-border-outlined-default);
|
|
1197
|
+
color: var(--primer-color-text-primary);
|
|
1198
|
+
flex: 1;
|
|
1199
|
+
padding: 1px;
|
|
1200
|
+
}
|
|
1201
|
+
|
|
1202
|
+
.image-container {
|
|
1203
|
+
display: flex;
|
|
1204
|
+
justify-content: center;
|
|
1205
|
+
width: 100%;
|
|
1206
|
+
height: 100%;
|
|
1207
|
+
}
|
|
1208
|
+
/* Target the img specifically inside our component */
|
|
1209
|
+
img {
|
|
1210
|
+
height: 100%;
|
|
1211
|
+
}
|
|
1212
|
+
`;var ge=class extends f{constructor(){super(...arguments);this.paymentManagers=new Map;this.sdkState=null;this.headlessUtils=null;this._paymentMethodManagerTask=new V(this,{task:async([e,r])=>!e||!r?D:r.get(e)?.manager,args:()=>[this.paymentMethod?.type,this.paymentManagers]});this._getAssetsTask=new V(this,{task:async([e,r])=>{if(!e||!r)return D;let i=r.getPaymentMethodConfiguration(e);return i?{backgroundColor:i.displayMetadata.button.backgroundColor.colored,name:i.name,iconUrl:i.displayMetadata.button.iconUrl.colored}:D},args:()=>[this.paymentMethod?.type,this.headlessUtils]});this._setupTasks=new V(this,{task:async([e,r])=>!e||!r?D:{paymentMethodManager:e,assetsConfig:r},args:()=>[this._paymentMethodManagerTask.value,this._getAssetsTask.value]})}startRedirectPayment(){this._paymentMethodManagerTask.value&&this._paymentMethodManagerTask.value.start()}render(){return this._setupTasks.render({error:()=>u,complete:({assetsConfig:e})=>(this.style.setProperty("--redirect-payment-button-bg-color",e.backgroundColor),m` <primer-button
|
|
1213
|
+
@click="${()=>this.startRedirectPayment()}"
|
|
1214
|
+
class=${pe({loading:!!this.sdkState?.isProcessing})}
|
|
1215
|
+
title="${P("pay_with",{id:"pay_with"})} ${e.name}"
|
|
1216
|
+
>
|
|
1217
|
+
<span class="image-container">
|
|
1218
|
+
<img src="${e.iconUrl}" alt="${e.name}" />
|
|
1219
|
+
</span>
|
|
1220
|
+
</primer-button>`)})}};ge.styles=[S,Hi],n([d({type:Object})],ge.prototype,"paymentMethod",2),n([C({context:ue,subscribe:!0})],ge.prototype,"paymentManagers",2),n([C({context:j,subscribe:!0})],ge.prototype,"sdkState",2),n([C({context:q,subscribe:!0})],ge.prototype,"headlessUtils",2),ge=n([v("primer-redirect-payment"),I()],ge);var Yi=g`
|
|
1221
|
+
:host {
|
|
1222
|
+
display: contents;
|
|
1223
|
+
}
|
|
1224
|
+
|
|
1225
|
+
.primer-main-list {
|
|
1226
|
+
display: flex;
|
|
1227
|
+
flex-direction: column;
|
|
1228
|
+
gap: var(--primer-space-small);
|
|
1229
|
+
}
|
|
1230
|
+
|
|
1231
|
+
.primer-is-processing {
|
|
1232
|
+
opacity: 0.5;
|
|
1233
|
+
pointer-events: none;
|
|
1234
|
+
}
|
|
1235
|
+
|
|
1236
|
+
primer-vault-manager {
|
|
1237
|
+
margin-bottom: var(--primer-space-xlarge);
|
|
1238
|
+
}
|
|
1239
|
+
`;var $e=class extends f{constructor(){super(...arguments);this.hasAssignedContent=!1;this.onSlotChange=e=>{let i=e.target.assignedNodes({flatten:!0});this.hasAssignedContent=i.length>0,this.requestUpdate()};this.paymentMethods=null;this.sdkState=null}render(){return this.sdkState?.isSuccessful?m`
|
|
1240
|
+
<slot name="checkout-complete">
|
|
1241
|
+
<primer-checkout-complete></primer-checkout-complete>
|
|
1242
|
+
</slot>
|
|
1243
|
+
`:m`
|
|
1244
|
+
<slot name="payments" @slotchange=${this.onSlotChange}></slot>
|
|
1245
|
+
${$(this.hasAssignedContent,()=>u,()=>m`
|
|
1246
|
+
<div
|
|
1247
|
+
class=${pe({"primer-is-processing":!!this.sdkState?.isProcessing})}
|
|
1248
|
+
>
|
|
1249
|
+
<primer-vault-manager></primer-vault-manager>
|
|
1250
|
+
<primer-show-other-payments>
|
|
1251
|
+
<div slot="other-payments" class="primer-main-list">
|
|
1252
|
+
${this.paymentMethods?.toArray().map(e=>m`
|
|
1253
|
+
<primer-payment-method
|
|
1254
|
+
type=${e.type}
|
|
1255
|
+
></primer-payment-method>
|
|
1256
|
+
`)}
|
|
1257
|
+
</div>
|
|
1258
|
+
</primer-show-other-payments>
|
|
1259
|
+
<primer-error-message-container></primer-error-message-container>
|
|
1260
|
+
</div>
|
|
1261
|
+
`)}
|
|
1262
|
+
`}};$e.styles=[S,Yi],n([C({context:it,subscribe:!0}),d()],$e.prototype,"paymentMethods",2),n([C({context:j,subscribe:!0}),d()],$e.prototype,"sdkState",2),$e=n([v("primer-main")],$e);var Ui=g`
|
|
1263
|
+
:host {
|
|
1264
|
+
height: calc(
|
|
1265
|
+
var(--primer-typography-title-large-line-height) +
|
|
1266
|
+
calc(2 * var(--primer-space-medium))
|
|
1267
|
+
);
|
|
1268
|
+
display: flex;
|
|
1269
|
+
}
|
|
1270
|
+
|
|
1271
|
+
.native-button-container {
|
|
1272
|
+
width: 100%;
|
|
1273
|
+
height: 100%;
|
|
1274
|
+
flex: 1;
|
|
1275
|
+
}
|
|
1276
|
+
`;var Me=class extends f{constructor(){super();this.paymentManagers=new Map;this.computedStyles=null;this._buttonId="button-container";this.loadManagerTask=new V(this,{args:()=>[this.paymentMethod?.type],task:async([e])=>{if(!e)return D;let r=this.paymentManagers.get(e)?.manager;if(!r)throw new Error(`No manager found for payment method type ${e}`);return r}}),new V(this,{args:()=>[this.loadManagerTask.value],task:async([e])=>{if(!e)return D;await this.updateComplete;let r=this.shadowRoot?.getElementById(this._buttonId);if(!r)return;let i=this.calculateButtonHeight(),s=e.createButton(),c=this.createRenderOptions(i);return await s.render(this.paymentMethod?.type==="GOOGLE_PAY"?this.shadowRoot?.getRootNode():r,c),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:()=>u,complete:()=>m`
|
|
1277
|
+
<!-- The native button container is rendered first -->
|
|
1278
|
+
<div class="native-button-container" id="${this._buttonId}"></div>
|
|
1279
|
+
`,pending:()=>u})}};Me.styles=[S,Ui],n([d({type:Object})],Me.prototype,"paymentMethod",2),n([C({context:ue,subscribe:!0}),d()],Me.prototype,"paymentManagers",2),n([C({context:Pe,subscribe:!0}),d()],Me.prototype,"computedStyles",2),Me=n([v("primer-native-payment")],Me);var vr="card-form-context";var zi=g`
|
|
1280
|
+
:host {
|
|
1281
|
+
display: contents;
|
|
1282
|
+
}
|
|
1283
|
+
|
|
1284
|
+
form {
|
|
1285
|
+
display: flex;
|
|
1286
|
+
flex-direction: column;
|
|
1287
|
+
gap: var(--primer-space-medium);
|
|
1288
|
+
width: 100%;
|
|
1289
|
+
}
|
|
1290
|
+
|
|
1291
|
+
.card-form {
|
|
1292
|
+
display: flex;
|
|
1293
|
+
flex-direction: column;
|
|
1294
|
+
gap: var(--primer-space-medium);
|
|
1295
|
+
margin-bottom: var(--primer-space-medium);
|
|
1296
|
+
}
|
|
1297
|
+
|
|
1298
|
+
.card-form-row {
|
|
1299
|
+
display: flex;
|
|
1300
|
+
gap: var(--primer-space-small);
|
|
1301
|
+
}
|
|
1302
|
+
`;var _e=class extends f{constructor(){super(...arguments);this.hasAssignedContent=!1;this.selectedCardNetwork=null;this.paymentManagers=new Map;this.cardFormProvider=new K(this,{context:vr,initialValue:null});this.eventsController=new tt(this);this.setupCardFormTask=new V(this,{task:async([e])=>{if(!e?.manager)return D;let{manager:r}=e,{cardNumberInput:i,expiryInput:s,cvvInput:c}=r.createHostedInputs();return this.cardFormProvider.setValue({cardNumberInput:i,expiryInput:s,cvvInput:c,setCardholderName:x=>r.setCardholderName(x),setCardNetwork:x=>{this.selectedCardNetwork=x},validate:()=>r.validate(),submit:x=>r.submit(x)}),!0},args:()=>[this.paymentManagers.get("PAYMENT_CARD")]});this.handleSlotButtonClick=e=>{let i=e.target.closest("button, primer-button");if(!i)return;this.isSubmitButton(i)&&(e.preventDefault(),this.submitCardPayment())};this.handleDirectSubmit=e=>{e.stopPropagation(),this.submitCardPayment()};this.onSlotChange=e=>{let i=e.target.assignedNodes({flatten:!0});this.hasAssignedContent=i.length>0};this.handleFormSubmit=e=>{e.preventDefault(),e.stopPropagation(),this.submitCardPayment()}}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(),i=r==="button",s=r==="primer-button";return i&&(e.getAttribute("type")==="submit"||e.hasAttribute("data-submit"))||s&&(e.getAttribute("buttonType")==="submit"||e.hasAttribute("data-submit"))}async submitCardPayment(){let e=this.cardFormProvider.value;if(!e)return;let r=await e.validate?.();if(r?.valid){let i=await e.submit?.(this.selectedCardNetwork?{cardNetwork:this.selectedCardNetwork}:void 0);this.eventsController.dispatchFormSubmitSuccess(i)}else{let i=r?.validationErrors;this.cardFormProvider.setValue({...e,errors:i}),this.eventsController.dispatchFormSubmitErrors(i)}}render(){return this.setupCardFormTask.status===ke.ERROR||this.setupCardFormTask.status===ke.INITIAL?u:m`
|
|
1303
|
+
<form @submit=${this.handleFormSubmit}>
|
|
1304
|
+
<slot name="card-form-content" @slotchange=${this.onSlotChange}></slot>
|
|
1305
|
+
${this.setupCardFormTask.render({complete:()=>$(this.hasAssignedContent,()=>u,()=>m`
|
|
1306
|
+
<div class="card-form">
|
|
1307
|
+
<primer-input-card-number></primer-input-card-number>
|
|
1308
|
+
<div class="card-form-row">
|
|
1309
|
+
<primer-input-card-expiry></primer-input-card-expiry>
|
|
1310
|
+
<primer-input-cvv></primer-input-cvv>
|
|
1311
|
+
</div>
|
|
1312
|
+
<primer-input-card-holder-name></primer-input-card-holder-name>
|
|
1313
|
+
</div>
|
|
1314
|
+
<primer-card-form-submit></primer-card-form-submit>
|
|
1315
|
+
`)})}
|
|
1316
|
+
</form>
|
|
1317
|
+
`}};_e.styles=[S,zi],n([w()],_e.prototype,"hasAssignedContent",2),n([w()],_e.prototype,"selectedCardNetwork",2),n([C({context:ue,subscribe:!0}),d({type:Object})],_e.prototype,"paymentManagers",2),_e=n([v("primer-card-form"),I()],_e);function Bi(o,t){if(o.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;",o.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=`
|
|
1318
|
+
input[data-custom-input]::placeholder {
|
|
1319
|
+
color: var(--primer-color-text-placeholder);
|
|
1320
|
+
font-size: var(--primer-typography-body-large-size);
|
|
1321
|
+
font-family: var(--primer-typography-body-large-font);
|
|
1322
|
+
}
|
|
1323
|
+
input[data-custom-input]:focus {
|
|
1324
|
+
outline: none;
|
|
1325
|
+
}
|
|
1326
|
+
`,t.shadowRoot?t.shadowRoot.appendChild(e):t.appendChild(e)}}function yr(o){return o?{paddingHorizontal:0,placeholder:{color:o.getPropertyValue("--primer-color-text-placeholder").trim(),fontSize:o.getPropertyValue("--primer-typography-body-large-size").trim(),fontFamily:o.getPropertyValue("--primer-typography-body-large-font").trim()},height:o.getPropertyValue("--primer-typography-body-large-line-height").trim(),fontSize:o.getPropertyValue("--primer-typography-body-large-size").trim(),fontFamily:o.getPropertyValue("--primer-typography-body-large-font").trim(),color:o.getPropertyValue("--primer-color-text-primary").trim()}:null}function Fi(o,t){return o.active===t.active&&o.dirty===t.dirty&&o.error===t.error&&o.errorCode===t.errorCode&&o.submitted===t.submitted&&o.touched===t.touched&&o.valid===t.valid}var br=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 V(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 D;await this.host.updateComplete;let e=this.getTargetContainer();return e?t==="cardholderName"?this.setupStandardInput(e):this.setupHostedIframeInput(t,e):D}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,Bi(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(s=>requestAnimationFrame(()=>s())),this._hostedInput=t;let r=yr(this.host.computedStyles),i=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",s=>{this._meta=s,Fi(this._meta,s)&&this.host.requestUpdate()}),await t.render(e,{placeholder:this.host.placeholder,ariaLabel:this.host.ariaLabel,...i}),!0}get isFocused(){return this._isFocused}get meta(){return this._meta}hostConnected(){}hostDisconnected(){this._hostedInput=null,this._standardInput=null}};var G=class extends f{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:P(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 br(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.touched?e.errorCode:null}renderInput(){if(this.hostedInputController.setupTask.status===ke.ERROR)return u;let e=this.getError();return m`
|
|
1327
|
+
<primer-input-wrapper
|
|
1328
|
+
.focusWithin="${this.hostedInputController.isFocused}"
|
|
1329
|
+
.hasError=${!!e}
|
|
1330
|
+
@wrapper-click="${this.handleWrapperClick}"
|
|
1331
|
+
>
|
|
1332
|
+
<primer-input-label slot="label">${this.label}</primer-input-label>
|
|
1333
|
+
<div
|
|
1334
|
+
slot="input"
|
|
1335
|
+
class="card-input-slot"
|
|
1336
|
+
id="${this.config.containerSelector.substring(1)}"
|
|
1337
|
+
></div>
|
|
1338
|
+
${$(e,()=>m`
|
|
1339
|
+
<primer-input-error slot="error">
|
|
1340
|
+
${P(e,{id:e})}
|
|
1341
|
+
</primer-input-error>
|
|
1342
|
+
`,()=>u)}
|
|
1343
|
+
</primer-input-wrapper>
|
|
1344
|
+
`}};n([C({context:vr,subscribe:!0})],G.prototype,"cardFormContext",2),n([C({context:Pe,subscribe:!0}),d()],G.prototype,"computedStyles",2),n([d({type:String})],G.prototype,"label",1),n([d({type:String})],G.prototype,"placeholder",1),n([d({type:String,attribute:"aria-label"})],G.prototype,"ariaLabel",1);var Ki=g`
|
|
1345
|
+
:host {
|
|
1346
|
+
display: contents;
|
|
1347
|
+
}
|
|
1348
|
+
|
|
1349
|
+
.card-number-container {
|
|
1350
|
+
display: flex;
|
|
1351
|
+
align-items: center;
|
|
1352
|
+
width: 100%;
|
|
1353
|
+
position: relative;
|
|
1354
|
+
gap: var(--primer-space-small);
|
|
1355
|
+
}
|
|
1356
|
+
|
|
1357
|
+
#cardNumber {
|
|
1358
|
+
flex: 1;
|
|
1359
|
+
display: flex;
|
|
1360
|
+
width: 100%;
|
|
1361
|
+
}
|
|
1362
|
+
|
|
1363
|
+
.network-selector-container {
|
|
1364
|
+
display: flex;
|
|
1365
|
+
align-items: center;
|
|
1366
|
+
z-index: 2;
|
|
1367
|
+
}
|
|
1368
|
+
`;var Ve=g`
|
|
1369
|
+
.card-input-slot {
|
|
1370
|
+
display: flex;
|
|
1371
|
+
}
|
|
1372
|
+
`;var lt=class extends G{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===ke.ERROR)return u;let e=this.getError();return m`
|
|
1373
|
+
<primer-input-wrapper
|
|
1374
|
+
.focusWithin="${this.hostedInputController.isFocused}"
|
|
1375
|
+
.hasError=${!!e}
|
|
1376
|
+
>
|
|
1377
|
+
<primer-input-label slot="label">${this.label}</primer-input-label>
|
|
1378
|
+
<div slot="input" class="card-number-container">
|
|
1379
|
+
<div id="${this.config.containerSelector.substring(1)}"></div>
|
|
1380
|
+
<div class="network-selector-container">
|
|
1381
|
+
<primer-card-network-selector
|
|
1382
|
+
@network-selected=${this.handleNetworkSelected}
|
|
1383
|
+
></primer-card-network-selector>
|
|
1384
|
+
</div>
|
|
1385
|
+
</div>
|
|
1386
|
+
${$(e,r=>m`
|
|
1387
|
+
<primer-input-error slot="error">
|
|
1388
|
+
${P(r,{id:r})}
|
|
1389
|
+
</primer-input-error>
|
|
1390
|
+
`,()=>u)}
|
|
1391
|
+
</primer-input-wrapper>
|
|
1392
|
+
`}render(){return this.renderInput()}};lt.styles=[S,Ve,Ki],lt=n([v("primer-input-card-number"),I()],lt);var ji=g`
|
|
1393
|
+
:host {
|
|
1394
|
+
display: contents;
|
|
1395
|
+
}
|
|
1396
|
+
`;var dt=class extends G{constructor(){super();this.config={inputType:"cvv",containerSelector:"#cvv",errorName:"cvv-card",translations:{label:"CVV",placeholder:"123"}};this.childUpdated()}render(){return this.renderInput()}};dt.styles=[S,Ve,ji],dt=n([v("primer-input-cvv"),I()],dt);var Gi=g`
|
|
1397
|
+
:host {
|
|
1398
|
+
display: contents;
|
|
1399
|
+
}
|
|
1400
|
+
`;var pt=class extends G{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()}};pt.styles=[S,Ve,Gi],pt=n([v("primer-input-card-expiry"),I()],pt);var qi=g`
|
|
1401
|
+
:host {
|
|
1402
|
+
display: contents;
|
|
1403
|
+
}
|
|
1404
|
+
`;var ct=class extends G{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()}};ct.styles=[S,Ve,qi],ct=n([v("primer-input-card-holder-name"),I()],ct);var Wi=g`
|
|
1405
|
+
:host {
|
|
1406
|
+
display: contents;
|
|
1407
|
+
}
|
|
1408
|
+
`;var se=class extends f{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:P("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}`:u;return m`
|
|
1409
|
+
<primer-button
|
|
1410
|
+
buttonType="submit"
|
|
1411
|
+
variant=${this.variant}
|
|
1412
|
+
?disabled=${this.disabled}
|
|
1413
|
+
@click=${this.handleClick}
|
|
1414
|
+
.loading=${!!this.sdkState?.isProcessing}
|
|
1415
|
+
data-submit
|
|
1416
|
+
>
|
|
1417
|
+
${this.buttonText}${r}
|
|
1418
|
+
</primer-button>
|
|
1419
|
+
`}};se.styles=[S,Wi],n([d({type:String})],se.prototype,"buttonText",1),n([C({context:q,subscribe:!0}),d({type:Object})],se.prototype,"headlessInstance",2),n([C({context:ot,subscribe:!0}),d({type:Object})],se.prototype,"clientOptions",2),n([C({context:j,subscribe:!0}),d()],se.prototype,"sdkState",2),n([d({type:String})],se.prototype,"variant",2),n([d({type:Boolean})],se.prototype,"disabled",2),se=n([v("primer-card-form-submit"),I()],se);var{I:Zf}=xi;var Zi=o=>o.strings===void 0;var $t=(o,t)=>{let e=o._$AN;if(e===void 0)return!1;for(let r of e)r._$AO?.(t,!1),$t(r,t);return!0},Er=o=>{let t,e;do{if((t=o._$AM)===void 0)break;e=t._$AN,e.delete(o),o=t}while(e?.size===0)},Xi=o=>{for(let t;t=o._$AM;o=t){let e=t._$AN;if(e===void 0)t._$AN=e=new Set;else if(e.has(o))break;e.add(o),Rn(t)}};function Nn(o){this._$AN!==void 0?(Er(this),this._$AM=o,Xi(this)):this._$AM=o}function Ln(o,t=!1,e=0){let r=this._$AH,i=this._$AN;if(i!==void 0&&i.size!==0)if(t)if(Array.isArray(r))for(let s=e;s<r.length;s++)$t(r[s],!1),Er(r[s]);else r!=null&&($t(r,!1),Er(r));else $t(this,o)}var Rn=o=>{o.type==fr.CHILD&&(o._$AP??(o._$AP=Ln),o._$AQ??(o._$AQ=Nn))},xr=class extends st{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,r){super._$AT(t,e,r),Xi(this),this.isConnected=t._$AU}_$AO(t,e=!0){t!==this.isConnected&&(this.isConnected=t,t?this.reconnected?.():this.disconnected?.()),e&&($t(this,t),Er(this))}setValue(t){if(Zi(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 po=()=>new lo,lo=class{},so=new WeakMap,Cr=Dt(class extends xr{render(o){return u}update(o,[t]){let e=t!==this.Y;return e&&this.Y!==void 0&&this.rt(void 0),(e||this.lt!==this.ct)&&(this.Y=t,this.ht=o.options?.host,this.rt(this.ct=o.element)),u}rt(o){if(this.isConnected||(o=void 0),typeof this.Y=="function"){let t=this.ht??globalThis,e=so.get(t);e===void 0&&(e=new WeakMap,so.set(t,e)),e.get(this.Y)!==void 0&&this.Y.call(this.ht,void 0),e.set(this.Y,o),o!==void 0&&this.Y.call(this.ht,o)}else this.Y.value=o}get lt(){return typeof this.Y=="function"?so.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 Ji=g`
|
|
1420
|
+
:host {
|
|
1421
|
+
display: flex;
|
|
1422
|
+
align-items: center;
|
|
1423
|
+
position: relative;
|
|
1424
|
+
}
|
|
1425
|
+
|
|
1426
|
+
.network-selector {
|
|
1427
|
+
display: flex;
|
|
1428
|
+
align-items: center;
|
|
1429
|
+
cursor: pointer;
|
|
1430
|
+
background: none;
|
|
1431
|
+
padding: unset;
|
|
1432
|
+
border: none;
|
|
1433
|
+
transition: opacity var(--primer-animation-duration)
|
|
1434
|
+
var(--primer-animation-easing);
|
|
1435
|
+
outline: none;
|
|
1436
|
+
gap: var(--primer-space-xsmall);
|
|
1437
|
+
}
|
|
1438
|
+
|
|
1439
|
+
.network-selector:hover {
|
|
1440
|
+
opacity: 0.8;
|
|
1441
|
+
}
|
|
1442
|
+
|
|
1443
|
+
.network-selector:focus-visible {
|
|
1444
|
+
outline: 2px solid var(--primer-color-focus);
|
|
1445
|
+
border-radius: var(--primer-radius-xsmall);
|
|
1446
|
+
}
|
|
1447
|
+
|
|
1448
|
+
.network-icon {
|
|
1449
|
+
width: var(--primer-size-large);
|
|
1450
|
+
object-fit: contain;
|
|
1451
|
+
}
|
|
1452
|
+
|
|
1453
|
+
.caret {
|
|
1454
|
+
margin-left: var(--primer-space-xsmall);
|
|
1455
|
+
transition: transform var(--primer-animation-duration)
|
|
1456
|
+
var(--primer-animation-easing);
|
|
1457
|
+
color: var(--primer-color-icon-primary);
|
|
1458
|
+
}
|
|
1459
|
+
|
|
1460
|
+
.caret.open {
|
|
1461
|
+
transform: rotate(180deg);
|
|
1462
|
+
}
|
|
1463
|
+
|
|
1464
|
+
.dropdown {
|
|
1465
|
+
position: absolute;
|
|
1466
|
+
top: 100%;
|
|
1467
|
+
right: 0;
|
|
1468
|
+
width: max-content;
|
|
1469
|
+
min-width: calc(var(--primer-size-xxxlarge) * 3);
|
|
1470
|
+
background: var(--primer-color-gray-000);
|
|
1471
|
+
border-radius: var(--primer-radius-small);
|
|
1472
|
+
box-shadow: 0 var(--primer-space-xxsmall) var(--primer-space-large)
|
|
1473
|
+
rgba(0, 0, 0, 0.15);
|
|
1474
|
+
z-index: 10;
|
|
1475
|
+
overflow: hidden;
|
|
1476
|
+
border: 1px solid var(--primer-color-border-outlined-default);
|
|
1477
|
+
}
|
|
1478
|
+
|
|
1479
|
+
.dropdown:not(.open) {
|
|
1480
|
+
display: none;
|
|
1481
|
+
}
|
|
1482
|
+
|
|
1483
|
+
.dropdown.open {
|
|
1484
|
+
display: block;
|
|
1485
|
+
max-height: calc(var(--primer-size-xxxlarge) * 4);
|
|
1486
|
+
overflow-y: auto;
|
|
1487
|
+
}
|
|
1488
|
+
|
|
1489
|
+
.network-option {
|
|
1490
|
+
display: flex;
|
|
1491
|
+
align-items: center;
|
|
1492
|
+
padding: var(--primer-space-small) var(--primer-space-medium);
|
|
1493
|
+
cursor: pointer;
|
|
1494
|
+
transition: background-color var(--primer-animation-duration)
|
|
1495
|
+
var(--primer-animation-easing);
|
|
1496
|
+
position: relative;
|
|
1497
|
+
outline: none;
|
|
1498
|
+
background-color: transparent;
|
|
1499
|
+
}
|
|
1500
|
+
|
|
1501
|
+
/* Only apply hover effect when not in keyboard navigation mode */
|
|
1502
|
+
.network-option:hover {
|
|
1503
|
+
background-color: var(--primer-color-gray-100);
|
|
1504
|
+
}
|
|
1505
|
+
|
|
1506
|
+
/* Apply focused style only when the focused class is present (keyboard navigation) */
|
|
1507
|
+
.network-option.focused {
|
|
1508
|
+
background-color: var(--primer-color-gray-100);
|
|
1509
|
+
}
|
|
1510
|
+
|
|
1511
|
+
.network-option:focus-visible {
|
|
1512
|
+
outline: 2px solid var(--primer-color-focus);
|
|
1513
|
+
outline-offset: -2px;
|
|
1514
|
+
}
|
|
1515
|
+
|
|
1516
|
+
.network-option-icon {
|
|
1517
|
+
width: var(--primer-size-medium);
|
|
1518
|
+
height: var(--primer-size-small);
|
|
1519
|
+
margin-right: var(--primer-space-small);
|
|
1520
|
+
object-fit: contain;
|
|
1521
|
+
}
|
|
1522
|
+
|
|
1523
|
+
.network-name {
|
|
1524
|
+
font-size: var(--primer-typography-body-medium-size);
|
|
1525
|
+
font-family: var(--primer-typography-body-medium-font);
|
|
1526
|
+
line-height: var(--primer-typography-body-medium-line-height);
|
|
1527
|
+
letter-spacing: var(--primer-typography-body-medium-letter-spacing);
|
|
1528
|
+
white-space: nowrap;
|
|
1529
|
+
color: var(--primer-color-text-primary);
|
|
1530
|
+
flex: 1;
|
|
1531
|
+
}
|
|
1532
|
+
|
|
1533
|
+
.checkmark {
|
|
1534
|
+
margin-left: var(--primer-space-small);
|
|
1535
|
+
color: var(--primer-color-brand);
|
|
1536
|
+
width: var(--primer-size-small);
|
|
1537
|
+
height: var(--primer-size-small);
|
|
1538
|
+
}
|
|
1539
|
+
`;var le=class extends f{constructor(){super(...arguments);this.cardNetworks=null;this.headlessUtils=null;this.selectedCardNetwork=null;this.isDropdownOpen=!1;this.focusedNetworkIndex=0;this.isKeyboardNavigation=!1;this.buttonRef=po();this.dropdownRef=po();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(i=>i.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 m`<primer-spinner size="small" compact></primer-spinner>`;let e=this.getSelectableNetworks();if(!this.getDetectedNetwork()&&e.length===0)return m`<primer-icon name="payment-card"></primer-icon>`;let r=this.getDetectedNetwork()||(e.length>0?e[0]:null);if(!r)return m`<primer-icon name="payment-card" size="sm"></primer-icon>`;let i=e.length>1;return m`
|
|
1540
|
+
<button
|
|
1541
|
+
${Cr(this.buttonRef)}
|
|
1542
|
+
class="network-selector"
|
|
1543
|
+
@click=${this.toggleDropdown}
|
|
1544
|
+
@keydown=${s=>{(s.key===" "||s.key==="Enter")&&i&&(s.preventDefault(),this.isDropdownOpen=!this.isDropdownOpen,this.isDropdownOpen&&(this.focusedNetworkIndex=this.getSelectedNetworkIndex()))}}
|
|
1545
|
+
aria-label=${i?`Selected card network: ${r.displayName}. Click to change.`:`Card network: ${r.displayName}`}
|
|
1546
|
+
aria-expanded=${i?this.isDropdownOpen:u}
|
|
1547
|
+
aria-haspopup=${i?"true":u}
|
|
1548
|
+
aria-controls=${i?"network-dropdown":u}
|
|
1549
|
+
>
|
|
1550
|
+
<img
|
|
1551
|
+
class="network-icon"
|
|
1552
|
+
src=${this.getNetworkIconUrl(r)}
|
|
1553
|
+
alt=${r.displayName}
|
|
1554
|
+
/>
|
|
1555
|
+
${$(i,()=>m`
|
|
1556
|
+
<primer-icon
|
|
1557
|
+
class="caret ${this.isDropdownOpen?"open":""}"
|
|
1558
|
+
name="chevron-down"
|
|
1559
|
+
></primer-icon>
|
|
1560
|
+
`,()=>u)}
|
|
1561
|
+
</button>
|
|
1562
|
+
|
|
1563
|
+
${$(this.isDropdownOpen,()=>m`
|
|
1564
|
+
<div
|
|
1565
|
+
${Cr(this.dropdownRef)}
|
|
1566
|
+
id="network-dropdown"
|
|
1567
|
+
class="dropdown open"
|
|
1568
|
+
role="listbox"
|
|
1569
|
+
aria-label="Select card network"
|
|
1570
|
+
>
|
|
1571
|
+
${e.map((s,c)=>m`
|
|
1572
|
+
<div
|
|
1573
|
+
${Cr(x=>this.setNetworkOptionRef(x,c))}
|
|
1574
|
+
class="network-option ${this.isKeyboardNavigation&&c===this.focusedNetworkIndex?"focused":""}"
|
|
1575
|
+
@click=${x=>this.selectNetwork(x,s)}
|
|
1576
|
+
@keydown=${x=>{(x.key==="Enter"||x.key===" ")&&this.selectNetwork(x,s)}}
|
|
1577
|
+
role="option"
|
|
1578
|
+
aria-selected=${s.network===r.network}
|
|
1579
|
+
tabindex="${c===this.focusedNetworkIndex?"0":"-1"}"
|
|
1580
|
+
>
|
|
1581
|
+
<img
|
|
1582
|
+
class="network-option-icon"
|
|
1583
|
+
src=${this.getNetworkIconUrl(s)}
|
|
1584
|
+
alt=${s.displayName}
|
|
1585
|
+
/>
|
|
1586
|
+
<span class="network-name">${s.displayName}</span>
|
|
1587
|
+
${$(s.network===r.network,()=>m`
|
|
1588
|
+
<primer-icon
|
|
1589
|
+
class="checkmark"
|
|
1590
|
+
name="checkmark"
|
|
1591
|
+
></primer-icon>
|
|
1592
|
+
`,()=>u)}
|
|
1593
|
+
</div>
|
|
1594
|
+
`)}
|
|
1595
|
+
</div>
|
|
1596
|
+
`,()=>u)}
|
|
1597
|
+
`}};le.styles=[S,Ji],n([C({context:Gt,subscribe:!0})],le.prototype,"cardNetworks",2),n([C({context:q,subscribe:!0})],le.prototype,"headlessUtils",2),n([w()],le.prototype,"selectedCardNetwork",2),n([w()],le.prototype,"isDropdownOpen",2),n([w()],le.prototype,"focusedNetworkIndex",2),n([w()],le.prototype,"isKeyboardNavigation",2),le=n([v("primer-card-network-selector")],le);var On=Dr(Ar(),1),mt=Dr(Ar(),1);function mo(o){return o.charAt(0).toUpperCase()+o.slice(1).toLowerCase()}function Dn(o){return o?o===o.toUpperCase()?mo(o):o:""}function Qi(o,t){return[o,t].filter(Boolean).join(" ")}function $n(o,t){return!o||!t?"":`Expires ${o}/${t.slice(-2)}`}function ea(o){return o?`\u2022\u2022\u2022\u2022 ${o}`:""}function Vn(o){let t=o.paymentInstrumentData,e=Dn(t.network),r=t.last4Digits,i=`${o.paymentInstrumentData.cardholderName?o.paymentInstrumentData.cardholderName:""}${(r?` ${e} ${ea(r)}`:e)||" Card"}`,s=$n(t.expirationMonth,t.expirationYear);return{description:i,secondaryDescription:s}}function Hn(o){let t=o.paymentInstrumentData,e=t.externalPayerInfo?.email||"",r=t.externalPayerInfo?.firstName||"",i=t.externalPayerInfo?.lastName||"",s=o.userDescription||e||"PayPal Account",c=Qi(r,i);return{description:s,secondaryDescription:c}}function Yn(o){let t=o.paymentInstrumentData,e=t.sessionData?.billingAddress?.email||"",r=t.sessionData?.billingAddress?.firstName||"",i=t.sessionData?.billingAddress?.lastName||"",s=o.userDescription||(e?`Klarna - ${e}`:"Klarna Account"),c=Qi(r,i);return{description:s,secondaryDescription:c}}function Un(o){let t=o.paymentInstrumentData,e=t.accountNumberLastFourDigits||"",r=t.bankName||"",i=t.accountType||"",s=o.userDescription;s||(r&&e?s=`${r} ${ea(e)}`:r?s=r:s="Bank Account");let c=i?`${mo(i)} Account`:"";return{description:s,secondaryDescription:c}}function zn(o){let t=o.paymentInstrumentType,e=mo(t.replace(/_/g," "));return{description:o.userDescription||e}}var Bn={[mt.PaymentInstrumentType.CARD]:Vn,[mt.PaymentInstrumentType.PAYPAL_VAULTED]:Hn,[mt.PaymentInstrumentType.KLARNA_CUSTOMER_TOKEN]:Yn,[mt.PaymentInstrumentType.AUTOMATED_CLEARING_HOUSE]:Un};function Mr(o){try{let t=Bn[o.paymentInstrumentType];return t?t(o):zn(o)}catch(t){return N.error("FormatUtils",`Error formatting payment method ${o.id}:`,t),{description:o.userDescription||o.id||"Payment Method"}}}var ta=g`
|
|
1598
|
+
:host {
|
|
1599
|
+
display: block;
|
|
1600
|
+
width: 100%;
|
|
1601
|
+
}
|
|
1602
|
+
|
|
1603
|
+
.vault-manager {
|
|
1604
|
+
display: flex;
|
|
1605
|
+
flex-direction: column;
|
|
1606
|
+
}
|
|
1607
|
+
|
|
1608
|
+
.vault-manager-content {
|
|
1609
|
+
display: flex;
|
|
1610
|
+
flex-direction: column;
|
|
1611
|
+
width: 100%;
|
|
1612
|
+
}
|
|
1613
|
+
|
|
1614
|
+
/* Payment methods list */
|
|
1615
|
+
.payment-methods-list {
|
|
1616
|
+
display: flex;
|
|
1617
|
+
flex-direction: column;
|
|
1618
|
+
gap: var(--primer-space-small);
|
|
1619
|
+
width: 100%;
|
|
1620
|
+
}
|
|
1621
|
+
|
|
1622
|
+
/* Delete confirmation container */
|
|
1623
|
+
.delete-confirmation-container {
|
|
1624
|
+
width: 100%;
|
|
1625
|
+
z-index: 1;
|
|
1626
|
+
}
|
|
1627
|
+
`;var ce=class extends f{constructor(){super(...arguments);this.vaultManagerContext=null;this.isEditMode=!1;this.deletePaymentMethodId=null;this.isDeleting=!1;this.errorMessage=""}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=P("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:P("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:P("payment_processing_error",{id:"payment_processing_error"})}handleCloseError(){this.errorMessage=""}getPaymentMethodName(e){if(!this.vaultManagerContext)return"";let r=this.vaultManagerContext.vaultedPaymentMethods.find(i=>i.id===e);if(!r)return"";try{return Mr(r).description||""}catch{return""}}renderDeleteConfirmation(){if(!this.deletePaymentMethodId)return u;let e=this.getPaymentMethodName(this.deletePaymentMethodId);return m`
|
|
1628
|
+
<div class="delete-confirmation-container">
|
|
1629
|
+
<primer-vault-delete-confirmation
|
|
1630
|
+
.isDeleting=${this.isDeleting}
|
|
1631
|
+
.paymentMethodId=${this.deletePaymentMethodId}
|
|
1632
|
+
.paymentMethodName=${e}
|
|
1633
|
+
@confirm-delete=${this.handleConfirmDelete}
|
|
1634
|
+
@cancel-delete=${this.handleCancelDelete}
|
|
1635
|
+
></primer-vault-delete-confirmation>
|
|
1636
|
+
</div>
|
|
1637
|
+
`}renderPaymentMethodItem(e){return this.deletePaymentMethodId===e.id?u:m`
|
|
1638
|
+
<primer-vault-payment-method-item
|
|
1639
|
+
.paymentMethod=${e}
|
|
1640
|
+
.isEditMode=${this.isEditMode}
|
|
1641
|
+
@delete-payment-method=${this.handleDeletePaymentMethod}
|
|
1642
|
+
></primer-vault-payment-method-item>
|
|
1643
|
+
`}render(){if(!this.vaultManagerContext?.enabled)return u;let e=this.vaultManagerContext.vaultedPaymentMethods.length>0,r=this.vaultManagerContext.isLoading,i=!this.isEditMode&&e&&!r&&!this.deletePaymentMethodId;return m`
|
|
1644
|
+
<div class="vault-manager">
|
|
1645
|
+
<primer-vault-manager-header
|
|
1646
|
+
.isEditMode=${this.isEditMode}
|
|
1647
|
+
.hasPaymentMethods=${e}
|
|
1648
|
+
@toggle-edit-mode=${this.handleToggleEditMode}
|
|
1649
|
+
></primer-vault-manager-header>
|
|
1650
|
+
|
|
1651
|
+
${$(this.errorMessage,()=>m`
|
|
1652
|
+
<primer-vault-error-message
|
|
1653
|
+
.errorMessage=${this.errorMessage}
|
|
1654
|
+
@close-error=${this.handleCloseError}
|
|
1655
|
+
></primer-vault-error-message>
|
|
1656
|
+
`,()=>u)}
|
|
1657
|
+
|
|
1658
|
+
<div class="vault-manager-content">
|
|
1659
|
+
${$(!r&&!e,()=>m`<primer-vault-empty-state></primer-vault-empty-state>`,()=>u)}
|
|
1660
|
+
${$(!r&&e&&this.deletePaymentMethodId,()=>this.renderDeleteConfirmation(),()=>u)}
|
|
1661
|
+
${$(!r&&e&&!this.deletePaymentMethodId,()=>m`
|
|
1662
|
+
<div class="payment-methods-list">
|
|
1663
|
+
${this.vaultManagerContext?.vaultedPaymentMethods.map(s=>this.renderPaymentMethodItem(s))}
|
|
1664
|
+
${$(i,()=>m`
|
|
1665
|
+
<primer-vault-payment-submit
|
|
1666
|
+
@primer-vault-payment-error=${this.handlePaymentError}
|
|
1667
|
+
></primer-vault-payment-submit>
|
|
1668
|
+
`,()=>u)}
|
|
1669
|
+
</div>
|
|
1670
|
+
`,()=>u)}
|
|
1671
|
+
</div>
|
|
1672
|
+
</div>
|
|
1673
|
+
`}};ce.styles=[S,ta],n([C({context:W,subscribe:!0}),d({type:Object,attribute:!1})],ce.prototype,"vaultManagerContext",2),n([w()],ce.prototype,"isEditMode",2),n([w()],ce.prototype,"deletePaymentMethodId",2),n([w()],ce.prototype,"isDeleting",2),n([w()],ce.prototype,"errorMessage",2),ce=n([v("primer-vault-manager"),I()],ce);var ra=Dr(Ar(),1);function oa(o){return o.paymentInstrumentType===ra.PaymentInstrumentType.CARD}var ia=g`
|
|
1674
|
+
:host {
|
|
1675
|
+
display: flex;
|
|
1676
|
+
width: 100%;
|
|
1677
|
+
flex-direction: column;
|
|
1678
|
+
}
|
|
1679
|
+
|
|
1680
|
+
.payment-method-wrapper {
|
|
1681
|
+
display: flex;
|
|
1682
|
+
flex-direction: column;
|
|
1683
|
+
width: 100%;
|
|
1684
|
+
}
|
|
1685
|
+
|
|
1686
|
+
/* Styles for edit mode */
|
|
1687
|
+
.payment-method-item {
|
|
1688
|
+
border: 1px solid var(--primer-color-border-outlined-default);
|
|
1689
|
+
background-color: var(--primer-color-background-outlined-default);
|
|
1690
|
+
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
|
|
1691
|
+
padding: var(--primer-space-medium);
|
|
1692
|
+
border-radius: var(--primer-radius-medium);
|
|
1693
|
+
box-sizing: border-box;
|
|
1694
|
+
display: flex;
|
|
1695
|
+
width: 100%;
|
|
1696
|
+
}
|
|
1697
|
+
|
|
1698
|
+
/* Hover states */
|
|
1699
|
+
.payment-method-item:hover {
|
|
1700
|
+
border-color: var(--primer-color-border-outlined-hover);
|
|
1701
|
+
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.07);
|
|
1702
|
+
}
|
|
1703
|
+
|
|
1704
|
+
.payment-method-content {
|
|
1705
|
+
display: flex;
|
|
1706
|
+
align-items: center;
|
|
1707
|
+
gap: var(--primer-space-small);
|
|
1708
|
+
width: 100%;
|
|
1709
|
+
position: relative;
|
|
1710
|
+
}
|
|
1711
|
+
|
|
1712
|
+
/* Card icons */
|
|
1713
|
+
.payment-method-icon {
|
|
1714
|
+
height: var(--primer-space-xlarge);
|
|
1715
|
+
object-fit: contain;
|
|
1716
|
+
flex-shrink: 0;
|
|
1717
|
+
transition: transform var(--primer-animation-duration)
|
|
1718
|
+
var(--primer-animation-easing);
|
|
1719
|
+
}
|
|
1720
|
+
|
|
1721
|
+
.payment-method-icon-generic {
|
|
1722
|
+
display: flex;
|
|
1723
|
+
align-items: center;
|
|
1724
|
+
justify-content: center;
|
|
1725
|
+
color: var(--primer-color-gray-500);
|
|
1726
|
+
height: var(--primer-space-xlarge);
|
|
1727
|
+
flex-shrink: 0;
|
|
1728
|
+
}
|
|
1729
|
+
|
|
1730
|
+
.payment-method-details {
|
|
1731
|
+
flex: 1;
|
|
1732
|
+
display: flex;
|
|
1733
|
+
gap: var(--primer-space-small);
|
|
1734
|
+
align-items: baseline;
|
|
1735
|
+
transition: transform var(--primer-animation-duration)
|
|
1736
|
+
var(--primer-animation-easing);
|
|
1737
|
+
}
|
|
1738
|
+
|
|
1739
|
+
.payment-method-description {
|
|
1740
|
+
font-weight: var(--primer-typography-title-large-weight);
|
|
1741
|
+
color: var(--primer-color-text-primary);
|
|
1742
|
+
transition: color var(--primer-animation-duration)
|
|
1743
|
+
var(--primer-animation-easing);
|
|
1744
|
+
}
|
|
1745
|
+
|
|
1746
|
+
.payment-method-secondary-description {
|
|
1747
|
+
font-size: var(--primer-typography-body-small-size);
|
|
1748
|
+
color: var(--primer-color-text-secondary);
|
|
1749
|
+
margin-top: var(--primer-space-xxsmall);
|
|
1750
|
+
transition: color var(--primer-animation-duration)
|
|
1751
|
+
var(--primer-animation-easing);
|
|
1752
|
+
}
|
|
1753
|
+
|
|
1754
|
+
/* Delete button - visible only in edit mode */
|
|
1755
|
+
.delete-button {
|
|
1756
|
+
background-color: transparent;
|
|
1757
|
+
border: none;
|
|
1758
|
+
color: var(--primer-color-red-500);
|
|
1759
|
+
cursor: pointer;
|
|
1760
|
+
padding: var(--primer-space-xsmall);
|
|
1761
|
+
border-radius: var(--primer-radius-small);
|
|
1762
|
+
flex-shrink: 0;
|
|
1763
|
+
display: flex;
|
|
1764
|
+
align-items: center;
|
|
1765
|
+
justify-content: center;
|
|
1766
|
+
height: var(--primer-size-medium);
|
|
1767
|
+
width: var(--primer-size-medium);
|
|
1768
|
+
/* The delete button starts invisible */
|
|
1769
|
+
opacity: 0;
|
|
1770
|
+
transform: translateX(var(--primer-space-small));
|
|
1771
|
+
}
|
|
1772
|
+
|
|
1773
|
+
/* Delete button is fully visible in stable edit mode (not transitioning) */
|
|
1774
|
+
.payment-method-item .delete-button {
|
|
1775
|
+
opacity: 1;
|
|
1776
|
+
transform: translateX(0);
|
|
1777
|
+
}
|
|
1778
|
+
|
|
1779
|
+
.delete-button:hover {
|
|
1780
|
+
background-color: var(--primer-color-red-100);
|
|
1781
|
+
transform: scale(1.05);
|
|
1782
|
+
}
|
|
1783
|
+
|
|
1784
|
+
.delete-button:active {
|
|
1785
|
+
transform: scale(0.95);
|
|
1786
|
+
}
|
|
1787
|
+
|
|
1788
|
+
.delete-button primer-icon {
|
|
1789
|
+
color: var(--primer-color-red-500);
|
|
1790
|
+
}
|
|
1791
|
+
`;var me=class extends f{constructor(){super(...arguments);this.vaultManagerContext=null;this.vaultItemContext=null;this.headlessUtils=null;this.paymentMethod=null;this.isEditMode=!1;this._getAssetsTask=new V(this,{task:async([e,r,i])=>{if(!e||!r||!i)return D;let s="";if(oa(e))s=r.getCardNetworkAsset(e.paymentInstrumentData.network).cardUrl;else{let h=await r.getCDNAssets(e.paymentMethodType);h&&(s=h.assets?.icon?`${h.goatCdnUrl}/${h.assets.icon}`:"")}let c=i.cvvRecapture,x=Mr(e);return{icon:s,shouldShowCVV:c,...x}},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?m`<img
|
|
1792
|
+
class="payment-method-icon"
|
|
1793
|
+
src=${e.icon}
|
|
1794
|
+
alt=${e.description}
|
|
1795
|
+
/>`:m`
|
|
1796
|
+
<div class="payment-method-icon payment-method-icon-generic">
|
|
1797
|
+
<primer-icon name="payment-card" size="sm"></primer-icon>
|
|
1798
|
+
</div>
|
|
1799
|
+
`;return m`
|
|
1800
|
+
${r}
|
|
1801
|
+
<div class="payment-method-details">
|
|
1802
|
+
<div class="payment-method-description">${e.description}</div>
|
|
1803
|
+
${e.secondaryDescription?m`<div class="payment-method-secondary-description">
|
|
1804
|
+
${e.secondaryDescription}
|
|
1805
|
+
</div>`:u}
|
|
1806
|
+
</div>
|
|
1807
|
+
`}render(){return this._getAssetsTask.render({error:()=>u,complete:e=>{let r=this.isSelected()?"checked":"default";return this.isEditMode?m`
|
|
1808
|
+
<div class="payment-method-item" @click=${this.handleClick}>
|
|
1809
|
+
<div class="payment-method-content">
|
|
1810
|
+
${this.renderPaymentMethodContent(e)}
|
|
1811
|
+
<button
|
|
1812
|
+
class="delete-button"
|
|
1813
|
+
@click=${this.handleDeleteClick}
|
|
1814
|
+
aria-label=${`${P("delete",{id:"delete"})} ${e.description}`}
|
|
1815
|
+
>
|
|
1816
|
+
<primer-icon name="trash" size="sm"></primer-icon>
|
|
1817
|
+
</button>
|
|
1818
|
+
</div>
|
|
1819
|
+
</div>
|
|
1820
|
+
`:m`
|
|
1821
|
+
<div class="payment-method-wrapper">
|
|
1822
|
+
<primer-button
|
|
1823
|
+
variant="secondary"
|
|
1824
|
+
class="payment-method-button"
|
|
1825
|
+
selectable
|
|
1826
|
+
selectionState=${r}
|
|
1827
|
+
@click=${this.handleClick}
|
|
1828
|
+
>
|
|
1829
|
+
${this.renderPaymentMethodContent(e)}
|
|
1830
|
+
</primer-button>
|
|
1831
|
+
${$(e.shouldShowCVV&&this.isSelected(),()=>m`<primer-vault-cvv-input
|
|
1832
|
+
.paymentMethod="${this.paymentMethod}"
|
|
1833
|
+
></primer-vault-cvv-input>`)}
|
|
1834
|
+
</div>
|
|
1835
|
+
`}})}};me.styles=[S,ia],n([C({context:W,subscribe:!0}),d({type:Object,attribute:!1,hasChanged(e,r){return e?.cvvRecapture!==r?.cvvRecapture}})],me.prototype,"vaultManagerContext",2),n([C({context:Te,subscribe:!0}),d({type:Object,attribute:!1,hasChanged(e,r){return e?.selectedVaultedPaymentMethod?.id!==r?.selectedVaultedPaymentMethod?.id}})],me.prototype,"vaultItemContext",2),n([C({context:q,subscribe:!0}),d({type:Object})],me.prototype,"headlessUtils",2),n([d({type:Object,attribute:!1})],me.prototype,"paymentMethod",2),n([d({type:Boolean,reflect:!0})],me.prototype,"isEditMode",2),me=n([v("primer-vault-payment-method-item"),I()],me);var aa=g`
|
|
1836
|
+
:host {
|
|
1837
|
+
display: block;
|
|
1838
|
+
width: 100%;
|
|
1839
|
+
}
|
|
1840
|
+
|
|
1841
|
+
.vault-manager-header {
|
|
1842
|
+
display: flex;
|
|
1843
|
+
justify-content: space-between;
|
|
1844
|
+
align-items: center;
|
|
1845
|
+
margin-bottom: var(--primer-space-medium);
|
|
1846
|
+
}
|
|
1847
|
+
|
|
1848
|
+
.vault-manager-header h3 {
|
|
1849
|
+
font-size: var(--primer-typography-title-large-size);
|
|
1850
|
+
font-weight: var(--primer-typography-title-large-weight);
|
|
1851
|
+
font-family: var(--primer-typography-title-large-font);
|
|
1852
|
+
color: var(--primer-color-text-primary);
|
|
1853
|
+
margin: 0;
|
|
1854
|
+
}
|
|
1855
|
+
|
|
1856
|
+
.edit-button {
|
|
1857
|
+
display: flex;
|
|
1858
|
+
align-items: center;
|
|
1859
|
+
justify-content: center;
|
|
1860
|
+
}
|
|
1861
|
+
|
|
1862
|
+
.edit-button.active {
|
|
1863
|
+
color: var(--primer-color-brand);
|
|
1864
|
+
}
|
|
1865
|
+
`;var He=class extends f{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 m`
|
|
1866
|
+
<div class="vault-manager-header">
|
|
1867
|
+
<h3>${P("previouslyUsed",{id:"previouslyUsed"})}</h3>
|
|
1868
|
+
|
|
1869
|
+
${this.hasPaymentMethods?m`
|
|
1870
|
+
<primer-button
|
|
1871
|
+
class="edit-button ${this.isEditMode?"active":""}"
|
|
1872
|
+
@click=${this.toggleEditMode}
|
|
1873
|
+
aria-label=${this.isEditMode?P("confirm",{id:"confirm"}):P("editPaymentMethods",{id:"editPaymentMethods"})}
|
|
1874
|
+
>
|
|
1875
|
+
${this.isEditMode?m`<primer-icon name="checkmark" size="sm"></primer-icon>`:m`<primer-icon name="pencil" size="sm"></primer-icon>`}
|
|
1876
|
+
</primer-button>
|
|
1877
|
+
`:u}
|
|
1878
|
+
</div>
|
|
1879
|
+
`}};He.styles=[S,aa],n([d({type:Boolean})],He.prototype,"isEditMode",2),n([d({type:Boolean})],He.prototype,"hasPaymentMethods",2),He=n([v("primer-vault-manager-header"),I()],He);var na=g`
|
|
1880
|
+
:host {
|
|
1881
|
+
display: block;
|
|
1882
|
+
width: 100%;
|
|
1883
|
+
}
|
|
1884
|
+
|
|
1885
|
+
.delete-confirmation {
|
|
1886
|
+
margin-top: var(--primer-space-small);
|
|
1887
|
+
padding: var(--primer-space-medium);
|
|
1888
|
+
background-color: var(--primer-color-gray-000);
|
|
1889
|
+
border: 1px solid var(--primer-color-red-500);
|
|
1890
|
+
border-radius: var(--primer-radius-medium);
|
|
1891
|
+
}
|
|
1892
|
+
|
|
1893
|
+
.delete-message {
|
|
1894
|
+
margin-bottom: var(--primer-space-medium);
|
|
1895
|
+
}
|
|
1896
|
+
|
|
1897
|
+
.delete-text {
|
|
1898
|
+
margin: 0;
|
|
1899
|
+
color: var(--primer-color-text-secondary);
|
|
1900
|
+
font-size: var(--primer-typography-body-medium-size);
|
|
1901
|
+
}
|
|
1902
|
+
|
|
1903
|
+
.delete-actions {
|
|
1904
|
+
display: flex;
|
|
1905
|
+
justify-content: flex-end;
|
|
1906
|
+
gap: var(--primer-space-small);
|
|
1907
|
+
}
|
|
1908
|
+
|
|
1909
|
+
.delete-confirm {
|
|
1910
|
+
background-color: var(--primer-color-red-500);
|
|
1911
|
+
color: var(--primer-color-gray-000);
|
|
1912
|
+
border: none;
|
|
1913
|
+
padding: var(--primer-space-small) var(--primer-space-medium);
|
|
1914
|
+
border-radius: var(--primer-radius-small);
|
|
1915
|
+
font-weight: var(--primer-typography-body-medium-weight);
|
|
1916
|
+
cursor: pointer;
|
|
1917
|
+
transition: background-color var(--primer-animation-duration)
|
|
1918
|
+
var(--primer-animation-easing);
|
|
1919
|
+
}
|
|
1920
|
+
|
|
1921
|
+
.delete-confirm:hover:not(:disabled) {
|
|
1922
|
+
background-color: var(--primer-color-red-900);
|
|
1923
|
+
}
|
|
1924
|
+
|
|
1925
|
+
.delete-confirm:disabled {
|
|
1926
|
+
opacity: 0.7;
|
|
1927
|
+
cursor: not-allowed;
|
|
1928
|
+
}
|
|
1929
|
+
|
|
1930
|
+
.delete-cancel {
|
|
1931
|
+
background-color: transparent;
|
|
1932
|
+
border: 1px solid var(--primer-color-border-outlined-default);
|
|
1933
|
+
padding: var(--primer-space-small) var(--primer-space-medium);
|
|
1934
|
+
border-radius: var(--primer-radius-small);
|
|
1935
|
+
color: var(--primer-color-text-primary);
|
|
1936
|
+
font-weight: var(--primer-typography-body-medium-weight);
|
|
1937
|
+
cursor: pointer;
|
|
1938
|
+
transition: background-color var(--primer-animation-duration)
|
|
1939
|
+
var(--primer-animation-easing);
|
|
1940
|
+
}
|
|
1941
|
+
|
|
1942
|
+
.delete-cancel:hover:not(:disabled) {
|
|
1943
|
+
background-color: var(--primer-color-gray-100);
|
|
1944
|
+
}
|
|
1945
|
+
|
|
1946
|
+
.delete-cancel:disabled {
|
|
1947
|
+
opacity: 0.7;
|
|
1948
|
+
cursor: not-allowed;
|
|
1949
|
+
}
|
|
1950
|
+
`;var fe=class extends f{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 m`
|
|
1951
|
+
<div class="delete-confirmation">
|
|
1952
|
+
<div class="delete-message">
|
|
1953
|
+
<p class="delete-text">${e}</p>
|
|
1954
|
+
</div>
|
|
1955
|
+
<div class="delete-actions">
|
|
1956
|
+
<button
|
|
1957
|
+
class="delete-confirm"
|
|
1958
|
+
@click=${this.handleConfirmClick}
|
|
1959
|
+
?disabled=${this.isDeleting}
|
|
1960
|
+
>
|
|
1961
|
+
${this.isDeleting?P("deleting",{id:"deleting"}):P("confirmVaultedPaymentMethodDeletion",{id:"confirmVaultedPaymentMethodDeletion"})}
|
|
1962
|
+
</button>
|
|
1963
|
+
<button
|
|
1964
|
+
class="delete-cancel"
|
|
1965
|
+
@click=${this.handleCancelClick}
|
|
1966
|
+
?disabled=${this.isDeleting}
|
|
1967
|
+
>
|
|
1968
|
+
${P("cancel",{id:"cancel"})}
|
|
1969
|
+
</button>
|
|
1970
|
+
</div>
|
|
1971
|
+
</div>
|
|
1972
|
+
`}};fe.styles=[S,na],n([d({type:Boolean})],fe.prototype,"isDeleting",2),n([d({type:String})],fe.prototype,"paymentMethodId",2),n([d({type:String})],fe.prototype,"paymentMethodName",2),n([C({context:W,subscribe:!0})],fe.prototype,"vaultManager",2),fe=n([v("primer-vault-delete-confirmation"),I()],fe);var sa=g`
|
|
1973
|
+
:host {
|
|
1974
|
+
display: block;
|
|
1975
|
+
width: 100%;
|
|
1976
|
+
}
|
|
1977
|
+
|
|
1978
|
+
.empty-state {
|
|
1979
|
+
padding: var(--primer-space-xlarge) 0;
|
|
1980
|
+
text-align: center;
|
|
1981
|
+
color: var(--primer-color-text-secondary);
|
|
1982
|
+
}
|
|
1983
|
+
|
|
1984
|
+
.empty-state p {
|
|
1985
|
+
margin: 0;
|
|
1986
|
+
}
|
|
1987
|
+
`;var ut=class extends f{render(){return m`
|
|
1988
|
+
<div class="empty-state">
|
|
1989
|
+
<p>
|
|
1990
|
+
${P("savedPaymentMethodsEmpty",{id:"savedPaymentMethodsEmpty"})}
|
|
1991
|
+
</p>
|
|
1992
|
+
</div>
|
|
1993
|
+
`}};ut.styles=[S,sa],ut=n([v("primer-vault-empty-state"),I()],ut);var la=g`
|
|
1994
|
+
:host {
|
|
1995
|
+
display: block;
|
|
1996
|
+
width: 100%;
|
|
1997
|
+
}
|
|
1998
|
+
|
|
1999
|
+
.error-message {
|
|
2000
|
+
display: flex;
|
|
2001
|
+
background-color: var(--primer-color-red-100);
|
|
2002
|
+
padding: var(--primer-space-medium);
|
|
2003
|
+
border-radius: var(--primer-radius-small);
|
|
2004
|
+
margin-bottom: var(--primer-space-medium);
|
|
2005
|
+
justify-content: space-between;
|
|
2006
|
+
align-items: center;
|
|
2007
|
+
border: 1px solid var(--primer-color-red-500);
|
|
2008
|
+
}
|
|
2009
|
+
|
|
2010
|
+
.error-content {
|
|
2011
|
+
display: flex;
|
|
2012
|
+
align-items: center;
|
|
2013
|
+
gap: var(--primer-space-small);
|
|
2014
|
+
}
|
|
2015
|
+
|
|
2016
|
+
.error-message p {
|
|
2017
|
+
margin: 0;
|
|
2018
|
+
color: var(--primer-color-text-negative);
|
|
2019
|
+
font-size: var(--primer-typography-body-medium-size);
|
|
2020
|
+
}
|
|
2021
|
+
|
|
2022
|
+
.error-message button {
|
|
2023
|
+
background: transparent;
|
|
2024
|
+
border: none;
|
|
2025
|
+
color: var(--primer-color-text-negative);
|
|
2026
|
+
cursor: pointer;
|
|
2027
|
+
padding: var(--primer-space-xsmall);
|
|
2028
|
+
display: flex;
|
|
2029
|
+
align-items: center;
|
|
2030
|
+
justify-content: center;
|
|
2031
|
+
border-radius: var(--primer-radius-small);
|
|
2032
|
+
transition: background-color var(--primer-animation-duration)
|
|
2033
|
+
var(--primer-animation-easing);
|
|
2034
|
+
}
|
|
2035
|
+
|
|
2036
|
+
.error-message button:hover {
|
|
2037
|
+
background-color: rgba(0, 0, 0, 0.05);
|
|
2038
|
+
}
|
|
2039
|
+
`;var Ze=class extends f{constructor(){super(...arguments);this.errorMessage=""}handleDismiss(){this.dispatchEvent(new CustomEvent("close-error",{bubbles:!0,composed:!0}))}render(){return m`
|
|
2040
|
+
<div class="error-message">
|
|
2041
|
+
<div class="error-content">
|
|
2042
|
+
<primer-icon
|
|
2043
|
+
name="warning"
|
|
2044
|
+
size="sm"
|
|
2045
|
+
color="var(--primer-color-red-500)"
|
|
2046
|
+
></primer-icon>
|
|
2047
|
+
<p>${this.errorMessage}</p>
|
|
2048
|
+
</div>
|
|
2049
|
+
<button
|
|
2050
|
+
@click=${this.handleDismiss}
|
|
2051
|
+
aria-label=${P("closeErrorMessage",{id:"closeErrorMessage"})}
|
|
2052
|
+
>
|
|
2053
|
+
<primer-icon name="close" size="sm"></primer-icon>
|
|
2054
|
+
</button>
|
|
2055
|
+
</div>
|
|
2056
|
+
`}};Ze.styles=[S,la],n([d({type:String})],Ze.prototype,"errorMessage",2),Ze=n([v("primer-vault-error-message"),I()],Ze);var da=g`
|
|
2057
|
+
:host {
|
|
2058
|
+
display: contents;
|
|
2059
|
+
}
|
|
2060
|
+
`;var X=class extends f{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 i=new CustomEvent("primer-vault-payment-error",{bubbles:!0,composed:!0,detail:{error:r}});this.dispatchEvent(i)}}}get buttonText(){return this._userAssignedProps.has("buttonText")?this._internalButtonText:P("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}`:u;return m`
|
|
2061
|
+
<primer-button
|
|
2062
|
+
buttonType="submit"
|
|
2063
|
+
variant=${this.variant}
|
|
2064
|
+
@click=${this.handleClick}
|
|
2065
|
+
.disabled=${this.isButtonDisabled}
|
|
2066
|
+
.loading=${this.sdkState?.isProcessing}
|
|
2067
|
+
data-submit
|
|
2068
|
+
>
|
|
2069
|
+
${this.buttonText}${r}
|
|
2070
|
+
</primer-button>
|
|
2071
|
+
`}};X.styles=[S,da],n([d({type:String})],X.prototype,"buttonText",1),n([C({context:q,subscribe:!0}),d({type:Object})],X.prototype,"headlessInstance",2),n([C({context:j,subscribe:!0}),d()],X.prototype,"sdkState",2),n([C({context:Te,subscribe:!0}),d({type:Object,attribute:!1,hasChanged(e,r){return e?.selectedVaultedPaymentMethod?.id!==r?.selectedVaultedPaymentMethod?.id}})],X.prototype,"vaultItemContext",2),n([C({context:W,subscribe:!0}),d({type:Object,attribute:!1})],X.prototype,"vaultManager",2),n([C({context:ot,subscribe:!0}),d({type:Object,attribute:!1,hasChanged(e,r){return e?.submitButton?.amountVisible!==r?.submitButton?.amountVisible}})],X.prototype,"clientOptions",2),n([d({type:String})],X.prototype,"variant",2),n([d({type:Boolean})],X.prototype,"disabled",2),X=n([v("primer-vault-payment-submit"),I()],X);var pa=g`
|
|
2072
|
+
:host {
|
|
2073
|
+
display: block;
|
|
2074
|
+
margin-top: var(--primer-space-medium);
|
|
2075
|
+
}
|
|
2076
|
+
|
|
2077
|
+
.cvv-input-container {
|
|
2078
|
+
margin-bottom: var(--primer-space-medium);
|
|
2079
|
+
}
|
|
2080
|
+
`;var J=class extends f{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 V(this,{task:async([e,r])=>!e||!r||e.paymentMethodType!=="PAYMENT_CARD"||!e.paymentInstrumentData?.network||r.createCvvInput===void 0?D:{network:e.paymentInstrumentData.network,createCvvInput:r.createCvvInput},args:()=>[this.paymentMethod,this.vaultManagerFormContext]});this.cvvContainerId=`cvv-container-${Math.random().toString(36).substring(2,9)}`,new V(this,{task:async([e])=>{if(!e)return D;await this.updateComplete;let r=this.renderRoot.querySelector(`#${this.cvvContainerId}`);if(!r)return;let i=yr(this.computedStyles),s=i?{input:{base:i}}:void 0,c={cardNetwork:e.network,container:r,name:"cvv",placeholder:"123",style:s};this.cvvInput=await e.createCvvInput(c),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:()=>u,complete:()=>m`
|
|
2081
|
+
<div class="cvv-input-container">
|
|
2082
|
+
<primer-input-wrapper
|
|
2083
|
+
.hasError=${!!this.cvvError&&(this.vaultManagerCvvContext?.formIsDirty||this.cvvInputIsDirty&&this.cvvInputIsBlurred)}
|
|
2084
|
+
>
|
|
2085
|
+
<primer-input-label slot="label">CVV</primer-input-label>
|
|
2086
|
+
<div slot="input" id="${this.cvvContainerId}"></div>
|
|
2087
|
+
${$(this.cvvError&&(this.vaultManagerCvvContext?.formIsDirty||this.cvvInputIsDirty&&this.cvvInputIsBlurred),()=>m`
|
|
2088
|
+
<primer-input-error slot="error">
|
|
2089
|
+
${this.cvvError}
|
|
2090
|
+
</primer-input-error>
|
|
2091
|
+
`)}
|
|
2092
|
+
</primer-input-wrapper>
|
|
2093
|
+
</div>
|
|
2094
|
+
`})}};J.styles=[S,pa],n([C({context:W,subscribe:!0}),d({type:Object,attribute:!1,hasChanged(e,r){return e?.createCvvInput!==r?.createCvvInput}})],J.prototype,"vaultManagerFormContext",2),n([C({context:Te,subscribe:!0}),d({type:Object,attribute:!1})],J.prototype,"vaultManagerCvvContext",2),n([C({context:Pe,subscribe:!0}),d()],J.prototype,"computedStyles",2),n([d({type:Object})],J.prototype,"paymentMethod",2),n([w()],J.prototype,"cvvError",2),n([w()],J.prototype,"cvvInputIsDirty",2),n([w()],J.prototype,"cvvInputIsBlurred",2),n([w()],J.prototype,"cvvInput",2),J=n([v("primer-vault-cvv-input"),I()],J);var ca=g`
|
|
2095
|
+
:host {
|
|
2096
|
+
display: block;
|
|
2097
|
+
margin-top: var(--primer-space-medium);
|
|
2098
|
+
margin-bottom: var(--primer-space-medium);
|
|
2099
|
+
}
|
|
2100
|
+
|
|
2101
|
+
.other-payment-methods-container {
|
|
2102
|
+
width: 100%;
|
|
2103
|
+
}
|
|
2104
|
+
|
|
2105
|
+
.other-payment-methods-content {
|
|
2106
|
+
padding: var(--primer-space-medium) 0;
|
|
2107
|
+
}
|
|
2108
|
+
|
|
2109
|
+
.primer-loader {
|
|
2110
|
+
display: flex;
|
|
2111
|
+
justify-content: center;
|
|
2112
|
+
align-items: center;
|
|
2113
|
+
}
|
|
2114
|
+
`;var Ye=class extends f{constructor(){super(...arguments);this.isShowingOtherPayments=!1;this.vaultManager=null}handleExpandedChanged(e){this.isShowingOtherPayments=e.detail.expanded}render(){return this.vaultManager?.isLoading?u:!this.vaultManager||!this.vaultManager.enabled||this.vaultManager.vaultedPaymentMethods.length===0?m`<slot name="other-payments"></slot>`:m`
|
|
2115
|
+
<div class="other-payment-methods-container">
|
|
2116
|
+
<primer-collapsable
|
|
2117
|
+
buttonVariant="secondary"
|
|
2118
|
+
.expanded="${this.isShowingOtherPayments}"
|
|
2119
|
+
.header="${P("navigateToPaymentMethods",{id:"navigateToPaymentMethods"})}"
|
|
2120
|
+
@expanded-changed="${this.handleExpandedChanged}"
|
|
2121
|
+
>
|
|
2122
|
+
<div class="other-payment-methods-content">
|
|
2123
|
+
<slot name="other-payments"></slot>
|
|
2124
|
+
</div>
|
|
2125
|
+
</primer-collapsable>
|
|
2126
|
+
</div>
|
|
2127
|
+
`}};Ye.styles=[ca],n([w()],Ye.prototype,"isShowingOtherPayments",2),n([C({context:W,subscribe:!0}),d({type:Object,attribute:!1})],Ye.prototype,"vaultManager",2),Ye=n([v("primer-show-other-payments")],Ye);var Ht=class extends f{render(){return m`
|
|
2128
|
+
<primer-checkout-state type="complete"></primer-checkout-state>
|
|
2129
|
+
`}};Ht=n([v("primer-checkout-complete")],Ht);var ht=class extends f{constructor(){super(...arguments);this.sdkState=null}render(){return m`
|
|
2130
|
+
<primer-checkout-state
|
|
2131
|
+
type="failure"
|
|
2132
|
+
description=${this.sdkState?.error?.message||""}
|
|
2133
|
+
></primer-checkout-state>
|
|
2134
|
+
`}};n([C({context:j,subscribe:!0}),d()],ht.prototype,"sdkState",2),ht=n([v("primer-checkout-error")],ht);var ma=g`
|
|
2135
|
+
:host {
|
|
2136
|
+
display: block;
|
|
2137
|
+
width: 100%;
|
|
2138
|
+
}
|
|
2139
|
+
`;var Ue=class extends f{constructor(){super(...arguments);this.showProcessingErrors=!0}get shouldShowError(){return!this.sdkState||this.sdkState.isProcessing?!1:!!(this.sdkState.failure&&this.showProcessingErrors)}render(){return this.sdkState?m`
|
|
2140
|
+
<primer-error-message
|
|
2141
|
+
message="${P(this.sdkState.failure?.message??"",{id:"tokenizationError"})}"
|
|
2142
|
+
?visible="${this.shouldShowError}"
|
|
2143
|
+
></primer-error-message>
|
|
2144
|
+
`:u}};Ue.styles=[ma],n([C({context:j,subscribe:!0}),w()],Ue.prototype,"sdkState",2),n([d({type:Boolean,attribute:"show-processing-errors"})],Ue.prototype,"showProcessingErrors",2),Ue=n([v("primer-error-message-container")],Ue);function Fn(){xt(zo,"primer-css-loader-styles",!1)}function Kn(){Ko()}function Px(){$r()}function Tx(){Vr()}async function wx(){Fn(),Kn()}export{ne as Button,_e as CardForm,dt as CardFormCVV,le as CardFormCardNetworkSelector,lt as CardFormCardNumber,Re as CardFormError,pt as CardFormExpiry,ct as CardFormName,se as CardFormSubmit,re as Collapsable,he as ErrorMessage,Ue as ErrorMessageContainer,hr as InitializedPayments,Y as Input,Le as InputLabel,Ce as InputWrapper,Me as NativePayment,De as PaymentMethod,Ht as PrimerCheckoutComplete,ae as PrimerCheckoutComponent,ht as PrimerCheckoutFailure,Oe as PrimerCheckoutState,Ae as PrimerIcon,Z as PrimerKlarna,$e as PrimerMain,ge as RedirectPayment,Ye as ShowOtherPayments,xe as Spinner,J as VaultCvvInput,fe as VaultDeleteConfirmation,ut as VaultEmptyState,Ze as VaultErrorMessage,ce as VaultManager,He as VaultManagerHeader,me as VaultPaymentMethodItem,X as VaultPaymentSubmit,Tx as injectDarkTheme,Px as injectLightTheme,Fn as injectLoaderStyles,Kn as injectThemeStyles,wx as loadPrimer};
|
|
2145
|
+
/*! Bundled license information:
|
|
2146
|
+
|
|
2147
|
+
@lit/context/lib/context-request-event.js:
|
|
2148
|
+
(**
|
|
2149
|
+
* @license
|
|
2150
|
+
* Copyright 2021 Google LLC
|
|
2151
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
2152
|
+
*)
|
|
2153
|
+
|
|
2154
|
+
@lit/context/lib/create-context.js:
|
|
2155
|
+
(**
|
|
2156
|
+
* @license
|
|
2157
|
+
* Copyright 2021 Google LLC
|
|
2158
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
2159
|
+
*)
|
|
2160
|
+
|
|
2161
|
+
@lit/context/lib/controllers/context-consumer.js:
|
|
2162
|
+
(**
|
|
2163
|
+
* @license
|
|
2164
|
+
* Copyright 2021 Google LLC
|
|
2165
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
2166
|
+
*)
|
|
2167
|
+
|
|
2168
|
+
@lit/context/lib/value-notifier.js:
|
|
2169
|
+
(**
|
|
2170
|
+
* @license
|
|
2171
|
+
* Copyright 2021 Google LLC
|
|
2172
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
2173
|
+
*)
|
|
2174
|
+
|
|
2175
|
+
@lit/context/lib/controllers/context-provider.js:
|
|
2176
|
+
(**
|
|
2177
|
+
* @license
|
|
2178
|
+
* Copyright 2021 Google LLC
|
|
2179
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
2180
|
+
*)
|
|
2181
|
+
|
|
2182
|
+
@lit/context/lib/context-root.js:
|
|
2183
|
+
(**
|
|
2184
|
+
* @license
|
|
2185
|
+
* Copyright 2021 Google LLC
|
|
2186
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
2187
|
+
*)
|
|
2188
|
+
|
|
2189
|
+
@lit/context/lib/decorators/provide.js:
|
|
2190
|
+
(**
|
|
2191
|
+
* @license
|
|
2192
|
+
* Copyright 2017 Google LLC
|
|
2193
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
2194
|
+
*)
|
|
2195
|
+
|
|
2196
|
+
@lit/context/lib/decorators/consume.js:
|
|
2197
|
+
(**
|
|
2198
|
+
* @license
|
|
2199
|
+
* Copyright 2022 Google LLC
|
|
2200
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
2201
|
+
*)
|
|
2202
|
+
|
|
2203
|
+
@lit/reactive-element/css-tag.js:
|
|
2204
|
+
(**
|
|
2205
|
+
* @license
|
|
2206
|
+
* Copyright 2019 Google LLC
|
|
2207
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
2208
|
+
*)
|
|
2209
|
+
|
|
2210
|
+
@lit/reactive-element/reactive-element.js:
|
|
2211
|
+
(**
|
|
2212
|
+
* @license
|
|
2213
|
+
* Copyright 2017 Google LLC
|
|
2214
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
2215
|
+
*)
|
|
2216
|
+
|
|
2217
|
+
@lit/task/task.js:
|
|
2218
|
+
(**
|
|
2219
|
+
* @license
|
|
2220
|
+
* Copyright 2017 Google LLC
|
|
2221
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
2222
|
+
*)
|
|
2223
|
+
|
|
2224
|
+
@lit/localize/internal/locale-status-event.js:
|
|
2225
|
+
(**
|
|
2226
|
+
* @license
|
|
2227
|
+
* Copyright 2021 Google LLC
|
|
2228
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
2229
|
+
*)
|
|
2230
|
+
|
|
2231
|
+
@lit/localize/internal/str-tag.js:
|
|
2232
|
+
(**
|
|
2233
|
+
* @license
|
|
2234
|
+
* Copyright 2021 Google LLC
|
|
2235
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
2236
|
+
*)
|
|
2237
|
+
|
|
2238
|
+
@lit/localize/internal/types.js:
|
|
2239
|
+
(**
|
|
2240
|
+
* @license
|
|
2241
|
+
* Copyright 2021 Google LLC
|
|
2242
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
2243
|
+
*)
|
|
2244
|
+
|
|
2245
|
+
@lit/localize/internal/default-msg.js:
|
|
2246
|
+
(**
|
|
2247
|
+
* @license
|
|
2248
|
+
* Copyright 2021 Google LLC
|
|
2249
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
2250
|
+
*)
|
|
2251
|
+
|
|
2252
|
+
@lit/localize/internal/localized-controller.js:
|
|
2253
|
+
(**
|
|
2254
|
+
* @license
|
|
2255
|
+
* Copyright 2021 Google LLC
|
|
2256
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
2257
|
+
*)
|
|
2258
|
+
|
|
2259
|
+
@lit/localize/internal/localized-decorator.js:
|
|
2260
|
+
(**
|
|
2261
|
+
* @license
|
|
2262
|
+
* Copyright 2021 Google LLC
|
|
2263
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
2264
|
+
*)
|
|
2265
|
+
|
|
2266
|
+
@lit/localize/internal/deferred.js:
|
|
2267
|
+
(**
|
|
2268
|
+
* @license
|
|
2269
|
+
* Copyright 2020 Google LLC
|
|
2270
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
2271
|
+
*)
|
|
2272
|
+
|
|
2273
|
+
@lit/localize/internal/fnv1a64.js:
|
|
2274
|
+
(**
|
|
2275
|
+
* @license
|
|
2276
|
+
* Copyright 2014 Travis Webb
|
|
2277
|
+
* SPDX-License-Identifier: MIT
|
|
2278
|
+
*)
|
|
2279
|
+
|
|
2280
|
+
@lit/localize/internal/id-generation.js:
|
|
2281
|
+
(**
|
|
2282
|
+
* @license
|
|
2283
|
+
* Copyright 2020 Google LLC
|
|
2284
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
2285
|
+
*)
|
|
2286
|
+
|
|
2287
|
+
@lit/localize/internal/runtime-msg.js:
|
|
2288
|
+
(**
|
|
2289
|
+
* @license
|
|
2290
|
+
* Copyright 2021 Google LLC
|
|
2291
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
2292
|
+
*)
|
|
2293
|
+
|
|
2294
|
+
@lit/localize/init/runtime.js:
|
|
2295
|
+
(**
|
|
2296
|
+
* @license
|
|
2297
|
+
* Copyright 2021 Google LLC
|
|
2298
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
2299
|
+
*)
|
|
2300
|
+
|
|
2301
|
+
@lit/localize/init/transform.js:
|
|
2302
|
+
(**
|
|
2303
|
+
* @license
|
|
2304
|
+
* Copyright 2021 Google LLC
|
|
2305
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
2306
|
+
*)
|
|
2307
|
+
|
|
2308
|
+
@lit/localize/lit-localize.js:
|
|
2309
|
+
(**
|
|
2310
|
+
* @license
|
|
2311
|
+
* Copyright 2020 Google LLC
|
|
2312
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
2313
|
+
*)
|
|
2314
|
+
|
|
2315
|
+
lit-html/lit-html.js:
|
|
2316
|
+
(**
|
|
2317
|
+
* @license
|
|
2318
|
+
* Copyright 2017 Google LLC
|
|
2319
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
2320
|
+
*)
|
|
2321
|
+
|
|
2322
|
+
lit-element/lit-element.js:
|
|
2323
|
+
(**
|
|
2324
|
+
* @license
|
|
2325
|
+
* Copyright 2017 Google LLC
|
|
2326
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
2327
|
+
*)
|
|
2328
|
+
|
|
2329
|
+
lit-html/is-server.js:
|
|
2330
|
+
(**
|
|
2331
|
+
* @license
|
|
2332
|
+
* Copyright 2022 Google LLC
|
|
2333
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
2334
|
+
*)
|
|
2335
|
+
|
|
2336
|
+
@lit/reactive-element/decorators/custom-element.js:
|
|
2337
|
+
(**
|
|
2338
|
+
* @license
|
|
2339
|
+
* Copyright 2017 Google LLC
|
|
2340
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
2341
|
+
*)
|
|
2342
|
+
|
|
2343
|
+
@lit/reactive-element/decorators/property.js:
|
|
2344
|
+
(**
|
|
2345
|
+
* @license
|
|
2346
|
+
* Copyright 2017 Google LLC
|
|
2347
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
2348
|
+
*)
|
|
2349
|
+
|
|
2350
|
+
@lit/reactive-element/decorators/state.js:
|
|
2351
|
+
(**
|
|
2352
|
+
* @license
|
|
2353
|
+
* Copyright 2017 Google LLC
|
|
2354
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
2355
|
+
*)
|
|
2356
|
+
|
|
2357
|
+
@lit/reactive-element/decorators/event-options.js:
|
|
2358
|
+
(**
|
|
2359
|
+
* @license
|
|
2360
|
+
* Copyright 2017 Google LLC
|
|
2361
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
2362
|
+
*)
|
|
2363
|
+
|
|
2364
|
+
@lit/reactive-element/decorators/base.js:
|
|
2365
|
+
(**
|
|
2366
|
+
* @license
|
|
2367
|
+
* Copyright 2017 Google LLC
|
|
2368
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
2369
|
+
*)
|
|
2370
|
+
|
|
2371
|
+
@lit/reactive-element/decorators/query.js:
|
|
2372
|
+
(**
|
|
2373
|
+
* @license
|
|
2374
|
+
* Copyright 2017 Google LLC
|
|
2375
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
2376
|
+
*)
|
|
2377
|
+
|
|
2378
|
+
@lit/reactive-element/decorators/query-all.js:
|
|
2379
|
+
(**
|
|
2380
|
+
* @license
|
|
2381
|
+
* Copyright 2017 Google LLC
|
|
2382
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
2383
|
+
*)
|
|
2384
|
+
|
|
2385
|
+
@lit/reactive-element/decorators/query-async.js:
|
|
2386
|
+
(**
|
|
2387
|
+
* @license
|
|
2388
|
+
* Copyright 2017 Google LLC
|
|
2389
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
2390
|
+
*)
|
|
2391
|
+
|
|
2392
|
+
@lit/reactive-element/decorators/query-assigned-elements.js:
|
|
2393
|
+
(**
|
|
2394
|
+
* @license
|
|
2395
|
+
* Copyright 2021 Google LLC
|
|
2396
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
2397
|
+
*)
|
|
2398
|
+
|
|
2399
|
+
@lit/reactive-element/decorators/query-assigned-nodes.js:
|
|
2400
|
+
(**
|
|
2401
|
+
* @license
|
|
2402
|
+
* Copyright 2017 Google LLC
|
|
2403
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
2404
|
+
*)
|
|
2405
|
+
|
|
2406
|
+
lit-html/directives/when.js:
|
|
2407
|
+
(**
|
|
2408
|
+
* @license
|
|
2409
|
+
* Copyright 2021 Google LLC
|
|
2410
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
2411
|
+
*)
|
|
2412
|
+
|
|
2413
|
+
lit-html/directive.js:
|
|
2414
|
+
(**
|
|
2415
|
+
* @license
|
|
2416
|
+
* Copyright 2017 Google LLC
|
|
2417
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
2418
|
+
*)
|
|
2419
|
+
|
|
2420
|
+
lit-html/directives/class-map.js:
|
|
2421
|
+
(**
|
|
2422
|
+
* @license
|
|
2423
|
+
* Copyright 2018 Google LLC
|
|
2424
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
2425
|
+
*)
|
|
2426
|
+
|
|
2427
|
+
lit-html/directive-helpers.js:
|
|
2428
|
+
(**
|
|
2429
|
+
* @license
|
|
2430
|
+
* Copyright 2020 Google LLC
|
|
2431
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
2432
|
+
*)
|
|
2433
|
+
|
|
2434
|
+
lit-html/async-directive.js:
|
|
2435
|
+
(**
|
|
2436
|
+
* @license
|
|
2437
|
+
* Copyright 2017 Google LLC
|
|
2438
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
2439
|
+
*)
|
|
2440
|
+
|
|
2441
|
+
lit-html/directives/ref.js:
|
|
2442
|
+
(**
|
|
2443
|
+
* @license
|
|
2444
|
+
* Copyright 2020 Google LLC
|
|
2445
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
2446
|
+
*)
|
|
2447
|
+
*/
|