@basis-theory/web-elements 3.0.0 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.vite/manifest.json +49 -0
- package/dist/basis-theory-sdk.es.js +1 -1
- package/dist/basis-theory-sdk.umd.js +1 -1
- package/dist/basis-theory-sdk.umd.js.map +1 -1
- package/dist/{create-card-C94szxMV.js → create-card-CoTyU6ju.js} +10 -1
- package/dist/create-card-CoTyU6ju.js.map +1 -0
- package/dist/{create-card-display-DsLzA_vl.js → create-card-display-DQmTA_8S.js} +3 -1
- package/dist/{create-card-display-DsLzA_vl.js.map → create-card-display-DQmTA_8S.js.map} +1 -1
- package/dist/{create-copy-button-Z1s9ao67.js → create-copy-button-D8VeinHW.js} +3 -1
- package/dist/create-copy-button-D8VeinHW.js.map +1 -0
- package/dist/{index-DIVQdm8b.js → index-hHam_H0I.js} +214 -11
- package/dist/index-hHam_H0I.js.map +1 -0
- package/dist/index.d.ts +135 -0
- package/dist/loader/basis-theory.min.js +1 -1
- package/dist/sri.json +9 -9
- package/dist/stats.html +1 -1
- package/package.json +5 -5
- package/dist/create-card-C94szxMV.js.map +0 -1
- package/dist/create-copy-button-Z1s9ao67.js.map +0 -1
- package/dist/index-DIVQdm8b.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* API URL Resolution Utility
|
|
3
|
+
*
|
|
4
|
+
* Simple same-origin API detection for v3
|
|
5
|
+
* Shared across SDK and Elements packages
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Named API endpoints. These are dedicated hosts rather than same-origin paths: they
|
|
10
|
+
* carry the destination in the hostname, so routing does not depend on edge request
|
|
11
|
+
* processing and survives an edge incident.
|
|
12
|
+
*
|
|
13
|
+
* One option rather than separate stage and region knobs, matching the generated
|
|
14
|
+
* SDKs, iOS and Android, which all expose a single `environment`. v3 derives its
|
|
15
|
+
* stage from the page origin, so the only choice a caller makes is the destination.
|
|
16
|
+
*/
|
|
17
|
+
declare type ApiEnvironment = 'us' | 'eu' | 'test';
|
|
18
|
+
|
|
1
19
|
/**
|
|
2
20
|
* Base event detail - all element events include this metadata
|
|
3
21
|
*/
|
|
@@ -166,6 +184,34 @@ export declare interface BasisTheorySDK {
|
|
|
166
184
|
}): Promise<ProxyResponse>;
|
|
167
185
|
delete(options?: ProxyRequestOptions): Promise<unknown>;
|
|
168
186
|
};
|
|
187
|
+
/**
|
|
188
|
+
* Send element values straight to a third-party destination — "dual writing".
|
|
189
|
+
*
|
|
190
|
+
* Unlike `proxy`, the request does not pass through Basis Theory: it is made
|
|
191
|
+
* from inside a Basis Theory iframe directly to `url`, carrying no Basis
|
|
192
|
+
* Theory credentials. Destinations must be present in the Elements build's
|
|
193
|
+
* HTTP client allowlist, and `allowHttpClient: true` is required at init.
|
|
194
|
+
*
|
|
195
|
+
* Resolves with the destination's response body as plaintext, which may
|
|
196
|
+
* contain sensitive data depending on what the destination returns. Rejects
|
|
197
|
+
* with `HttpClientError` carrying `status`, `data`, and `headers`.
|
|
198
|
+
*
|
|
199
|
+
* @example
|
|
200
|
+
* ```typescript
|
|
201
|
+
* await bt.client.post('https://api.example.com/cards', {
|
|
202
|
+
* number: cardNumberElement,
|
|
203
|
+
* cvc: cvvElement,
|
|
204
|
+
* reference: 'order-123',
|
|
205
|
+
* }, { headers: { 'Authorization': 'Bearer ...' } });
|
|
206
|
+
* ```
|
|
207
|
+
*/
|
|
208
|
+
client: {
|
|
209
|
+
get(url: string, options?: HttpClientRequestOptions): Promise<unknown>;
|
|
210
|
+
post(url: string, body?: unknown, options?: HttpClientRequestOptions): Promise<unknown>;
|
|
211
|
+
put(url: string, body?: unknown, options?: HttpClientRequestOptions): Promise<unknown>;
|
|
212
|
+
patch(url: string, body?: unknown, options?: HttpClientRequestOptions): Promise<unknown>;
|
|
213
|
+
delete(url: string, options?: HttpClientRequestOptions): Promise<unknown>;
|
|
214
|
+
};
|
|
169
215
|
/**
|
|
170
216
|
* Update the theme mode for all mounted elements
|
|
171
217
|
*
|
|
@@ -314,6 +360,12 @@ export declare interface CardElementOptions {
|
|
|
314
360
|
disabled?: boolean;
|
|
315
361
|
/** Read-only state (applies to all 3 sub-fields) */
|
|
316
362
|
readOnly?: boolean;
|
|
363
|
+
/**
|
|
364
|
+
* Enter key label on mobile virtual keyboards. A single value applies to all 3
|
|
365
|
+
* sub-fields; an object sets each field independently (e.g. 'next' on card number
|
|
366
|
+
* and expiry, 'done' on cvv).
|
|
367
|
+
*/
|
|
368
|
+
enterKeyHint?: EnterKeyHint | CardEnterKeyHint;
|
|
317
369
|
/** Layout mode */
|
|
318
370
|
layout?: 'row' | 'column' | 'auto';
|
|
319
371
|
/** Stack threshold in pixels (only applies when layout: 'auto') */
|
|
@@ -337,6 +389,17 @@ export declare interface CardElementOptions {
|
|
|
337
389
|
};
|
|
338
390
|
}
|
|
339
391
|
|
|
392
|
+
/**
|
|
393
|
+
* Enter key label per card sub-field.
|
|
394
|
+
* `cvv` and `cvc` are interchangeable; `cvv` wins when both are set.
|
|
395
|
+
*/
|
|
396
|
+
export declare interface CardEnterKeyHint {
|
|
397
|
+
cardNumber?: EnterKeyHint;
|
|
398
|
+
expiryDate?: EnterKeyHint;
|
|
399
|
+
cvv?: EnterKeyHint;
|
|
400
|
+
cvc?: EnterKeyHint;
|
|
401
|
+
}
|
|
402
|
+
|
|
340
403
|
/**
|
|
341
404
|
* Card number specific change event detail
|
|
342
405
|
* Extends base with card brand detection metadata
|
|
@@ -439,6 +502,8 @@ export declare interface CopyEventDetail extends BaseEventDetail {
|
|
|
439
502
|
error?: string;
|
|
440
503
|
}
|
|
441
504
|
|
|
505
|
+
declare type Direction = 'ltr' | 'rtl';
|
|
506
|
+
|
|
442
507
|
declare interface Element_2 {
|
|
443
508
|
/**
|
|
444
509
|
* Unique identifier for the element
|
|
@@ -531,6 +596,13 @@ export declare interface ElementOptions {
|
|
|
531
596
|
* @default false
|
|
532
597
|
*/
|
|
533
598
|
readOnly?: boolean;
|
|
599
|
+
/**
|
|
600
|
+
* Action label rendered on the enter key of mobile virtual keyboards.
|
|
601
|
+
* Maps to the HTML `enterkeyhint` attribute.
|
|
602
|
+
* For card elements, an object sets each sub-field independently.
|
|
603
|
+
* @example 'next' to move between fields, 'done' to dismiss the keyboard
|
|
604
|
+
*/
|
|
605
|
+
enterKeyHint?: EnterKeyHint | CardEnterKeyHint;
|
|
534
606
|
/**
|
|
535
607
|
* RegExp pattern for validation
|
|
536
608
|
* Only applicable to text elements
|
|
@@ -662,6 +734,12 @@ export declare interface EncryptToken {
|
|
|
662
734
|
data: ElementInputObject;
|
|
663
735
|
}
|
|
664
736
|
|
|
737
|
+
/**
|
|
738
|
+
* Action label rendered on the enter key of mobile virtual keyboards
|
|
739
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/enterkeyhint
|
|
740
|
+
*/
|
|
741
|
+
export declare type EnterKeyHint = 'enter' | 'done' | 'go' | 'next' | 'previous' | 'search' | 'send';
|
|
742
|
+
|
|
665
743
|
/**
|
|
666
744
|
* Error codes
|
|
667
745
|
*/
|
|
@@ -710,6 +788,20 @@ declare interface FieldDisplayConfig {
|
|
|
710
788
|
export declare interface FocusEventDetail extends BaseEventDetail {
|
|
711
789
|
}
|
|
712
790
|
|
|
791
|
+
/**
|
|
792
|
+
* Options for a `bt.client.*` request to a third-party destination.
|
|
793
|
+
*
|
|
794
|
+
* `Content-Type` defaults to `application/json` and may be overridden — unlike
|
|
795
|
+
* the proxy, the caller owns serialization here, because Basis Theory doesn't
|
|
796
|
+
* know what the destination expects. Object bodies are serialized for JSON and
|
|
797
|
+
* `application/x-www-form-urlencoded`; for any other media type, pass a
|
|
798
|
+
* pre-serialized string body.
|
|
799
|
+
*/
|
|
800
|
+
declare interface HttpClientRequestOptions {
|
|
801
|
+
/** Headers sent to the destination. `Content-Type` defaults to application/json. */
|
|
802
|
+
headers?: Record<string, string>;
|
|
803
|
+
}
|
|
804
|
+
|
|
713
805
|
/**
|
|
714
806
|
* Fired when the selected payment network changes (co-badge)
|
|
715
807
|
*/
|
|
@@ -799,6 +891,23 @@ export declare interface SDKOptions {
|
|
|
799
891
|
* @example 'https://api-proxy.company.com/basistheory'
|
|
800
892
|
*/
|
|
801
893
|
apiBaseUrl?: string;
|
|
894
|
+
/**
|
|
895
|
+
* Pin API traffic to a named endpoint.
|
|
896
|
+
*
|
|
897
|
+
* - `'us'` → https://api.us.basistheory.com
|
|
898
|
+
* - `'eu'` → https://api.eu.basistheory.com
|
|
899
|
+
* - `'test'` → https://api.test.basistheory.com
|
|
900
|
+
*
|
|
901
|
+
* Opt-in. Left unset, the API URL resolves exactly as before, so an existing
|
|
902
|
+
* integration keeps its current behaviour until it asks for one.
|
|
903
|
+
*
|
|
904
|
+
* EU tenants should set this: the shared host depends on edge request processing
|
|
905
|
+
* to route regionally, while these hosts carry the destination in the name. An
|
|
906
|
+
* explicit `apiBaseUrl` still wins over it.
|
|
907
|
+
*
|
|
908
|
+
* @example 'eu'
|
|
909
|
+
*/
|
|
910
|
+
environment?: ApiEnvironment;
|
|
802
911
|
/**
|
|
803
912
|
* Enable debug logging
|
|
804
913
|
* @default false
|
|
@@ -816,6 +925,21 @@ export declare interface SDKOptions {
|
|
|
816
925
|
* @default false
|
|
817
926
|
*/
|
|
818
927
|
allowClipboard?: boolean;
|
|
928
|
+
/**
|
|
929
|
+
* Allow `bt.client.*` to send element values to a third-party destination
|
|
930
|
+
* (dual writing).
|
|
931
|
+
*
|
|
932
|
+
* The coordinator freezes this at initialization and refuses every
|
|
933
|
+
* `bt.client.*` call unless it was enabled here, so a script that gains
|
|
934
|
+
* execution on the page later can't turn dual writing on. That is the only
|
|
935
|
+
* per-integration control on this feature — the destination allowlist itself
|
|
936
|
+
* is a single build-time list shared by every tenant.
|
|
937
|
+
*
|
|
938
|
+
* Sending card data to a third party, and receiving that third party's
|
|
939
|
+
* response in page context, may affect PCI scope.
|
|
940
|
+
* @default false
|
|
941
|
+
*/
|
|
942
|
+
allowHttpClient?: boolean;
|
|
819
943
|
/**
|
|
820
944
|
* Enable performance monitoring (bundle size, load times, compression metrics)
|
|
821
945
|
* When enabled, automatically measures and logs performance after elements load
|
|
@@ -841,6 +965,17 @@ export declare interface SDKOptions {
|
|
|
841
965
|
* @default 'auto'
|
|
842
966
|
*/
|
|
843
967
|
themeMode?: ThemeMode;
|
|
968
|
+
/**
|
|
969
|
+
* Text direction applied to every element iframe
|
|
970
|
+
* 'rtl' renders inputs, placeholders and the card brand picker right-to-left
|
|
971
|
+
* @default 'ltr'
|
|
972
|
+
*/
|
|
973
|
+
direction?: Direction;
|
|
974
|
+
/**
|
|
975
|
+
* BCP 47 language tag applied to every element iframe, e.g. 'ar' or 'he'
|
|
976
|
+
* Lets assistive technology announce placeholder and label text correctly
|
|
977
|
+
*/
|
|
978
|
+
language?: string;
|
|
844
979
|
/**
|
|
845
980
|
* Theme configuration (design tokens)
|
|
846
981
|
* CSS variables will be injected into element iframes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var BasisTheoryLoader=(function(L){"use strict";const F=[/cardnumber/i,/^pan$/i,/accountnumber/i,/^number$/i],
|
|
1
|
+
var BasisTheoryLoader=(function(L){"use strict";const F=[/cardnumber/i,/^pan$/i,/accountnumber/i,/^number$/i],M=[/cvv/i,/cvc/i,/cvv2/i,/securitycode/i,/pin/i,/password/i,/secret/i,/token/i,/ssn/i,/track/i,/session_key/i,/^apikey$/i],$=e=>F.some(t=>t.test(e)),x=e=>M.some(t=>t.test(e)),D=e=>{const t=e.replace(/\D/g,"");if(t.length<10)return"***";const i=t.substring(0,6),n=t.substring(t.length-4),u=Math.max(t.length-10,6),f="*".repeat(u);return`${i}${f}${n}`},v=e=>{const t=e.replace(/[\s-]/g,"");return/^\d{13,19}$/.test(t)},N=(e,t)=>t==null?t:typeof t=="function"?"[Function]":typeof t=="symbol"?"[Symbol]":t instanceof RegExp?"[RegExp]":t instanceof Date?t:$(e)?typeof t=="string"?D(t):"***":x(e)?"***":typeof t=="string"&&v(t)?D(t):t,E=(e,t=0,i=new WeakSet)=>{if(t>=5)return"[Max Depth]";if(e==null)return e;if(typeof e=="string")return v(e)?D(e):e;if(typeof e!="object")return e;if(e instanceof RegExp)return"[RegExp]";if(e instanceof Date)return e;if(i.has(e))return"[Circular]";i.add(e);let n;if(Array.isArray(e))n=e.map(u=>E(u,t+1,i));else{const u={};for(const[f,h]of Object.entries(e)){const y=N(f,h);y!==null&&typeof y=="object"?u[f]=E(y,t+1,i):u[f]=y}n=u}return i.delete(e),n},V=e=>{const t={};for(const[i,n]of Object.entries(e))if($(i)||x(i)){const u=typeof n=="string"?n.length:typeof n=="number"?String(n).length:0;t[`${i}_length`]=u}else t[i]=E(n);return t},q=()=>{const e=new Date,t=String(e.getHours()).padStart(2,"0"),i=String(e.getMinutes()).padStart(2,"0"),n=String(e.getSeconds()).padStart(2,"0"),u=String(e.getMilliseconds()).padStart(3,"0");return`${t}:${i}:${n}.${u}`},P=(e,t)=>t?(i,n)=>{const u=q(),f=n?V(n):{};console.log(`🔍 [${u}] [${e}] ${i}`,f)}:()=>{},j=(e,t,i)=>{const n=new Error(t);return n.name="BasisTheoryError",n.code=e,n.details=i,Error.captureStackTrace&&Error.captureStackTrace(n,j),n.toJSON=()=>({name:n.name,code:n.code,message:n.message,...n.details&&{details:n.details}}),n},I=(e,t)=>{const i=j("CONFIGURATION_ERROR",e,t);return i.name="ConfigurationError",i},C=new Set(["host","content-length","transfer-encoding","te","trailer","connection","upgrade","keep-alive","proxy-connection","via","proxy-authorization","bt-api-key","bt-proxy-key","bt-proxy-url","bt-idempotency-key","x-forwarded-for","x-forwarded-host","x-real-ip","content-type"]);new Set([...C].filter(e=>e!=="content-type"));const H=()=>{if(typeof document>"u")return;const e=document.currentScript;if(e?.src)try{const t=new URL(e.src).origin;if(t.startsWith("https"))return t}catch{}},K=(e,t)=>{if(!e)return t;try{const i=new URL(t);return`${e}${i.pathname}`}catch{return t}},Q=(e,t)=>{if(e)try{const i=new URL(t),{pathname:n}=i,u=n.replace(/\/web-elements\/basis-theory-sdk\.umd\.js$/,"/elements");return u===n?void 0:`${e}${u}`}catch{return}};function A(e){const{version:t="loader-0.1.0",onSdkReady:i,debug:n=!1,sdkSriHash:u=""}=e,f=P("BasisTheoryLoader",n),h=[];let y=null,d=!1,o=null,b=null,k=null,R=!1,S=e.sdkUrl;function W(){return y||(y=new Promise((l,c)=>{if(k=c,window.__BasisTheorySDK__){f("SDK already loaded, skipping script injection"),k=null,d=!0,l(),i?.();return}const m=document.createElement("script");m.src=S,m.async=!0,m.crossOrigin="anonymous",b=m,u&&(m.integrity=u),m.onload=()=>{b===m&&(k=null,d=!0,l(),i?.())},m.onerror=()=>{b===m&&(k=null,y=null,c(new Error(`Failed to load BasisTheory SDK from ${S}`)))},document.head.appendChild(m)}),y)}function X(){if(h.length===0)return[];f("Transforming queued commands for SDK",{count:h.length});const l=[];for(const c of h)c.type==="init"||c.type==="createElement"||l.push({method:c.type,args:c.args||[],resolve:()=>{},reject:m=>{console.error("[BasisTheory] Queued command failed:",c.type,m)}});return l}async function g(l,c){if(R)throw I("SDK instance has been destroyed. Create a new instance with BasisTheory()");if(o)return o;if(await y,!o){const m=X();f("Initializing SDK with queued commands",{queueLength:m.length});const r=window.__BasisTheorySDK__;if(!r||typeof r!="function")throw I("BasisTheory SDK not found at window.__BasisTheorySDK__");f("Found SDK function",{type:typeof r}),o=r(l,c,m),h.length=0}return o}const B=function(l,c){return R=!1,e.whitelabelElementsBaseUrl&&!c?.elementsBaseUrl&&(c={...c,elementsBaseUrl:e.whitelabelElementsBaseUrl},n&&console.log("[BasisTheory] Whitelabel elementsBaseUrl injected:",e.whitelabelElementsBaseUrl)),h.push({type:"init",apiKey:l,options:c,timestamp:Date.now()}),c?.elementsBaseUrl&&!y&&(S=`${c.elementsBaseUrl.replace(/\/elements\/?$/,"")}/web-elements/basis-theory-sdk.umd.js`,f("Derived SDK URL from elementsBaseUrl",{sdkUrl:S})),W(),{createElement(r,a){if(d&&o)return o.createElement(r,a);h.push({type:"createElement",args:[r,a],timestamp:Date.now()});let s=null;const w=[],z={get id(){return s?.id},get type(){return s?.type},get mounted(){return s?.mounted??!1},mount:async p=>(s=(await g(l,c)).createElement(r,a),w.forEach(({event:_,handler:Y})=>{s.on(_,Y)}),w.length=0,await s.mount(p)),on:(p,T)=>s?s.on(p,T):(w.push({event:p,handler:T}),()=>{const U=w.findIndex(_=>_.event===p&&_.handler===T);U!==-1&&w.splice(U,1)}),update:async(...p)=>{if(s)return s.update(...p)},unmount:()=>{s&&s.unmount()},focus:()=>{s&&s.focus()},blur:()=>{s&&s.blur()},clear:()=>{s&&s.clear()},setValueRef:async p=>{if(s?.setValueRef)return s.setValueRef(p);throw new Error("Element must be mounted before calling setValueRef")}};return r==="card"&&Object.defineProperties(z,{number:{get:()=>s?.number,enumerable:!0},expiryDate:{get:()=>s?.expiryDate,enumerable:!0},cvc:{get:()=>s?.cvc,enumerable:!0}}),z},async tokenize(r,a){return d&&o?o.tokenize(r,a):(await g(l,c)).tokenize(r,a)},updateThemeMode(r){if(d&&o)return o.updateThemeMode(r);h.push({type:"updateThemeMode",args:[r],timestamp:Date.now()})},async destroy(){f("Destroying loader / SDK instance",{sdkReady:d,hasInstance:!!o});const r=o&&typeof o.destroy=="function"?o.destroy():void 0;k&&(k(new Error("BasisTheory SDK destroyed before load completed")),k=null),b&&(b.remove(),b=null),o=null,d=!1,y=null,h.length=0,R=!0,S=e.sdkUrl,typeof window<"u"&&window.BasisTheory&&(window.BasisTheory.__sdkReady=!1);try{await r}catch(a){f("SDK destroy failed",{error:a.message})}},tokens:{async create(r){return d&&o?o.tokens.create(r):(await g(l,c)).tokens.create(r)},async retrieve(r,a){return d&&o?o.tokens.retrieve(r,a):(await g(l,c)).tokens.retrieve(r,a)},async update(r,a){return d&&o?o.tokens.update(r,a):(await g(l,c)).tokens.update(r,a)},async encrypt(r,a,s){return d&&o?o.tokens.encrypt(r,a,s):(await g(l,c)).tokens.encrypt(r,a,s)}},sessions:{async create(){return d&&o?o.sessions.create():(await g(l,c)).sessions.create()}},tokenIntents:{async create(r,a){return d&&o?o.tokenIntents.create(r,a):(await g(l,c)).tokenIntents.create(r,a)},async get(r,a){return d&&o?o.tokenIntents.get(r,a):(await g(l,c)).tokenIntents.get(r,a)}},proxy:(()=>{const r=a=>async s=>d&&o?o.proxy[a](s):(await g(l,c)).proxy[a](s);return{get:r("get"),post:r("post"),put:r("put"),patch:r("patch"),delete:r("delete")}})(),client:(()=>{const r=a=>async(...s)=>d&&o?o.client[a](...s):(await g(l,c)).client[a](...s);return{get:r("get"),post:r("post"),put:r("put"),patch:r("patch"),delete:r("delete")}})(),__queue:h,__loaderVersion:t}};return B.__sdkUrl=S,B.__version=t,Object.defineProperty(B,"__pending",{get(){return d?0:h.filter(l=>l.type==="init").length}}),B}if(typeof window<"u"){const e=typeof localStorage<"u"&&localStorage.getItem("bt_debug")==="true",t=P("BasisTheoryLoader",e),i=H(),n=K(i,"https://js.basistheory.com/3.1.0/web-elements/basis-theory-sdk.umd.js"),u=(()=>{try{return new URL(n).origin!==new URL("https://js.basistheory.com/3.1.0/web-elements/basis-theory-sdk.umd.js").origin}catch{return!1}})();u&&t("[BasisTheory] Whitelabel origin detected:",{detectedOrigin:i});const h={sdkUrl:n,version:"loader-0.1.0",debug:e,sdkSriHash:u?"":"sha384-qVS6X5Y++2LbqcB14/UOIoCxBek3DpZ97+ifgvbM9FahnCsxUVQPALWIcQEs9KP/",whitelabelElementsBaseUrl:Q(u?i:void 0,"https://js.basistheory.com/3.1.0/web-elements/basis-theory-sdk.umd.js"),onSdkReady:()=>{window.BasisTheory.__sdkReady=!0,t("SDK loaded and ready")}},y=A(h);window.BasisTheory=y,window.BasisTheory.__loaderLoadTime=Date.now(),window.BasisTheory.__sdkReady=!1,t("SDK available at window.BasisTheory")}return L.createLoader=A,L})({});
|
package/dist/sri.json
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": "1.0",
|
|
3
3
|
"versions": {
|
|
4
|
-
"3.
|
|
4
|
+
"3.1.0": {
|
|
5
5
|
"umd": {
|
|
6
|
-
"hash": "sha384-
|
|
7
|
-
"url": "https://js.basistheory.com/3.
|
|
8
|
-
"size":
|
|
6
|
+
"hash": "sha384-qVS6X5Y++2LbqcB14/UOIoCxBek3DpZ97+ifgvbM9FahnCsxUVQPALWIcQEs9KP/",
|
|
7
|
+
"url": "https://js.basistheory.com/3.1.0/web-elements/basis-theory-sdk.umd.js",
|
|
8
|
+
"size": 60076
|
|
9
9
|
},
|
|
10
10
|
"es": {
|
|
11
|
-
"hash": "sha384-
|
|
12
|
-
"url": "https://js.basistheory.com/3.
|
|
11
|
+
"hash": "sha384-y7CYZdfL9lUREe/71T7QgyUPDvma8ckOcCrREIucXClAuzDuGL6pKzra//byneks",
|
|
12
|
+
"url": "https://js.basistheory.com/3.1.0/web-elements/basis-theory-sdk.es.js",
|
|
13
13
|
"size": 108
|
|
14
14
|
},
|
|
15
15
|
"loader": {
|
|
16
|
-
"hash": "sha384-
|
|
17
|
-
"url": "https://js.basistheory.com/3.
|
|
18
|
-
"size":
|
|
16
|
+
"hash": "sha384-VhpBFd7Y60uXrzHyzv05i6B5v3KwAWRbZM2pYsf54Xv/qZtWj19MO3pMtYwdC/Mn",
|
|
17
|
+
"url": "https://js.basistheory.com/3.1.0/web-elements/basis-theory.js",
|
|
18
|
+
"size": 8245
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
}
|
package/dist/stats.html
CHANGED
|
@@ -4929,7 +4929,7 @@ var drawChart = (function (exports) {
|
|
|
4929
4929
|
</script>
|
|
4930
4930
|
<script>
|
|
4931
4931
|
/*<!--*/
|
|
4932
|
-
const data = {"version":2,"tree":{"name":"root","children":[{"name":"basis-theory-sdk.umd.js","children":[{"name":"home/runner/work/basistheory-elements/basistheory-elements/packages","children":[{"name":"shared/dist","children":[{"uid":"40641b98-1","name":"deep-sanitization.js"},{"uid":"40641b98-3","name":"debug-logger.js"},{"uid":"40641b98-5","name":"generate-id.js"},{"uid":"40641b98-7","name":"logger-context.js"},{"uid":"40641b98-9","name":"errors.js"},{"uid":"40641b98-11","name":"proxy-validation.js"}]},{"name":"postmessage/dist/client.js","uid":"40641b98-13"}]},{"name":"src","children":[{"name":"mounter/create-mounter.ts","uid":"40641b98-15"},{"name":"utils","children":[{"uid":"40641b98-17","name":"bind-coordinator-port.ts"},{"uid":"40641b98-19","name":"create-iframe.ts"},{"uid":"40641b98-21","name":"create-event-dispatcher.ts"},{"uid":"40641b98-31","name":"resolve-element-references.ts"},{"uid":"40641b98-35","name":"warn-unknown-keys.ts"},{"uid":"40641b98-37","name":"validate-sdk-config.ts"},{"uid":"40641b98-39","name":"validate-element-options.ts"}]},{"name":"elements","children":[{"uid":"40641b98-23","name":"create-card-number.ts"},{"uid":"40641b98-25","name":"create-cvv.ts"},{"uid":"40641b98-27","name":"create-expiry.ts"},{"uid":"40641b98-29","name":"create-text.ts"},{"uid":"40641b98-47","name":"create-card.ts"},{"uid":"40641b98-49","name":"create-copy-button.ts"},{"uid":"40641b98-51","name":"create-card-display.ts"}]},{"name":"theme/default-theme.ts","uid":"40641b98-33"},{"uid":"40641b98-41","name":"BasisTheory.ts"},{"uid":"40641b98-43","name":"version.ts"},{"uid":"40641b98-45","name":"index.ts"}]}]}],"isRoot":true},"nodeParts":{"40641b98-1":{"renderedLength":5897,"gzipLength":1806,"brotliLength":1558,"metaUid":"40641b98-0"},"40641b98-3":{"renderedLength":2608,"gzipLength":1059,"brotliLength":903,"metaUid":"40641b98-2"},"40641b98-5":{"renderedLength":1334,"gzipLength":645,"brotliLength":531,"metaUid":"40641b98-4"},"40641b98-7":{"renderedLength":341,"gzipLength":224,"brotliLength":152,"metaUid":"40641b98-6"},"40641b98-9":{"renderedLength":2628,"gzipLength":748,"brotliLength":641,"metaUid":"40641b98-8"},"40641b98-11":{"renderedLength":14643,"gzipLength":4140,"brotliLength":3559,"metaUid":"40641b98-10"},"40641b98-13":{"renderedLength":12970,"gzipLength":3468,"brotliLength":2933,"metaUid":"40641b98-12"},"40641b98-15":{"renderedLength":484,"gzipLength":223,"brotliLength":164,"metaUid":"40641b98-14"},"40641b98-17":{"renderedLength":1590,"gzipLength":525,"brotliLength":435,"metaUid":"40641b98-16"},"40641b98-19":{"renderedLength":389,"gzipLength":200,"brotliLength":148,"metaUid":"40641b98-18"},"40641b98-21":{"renderedLength":3268,"gzipLength":837,"brotliLength":700,"metaUid":"40641b98-20"},"40641b98-23":{"renderedLength":8028,"gzipLength":1907,"brotliLength":1639,"metaUid":"40641b98-22"},"40641b98-25":{"renderedLength":7008,"gzipLength":1755,"brotliLength":1506,"metaUid":"40641b98-24"},"40641b98-27":{"renderedLength":6807,"gzipLength":1674,"brotliLength":1434,"metaUid":"40641b98-26"},"40641b98-29":{"renderedLength":8288,"gzipLength":2077,"brotliLength":1774,"metaUid":"40641b98-28"},"40641b98-31":{"renderedLength":1131,"gzipLength":439,"brotliLength":360,"metaUid":"40641b98-30"},"40641b98-33":{"renderedLength":4104,"gzipLength":1062,"brotliLength":915,"metaUid":"40641b98-32"},"40641b98-35":{"renderedLength":590,"gzipLength":285,"brotliLength":255,"metaUid":"40641b98-34"},"40641b98-37":{"renderedLength":5953,"gzipLength":1405,"brotliLength":1235,"metaUid":"40641b98-36"},"40641b98-39":{"renderedLength":4864,"gzipLength":1199,"brotliLength":1016,"metaUid":"40641b98-38"},"40641b98-41":{"renderedLength":32632,"gzipLength":6419,"brotliLength":5567,"metaUid":"40641b98-40"},"40641b98-43":{"renderedLength":78,"gzipLength":88,"brotliLength":82,"metaUid":"40641b98-42"},"40641b98-45":{"renderedLength":93,"gzipLength":93,"brotliLength":75,"metaUid":"40641b98-44"},"40641b98-47":{"renderedLength":9605,"gzipLength":2183,"brotliLength":1878,"metaUid":"40641b98-46"},"40641b98-49":{"renderedLength":9209,"gzipLength":2366,"brotliLength":2004,"metaUid":"40641b98-48"},"40641b98-51":{"renderedLength":10072,"gzipLength":2565,"brotliLength":2181,"metaUid":"40641b98-50"}},"nodeMetas":{"40641b98-0":{"id":"/home/runner/work/basistheory-elements/basistheory-elements/packages/shared/dist/deep-sanitization.js","moduleParts":{"basis-theory-sdk.umd.js":"40641b98-1"},"imported":[],"importedBy":[{"uid":"40641b98-53"},{"uid":"40641b98-2"}]},"40641b98-2":{"id":"/home/runner/work/basistheory-elements/basistheory-elements/packages/shared/dist/debug-logger.js","moduleParts":{"basis-theory-sdk.umd.js":"40641b98-3"},"imported":[{"uid":"40641b98-0"}],"importedBy":[{"uid":"40641b98-53"},{"uid":"40641b98-6"}]},"40641b98-4":{"id":"/home/runner/work/basistheory-elements/basistheory-elements/packages/shared/dist/generate-id.js","moduleParts":{"basis-theory-sdk.umd.js":"40641b98-5"},"imported":[],"importedBy":[{"uid":"40641b98-53"}]},"40641b98-6":{"id":"/home/runner/work/basistheory-elements/basistheory-elements/packages/shared/dist/logger-context.js","moduleParts":{"basis-theory-sdk.umd.js":"40641b98-7"},"imported":[{"uid":"40641b98-2"}],"importedBy":[{"uid":"40641b98-53"}]},"40641b98-8":{"id":"/home/runner/work/basistheory-elements/basistheory-elements/packages/shared/dist/errors.js","moduleParts":{"basis-theory-sdk.umd.js":"40641b98-9"},"imported":[],"importedBy":[{"uid":"40641b98-53"},{"uid":"40641b98-10"}]},"40641b98-10":{"id":"/home/runner/work/basistheory-elements/basistheory-elements/packages/shared/dist/proxy-validation.js","moduleParts":{"basis-theory-sdk.umd.js":"40641b98-11"},"imported":[{"uid":"40641b98-8"}],"importedBy":[{"uid":"40641b98-53"}]},"40641b98-12":{"id":"/home/runner/work/basistheory-elements/basistheory-elements/packages/postmessage/dist/client.js","moduleParts":{"basis-theory-sdk.umd.js":"40641b98-13"},"imported":[{"uid":"40641b98-53"}],"importedBy":[{"uid":"40641b98-52"}]},"40641b98-14":{"id":"/src/mounter/create-mounter.ts","moduleParts":{"basis-theory-sdk.umd.js":"40641b98-15"},"imported":[],"importedBy":[{"uid":"40641b98-22"},{"uid":"40641b98-24"},{"uid":"40641b98-26"},{"uid":"40641b98-28"},{"uid":"40641b98-46"},{"uid":"40641b98-48"},{"uid":"40641b98-50"}]},"40641b98-16":{"id":"/src/utils/bind-coordinator-port.ts","moduleParts":{"basis-theory-sdk.umd.js":"40641b98-17"},"imported":[{"uid":"40641b98-53"}],"importedBy":[{"uid":"40641b98-22"},{"uid":"40641b98-24"},{"uid":"40641b98-26"},{"uid":"40641b98-28"},{"uid":"40641b98-46"},{"uid":"40641b98-48"},{"uid":"40641b98-50"}]},"40641b98-18":{"id":"/src/utils/create-iframe.ts","moduleParts":{"basis-theory-sdk.umd.js":"40641b98-19"},"imported":[],"importedBy":[{"uid":"40641b98-22"},{"uid":"40641b98-24"},{"uid":"40641b98-26"},{"uid":"40641b98-28"},{"uid":"40641b98-46"},{"uid":"40641b98-48"},{"uid":"40641b98-50"}]},"40641b98-20":{"id":"/src/utils/create-event-dispatcher.ts","moduleParts":{"basis-theory-sdk.umd.js":"40641b98-21"},"imported":[],"importedBy":[{"uid":"40641b98-22"},{"uid":"40641b98-24"},{"uid":"40641b98-26"},{"uid":"40641b98-28"},{"uid":"40641b98-46"},{"uid":"40641b98-48"}]},"40641b98-22":{"id":"/src/elements/create-card-number.ts","moduleParts":{"basis-theory-sdk.umd.js":"40641b98-23"},"imported":[{"uid":"40641b98-52"},{"uid":"40641b98-53"},{"uid":"40641b98-14"},{"uid":"40641b98-16"},{"uid":"40641b98-18"},{"uid":"40641b98-20"}],"importedBy":[{"uid":"40641b98-40"}]},"40641b98-24":{"id":"/src/elements/create-cvv.ts","moduleParts":{"basis-theory-sdk.umd.js":"40641b98-25"},"imported":[{"uid":"40641b98-52"},{"uid":"40641b98-53"},{"uid":"40641b98-14"},{"uid":"40641b98-16"},{"uid":"40641b98-18"},{"uid":"40641b98-20"}],"importedBy":[{"uid":"40641b98-40"}]},"40641b98-26":{"id":"/src/elements/create-expiry.ts","moduleParts":{"basis-theory-sdk.umd.js":"40641b98-27"},"imported":[{"uid":"40641b98-52"},{"uid":"40641b98-53"},{"uid":"40641b98-14"},{"uid":"40641b98-16"},{"uid":"40641b98-18"},{"uid":"40641b98-20"}],"importedBy":[{"uid":"40641b98-40"}]},"40641b98-28":{"id":"/src/elements/create-text.ts","moduleParts":{"basis-theory-sdk.umd.js":"40641b98-29"},"imported":[{"uid":"40641b98-52"},{"uid":"40641b98-53"},{"uid":"40641b98-14"},{"uid":"40641b98-16"},{"uid":"40641b98-18"},{"uid":"40641b98-20"}],"importedBy":[{"uid":"40641b98-40"}]},"40641b98-30":{"id":"/src/utils/resolve-element-references.ts","moduleParts":{"basis-theory-sdk.umd.js":"40641b98-31"},"imported":[{"uid":"40641b98-53"}],"importedBy":[{"uid":"40641b98-40"}]},"40641b98-32":{"id":"/src/theme/default-theme.ts","moduleParts":{"basis-theory-sdk.umd.js":"40641b98-33"},"imported":[],"importedBy":[{"uid":"40641b98-36"}]},"40641b98-34":{"id":"/src/utils/warn-unknown-keys.ts","moduleParts":{"basis-theory-sdk.umd.js":"40641b98-35"},"imported":[],"importedBy":[{"uid":"40641b98-36"},{"uid":"40641b98-38"}]},"40641b98-36":{"id":"/src/utils/validate-sdk-config.ts","moduleParts":{"basis-theory-sdk.umd.js":"40641b98-37"},"imported":[{"uid":"40641b98-53"},{"uid":"40641b98-32"},{"uid":"40641b98-34"}],"importedBy":[{"uid":"40641b98-40"}]},"40641b98-38":{"id":"/src/utils/validate-element-options.ts","moduleParts":{"basis-theory-sdk.umd.js":"40641b98-39"},"imported":[{"uid":"40641b98-53"},{"uid":"40641b98-34"}],"importedBy":[{"uid":"40641b98-40"}]},"40641b98-40":{"id":"/src/BasisTheory.ts","moduleParts":{"basis-theory-sdk.umd.js":"40641b98-41"},"imported":[{"uid":"40641b98-52"},{"uid":"40641b98-53"},{"uid":"40641b98-22"},{"uid":"40641b98-24"},{"uid":"40641b98-26"},{"uid":"40641b98-28"},{"uid":"40641b98-30"},{"uid":"40641b98-36"},{"uid":"40641b98-38"},{"uid":"40641b98-46","dynamic":true},{"uid":"40641b98-48","dynamic":true},{"uid":"40641b98-50","dynamic":true}],"importedBy":[{"uid":"40641b98-44"}]},"40641b98-42":{"id":"/src/version.ts","moduleParts":{"basis-theory-sdk.umd.js":"40641b98-43"},"imported":[],"importedBy":[{"uid":"40641b98-44"}]},"40641b98-44":{"id":"/src/index.ts","moduleParts":{"basis-theory-sdk.umd.js":"40641b98-45"},"imported":[{"uid":"40641b98-40"},{"uid":"40641b98-42"}],"importedBy":[],"isEntry":true},"40641b98-46":{"id":"/src/elements/create-card.ts","moduleParts":{"basis-theory-sdk.umd.js":"40641b98-47"},"imported":[{"uid":"40641b98-52"},{"uid":"40641b98-53"},{"uid":"40641b98-14"},{"uid":"40641b98-16"},{"uid":"40641b98-18"},{"uid":"40641b98-20"}],"importedBy":[{"uid":"40641b98-40"}]},"40641b98-48":{"id":"/src/elements/create-copy-button.ts","moduleParts":{"basis-theory-sdk.umd.js":"40641b98-49"},"imported":[{"uid":"40641b98-52"},{"uid":"40641b98-53"},{"uid":"40641b98-14"},{"uid":"40641b98-16"},{"uid":"40641b98-18"},{"uid":"40641b98-20"}],"importedBy":[{"uid":"40641b98-40"}]},"40641b98-50":{"id":"/src/elements/create-card-display.ts","moduleParts":{"basis-theory-sdk.umd.js":"40641b98-51"},"imported":[{"uid":"40641b98-52"},{"uid":"40641b98-53"},{"uid":"40641b98-14"},{"uid":"40641b98-16"},{"uid":"40641b98-18"}],"importedBy":[{"uid":"40641b98-40"}]},"40641b98-52":{"id":"/home/runner/work/basistheory-elements/basistheory-elements/packages/postmessage/dist/index.js","moduleParts":{},"imported":[{"uid":"40641b98-12"},{"uid":"40641b98-54"},{"uid":"40641b98-55"},{"uid":"40641b98-56"}],"importedBy":[{"uid":"40641b98-40"},{"uid":"40641b98-22"},{"uid":"40641b98-24"},{"uid":"40641b98-26"},{"uid":"40641b98-28"},{"uid":"40641b98-46"},{"uid":"40641b98-48"},{"uid":"40641b98-50"}]},"40641b98-53":{"id":"/home/runner/work/basistheory-elements/basistheory-elements/packages/shared/dist/index.js","moduleParts":{},"imported":[{"uid":"40641b98-2"},{"uid":"40641b98-0"},{"uid":"40641b98-57"},{"uid":"40641b98-4"},{"uid":"40641b98-6"},{"uid":"40641b98-8"},{"uid":"40641b98-10"}],"importedBy":[{"uid":"40641b98-40"},{"uid":"40641b98-22"},{"uid":"40641b98-24"},{"uid":"40641b98-26"},{"uid":"40641b98-28"},{"uid":"40641b98-30"},{"uid":"40641b98-36"},{"uid":"40641b98-38"},{"uid":"40641b98-46"},{"uid":"40641b98-48"},{"uid":"40641b98-50"},{"uid":"40641b98-12"},{"uid":"40641b98-54"},{"uid":"40641b98-16"}]},"40641b98-54":{"id":"/home/runner/work/basistheory-elements/basistheory-elements/packages/postmessage/dist/server.js","moduleParts":{},"imported":[{"uid":"40641b98-53"}],"importedBy":[{"uid":"40641b98-52"}]},"40641b98-55":{"id":"/home/runner/work/basistheory-elements/basistheory-elements/packages/postmessage/dist/types.js","moduleParts":{},"imported":[],"importedBy":[{"uid":"40641b98-52"}]},"40641b98-56":{"id":"/home/runner/work/basistheory-elements/basistheory-elements/packages/postmessage/dist/event-map.js","moduleParts":{},"imported":[],"importedBy":[{"uid":"40641b98-52"}]},"40641b98-57":{"id":"/home/runner/work/basistheory-elements/basistheory-elements/packages/shared/dist/api-url-resolver.js","moduleParts":{},"imported":[],"importedBy":[{"uid":"40641b98-53"}]}},"env":{"rollup":"4.62.2"},"options":{"gzip":true,"brotli":true,"sourcemap":false}};
|
|
4932
|
+
const data = {"version":2,"tree":{"name":"root","children":[{"name":"basis-theory-sdk.umd.js","children":[{"name":"home/runner/work/basistheory-elements/basistheory-elements/packages","children":[{"name":"shared/dist","children":[{"uid":"7c1ccaf0-1","name":"deep-sanitization.js"},{"uid":"7c1ccaf0-3","name":"debug-logger.js"},{"uid":"7c1ccaf0-5","name":"generate-id.js"},{"uid":"7c1ccaf0-7","name":"language-tag.js"},{"uid":"7c1ccaf0-9","name":"logger-context.js"},{"uid":"7c1ccaf0-11","name":"errors.js"},{"uid":"7c1ccaf0-13","name":"proxy-validation.js"}]},{"name":"postmessage/dist/client.js","uid":"7c1ccaf0-15"}]},{"name":"src","children":[{"name":"mounter/create-mounter.ts","uid":"7c1ccaf0-17"},{"name":"utils","children":[{"uid":"7c1ccaf0-19","name":"bind-coordinator-port.ts"},{"uid":"7c1ccaf0-21","name":"create-iframe.ts"},{"uid":"7c1ccaf0-23","name":"create-event-dispatcher.ts"},{"uid":"7c1ccaf0-33","name":"resolve-element-references.ts"},{"uid":"7c1ccaf0-37","name":"warn-unknown-keys.ts"},{"uid":"7c1ccaf0-39","name":"validate-sdk-config.ts"},{"uid":"7c1ccaf0-41","name":"validate-element-options.ts"}]},{"name":"elements","children":[{"uid":"7c1ccaf0-25","name":"create-card-number.ts"},{"uid":"7c1ccaf0-27","name":"create-cvv.ts"},{"uid":"7c1ccaf0-29","name":"create-expiry.ts"},{"uid":"7c1ccaf0-31","name":"create-text.ts"},{"uid":"7c1ccaf0-49","name":"create-card.ts"},{"uid":"7c1ccaf0-51","name":"create-copy-button.ts"},{"uid":"7c1ccaf0-53","name":"create-card-display.ts"}]},{"name":"theme/default-theme.ts","uid":"7c1ccaf0-35"},{"uid":"7c1ccaf0-43","name":"BasisTheory.ts"},{"uid":"7c1ccaf0-45","name":"version.ts"},{"uid":"7c1ccaf0-47","name":"index.ts"}]}]}],"isRoot":true},"nodeParts":{"7c1ccaf0-1":{"renderedLength":5897,"gzipLength":1806,"brotliLength":1558,"metaUid":"7c1ccaf0-0"},"7c1ccaf0-3":{"renderedLength":2608,"gzipLength":1059,"brotliLength":903,"metaUid":"7c1ccaf0-2"},"7c1ccaf0-5":{"renderedLength":1334,"gzipLength":645,"brotliLength":531,"metaUid":"7c1ccaf0-4"},"7c1ccaf0-7":{"renderedLength":554,"gzipLength":361,"brotliLength":288,"metaUid":"7c1ccaf0-6"},"7c1ccaf0-9":{"renderedLength":341,"gzipLength":224,"brotliLength":152,"metaUid":"7c1ccaf0-8"},"7c1ccaf0-11":{"renderedLength":3395,"gzipLength":1008,"brotliLength":836,"metaUid":"7c1ccaf0-10"},"7c1ccaf0-13":{"renderedLength":16982,"gzipLength":4530,"brotliLength":3898,"metaUid":"7c1ccaf0-12"},"7c1ccaf0-15":{"renderedLength":13131,"gzipLength":3496,"brotliLength":2956,"metaUid":"7c1ccaf0-14"},"7c1ccaf0-17":{"renderedLength":484,"gzipLength":223,"brotliLength":164,"metaUid":"7c1ccaf0-16"},"7c1ccaf0-19":{"renderedLength":1590,"gzipLength":525,"brotliLength":435,"metaUid":"7c1ccaf0-18"},"7c1ccaf0-21":{"renderedLength":389,"gzipLength":200,"brotliLength":148,"metaUid":"7c1ccaf0-20"},"7c1ccaf0-23":{"renderedLength":3268,"gzipLength":837,"brotliLength":700,"metaUid":"7c1ccaf0-22"},"7c1ccaf0-25":{"renderedLength":8342,"gzipLength":1974,"brotliLength":1697,"metaUid":"7c1ccaf0-24"},"7c1ccaf0-27":{"renderedLength":7472,"gzipLength":1904,"brotliLength":1618,"metaUid":"7c1ccaf0-26"},"7c1ccaf0-29":{"renderedLength":7271,"gzipLength":1822,"brotliLength":1549,"metaUid":"7c1ccaf0-28"},"7c1ccaf0-31":{"renderedLength":8752,"gzipLength":2223,"brotliLength":1885,"metaUid":"7c1ccaf0-30"},"7c1ccaf0-33":{"renderedLength":1131,"gzipLength":439,"brotliLength":360,"metaUid":"7c1ccaf0-32"},"7c1ccaf0-35":{"renderedLength":4104,"gzipLength":1062,"brotliLength":915,"metaUid":"7c1ccaf0-34"},"7c1ccaf0-37":{"renderedLength":590,"gzipLength":285,"brotliLength":255,"metaUid":"7c1ccaf0-36"},"7c1ccaf0-39":{"renderedLength":7076,"gzipLength":1666,"brotliLength":1458,"metaUid":"7c1ccaf0-38"},"7c1ccaf0-41":{"renderedLength":6193,"gzipLength":1532,"brotliLength":1317,"metaUid":"7c1ccaf0-40"},"7c1ccaf0-43":{"renderedLength":35304,"gzipLength":6850,"brotliLength":5894,"metaUid":"7c1ccaf0-42"},"7c1ccaf0-45":{"renderedLength":78,"gzipLength":88,"brotliLength":75,"metaUid":"7c1ccaf0-44"},"7c1ccaf0-47":{"renderedLength":93,"gzipLength":93,"brotliLength":75,"metaUid":"7c1ccaf0-46"},"7c1ccaf0-49":{"renderedLength":9993,"gzipLength":2256,"brotliLength":1937,"metaUid":"7c1ccaf0-48"},"7c1ccaf0-51":{"renderedLength":9299,"gzipLength":2389,"brotliLength":2016,"metaUid":"7c1ccaf0-50"},"7c1ccaf0-53":{"renderedLength":10162,"gzipLength":2589,"brotliLength":2195,"metaUid":"7c1ccaf0-52"}},"nodeMetas":{"7c1ccaf0-0":{"id":"/home/runner/work/basistheory-elements/basistheory-elements/packages/shared/dist/deep-sanitization.js","moduleParts":{"basis-theory-sdk.umd.js":"7c1ccaf0-1"},"imported":[],"importedBy":[{"uid":"7c1ccaf0-55"},{"uid":"7c1ccaf0-2"}]},"7c1ccaf0-2":{"id":"/home/runner/work/basistheory-elements/basistheory-elements/packages/shared/dist/debug-logger.js","moduleParts":{"basis-theory-sdk.umd.js":"7c1ccaf0-3"},"imported":[{"uid":"7c1ccaf0-0"}],"importedBy":[{"uid":"7c1ccaf0-55"},{"uid":"7c1ccaf0-8"}]},"7c1ccaf0-4":{"id":"/home/runner/work/basistheory-elements/basistheory-elements/packages/shared/dist/generate-id.js","moduleParts":{"basis-theory-sdk.umd.js":"7c1ccaf0-5"},"imported":[],"importedBy":[{"uid":"7c1ccaf0-55"}]},"7c1ccaf0-6":{"id":"/home/runner/work/basistheory-elements/basistheory-elements/packages/shared/dist/language-tag.js","moduleParts":{"basis-theory-sdk.umd.js":"7c1ccaf0-7"},"imported":[],"importedBy":[{"uid":"7c1ccaf0-55"}]},"7c1ccaf0-8":{"id":"/home/runner/work/basistheory-elements/basistheory-elements/packages/shared/dist/logger-context.js","moduleParts":{"basis-theory-sdk.umd.js":"7c1ccaf0-9"},"imported":[{"uid":"7c1ccaf0-2"}],"importedBy":[{"uid":"7c1ccaf0-55"}]},"7c1ccaf0-10":{"id":"/home/runner/work/basistheory-elements/basistheory-elements/packages/shared/dist/errors.js","moduleParts":{"basis-theory-sdk.umd.js":"7c1ccaf0-11"},"imported":[],"importedBy":[{"uid":"7c1ccaf0-55"},{"uid":"7c1ccaf0-12"}]},"7c1ccaf0-12":{"id":"/home/runner/work/basistheory-elements/basistheory-elements/packages/shared/dist/proxy-validation.js","moduleParts":{"basis-theory-sdk.umd.js":"7c1ccaf0-13"},"imported":[{"uid":"7c1ccaf0-10"}],"importedBy":[{"uid":"7c1ccaf0-55"}]},"7c1ccaf0-14":{"id":"/home/runner/work/basistheory-elements/basistheory-elements/packages/postmessage/dist/client.js","moduleParts":{"basis-theory-sdk.umd.js":"7c1ccaf0-15"},"imported":[{"uid":"7c1ccaf0-55"}],"importedBy":[{"uid":"7c1ccaf0-54"}]},"7c1ccaf0-16":{"id":"/src/mounter/create-mounter.ts","moduleParts":{"basis-theory-sdk.umd.js":"7c1ccaf0-17"},"imported":[],"importedBy":[{"uid":"7c1ccaf0-24"},{"uid":"7c1ccaf0-26"},{"uid":"7c1ccaf0-28"},{"uid":"7c1ccaf0-30"},{"uid":"7c1ccaf0-48"},{"uid":"7c1ccaf0-50"},{"uid":"7c1ccaf0-52"}]},"7c1ccaf0-18":{"id":"/src/utils/bind-coordinator-port.ts","moduleParts":{"basis-theory-sdk.umd.js":"7c1ccaf0-19"},"imported":[{"uid":"7c1ccaf0-55"}],"importedBy":[{"uid":"7c1ccaf0-24"},{"uid":"7c1ccaf0-26"},{"uid":"7c1ccaf0-28"},{"uid":"7c1ccaf0-30"},{"uid":"7c1ccaf0-48"},{"uid":"7c1ccaf0-50"},{"uid":"7c1ccaf0-52"}]},"7c1ccaf0-20":{"id":"/src/utils/create-iframe.ts","moduleParts":{"basis-theory-sdk.umd.js":"7c1ccaf0-21"},"imported":[],"importedBy":[{"uid":"7c1ccaf0-24"},{"uid":"7c1ccaf0-26"},{"uid":"7c1ccaf0-28"},{"uid":"7c1ccaf0-30"},{"uid":"7c1ccaf0-48"},{"uid":"7c1ccaf0-50"},{"uid":"7c1ccaf0-52"}]},"7c1ccaf0-22":{"id":"/src/utils/create-event-dispatcher.ts","moduleParts":{"basis-theory-sdk.umd.js":"7c1ccaf0-23"},"imported":[],"importedBy":[{"uid":"7c1ccaf0-24"},{"uid":"7c1ccaf0-26"},{"uid":"7c1ccaf0-28"},{"uid":"7c1ccaf0-30"},{"uid":"7c1ccaf0-48"},{"uid":"7c1ccaf0-50"}]},"7c1ccaf0-24":{"id":"/src/elements/create-card-number.ts","moduleParts":{"basis-theory-sdk.umd.js":"7c1ccaf0-25"},"imported":[{"uid":"7c1ccaf0-54"},{"uid":"7c1ccaf0-55"},{"uid":"7c1ccaf0-16"},{"uid":"7c1ccaf0-18"},{"uid":"7c1ccaf0-20"},{"uid":"7c1ccaf0-22"}],"importedBy":[{"uid":"7c1ccaf0-42"}]},"7c1ccaf0-26":{"id":"/src/elements/create-cvv.ts","moduleParts":{"basis-theory-sdk.umd.js":"7c1ccaf0-27"},"imported":[{"uid":"7c1ccaf0-54"},{"uid":"7c1ccaf0-55"},{"uid":"7c1ccaf0-16"},{"uid":"7c1ccaf0-18"},{"uid":"7c1ccaf0-20"},{"uid":"7c1ccaf0-22"}],"importedBy":[{"uid":"7c1ccaf0-42"}]},"7c1ccaf0-28":{"id":"/src/elements/create-expiry.ts","moduleParts":{"basis-theory-sdk.umd.js":"7c1ccaf0-29"},"imported":[{"uid":"7c1ccaf0-54"},{"uid":"7c1ccaf0-55"},{"uid":"7c1ccaf0-16"},{"uid":"7c1ccaf0-18"},{"uid":"7c1ccaf0-20"},{"uid":"7c1ccaf0-22"}],"importedBy":[{"uid":"7c1ccaf0-42"}]},"7c1ccaf0-30":{"id":"/src/elements/create-text.ts","moduleParts":{"basis-theory-sdk.umd.js":"7c1ccaf0-31"},"imported":[{"uid":"7c1ccaf0-54"},{"uid":"7c1ccaf0-55"},{"uid":"7c1ccaf0-16"},{"uid":"7c1ccaf0-18"},{"uid":"7c1ccaf0-20"},{"uid":"7c1ccaf0-22"}],"importedBy":[{"uid":"7c1ccaf0-42"}]},"7c1ccaf0-32":{"id":"/src/utils/resolve-element-references.ts","moduleParts":{"basis-theory-sdk.umd.js":"7c1ccaf0-33"},"imported":[{"uid":"7c1ccaf0-55"}],"importedBy":[{"uid":"7c1ccaf0-42"}]},"7c1ccaf0-34":{"id":"/src/theme/default-theme.ts","moduleParts":{"basis-theory-sdk.umd.js":"7c1ccaf0-35"},"imported":[],"importedBy":[{"uid":"7c1ccaf0-38"}]},"7c1ccaf0-36":{"id":"/src/utils/warn-unknown-keys.ts","moduleParts":{"basis-theory-sdk.umd.js":"7c1ccaf0-37"},"imported":[],"importedBy":[{"uid":"7c1ccaf0-38"},{"uid":"7c1ccaf0-40"}]},"7c1ccaf0-38":{"id":"/src/utils/validate-sdk-config.ts","moduleParts":{"basis-theory-sdk.umd.js":"7c1ccaf0-39"},"imported":[{"uid":"7c1ccaf0-55"},{"uid":"7c1ccaf0-34"},{"uid":"7c1ccaf0-36"}],"importedBy":[{"uid":"7c1ccaf0-42"}]},"7c1ccaf0-40":{"id":"/src/utils/validate-element-options.ts","moduleParts":{"basis-theory-sdk.umd.js":"7c1ccaf0-41"},"imported":[{"uid":"7c1ccaf0-55"},{"uid":"7c1ccaf0-36"}],"importedBy":[{"uid":"7c1ccaf0-42"}]},"7c1ccaf0-42":{"id":"/src/BasisTheory.ts","moduleParts":{"basis-theory-sdk.umd.js":"7c1ccaf0-43"},"imported":[{"uid":"7c1ccaf0-54"},{"uid":"7c1ccaf0-55"},{"uid":"7c1ccaf0-24"},{"uid":"7c1ccaf0-26"},{"uid":"7c1ccaf0-28"},{"uid":"7c1ccaf0-30"},{"uid":"7c1ccaf0-32"},{"uid":"7c1ccaf0-38"},{"uid":"7c1ccaf0-40"},{"uid":"7c1ccaf0-48","dynamic":true},{"uid":"7c1ccaf0-50","dynamic":true},{"uid":"7c1ccaf0-52","dynamic":true}],"importedBy":[{"uid":"7c1ccaf0-46"}]},"7c1ccaf0-44":{"id":"/src/version.ts","moduleParts":{"basis-theory-sdk.umd.js":"7c1ccaf0-45"},"imported":[],"importedBy":[{"uid":"7c1ccaf0-46"}]},"7c1ccaf0-46":{"id":"/src/index.ts","moduleParts":{"basis-theory-sdk.umd.js":"7c1ccaf0-47"},"imported":[{"uid":"7c1ccaf0-42"},{"uid":"7c1ccaf0-44"}],"importedBy":[],"isEntry":true},"7c1ccaf0-48":{"id":"/src/elements/create-card.ts","moduleParts":{"basis-theory-sdk.umd.js":"7c1ccaf0-49"},"imported":[{"uid":"7c1ccaf0-54"},{"uid":"7c1ccaf0-55"},{"uid":"7c1ccaf0-16"},{"uid":"7c1ccaf0-18"},{"uid":"7c1ccaf0-20"},{"uid":"7c1ccaf0-22"}],"importedBy":[{"uid":"7c1ccaf0-42"}]},"7c1ccaf0-50":{"id":"/src/elements/create-copy-button.ts","moduleParts":{"basis-theory-sdk.umd.js":"7c1ccaf0-51"},"imported":[{"uid":"7c1ccaf0-54"},{"uid":"7c1ccaf0-55"},{"uid":"7c1ccaf0-16"},{"uid":"7c1ccaf0-18"},{"uid":"7c1ccaf0-20"},{"uid":"7c1ccaf0-22"}],"importedBy":[{"uid":"7c1ccaf0-42"}]},"7c1ccaf0-52":{"id":"/src/elements/create-card-display.ts","moduleParts":{"basis-theory-sdk.umd.js":"7c1ccaf0-53"},"imported":[{"uid":"7c1ccaf0-54"},{"uid":"7c1ccaf0-55"},{"uid":"7c1ccaf0-16"},{"uid":"7c1ccaf0-18"},{"uid":"7c1ccaf0-20"}],"importedBy":[{"uid":"7c1ccaf0-42"}]},"7c1ccaf0-54":{"id":"/home/runner/work/basistheory-elements/basistheory-elements/packages/postmessage/dist/index.js","moduleParts":{},"imported":[{"uid":"7c1ccaf0-14"},{"uid":"7c1ccaf0-56"},{"uid":"7c1ccaf0-57"},{"uid":"7c1ccaf0-58"}],"importedBy":[{"uid":"7c1ccaf0-42"},{"uid":"7c1ccaf0-24"},{"uid":"7c1ccaf0-26"},{"uid":"7c1ccaf0-28"},{"uid":"7c1ccaf0-30"},{"uid":"7c1ccaf0-48"},{"uid":"7c1ccaf0-50"},{"uid":"7c1ccaf0-52"}]},"7c1ccaf0-55":{"id":"/home/runner/work/basistheory-elements/basistheory-elements/packages/shared/dist/index.js","moduleParts":{},"imported":[{"uid":"7c1ccaf0-2"},{"uid":"7c1ccaf0-0"},{"uid":"7c1ccaf0-59"},{"uid":"7c1ccaf0-4"},{"uid":"7c1ccaf0-6"},{"uid":"7c1ccaf0-8"},{"uid":"7c1ccaf0-10"},{"uid":"7c1ccaf0-12"}],"importedBy":[{"uid":"7c1ccaf0-42"},{"uid":"7c1ccaf0-24"},{"uid":"7c1ccaf0-26"},{"uid":"7c1ccaf0-28"},{"uid":"7c1ccaf0-30"},{"uid":"7c1ccaf0-32"},{"uid":"7c1ccaf0-38"},{"uid":"7c1ccaf0-40"},{"uid":"7c1ccaf0-48"},{"uid":"7c1ccaf0-50"},{"uid":"7c1ccaf0-52"},{"uid":"7c1ccaf0-14"},{"uid":"7c1ccaf0-56"},{"uid":"7c1ccaf0-18"}]},"7c1ccaf0-56":{"id":"/home/runner/work/basistheory-elements/basistheory-elements/packages/postmessage/dist/server.js","moduleParts":{},"imported":[{"uid":"7c1ccaf0-55"}],"importedBy":[{"uid":"7c1ccaf0-54"}]},"7c1ccaf0-57":{"id":"/home/runner/work/basistheory-elements/basistheory-elements/packages/postmessage/dist/types.js","moduleParts":{},"imported":[],"importedBy":[{"uid":"7c1ccaf0-54"}]},"7c1ccaf0-58":{"id":"/home/runner/work/basistheory-elements/basistheory-elements/packages/postmessage/dist/event-map.js","moduleParts":{},"imported":[],"importedBy":[{"uid":"7c1ccaf0-54"}]},"7c1ccaf0-59":{"id":"/home/runner/work/basistheory-elements/basistheory-elements/packages/shared/dist/api-url-resolver.js","moduleParts":{},"imported":[],"importedBy":[{"uid":"7c1ccaf0-55"}]}},"env":{"rollup":"4.62.2"},"options":{"gzip":true,"brotli":true,"sourcemap":false}};
|
|
4933
4933
|
|
|
4934
4934
|
const run = () => {
|
|
4935
4935
|
const width = window.innerWidth;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@basis-theory/web-elements",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.1.0",
|
|
4
4
|
"description": "Secure, PCI-compliant elements for creating payment input forms",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/basis-theory-sdk.umd.js",
|
|
@@ -48,10 +48,10 @@
|
|
|
48
48
|
"directory": "packages/web-elements"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
|
-
"@basis-theory-elements/api-client": "3.
|
|
52
|
-
"@basis-theory-elements/postmessage": "3.
|
|
53
|
-
"@basis-theory-elements/shared": "3.
|
|
54
|
-
"@basis-theory-elements/validation": "3.
|
|
51
|
+
"@basis-theory-elements/api-client": "3.1.0",
|
|
52
|
+
"@basis-theory-elements/postmessage": "3.1.0",
|
|
53
|
+
"@basis-theory-elements/shared": "3.1.0",
|
|
54
|
+
"@basis-theory-elements/validation": "3.1.0",
|
|
55
55
|
"@microsoft/api-extractor": "^7.58.9",
|
|
56
56
|
"@types/node": "^20.0.0",
|
|
57
57
|
"jsdom": "^24.0.0",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create-card-C94szxMV.js","sources":["../src/elements/create-card.ts"],"sourcesContent":["/**\n * Card Element Factory (Unified)\n */\n\nimport type { PostMessageClient } from '@basis-theory-elements/postmessage';\nimport { createPostMessageClient } from '@basis-theory-elements/postmessage';\nimport { ElementError, log } from '@basis-theory-elements/shared';\nimport { createMounter } from '../mounter/create-mounter';\nimport type {\n CardElement,\n ElementMounter,\n ElementOptions,\n EventListener,\n EventType,\n SDKConfig,\n SubElementRef,\n} from '../types';\nimport type { CoordinatorRequest } from '../utils/bind-coordinator-port';\nimport { bindCoordinatorPort } from '../utils/bind-coordinator-port';\nimport { createIframe } from '../utils/create-iframe';\nimport { createEventDispatcher } from '../utils/create-event-dispatcher';\n\n/**\n * Default stack threshold in pixels for CardElement auto-layout\n * When container width is below this threshold, card inputs stack vertically\n */\nconst DEFAULT_CARD_STACK_THRESHOLD = 400;\n\n/**\n * Card element options\n */\nexport interface CardElementOptions {\n /** CSS styling */\n style?: Record<string, any>;\n\n /** Placeholder text for each sub-field */\n placeholder?: {\n cardNumber?: string;\n expiryDate?: string;\n cvc?: string;\n };\n\n /** Accessibility label */\n ariaLabel?: string;\n\n /** Disabled state (applies to all 3 sub-fields) */\n disabled?: boolean;\n\n /** Read-only state (applies to all 3 sub-fields) */\n readOnly?: boolean;\n\n /** Layout mode */\n layout?: 'row' | 'column' | 'auto';\n\n /** Stack threshold in pixels (only applies when layout: 'auto') */\n stackAt?: number;\n\n /** Icon position */\n iconPosition?: 'left' | 'right' | 'none';\n\n /** Restrict accepted card brands */\n cardBrands?: string[];\n\n /**\n * BIN enrichment for the card number field. Setting `coBadge` turns enrichment on and\n * overrides this — an explicit `binLookup: false` is ignored when `coBadge` is set.\n */\n binLookup?: boolean | { enabled?: boolean; debounceMs?: number };\n\n /** Co-badge options; forces BIN enrichment on when set, overriding `binLookup`. */\n coBadge?: {\n preferredNetworks?: string[];\n mode?: 'auto' | 'manual';\n };\n}\n\n/**\n * Factory function to create a unified card element\n * No class, pure functional approach with closure-based state\n */\nexport const createCardElement = (\n apiKey: string,\n sdkConfig: SDKConfig,\n options: CardElementOptions = {},\n coordinatorElementId: string,\n ensureCoordinatorReady: () => Promise<void>,\n notifyCoordinatorElementUnmount: (elementId: string) => Promise<void>, // ← Notify coordinator on unmount\n coordinatorRequest: CoordinatorRequest // ← Brokers this element's coordinator port\n): CardElement => {\n // Private state (closure)\n let iframe: HTMLIFrameElement | null = null;\n let client: PostMessageClient | null = null;\n let mounter: ElementMounter | null = null;\n let isMounted = false;\n let container: HTMLElement | null = null;\n let eventDispatcher: ReturnType<typeof createEventDispatcher> | null = null;\n\n // Event target for event emission\n const eventTarget = new EventTarget();\n\n // Use coordinator-generated ID for all references\n const id = coordinatorElementId;\n const type = 'card';\n\n // Setup event dispatcher\n const setupEventListeners = () => {\n if (!client) {\n return;\n }\n\n eventDispatcher = createEventDispatcher({\n elementType: type,\n elementId: id,\n client,\n eventTarget,\n });\n\n eventDispatcher.setupSubscriptions();\n };\n\n /**\n * Create sub-element reference for tokenization\n * These refs are used in bt.tokens.create() data payload\n */\n const createSubElementRef = (subId: string): SubElementRef => ({\n id: subId,\n type: 'card',\n get mounted() {\n return isMounted;\n },\n mount: () => {\n throw ElementError('Sub-field refs cannot be mounted independently');\n },\n unmount: () => {},\n update: () => Promise.resolve(),\n focus: () => {},\n blur: () => {},\n clear: () => {},\n on: () => () => {},\n });\n\n const numberRef = createSubElementRef(`${id}__number`);\n const expiryDateRef = createSubElementRef(`${id}__expiry`);\n const cvcRef = createSubElementRef(`${id}__cvc`);\n\n // Public API (Element interface with sub-field refs)\n const cardElement = {\n id,\n type,\n get mounted() {\n return isMounted;\n },\n get loaded() {\n return isMounted;\n },\n\n // Sub-field references for tokenization\n number: numberRef,\n expiryDate: expiryDateRef,\n cvc: cvcRef,\n\n mount: async (selector: string | HTMLElement) => {\n if (isMounted) {\n throw ElementError('Element is already mounted');\n }\n\n // Resolve container\n container =\n typeof selector === 'string'\n ? document.querySelector(selector)\n : selector;\n\n if (!container) {\n throw ElementError(`Container not found: ${selector}`);\n }\n\n // Create iframe\n const parentOrigin = window.location.origin;\n const iframeUrl = new URL(`${sdkConfig.elementsBaseUrl}/card.html`);\n iframeUrl.searchParams.set('parentOrigin', parentOrigin);\n iframeUrl.searchParams.set('elementId', id);\n iframeUrl.searchParams.set(\n 'measurePerformance',\n String(sdkConfig.measurePerformance || false)\n );\n iframeUrl.searchParams.set('debug', String(sdkConfig.debug || false));\n\n iframe = createIframe({\n src: iframeUrl.toString(),\n sandbox: 'allow-scripts allow-same-origin',\n title: options.ariaLabel || 'Card Input',\n });\n\n // Add element ID and theme mode attributes\n iframe.setAttribute('data-bt-element-id', id);\n iframe.setAttribute('data-theme-mode', sdkConfig.themeMode || 'auto');\n\n // Create PostMessage client\n client = createPostMessageClient(iframe, {\n targetOrigin: sdkConfig.iframeOrigin,\n timeout: sdkConfig.timeoutMs,\n retries: sdkConfig.retryConfig.maxRetries,\n debug: sdkConfig.debug,\n });\n\n // Create mounter\n mounter = createMounter();\n\n // Set up event listeners\n setupEventListeners();\n\n // Subscribe to 'ready' event BEFORE mounting iframe\n const readyPromise = new Promise<void>((resolve, reject) => {\n const timeout = setTimeout(() => {\n reject(\n ElementError(\n `Iframe EVENT_READY not received within ${sdkConfig.timeoutMs}ms`,\n id,\n { elementType: type, timeoutMs: sdkConfig.timeoutMs }\n )\n );\n }, sdkConfig.timeoutMs);\n\n const handleReady = () => {\n clearTimeout(timeout);\n resolve();\n };\n\n eventTarget.addEventListener('ready', handleReady, { once: true });\n });\n\n // Mount iframe to DOM (synchronous)\n mounter.mount(container, iframe, {\n timeoutMs: sdkConfig.timeoutMs,\n });\n\n isMounted = true;\n\n // Wait for coordinator + configuration to complete\n try {\n // Wait for coordinator (loads Core SDK if needed)\n await ensureCoordinatorReady();\n\n // Wait for EVENT_READY\n await readyPromise;\n\n // Bind the private channel before any value can be typed; all three\n // sub-values travel over this one port.\n await bindCoordinatorPort({\n elementId: id,\n elementType: type,\n client: client!,\n coordinatorRequest,\n });\n\n // Send initial configuration with card-specific options.\n // Omit `binLookup` / `coBadge` when undefined so the iframe never receives\n // explicit `undefined` (object literals include own keys with undefined values).\n await client!.sendRequest('CMD_SET_CONFIG', {\n elementId: id,\n apiKey,\n apiTimeout: sdkConfig.timeoutMs,\n apiRetries: sdkConfig.retryConfig.maxRetries,\n theme: sdkConfig.theme,\n darkTheme: sdkConfig.darkTheme,\n themeMode: sdkConfig.themeMode,\n placeholder: options.placeholder,\n ...(options.style !== undefined && { style: options.style }),\n disabled: options.disabled,\n readOnly: options.readOnly,\n layout: options.layout || 'auto',\n stackAt: options.stackAt || DEFAULT_CARD_STACK_THRESHOLD,\n iconPosition: options.iconPosition || 'left',\n ...(options.cardBrands !== undefined && { cardBrands: options.cardBrands }),\n ...(options.binLookup !== undefined && { binLookup: options.binLookup }),\n ...(options.coBadge !== undefined && { coBadge: options.coBadge }),\n debug: sdkConfig.debug,\n });\n\n // Reveal iframe now that theme is fully applied\n if (iframe) iframe.style.opacity = '1';\n } catch (error) {\n // Dispatch error event before cleanup\n if (eventDispatcher) {\n eventDispatcher.dispatchError(\n 'MOUNT_ERROR',\n (error as Error).message,\n error as Error\n );\n }\n\n // Mount failed - clean up and mark as unmounted\n isMounted = false;\n\n if (client) {\n client.destroy();\n client = null;\n }\n\n if (mounter && iframe) {\n mounter.unmount(iframe);\n iframe = null;\n mounter = null;\n }\n\n eventDispatcher = null;\n container = null;\n\n throw error;\n }\n },\n\n unmount: () => {\n if (!isMounted) {\n throw ElementError('Element is not mounted');\n }\n\n // PCI DSS 3.2.1: the coordinator clears every value this element owns\n // (__number, __expiry, __cvc) and releases its port.\n notifyCoordinatorElementUnmount(id).catch((error) => {\n log('Failed to notify coordinator of element unmount', {\n elementId: id,\n error: (error as Error).message,\n });\n });\n\n if (client) {\n client.destroy();\n client = null;\n }\n\n if (mounter && iframe) {\n mounter.unmount(iframe);\n iframe = null;\n mounter = null;\n }\n\n eventDispatcher = null;\n container = null;\n isMounted = false;\n },\n\n update: async (newOptions: Partial<ElementOptions> & { themeMode?: string }) => {\n if (!isMounted || !client) {\n throw ElementError('Element must be mounted before updating');\n }\n\n const cardOptions = newOptions as Partial<CardElementOptions> & { themeMode?: string };\n\n // Only send fields that are present (matches create-card-number) so we never\n // overwrite iframe config with undefined/null over postMessage.\n const updatePayload: Record<string, any> = {\n elementId: id,\n };\n\n if (cardOptions.placeholder !== undefined) {\n updatePayload.placeholder = cardOptions.placeholder;\n }\n if (cardOptions.style !== undefined) {\n updatePayload.style = cardOptions.style;\n }\n if (cardOptions.disabled !== undefined) {\n updatePayload.disabled = cardOptions.disabled;\n }\n if (cardOptions.readOnly !== undefined) {\n updatePayload.readOnly = cardOptions.readOnly;\n }\n if (cardOptions.layout !== undefined) {\n updatePayload.layout = cardOptions.layout;\n }\n if (cardOptions.stackAt !== undefined) {\n updatePayload.stackAt = cardOptions.stackAt;\n }\n if (cardOptions.iconPosition !== undefined) {\n updatePayload.iconPosition = cardOptions.iconPosition;\n }\n if (cardOptions.cardBrands !== undefined) {\n updatePayload.cardBrands = cardOptions.cardBrands;\n }\n if (cardOptions.binLookup !== undefined) {\n updatePayload.binLookup = cardOptions.binLookup;\n }\n if (cardOptions.coBadge !== undefined) {\n updatePayload.coBadge = cardOptions.coBadge;\n }\n\n if (newOptions.themeMode !== undefined) {\n updatePayload.themeMode = newOptions.themeMode;\n updatePayload.theme = sdkConfig.theme;\n updatePayload.darkTheme = sdkConfig.darkTheme;\n }\n\n await client.sendRequest('CMD_UPDATE_CONFIG', updatePayload);\n },\n\n focus: () => {\n if (!isMounted || !client) {\n throw ElementError('Element must be mounted before focusing');\n }\n\n client.sendRequest('CMD_FOCUS', {});\n },\n\n blur: () => {\n if (!isMounted || !client) {\n throw ElementError('Element must be mounted before blurring');\n }\n\n client.sendRequest('CMD_BLUR', {});\n },\n\n clear: () => {\n if (!isMounted || !client) {\n throw ElementError('Element must be mounted before clearing');\n }\n\n client.sendRequest('CMD_CLEAR', {});\n },\n\n on: (eventType: EventType, listener: EventListener) => {\n eventTarget.addEventListener(\n eventType,\n listener as EventListenerOrEventListenerObject\n );\n\n // Return unsubscribe function\n return () =>\n eventTarget.removeEventListener(\n eventType,\n listener as EventListenerOrEventListenerObject\n );\n },\n\n setNetwork: async (network: string) => {\n if (!isMounted || !client) {\n throw ElementError('Element must be mounted before setNetwork');\n }\n await client.sendRequest('CMD_SET_NETWORK', { network });\n },\n };\n\n return cardElement as CardElement;\n};\n"],"names":[],"mappings":";AA0B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,cAAc,QAAW;AACvC,sBAAc,YAAY,YAAY;AAAA,MACxC;AACA,UAAI,YAAY,YAAY,QAAW;AACrC,sBAAc,UAAU,YAAY;AAAA,MACtC;AAEA,UAAI,WAAW,cAAc,QAAW;AACtC,sBAAc,YAAY,WAAW;AACrC,sBAAc,QAAQ,UAAU;AAChC,sBAAc,YAAY,UAAU;AAAA,MACtC;AAEA,YAAM,OAAO,YAAY,qBAAqB,aAAa;AAAA,IAC7D;AAAA,IAEA,OAAO,MAAM;AACX,UAAI,CAAC,aAAa,CAAC,QAAQ;AACzB,cAAM,aAAa,yCAAyC;AAAA,MAC9D;AAEA,aAAO,YAAY,aAAa,EAAE;AAAA,IACpC;AAAA,IAEA,MAAM,MAAM;AACV,UAAI,CAAC,aAAa,CAAC,QAAQ;AACzB,cAAM,aAAa,yCAAyC;AAAA,MAC9D;AAEA,aAAO,YAAY,YAAY,EAAE;AAAA,IACnC;AAAA,IAEA,OAAO,MAAM;AACX,UAAI,CAAC,aAAa,CAAC,QAAQ;AACzB,cAAM,aAAa,yCAAyC;AAAA,MAC9D;AAEA,aAAO,YAAY,aAAa,EAAE;AAAA,IACpC;AAAA,IAEA,IAAI,CAAC,WAAsB,aAA4B;AACrD,kBAAY;AAAA,QACV;AAAA,QACA;AAAA,MAAA;AAIF,aAAO,MACL,YAAY;AAAA,QACV;AAAA,QACA;AAAA,MAAA;AAAA,IAEN;AAAA,IAEA,YAAY,OAAO,YAAoB;AACrC,UAAI,CAAC,aAAa,CAAC,QAAQ;AACzB,cAAM,aAAa,2CAA2C;AAAA,MAChE;AACA,YAAM,OAAO,YAAY,mBAAmB,EAAE,SAAS;AAAA,IACzD;AAAA,EAAA;AAGF,SAAO;AACT;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create-copy-button-Z1s9ao67.js","sources":["../src/elements/create-copy-button.ts"],"sourcesContent":["/**\n * Copy Button Element Factory\n *\n * Creates a secure button that copies values to clipboard.\n * Can copy either a static value or a value from a linked BT element.\n *\n * SECURITY NOTE: This element is opt-in only via allowClipboard: true.\n * Clipboard access for raw card data may not be PCI compliant and must\n * never be enabled inadvertently.\n */\n\nimport type { PostMessageClient } from '@basis-theory-elements/postmessage';\nimport { createPostMessageClient } from '@basis-theory-elements/postmessage';\nimport { ConfigurationError, ElementError, log } from '@basis-theory-elements/shared';\nimport { createMounter } from '../mounter/create-mounter';\nimport type {\n CopyButtonElement,\n CopyButtonOptions,\n Element,\n ElementMounter,\n ElementOptions,\n EventListener,\n EventType,\n SDKConfig,\n} from '../types';\nimport type { CoordinatorRequest } from '../utils/bind-coordinator-port';\nimport { bindCoordinatorPort } from '../utils/bind-coordinator-port';\nimport { createIframe } from '../utils/create-iframe';\nimport { createEventDispatcher } from '../utils/create-event-dispatcher';\n\n/**\n * Factory function to create a copy button element\n *\n * @throws ConfigurationError if allowClipboard is not set to true\n */\nexport const createCopyButtonElement = (\n _apiKey: string, // Reserved for future API calls\n sdkConfig: SDKConfig,\n inputOptions: ElementOptions | CopyButtonOptions | undefined,\n coordinatorElementId: string,\n ensureCoordinatorReady: () => Promise<void>,\n notifyCoordinatorElementUnmount: (elementId: string) => Promise<void>,\n coordinatorRequest: CoordinatorRequest // ← Brokers this button's coordinator port\n): CopyButtonElement => {\n // SECURITY: Defense-in-depth check for allowClipboard flag\n // Primary validation is in validate-element-options.ts, but we keep this\n // as a backup in case the factory is called directly (e.g., lazy loading)\n const options = inputOptions as CopyButtonOptions | undefined;\n if (options?.allowClipboard !== true) {\n throw ConfigurationError(\n 'CopyButton requires allowClipboard: true. ' +\n 'Clipboard access for raw card data may not be PCI compliant ' +\n 'and must be explicitly enabled.',\n {\n received: options?.allowClipboard,\n expected: true,\n elementType: 'copyButton',\n }\n );\n }\n\n // The coordinator freezes clipboard access at initialization and refuses copy\n // references without it, so fail here rather than at setValueRef.\n if (!sdkConfig.allowClipboard) {\n throw ConfigurationError(\n 'CopyButton also requires allowClipboard: true on BasisTheory() ' +\n 'initialization. The coordinator only honors copy references when ' +\n 'clipboard access was enabled at init.',\n {\n received: sdkConfig.allowClipboard,\n expected: true,\n elementType: 'copyButton',\n }\n );\n }\n\n // Private state (closure)\n let iframe: HTMLIFrameElement | null = null;\n let client: PostMessageClient | null = null;\n let mounter: ElementMounter | null = null;\n let isMounted = false;\n let container: HTMLElement | null = null;\n let eventDispatcher: ReturnType<typeof createEventDispatcher> | null = null;\n\n const eventTarget = new EventTarget();\n const id = coordinatorElementId;\n const type = 'copyButton' as const;\n\n // Setup event dispatcher (centralized event mapping logic)\n const setupEventListeners = () => {\n if (!client) return;\n\n eventDispatcher = createEventDispatcher({\n elementType: type,\n elementId: id,\n client,\n eventTarget,\n });\n\n eventDispatcher.setupSubscriptions();\n\n // Subscribe to copy events from the iframe\n client.subscribe('EVENT_COPY', (payload) => {\n const event = new CustomEvent('copy', {\n detail: {\n elementType: type,\n elementId: id,\n timestamp: Date.now(),\n success: payload?.success ?? false,\n error: payload?.error,\n },\n });\n eventTarget.dispatchEvent(event);\n });\n };\n\n const element: CopyButtonElement = {\n id,\n type,\n get mounted() {\n return isMounted;\n },\n get loaded() {\n return isMounted;\n },\n\n mount: async (selector: string | HTMLElement) => {\n if (isMounted) {\n throw ElementError('Element is already mounted', id);\n }\n\n container =\n typeof selector === 'string'\n ? document.querySelector(selector)\n : selector;\n\n if (!container) {\n throw ElementError(`Container not found: ${selector}`);\n }\n\n // Pass parent origin + element ID via URL parameters\n const parentOrigin = window.location.origin;\n const iframeUrl = new URL(`${sdkConfig.elementsBaseUrl}/copy-button.html`);\n iframeUrl.searchParams.set('parentOrigin', parentOrigin);\n iframeUrl.searchParams.set('elementId', id);\n iframeUrl.searchParams.set(\n 'measurePerformance',\n String(sdkConfig.measurePerformance || false)\n );\n iframeUrl.searchParams.set('debug', String(sdkConfig.debug || false));\n\n iframe = createIframe({\n src: iframeUrl.toString(),\n sandbox: 'allow-scripts allow-same-origin',\n // clipboard-write is required for Firefox/Safari clipboard access in iframes\n allow: 'clipboard-write',\n title: 'Copy Button',\n });\n\n // Add element ID attribute for debugging\n iframe.setAttribute('data-bt-element-id', id);\n\n client = createPostMessageClient(iframe, {\n targetOrigin: sdkConfig.iframeOrigin,\n timeout: sdkConfig.timeoutMs,\n retries: sdkConfig.retryConfig.maxRetries,\n debug: sdkConfig.debug,\n });\n\n mounter = createMounter();\n setupEventListeners();\n\n // Subscribe to 'ready' event BEFORE mounting iframe (prevents race condition)\n const readyPromise = new Promise<void>((resolve, reject) => {\n const timeout = setTimeout(() => {\n reject(\n ElementError(\n `Iframe EVENT_READY not received within ${sdkConfig.timeoutMs}ms`,\n id,\n { elementType: type, timeoutMs: sdkConfig.timeoutMs }\n )\n );\n }, sdkConfig.timeoutMs);\n\n const handleReady = () => {\n clearTimeout(timeout);\n resolve();\n };\n\n eventTarget.addEventListener('ready', handleReady, { once: true });\n });\n\n // Mount iframe to DOM\n mounter.mount(container, iframe, {\n timeoutMs: sdkConfig.timeoutMs,\n });\n\n isMounted = true;\n\n // Wait for coordinator + configuration to complete\n try {\n await ensureCoordinatorReady();\n await readyPromise;\n\n // Referenced values arrive only over this port, so a copy button framed\n // without the SDK has nothing to copy.\n await bindCoordinatorPort({\n elementId: id,\n elementType: type,\n client: client!,\n coordinatorRequest,\n });\n\n await client!.sendRequest('CMD_SET_CONFIG', {\n elementId: id,\n theme: sdkConfig.theme,\n darkTheme: sdkConfig.darkTheme,\n themeMode: sdkConfig.themeMode,\n text: options.text || 'Copy',\n value: options.value,\n disabled: options.disabled,\n debug: sdkConfig.debug,\n });\n\n // Reveal iframe now that theme is applied\n if (iframe) iframe.style.opacity = '1';\n } catch (error) {\n // Dispatch error event before cleanup\n if (eventDispatcher) {\n eventDispatcher.dispatchError(\n 'MOUNT_ERROR',\n (error as Error).message,\n error as Error\n );\n }\n\n // Mount failed - clean up\n isMounted = false;\n\n if (client) {\n client.destroy();\n client = null;\n }\n\n if (mounter && iframe) {\n mounter.unmount(iframe);\n iframe = null;\n mounter = null;\n }\n\n eventDispatcher = null;\n container = null;\n\n throw error;\n }\n },\n\n unmount: () => {\n if (!isMounted) {\n throw ElementError('Element is not mounted');\n }\n\n // Drops the coordinator's copy reference and releases this button's port\n notifyCoordinatorElementUnmount(id).catch((error) => {\n log('Failed to notify coordinator of element unmount', {\n elementId: id,\n error: (error as Error).message,\n });\n });\n\n if (client) {\n client.destroy();\n client = null;\n }\n\n if (mounter && iframe) {\n mounter.unmount(iframe);\n iframe = null;\n mounter = null;\n }\n\n eventDispatcher = null;\n container = null;\n isMounted = false;\n },\n\n update: async (newOptions: Partial<CopyButtonOptions> & { themeMode?: string }) => {\n if (!isMounted || !client) {\n throw ElementError('Element must be mounted before updating', id);\n }\n\n // Only send fields that are present (matches create-card-number) so we never\n // overwrite iframe config with undefined/null over postMessage.\n const updatePayload: Record<string, any> = {};\n\n const copyButtonOptions = newOptions as Partial<CopyButtonOptions> & { themeMode?: string };\n\n if (copyButtonOptions.text !== undefined) {\n updatePayload.text = copyButtonOptions.text;\n }\n if (copyButtonOptions.value !== undefined) {\n updatePayload.value = copyButtonOptions.value;\n }\n if (copyButtonOptions.disabled !== undefined) {\n updatePayload.disabled = copyButtonOptions.disabled;\n }\n\n // Include theme mode update if provided\n if (newOptions.themeMode !== undefined) {\n updatePayload.themeMode = newOptions.themeMode;\n updatePayload.theme = sdkConfig.theme;\n updatePayload.darkTheme = sdkConfig.darkTheme;\n }\n\n await client.sendRequest('CMD_UPDATE_CONFIG', updatePayload);\n },\n\n focus: () => {\n if (!isMounted || !client) {\n throw ElementError('Element must be mounted before focusing', id);\n }\n\n client.sendRequest('CMD_FOCUS', {});\n },\n\n blur: () => {\n if (!isMounted || !client) {\n throw ElementError('Element must be mounted before blurring', id);\n }\n\n client.sendRequest('CMD_BLUR', {});\n },\n\n // No-op for CopyButton (nothing to clear in a button)\n clear: () => {},\n\n on: (eventType: EventType, listener: EventListener) => {\n eventTarget.addEventListener(\n eventType,\n listener as EventListenerOrEventListenerObject\n );\n\n return () =>\n eventTarget.removeEventListener(\n eventType,\n listener as EventListenerOrEventListenerObject\n );\n },\n\n /**\n * Link this copy button to another element's value.\n *\n * Authorized by the coordinator, not the iframe: it checks both ids are ones\n * it registered, then forwards the value over this button's port.\n */\n setValueRef: async (refElement: Element): Promise<void> => {\n log('setValueRef called', {\n copyButtonId: id,\n refElementId: refElement?.id,\n });\n\n if (!refElement || !refElement.id) {\n throw ElementError('setValueRef requires a valid Element with an ID', id);\n }\n\n if (!isMounted || !client) {\n throw ElementError('Element must be mounted before calling setValueRef', id);\n }\n\n const result = await coordinatorRequest<{ success: boolean; error?: string }>(\n 'CMD_SET_COPY_REFERENCE',\n { elementId: id, referenceElementId: refElement.id }\n );\n\n if (!result?.success) {\n throw ElementError(\n `Coordinator rejected the copy reference (${result?.error ?? 'UNKNOWN'})`,\n id\n );\n }\n },\n };\n\n return element;\n};\n"],"names":[],"mappings":";AAmCO,MAAM,0BAA0B,CACrC,SACA,WACA,cACA,sBACA,wBACA,iCACA,uBACsB;AAItB,QAAM,UAAU;AAChB,OAAI,mCAAS,oBAAmB,MAAM;AACpC,UAAM;AAAA,MACJ;AAAA,MAGA;AAAA,QACE,UAAU,mCAAS;AAAA,QACnB,UAAU;AAAA,QACV,aAAa;AAAA,MAAA;AAAA,IACf;AAAA,EAEJ;AAIA,MAAI,CAAC,UAAU,gBAAgB;AAC7B,UAAM;AAAA,MACJ;AAAA,MAGA;AAAA,QACE,UAAU,UAAU;AAAA,QACpB,UAAU;AAAA,QACV,aAAa;AAAA,MAAA;AAAA,IACf;AAAA,EAEJ;AAGA,MAAI,SAAmC;AACvC,MAAI,SAAmC;AACvC,MAAI,UAAiC;AACrC,MAAI,YAAY;AAChB,MAAI,YAAgC;AACpC,MAAI,kBAAmE;AAEvE,QAAM,cAAc,IAAI,YAAA;AACxB,QAAM,KAAK;AACX,QAAM,OAAO;AAGb,QAAM,sBAAsB,MAAM;AAChC,QAAI,CAAC,OAAQ;AAEb,sBAAkB,sBAAsB;AAAA,MACtC,aAAa;AAAA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