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.12 to 0.0.13

16

CHANGELOG.md

@@ -0,1 +1,7 @@

## [0.0.13]
### Changed
-No changes but the build published to NPM for version `0.0.12` vas outdated.
## [0.0.12]

@@ -5,4 +11,4 @@

- Support embed with `onPayment` event handler.
- *Deprecate* support for embed with `onPaymentAuthorized` event handler.
- Support embed with `onPayment` event handler.
- _Deprecate_ support for embed with `onPaymentAuthorized` event handler.

@@ -13,3 +19,3 @@ ## [0.0.11]

- Support for language updates and embedResult page
- Support for language updates and embedResult page

@@ -20,3 +26,3 @@ ## [0.0.10]

- Use correct callback names in README examples
- Use correct callback names in README examples

@@ -27,2 +33,2 @@ ## [0.0.9]

- sdk version as url query parameter
- sdk version as url query parameter

@@ -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,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}))};
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,o="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 i(e,r){t.add(e,r),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 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,o;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")):(o=a(r))?o.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&&i(s,n))}function f(e,n,t,r){for(var o=0;o<n.length;o++)!function(o){e.resolve(n[o]).then(function(e){t(o,e)},r)}(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 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&&i(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))?i(function(){var o=new d(r);try{t.call(n,function(){e.apply(o,arguments)},function(){u.apply(o,arguments)})}catch(e){u.call(o,e)}}):(r.msg=n,r.state=1,r.chain.length>0&&i(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 o(e,n){this.fn=e,this.self=n,this.next=void 0}return{add:function(n,i){r=new o(n,i),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 o=e.length,i=Array(o),a=0;f(n,e,function(e,n){i[e]=n,++a===o&&t(i)},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.SessionPaymentOnHold="SessionPaymentOnHold",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)},o=function(e){var n=e.sid,t=e.endpoint,r=e.language,o=e.ui;if(!t)throw new Error("Invalid endpoint");var i=[r?"language="+r:"",o?"ui="+o:"","sdk=0.0.13"].filter(function(e){return e}).join("&");return t+"/v1/view/"+n+(i?"?"+i:"")},i=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,o){var i=["sid","merchant_reference","transaction_id","error"].map(function(e){return[e,n[e]]});n.type!==e.SessionCancel||n.error||i.push(["error","cancelled"]),i.push(["language",o.language]),i.push(["sdk","0.0.13"]);var a=i.filter(function(e){return e[1]}).map(function(e){return e[0]+"="+e[1]}).join("&");o.iframe.setAttribute("src",t+"/embedResult/?"+a),r(n,o)}};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.onPayment,g=t.onPaymentAuthorized,y=t.onPaymentError,v=t.onSessionNotFound,m=[];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,o({sid:u,endpoint:d,language:f,ui:"inline"}))).then(function(t){var o=t.iframe,w=t.initiate,b={destroy:function(){o&&(m.forEach(function(e){return e.unsubscribe()}),o.parentElement&&r.removeChild(o))},iframe:o,language:f};return[{handler:s,eventTypes:[n.LanguageChanged]},{handler:a,eventTypes:[n.HeightChanged]},{handler:h,eventTypes:[e.SessionLoaded,e.SessionUpdated]},{eventTypes:[e.SessionPaymentOnHold],handler:p?c(0,d,p):i},{eventTypes:[e.SessionPaymentAuthorized],handler:g||p?c(0,d,g||p):i},{handler:l?c(0,d,l):i,eventTypes:[e.SessionCancel]},{handler:y?c(0,d,y):i,eventTypes:[e.SessionPaymentError]},{handler:v,eventTypes:[e.SessionNotFound]}].forEach(function(e){var n=e.handler;n&&m.push(function(e){var n=e.sid,t=e.endpoint,r=e.handler,o=e.eventTypes,i=e.checkout,a=function(e){var a=e.origin===t,s=e.source===i.iframe.contentWindow,c=e.data&&e.data.sid===n,u=-1!==o.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||"*")}(i.iframe,e),r(e.data,i))};return window.addEventListener("message",a,!1),{unsubscribe:function(){window.removeEventListener("message",a,!1)}}}({sid:u,endpoint:d,handler:n,eventTypes:e.eventTypes,checkout:b}))}),Promise.resolve(w()).then(function(){return b})})}catch(e){return Promise.reject(e)}},exports.redirect=function(e){var n=e.endpoint;void 0===n&&(n="https://checkout.dintero.com"),r(o({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,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}))}});
!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 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.SessionPaymentOnHold="SessionPaymentOnHold",e.SessionPaymentAuthorized="SessionPaymentAuthorized",e.SessionPaymentError="SessionPaymentError"}(n||(n={})),function(e){e.HeightChanged="HeightChanged",e.LanguageChanged="LanguageChanged"}(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.13"].filter(function(e){return e}).join("&");return t+"/v1/view/"+n+(r?"?"+r:"")},a=function(e){e.href&&i(e.href)},s=function(e,n){(e.height||0===e.height)&&n.iframe.setAttribute("style","width:100%; height:"+e.height+"px;")},c=function(e,n){e.language&&(n.language=e.language)},u=function(e,t,o){return function(e,i){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",i.language]),r.push(["sdk","0.0.13"]);var a=r.filter(function(e){return e[1]}).map(function(e){return e[0]+"="+e[1]}).join("&");i.iframe.setAttribute("src",t+"/embedResult/?"+a),o(e,i)}};e.embed=function(e){try{var o=e.container,i=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.onPayment,g=e.onPaymentAuthorized,y=e.onPaymentError,v=e.onSessionNotFound,m=[];return Promise.resolve(function(e,n,t){if(!e||!e.appendChild)throw new Error("Invalid container");var o=document.createElement("iframe");return o.setAttribute("frameborder","0"),o.setAttribute("allowTransparency","true"),o.setAttribute("style","width:100%; height:0;"),o.setAttribute("sandbox","allow-scripts allow-forms allow-same-origin allow-popups"),o.setAttribute("importance","high"),o.setAttribute("src",t),{iframe:o,initiate:function(){try{return Promise.resolve(new Promise(function(n,t){o.onload=function(){return n()},o.onerror=function(){return t()},e.appendChild(o)}))}catch(e){return Promise.reject(e)}}}}(o,0,r({sid:i,endpoint:d,language:f,ui:"inline"}))).then(function(e){var r=e.iframe,w=e.initiate,b={destroy:function(){r&&(m.forEach(function(e){return e.unsubscribe()}),r.parentElement&&o.removeChild(r))},iframe:r,language:f};return[{handler:c,eventTypes:[t.LanguageChanged]},{handler:s,eventTypes:[t.HeightChanged]},{handler:h,eventTypes:[n.SessionLoaded,n.SessionUpdated]},{eventTypes:[n.SessionPaymentOnHold],handler:p?u(0,d,p):a},{eventTypes:[n.SessionPaymentAuthorized],handler:g||p?u(0,d,g||p):a},{handler:l?u(0,d,l):a,eventTypes:[n.SessionCancel]},{handler:y?u(0,d,y):a,eventTypes:[n.SessionPaymentError]},{handler:v,eventTypes:[n.SessionNotFound]}].forEach(function(e){var n=e.handler;n&&m.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:i,endpoint:d,handler:n,eventTypes:e.eventTypes,checkout:b}))}),Promise.resolve(w()).then(function(){return b})})}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

@@ -7,2 +7,3 @@ import { Session } from "./session";

SessionCancel = "SessionCancel",
SessionPaymentOnHold = "SessionPaymentOnHold",
SessionPaymentAuthorized = "SessionPaymentAuthorized",

@@ -30,2 +31,8 @@ SessionPaymentError = "SessionPaymentError"

};
export declare type SessionPaymentOnHold = {
type: CheckoutEvents.SessionPaymentOnHold;
transaction_id: string;
merchant_reference: string;
href: string;
};
export declare type SessionPaymentAuthorized = {

@@ -37,2 +44,3 @@ type: CheckoutEvents.SessionPaymentAuthorized;

};
export declare type SessionPayment = SessionPaymentAuthorized | SessionPaymentOnHold;
export declare type SessionPaymentError = {

@@ -43,2 +51,2 @@ type: CheckoutEvents.SessionPaymentError;

};
export declare type SessionEvent = SessionNotFound | SessionLoaded | SessionUpdated | SessionCancel | SessionPaymentAuthorized | SessionPaymentError;
export declare type SessionEvent = SessionNotFound | SessionLoaded | SessionUpdated | SessionCancel | SessionPaymentOnHold | SessionPaymentAuthorized | SessionPaymentError;
import "native-promise-only";
import { SessionNotFound, SessionLoaded, SessionUpdated, SessionCancel, SessionPaymentAuthorized, SessionPaymentError } from "./checkout";
import { SessionNotFound, SessionLoaded, SessionUpdated, SessionCancel, SessionPaymentOnHold, SessionPaymentAuthorized, SessionPaymentError } from "./checkout";
export interface DinteroCheckoutInstance {

@@ -18,2 +18,6 @@ /**

container: HTMLDivElement;
onPayment?: (event: SessionPaymentAuthorized | SessionPaymentOnHold, checkout: DinteroCheckoutInstance) => void;
/**
* @deprecated Since version 0.0.1. Will be deleted in version 1.0.0. Use onPayment instead.
*/
onPaymentAuthorized?: (event: SessionPaymentAuthorized, checkout: DinteroCheckoutInstance) => void;

@@ -20,0 +24,0 @@ onSession?: (event: SessionLoaded | SessionUpdated, checkout: DinteroCheckoutInstance) => void;

{
"name": "@dintero/checkout-web-sdk",
"version": "0.0.12",
"version": "0.0.13",
"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.12/dist/checkout-web-sdk.umd.js" integrity="sha384-5O24oFt5onxdX5Oy89p2BiolScIILUAxKz7U3niumoIfkFQmVGY8N2DiqK5Ye7VL"></script>
<script src="https://unpkg.com/@dintero/checkout-web-sdk@0.0.13/dist/checkout-web-sdk.umd.js" integrity="sha384-sM9iYAp4hUFxf/0dZeDdKHrK0drTxFo+w4Of3CAt8QUFHzkaE1ZOgQZUOloi6b6+"></script>
```

@@ -36,0 +36,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