@dintero/checkout-web-sdk
Advanced tools
Comparing version 0.0.4 to 0.0.5
@@ -1,2 +0,2 @@ | ||
var e;require("native-promise-only"),function(e){e.SessionNotFound="SessionNotFound",e.SessionLoaded="SessionLoaded",e.SessionUpdated="SessionUpdated",e.SessionCancel="SessionCancel",e.SessionPaymentAuthorized="SessionPaymentAuthorized",e.SessionPaymentError="SessionPaymentError"}(e||(e={}));var n=function(e){window.location.assign(e)},t=function(e){var n=e.iid,t=e.sid,i=e.endpoint,r=e.language;if(!t)throw new Error("Invalid sid");if(!i)throw new Error("Invalid endpoint");var o=[n?"iid="+n:"",r?"language="+r:""].filter(function(e){return e}).join("&");return i+"/v1/view/"+t+(o?"?"+o:"")},i=function(e){e.href&&n(e.href)},r=function(){return(new Date).valueOf()+Math.random().toString(36).substring(7)},o={embedded:function(n){try{var o=n.container,a=n.sid,s=n.language,d=n.endpoint;void 0===d&&(d="https://checkout.dintero.com");var u=n.onSession,c=n.onSessionCancel,l=n.onPaymentAuthorized,h=n.onPaymentError,v=n.onSessionNotFound,f=[],p=r();return Promise.resolve(function(e,n,t){return new Promise(function(n,i){e&&e.appendChild||i(new Error("Invalid container"));var r=document.createElement("iframe");r.setAttribute("frameborder","0"),r.setAttribute("allowTransparency","true"),r.setAttribute("style","width:100%; height:100%;"),r.setAttribute("sandbox","allow-scripts allow-forms"),r.setAttribute("importance","high"),r.setAttribute("src",t),r.onload=function(){return n(r)},r.onerror=function(){return i(r)},e.appendChild(r)})}(o,0,t({iid:p,sid:a,endpoint:d,language:s}))).then(function(n){var t={destroy:function(){n&&(f.forEach(function(e){return e.unsubscribe()}),o.removeChild(n))},iframe:n};return[{handler:u,eventTypes:[e.SessionLoaded,e.SessionUpdated]},{eventTypes:[e.SessionPaymentAuthorized],handler:l||i},{handler:c||i,eventTypes:[e.SessionCancel]},{handler:h||i,eventTypes:[e.SessionPaymentError]},{handler:v,eventTypes:[e.SessionNotFound]}].forEach(function(e){var n=e.handler;n&&f.push(function(e){var n=e.sid,t=e.iid,i=e.handler,r=e.eventTypes,o=e.checkout,a=function(e){var a=e.data&&e.data.sid===n,s=e.data&&e.data.iid===t,d=-1!==r.indexOf(e.data&&e.data.type);a&&s&&d&&i(e.data,o)};return window.addEventListener("message",a,!1),{unsubscribe:function(){window.removeEventListener("message",a,!1)}}}({iid:p,sid:a,endpoint:d,handler:n,eventTypes:e.eventTypes,checkout:t}))}),t})}catch(e){return Promise.reject(e)}},redirect:function(e){var i=e.endpoint;void 0===i&&(i="https://checkout.dintero.com"),n(t({iid:void 0,sid:e.sid,endpoint:i,language:e.language}))}};exports.getInstanceId=r,exports.default=o; | ||
var e;require("native-promise-only"),function(e){e.SessionNotFound="SessionNotFound",e.SessionLoaded="SessionLoaded",e.SessionUpdated="SessionUpdated",e.SessionCancel="SessionCancel",e.SessionPaymentAuthorized="SessionPaymentAuthorized",e.SessionPaymentError="SessionPaymentError"}(e||(e={}));var n=function(e){window.location.assign(e)},t=function(e){var n=e.iid,t=e.sid,i=e.endpoint,o=e.language;if(!t)throw new Error("Invalid sid");if(!i)throw new Error("Invalid endpoint");var r=[n?"iid="+n:"",o?"language="+o:""].filter(function(e){return e}).join("&");return i+"/v1/view/"+t+(r?"?"+r:"")},i=function(e){e.href&&n(e.href)};exports.embed=function(n){try{var o=n.container,r=n.sid,s=n.language,a=n.endpoint;void 0===a&&(a="https://checkout.dintero.com");var d=n.onSession,u=n.onSessionCancel,c=n.onPaymentAuthorized,l=n.onPaymentError,h=n.onSessionNotFound,v=[],p=(new Date).valueOf()+Math.random().toString(36).substring(7);return Promise.resolve(function(e,n,t){return new Promise(function(n,i){e&&e.appendChild||i(new Error("Invalid container"));var o=document.createElement("iframe");o.setAttribute("frameborder","0"),o.setAttribute("allowTransparency","true"),o.setAttribute("style","width:100%; height:100%;"),o.setAttribute("sandbox","allow-scripts allow-forms"),o.setAttribute("importance","high"),o.setAttribute("src",t),o.onload=function(){return n(o)},o.onerror=function(){return i(o)},e.appendChild(o)})}(o,0,t({iid:p,sid:r,endpoint:a,language:s}))).then(function(n){var t={destroy:function(){n&&(v.forEach(function(e){return e.unsubscribe()}),o.removeChild(n))},iframe:n};return[{handler:d,eventTypes:[e.SessionLoaded,e.SessionUpdated]},{eventTypes:[e.SessionPaymentAuthorized],handler:c||i},{handler:u||i,eventTypes:[e.SessionCancel]},{handler:l||i,eventTypes:[e.SessionPaymentError]},{handler:h,eventTypes:[e.SessionNotFound]}].forEach(function(e){var n=e.handler;n&&v.push(function(e){var n=e.sid,t=e.iid,i=e.handler,o=e.eventTypes,r=e.checkout,s=function(e){var s=e.data&&e.data.sid===n,a=e.data&&e.data.iid===t,d=-1!==o.indexOf(e.data&&e.data.type);s&&a&&d&&i(e.data,r)};return window.addEventListener("message",s,!1),{unsubscribe:function(){window.removeEventListener("message",s,!1)}}}({iid:p,sid:r,endpoint:a,handler:n,eventTypes:e.eventTypes,checkout:t}))}),t})}catch(e){return Promise.reject(e)}},exports.redirect=function(e){var i=e.endpoint;void 0===i&&(i="https://checkout.dintero.com"),n(t({iid:void 0,sid:e.sid,endpoint:i,language:e.language}))}; | ||
//# sourceMappingURL=checkout-web-sdk.js.map |
@@ -1,2 +0,2 @@ | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("native-promise-only")):"function"==typeof define&&define.amd?define(["exports","native-promise-only"],n):n(e.checkoutWebSdk={})}(this,function(e){var n;!function(e){e.SessionNotFound="SessionNotFound",e.SessionLoaded="SessionLoaded",e.SessionUpdated="SessionUpdated",e.SessionCancel="SessionCancel",e.SessionPaymentAuthorized="SessionPaymentAuthorized",e.SessionPaymentError="SessionPaymentError"}(n||(n={}));var t=function(e){window.location.assign(e)},i=function(e){var n=e.iid,t=e.sid,i=e.endpoint,o=e.language;if(!t)throw new Error("Invalid sid");if(!i)throw new Error("Invalid endpoint");var r=[n?"iid="+n:"",o?"language="+o:""].filter(function(e){return e}).join("&");return i+"/v1/view/"+t+(r?"?"+r:"")},o=function(e){e.href&&t(e.href)},r=function(){return(new Date).valueOf()+Math.random().toString(36).substring(7)},s={embedded:function(e){try{var t=e.container,s=e.sid,a=e.language,d=e.endpoint;void 0===d&&(d="https://checkout.dintero.com");var u=e.onSession,c=e.onSessionCancel,f=e.onPaymentAuthorized,l=e.onPaymentError,h=e.onSessionNotFound,p=[],v=r();return Promise.resolve(function(e,n,t){return new Promise(function(n,i){e&&e.appendChild||i(new Error("Invalid container"));var o=document.createElement("iframe");o.setAttribute("frameborder","0"),o.setAttribute("allowTransparency","true"),o.setAttribute("style","width:100%; height:100%;"),o.setAttribute("sandbox","allow-scripts allow-forms"),o.setAttribute("importance","high"),o.setAttribute("src",t),o.onload=function(){return n(o)},o.onerror=function(){return i(o)},e.appendChild(o)})}(t,0,i({iid:v,sid:s,endpoint:d,language:a}))).then(function(e){var i={destroy:function(){e&&(p.forEach(function(e){return e.unsubscribe()}),t.removeChild(e))},iframe:e};return[{handler:u,eventTypes:[n.SessionLoaded,n.SessionUpdated]},{eventTypes:[n.SessionPaymentAuthorized],handler:f||o},{handler:c||o,eventTypes:[n.SessionCancel]},{handler:l||o,eventTypes:[n.SessionPaymentError]},{handler:h,eventTypes:[n.SessionNotFound]}].forEach(function(e){var n=e.handler;n&&p.push(function(e){var n=e.sid,t=e.iid,i=e.handler,o=e.eventTypes,r=e.checkout,s=function(e){var s=e.data&&e.data.sid===n,a=e.data&&e.data.iid===t,d=-1!==o.indexOf(e.data&&e.data.type);s&&a&&d&&i(e.data,r)};return window.addEventListener("message",s,!1),{unsubscribe:function(){window.removeEventListener("message",s,!1)}}}({iid:v,sid:s,endpoint:d,handler:n,eventTypes:e.eventTypes,checkout:i}))}),i})}catch(e){return Promise.reject(e)}},redirect:function(e){var n=e.endpoint;void 0===n&&(n="https://checkout.dintero.com"),t(i({iid:void 0,sid:e.sid,endpoint:n,language:e.language}))}};e.getInstanceId=r,e.default=s}); | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("native-promise-only")):"function"==typeof define&&define.amd?define(["exports","native-promise-only"],n):n(e.dintero={})}(this,function(e){var n;!function(e){e.SessionNotFound="SessionNotFound",e.SessionLoaded="SessionLoaded",e.SessionUpdated="SessionUpdated",e.SessionCancel="SessionCancel",e.SessionPaymentAuthorized="SessionPaymentAuthorized",e.SessionPaymentError="SessionPaymentError"}(n||(n={}));var t=function(e){window.location.assign(e)},i=function(e){var n=e.iid,t=e.sid,i=e.endpoint,o=e.language;if(!t)throw new Error("Invalid sid");if(!i)throw new Error("Invalid endpoint");var r=[n?"iid="+n:"",o?"language="+o:""].filter(function(e){return e}).join("&");return i+"/v1/view/"+t+(r?"?"+r:"")},o=function(e){e.href&&t(e.href)};e.embed=function(e){try{var t=e.container,r=e.sid,s=e.language,a=e.endpoint;void 0===a&&(a="https://checkout.dintero.com");var d=e.onSession,u=e.onSessionCancel,c=e.onPaymentAuthorized,f=e.onPaymentError,l=e.onSessionNotFound,h=[],p=(new Date).valueOf()+Math.random().toString(36).substring(7);return Promise.resolve(function(e,n,t){return new Promise(function(n,i){e&&e.appendChild||i(new Error("Invalid container"));var o=document.createElement("iframe");o.setAttribute("frameborder","0"),o.setAttribute("allowTransparency","true"),o.setAttribute("style","width:100%; height:100%;"),o.setAttribute("sandbox","allow-scripts allow-forms"),o.setAttribute("importance","high"),o.setAttribute("src",t),o.onload=function(){return n(o)},o.onerror=function(){return i(o)},e.appendChild(o)})}(t,0,i({iid:p,sid:r,endpoint:a,language:s}))).then(function(e){var i={destroy:function(){e&&(h.forEach(function(e){return e.unsubscribe()}),t.removeChild(e))},iframe:e};return[{handler:d,eventTypes:[n.SessionLoaded,n.SessionUpdated]},{eventTypes:[n.SessionPaymentAuthorized],handler:c||o},{handler:u||o,eventTypes:[n.SessionCancel]},{handler:f||o,eventTypes:[n.SessionPaymentError]},{handler:l,eventTypes:[n.SessionNotFound]}].forEach(function(e){var n=e.handler;n&&h.push(function(e){var n=e.sid,t=e.iid,i=e.handler,o=e.eventTypes,r=e.checkout,s=function(e){var s=e.data&&e.data.sid===n,a=e.data&&e.data.iid===t,d=-1!==o.indexOf(e.data&&e.data.type);s&&a&&d&&i(e.data,r)};return window.addEventListener("message",s,!1),{unsubscribe:function(){window.removeEventListener("message",s,!1)}}}({iid:p,sid:r,endpoint:a,handler:n,eventTypes:e.eventTypes,checkout:i}))}),i})}catch(e){return Promise.reject(e)}},e.redirect=function(e){var n=e.endpoint;void 0===n&&(n="https://checkout.dintero.com"),t(i({iid:void 0,sid:e.sid,endpoint:n,language:e.language}))}}); | ||
//# sourceMappingURL=checkout-web-sdk.umd.js.map |
@@ -24,9 +24,5 @@ import "native-promise-only"; | ||
/** | ||
* Create a unique instance id. | ||
* Show a dintero payment session in an embedded iframe. | ||
*/ | ||
export declare const getInstanceId: () => string; | ||
declare const dintero: { | ||
embedded: (options: DinteroEmbedCheckoutOptions) => Promise<DinteroCheckoutInstance>; | ||
redirect: (options: DinteroCheckoutOptions) => void; | ||
}; | ||
export default dintero; | ||
export declare const embed: (options: DinteroEmbedCheckoutOptions) => Promise<DinteroCheckoutInstance>; | ||
export declare const redirect: (options: DinteroCheckoutOptions) => void; |
{ | ||
"name": "@dintero/checkout-web-sdk", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"description": "Dintero Checkout SDK for web frontends", | ||
@@ -14,3 +14,3 @@ "source": "src/dintero-checkout-web-sdk.ts", | ||
"scripts": { | ||
"build": "microbundle", | ||
"build": "microbundle --name dintero", | ||
"dev": "microbundle watch", | ||
@@ -17,0 +17,0 @@ "test": "karma start" |
@@ -33,3 +33,3 @@ # Dintero Checkout JavaScript SDK for frontend applications | ||
``` | ||
<script src="https://unpkg.com/@dintero/checkout-web-sdk@0.0.4/dist/checkout-web-sdk.umd.js" integrity="sha384-kspprVhMn1vXnNrJt8siBT8IniHvZyqFMGgU29s4nprJGcPcCnTdADgLth/5c2hz"></script> | ||
<script src="https://unpkg.com/@dintero/checkout-web-sdk@0.0.5/dist/checkout-web-sdk.umd.js" integrity="sha384-N+KaZnQwHH9GlLXQiwAM6U7iHtqWdzlCi878pBr+/swGAe53x/guPM3VZ3l4gru+"></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
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
60613
147