@dintero/checkout-web-sdk
Advanced tools
Comparing version 0.0.9 to 0.0.10
@@ -1,2 +0,2 @@ | ||
var e,n,t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};!function(e){var n;(n=t).Promise=n.Promise||function(){var e,n,t,o=Object.prototype.toString,i="undefined"!=typeof setImmediate?function(e){return setImmediate(e)}:setTimeout;try{Object.defineProperty({},"x",{}),e=function(e,n,t,o){return Object.defineProperty(e,n,{value:t,writable:!0,configurable:!1!==o})}}catch(n){e=function(e,n,t){return e[n]=t,e}}function r(e,o){t.add(e,o),n||(n=i(t.drain))}function a(e){var n,t=typeof e;return null==e||"object"!=t&&"function"!=t||(n=e.then),"function"==typeof n&&n}function s(){for(var e=0;e<this.chain.length;e++)c(this,1===this.state?this.chain[e].success:this.chain[e].failure,this.chain[e]);this.chain.length=0}function c(e,n,t){var o,i;try{!1===n?t.reject(e.msg):(o=!0===n?e.msg:n.call(void 0,e.msg))===t.promise?t.reject(TypeError("Promise-chain cycle")):(i=a(o))?i.call(o,t.resolve,t.reject):t.resolve(o)}catch(e){t.reject(e)}}function u(e){var n=this;n.triggered||(n.triggered=!0,n.def&&(n=n.def),n.msg=e,n.state=2,n.chain.length>0&&r(s,n))}function f(e,n,t,o){for(var i=0;i<n.length;i++)!function(i){e.resolve(n[i]).then(function(e){t(i,e)},o)}(i)}function d(e){this.def=e,this.triggered=!1}function h(e){this.promise=e,this.state=0,this.triggered=!1,this.chain=[],this.msg=void 0}function l(e){if("function"!=typeof e)throw TypeError("Not a function");if(0!==this.__NPO__)throw TypeError("Not a promise");this.__NPO__=1;var n=new h(this);this.then=function(e,t){var o={success:"function"!=typeof e||e,failure:"function"==typeof t&&t};return o.promise=new this.constructor(function(e,n){if("function"!=typeof e||"function"!=typeof n)throw TypeError("Not a function");o.resolve=e,o.reject=n}),n.chain.push(o),0!==n.state&&r(s,n),o.promise},this.catch=function(e){return this.then(void 0,e)};try{e.call(void 0,function(e){(function e(n){var t,o=this;if(!o.triggered){o.triggered=!0,o.def&&(o=o.def);try{(t=a(n))?r(function(){var i=new d(o);try{t.call(n,function(){e.apply(i,arguments)},function(){u.apply(i,arguments)})}catch(e){u.call(i,e)}}):(o.msg=n,o.state=1,o.chain.length>0&&r(s,o))}catch(e){u.call(new d(o),e)}}}).call(n,e)},function(e){u.call(n,e)})}catch(e){u.call(n,e)}}t=function(){var e,t,o;function i(e,n){this.fn=e,this.self=n,this.next=void 0}return{add:function(n,r){o=new i(n,r),t?t.next=o:e=o,t=o,o=void 0},drain:function(){var o=e;for(e=t=n=void 0;o;)o.fn.call(o.self),o=o.next}}}();var p=e({},"constructor",l,!1);return l.prototype=p,e(p,"__NPO__",0,!1),e(l,"resolve",function(e){return e&&"object"==typeof e&&1===e.__NPO__?e:new this(function(n,t){if("function"!=typeof n||"function"!=typeof t)throw TypeError("Not a function");n(e)})}),e(l,"reject",function(e){return new this(function(n,t){if("function"!=typeof n||"function"!=typeof t)throw TypeError("Not a function");t(e)})}),e(l,"all",function(e){var n=this;return"[object Array]"!=o.call(e)?n.reject(TypeError("Not an array")):0===e.length?n.resolve([]):new n(function(t,o){if("function"!=typeof t||"function"!=typeof o)throw TypeError("Not a function");var i=e.length,r=Array(i),a=0;f(n,e,function(e,n){r[e]=n,++a===i&&t(r)},o)})}),e(l,"race",function(e){var n=this;return"[object Array]"!=o.call(e)?n.reject(TypeError("Not an array")):new n(function(t,o){if("function"!=typeof t||"function"!=typeof o)throw TypeError("Not a function");f(n,e,function(e,n){t(n)},o)})}),l}(),e.exports&&(e.exports=n.Promise)}({exports:{}}),function(e){e.SessionNotFound="SessionNotFound",e.SessionLoaded="SessionLoaded",e.SessionUpdated="SessionUpdated",e.SessionCancel="SessionCancel",e.SessionPaymentAuthorized="SessionPaymentAuthorized",e.SessionPaymentError="SessionPaymentError"}(e||(e={})),function(e){e.HeightChanged="HeightChanged"}(n||(n={}));var o=function(e){window.location.assign(e)},i=function(e){var n=e.sid,t=e.endpoint,o=e.language,i=e.ui;if(!t)throw new Error("Invalid endpoint");var r=[o?"language="+o:"",i?"ui="+i:"","sdk=0.0.9"].filter(function(e){return e}).join("&");return t+"/v1/view/"+n+(r?"?"+r:"")},r=function(e){e.href&&o(e.href)},a=function(e,n){e.height&&n.iframe.setAttribute("style","width:100%; height:"+e.height+"px;")};exports.embed=function(t){try{var o=t.container,s=t.sid,c=t.endpoint;void 0===c&&(c="https://checkout.dintero.com");var u=t.onSession,f=t.onSessionCancel,d=t.onPaymentAuthorized,h=t.onPaymentError,l=t.onSessionNotFound,p=[];return Promise.resolve(function(e,n,t){return new Promise(function(n,o){e&&e.appendChild||o(new Error("Invalid container"));var i=document.createElement("iframe");i.setAttribute("frameborder","0"),i.setAttribute("allowTransparency","true"),i.setAttribute("style","width:100%; height:0;"),i.setAttribute("sandbox","allow-scripts allow-forms allow-same-origin allow-popups"),i.setAttribute("importance","high"),i.setAttribute("src",t),i.onload=function(){return n(i)},i.onerror=function(){return o(i)},e.appendChild(i)})}(o,0,i({sid:s,endpoint:c,language:t.language,ui:"inline"}))).then(function(t){var i={destroy:function(){t&&(p.forEach(function(e){return e.unsubscribe()}),t.parentElement&&o.removeChild(t))},iframe:t};return[{handler:a,eventTypes:[n.HeightChanged]},{handler:u,eventTypes:[e.SessionLoaded,e.SessionUpdated]},{eventTypes:[e.SessionPaymentAuthorized],handler:d||r},{handler:f||r,eventTypes:[e.SessionCancel]},{handler:h||r,eventTypes:[e.SessionPaymentError]},{handler:l,eventTypes:[e.SessionNotFound]}].forEach(function(e){var n=e.handler;n&&p.push(function(e){var n=e.sid,t=e.endpoint,o=e.handler,i=e.eventTypes,r=e.checkout,a=function(e){var a=e.origin===t,s=e.source===r.iframe.contentWindow,c=e.data&&e.data.sid===n,u=-1!==i.indexOf(e.data&&e.data.type);a&&s&&c&&u&&(function(e,n){n.data.mid&&e.contentWindow&&e.contentWindow.postMessage({ack:n.data.mid},n.origin||"*")}(r.iframe,e),o(e.data,r))};return window.addEventListener("message",a,!1),{unsubscribe:function(){window.removeEventListener("message",a,!1)}}}({sid:s,endpoint:c,handler:n,eventTypes:e.eventTypes,checkout:i}))}),i})}catch(e){return Promise.reject(e)}},exports.redirect=function(e){var n=e.endpoint;void 0===n&&(n="https://checkout.dintero.com"),o(i({sid:e.sid,endpoint:n,language:e.language}))}; | ||
var e,n,t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};!function(e){var n;(n=t).Promise=n.Promise||function(){var e,n,t,o=Object.prototype.toString,i="undefined"!=typeof setImmediate?function(e){return setImmediate(e)}:setTimeout;try{Object.defineProperty({},"x",{}),e=function(e,n,t,o){return Object.defineProperty(e,n,{value:t,writable:!0,configurable:!1!==o})}}catch(n){e=function(e,n,t){return e[n]=t,e}}function r(e,o){t.add(e,o),n||(n=i(t.drain))}function a(e){var n,t=typeof e;return null==e||"object"!=t&&"function"!=t||(n=e.then),"function"==typeof n&&n}function s(){for(var e=0;e<this.chain.length;e++)c(this,1===this.state?this.chain[e].success:this.chain[e].failure,this.chain[e]);this.chain.length=0}function c(e,n,t){var o,i;try{!1===n?t.reject(e.msg):(o=!0===n?e.msg:n.call(void 0,e.msg))===t.promise?t.reject(TypeError("Promise-chain cycle")):(i=a(o))?i.call(o,t.resolve,t.reject):t.resolve(o)}catch(e){t.reject(e)}}function u(e){var n=this;n.triggered||(n.triggered=!0,n.def&&(n=n.def),n.msg=e,n.state=2,n.chain.length>0&&r(s,n))}function f(e,n,t,o){for(var i=0;i<n.length;i++)!function(i){e.resolve(n[i]).then(function(e){t(i,e)},o)}(i)}function d(e){this.def=e,this.triggered=!1}function h(e){this.promise=e,this.state=0,this.triggered=!1,this.chain=[],this.msg=void 0}function l(e){if("function"!=typeof e)throw TypeError("Not a function");if(0!==this.__NPO__)throw TypeError("Not a promise");this.__NPO__=1;var n=new h(this);this.then=function(e,t){var o={success:"function"!=typeof e||e,failure:"function"==typeof t&&t};return o.promise=new this.constructor(function(e,n){if("function"!=typeof e||"function"!=typeof n)throw TypeError("Not a function");o.resolve=e,o.reject=n}),n.chain.push(o),0!==n.state&&r(s,n),o.promise},this.catch=function(e){return this.then(void 0,e)};try{e.call(void 0,function(e){(function e(n){var t,o=this;if(!o.triggered){o.triggered=!0,o.def&&(o=o.def);try{(t=a(n))?r(function(){var i=new d(o);try{t.call(n,function(){e.apply(i,arguments)},function(){u.apply(i,arguments)})}catch(e){u.call(i,e)}}):(o.msg=n,o.state=1,o.chain.length>0&&r(s,o))}catch(e){u.call(new d(o),e)}}}).call(n,e)},function(e){u.call(n,e)})}catch(e){u.call(n,e)}}t=function(){var e,t,o;function i(e,n){this.fn=e,this.self=n,this.next=void 0}return{add:function(n,r){o=new i(n,r),t?t.next=o:e=o,t=o,o=void 0},drain:function(){var o=e;for(e=t=n=void 0;o;)o.fn.call(o.self),o=o.next}}}();var p=e({},"constructor",l,!1);return l.prototype=p,e(p,"__NPO__",0,!1),e(l,"resolve",function(e){return e&&"object"==typeof e&&1===e.__NPO__?e:new this(function(n,t){if("function"!=typeof n||"function"!=typeof t)throw TypeError("Not a function");n(e)})}),e(l,"reject",function(e){return new this(function(n,t){if("function"!=typeof n||"function"!=typeof t)throw TypeError("Not a function");t(e)})}),e(l,"all",function(e){var n=this;return"[object Array]"!=o.call(e)?n.reject(TypeError("Not an array")):0===e.length?n.resolve([]):new n(function(t,o){if("function"!=typeof t||"function"!=typeof o)throw TypeError("Not a function");var i=e.length,r=Array(i),a=0;f(n,e,function(e,n){r[e]=n,++a===i&&t(r)},o)})}),e(l,"race",function(e){var n=this;return"[object Array]"!=o.call(e)?n.reject(TypeError("Not an array")):new n(function(t,o){if("function"!=typeof t||"function"!=typeof o)throw TypeError("Not a function");f(n,e,function(e,n){t(n)},o)})}),l}(),e.exports&&(e.exports=n.Promise)}({exports:{}}),function(e){e.SessionNotFound="SessionNotFound",e.SessionLoaded="SessionLoaded",e.SessionUpdated="SessionUpdated",e.SessionCancel="SessionCancel",e.SessionPaymentAuthorized="SessionPaymentAuthorized",e.SessionPaymentError="SessionPaymentError"}(e||(e={})),function(e){e.HeightChanged="HeightChanged"}(n||(n={}));var o=function(e){window.location.assign(e)},i=function(e){var n=e.sid,t=e.endpoint,o=e.language,i=e.ui;if(!t)throw new Error("Invalid endpoint");var r=[o?"language="+o:"",i?"ui="+i:"","sdk=0.0.10"].filter(function(e){return e}).join("&");return t+"/v1/view/"+n+(r?"?"+r:"")},r=function(e){e.href&&o(e.href)},a=function(e,n){e.height&&n.iframe.setAttribute("style","width:100%; height:"+e.height+"px;")};exports.embed=function(t){try{var o=t.container,s=t.sid,c=t.endpoint;void 0===c&&(c="https://checkout.dintero.com");var u=t.onSession,f=t.onSessionCancel,d=t.onPaymentAuthorized,h=t.onPaymentError,l=t.onSessionNotFound,p=[];return Promise.resolve(function(e,n,t){return new Promise(function(n,o){e&&e.appendChild||o(new Error("Invalid container"));var i=document.createElement("iframe");i.setAttribute("frameborder","0"),i.setAttribute("allowTransparency","true"),i.setAttribute("style","width:100%; height:0;"),i.setAttribute("sandbox","allow-scripts allow-forms allow-same-origin allow-popups"),i.setAttribute("importance","high"),i.setAttribute("src",t),i.onload=function(){return n(i)},i.onerror=function(){return o(i)},e.appendChild(i)})}(o,0,i({sid:s,endpoint:c,language:t.language,ui:"inline"}))).then(function(t){var i={destroy:function(){t&&(p.forEach(function(e){return e.unsubscribe()}),t.parentElement&&o.removeChild(t))},iframe:t};return[{handler:a,eventTypes:[n.HeightChanged]},{handler:u,eventTypes:[e.SessionLoaded,e.SessionUpdated]},{eventTypes:[e.SessionPaymentAuthorized],handler:d||r},{handler:f||r,eventTypes:[e.SessionCancel]},{handler:h||r,eventTypes:[e.SessionPaymentError]},{handler:l,eventTypes:[e.SessionNotFound]}].forEach(function(e){var n=e.handler;n&&p.push(function(e){var n=e.sid,t=e.endpoint,o=e.handler,i=e.eventTypes,r=e.checkout,a=function(e){var a=e.origin===t,s=e.source===r.iframe.contentWindow,c=e.data&&e.data.sid===n,u=-1!==i.indexOf(e.data&&e.data.type);a&&s&&c&&u&&(function(e,n){n.data.mid&&e.contentWindow&&e.contentWindow.postMessage({ack:n.data.mid},n.origin||"*")}(r.iframe,e),o(e.data,r))};return window.addEventListener("message",a,!1),{unsubscribe:function(){window.removeEventListener("message",a,!1)}}}({sid:s,endpoint:c,handler:n,eventTypes:e.eventTypes,checkout:i}))}),i})}catch(e){return Promise.reject(e)}},exports.redirect=function(e){var n=e.endpoint;void 0===n&&(n="https://checkout.dintero.com"),o(i({sid:e.sid,endpoint:n,language:e.language}))}; | ||
//# sourceMappingURL=checkout-web-sdk.js.map |
@@ -1,2 +0,2 @@ | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n(e.dintero={})}(this,function(e){var n,t,o="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};!function(e){var n;(n=o).Promise=n.Promise||function(){var e,n,t,o=Object.prototype.toString,i="undefined"!=typeof setImmediate?function(e){return setImmediate(e)}:setTimeout;try{Object.defineProperty({},"x",{}),e=function(e,n,t,o){return Object.defineProperty(e,n,{value:t,writable:!0,configurable:!1!==o})}}catch(n){e=function(e,n,t){return e[n]=t,e}}function r(e,o){t.add(e,o),n||(n=i(t.drain))}function a(e){var n,t=typeof e;return null==e||"object"!=t&&"function"!=t||(n=e.then),"function"==typeof n&&n}function c(){for(var e=0;e<this.chain.length;e++)s(this,1===this.state?this.chain[e].success:this.chain[e].failure,this.chain[e]);this.chain.length=0}function s(e,n,t){var o,i;try{!1===n?t.reject(e.msg):(o=!0===n?e.msg:n.call(void 0,e.msg))===t.promise?t.reject(TypeError("Promise-chain cycle")):(i=a(o))?i.call(o,t.resolve,t.reject):t.resolve(o)}catch(e){t.reject(e)}}function u(e){var n=this;n.triggered||(n.triggered=!0,n.def&&(n=n.def),n.msg=e,n.state=2,n.chain.length>0&&r(c,n))}function f(e,n,t,o){for(var i=0;i<n.length;i++)!function(i){e.resolve(n[i]).then(function(e){t(i,e)},o)}(i)}function d(e){this.def=e,this.triggered=!1}function h(e){this.promise=e,this.state=0,this.triggered=!1,this.chain=[],this.msg=void 0}function l(e){if("function"!=typeof e)throw TypeError("Not a function");if(0!==this.__NPO__)throw TypeError("Not a promise");this.__NPO__=1;var n=new h(this);this.then=function(e,t){var o={success:"function"!=typeof e||e,failure:"function"==typeof t&&t};return o.promise=new this.constructor(function(e,n){if("function"!=typeof e||"function"!=typeof n)throw TypeError("Not a function");o.resolve=e,o.reject=n}),n.chain.push(o),0!==n.state&&r(c,n),o.promise},this.catch=function(e){return this.then(void 0,e)};try{e.call(void 0,function(e){(function e(n){var t,o=this;if(!o.triggered){o.triggered=!0,o.def&&(o=o.def);try{(t=a(n))?r(function(){var i=new d(o);try{t.call(n,function(){e.apply(i,arguments)},function(){u.apply(i,arguments)})}catch(e){u.call(i,e)}}):(o.msg=n,o.state=1,o.chain.length>0&&r(c,o))}catch(e){u.call(new d(o),e)}}}).call(n,e)},function(e){u.call(n,e)})}catch(e){u.call(n,e)}}t=function(){var e,t,o;function i(e,n){this.fn=e,this.self=n,this.next=void 0}return{add:function(n,r){o=new i(n,r),t?t.next=o:e=o,t=o,o=void 0},drain:function(){var o=e;for(e=t=n=void 0;o;)o.fn.call(o.self),o=o.next}}}();var p=e({},"constructor",l,!1);return l.prototype=p,e(p,"__NPO__",0,!1),e(l,"resolve",function(e){return e&&"object"==typeof e&&1===e.__NPO__?e:new this(function(n,t){if("function"!=typeof n||"function"!=typeof t)throw TypeError("Not a function");n(e)})}),e(l,"reject",function(e){return new this(function(n,t){if("function"!=typeof n||"function"!=typeof t)throw TypeError("Not a function");t(e)})}),e(l,"all",function(e){var n=this;return"[object Array]"!=o.call(e)?n.reject(TypeError("Not an array")):0===e.length?n.resolve([]):new n(function(t,o){if("function"!=typeof t||"function"!=typeof o)throw TypeError("Not a function");var i=e.length,r=Array(i),a=0;f(n,e,function(e,n){r[e]=n,++a===i&&t(r)},o)})}),e(l,"race",function(e){var n=this;return"[object Array]"!=o.call(e)?n.reject(TypeError("Not an array")):new n(function(t,o){if("function"!=typeof t||"function"!=typeof o)throw TypeError("Not a function");f(n,e,function(e,n){t(n)},o)})}),l}(),e.exports&&(e.exports=n.Promise)}({exports:{}}),function(e){e.SessionNotFound="SessionNotFound",e.SessionLoaded="SessionLoaded",e.SessionUpdated="SessionUpdated",e.SessionCancel="SessionCancel",e.SessionPaymentAuthorized="SessionPaymentAuthorized",e.SessionPaymentError="SessionPaymentError"}(n||(n={})),function(e){e.HeightChanged="HeightChanged"}(t||(t={}));var i=function(e){window.location.assign(e)},r=function(e){var n=e.sid,t=e.endpoint,o=e.language,i=e.ui;if(!t)throw new Error("Invalid endpoint");var r=[o?"language="+o:"",i?"ui="+i:"","sdk=0.0.9"].filter(function(e){return e}).join("&");return t+"/v1/view/"+n+(r?"?"+r:"")},a=function(e){e.href&&i(e.href)},c=function(e,n){e.height&&n.iframe.setAttribute("style","width:100%; height:"+e.height+"px;")};e.embed=function(e){try{var o=e.container,i=e.sid,s=e.endpoint;void 0===s&&(s="https://checkout.dintero.com");var u=e.onSession,f=e.onSessionCancel,d=e.onPaymentAuthorized,h=e.onPaymentError,l=e.onSessionNotFound,p=[];return Promise.resolve(function(e,n,t){return new Promise(function(n,o){e&&e.appendChild||o(new Error("Invalid container"));var i=document.createElement("iframe");i.setAttribute("frameborder","0"),i.setAttribute("allowTransparency","true"),i.setAttribute("style","width:100%; height:0;"),i.setAttribute("sandbox","allow-scripts allow-forms allow-same-origin allow-popups"),i.setAttribute("importance","high"),i.setAttribute("src",t),i.onload=function(){return n(i)},i.onerror=function(){return o(i)},e.appendChild(i)})}(o,0,r({sid:i,endpoint:s,language:e.language,ui:"inline"}))).then(function(e){var r={destroy:function(){e&&(p.forEach(function(e){return e.unsubscribe()}),e.parentElement&&o.removeChild(e))},iframe:e};return[{handler:c,eventTypes:[t.HeightChanged]},{handler:u,eventTypes:[n.SessionLoaded,n.SessionUpdated]},{eventTypes:[n.SessionPaymentAuthorized],handler:d||a},{handler:f||a,eventTypes:[n.SessionCancel]},{handler:h||a,eventTypes:[n.SessionPaymentError]},{handler:l,eventTypes:[n.SessionNotFound]}].forEach(function(e){var n=e.handler;n&&p.push(function(e){var n=e.sid,t=e.endpoint,o=e.handler,i=e.eventTypes,r=e.checkout,a=function(e){var a=e.origin===t,c=e.source===r.iframe.contentWindow,s=e.data&&e.data.sid===n,u=-1!==i.indexOf(e.data&&e.data.type);a&&c&&s&&u&&(function(e,n){n.data.mid&&e.contentWindow&&e.contentWindow.postMessage({ack:n.data.mid},n.origin||"*")}(r.iframe,e),o(e.data,r))};return window.addEventListener("message",a,!1),{unsubscribe:function(){window.removeEventListener("message",a,!1)}}}({sid:i,endpoint:s,handler:n,eventTypes:e.eventTypes,checkout:r}))}),r})}catch(e){return Promise.reject(e)}},e.redirect=function(e){var n=e.endpoint;void 0===n&&(n="https://checkout.dintero.com"),i(r({sid:e.sid,endpoint:n,language:e.language}))}}); | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n(e.dintero={})}(this,function(e){var n,t,o="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};!function(e){var n;(n=o).Promise=n.Promise||function(){var e,n,t,o=Object.prototype.toString,i="undefined"!=typeof setImmediate?function(e){return setImmediate(e)}:setTimeout;try{Object.defineProperty({},"x",{}),e=function(e,n,t,o){return Object.defineProperty(e,n,{value:t,writable:!0,configurable:!1!==o})}}catch(n){e=function(e,n,t){return e[n]=t,e}}function r(e,o){t.add(e,o),n||(n=i(t.drain))}function a(e){var n,t=typeof e;return null==e||"object"!=t&&"function"!=t||(n=e.then),"function"==typeof n&&n}function c(){for(var e=0;e<this.chain.length;e++)s(this,1===this.state?this.chain[e].success:this.chain[e].failure,this.chain[e]);this.chain.length=0}function s(e,n,t){var o,i;try{!1===n?t.reject(e.msg):(o=!0===n?e.msg:n.call(void 0,e.msg))===t.promise?t.reject(TypeError("Promise-chain cycle")):(i=a(o))?i.call(o,t.resolve,t.reject):t.resolve(o)}catch(e){t.reject(e)}}function u(e){var n=this;n.triggered||(n.triggered=!0,n.def&&(n=n.def),n.msg=e,n.state=2,n.chain.length>0&&r(c,n))}function f(e,n,t,o){for(var i=0;i<n.length;i++)!function(i){e.resolve(n[i]).then(function(e){t(i,e)},o)}(i)}function d(e){this.def=e,this.triggered=!1}function h(e){this.promise=e,this.state=0,this.triggered=!1,this.chain=[],this.msg=void 0}function l(e){if("function"!=typeof e)throw TypeError("Not a function");if(0!==this.__NPO__)throw TypeError("Not a promise");this.__NPO__=1;var n=new h(this);this.then=function(e,t){var o={success:"function"!=typeof e||e,failure:"function"==typeof t&&t};return o.promise=new this.constructor(function(e,n){if("function"!=typeof e||"function"!=typeof n)throw TypeError("Not a function");o.resolve=e,o.reject=n}),n.chain.push(o),0!==n.state&&r(c,n),o.promise},this.catch=function(e){return this.then(void 0,e)};try{e.call(void 0,function(e){(function e(n){var t,o=this;if(!o.triggered){o.triggered=!0,o.def&&(o=o.def);try{(t=a(n))?r(function(){var i=new d(o);try{t.call(n,function(){e.apply(i,arguments)},function(){u.apply(i,arguments)})}catch(e){u.call(i,e)}}):(o.msg=n,o.state=1,o.chain.length>0&&r(c,o))}catch(e){u.call(new d(o),e)}}}).call(n,e)},function(e){u.call(n,e)})}catch(e){u.call(n,e)}}t=function(){var e,t,o;function i(e,n){this.fn=e,this.self=n,this.next=void 0}return{add:function(n,r){o=new i(n,r),t?t.next=o:e=o,t=o,o=void 0},drain:function(){var o=e;for(e=t=n=void 0;o;)o.fn.call(o.self),o=o.next}}}();var p=e({},"constructor",l,!1);return l.prototype=p,e(p,"__NPO__",0,!1),e(l,"resolve",function(e){return e&&"object"==typeof e&&1===e.__NPO__?e:new this(function(n,t){if("function"!=typeof n||"function"!=typeof t)throw TypeError("Not a function");n(e)})}),e(l,"reject",function(e){return new this(function(n,t){if("function"!=typeof n||"function"!=typeof t)throw TypeError("Not a function");t(e)})}),e(l,"all",function(e){var n=this;return"[object Array]"!=o.call(e)?n.reject(TypeError("Not an array")):0===e.length?n.resolve([]):new n(function(t,o){if("function"!=typeof t||"function"!=typeof o)throw TypeError("Not a function");var i=e.length,r=Array(i),a=0;f(n,e,function(e,n){r[e]=n,++a===i&&t(r)},o)})}),e(l,"race",function(e){var n=this;return"[object Array]"!=o.call(e)?n.reject(TypeError("Not an array")):new n(function(t,o){if("function"!=typeof t||"function"!=typeof o)throw TypeError("Not a function");f(n,e,function(e,n){t(n)},o)})}),l}(),e.exports&&(e.exports=n.Promise)}({exports:{}}),function(e){e.SessionNotFound="SessionNotFound",e.SessionLoaded="SessionLoaded",e.SessionUpdated="SessionUpdated",e.SessionCancel="SessionCancel",e.SessionPaymentAuthorized="SessionPaymentAuthorized",e.SessionPaymentError="SessionPaymentError"}(n||(n={})),function(e){e.HeightChanged="HeightChanged"}(t||(t={}));var i=function(e){window.location.assign(e)},r=function(e){var n=e.sid,t=e.endpoint,o=e.language,i=e.ui;if(!t)throw new Error("Invalid endpoint");var r=[o?"language="+o:"",i?"ui="+i:"","sdk=0.0.10"].filter(function(e){return e}).join("&");return t+"/v1/view/"+n+(r?"?"+r:"")},a=function(e){e.href&&i(e.href)},c=function(e,n){e.height&&n.iframe.setAttribute("style","width:100%; height:"+e.height+"px;")};e.embed=function(e){try{var o=e.container,i=e.sid,s=e.endpoint;void 0===s&&(s="https://checkout.dintero.com");var u=e.onSession,f=e.onSessionCancel,d=e.onPaymentAuthorized,h=e.onPaymentError,l=e.onSessionNotFound,p=[];return Promise.resolve(function(e,n,t){return new Promise(function(n,o){e&&e.appendChild||o(new Error("Invalid container"));var i=document.createElement("iframe");i.setAttribute("frameborder","0"),i.setAttribute("allowTransparency","true"),i.setAttribute("style","width:100%; height:0;"),i.setAttribute("sandbox","allow-scripts allow-forms allow-same-origin allow-popups"),i.setAttribute("importance","high"),i.setAttribute("src",t),i.onload=function(){return n(i)},i.onerror=function(){return o(i)},e.appendChild(i)})}(o,0,r({sid:i,endpoint:s,language:e.language,ui:"inline"}))).then(function(e){var r={destroy:function(){e&&(p.forEach(function(e){return e.unsubscribe()}),e.parentElement&&o.removeChild(e))},iframe:e};return[{handler:c,eventTypes:[t.HeightChanged]},{handler:u,eventTypes:[n.SessionLoaded,n.SessionUpdated]},{eventTypes:[n.SessionPaymentAuthorized],handler:d||a},{handler:f||a,eventTypes:[n.SessionCancel]},{handler:h||a,eventTypes:[n.SessionPaymentError]},{handler:l,eventTypes:[n.SessionNotFound]}].forEach(function(e){var n=e.handler;n&&p.push(function(e){var n=e.sid,t=e.endpoint,o=e.handler,i=e.eventTypes,r=e.checkout,a=function(e){var a=e.origin===t,c=e.source===r.iframe.contentWindow,s=e.data&&e.data.sid===n,u=-1!==i.indexOf(e.data&&e.data.type);a&&c&&s&&u&&(function(e,n){n.data.mid&&e.contentWindow&&e.contentWindow.postMessage({ack:n.data.mid},n.origin||"*")}(r.iframe,e),o(e.data,r))};return window.addEventListener("message",a,!1),{unsubscribe:function(){window.removeEventListener("message",a,!1)}}}({sid:i,endpoint:s,handler:n,eventTypes:e.eventTypes,checkout:r}))}),r})}catch(e){return Promise.reject(e)}},e.redirect=function(e){var n=e.endpoint;void 0===n&&(n="https://checkout.dintero.com"),i(r({sid:e.sid,endpoint:n,language:e.language}))}}); | ||
//# sourceMappingURL=checkout-web-sdk.umd.js.map |
{ | ||
"name": "@dintero/checkout-web-sdk", | ||
"version": "0.0.9", | ||
"version": "0.0.10", | ||
"description": "Dintero Checkout SDK for web frontends", | ||
@@ -5,0 +5,0 @@ "source": "src/dintero-checkout-web-sdk.ts", |
@@ -33,3 +33,3 @@ # Dintero Checkout JavaScript SDK for frontend applications | ||
``` | ||
<script src="https://unpkg.com/@dintero/checkout-web-sdk@0.0.9/dist/checkout-web-sdk.umd.js" integrity="sha384-t/QVkJYrl4Q22SEHdAbOvBvtNgdpYZ+jlgcnGnoOy+CKsuA5zXi+ptzfzQgJbrwR"></script> | ||
<script src="https://unpkg.com/@dintero/checkout-web-sdk@0.0.10/dist/checkout-web-sdk.umd.js" integrity="sha384-CLElnOOZ/fM7hVafziXhnqW4bNUjEDLpqel4MZmFSKkYapCWv3gTWFKO32lQ7zLV"></script> | ||
``` | ||
@@ -56,3 +56,3 @@ | ||
}, | ||
onSessionPaymentAuthorized: function(event, checkout) { | ||
onPaymentAuthorized: function(event, checkout) { | ||
console.log("transaction_id", event.transaction_id); | ||
@@ -62,3 +62,3 @@ console.log("href", event.href); | ||
}, | ||
onSessionPaymentError: function(event, checkout) { | ||
onPaymentError: function(event, checkout) { | ||
console.log("href", event.href); | ||
@@ -98,3 +98,3 @@ checkout.destroy(); | ||
}, | ||
onSessionPaymentAuthorized: (event: SessionPaymentAuthorized) => { | ||
onPaymentAuthorized: (event: SessionPaymentAuthorized) => { | ||
console.log("transaction_id", event.transaction_id); | ||
@@ -104,3 +104,3 @@ console.log("href", event.href); | ||
}, | ||
onSessionPaymentError: (event: SessionPaymentError) => { | ||
onPaymentError: (event: SessionPaymentError) => { | ||
console.log("href", event.href); | ||
@@ -107,0 +107,0 @@ checkout.destroy(); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
118982