@basis-theory/web-elements 2.7.0 → 2.8.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.
@@ -1 +1 @@
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.7.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),v(Error),"undefined"!=typeof window&&document.currentScript&&!window.basistheory&&(window.basistheory=S)}();
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.8.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.environment)&&void 0!==h?h:"production",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),v(Error),"undefined"!=typeof window&&document.currentScript&&!window.basistheory&&(window.basistheory=S)}();
@@ -352,7 +352,7 @@ const $5dbc1ef1648671b0$export$9c5c779c8690dca6 = null;
352
352
 
353
353
 
354
354
  // Auto-generated version file
355
- const $eef42ce81412d9ae$export$83d89fbfd8236492 = '2.7.0';
355
+ const $eef42ce81412d9ae$export$83d89fbfd8236492 = '2.8.0';
356
356
 
357
357
 
358
358
  const $316c9c8f85cead13$var$TEST_ORIGIN = 'https://js.flock-dev.com';
@@ -383,7 +383,7 @@ const $316c9c8f85cead13$export$cbe2892587230861 = async (apiKey, options)=>{
383
383
  (0, $fe2ec396f58502a3$export$af88d00dbe7f521).setBaseUrl(origin);
384
384
  (0, $fe2ec396f58502a3$export$af88d00dbe7f521).disableTelemetry(Boolean(options?.disableTelemetry));
385
385
  const elements = await (0, $6477b722f43d24f2$export$2b0a6e5a1c78018f)(clientJsUrl);
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);
386
+ return elements.init(apiKey, hostedElementsBaseUrl, false, options?.useSameOriginApi ?? true, options?.disableTelemetry ?? false, options?.debug ?? false, options?.environment ?? 'production', options?.useNetworkCheck ?? false, options?.customDomain ? origin : undefined);
387
387
  };
388
388
 
389
389
 
@@ -352,7 +352,7 @@ const $c9bd4b894cc03378$export$9c5c779c8690dca6 = null;
352
352
 
353
353
 
354
354
  // Auto-generated version file
355
- const $6a2f0bfcc5905f21$export$83d89fbfd8236492 = '2.7.0';
355
+ const $6a2f0bfcc5905f21$export$83d89fbfd8236492 = '2.8.0';
356
356
 
357
357
 
358
358
  const $65168f0452925da7$var$TEST_ORIGIN = 'https://js.flock-dev.com';
@@ -383,7 +383,7 @@ const $65168f0452925da7$export$cbe2892587230861 = async (apiKey, options)=>{
383
383
  (0, $367e4a81566d966b$export$af88d00dbe7f521).setBaseUrl(origin);
384
384
  (0, $367e4a81566d966b$export$af88d00dbe7f521).disableTelemetry(Boolean(options?.disableTelemetry));
385
385
  const elements = await (0, $2cc07a9862fd14af$export$2b0a6e5a1c78018f)(clientJsUrl);
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);
386
+ return elements.init(apiKey, hostedElementsBaseUrl, false, options?.useSameOriginApi ?? true, options?.disableTelemetry ?? false, options?.debug ?? false, options?.environment ?? 'production', options?.useNetworkCheck ?? false, options?.customDomain ? origin : undefined);
387
387
  };
388
388
 
389
389
 
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@basis-theory/web-elements",
3
- "version": "2.7.0",
3
+ "version": "2.8.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/basis-theory/web-elements.git"
@@ -220,7 +220,7 @@ export interface ElementInternalOptions {
220
220
  disableTelemetry: boolean | undefined;
221
221
  useNgApi: boolean | undefined;
222
222
  useSameOriginApi: boolean | undefined;
223
- useUat: boolean | undefined;
223
+ environment: string | undefined;
224
224
  useNetworkCheck: boolean | undefined;
225
225
  }
226
226
  export enum InputMode {
@@ -489,17 +489,23 @@ interface CardIssuerDetails {
489
489
  country: string;
490
490
  name: string;
491
491
  }
492
+ export interface BinRange {
493
+ binMin: string;
494
+ binMax: string;
495
+ }
492
496
  interface CardInfo {
493
497
  brand: string;
494
498
  funding: string;
495
499
  issuer: CardIssuerDetails;
500
+ binRange?: BinRange[];
496
501
  }
497
502
  export interface BinInfo {
498
- brand: string;
499
- funding: string;
500
- issuer: CardIssuerDetails;
501
- segment: string;
503
+ brand?: string;
504
+ funding?: string;
505
+ issuer?: CardIssuerDetails;
506
+ segment?: string;
502
507
  additional?: CardInfo[];
508
+ binRange?: BinRange[];
503
509
  }
504
510
  /**
505
511
  * Make all properties in T nullable
@@ -672,7 +678,7 @@ export interface BasisTheoryElements {
672
678
  createElement(type: 'copyButton', options: CreateCopyButtonElementOptions): ICopyButtonElement;
673
679
  }
674
680
  export interface BasisTheoryElementsInternal extends BasisTheoryElements {
675
- 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>;
681
+ init: (apiKey: string | undefined, elementsBaseUrl: string, elementsUseNgApi: boolean | undefined, elementsUseSameOriginApi: boolean | undefined, disableTelemetry: boolean | undefined, debug: boolean | undefined, environment: string | undefined, useNetworkCheck: boolean | undefined, customDomain: string | undefined) => Promise<BasisTheoryElements>;
676
682
  hasElement: (payload: unknown) => boolean;
677
683
  }
678
684
  declare global {
@@ -696,7 +702,7 @@ export interface BasisTheoryInitOptions {
696
702
  _devMode?: boolean;
697
703
  disableTelemetry?: boolean;
698
704
  useSameOriginApi?: boolean;
699
- useUat?: boolean;
705
+ environment?: string;
700
706
  debug?: boolean;
701
707
  useNetworkCheck?: boolean;
702
708
  customDomain?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@basis-theory/web-elements",
3
- "version": "2.7.0",
3
+ "version": "2.8.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/basis-theory/web-elements.git"