@paynext/sdk 1.0.2 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.es.js +5 -5
- package/dist/index.umd.js +1 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -19,7 +19,7 @@ async function c(n) {
|
|
|
19
19
|
return;
|
|
20
20
|
}
|
|
21
21
|
const o = document.createElement("script");
|
|
22
|
-
o.src = e === "develop" ? P : w, o.crossOrigin = "
|
|
22
|
+
o.src = e === "develop" ? P : w, o.crossOrigin = "anonymous", o.async = !0, o.onload = () => {
|
|
23
23
|
const i = window.PayNextSDK;
|
|
24
24
|
if (!i) {
|
|
25
25
|
console.error("[PayNext CDN] PayNextSDK not found in window after load"), r = null, document.head.removeChild(o), s(new Error("PayNextSDK not found in global scope after loading"));
|
|
@@ -67,12 +67,12 @@ class N {
|
|
|
67
67
|
await c(e);
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
|
-
const
|
|
70
|
+
const m = {
|
|
71
71
|
preload: N.preload
|
|
72
72
|
};
|
|
73
|
-
var
|
|
73
|
+
var y = /* @__PURE__ */ ((n) => (n.PAYPAL = "PAYPAL", n.APPLE_PAY = "APPLEPAY", n.GOOGLE_PAY = "GPAY", n.CARD = "CARD", n.VENMO = "VENMO", n.CASHAPP = "CASHAPP", n))(y || {});
|
|
74
74
|
export {
|
|
75
75
|
N as PayNextCheckout,
|
|
76
|
-
|
|
77
|
-
|
|
76
|
+
m as PayNextSDK,
|
|
77
|
+
y as PaymentMethod
|
|
78
78
|
};
|
package/dist/index.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(e,n){typeof exports=="object"&&typeof module<"u"?n(exports):typeof define=="function"&&define.amd?define(["exports"],n):(e=typeof globalThis<"u"?globalThis:e||self,n(e["PayNext SDK"]={}))})(this,(function(e){"use strict";var h=Object.defineProperty;var N=(e,n,a)=>n in e?h(e,n,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[n]=a;var u=(e,n,a)=>N(e,typeof n!="symbol"?n+"":n,a);const n="https://cdn-sdk-dev.paynext.com/index.cdn.js",a="https://cdn-sdk.paynext.com/index.cdn.js";let d=null,s=null;async function P(t){if(s)return s;if(d)return d;const r=t?.toLowerCase()?.includes("develop")||t?.toLowerCase()?.includes("staging")?"develop":"production";return d=new Promise((o,l)=>{if(typeof window>"u"){l(new Error("PayNext SDK can only be loaded in browser environment"));return}if(window.PayNextSDK){console.log("[PayNext CDN] SDK already loaded from cache"),s=window.PayNextSDK,o(s);return}const i=document.createElement("script");i.src=r==="develop"?n:a,i.crossOrigin="
|
|
1
|
+
(function(e,n){typeof exports=="object"&&typeof module<"u"?n(exports):typeof define=="function"&&define.amd?define(["exports"],n):(e=typeof globalThis<"u"?globalThis:e||self,n(e["PayNext SDK"]={}))})(this,(function(e){"use strict";var h=Object.defineProperty;var N=(e,n,a)=>n in e?h(e,n,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[n]=a;var u=(e,n,a)=>N(e,typeof n!="symbol"?n+"":n,a);const n="https://cdn-sdk-dev.paynext.com/index.cdn.js",a="https://cdn-sdk.paynext.com/index.cdn.js";let d=null,s=null;async function P(t){if(s)return s;if(d)return d;const r=t?.toLowerCase()?.includes("develop")||t?.toLowerCase()?.includes("staging")?"develop":"production";return d=new Promise((o,l)=>{if(typeof window>"u"){l(new Error("PayNext SDK can only be loaded in browser environment"));return}if(window.PayNextSDK){console.log("[PayNext CDN] SDK already loaded from cache"),s=window.PayNextSDK,o(s);return}const i=document.createElement("script");i.src=r==="develop"?n:a,i.crossOrigin="anonymous",i.async=!0,i.onload=()=>{const c=window.PayNextSDK;if(!c){console.error("[PayNext CDN] PayNextSDK not found in window after load"),d=null,document.head.removeChild(i),l(new Error("PayNextSDK not found in global scope after loading"));return}s=c,o(c)},i.onerror=c=>{console.error("[PayNext CDN] Failed to load script:",c),d=null,document.head.removeChild(i),l(new Error("Failed to load PayNext SDK script from CDN"))},document.head.appendChild(i)}),d}class y{constructor(){u(this,"cdnInstance",null);u(this,"initPromise",null)}async initialize(r){try{if(this.initPromise=await P(r),!this.initPromise.PayNextCheckout)throw new Error("PayNextCheckout not found in CDN module");this.cdnInstance=new this.initPromise.PayNextCheckout}catch(o){throw console.error("[PayNext CDN] Failed to initialize:",o),o}}waitForReady(){if(!this.initPromise)throw new Error("SDK initialization not started");if(!this.cdnInstance)throw new Error("SDK instance not created")}async mount(r,o){return await this.initialize(o.environment),this.waitForReady(),this.cdnInstance?.mount(r,o)}async unmount(){if(this.waitForReady(),this.cdnInstance?.unmount)return this.cdnInstance.unmount()}static async preload(r){await P(r)}}const f={preload:y.preload};var w=(t=>(t.PAYPAL="PAYPAL",t.APPLE_PAY="APPLEPAY",t.GOOGLE_PAY="GPAY",t.CARD="CARD",t.VENMO="VENMO",t.CASHAPP="CASHAPP",t))(w||{});e.PayNextCheckout=y,e.PayNextSDK=f,e.PaymentMethod=w,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})}));
|