@paynext/sdk 0.0.143 → 0.0.144
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.d.ts +1 -3
- package/dist/index.es.js +20 -21
- package/dist/index.umd.js +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -353,7 +353,7 @@ declare enum PaymentStatus {
|
|
|
353
353
|
* This class acts as a proxy that loads the actual implementation from CDN.
|
|
354
354
|
* Users can use it immediately, and the CDN version will be loaded on demand.
|
|
355
355
|
*/
|
|
356
|
-
declare class PayNextCheckout {
|
|
356
|
+
export declare class PayNextCheckout {
|
|
357
357
|
private cdnInstance;
|
|
358
358
|
private initPromise;
|
|
359
359
|
constructor();
|
|
@@ -399,8 +399,6 @@ declare class PayNextCheckout {
|
|
|
399
399
|
*/
|
|
400
400
|
static preload(): Promise<void>;
|
|
401
401
|
}
|
|
402
|
-
export { PayNextCheckout }
|
|
403
|
-
export default PayNextCheckout;
|
|
404
402
|
|
|
405
403
|
export declare interface PayNextConfig {
|
|
406
404
|
clientToken: string;
|
package/dist/index.es.js
CHANGED
|
@@ -1,49 +1,49 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var u = (
|
|
4
|
-
var a = (
|
|
1
|
+
var h = Object.defineProperty;
|
|
2
|
+
var f = (t, e, n) => e in t ? h(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
|
|
3
|
+
var u = (t, e, n) => f(t, typeof e != "symbol" ? e + "" : e, n);
|
|
4
|
+
var a = (t, e, n) => new Promise((o, N) => {
|
|
5
5
|
var w = (r) => {
|
|
6
6
|
try {
|
|
7
|
-
l(
|
|
7
|
+
l(n.next(r));
|
|
8
8
|
} catch (d) {
|
|
9
9
|
N(d);
|
|
10
10
|
}
|
|
11
11
|
}, C = (r) => {
|
|
12
12
|
try {
|
|
13
|
-
l(
|
|
13
|
+
l(n.throw(r));
|
|
14
14
|
} catch (d) {
|
|
15
15
|
N(d);
|
|
16
16
|
}
|
|
17
17
|
}, l = (r) => r.done ? o(r.value) : Promise.resolve(r.value).then(w, C);
|
|
18
|
-
l((
|
|
18
|
+
l((n = n.apply(t, e)).next());
|
|
19
19
|
});
|
|
20
20
|
const c = "https://paynext-sdk.cbvcode.workers.dev/index.cdn.js", P = "1.0.0";
|
|
21
21
|
let i = null, s = null;
|
|
22
22
|
function y() {
|
|
23
23
|
return a(this, null, function* () {
|
|
24
|
-
return s || i || (i = new Promise((
|
|
24
|
+
return s || i || (i = new Promise((t, e) => {
|
|
25
25
|
if (typeof window == "undefined") {
|
|
26
26
|
e(new Error("PayNext SDK can only be loaded in browser environment"));
|
|
27
27
|
return;
|
|
28
28
|
}
|
|
29
29
|
if (window.PayNextSDK) {
|
|
30
|
-
console.log("[PayNext CDN] SDK already loaded from cache"), s = window.PayNextSDK,
|
|
30
|
+
console.log("[PayNext CDN] SDK already loaded from cache"), s = window.PayNextSDK, t(s);
|
|
31
31
|
return;
|
|
32
32
|
}
|
|
33
33
|
console.log("[PayNext CDN] Fetching SDK from:", c);
|
|
34
|
-
const
|
|
35
|
-
|
|
34
|
+
const n = document.createElement("script");
|
|
35
|
+
n.src = c, n.crossOrigin = "anonymous", n.async = !0, n.onload = () => {
|
|
36
36
|
console.log("[PayNext CDN] Script loaded, checking global..."), setTimeout(() => {
|
|
37
37
|
const o = window.PayNextSDK;
|
|
38
38
|
if (!o) {
|
|
39
|
-
console.error("[PayNext CDN 77777777] PayNextSDK not found in window after load"), i = null, document.head.removeChild(
|
|
39
|
+
console.error("[PayNext CDN 77777777] PayNextSDK not found in window after load"), i = null, document.head.removeChild(n), e(new Error("PayNextSDK not found in global scope after loading"));
|
|
40
40
|
return;
|
|
41
41
|
}
|
|
42
|
-
console.log("[PayNext CDN] SDK fetched successfully, exports:", Object.keys(o)), s = o,
|
|
42
|
+
console.log("[PayNext CDN] SDK fetched successfully, exports:", Object.keys(o)), s = o, t(o);
|
|
43
43
|
}, 1);
|
|
44
|
-
},
|
|
45
|
-
console.error("[PayNext CDN] Failed to load script:", o), i = null, document.head.removeChild(
|
|
46
|
-
}, document.head.appendChild(
|
|
44
|
+
}, n.onerror = (o) => {
|
|
45
|
+
console.error("[PayNext CDN] Failed to load script:", o), i = null, document.head.removeChild(n), e(new Error("Failed to load PayNext SDK script from CDN"));
|
|
46
|
+
}, document.head.appendChild(n);
|
|
47
47
|
}), i);
|
|
48
48
|
});
|
|
49
49
|
}
|
|
@@ -86,9 +86,9 @@ class D {
|
|
|
86
86
|
* @param containerId - DOM element ID
|
|
87
87
|
* @param config - Checkout configuration
|
|
88
88
|
*/
|
|
89
|
-
mount(e,
|
|
89
|
+
mount(e, n) {
|
|
90
90
|
return a(this, null, function* () {
|
|
91
|
-
return console.log("[PayNext CDN] mount() called, waiting for SDK..."), yield this.waitForReady(), console.log("[PayNext CDN] SDK ready, calling mount on CDN instance..."), this.cdnInstance.mount(e,
|
|
91
|
+
return console.log("[PayNext CDN] mount() called, waiting for SDK..."), yield this.waitForReady(), console.log("[PayNext CDN] SDK ready, calling mount on CDN instance..."), this.cdnInstance.mount(e, n);
|
|
92
92
|
});
|
|
93
93
|
}
|
|
94
94
|
/**
|
|
@@ -144,11 +144,10 @@ const g = {
|
|
|
144
144
|
preload: D.preload,
|
|
145
145
|
isLoaded: D.isLoaded
|
|
146
146
|
};
|
|
147
|
-
var x = /* @__PURE__ */ ((
|
|
147
|
+
var x = /* @__PURE__ */ ((t) => (t.PAYPAL = "PAYPAL", t.APPLE_PAY = "APPLEPAY", t.GOOGLE_PAY = "GPAY", t.CARD = "CARD", t.VENMO = "VENMO", t))(x || {});
|
|
148
148
|
export {
|
|
149
149
|
D as PayNextCheckout,
|
|
150
150
|
g as PayNextSDK,
|
|
151
|
-
x as PaymentMethod
|
|
152
|
-
D as default
|
|
151
|
+
x as PaymentMethod
|
|
153
152
|
};
|
|
154
153
|
//# sourceMappingURL=index.es.js.map
|
package/dist/index.umd.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
(function(t,e){typeof exports=="object"&&typeof module!="undefined"?e(exports):typeof define=="function"&&define.amd?define(["exports"],e):(t=typeof globalThis!="undefined"?globalThis:t||self,e(t["PayNext SDK"]={}))})(this,function(t){"use strict";var
|
|
1
|
+
(function(t,e){typeof exports=="object"&&typeof module!="undefined"?e(exports):typeof define=="function"&&define.amd?define(["exports"],e):(t=typeof globalThis!="undefined"?globalThis:t||self,e(t["PayNext SDK"]={}))})(this,function(t){"use strict";var D=Object.defineProperty;var f=(t,e,i)=>e in t?D(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i;var P=(t,e,i)=>f(t,typeof e!="symbol"?e+"":e,i);var d=(t,e,i)=>new Promise((c,s)=>{var N=a=>{try{y(i.next(a))}catch(n){s(n)}},u=a=>{try{y(i.throw(a))}catch(n){s(n)}},y=a=>a.done?c(a.value):Promise.resolve(a.value).then(N,u);y((i=i.apply(t,e)).next())});const e="https://paynext-sdk.cbvcode.workers.dev/index.cdn.js",i="1.0.0";let c=null,s=null;function N(){return d(this,null,function*(){return s||c||(c=new Promise((n,o)=>{if(typeof window=="undefined"){o(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,n(s);return}console.log("[PayNext CDN] Fetching SDK from:",e);const r=document.createElement("script");r.src=e,r.crossOrigin="anonymous",r.async=!0,r.onload=()=>{console.log("[PayNext CDN] Script loaded, checking global..."),setTimeout(()=>{const l=window.PayNextSDK;if(!l){console.error("[PayNext CDN 77777777] PayNextSDK not found in window after load"),c=null,document.head.removeChild(r),o(new Error("PayNextSDK not found in global scope after loading"));return}console.log("[PayNext CDN] SDK fetched successfully, exports:",Object.keys(l)),s=l,n(l)},1)},r.onerror=l=>{console.error("[PayNext CDN] Failed to load script:",l),c=null,document.head.removeChild(r),o(new Error("Failed to load PayNext SDK script from CDN"))},document.head.appendChild(r)}),c)})}class u{constructor(){P(this,"cdnInstance",null);P(this,"initPromise",null);this.initPromise=this.initialize()}initialize(){return d(this,null,function*(){try{console.log("[PayNext CDN] Loading SDK from CDN...");const o=yield N();if(console.log("[PayNext CDN] SDK loaded, exports:",Object.keys(o)),!o.PayNextCheckout)throw new Error("PayNextCheckout not found in CDN module");this.cdnInstance=new o.PayNextCheckout,console.log("[PayNext CDN] Instance created successfully")}catch(o){throw console.error("[PayNext CDN] Failed to initialize:",o),o}})}waitForReady(){return d(this,null,function*(){if(!this.initPromise)throw new Error("SDK initialization not started");if(yield this.initPromise,!this.cdnInstance)throw new Error("SDK instance not created")})}mount(o,r){return d(this,null,function*(){return console.log("[PayNext CDN] mount() called, waiting for SDK..."),yield this.waitForReady(),console.log("[PayNext CDN] SDK ready, calling mount on CDN instance..."),this.cdnInstance.mount(o,r)})}unmount(){return d(this,null,function*(){if(yield this.waitForReady(),this.cdnInstance.unmount)return this.cdnInstance.unmount()})}updateConfig(o){return d(this,null,function*(){if(yield this.waitForReady(),this.cdnInstance.updateConfig)return this.cdnInstance.updateConfig(o)})}static getVersion(){return i}static getCDNUrl(){return e}static isLoaded(){return s!==null}static preload(){return d(this,null,function*(){yield N()})}}const y={version:i,cdnUrl:e,preload:u.preload,isLoaded:u.isLoaded};var a=(n=>(n.PAYPAL="PAYPAL",n.APPLE_PAY="APPLEPAY",n.GOOGLE_PAY="GPAY",n.CARD="CARD",n.VENMO="VENMO",n))(a||{});t.PayNextCheckout=u,t.PayNextSDK=y,t.PaymentMethod=a,Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})});
|
|
2
2
|
//# sourceMappingURL=index.umd.js.map
|