Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@dintero/checkout-web-sdk

Package Overview
Dependencies
Maintainers
2
Versions
63
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dintero/checkout-web-sdk - npm Package Compare versions

Comparing version 0.0.10 to 0.0.11

2

dist/checkout-web-sdk.js

@@ -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.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}))};
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,r=Object.prototype.toString,i="undefined"!=typeof setImmediate?function(e){return setImmediate(e)}:setTimeout;try{Object.defineProperty({},"x",{}),e=function(e,n,t,r){return Object.defineProperty(e,n,{value:t,writable:!0,configurable:!1!==r})}}catch(n){e=function(e,n,t){return e[n]=t,e}}function o(e,r){t.add(e,r),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 r,i;try{!1===n?t.reject(e.msg):(r=!0===n?e.msg:n.call(void 0,e.msg))===t.promise?t.reject(TypeError("Promise-chain cycle")):(i=a(r))?i.call(r,t.resolve,t.reject):t.resolve(r)}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&&o(s,n))}function f(e,n,t,r){for(var i=0;i<n.length;i++)!function(i){e.resolve(n[i]).then(function(e){t(i,e)},r)}(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 r={success:"function"!=typeof e||e,failure:"function"==typeof t&&t};return r.promise=new this.constructor(function(e,n){if("function"!=typeof e||"function"!=typeof n)throw TypeError("Not a function");r.resolve=e,r.reject=n}),n.chain.push(r),0!==n.state&&o(s,n),r.promise},this.catch=function(e){return this.then(void 0,e)};try{e.call(void 0,function(e){(function e(n){var t,r=this;if(!r.triggered){r.triggered=!0,r.def&&(r=r.def);try{(t=a(n))?o(function(){var i=new d(r);try{t.call(n,function(){e.apply(i,arguments)},function(){u.apply(i,arguments)})}catch(e){u.call(i,e)}}):(r.msg=n,r.state=1,r.chain.length>0&&o(s,r))}catch(e){u.call(new d(r),e)}}}).call(n,e)},function(e){u.call(n,e)})}catch(e){u.call(n,e)}}t=function(){var e,t,r;function i(e,n){this.fn=e,this.self=n,this.next=void 0}return{add:function(n,o){r=new i(n,o),t?t.next=r:e=r,t=r,r=void 0},drain:function(){var r=e;for(e=t=n=void 0;r;)r.fn.call(r.self),r=r.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]"!=r.call(e)?n.reject(TypeError("Not an array")):0===e.length?n.resolve([]):new n(function(t,r){if("function"!=typeof t||"function"!=typeof r)throw TypeError("Not a function");var i=e.length,o=Array(i),a=0;f(n,e,function(e,n){o[e]=n,++a===i&&t(o)},r)})}),e(l,"race",function(e){var n=this;return"[object Array]"!=r.call(e)?n.reject(TypeError("Not an array")):new n(function(t,r){if("function"!=typeof t||"function"!=typeof r)throw TypeError("Not a function");f(n,e,function(e,n){t(n)},r)})}),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",e.LanguageChanged="LanguageChanged"}(n||(n={}));var r=function(e){window.location.assign(e)},i=function(e){var n=e.sid,t=e.endpoint,r=e.language,i=e.ui;if(!t)throw new Error("Invalid endpoint");var o=[r?"language="+r:"",i?"ui="+i:"","sdk=0.0.11"].filter(function(e){return e}).join("&");return t+"/v1/view/"+n+(o?"?"+o:"")},o=function(e){e.href&&r(e.href)},a=function(e,n){(e.height||0===e.height)&&n.iframe.setAttribute("style","width:100%; height:"+e.height+"px;")},s=function(e,n){e.language&&(n.language=e.language)},c=function(n,t,r){return function(n,i){var o=["sid","merchant_reference","transaction_id","error"].map(function(e){return[e,n[e]]});n.type!==e.SessionCancel||n.error||o.push(["error","cancelled"]),o.push(["language",i.language]),o.push(["sdk","0.0.11"]);var a=o.filter(function(e){return e[1]}).map(function(e){return e[0]+"="+e[1]}).join("&");i.iframe.setAttribute("src",t+"/embedResult/?"+a),r(n,i)}};exports.embed=function(t){try{var r=t.container,u=t.sid,f=t.language,d=t.endpoint;void 0===d&&(d="https://checkout.dintero.com");var h=t.onSession,l=t.onSessionCancel,p=t.onPaymentAuthorized,g=t.onPaymentError,y=t.onSessionNotFound,v=[];return Promise.resolve(function(e,n,t){if(!e||!e.appendChild)throw new Error("Invalid container");var r=document.createElement("iframe");return r.setAttribute("frameborder","0"),r.setAttribute("allowTransparency","true"),r.setAttribute("style","width:100%; height:0;"),r.setAttribute("sandbox","allow-scripts allow-forms allow-same-origin allow-popups"),r.setAttribute("importance","high"),r.setAttribute("src",t),{iframe:r,initiate:function(){try{return Promise.resolve(new Promise(function(n,t){r.onload=function(){return n()},r.onerror=function(){return t()},e.appendChild(r)}))}catch(e){return Promise.reject(e)}}}}(r,0,i({sid:u,endpoint:d,language:f,ui:"inline"}))).then(function(t){var i=t.iframe,m=t.initiate,w={destroy:function(){i&&(v.forEach(function(e){return e.unsubscribe()}),i.parentElement&&r.removeChild(i))},iframe:i,language:f};return[{handler:s,eventTypes:[n.LanguageChanged]},{handler:a,eventTypes:[n.HeightChanged]},{handler:h,eventTypes:[e.SessionLoaded,e.SessionUpdated]},{eventTypes:[e.SessionPaymentAuthorized],handler:p?c(0,d,p):o},{handler:l?c(0,d,l):o,eventTypes:[e.SessionCancel]},{handler:g?c(0,d,g):o,eventTypes:[e.SessionPaymentError]},{handler:y,eventTypes:[e.SessionNotFound]}].forEach(function(e){var n=e.handler;n&&v.push(function(e){var n=e.sid,t=e.endpoint,r=e.handler,i=e.eventTypes,o=e.checkout,a=function(e){var a=e.origin===t,s=e.source===o.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||"*")}(o.iframe,e),r(e.data,o))};return window.addEventListener("message",a,!1),{unsubscribe:function(){window.removeEventListener("message",a,!1)}}}({sid:u,endpoint:d,handler:n,eventTypes:e.eventTypes,checkout:w}))}),Promise.resolve(m()).then(function(){return w})})}catch(e){return Promise.reject(e)}},exports.redirect=function(e){var n=e.endpoint;void 0===n&&(n="https://checkout.dintero.com"),r(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.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}))}});
!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,i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};!function(e){var n;(n=i).Promise=n.Promise||function(){var e,n,t,i=Object.prototype.toString,o="undefined"!=typeof setImmediate?function(e){return setImmediate(e)}:setTimeout;try{Object.defineProperty({},"x",{}),e=function(e,n,t,i){return Object.defineProperty(e,n,{value:t,writable:!0,configurable:!1!==i})}}catch(n){e=function(e,n,t){return e[n]=t,e}}function r(e,i){t.add(e,i),n||(n=o(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 i,o;try{!1===n?t.reject(e.msg):(i=!0===n?e.msg:n.call(void 0,e.msg))===t.promise?t.reject(TypeError("Promise-chain cycle")):(o=a(i))?o.call(i,t.resolve,t.reject):t.resolve(i)}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,i){for(var o=0;o<n.length;o++)!function(o){e.resolve(n[o]).then(function(e){t(o,e)},i)}(o)}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 i={success:"function"!=typeof e||e,failure:"function"==typeof t&&t};return i.promise=new this.constructor(function(e,n){if("function"!=typeof e||"function"!=typeof n)throw TypeError("Not a function");i.resolve=e,i.reject=n}),n.chain.push(i),0!==n.state&&r(c,n),i.promise},this.catch=function(e){return this.then(void 0,e)};try{e.call(void 0,function(e){(function e(n){var t,i=this;if(!i.triggered){i.triggered=!0,i.def&&(i=i.def);try{(t=a(n))?r(function(){var o=new d(i);try{t.call(n,function(){e.apply(o,arguments)},function(){u.apply(o,arguments)})}catch(e){u.call(o,e)}}):(i.msg=n,i.state=1,i.chain.length>0&&r(c,i))}catch(e){u.call(new d(i),e)}}}).call(n,e)},function(e){u.call(n,e)})}catch(e){u.call(n,e)}}t=function(){var e,t,i;function o(e,n){this.fn=e,this.self=n,this.next=void 0}return{add:function(n,r){i=new o(n,r),t?t.next=i:e=i,t=i,i=void 0},drain:function(){var i=e;for(e=t=n=void 0;i;)i.fn.call(i.self),i=i.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]"!=i.call(e)?n.reject(TypeError("Not an array")):0===e.length?n.resolve([]):new n(function(t,i){if("function"!=typeof t||"function"!=typeof i)throw TypeError("Not a function");var o=e.length,r=Array(o),a=0;f(n,e,function(e,n){r[e]=n,++a===o&&t(r)},i)})}),e(l,"race",function(e){var n=this;return"[object Array]"!=i.call(e)?n.reject(TypeError("Not an array")):new n(function(t,i){if("function"!=typeof t||"function"!=typeof i)throw TypeError("Not a function");f(n,e,function(e,n){t(n)},i)})}),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",e.LanguageChanged="LanguageChanged"}(t||(t={}));var o=function(e){window.location.assign(e)},r=function(e){var n=e.sid,t=e.endpoint,i=e.language,o=e.ui;if(!t)throw new Error("Invalid endpoint");var r=[i?"language="+i:"",o?"ui="+o:"","sdk=0.0.11"].filter(function(e){return e}).join("&");return t+"/v1/view/"+n+(r?"?"+r:"")},a=function(e){e.href&&o(e.href)},c=function(e,n){(e.height||0===e.height)&&n.iframe.setAttribute("style","width:100%; height:"+e.height+"px;")},s=function(e,n){e.language&&(n.language=e.language)},u=function(e,t,i){return function(e,o){var r=["sid","merchant_reference","transaction_id","error"].map(function(n){return[n,e[n]]});e.type!==n.SessionCancel||e.error||r.push(["error","cancelled"]),r.push(["language",o.language]),r.push(["sdk","0.0.11"]);var a=r.filter(function(e){return e[1]}).map(function(e){return e[0]+"="+e[1]}).join("&");o.iframe.setAttribute("src",t+"/embedResult/?"+a),i(e,o)}};e.embed=function(e){try{var i=e.container,o=e.sid,f=e.language,d=e.endpoint;void 0===d&&(d="https://checkout.dintero.com");var h=e.onSession,l=e.onSessionCancel,p=e.onPaymentAuthorized,g=e.onPaymentError,y=e.onSessionNotFound,v=[];return Promise.resolve(function(e,n,t){if(!e||!e.appendChild)throw new Error("Invalid container");var i=document.createElement("iframe");return 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),{iframe:i,initiate:function(){try{return Promise.resolve(new Promise(function(n,t){i.onload=function(){return n()},i.onerror=function(){return t()},e.appendChild(i)}))}catch(e){return Promise.reject(e)}}}}(i,0,r({sid:o,endpoint:d,language:f,ui:"inline"}))).then(function(e){var r=e.iframe,m=e.initiate,w={destroy:function(){r&&(v.forEach(function(e){return e.unsubscribe()}),r.parentElement&&i.removeChild(r))},iframe:r,language:f};return[{handler:s,eventTypes:[t.LanguageChanged]},{handler:c,eventTypes:[t.HeightChanged]},{handler:h,eventTypes:[n.SessionLoaded,n.SessionUpdated]},{eventTypes:[n.SessionPaymentAuthorized],handler:p?u(0,d,p):a},{handler:l?u(0,d,l):a,eventTypes:[n.SessionCancel]},{handler:g?u(0,d,g):a,eventTypes:[n.SessionPaymentError]},{handler:y,eventTypes:[n.SessionNotFound]}].forEach(function(e){var n=e.handler;n&&v.push(function(e){var n=e.sid,t=e.endpoint,i=e.handler,o=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!==o.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),i(e.data,r))};return window.addEventListener("message",a,!1),{unsubscribe:function(){window.removeEventListener("message",a,!1)}}}({sid:o,endpoint:d,handler:n,eventTypes:e.eventTypes,checkout:w}))}),Promise.resolve(m()).then(function(){return w})})}catch(e){return Promise.reject(e)}},e.redirect=function(e){var n=e.endpoint;void 0===n&&(n="https://checkout.dintero.com"),o(r({sid:e.sid,endpoint:n,language:e.language}))}});
//# sourceMappingURL=checkout-web-sdk.umd.js.map

@@ -11,3 +11,4 @@ import { Session } from "./session";

export declare enum InternalCheckoutEvents {
HeightChanged = "HeightChanged"
HeightChanged = "HeightChanged",
LanguageChanged = "LanguageChanged"
}

@@ -14,0 +15,0 @@ export declare type SessionNotFound = {

@@ -7,2 +7,5 @@ /**

*/
export declare const createIframeAsync: (container: HTMLDivElement, endpoint: string, url: string) => Promise<HTMLIFrameElement>;
export declare const createIframeAsync: (container: HTMLDivElement, endpoint: string, url: string) => {
iframe: HTMLIFrameElement;
initiate: () => void;
};

@@ -9,2 +9,3 @@ import "native-promise-only";

iframe: HTMLIFrameElement;
language: string;
}

@@ -11,0 +12,0 @@ export interface DinteroCheckoutOptions {

{
"name": "@dintero/checkout-web-sdk",
"version": "0.0.10",
"version": "0.0.11",
"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.10/dist/checkout-web-sdk.umd.js" integrity="sha384-CLElnOOZ/fM7hVafziXhnqW4bNUjEDLpqel4MZmFSKkYapCWv3gTWFKO32lQ7zLV"></script>
<script src="https://unpkg.com/@dintero/checkout-web-sdk@0.0.11/dist/checkout-web-sdk.umd.js" integrity="sha384-iR6i8hSBx+w5PWbu83MaVqQ04MocLyDm6JadFxy93xrp0GKTQEXeSD8I90hLvyy+"></script>
```

@@ -41,4 +41,19 @@

### Inline HTML JavaScript example
### Minimal example
_When payment is completed, the SDK will redirect the end user to the `return_url` defined in the payment session._
```html
<script type="text/javascript">
const container = document.getElementById("#checkout-container");
dintero.embed({
container,
sid: "T11223344.<short-uuid>",
});
</script>
```
### Full inline HTML JavaScript example
_The checkout sdk will add a polyfill for promises if the browser does not support promises natively._

@@ -45,0 +60,0 @@

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc