@basis-theory/web-elements 1.24.2 → 2.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/CHANGELOG.md +29 -0
- package/dist/bundle/index.js +1 -1
- package/dist/main/index.js +114 -24
- package/dist/module/module.js +115 -25
- package/dist/package.json +1 -1
- package/dist/types/index.d.ts +103 -23
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,26 @@
|
|
|
1
|
+
## [2.1.0] - 2025-09-11
|
|
2
|
+
|
|
3
|
+
### Features
|
|
4
|
+
|
|
5
|
+
- fdfaabf 2025-09-11 feat: adds copy button (#519) by brian.gonzalez@basistheory.com
|
|
6
|
+
- 6503dd1 2025-09-08 feat: add support for domain whitelabeling (#510) by kevin@basistheory.com
|
|
7
|
+
|
|
8
|
+
## [2.0.0] - 2025-09-08
|
|
9
|
+
|
|
10
|
+
### Breaking Changes
|
|
11
|
+
|
|
12
|
+
- eb651be 2025-08-29 feat!: remove material ui (#478) by kevin@basistheory.com
|
|
13
|
+
|
|
14
|
+
### Features
|
|
15
|
+
|
|
16
|
+
- 5f3b347 2025-09-03 feat: collect device info (#516) by kevin@basistheory.com
|
|
17
|
+
- c7f606d 2025-09-01 feat: allow style customization of elements container (#518) by kevin@basistheory.com
|
|
18
|
+
- 97264fd 2025-08-21 feat: remove axios and btjs (#495) by kevin@basistheory.com
|
|
19
|
+
|
|
20
|
+
### Bug Fixes
|
|
21
|
+
|
|
22
|
+
- 8dbb18a 2025-08-29 fix: make input field always transparent (#517) by kevin@basistheory.com
|
|
23
|
+
|
|
1
24
|
## [1.24.2] - 2025-08-21
|
|
2
25
|
|
|
3
26
|
### Bug Fixes
|
|
@@ -50,6 +73,12 @@
|
|
|
50
73
|
- 528c197 2025-07-29 fix: release (#480) by kevin@basistheory.com
|
|
51
74
|
- a9f3fae 2025-07-29 fix: revert latest (#479) by kevin@basistheory.com
|
|
52
75
|
|
|
76
|
+
## [1.22.1] - 2025-07-29
|
|
77
|
+
|
|
78
|
+
### Bug Fixes
|
|
79
|
+
|
|
80
|
+
- a229582 2025-07-22 fix: do not snakeCase/camelCase tokenize (#477) by kevin@basistheory.com
|
|
81
|
+
|
|
53
82
|
## [1.22.0] - 2025-07-18
|
|
54
83
|
|
|
55
84
|
### Features
|
package/dist/bundle/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(){function e(e,r,t,n,o,i,l){try{var c=e[i](l),u=c.value}catch(e){t(e);return}c.done?r(u):Promise.resolve(u).then(n,o)}function r(r){return function(){var t=this,n=arguments;return new Promise(function(o,i){var l=r.apply(t,n);function c(r){e(l,o,i,c,u,"next",r)}function u(r){e(l,o,i,c,u,"throw",r)}c(void 0)})}}function t(e,r){var t,n,o,i,l={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(i){return function(c){var u=[i,c];if(t)throw TypeError("Generator is already executing.");for(;l;)try{if(t=1,n&&(o=2&u[0]?n.return:u[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,u[1])).done)return o;switch(n=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return l.label++,{value:u[1],done:!1};case 5:l.label++,n=u[1],u=[0];continue;case 7:u=l.ops.pop(),l.trys.pop();continue;default:if(!(o=(o=l.trys).length>0&&o[o.length-1])&&(6===u[0]||2===u[0])){l=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){l.label=u[1];break}if(6===u[0]&&l.label<o[1]){l.label=o[1],o=u;break}if(o&&l.label<o[2]){l.label=o[2],l.ops.push(u);break}o[2]&&l.ops.pop(),l.trys.pop();continue}u=r.call(e,l)}catch(e){u=[6,e],n=0}finally{t=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}var n,o,i,l,c,u,s,a=(l=r(function(e,r){var n,l,c,u,s,a,d,f=arguments;return t(this,function(t){switch(t.label){case 0:if(n=f.length>2&&void 0!==f[2]?f[2]:{},o)return[2];d=function(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{},n=Object.keys(t);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(t).filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.forEach(function(r){var n;n=t[r],r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n})}return e}({level:r,message:e,service:"web-elements-loader",env:a=!i||(null==i?void 0:i.includes("localhost"))?"local":i.includes("dev")?"dev":"prod",referrer:null===(l=document)||void 0===l?void 0:l.referrer,origin:null===(c=window)||void 0===c?void 0:c.location.origin,url:null===(u=window)||void 0===u?void 0:u.location.href,userAgent:null===(s=navigator)||void 0===s?void 0:s.userAgent},n),["local","dev"].includes(a)&&console.log(d),t.label=1;case 1:return t.trys.push([1,3,,4]),[4,fetch("https://http-intake.logs.datadoghq.com/v1/input/".concat("pubb96b84a13912504f4354f2d794ea4fab"),{method:"POST",body:JSON.stringify(d),headers:{"Content-Type":"application/json"}})];case 2:return t.sent(),[3,4];case 3:return t.sent(),console.warn("There was an error sending telemetry."),[3,4];case 4:return[2]}})}),c=function(e,r){return l.apply(this,arguments)},{disableTelemetry:function(e){o=e},setBaseUrl:function(e){i=e},log:{error:function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return c(e,"error",r)},info:function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return c(e,"info",r)},warn:function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return c(e,"warn",r)}}}),d=function(e){var r=document.querySelector('script[src^="'.concat(e,'"]'));if(r)return r;var t=document.head||document.body;if(!t)throw Error("No <head> or <body> elements found in the document.");var n=Object.assign(document.createElement("script"),{src:e});return t.append(n),n},f="Tried to load BasisTheoryElements in a non-DOM environment.",p="Unable to load the Elements script. This may be due to network restrictions or browser extensions like ad blockers interfering with script loading. Check browser settings or network connection and try again.",h=function(e,n){return new Promise(function(o,i){var l,c=d(e),u=!1;c.addEventListener("load",function(){window.BasisTheoryElements?o(window.BasisTheoryElements):(r(function(){return t(this,function(e){switch(e.label){case 0:return[4,a.log.error("Elements not found on window on load",{logType:"elementsNotFoundOnWindow",logOrigin:"loadScript",retryCount:n})];case 1:return e.sent(),[2]}})})(),i(Error("Basis Theory Elements did not load properly. Check network tab for more details.")))}),c.addEventListener("error",(l=r(function(r){var l,s,d;return t(this,function(t){switch(t.label){case 0:if(u)return[2];return u=!0,[4,a.log.error("Elements script onError event",{logType:"elementsScriptOnError",logOrigin:"loadScript",retryCount:n,event:{message:null==r?void 0:r.message,source:null==r?void 0:r.filename,lineno:null==r?void 0:r.lineno,colno:null==r?void 0:r.colno,error:null==r?void 0:r.error,target:null==r?void 0:r.target}})];case 1:t.sent(),t.label=2;case 2:return t.trys.push([2,3,,5]),null==c||c.remove(),[3,5];case 3:return l=t.sent(),[4,a.log.error("Error removing script from DOM on retry attempt ".concat(n),{logType:"scriptRemovalError",logOrigin:"loadScript",retryCount:n,removalError:l})];case 4:return t.sent(),[3,5];case 5:if(0===n)return h(e,n+1).then(o).catch(i),[2];t.label=6;case 6:return t.trys.push([6,12,,14]),[4,fetch(e)];case 7:if((s=t.sent()).ok)return[3,9];return[4,a.log.error("Second attempt to load elements script failed, fetch failed with status: ".concat(s.status,"."),{logType:"elementsScriptFetchFailure",logOrigin:"loadScript",retryCount:n,fetchResult:"error",fetchResponse:s})];case 8:return t.sent(),i(Error(f)),[3,11];case 9:return[4,a.log.error("Second attempt to load elements script failed, fetch success",{logType:"elementsScriptFetchFailure",logOrigin:"loadScript",retryCount:n,fetchResult:"success",fetchResponse:s})];case 10:t.sent(),i(Error(p)),t.label=11;case 11:return[3,14];case 12:return d=t.sent(),[4,a.log.error("Second attempt failed to load elements script failed, fetch network error.",{logType:"elementsScriptFetchError",logOrigin:"loadScript",retryCount:n,fetchResult:"error",fetchError:d})];case 13:return t.sent(),i(Error(p)),[3,14];case 14:return i((null==r?void 0:r.error)||(null==r?void 0:r.message)||Error(p)),[2]}})}),function(e){return l.apply(this,arguments)}))})},v="1.24.2",y=(u=r(function(e,o){var i,l,c,u,s,d,p,y;return t(this,function(m){switch(m.label){case 0:if(!e||0===e.length)throw Error("API key is required");return i=(null==o?void 0:o._devMode)?"js.flock-dev.com":"js.basistheory.com",a.setBaseUrl(i),a.disableTelemetry(!!(null==o?void 0:o.disableTelemetry)),l="https://".concat(i,"/web-elements/").concat(v,"/client/index.js"),c="https://".concat(i,"/web-elements/").concat(v,"/hosted-elements/"),[4,(n||(n=new Promise(function(e,n){var o;if(("undefined"==typeof window?"undefined":(o=window)&&"undefined"!=typeof Symbol&&o.constructor===Symbol?"symbol":typeof o)!="object"){r(function(){return t(this,function(e){switch(e.label){case 0:return[4,a.log.warn(f,{logType:"elementsNonDomError",logOrigin:"loadElements"})];case 1:return e.sent(),n(Error(f)),[2]}})})();return}if(window.BasisTheoryElements){e(window.BasisTheoryElements);return}h(new URL(l).toString().replace(RegExp("\\/$","u"),""),0).then(e).catch(function(e){n(e)})})),n)];case 1:return[2,m.sent().init(e,c,!1,null===(u=null==o?void 0:o.useSameOriginApi)||void 0===u||u,null!==(s=null==o?void 0:o.disableTelemetry)&&void 0!==s&&s,null!==(d=null==o?void 0:o.debug)&&void 0!==d&&d,null!==(p=null==o?void 0:o.useUat)&&void 0!==p&&p,null!==(y=null==o?void 0:o.useNetworkCheck)&&void 0!==y&&y)]}})}),function(e,r){return u.apply(this,arguments)}),m=((s=m||{}).DECIMAL="decimal",s.EMAIL="email",s.NONE="none",s.NUMERIC="numeric",s.SEARCH="search",s.TEL="tel",s.TEXT="text",s.URL="url",s);function b(e){return(b=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function g(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(g=function(){return!!e})()}function w(e,r){return(w=Object.setPrototypeOf||function(e,r){return e.__proto__=r,e})(e,r)}function E(e,r,t){return(E=g()?Reflect.construct:function(e,r,t){var n=[null];n.push.apply(n,r);var o=new(Function.bind.apply(e,n));return t&&w(o,t.prototype),o}).apply(null,arguments)}function O(e){var r="function"==typeof Map?new Map:void 0;return(O=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw TypeError("Super expression must either be null or a function");if(void 0!==r){if(r.has(e))return r.get(e);r.set(e,t)}function t(){return E(e,arguments,b(this).constructor)}return t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),w(t,e)})(e)}O(Error),O(Error),O(Error),"undefined"!=typeof window&&document.currentScript&&!window.basistheory&&(window.basistheory=y)}();
|
|
1
|
+
!function(){function e(e,t,r,n,o,i,l){try{var c=e[i](l),a=c.value}catch(e){r(e);return}c.done?t(a):Promise.resolve(a).then(n,o)}function t(t){return function(){var r=this,n=arguments;return new Promise(function(o,i){var l=t.apply(r,n);function c(t){e(l,o,i,c,a,"next",t)}function a(t){e(l,o,i,c,a,"throw",t)}c(void 0)})}}function r(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function n(e,t){var r,n,o,i,l={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(i){return function(c){var a=[i,c];if(r)throw TypeError("Generator is already executing.");for(;l;)try{if(r=1,n&&(o=2&a[0]?n.return:a[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,a[1])).done)return o;switch(n=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return l.label++,{value:a[1],done:!1};case 5:l.label++,n=a[1],a=[0];continue;case 7:a=l.ops.pop(),l.trys.pop();continue;default:if(!(o=(o=l.trys).length>0&&o[o.length-1])&&(6===a[0]||2===a[0])){l=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){l.label=a[1];break}if(6===a[0]&&l.label<o[1]){l.label=o[1],o=a;break}if(o&&l.label<o[2]){l.label=o[2],l.ops.push(a);break}o[2]&&l.ops.pop(),l.trys.pop();continue}a=t.call(e,l)}catch(e){a=[6,e],n=0}finally{r=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}}}var o,i,l,c,a,s,u,d=(c=t(function(e,t){var r,o,c,a,s,u,d,f=arguments;return n(this,function(n){switch(n.label){case 0:if(r=f.length>2&&void 0!==f[2]?f[2]:{},i)return[2];d=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})}return e}({level:t,message:e,service:"web-elements-loader",env:u=!l||(null==l?void 0:l.includes("localhost"))?"local":l.includes("dev")?"dev":"prod",referrer:null===(o=document)||void 0===o?void 0:o.referrer,origin:null===(c=window)||void 0===c?void 0:c.location.origin,url:null===(a=window)||void 0===a?void 0:a.location.href,userAgent:null===(s=navigator)||void 0===s?void 0:s.userAgent},r),["local","dev"].includes(u)&&console.log(d),n.label=1;case 1:return n.trys.push([1,3,,4]),[4,fetch("https://http-intake.logs.datadoghq.com/v1/input/".concat("pubb96b84a13912504f4354f2d794ea4fab"),{method:"POST",body:JSON.stringify(d),headers:{"Content-Type":"application/json"}})];case 2:return n.sent(),[3,4];case 3:return n.sent(),console.warn("There was an error sending telemetry."),[3,4];case 4:return[2]}})}),a=function(e,t){return c.apply(this,arguments)},{disableTelemetry:function(e){i=e},setBaseUrl:function(e){l=e},log:{error:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return a(e,"error",t)},info:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return a(e,"info",t)},warn:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return a(e,"warn",t)}}});function f(e){return(f=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function p(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(p=function(){return!!e})()}function h(e,t){return(h=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function m(e,t,r){return(m=p()?Reflect.construct:function(e,t,r){var n=[null];n.push.apply(n,t);var o=new(Function.bind.apply(e,n));return r&&h(o,r.prototype),o}).apply(null,arguments)}function v(e){var t="function"==typeof Map?new Map:void 0;return(v=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return m(e,arguments,f(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),h(r,e)})(e)}var y=function(e){"use strict";if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function t(e,n,o){var i;if(!(this instanceof t))throw TypeError("Cannot call a class as a function");return(i=function(e,t,n){t=f(t);var o=p()?Reflect.construct(t,n||[],f(e).constructor):t.apply(e,n);if(o&&("object"===r(o)||"function"==typeof o))return o;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,t,[e])).details=n,i.validation=o,i.name="BasisTheoryValidationError",Object.setPrototypeOf(i,t.prototype),i}return t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&h(t,e),t}(v(Error)),w=function(e){var t;if("string"!=typeof e||!e.trim())throw Error("Custom domain must be a non-empty string.");try{t=new URL(e.toLowerCase().startsWith("http")?e:"https://".concat(e))}catch(t){throw new y('Invalid custom domain: "'.concat(e,'"'),{})}if("https:"!==t.protocol)throw new y('Custom domain must use HTTPS (got "'.concat(t.protocol,'")'),{});if("/"!==t.pathname||t.search||t.hash)throw new y('Custom domain must not include path, query, or hash (got "'.concat(t.href,'")'),{});if(t.port)throw new y('Custom domain must not include a port (got ":'.concat(t.port,'")'),{});if(!/^(?=.{1,253}$)([a-zA-Z0-9-]{1,63}\.)+[a-zA-Z]{2,63}$/.test(t.hostname))throw new y('Invalid hostname: "'.concat(t.hostname,'"'),{});return t.origin},b=function(e){var t=document.querySelector('script[src^="'.concat(e,'"]'));if(t)return t;var r=document.head||document.body;if(!r)throw Error("No <head> or <body> elements found in the document.");var n=Object.assign(document.createElement("script"),{src:e});return r.append(n),n},g="Tried to load BasisTheoryElements in a non-DOM environment.",E="Unable to load the Elements script. This may be due to network restrictions or browser extensions like ad blockers interfering with script loading. Check browser settings or network connection and try again.",O=function(e,r){return new Promise(function(o,i){var l,c=b(e),a=!1;c.addEventListener("load",function(){window.BasisTheoryElements?o(window.BasisTheoryElements):(t(function(){return n(this,function(e){switch(e.label){case 0:return[4,d.log.error("Elements not found on window on load",{logType:"elementsNotFoundOnWindow",logOrigin:"loadScript",retryCount:r})];case 1:return e.sent(),[2]}})})(),i(Error("Basis Theory Elements did not load properly. Check network tab for more details.")))}),c.addEventListener("error",(l=t(function(t){var l,s,u;return n(this,function(n){switch(n.label){case 0:if(a)return[2];return a=!0,[4,d.log.error("Elements script onError event",{logType:"elementsScriptOnError",logOrigin:"loadScript",retryCount:r,event:{message:null==t?void 0:t.message,source:null==t?void 0:t.filename,lineno:null==t?void 0:t.lineno,colno:null==t?void 0:t.colno,error:null==t?void 0:t.error,target:null==t?void 0:t.target}})];case 1:n.sent(),n.label=2;case 2:return n.trys.push([2,3,,5]),null==c||c.remove(),[3,5];case 3:return l=n.sent(),[4,d.log.error("Error removing script from DOM on retry attempt ".concat(r),{logType:"scriptRemovalError",logOrigin:"loadScript",retryCount:r,removalError:l})];case 4:return n.sent(),[3,5];case 5:if(0===r)return O(e,r+1).then(o).catch(i),[2];n.label=6;case 6:return n.trys.push([6,12,,14]),[4,fetch(e)];case 7:if((s=n.sent()).ok)return[3,9];return[4,d.log.error("Second attempt to load elements script failed, fetch failed with status: ".concat(s.status,"."),{logType:"elementsScriptFetchFailure",logOrigin:"loadScript",retryCount:r,fetchResult:"error",fetchResponse:s})];case 8:return n.sent(),i(Error(g)),[3,11];case 9:return[4,d.log.error("Second attempt to load elements script failed, fetch success",{logType:"elementsScriptFetchFailure",logOrigin:"loadScript",retryCount:r,fetchResult:"success",fetchResponse:s})];case 10:n.sent(),i(Error(E)),n.label=11;case 11:return[3,14];case 12:return u=n.sent(),[4,d.log.error("Second attempt failed to load elements script failed, fetch network error.",{logType:"elementsScriptFetchError",logOrigin:"loadScript",retryCount:r,fetchResult:"error",fetchError:u})];case 13:return n.sent(),i(Error(E)),[3,14];case 14:return i((null==t?void 0:t.error)||(null==t?void 0:t.message)||Error(E)),[2]}})}),function(e){return l.apply(this,arguments)}))})},T=function(e){(null==e?void 0:e._devMode)&&(null==e?void 0:e.customDomain)&&console.warn("Dev mode and domain whitelabeling are both enabled - dev mode takes precedence.");var t=(null==e?void 0:e._devMode)?"https://js.flock-dev.com":(null==e?void 0:e.customDomain)?w(e.customDomain):"https://js.basistheory.com",r="".concat(t,"/web-elements/").concat("2.1.0"),n="".concat(r,"/client/index.js"),o="".concat(r,"/hosted-elements/");return(null==e?void 0:e.customDomain)&&!e._devMode,{origin:t,clientJsUrl:n,hostedElementsBaseUrl:o}},S=(s=t(function(e,i){var l,c,a,s,u,f,p,h,m;return n(this,function(v){switch(v.label){case 0:if(!e||0===e.length)throw Error("API key is required");return c=(l=T(i)).origin,a=l.clientJsUrl,s=l.hostedElementsBaseUrl,d.setBaseUrl(c),d.disableTelemetry(!!(null==i?void 0:i.disableTelemetry)),[4,(o||(o=new Promise(function(e,o){if(("undefined"==typeof window?"undefined":r(window))!=="object"){t(function(){return n(this,function(e){switch(e.label){case 0:return[4,d.log.warn(g,{logType:"elementsNonDomError",logOrigin:"loadElements"})];case 1:return e.sent(),o(Error(g)),[2]}})})();return}if(window.BasisTheoryElements){e(window.BasisTheoryElements);return}O(new URL(a).toString().replace(RegExp("\\/$","u"),""),0).then(e).catch(function(e){o(e)})})),o)];case 1:return[2,v.sent().init(e,s,!1,null===(u=null==i?void 0:i.useSameOriginApi)||void 0===u||u,null!==(f=null==i?void 0:i.disableTelemetry)&&void 0!==f&&f,null!==(p=null==i?void 0:i.debug)&&void 0!==p&&p,null!==(h=null==i?void 0:i.useUat)&&void 0!==h&&h,null!==(m=null==i?void 0:i.useNetworkCheck)&&void 0!==m&&m,(null==i?void 0:i.customDomain)?c:void 0)]}})}),function(e,t){return s.apply(this,arguments)}),k=((u=k||{}).DECIMAL="decimal",u.EMAIL="email",u.NONE="none",u.NUMERIC="numeric",u.SEARCH="search",u.TEL="tel",u.TEXT="text",u.URL="url",u);v(Error),v(Error),"undefined"!=typeof window&&document.currentScript&&!window.basistheory&&(window.basistheory=S)}();
|
package/dist/main/index.js
CHANGED
|
@@ -82,6 +82,34 @@ const $fe2ec396f58502a3$export$af88d00dbe7f521 = (()=>{
|
|
|
82
82
|
})();
|
|
83
83
|
|
|
84
84
|
|
|
85
|
+
class $3c527b4ad66b1eeb$export$925a29a6f046f0b5 extends Error {
|
|
86
|
+
constructor(message, details, /**
|
|
87
|
+
* @deprecated use {@link details}
|
|
88
|
+
*/ validation){
|
|
89
|
+
super(message), this.details = details, this.validation = validation;
|
|
90
|
+
this.name = 'BasisTheoryValidationError';
|
|
91
|
+
Object.setPrototypeOf(this, $3c527b4ad66b1eeb$export$925a29a6f046f0b5.prototype);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
const $bf863f47081878c5$export$8ec0597b01ce7a1a = (domain)=>{
|
|
97
|
+
if (typeof domain !== 'string' || !domain.trim()) throw new Error('Custom domain must be a non-empty string.');
|
|
98
|
+
let url;
|
|
99
|
+
try {
|
|
100
|
+
url = new URL(domain.toLowerCase().startsWith('http') ? domain : `https://${domain}`);
|
|
101
|
+
} catch {
|
|
102
|
+
throw new (0, $3c527b4ad66b1eeb$export$925a29a6f046f0b5)(`Invalid custom domain: "${domain}"`, {});
|
|
103
|
+
}
|
|
104
|
+
if (url.protocol !== 'https:') throw new (0, $3c527b4ad66b1eeb$export$925a29a6f046f0b5)(`Custom domain must use HTTPS (got "${url.protocol}")`, {});
|
|
105
|
+
if (url.pathname !== '/' || url.search || url.hash) throw new (0, $3c527b4ad66b1eeb$export$925a29a6f046f0b5)(`Custom domain must not include path, query, or hash (got "${url.href}")`, {});
|
|
106
|
+
if (url.port) throw new (0, $3c527b4ad66b1eeb$export$925a29a6f046f0b5)(`Custom domain must not include a port (got ":${url.port}")`, {});
|
|
107
|
+
const hostRegex = /^(?=.{1,253}$)([a-zA-Z0-9-]{1,63}\.)+[a-zA-Z]{2,63}$/;
|
|
108
|
+
if (!hostRegex.test(url.hostname)) throw new (0, $3c527b4ad66b1eeb$export$925a29a6f046f0b5)(`Invalid hostname: "${url.hostname}"`, {});
|
|
109
|
+
return url.origin;
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
|
|
85
113
|
const $426651baf7085210$export$74dcf80d122cf64e = (url)=>{
|
|
86
114
|
const existingScript = document.querySelector(`script[src^="${url}"]`);
|
|
87
115
|
if (existingScript) return existingScript;
|
|
@@ -318,33 +346,52 @@ const $6477b722f43d24f2$export$2b0a6e5a1c78018f = (elementsUrl)=>{
|
|
|
318
346
|
|
|
319
347
|
|
|
320
348
|
|
|
321
|
-
// Auto-generated version file
|
|
322
|
-
const $eef42ce81412d9ae$export$83d89fbfd8236492 = '1.24.2';
|
|
323
|
-
|
|
324
|
-
|
|
325
349
|
// Build-time generated URLs for regular deployment
|
|
326
350
|
const $5dbc1ef1648671b0$export$67c92c3b857d033a = null;
|
|
327
351
|
const $5dbc1ef1648671b0$export$9c5c779c8690dca6 = null;
|
|
328
352
|
|
|
329
353
|
|
|
330
|
-
|
|
331
|
-
const $
|
|
354
|
+
// Auto-generated version file
|
|
355
|
+
const $eef42ce81412d9ae$export$83d89fbfd8236492 = '2.1.0';
|
|
356
|
+
|
|
357
|
+
|
|
358
|
+
const $316c9c8f85cead13$var$TEST_ORIGIN = 'https://js.flock-dev.com';
|
|
359
|
+
const $316c9c8f85cead13$var$DEFAULT_ORIGIN = 'https://js.basistheory.com';
|
|
360
|
+
const $316c9c8f85cead13$var$resolveUrls = (options)=>{
|
|
361
|
+
if (options?._devMode && options?.customDomain) console.warn('Dev mode and domain whitelabeling are both enabled - dev mode takes precedence.');
|
|
362
|
+
let origin;
|
|
363
|
+
if (options?._devMode) origin = $316c9c8f85cead13$var$TEST_ORIGIN;
|
|
364
|
+
else if (options?.customDomain) origin = (0, $bf863f47081878c5$export$8ec0597b01ce7a1a)(options.customDomain);
|
|
365
|
+
else origin = $316c9c8f85cead13$var$DEFAULT_ORIGIN;
|
|
366
|
+
const base = `${origin}/web-elements/${(0, $eef42ce81412d9ae$export$83d89fbfd8236492)}`;
|
|
367
|
+
const client = `${base}/client/index.js`;
|
|
368
|
+
const hosted = `${base}/hosted-elements/`;
|
|
369
|
+
if (options?.customDomain && !options._devMode) return {
|
|
370
|
+
origin: origin,
|
|
371
|
+
clientJsUrl: client,
|
|
372
|
+
hostedElementsBaseUrl: hosted
|
|
373
|
+
};
|
|
374
|
+
return {
|
|
375
|
+
origin: origin,
|
|
376
|
+
clientJsUrl: (0, $5dbc1ef1648671b0$export$67c92c3b857d033a) ?? client,
|
|
377
|
+
hostedElementsBaseUrl: (0, $5dbc1ef1648671b0$export$9c5c779c8690dca6) ?? hosted
|
|
378
|
+
};
|
|
379
|
+
};
|
|
332
380
|
const $316c9c8f85cead13$export$cbe2892587230861 = async (apiKey, options)=>{
|
|
333
381
|
if (!apiKey || apiKey.length === 0) throw new Error('API key is required');
|
|
334
|
-
const
|
|
335
|
-
(0, $fe2ec396f58502a3$export$af88d00dbe7f521).setBaseUrl(
|
|
382
|
+
const { origin: origin, clientJsUrl: clientJsUrl, hostedElementsBaseUrl: hostedElementsBaseUrl } = $316c9c8f85cead13$var$resolveUrls(options);
|
|
383
|
+
(0, $fe2ec396f58502a3$export$af88d00dbe7f521).setBaseUrl(origin);
|
|
336
384
|
(0, $fe2ec396f58502a3$export$af88d00dbe7f521).disableTelemetry(Boolean(options?.disableTelemetry));
|
|
337
|
-
// Use build-time generated URLs if available, otherwise fall back to version-based URLs
|
|
338
|
-
const clientJsUrl = (0, $5dbc1ef1648671b0$export$67c92c3b857d033a) || `https://${baseUrl}/web-elements/${0, $eef42ce81412d9ae$export$83d89fbfd8236492}/client/index.js`;
|
|
339
|
-
const hostedElementsBaseUrl = (0, $5dbc1ef1648671b0$export$9c5c779c8690dca6) || `https://${baseUrl}/web-elements/${0, $eef42ce81412d9ae$export$83d89fbfd8236492}/hosted-elements/`;
|
|
340
385
|
const elements = await (0, $6477b722f43d24f2$export$2b0a6e5a1c78018f)(clientJsUrl);
|
|
341
|
-
return elements.init(apiKey, hostedElementsBaseUrl, false, options?.useSameOriginApi ?? true, options?.disableTelemetry ?? false, options?.debug ?? false, options?.useUat ?? false, options?.useNetworkCheck ?? false);
|
|
386
|
+
return elements.init(apiKey, hostedElementsBaseUrl, false, options?.useSameOriginApi ?? true, options?.disableTelemetry ?? false, options?.debug ?? false, options?.useUat ?? false, options?.useNetworkCheck ?? false, options?.customDomain ? origin : undefined);
|
|
342
387
|
};
|
|
343
388
|
|
|
344
389
|
|
|
345
390
|
var $001f46d7c9d998c1$exports = {};
|
|
346
391
|
|
|
392
|
+
$parcel$export($001f46d7c9d998c1$exports, "AUTOCOMPLETE_VALUES", () => $ef6e1b024b683770$export$dea6ebbc92df4fa3);
|
|
347
393
|
$parcel$export($001f46d7c9d998c1$exports, "CARD_BRANDS", () => $ef6e1b024b683770$export$51be6d94c4fcf45);
|
|
394
|
+
$parcel$export($001f46d7c9d998c1$exports, "CARD_ICON_POSITIONS", () => $ef6e1b024b683770$export$829c91d8f039f695);
|
|
348
395
|
var $94e2e5607fad631e$exports = {};
|
|
349
396
|
var $eb72fa80cc6cce99$exports = {};
|
|
350
397
|
|
|
@@ -841,6 +888,7 @@ const $2ac94b510629d419$export$8141e4f9a897abe6 = [
|
|
|
841
888
|
'cardExpirationDate',
|
|
842
889
|
'cardNumber',
|
|
843
890
|
'cardVerificationCode',
|
|
891
|
+
'copyButton',
|
|
844
892
|
'data',
|
|
845
893
|
'text'
|
|
846
894
|
];
|
|
@@ -882,11 +930,14 @@ var $e6da8ffa145ef6b4$exports = {};
|
|
|
882
930
|
var $79ee1b48c572ec2c$exports = {};
|
|
883
931
|
|
|
884
932
|
$parcel$export($79ee1b48c572ec2c$exports, "SAFE_CSS_PROPERTIES", () => $79ee1b48c572ec2c$export$e2bf52fc7723ec89);
|
|
933
|
+
$parcel$export($79ee1b48c572ec2c$exports, "BUTTON_CSS_PROPERTIES", () => $79ee1b48c572ec2c$export$93133f730762aee4);
|
|
885
934
|
$parcel$export($79ee1b48c572ec2c$exports, "SAFE_CSS_PROPERTIES_ALTERNATES", () => $79ee1b48c572ec2c$export$e22a44f86989e3f4);
|
|
886
935
|
$parcel$export($79ee1b48c572ec2c$exports, "SAFE_CSS_PROPERTIES_WITH_ALTERNATES", () => $79ee1b48c572ec2c$export$b5b27feb4cf29129);
|
|
887
936
|
$parcel$export($79ee1b48c572ec2c$exports, "CARD_ELEMENT_STYLE_VARIANT_SELECTORS", () => $79ee1b48c572ec2c$export$fc323aec0bf844b);
|
|
937
|
+
$parcel$export($79ee1b48c572ec2c$exports, "BUTTON_ELEMENT_STYLE_VARIANT_SELECTORS", () => $79ee1b48c572ec2c$export$8cce4e63ba22bae);
|
|
888
938
|
$parcel$export($79ee1b48c572ec2c$exports, "CARD_ELEMENT_STYLE_VARIANTS", () => $79ee1b48c572ec2c$export$a15fff7fac404fd9);
|
|
889
939
|
$parcel$export($79ee1b48c572ec2c$exports, "CARD_ELEMENT_STYLE_FONTS_ATTR", () => $79ee1b48c572ec2c$export$c3a88e1ff160bfd6);
|
|
940
|
+
$parcel$export($79ee1b48c572ec2c$exports, "BUTTON_ELEMENT_STYLE_VARIANTS", () => $79ee1b48c572ec2c$export$612b2fbe2f6ee5db);
|
|
890
941
|
const $79ee1b48c572ec2c$export$e2bf52fc7723ec89 = [
|
|
891
942
|
'backgroundColor',
|
|
892
943
|
'color',
|
|
@@ -896,14 +947,53 @@ const $79ee1b48c572ec2c$export$e2bf52fc7723ec89 = [
|
|
|
896
947
|
'fontStyle',
|
|
897
948
|
'fontVariant',
|
|
898
949
|
'fontWeight',
|
|
899
|
-
'lineHeight',
|
|
900
950
|
'letterSpacing',
|
|
901
|
-
'
|
|
951
|
+
'lineHeight',
|
|
902
952
|
'padding',
|
|
953
|
+
'textAlign',
|
|
903
954
|
'textDecoration',
|
|
904
955
|
'textShadow',
|
|
905
956
|
'textTransform'
|
|
906
957
|
];
|
|
958
|
+
// Button-specific CSS properties for styling interactive buttons
|
|
959
|
+
const $79ee1b48c572ec2c$export$93133f730762aee4 = [
|
|
960
|
+
'alignItems',
|
|
961
|
+
'backgroundColor',
|
|
962
|
+
'border',
|
|
963
|
+
'borderBottom',
|
|
964
|
+
'borderColor',
|
|
965
|
+
'borderLeft',
|
|
966
|
+
'borderRadius',
|
|
967
|
+
'borderRight',
|
|
968
|
+
'borderStyle',
|
|
969
|
+
'borderTop',
|
|
970
|
+
'borderWidth',
|
|
971
|
+
'boxShadow',
|
|
972
|
+
'color',
|
|
973
|
+
'cursor',
|
|
974
|
+
'display',
|
|
975
|
+
'fontFamily',
|
|
976
|
+
'fontSize',
|
|
977
|
+
'fontWeight',
|
|
978
|
+
'gap',
|
|
979
|
+
'height',
|
|
980
|
+
'justifyContent',
|
|
981
|
+
'letterSpacing',
|
|
982
|
+
'lineHeight',
|
|
983
|
+
'margin',
|
|
984
|
+
'maxHeight',
|
|
985
|
+
'maxWidth',
|
|
986
|
+
'minHeight',
|
|
987
|
+
'minWidth',
|
|
988
|
+
'opacity',
|
|
989
|
+
'outline',
|
|
990
|
+
'padding',
|
|
991
|
+
'textAlign',
|
|
992
|
+
'textTransform',
|
|
993
|
+
'transform',
|
|
994
|
+
'transition',
|
|
995
|
+
'width'
|
|
996
|
+
];
|
|
907
997
|
const $79ee1b48c572ec2c$export$e22a44f86989e3f4 = {
|
|
908
998
|
fontSmooth: [
|
|
909
999
|
'-webkit-font-smoothing',
|
|
@@ -919,13 +1009,23 @@ const $79ee1b48c572ec2c$export$fc323aec0bf844b = [
|
|
|
919
1009
|
'::selection',
|
|
920
1010
|
':disabled'
|
|
921
1011
|
];
|
|
1012
|
+
const $79ee1b48c572ec2c$export$8cce4e63ba22bae = [
|
|
1013
|
+
':hover',
|
|
1014
|
+
':focus',
|
|
1015
|
+
':active'
|
|
1016
|
+
];
|
|
922
1017
|
const $79ee1b48c572ec2c$export$a15fff7fac404fd9 = [
|
|
923
1018
|
'base',
|
|
1019
|
+
'container',
|
|
924
1020
|
'complete',
|
|
925
1021
|
'invalid',
|
|
926
1022
|
'empty'
|
|
927
1023
|
];
|
|
928
1024
|
const $79ee1b48c572ec2c$export$c3a88e1ff160bfd6 = 'fonts';
|
|
1025
|
+
const $79ee1b48c572ec2c$export$612b2fbe2f6ee5db = [
|
|
1026
|
+
'base',
|
|
1027
|
+
'container'
|
|
1028
|
+
];
|
|
929
1029
|
|
|
930
1030
|
|
|
931
1031
|
$parcel$exportWildcard($94e2e5607fad631e$exports, $eb72fa80cc6cce99$exports);
|
|
@@ -1025,16 +1125,6 @@ class $d4608c0b4e5d8cb4$export$5a9a4feb38dee587 extends Error {
|
|
|
1025
1125
|
}
|
|
1026
1126
|
|
|
1027
1127
|
|
|
1028
|
-
class $3c527b4ad66b1eeb$export$925a29a6f046f0b5 extends Error {
|
|
1029
|
-
constructor(message, details, /**
|
|
1030
|
-
* @deprecated use {@link details}
|
|
1031
|
-
*/ validation){
|
|
1032
|
-
super(message), this.details = details, this.validation = validation;
|
|
1033
|
-
this.name = 'BasisTheoryValidationError';
|
|
1034
|
-
Object.setPrototypeOf(this, $3c527b4ad66b1eeb$export$925a29a6f046f0b5.prototype);
|
|
1035
|
-
}
|
|
1036
|
-
}
|
|
1037
|
-
|
|
1038
1128
|
|
|
1039
1129
|
class $815b13df3d182116$export$83d862a6bd4a93c5 extends Error {
|
|
1040
1130
|
constructor(message, status, data, headers){
|
package/dist/module/module.js
CHANGED
|
@@ -82,6 +82,34 @@ const $367e4a81566d966b$export$af88d00dbe7f521 = (()=>{
|
|
|
82
82
|
})();
|
|
83
83
|
|
|
84
84
|
|
|
85
|
+
class $16b549d313b97bf4$export$925a29a6f046f0b5 extends Error {
|
|
86
|
+
constructor(message, details, /**
|
|
87
|
+
* @deprecated use {@link details}
|
|
88
|
+
*/ validation){
|
|
89
|
+
super(message), this.details = details, this.validation = validation;
|
|
90
|
+
this.name = 'BasisTheoryValidationError';
|
|
91
|
+
Object.setPrototypeOf(this, $16b549d313b97bf4$export$925a29a6f046f0b5.prototype);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
const $c03aa13093e09dc3$export$8ec0597b01ce7a1a = (domain)=>{
|
|
97
|
+
if (typeof domain !== 'string' || !domain.trim()) throw new Error('Custom domain must be a non-empty string.');
|
|
98
|
+
let url;
|
|
99
|
+
try {
|
|
100
|
+
url = new URL(domain.toLowerCase().startsWith('http') ? domain : `https://${domain}`);
|
|
101
|
+
} catch {
|
|
102
|
+
throw new (0, $16b549d313b97bf4$export$925a29a6f046f0b5)(`Invalid custom domain: "${domain}"`, {});
|
|
103
|
+
}
|
|
104
|
+
if (url.protocol !== 'https:') throw new (0, $16b549d313b97bf4$export$925a29a6f046f0b5)(`Custom domain must use HTTPS (got "${url.protocol}")`, {});
|
|
105
|
+
if (url.pathname !== '/' || url.search || url.hash) throw new (0, $16b549d313b97bf4$export$925a29a6f046f0b5)(`Custom domain must not include path, query, or hash (got "${url.href}")`, {});
|
|
106
|
+
if (url.port) throw new (0, $16b549d313b97bf4$export$925a29a6f046f0b5)(`Custom domain must not include a port (got ":${url.port}")`, {});
|
|
107
|
+
const hostRegex = /^(?=.{1,253}$)([a-zA-Z0-9-]{1,63}\.)+[a-zA-Z]{2,63}$/;
|
|
108
|
+
if (!hostRegex.test(url.hostname)) throw new (0, $16b549d313b97bf4$export$925a29a6f046f0b5)(`Invalid hostname: "${url.hostname}"`, {});
|
|
109
|
+
return url.origin;
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
|
|
85
113
|
const $0da125a57a8274fc$export$74dcf80d122cf64e = (url)=>{
|
|
86
114
|
const existingScript = document.querySelector(`script[src^="${url}"]`);
|
|
87
115
|
if (existingScript) return existingScript;
|
|
@@ -318,33 +346,52 @@ const $2cc07a9862fd14af$export$2b0a6e5a1c78018f = (elementsUrl)=>{
|
|
|
318
346
|
|
|
319
347
|
|
|
320
348
|
|
|
321
|
-
// Auto-generated version file
|
|
322
|
-
const $6a2f0bfcc5905f21$export$83d89fbfd8236492 = '1.24.2';
|
|
323
|
-
|
|
324
|
-
|
|
325
349
|
// Build-time generated URLs for regular deployment
|
|
326
350
|
const $c9bd4b894cc03378$export$67c92c3b857d033a = null;
|
|
327
351
|
const $c9bd4b894cc03378$export$9c5c779c8690dca6 = null;
|
|
328
352
|
|
|
329
353
|
|
|
330
|
-
|
|
331
|
-
const $
|
|
354
|
+
// Auto-generated version file
|
|
355
|
+
const $6a2f0bfcc5905f21$export$83d89fbfd8236492 = '2.1.0';
|
|
356
|
+
|
|
357
|
+
|
|
358
|
+
const $65168f0452925da7$var$TEST_ORIGIN = 'https://js.flock-dev.com';
|
|
359
|
+
const $65168f0452925da7$var$DEFAULT_ORIGIN = 'https://js.basistheory.com';
|
|
360
|
+
const $65168f0452925da7$var$resolveUrls = (options)=>{
|
|
361
|
+
if (options?._devMode && options?.customDomain) console.warn('Dev mode and domain whitelabeling are both enabled - dev mode takes precedence.');
|
|
362
|
+
let origin;
|
|
363
|
+
if (options?._devMode) origin = $65168f0452925da7$var$TEST_ORIGIN;
|
|
364
|
+
else if (options?.customDomain) origin = (0, $c03aa13093e09dc3$export$8ec0597b01ce7a1a)(options.customDomain);
|
|
365
|
+
else origin = $65168f0452925da7$var$DEFAULT_ORIGIN;
|
|
366
|
+
const base = `${origin}/web-elements/${(0, $6a2f0bfcc5905f21$export$83d89fbfd8236492)}`;
|
|
367
|
+
const client = `${base}/client/index.js`;
|
|
368
|
+
const hosted = `${base}/hosted-elements/`;
|
|
369
|
+
if (options?.customDomain && !options._devMode) return {
|
|
370
|
+
origin: origin,
|
|
371
|
+
clientJsUrl: client,
|
|
372
|
+
hostedElementsBaseUrl: hosted
|
|
373
|
+
};
|
|
374
|
+
return {
|
|
375
|
+
origin: origin,
|
|
376
|
+
clientJsUrl: (0, $c9bd4b894cc03378$export$67c92c3b857d033a) ?? client,
|
|
377
|
+
hostedElementsBaseUrl: (0, $c9bd4b894cc03378$export$9c5c779c8690dca6) ?? hosted
|
|
378
|
+
};
|
|
379
|
+
};
|
|
332
380
|
const $65168f0452925da7$export$cbe2892587230861 = async (apiKey, options)=>{
|
|
333
381
|
if (!apiKey || apiKey.length === 0) throw new Error('API key is required');
|
|
334
|
-
const
|
|
335
|
-
(0, $367e4a81566d966b$export$af88d00dbe7f521).setBaseUrl(
|
|
382
|
+
const { origin: origin, clientJsUrl: clientJsUrl, hostedElementsBaseUrl: hostedElementsBaseUrl } = $65168f0452925da7$var$resolveUrls(options);
|
|
383
|
+
(0, $367e4a81566d966b$export$af88d00dbe7f521).setBaseUrl(origin);
|
|
336
384
|
(0, $367e4a81566d966b$export$af88d00dbe7f521).disableTelemetry(Boolean(options?.disableTelemetry));
|
|
337
|
-
// Use build-time generated URLs if available, otherwise fall back to version-based URLs
|
|
338
|
-
const clientJsUrl = (0, $c9bd4b894cc03378$export$67c92c3b857d033a) || `https://${baseUrl}/web-elements/${0, $6a2f0bfcc5905f21$export$83d89fbfd8236492}/client/index.js`;
|
|
339
|
-
const hostedElementsBaseUrl = (0, $c9bd4b894cc03378$export$9c5c779c8690dca6) || `https://${baseUrl}/web-elements/${0, $6a2f0bfcc5905f21$export$83d89fbfd8236492}/hosted-elements/`;
|
|
340
385
|
const elements = await (0, $2cc07a9862fd14af$export$2b0a6e5a1c78018f)(clientJsUrl);
|
|
341
|
-
return elements.init(apiKey, hostedElementsBaseUrl, false, options?.useSameOriginApi ?? true, options?.disableTelemetry ?? false, options?.debug ?? false, options?.useUat ?? false, options?.useNetworkCheck ?? false);
|
|
386
|
+
return elements.init(apiKey, hostedElementsBaseUrl, false, options?.useSameOriginApi ?? true, options?.disableTelemetry ?? false, options?.debug ?? false, options?.useUat ?? false, options?.useNetworkCheck ?? false, options?.customDomain ? origin : undefined);
|
|
342
387
|
};
|
|
343
388
|
|
|
344
389
|
|
|
345
390
|
var $e8df50a6ced49e58$exports = {};
|
|
346
391
|
|
|
392
|
+
$parcel$export($e8df50a6ced49e58$exports, "AUTOCOMPLETE_VALUES", () => $2e9038c0999bba06$export$dea6ebbc92df4fa3);
|
|
347
393
|
$parcel$export($e8df50a6ced49e58$exports, "CARD_BRANDS", () => $2e9038c0999bba06$export$51be6d94c4fcf45);
|
|
394
|
+
$parcel$export($e8df50a6ced49e58$exports, "CARD_ICON_POSITIONS", () => $2e9038c0999bba06$export$829c91d8f039f695);
|
|
348
395
|
var $8142f8fc8bbedd0b$exports = {};
|
|
349
396
|
var $6011935a2a75da1d$exports = {};
|
|
350
397
|
|
|
@@ -841,6 +888,7 @@ const $0b7f2ce91f71c8fb$export$8141e4f9a897abe6 = [
|
|
|
841
888
|
'cardExpirationDate',
|
|
842
889
|
'cardNumber',
|
|
843
890
|
'cardVerificationCode',
|
|
891
|
+
'copyButton',
|
|
844
892
|
'data',
|
|
845
893
|
'text'
|
|
846
894
|
];
|
|
@@ -882,11 +930,14 @@ var $5c3fd4ec5ab25a5b$exports = {};
|
|
|
882
930
|
var $ce70703c3ce2f3a0$exports = {};
|
|
883
931
|
|
|
884
932
|
$parcel$export($ce70703c3ce2f3a0$exports, "SAFE_CSS_PROPERTIES", () => $ce70703c3ce2f3a0$export$e2bf52fc7723ec89);
|
|
933
|
+
$parcel$export($ce70703c3ce2f3a0$exports, "BUTTON_CSS_PROPERTIES", () => $ce70703c3ce2f3a0$export$93133f730762aee4);
|
|
885
934
|
$parcel$export($ce70703c3ce2f3a0$exports, "SAFE_CSS_PROPERTIES_ALTERNATES", () => $ce70703c3ce2f3a0$export$e22a44f86989e3f4);
|
|
886
935
|
$parcel$export($ce70703c3ce2f3a0$exports, "SAFE_CSS_PROPERTIES_WITH_ALTERNATES", () => $ce70703c3ce2f3a0$export$b5b27feb4cf29129);
|
|
887
936
|
$parcel$export($ce70703c3ce2f3a0$exports, "CARD_ELEMENT_STYLE_VARIANT_SELECTORS", () => $ce70703c3ce2f3a0$export$fc323aec0bf844b);
|
|
937
|
+
$parcel$export($ce70703c3ce2f3a0$exports, "BUTTON_ELEMENT_STYLE_VARIANT_SELECTORS", () => $ce70703c3ce2f3a0$export$8cce4e63ba22bae);
|
|
888
938
|
$parcel$export($ce70703c3ce2f3a0$exports, "CARD_ELEMENT_STYLE_VARIANTS", () => $ce70703c3ce2f3a0$export$a15fff7fac404fd9);
|
|
889
939
|
$parcel$export($ce70703c3ce2f3a0$exports, "CARD_ELEMENT_STYLE_FONTS_ATTR", () => $ce70703c3ce2f3a0$export$c3a88e1ff160bfd6);
|
|
940
|
+
$parcel$export($ce70703c3ce2f3a0$exports, "BUTTON_ELEMENT_STYLE_VARIANTS", () => $ce70703c3ce2f3a0$export$612b2fbe2f6ee5db);
|
|
890
941
|
const $ce70703c3ce2f3a0$export$e2bf52fc7723ec89 = [
|
|
891
942
|
'backgroundColor',
|
|
892
943
|
'color',
|
|
@@ -896,14 +947,53 @@ const $ce70703c3ce2f3a0$export$e2bf52fc7723ec89 = [
|
|
|
896
947
|
'fontStyle',
|
|
897
948
|
'fontVariant',
|
|
898
949
|
'fontWeight',
|
|
899
|
-
'lineHeight',
|
|
900
950
|
'letterSpacing',
|
|
901
|
-
'
|
|
951
|
+
'lineHeight',
|
|
902
952
|
'padding',
|
|
953
|
+
'textAlign',
|
|
903
954
|
'textDecoration',
|
|
904
955
|
'textShadow',
|
|
905
956
|
'textTransform'
|
|
906
957
|
];
|
|
958
|
+
// Button-specific CSS properties for styling interactive buttons
|
|
959
|
+
const $ce70703c3ce2f3a0$export$93133f730762aee4 = [
|
|
960
|
+
'alignItems',
|
|
961
|
+
'backgroundColor',
|
|
962
|
+
'border',
|
|
963
|
+
'borderBottom',
|
|
964
|
+
'borderColor',
|
|
965
|
+
'borderLeft',
|
|
966
|
+
'borderRadius',
|
|
967
|
+
'borderRight',
|
|
968
|
+
'borderStyle',
|
|
969
|
+
'borderTop',
|
|
970
|
+
'borderWidth',
|
|
971
|
+
'boxShadow',
|
|
972
|
+
'color',
|
|
973
|
+
'cursor',
|
|
974
|
+
'display',
|
|
975
|
+
'fontFamily',
|
|
976
|
+
'fontSize',
|
|
977
|
+
'fontWeight',
|
|
978
|
+
'gap',
|
|
979
|
+
'height',
|
|
980
|
+
'justifyContent',
|
|
981
|
+
'letterSpacing',
|
|
982
|
+
'lineHeight',
|
|
983
|
+
'margin',
|
|
984
|
+
'maxHeight',
|
|
985
|
+
'maxWidth',
|
|
986
|
+
'minHeight',
|
|
987
|
+
'minWidth',
|
|
988
|
+
'opacity',
|
|
989
|
+
'outline',
|
|
990
|
+
'padding',
|
|
991
|
+
'textAlign',
|
|
992
|
+
'textTransform',
|
|
993
|
+
'transform',
|
|
994
|
+
'transition',
|
|
995
|
+
'width'
|
|
996
|
+
];
|
|
907
997
|
const $ce70703c3ce2f3a0$export$e22a44f86989e3f4 = {
|
|
908
998
|
fontSmooth: [
|
|
909
999
|
'-webkit-font-smoothing',
|
|
@@ -919,13 +1009,23 @@ const $ce70703c3ce2f3a0$export$fc323aec0bf844b = [
|
|
|
919
1009
|
'::selection',
|
|
920
1010
|
':disabled'
|
|
921
1011
|
];
|
|
1012
|
+
const $ce70703c3ce2f3a0$export$8cce4e63ba22bae = [
|
|
1013
|
+
':hover',
|
|
1014
|
+
':focus',
|
|
1015
|
+
':active'
|
|
1016
|
+
];
|
|
922
1017
|
const $ce70703c3ce2f3a0$export$a15fff7fac404fd9 = [
|
|
923
1018
|
'base',
|
|
1019
|
+
'container',
|
|
924
1020
|
'complete',
|
|
925
1021
|
'invalid',
|
|
926
1022
|
'empty'
|
|
927
1023
|
];
|
|
928
1024
|
const $ce70703c3ce2f3a0$export$c3a88e1ff160bfd6 = 'fonts';
|
|
1025
|
+
const $ce70703c3ce2f3a0$export$612b2fbe2f6ee5db = [
|
|
1026
|
+
'base',
|
|
1027
|
+
'container'
|
|
1028
|
+
];
|
|
929
1029
|
|
|
930
1030
|
|
|
931
1031
|
$parcel$exportWildcard($8142f8fc8bbedd0b$exports, $6011935a2a75da1d$exports);
|
|
@@ -1025,16 +1125,6 @@ class $cc8dceaa5ea02f81$export$5a9a4feb38dee587 extends Error {
|
|
|
1025
1125
|
}
|
|
1026
1126
|
|
|
1027
1127
|
|
|
1028
|
-
class $16b549d313b97bf4$export$925a29a6f046f0b5 extends Error {
|
|
1029
|
-
constructor(message, details, /**
|
|
1030
|
-
* @deprecated use {@link details}
|
|
1031
|
-
*/ validation){
|
|
1032
|
-
super(message), this.details = details, this.validation = validation;
|
|
1033
|
-
this.name = 'BasisTheoryValidationError';
|
|
1034
|
-
Object.setPrototypeOf(this, $16b549d313b97bf4$export$925a29a6f046f0b5.prototype);
|
|
1035
|
-
}
|
|
1036
|
-
}
|
|
1037
|
-
|
|
1038
1128
|
|
|
1039
1129
|
class $3753a300b9392464$export$83d862a6bd4a93c5 extends Error {
|
|
1040
1130
|
constructor(message, status, data, headers){
|
|
@@ -1055,4 +1145,4 @@ class $3753a300b9392464$export$83d862a6bd4a93c5 extends Error {
|
|
|
1055
1145
|
*/ if (typeof window !== 'undefined' && document.currentScript && !window.basistheory) window.basistheory = (0, $65168f0452925da7$export$cbe2892587230861);
|
|
1056
1146
|
|
|
1057
1147
|
|
|
1058
|
-
export {$65168f0452925da7$export$cbe2892587230861 as basistheory, $2e9038c0999bba06$export$51be6d94c4fcf45 as CARD_BRANDS, $6011935a2a75da1d$export$1748c2651c2c6e25 as VISA, $6011935a2a75da1d$export$1c604828de4cf9cf as MASTERCARD, $6011935a2a75da1d$export$67c5e4e99638ee87 as AMERICAN_EXPRESS, $6011935a2a75da1d$export$fcf88132c9601d5d as DINERS_CLUB, $6011935a2a75da1d$export$27b2e48e28163360 as DISCOVER, $6011935a2a75da1d$export$bf30f1ca7b266454 as JCB, $6011935a2a75da1d$export$8ed8e9ea6bbca19f as UNION_PAY, $6011935a2a75da1d$export$f08651c87c943e8 as MAESTRO, $6011935a2a75da1d$export$c4b8f606caaecf2c as ELO, $6011935a2a75da1d$export$58f9d4150439d06e as MIR, $6011935a2a75da1d$export$8f50e2757841117b as HIPER, $6011935a2a75da1d$export$adb072c9761d9e59 as HIPERCARD, $6011935a2a75da1d$export$35b475386df8059d as DEFAULT_CARD_TYPES, $a7c0ed47a726bc77$export$8dde18ea9019c560 as CoBadgedSupport, $0b7f2ce91f71c8fb$export$8141e4f9a897abe6 as ELEMENTS_TYPES, $ce70703c3ce2f3a0$export$e2bf52fc7723ec89 as SAFE_CSS_PROPERTIES, $ce70703c3ce2f3a0$export$e22a44f86989e3f4 as SAFE_CSS_PROPERTIES_ALTERNATES, $ce70703c3ce2f3a0$export$b5b27feb4cf29129 as SAFE_CSS_PROPERTIES_WITH_ALTERNATES, $ce70703c3ce2f3a0$export$fc323aec0bf844b as CARD_ELEMENT_STYLE_VARIANT_SELECTORS, $ce70703c3ce2f3a0$export$a15fff7fac404fd9 as CARD_ELEMENT_STYLE_VARIANTS, $ce70703c3ce2f3a0$export$c3a88e1ff160bfd6 as CARD_ELEMENT_STYLE_FONTS_ATTR, $88bdfff2114854bc$export$f9a8af5874660c13 as DATA_CLASSIFICATIONS, $88bdfff2114854bc$export$7ea51ced9080f153 as DATA_IMPACT_LEVELS, $88bdfff2114854bc$export$23716d8c8b579500 as DATA_RESTRICTION_POLICIES, $cc8dceaa5ea02f81$export$5a9a4feb38dee587 as BasisTheoryApiError, $16b549d313b97bf4$export$925a29a6f046f0b5 as BasisTheoryValidationError, $3753a300b9392464$export$83d862a6bd4a93c5 as HttpClientError};
|
|
1148
|
+
export {$65168f0452925da7$export$cbe2892587230861 as basistheory, $2e9038c0999bba06$export$dea6ebbc92df4fa3 as AUTOCOMPLETE_VALUES, $2e9038c0999bba06$export$51be6d94c4fcf45 as CARD_BRANDS, $2e9038c0999bba06$export$829c91d8f039f695 as CARD_ICON_POSITIONS, $6011935a2a75da1d$export$1748c2651c2c6e25 as VISA, $6011935a2a75da1d$export$1c604828de4cf9cf as MASTERCARD, $6011935a2a75da1d$export$67c5e4e99638ee87 as AMERICAN_EXPRESS, $6011935a2a75da1d$export$fcf88132c9601d5d as DINERS_CLUB, $6011935a2a75da1d$export$27b2e48e28163360 as DISCOVER, $6011935a2a75da1d$export$bf30f1ca7b266454 as JCB, $6011935a2a75da1d$export$8ed8e9ea6bbca19f as UNION_PAY, $6011935a2a75da1d$export$f08651c87c943e8 as MAESTRO, $6011935a2a75da1d$export$c4b8f606caaecf2c as ELO, $6011935a2a75da1d$export$58f9d4150439d06e as MIR, $6011935a2a75da1d$export$8f50e2757841117b as HIPER, $6011935a2a75da1d$export$adb072c9761d9e59 as HIPERCARD, $6011935a2a75da1d$export$35b475386df8059d as DEFAULT_CARD_TYPES, $a7c0ed47a726bc77$export$8dde18ea9019c560 as CoBadgedSupport, $0b7f2ce91f71c8fb$export$8141e4f9a897abe6 as ELEMENTS_TYPES, $ce70703c3ce2f3a0$export$e2bf52fc7723ec89 as SAFE_CSS_PROPERTIES, $ce70703c3ce2f3a0$export$93133f730762aee4 as BUTTON_CSS_PROPERTIES, $ce70703c3ce2f3a0$export$e22a44f86989e3f4 as SAFE_CSS_PROPERTIES_ALTERNATES, $ce70703c3ce2f3a0$export$b5b27feb4cf29129 as SAFE_CSS_PROPERTIES_WITH_ALTERNATES, $ce70703c3ce2f3a0$export$fc323aec0bf844b as CARD_ELEMENT_STYLE_VARIANT_SELECTORS, $ce70703c3ce2f3a0$export$8cce4e63ba22bae as BUTTON_ELEMENT_STYLE_VARIANT_SELECTORS, $ce70703c3ce2f3a0$export$a15fff7fac404fd9 as CARD_ELEMENT_STYLE_VARIANTS, $ce70703c3ce2f3a0$export$c3a88e1ff160bfd6 as CARD_ELEMENT_STYLE_FONTS_ATTR, $ce70703c3ce2f3a0$export$612b2fbe2f6ee5db as BUTTON_ELEMENT_STYLE_VARIANTS, $88bdfff2114854bc$export$f9a8af5874660c13 as DATA_CLASSIFICATIONS, $88bdfff2114854bc$export$7ea51ced9080f153 as DATA_IMPACT_LEVELS, $88bdfff2114854bc$export$23716d8c8b579500 as DATA_RESTRICTION_POLICIES, $cc8dceaa5ea02f81$export$5a9a4feb38dee587 as BasisTheoryApiError, $16b549d313b97bf4$export$925a29a6f046f0b5 as BasisTheoryValidationError, $3753a300b9392464$export$83d862a6bd4a93c5 as HttpClientError};
|
package/dist/package.json
CHANGED
package/dist/types/index.d.ts
CHANGED
|
@@ -39,9 +39,55 @@ export interface HttpClient {
|
|
|
39
39
|
get(url: string, config?: RequestConfig): Promise<unknown>;
|
|
40
40
|
delete(url: string, config?: RequestConfig): Promise<unknown>;
|
|
41
41
|
}
|
|
42
|
+
interface NetworkInformation {
|
|
43
|
+
downlink: number;
|
|
44
|
+
downlinkMax?: number;
|
|
45
|
+
effectiveType: 'slow-2g' | '2g' | '3g' | '4g';
|
|
46
|
+
rtt: number;
|
|
47
|
+
saveData: boolean;
|
|
48
|
+
type?: 'bluetooth' | 'cellular' | 'ethernet' | 'none' | 'wifi' | 'wimax' | 'other' | 'unknown';
|
|
49
|
+
}
|
|
50
|
+
type DeviceInfo = {
|
|
51
|
+
uaBrands?: Array<{
|
|
52
|
+
brand: string;
|
|
53
|
+
version: string;
|
|
54
|
+
}>;
|
|
55
|
+
uaMobile?: boolean;
|
|
56
|
+
uaPlatform?: string;
|
|
57
|
+
uaPlatformVersion?: string;
|
|
58
|
+
languages?: string[];
|
|
59
|
+
timeZone?: string;
|
|
60
|
+
cookiesEnabled?: boolean;
|
|
61
|
+
localStorageEnabled?: boolean;
|
|
62
|
+
sessionStorageEnabled?: boolean;
|
|
63
|
+
platform?: string;
|
|
64
|
+
hardwareConcurrency?: number;
|
|
65
|
+
deviceMemoryGb?: number | null;
|
|
66
|
+
screenWidth?: number;
|
|
67
|
+
screenHeight?: number;
|
|
68
|
+
screenAvailWidth?: number;
|
|
69
|
+
screenAvailHeight?: number;
|
|
70
|
+
innerWidth?: number;
|
|
71
|
+
innerHeight?: number;
|
|
72
|
+
devicePixelRatio?: number;
|
|
73
|
+
maxTouchPoints?: number;
|
|
74
|
+
plugins?: string[];
|
|
75
|
+
mimeTypes?: string[];
|
|
76
|
+
webdriver?: boolean;
|
|
77
|
+
suspectedHeadless?: boolean;
|
|
78
|
+
webglVendor?: string;
|
|
79
|
+
webglRenderer?: string;
|
|
80
|
+
canvasHash?: string;
|
|
81
|
+
network?: NetworkInformation;
|
|
82
|
+
};
|
|
83
|
+
interface Device {
|
|
84
|
+
getDeviceInfo(options?: {
|
|
85
|
+
includeCanvasHash?: boolean;
|
|
86
|
+
}): DeviceInfo;
|
|
87
|
+
}
|
|
42
88
|
export const CARD_BRANDS: readonly ["accel", "bancontact", "cartes-bancaires", "culiance", "dankort", "ebt", "eftpos-australia", "nyce", "private-label", "prop", "pulse", "rupay", "star", "uatp", "korean-local", "visa", "mastercard", "american-express", "discover", "diners-club", "jcb", "unionpay", "maestro", "elo", "hiper", "hipercard", "mir", "unknown"];
|
|
43
|
-
|
|
44
|
-
|
|
89
|
+
export const CARD_ICON_POSITIONS: readonly ["left", "right", "none"];
|
|
90
|
+
export const AUTOCOMPLETE_VALUES: readonly ["additional-name", "address-level1", "address-level2", "address-level3", "address-level4", "address-line1", "address-line2", "address-line3", "bday-day", "bday-month", "bday-year", "bday", "billing", "cc-additional-name", "cc-csc", "cc-exp-month", "cc-exp-year", "cc-exp", "cc-family-name", "cc-given-name", "cc-name", "cc-number", "cc-type", "country-name", "country", "current-password", "email", "family-name", "fax", "given-name", "home", "honorific-prefix", "honorific-suffix", "language", "mobile", "name", "new-password", "nickname", "off", "on", "one-time-code", "organization-title", "organization", "page", "postal-code", "sex", "shipping", "street-address", "tel-area-code", "tel-country-code", "tel-extension", "tel-local-prefix", "tel-local-suffix", "tel-local", "tel-national", "tel", "transaction-amount", "transaction-currency", "url", "username", "work"];
|
|
45
91
|
export type FieldErrorType = 'incomplete' | 'invalid';
|
|
46
92
|
export type ConfigErrorType = 'missing-configuration' | 'missing-permission' | 'invalid-configuration';
|
|
47
93
|
export interface ConfigError {
|
|
@@ -91,7 +137,7 @@ export type DataElementReference = {
|
|
|
91
137
|
elementId: string;
|
|
92
138
|
path: string;
|
|
93
139
|
};
|
|
94
|
-
export type EventType = 'ready' | 'change' | 'focus' | 'blur' | 'keydown';
|
|
140
|
+
export type EventType = 'ready' | 'change' | 'focus' | 'blur' | 'keydown' | 'click';
|
|
95
141
|
export interface BaseEvent<T extends EventType> {
|
|
96
142
|
type: T;
|
|
97
143
|
}
|
|
@@ -113,12 +159,14 @@ export type InputBlurEvent = BaseEvent<'blur'> & Targeted;
|
|
|
113
159
|
export type InputKeydownEvent = BaseEvent<'keydown'> & Targeted & {
|
|
114
160
|
key: ListenableKey;
|
|
115
161
|
} & Pick<KeyboardEvent, 'altKey' | 'ctrlKey' | 'shiftKey' | 'metaKey'>;
|
|
162
|
+
export type ClickEvent = BaseEvent<'click'> & Targeted;
|
|
116
163
|
export type BaseElementEvents = ReadyEvent | InputFocusEvent | InputBlurEvent | InputKeydownEvent;
|
|
117
164
|
export type TextElementEvents = BaseElementEvents | ChangeEvent;
|
|
118
165
|
export type CardElementEvents = BaseElementEvents | CardChangeEvent;
|
|
119
166
|
export type CardNumberElementEvents = BaseElementEvents | CardChangeEvent;
|
|
120
167
|
export type CardExpirationDateElementEvents = BaseElementEvents | ChangeEvent;
|
|
121
168
|
export type CardVerificationCodeElementEvents = BaseElementEvents | ChangeEvent;
|
|
169
|
+
export type CopyButtonElementEvents = BaseElementEvents | ClickEvent;
|
|
122
170
|
/**
|
|
123
171
|
* Utility type that helps find a Union type based on a `type` property
|
|
124
172
|
*/
|
|
@@ -129,15 +177,21 @@ export type ElementEventListener<Events, Type> = (event: FindByType<Events, Type
|
|
|
129
177
|
export interface Subscription {
|
|
130
178
|
unsubscribe(): void;
|
|
131
179
|
}
|
|
132
|
-
export const SAFE_CSS_PROPERTIES: readonly ["backgroundColor", "color", "fontFamily", "fontSize", "fontSmooth", "fontStyle", "fontVariant", "fontWeight", "
|
|
180
|
+
export const SAFE_CSS_PROPERTIES: readonly ["backgroundColor", "color", "fontFamily", "fontSize", "fontSmooth", "fontStyle", "fontVariant", "fontWeight", "letterSpacing", "lineHeight", "padding", "textAlign", "textDecoration", "textShadow", "textTransform"];
|
|
181
|
+
export const BUTTON_CSS_PROPERTIES: readonly ["alignItems", "backgroundColor", "border", "borderBottom", "borderColor", "borderLeft", "borderRadius", "borderRight", "borderStyle", "borderTop", "borderWidth", "boxShadow", "color", "cursor", "display", "fontFamily", "fontSize", "fontWeight", "gap", "height", "justifyContent", "letterSpacing", "lineHeight", "margin", "maxHeight", "maxWidth", "minHeight", "minWidth", "opacity", "outline", "padding", "textAlign", "textTransform", "transform", "transition", "width"];
|
|
133
182
|
export type SafeCSSProperty = (typeof SAFE_CSS_PROPERTIES)[number];
|
|
183
|
+
export type ButtonCSSProperty = (typeof BUTTON_CSS_PROPERTIES)[number];
|
|
134
184
|
export const SAFE_CSS_PROPERTIES_ALTERNATES: Partial<Record<SafeCSSProperty, string[]>>;
|
|
135
185
|
export const SAFE_CSS_PROPERTIES_WITH_ALTERNATES: string[];
|
|
136
186
|
export type SafeStyle = Pick<Properties, SafeCSSProperty>;
|
|
137
187
|
export const CARD_ELEMENT_STYLE_VARIANT_SELECTORS: readonly [":hover", ":focus", ":read-only", "::placeholder", "::selection", ":disabled"];
|
|
188
|
+
export const BUTTON_ELEMENT_STYLE_VARIANT_SELECTORS: readonly [":hover", ":focus", ":active"];
|
|
138
189
|
export type CardElementStyleVariantSelector = (typeof CARD_ELEMENT_STYLE_VARIANT_SELECTORS)[number];
|
|
190
|
+
export type ButtonElementStyleVariantSelector = (typeof BUTTON_ELEMENT_STYLE_VARIANT_SELECTORS)[number];
|
|
191
|
+
export type ButtonStyle = Pick<Properties, ButtonCSSProperty>;
|
|
139
192
|
export type CardElementStyleVariantStyle = SafeStyle & Partial<Record<CardElementStyleVariantSelector, SafeStyle>>;
|
|
140
|
-
export
|
|
193
|
+
export type ButtonElementStyleVariantStyle = ButtonStyle & Partial<Record<ButtonElementStyleVariantSelector, ButtonStyle>>;
|
|
194
|
+
export const CARD_ELEMENT_STYLE_VARIANTS: readonly ["base", "container", "complete", "invalid", "empty"];
|
|
141
195
|
export const CARD_ELEMENT_STYLE_FONTS_ATTR: "fonts";
|
|
142
196
|
export type CardElementStyleVariant = (typeof CARD_ELEMENT_STYLE_VARIANTS)[number];
|
|
143
197
|
type CardElementStyleFontAttr = typeof CARD_ELEMENT_STYLE_FONTS_ATTR;
|
|
@@ -145,16 +199,21 @@ type FontSource = string;
|
|
|
145
199
|
export type FontSources = FontSource[];
|
|
146
200
|
export type Fonts = Record<CardElementStyleFontAttr, FontSources>;
|
|
147
201
|
export type CardElementStyle = Partial<Record<CardElementStyleVariant, CardElementStyleVariantStyle> & Fonts>;
|
|
148
|
-
export
|
|
202
|
+
export const BUTTON_ELEMENT_STYLE_VARIANTS: readonly ["base", "container"];
|
|
203
|
+
export type ButtonElementStyleVariant = (typeof BUTTON_ELEMENT_STYLE_VARIANTS)[number];
|
|
204
|
+
export type ButtonElementStyle = Partial<Record<ButtonElementStyleVariant, ButtonElementStyleVariantStyle> & Fonts>;
|
|
205
|
+
export type CopyButtonElementStyle = ButtonElementStyle;
|
|
206
|
+
export type ElementStyle = CardElementStyle | CopyButtonElementStyle;
|
|
149
207
|
export type CopyIconStyles = {
|
|
150
208
|
size?: string;
|
|
151
209
|
color?: string;
|
|
152
210
|
successColor?: string;
|
|
153
211
|
};
|
|
154
|
-
export const ELEMENTS_TYPES: readonly ["card", "cardExpirationDate", "cardNumber", "cardVerificationCode", "data", "text"];
|
|
212
|
+
export const ELEMENTS_TYPES: readonly ["card", "cardExpirationDate", "cardNumber", "cardVerificationCode", "copyButton", "data", "text"];
|
|
155
213
|
export type ElementType = (typeof ELEMENTS_TYPES)[number];
|
|
156
214
|
export interface ElementInternalOptions {
|
|
157
215
|
apiKey: string | undefined;
|
|
216
|
+
customDomain: string | undefined;
|
|
158
217
|
baseUrl: string;
|
|
159
218
|
type: ElementType;
|
|
160
219
|
debug: boolean | undefined;
|
|
@@ -195,6 +254,7 @@ export interface SanitizedElementOptions {
|
|
|
195
254
|
skipLuhnValidation?: boolean;
|
|
196
255
|
style?: ElementStyle;
|
|
197
256
|
targetId?: string;
|
|
257
|
+
text?: string;
|
|
198
258
|
title?: string;
|
|
199
259
|
transform?: [RegExp, string] | null;
|
|
200
260
|
validateOnChange?: boolean;
|
|
@@ -261,6 +321,12 @@ export type CreateCardVerificationCodeElementOptions = CustomizableElementOption
|
|
|
261
321
|
value?: string;
|
|
262
322
|
};
|
|
263
323
|
export type UpdateCardVerificationCodeElementOptions = Omit<CreateCardVerificationCodeElementOptions, 'targetId' | 'validateOnChange' | 'enableCopy'>;
|
|
324
|
+
export type CreateCopyButtonElementOptions = Pick<ElementOptions, 'targetId' | 'title' | 'disabled'> & {
|
|
325
|
+
id?: string;
|
|
326
|
+
style?: CopyButtonElementStyle;
|
|
327
|
+
text?: string;
|
|
328
|
+
};
|
|
329
|
+
export type UpdateCopyButtonElementOptions = Omit<CreateCopyButtonElementOptions, 'targetId'>;
|
|
264
330
|
export interface BinDetails {
|
|
265
331
|
cardBrand?: string;
|
|
266
332
|
type?: string;
|
|
@@ -277,12 +343,20 @@ export interface BinDetails {
|
|
|
277
343
|
issuerCurrency?: string;
|
|
278
344
|
comboCard?: string;
|
|
279
345
|
binLength?: number;
|
|
280
|
-
authentication?:
|
|
281
|
-
cost?:
|
|
346
|
+
authentication?: Authentication;
|
|
347
|
+
cost?: Cost;
|
|
282
348
|
bank?: BinDetailsBank;
|
|
283
349
|
country?: BinDetailsCountry;
|
|
284
350
|
product?: BinDetailsProduct;
|
|
285
351
|
}
|
|
352
|
+
interface Cost {
|
|
353
|
+
capAdvaloremAmount: string;
|
|
354
|
+
capTypeName: string;
|
|
355
|
+
capFixedAmount: string;
|
|
356
|
+
}
|
|
357
|
+
interface Authentication {
|
|
358
|
+
authenticationName: string;
|
|
359
|
+
}
|
|
286
360
|
export interface BinDetailsBank {
|
|
287
361
|
name?: string;
|
|
288
362
|
phone?: string;
|
|
@@ -566,6 +640,9 @@ export type ICardVerificationCodeElement = BaseElement<UpdateCardVerificationCod
|
|
|
566
640
|
setValueRef(value: ICardVerificationCodeElement): void;
|
|
567
641
|
setValue(value: DataElementReference): void;
|
|
568
642
|
};
|
|
643
|
+
export type ICopyButtonElement = BaseElement<UpdateCopyButtonElementOptions, CopyButtonElementEvents> & {
|
|
644
|
+
setValueRef(value: ITextElement | ICardNumberElement | ICardExpirationDateElement | ICardVerificationCodeElement): void;
|
|
645
|
+
};
|
|
569
646
|
export type ElementWrapper<T extends BaseElement<any, any> = BaseElement<any, any>> = {
|
|
570
647
|
element: T;
|
|
571
648
|
method?: string;
|
|
@@ -573,7 +650,7 @@ export type ElementWrapper<T extends BaseElement<any, any> = BaseElement<any, an
|
|
|
573
650
|
format: string;
|
|
574
651
|
};
|
|
575
652
|
};
|
|
576
|
-
export type ElementValue = ITextElement | ICardElement | ICardNumberElement | ICardExpirationDateElement | ICardVerificationCodeElement | ElementWrapper;
|
|
653
|
+
export type ElementValue = ITextElement | ICardElement | ICardNumberElement | ICardExpirationDateElement | ICardVerificationCodeElement | ICopyButtonElement | ElementWrapper;
|
|
577
654
|
export interface BasisTheoryElements {
|
|
578
655
|
tokens: Tokens;
|
|
579
656
|
proxy: Proxy;
|
|
@@ -581,14 +658,16 @@ export interface BasisTheoryElements {
|
|
|
581
658
|
tokenIntents: TokenIntents;
|
|
582
659
|
tokenize: Tokenize['tokenize'];
|
|
583
660
|
client: HttpClient;
|
|
661
|
+
device: Device;
|
|
584
662
|
createElement(type: 'card', options?: CreateCardElementOptions): ICardElement;
|
|
585
663
|
createElement(type: 'text', options: CreateTextElementOptions): ITextElement;
|
|
586
664
|
createElement(type: 'cardNumber', options: CreateCardNumberElementOptions): ICardNumberElement;
|
|
587
665
|
createElement(type: 'cardExpirationDate', options: CreateCardExpirationDateElementOptions): ICardExpirationDateElement;
|
|
588
666
|
createElement(type: 'cardVerificationCode', options: CreateCardVerificationCodeElementOptions): ICardVerificationCodeElement;
|
|
667
|
+
createElement(type: 'copyButton', options: CreateCopyButtonElementOptions): ICopyButtonElement;
|
|
589
668
|
}
|
|
590
669
|
export interface BasisTheoryElementsInternal extends BasisTheoryElements {
|
|
591
|
-
init: (apiKey: string | undefined, elementsBaseUrl: string, elementsUseNgApi: boolean | undefined, elementsUseSameOriginApi: boolean | undefined, disableTelemetry: boolean | undefined, debug: boolean | undefined, useUat: boolean | undefined, useNetworkCheck: boolean | undefined) => Promise<BasisTheoryElements>;
|
|
670
|
+
init: (apiKey: string | undefined, elementsBaseUrl: string, elementsUseNgApi: boolean | undefined, elementsUseSameOriginApi: boolean | undefined, disableTelemetry: boolean | undefined, debug: boolean | undefined, useUat: boolean | undefined, useNetworkCheck: boolean | undefined, customDomain: string | undefined) => Promise<BasisTheoryElements>;
|
|
592
671
|
hasElement: (payload: unknown) => boolean;
|
|
593
672
|
}
|
|
594
673
|
declare global {
|
|
@@ -596,6 +675,18 @@ declare global {
|
|
|
596
675
|
BasisTheoryElements?: BasisTheoryElementsInternal;
|
|
597
676
|
}
|
|
598
677
|
}
|
|
678
|
+
export class BasisTheoryValidationError<Details = Record<string, unknown>> extends Error {
|
|
679
|
+
readonly details: Details;
|
|
680
|
+
/**
|
|
681
|
+
* @deprecated use {@link details}
|
|
682
|
+
*/
|
|
683
|
+
readonly validation?: FieldError[] | undefined;
|
|
684
|
+
constructor(message: string, details: Details,
|
|
685
|
+
/**
|
|
686
|
+
* @deprecated use {@link details}
|
|
687
|
+
*/
|
|
688
|
+
validation?: FieldError[] | undefined);
|
|
689
|
+
}
|
|
599
690
|
export interface BasisTheoryInitOptions {
|
|
600
691
|
_devMode?: boolean;
|
|
601
692
|
disableTelemetry?: boolean;
|
|
@@ -603,6 +694,7 @@ export interface BasisTheoryInitOptions {
|
|
|
603
694
|
useUat?: boolean;
|
|
604
695
|
debug?: boolean;
|
|
605
696
|
useNetworkCheck?: boolean;
|
|
697
|
+
customDomain?: string;
|
|
606
698
|
}
|
|
607
699
|
export const basistheory: (apiKey: string, options?: BasisTheoryInitOptions) => Promise<BasisTheoryElements | undefined>;
|
|
608
700
|
export class BasisTheoryApiError extends Error {
|
|
@@ -611,18 +703,6 @@ export class BasisTheoryApiError extends Error {
|
|
|
611
703
|
readonly _debug?: Record<string, unknown> | undefined;
|
|
612
704
|
constructor(message: string, status: number, data?: unknown | undefined, _debug?: Record<string, unknown> | undefined);
|
|
613
705
|
}
|
|
614
|
-
export class BasisTheoryValidationError<Details = Record<string, unknown>> extends Error {
|
|
615
|
-
readonly details: Details;
|
|
616
|
-
/**
|
|
617
|
-
* @deprecated use {@link details}
|
|
618
|
-
*/
|
|
619
|
-
readonly validation?: FieldError[] | undefined;
|
|
620
|
-
constructor(message: string, details: Details,
|
|
621
|
-
/**
|
|
622
|
-
* @deprecated use {@link details}
|
|
623
|
-
*/
|
|
624
|
-
validation?: FieldError[] | undefined);
|
|
625
|
-
}
|
|
626
706
|
export class HttpClientError extends Error {
|
|
627
707
|
readonly status: number;
|
|
628
708
|
readonly data?: unknown;
|