rebill 1.0.8 → 1.0.10
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/index.js +1 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.Rebill=e():t.Rebill=e()}(this,(()=>(()=>{"use strict";var t={986:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CONSTANTS=void 0,e.CONSTANTS={IFRAME_READY:"IFRAME_READY",ON_SUCCESS:"ON_SUCCESS",ON_ERROR:"ON_ERROR",SET_TEXT:"SET_TEXT",SET_REQUEST:"SET_REQUEST",SET_CARDHOLDER:"SET_CARDHOLDER",SET_STYLES:"SET_STYLES",SET_CURRENCY:"SET_CURRENCY",SET_TRANSACTION_USE_CASE:"SET_TRANSACTION_USE_CASE",SET_PRICE:"SET_PRICE",SET_RENEW_CARD_USE_CASE:"SET_RENEW_CARD_USE_CASE",SET_ADD_CARD_USE_CASE:"SET_ADD_CARD_USE_CASE",SET_CONFIG_OPTIONS:"SET_CONFIG_OPTIONS",SET_CUSTOMER:"SET_CUSTOMER"}},607:function(t,e,n){var r=this&&this.__assign||function(){return r=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},r.apply(this,arguments)},i=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),o=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),s=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)"default"!==n&&Object.prototype.hasOwnProperty.call(t,n)&&i(e,t,n);return o(e,t),e},a=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{c(r.next(t))}catch(t){o(t)}}function a(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}c((r=r.apply(t,e||[])).next())}))},c=this&&this.__generator||function(t,e){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}};Object.defineProperty(e,"__esModule",{value:!0}),e.getCountryCodes=e.getCountries=e.getStatesBy=e.getIdentificationBy=e.setSdk=void 0;var u,l=s(n(0)),d=n(986),p="https://sdk-iframe.rebill.to/v3/index.html",f=function(){function t(t){var e=this;this.api_key=t,this.enableSync=!1,this.onSuccess=function(){},this.onError=function(){},this.metadataObject={},this.styles={},this.gateway={},window.addEventListener("message",(function(t){var n=t.data,r=n.type,i=n.detail;switch(r){case d.CONSTANTS.ON_SUCCESS:e.onSuccess(i);break;case d.CONSTANTS.ON_ERROR:e.onError(i)}}),!1),window.addEventListener(d.CONSTANTS.IFRAME_READY,(function(){var t,n,r,i=window.frames.rebill_elements;e.enableSync=!0,i.postMessage({type:d.CONSTANTS.SET_TRANSACTION_USE_CASE,detail:null===(t=e.priceData)||void 0===t?void 0:t.price.priceSetting.paymentMethods},p),i.postMessage({type:d.CONSTANTS.SET_ADD_CARD_USE_CASE,detail:e.customerId},p),i.postMessage({type:d.CONSTANTS.SET_RENEW_CARD_USE_CASE,detail:e.subscriptionId},p),i.postMessage({type:d.CONSTANTS.SET_REQUEST,detail:e.getRequest()},p),i.postMessage({type:d.CONSTANTS.SET_CURRENCY,detail:null===(n=e.priceData)||void 0===n?void 0:n.price.currency},p),i.postMessage({type:d.CONSTANTS.SET_PRICE,detail:null===(r=e.priceData)||void 0===r?void 0:r.price},p),i.postMessage({type:d.CONSTANTS.SET_CONFIG_OPTIONS,detail:e.config},p),i.postMessage({type:d.CONSTANTS.SET_TEXT,detail:e.text},p),i.postMessage({type:d.CONSTANTS.SET_STYLES,detail:e.styles},p),i.postMessage({type:d.CONSTANTS.SET_CARDHOLDER,detail:e.cardHolder},p),i.postMessage({type:d.CONSTANTS.SET_CUSTOMER,detail:e.customer},p)}))}return t.prototype.setUpdate=function(){window.frames.rebill_elements.postMessage({type:d.CONSTANTS.SET_REQUEST,detail:this.getRequest()},p)},t.prototype.getRequest=function(){var t,e;return{PAYLOAD:r(r({metadataObject:this.metadataObject},this.transaction),{priceData:{id:null===(t=this.priceData)||void 0===t?void 0:t.price.id,quantity:null===(e=this.priceData)||void 0===e?void 0:e.quantity},gateway:{type:this.gateway.type,country:this.gateway.country}}),REBILL_DEVICE_ID:u,API_KEY:this.api_key}},t.prototype.setCustomer=function(t){this.customer=t},t.prototype.renewCard=function(t){return a(this,void 0,void 0,(function(){return c(this,(function(e){return this.subscriptionId=t,this.setIframe(),[2]}))}))},t.prototype.addCard=function(t){return a(this,void 0,void 0,(function(){return c(this,(function(e){return this.customerId=t,this.setIframe(),[2]}))}))},t.prototype.setTransaction=function(t){return a(this,void 0,void 0,(function(){var e,n,i,o,s,a,u,d,p;return c(this,(function(c){switch(c.label){case 0:return e=t.id,n=t.currency,i=t.quantity,o=this.api_key,this.enableSync&&this.setUpdate(),[4,l.getItemData(e,n,o)];case 1:if(!(s=c.sent()))throw new Error("Neither product nor plan found with the given ID.");return a=s.price,u=a.priceSetting,(d=a.gateway).publicKey&&((p=document.createElement("script")).src="".concat("https://secure.rebill.com","/v1/Scripts/Antifraud.js?key=").concat(d.publicKey),p.type="text/javascript",document.head.appendChild(p)),this.priceData=r(r({},s),{quantity:i}),this.gateway={type:d.type,country:d.country},this.setIframe(),[2,u]}}))}))},t.prototype.setCallbacks=function(t){(null==t?void 0:t.onSuccess)&&(this.onSuccess=t.onSuccess),(null==t?void 0:t.onError)&&(this.onError=t.onError)},t.prototype.setText=function(t){this.text=t,this.enableSync&&this.setUpdate()},t.prototype.setStyles=function(t){this.styles=t,this.enableSync&&this.setUpdate()},t.prototype.setElements=function(t){if(!t)throw new Error("Missing element id");if(!document.getElementById(t))throw new Error("HTMLElement invalid.");this.html_id=t},t.prototype.setIframe=function(){var t=this.html_id;if(!t)throw new Error("Missing element id");setTimeout((function(){var e;u=null===(e=null===window||void 0===window?void 0:window.fingerPrintModel)||void 0===e?void 0:e.sessionid;var n=document.getElementById(t);if(!n)throw new Error("HTMLElement invalid.");window.setReady=function(){return dispatchEvent(new CustomEvent(d.CONSTANTS.IFRAME_READY))};var r='\n <iframe\n id="rebill_elements"\n title="rebill_elements"\n name="rebill_elements"\n src="'.concat(p,'"\n onLoad="setReady()"\n style="height: 100%; width: 100%; border: unset; overflow: visible;"\n allow="clipboard-read; clipboard-write"\n />\n ');n.innerHTML=r}),1500)},t.prototype.setMetadata=function(t){void 0===t&&(t={});var e=r(r({},this.metadataObject),t);this.metadataObject=e,this.enableSync&&this.setUpdate()},t.prototype.setConfigOptions=function(t){this.config=t,this.enableSync&&this.setUpdate()},t.prototype.setCardHolder=function(t){this.cardHolder=t,this.enableSync&&this.setUpdate()},t.prototype.submit=function(t){return a(this,void 0,void 0,(function(){var t,e=this;return c(this,(function(n){switch(n.label){case 0:return t=this.getRequest(),[4,fetch("".concat("https://api.rebill.com","/v2"),{method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify(t.PAYLOAD)}).then((function(t){if(t.ok)return t.json()})).then((function(t){return e.onSuccess(t)})).catch((function(t){return e.onError(t)}))];case 1:return n.sent(),[2]}}))}))},t}();e.setSdk=f,e.getIdentificationBy=function(t){return a(this,void 0,void 0,(function(){var e;return c(this,(function(n){switch(n.label){case 0:return[4,fetch("".concat("https://api.rebill.com","/v2/data/identification/").concat(t))];case 1:if(!(e=n.sent()).ok)throw new Error("Error fetching identification data: ".concat(e.status));return[4,e.json()];case 2:return[2,n.sent()]}}))}))},e.getStatesBy=function(t){return a(this,void 0,void 0,(function(){var e;return c(this,(function(n){switch(n.label){case 0:return[4,fetch("".concat("https://api.rebill.com","/v2/data/states/").concat(t))];case 1:if(!(e=n.sent()).ok)throw new Error("Error fetching states data: ".concat(e.status));return[4,e.json()];case 2:return[2,n.sent()]}}))}))},e.getCountries=function(){return a(this,void 0,void 0,(function(){var t;return c(this,(function(e){switch(e.label){case 0:return[4,fetch("".concat("https://api.rebill.com","/v2/data/countries"))];case 1:if(!(t=e.sent()).ok)throw new Error("Error fetching countries data: ".concat(t.status));return[4,t.json()];case 2:return[2,e.sent()]}}))}))},e.getCountryCodes=function(){return a(this,void 0,void 0,(function(){var t;return c(this,(function(e){switch(e.label){case 0:return[4,fetch("".concat("https://api.rebill.com","/v2/data/countrycode"))];case 1:if(!(t=e.sent()).ok)throw new Error("Error fetching countries code data: ".concat(t.status));return[4,t.json()];case 2:return[2,e.sent()]}}))}))}},0:function(t,e){var n=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{c(r.next(t))}catch(t){o(t)}}function a(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}c((r=r.apply(t,e||[])).next())}))},r=this&&this.__generator||function(t,e){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}};Object.defineProperty(e,"__esModule",{value:!0}),e.getItemData=void 0,e.getItemData=function(t,e,i){return n(this,void 0,void 0,(function(){var n,o;return r(this,(function(r){switch(r.label){case 0:return n={itemId:t,currency:e},[4,fetch("".concat("https://api.rebill.com","/v2/item/checkout"),{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(i)},body:JSON.stringify(n)})];case 1:if(!(o=r.sent()).ok)throw new Error("Network response was not ok");return[4,o.json()];case 2:return[2,r.sent()]}}))}))}}},e={};var n=function n(r){var i=e[r];if(void 0!==i)return i.exports;var o=e[r]={exports:{}};return t[r].call(o.exports,o,o.exports,n),o.exports}(607);return n})()));
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.Rebill=e():t.Rebill=e()}(this,(()=>(()=>{"use strict";var t={986:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CONSTANTS=void 0,e.CONSTANTS={IFRAME_READY:"IFRAME_READY",ON_SUCCESS:"ON_SUCCESS",ON_ERROR:"ON_ERROR",SET_TEXT:"SET_TEXT",SET_REQUEST:"SET_REQUEST",SET_CARDHOLDER:"SET_CARDHOLDER",SET_STYLES:"SET_STYLES",SET_CURRENCY:"SET_CURRENCY",SET_TRANSACTION_USE_CASE:"SET_TRANSACTION_USE_CASE",SET_PRICE:"SET_PRICE",SET_RENEW_CARD_USE_CASE:"SET_RENEW_CARD_USE_CASE",SET_ADD_CARD_USE_CASE:"SET_ADD_CARD_USE_CASE",SET_CONFIG_OPTIONS:"SET_CONFIG_OPTIONS",SET_CUSTOMER:"SET_CUSTOMER"}},607:function(t,e,n){var r=this&&this.__assign||function(){return r=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},r.apply(this,arguments)},i=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),o=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),a=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)"default"!==n&&Object.prototype.hasOwnProperty.call(t,n)&&i(e,t,n);return o(e,t),e},s=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{c(r.next(t))}catch(t){o(t)}}function s(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}c((r=r.apply(t,e||[])).next())}))},c=this&&this.__generator||function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(c){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(a=0)),a;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,r=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){a.label=s[1];break}if(6===s[0]&&a.label<i[1]){a.label=i[1],i=s;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(s);break}i[2]&&a.ops.pop(),a.trys.pop();continue}s=e.call(t,a)}catch(t){s=[6,t],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}};Object.defineProperty(e,"__esModule",{value:!0}),e.getCountryCodes=e.getCountries=e.getStatesBy=e.getIdentificationBy=e.setSdk=void 0;var u,l=a(n(0)),d=n(986),p="https://sdk-iframe.rebill.to/v3/index.html",f=function(){function t(t){var e=this;this.api_key=t,this.enableSync=!1,this.onSuccess=function(){},this.onError=function(){},this.metadataObject={},this.styles={},this.gateway={},window.addEventListener("message",(function(t){var n=t.data,r=n.type,i=n.detail;switch(r){case d.CONSTANTS.ON_SUCCESS:e.onSuccess(i);break;case d.CONSTANTS.ON_ERROR:e.onError(i)}}),!1),window.addEventListener(d.CONSTANTS.IFRAME_READY,(function(){var t,n,r,i=window.frames.rebill_elements;e.enableSync=!0,i.postMessage({type:d.CONSTANTS.SET_TRANSACTION_USE_CASE,detail:null===(t=e.priceData)||void 0===t?void 0:t.price.priceSetting.paymentMethods},p),i.postMessage({type:d.CONSTANTS.SET_ADD_CARD_USE_CASE,detail:e.customerId},p),i.postMessage({type:d.CONSTANTS.SET_RENEW_CARD_USE_CASE,detail:e.subscriptionId},p),i.postMessage({type:d.CONSTANTS.SET_REQUEST,detail:e.getRequest()},p),i.postMessage({type:d.CONSTANTS.SET_CURRENCY,detail:null===(n=e.priceData)||void 0===n?void 0:n.price.currency},p),i.postMessage({type:d.CONSTANTS.SET_PRICE,detail:null===(r=e.priceData)||void 0===r?void 0:r.price},p),i.postMessage({type:d.CONSTANTS.SET_CONFIG_OPTIONS,detail:e.config},p),i.postMessage({type:d.CONSTANTS.SET_TEXT,detail:e.text},p),i.postMessage({type:d.CONSTANTS.SET_STYLES,detail:e.styles},p),i.postMessage({type:d.CONSTANTS.SET_CARDHOLDER,detail:e.cardHolder},p),i.postMessage({type:d.CONSTANTS.SET_CUSTOMER,detail:e.customer},p)}))}return t.prototype.setUpdate=function(){window.frames.rebill_elements.postMessage({type:d.CONSTANTS.SET_REQUEST,detail:this.getRequest()},p)},t.prototype.getRequest=function(){var t,e;return{PAYLOAD:r(r({metadataObject:this.metadataObject},this.transaction),{priceData:{id:null===(t=this.priceData)||void 0===t?void 0:t.price.id,quantity:null===(e=this.priceData)||void 0===e?void 0:e.quantity},gateway:{type:this.gateway.type,country:this.gateway.country}}),REBILL_DEVICE_ID:u,API_KEY:this.api_key}},t.prototype.setCustomer=function(t){this.customer=t},t.prototype.renewCard=function(t){return s(this,void 0,void 0,(function(){return c(this,(function(e){return this.subscriptionId=t,this.setIframe(),[2]}))}))},t.prototype.addCard=function(t){return s(this,void 0,void 0,(function(){return c(this,(function(e){return this.customerId=t,this.setIframe(),[2]}))}))},t.prototype.setTransaction=function(t){return s(this,void 0,void 0,(function(){var e,n,i,o,a,s,u,d,p;return c(this,(function(c){switch(c.label){case 0:return e=t.id,n=t.currency,i=t.quantity,o=this.api_key,this.enableSync&&this.setUpdate(),[4,l.getItemData(e,n,o)];case 1:if(!(a=c.sent()))throw new Error("Neither product nor plan found with the given ID.");return s=a.price,u=s.priceSetting,(d=s.gateway).publicKey&&((p=document.createElement("script")).src="".concat("https://secure.rebill.dev","/v1/Scripts/Antifraud.js?key=").concat(d.publicKey),p.type="text/javascript",document.head.appendChild(p)),this.priceData=r(r({},a),{quantity:i}),this.gateway={type:d.type,country:d.country},this.setIframe(),[2,u]}}))}))},t.prototype.setCallbacks=function(t){(null==t?void 0:t.onSuccess)&&(this.onSuccess=t.onSuccess),(null==t?void 0:t.onError)&&(this.onError=t.onError)},t.prototype.setText=function(t){this.text=t,this.enableSync&&this.setUpdate()},t.prototype.setStyles=function(t){this.styles=t,this.enableSync&&this.setUpdate()},t.prototype.setElements=function(t){this.html_id=t},t.prototype.setIframe=function(){var t=this.html_id;if(!t)throw new Error("Missing element id");setTimeout((function(){var e;u=null===(e=null===window||void 0===window?void 0:window.fingerPrintModel)||void 0===e?void 0:e.sessionid;var n=document.getElementById(t);if(!n)throw new Error("HTMLElement invalid.");window.setReady=function(){return dispatchEvent(new CustomEvent(d.CONSTANTS.IFRAME_READY))};var r='\n <iframe\n id="rebill_elements"\n title="rebill_elements"\n name="rebill_elements"\n src="'.concat(p,'"\n onLoad="setReady()"\n style="height: 100%; width: 100%; border: unset; overflow: visible;"\n allow="clipboard-read; clipboard-write"\n />\n ');n.innerHTML=r}),1500)},t.prototype.setMetadata=function(t){void 0===t&&(t={});var e=r(r({},this.metadataObject),t);this.metadataObject=e,this.enableSync&&this.setUpdate()},t.prototype.setConfigOptions=function(t){this.config=t,this.enableSync&&this.setUpdate()},t.prototype.setCardHolder=function(t){this.cardHolder=t,this.enableSync&&this.setUpdate()},t.prototype.submit=function(t){return s(this,void 0,void 0,(function(){var t,e=this;return c(this,(function(n){switch(n.label){case 0:return t=this.getRequest(),[4,fetch("".concat("https://api.rebill.dev","/v2"),{method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify(t.PAYLOAD)}).then((function(t){if(t.ok)return t.json()})).then((function(t){return e.onSuccess(t)})).catch((function(t){return e.onError(t)}))];case 1:return n.sent(),[2]}}))}))},t}();e.setSdk=f,e.getIdentificationBy=function(t){return s(this,void 0,void 0,(function(){var e;return c(this,(function(n){switch(n.label){case 0:return[4,fetch("".concat("https://api.rebill.dev","/v2/data/identification/").concat(t))];case 1:if(!(e=n.sent()).ok)throw new Error("Error fetching identification data: ".concat(e.status));return[4,e.json()];case 2:return[2,n.sent()]}}))}))},e.getStatesBy=function(t){return s(this,void 0,void 0,(function(){var e;return c(this,(function(n){switch(n.label){case 0:return[4,fetch("".concat("https://api.rebill.dev","/v2/data/states/").concat(t))];case 1:if(!(e=n.sent()).ok)throw new Error("Error fetching states data: ".concat(e.status));return[4,e.json()];case 2:return[2,n.sent()]}}))}))},e.getCountries=function(){return s(this,void 0,void 0,(function(){var t;return c(this,(function(e){switch(e.label){case 0:return[4,fetch("".concat("https://api.rebill.dev","/v2/data/countries"))];case 1:if(!(t=e.sent()).ok)throw new Error("Error fetching countries data: ".concat(t.status));return[4,t.json()];case 2:return[2,e.sent()]}}))}))},e.getCountryCodes=function(){return s(this,void 0,void 0,(function(){var t;return c(this,(function(e){switch(e.label){case 0:return[4,fetch("".concat("https://api.rebill.dev","/v2/data/countrycode"))];case 1:if(!(t=e.sent()).ok)throw new Error("Error fetching countries code data: ".concat(t.status));return[4,t.json()];case 2:return[2,e.sent()]}}))}))}},0:function(t,e){var n=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{c(r.next(t))}catch(t){o(t)}}function s(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}c((r=r.apply(t,e||[])).next())}))},r=this&&this.__generator||function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(c){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(a=0)),a;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,r=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){a.label=s[1];break}if(6===s[0]&&a.label<i[1]){a.label=i[1],i=s;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(s);break}i[2]&&a.ops.pop(),a.trys.pop();continue}s=e.call(t,a)}catch(t){s=[6,t],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}};Object.defineProperty(e,"__esModule",{value:!0}),e.getItemData=void 0,e.getItemData=function(t,e,i){return n(this,void 0,void 0,(function(){var n,o;return r(this,(function(r){switch(r.label){case 0:return n={itemId:t,currency:e},[4,fetch("".concat("https://api.rebill.dev","/v2/item/checkout"),{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(i)},body:JSON.stringify(n)})];case 1:if(!(o=r.sent()).ok)throw new Error("Network response was not ok");return[4,o.json()];case 2:return[2,r.sent()]}}))}))}}},e={};var n=function n(r){var i=e[r];if(void 0!==i)return i.exports;var o=e[r]={exports:{}};return t[r].call(o.exports,o,o.exports,n),o.exports}(607);return n})()));
|