@dintero/checkout-web-sdk
Advanced tools
Comparing version 0.0.5 to 0.0.6
@@ -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,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}))}; | ||
var e,n;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={})),function(e){e.HeightChanged="HeightChanged"}(n||(n={}));var t=function(e){window.location.assign(e)},o=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:""].filter(function(e){return e}).join("&");return t+"/v1/view/"+n+(r?"?"+r:"")},i=function(e){e.href&&t(e.href)},r=function(e,n){e.height&&n.iframe.setAttribute("style","width:100%; height:"+e.height+"px;")};exports.embed=function(t){try{var s=t.container,a=t.sid,d=t.endpoint;void 0===d&&(d="https://checkout.dintero.com");var u=t.onSession,c=t.onSessionCancel,h=t.onPaymentAuthorized,l=t.onPaymentError,p=t.onSessionNotFound,f=[];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)})}(s,0,o({sid:a,endpoint:d,language:t.language,ui:"inline"}))).then(function(t){var o={destroy:function(){t&&(f.forEach(function(e){return e.unsubscribe()}),t.parentElement&&s.removeChild(t))},iframe:t};return[{handler:r,eventTypes:[n.HeightChanged]},{handler:u,eventTypes:[e.SessionLoaded,e.SessionUpdated]},{eventTypes:[e.SessionPaymentAuthorized],handler:h||i},{handler:c||i,eventTypes:[e.SessionCancel]},{handler:l||i,eventTypes:[e.SessionPaymentError]},{handler:p,eventTypes:[e.SessionNotFound]}].forEach(function(e){var n=e.handler;n&&f.push(function(e){var n=e.sid,t=e.endpoint,o=e.handler,i=e.eventTypes,r=e.checkout,s=function(e){var s=e.origin===t,a=e.source===r.iframe.contentWindow,d=e.data&&e.data.sid===n,u=-1!==i.indexOf(e.data&&e.data.type);s&&a&&d&&u&&o(e.data,r)};return window.addEventListener("message",s,!1),{unsubscribe:function(){window.removeEventListener("message",s,!1)}}}({sid:a,endpoint:d,handler:n,eventTypes:e.eventTypes,checkout:o}))}),o})}catch(e){return Promise.reject(e)}},exports.redirect=function(e){var n=e.endpoint;void 0===n&&(n="https://checkout.dintero.com"),t(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,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}))}}); | ||
!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,t;!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 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:""].filter(function(e){return e}).join("&");return t+"/v1/view/"+n+(r?"?"+r:"")},r=function(e){e.href&&o(e.href)},s=function(e,n){e.height&&n.iframe.setAttribute("style","width:100%; height:"+e.height+"px;")};e.embed=function(e){try{var o=e.container,a=e.sid,d=e.endpoint;void 0===d&&(d="https://checkout.dintero.com");var u=e.onSession,c=e.onSessionCancel,h=e.onPaymentAuthorized,l=e.onPaymentError,p=e.onSessionNotFound,f=[];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:a,endpoint:d,language:e.language,ui:"inline"}))).then(function(e){var i={destroy:function(){e&&(f.forEach(function(e){return e.unsubscribe()}),e.parentElement&&o.removeChild(e))},iframe:e};return[{handler:s,eventTypes:[t.HeightChanged]},{handler:u,eventTypes:[n.SessionLoaded,n.SessionUpdated]},{eventTypes:[n.SessionPaymentAuthorized],handler:h||r},{handler:c||r,eventTypes:[n.SessionCancel]},{handler:l||r,eventTypes:[n.SessionPaymentError]},{handler:p,eventTypes:[n.SessionNotFound]}].forEach(function(e){var n=e.handler;n&&f.push(function(e){var n=e.sid,t=e.endpoint,o=e.handler,i=e.eventTypes,r=e.checkout,s=function(e){var s=e.origin===t,a=e.source===r.iframe.contentWindow,d=e.data&&e.data.sid===n,u=-1!==i.indexOf(e.data&&e.data.type);s&&a&&d&&u&&o(e.data,r)};return window.addEventListener("message",s,!1),{unsubscribe:function(){window.removeEventListener("message",s,!1)}}}({sid:a,endpoint:d,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"),o(i({sid:e.sid,endpoint:n,language:e.language}))}}); | ||
//# sourceMappingURL=checkout-web-sdk.umd.js.map |
@@ -10,2 +10,5 @@ import { Session } from "./session"; | ||
} | ||
export declare enum InternalCheckoutEvents { | ||
HeightChanged = "HeightChanged" | ||
} | ||
export declare type SessionNotFound = { | ||
@@ -12,0 +15,0 @@ type: CheckoutEvents.SessionNotFound; |
@@ -27,2 +27,5 @@ import "native-promise-only"; | ||
export declare const embed: (options: DinteroEmbedCheckoutOptions) => Promise<DinteroCheckoutInstance>; | ||
/** | ||
* Redirect the customer to a payment session in the Dintero Checkout. | ||
*/ | ||
export declare const redirect: (options: DinteroCheckoutOptions) => void; |
@@ -1,2 +0,2 @@ | ||
import { CheckoutEvents, SessionEvent } from "./checkout"; | ||
import { CheckoutEvents, InternalCheckoutEvents, SessionEvent } from "./checkout"; | ||
import { DinteroCheckoutInstance } from "./dintero-checkout-web-sdk"; | ||
@@ -8,7 +8,6 @@ /** | ||
interface SubscriptionOptions { | ||
iid: string; | ||
sid: string; | ||
endpoint: string; | ||
handler: SubscriptionHandler; | ||
eventTypes: CheckoutEvents[]; | ||
eventTypes: (CheckoutEvents | InternalCheckoutEvents)[]; | ||
checkout: DinteroCheckoutInstance; | ||
@@ -15,0 +14,0 @@ } |
@@ -10,7 +10,7 @@ /** | ||
export interface SessionUrlOptions { | ||
iid: string | undefined; | ||
sid: string; | ||
endpoint: string; | ||
language: string | undefined; | ||
ui?: "fullscreen" | "inline"; | ||
} | ||
export declare const getSessionUrl: (options: SessionUrlOptions) => string; |
{ | ||
"name": "@dintero/checkout-web-sdk", | ||
"version": "0.0.5", | ||
"version": "0.0.6", | ||
"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.5/dist/checkout-web-sdk.umd.js" integrity="sha384-N+KaZnQwHH9GlLXQiwAM6U7iHtqWdzlCi878pBr+/swGAe53x/guPM3VZ3l4gru+"></script> | ||
<script src="https://unpkg.com/@dintero/checkout-web-sdk@0.0.6/dist/checkout-web-sdk.umd.js" integrity="sha384-haXi/PEJ96NcITvQkVCHfgdfhrPwZKcF5Ak8zw+JHi5Icj9YhJ0fP987i3XwprIP"></script> | ||
``` | ||
@@ -86,3 +86,3 @@ | ||
SessionCancel, | ||
} from "dintero-checkout-web-sdk"; | ||
} from "@dintero/checkout-web-sdk"; | ||
@@ -89,0 +89,0 @@ const container = document.getElementById("#checkout-container"); |
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
63201
154