@paynext/sdk 0.0.156 → 0.0.158

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 CHANGED
@@ -356,7 +356,6 @@ export declare class PayNextCheckout {
356
356
  mount(containerId: string, config: PayNextConfig): Promise<void>;
357
357
  unmount(): Promise<void>;
358
358
  updateConfig(config: any): Promise<void>;
359
- static isLoaded(): boolean;
360
359
  static preload(envType: 'develop' | 'staging' | 'sandbox' | 'production'): Promise<void>;
361
360
  }
362
361
 
@@ -376,9 +375,7 @@ export declare interface PayNextConfig {
376
375
  }
377
376
 
378
377
  export declare const PayNextSDK: {
379
- version: string;
380
378
  preload: typeof PayNextCheckout.preload;
381
- isLoaded: typeof PayNextCheckout.isLoaded;
382
379
  };
383
380
 
384
381
  export declare interface StylesConfig {
package/dist/index.es.js CHANGED
@@ -1,73 +1,52 @@
1
- var m = Object.defineProperty;
2
- var D = (n, t, o) => t in n ? m(n, t, { enumerable: !0, configurable: !0, writable: !0, value: o }) : n[t] = o;
3
- var P = (n, t, o) => D(n, typeof t != "symbol" ? t + "" : t, o);
4
- var s = (n, t, o) => new Promise((r, l) => {
5
- var u = (a) => {
6
- try {
7
- i(o.next(a));
8
- } catch (w) {
9
- l(w);
1
+ var l = Object.defineProperty;
2
+ var u = (t, n, e) => n in t ? l(t, n, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[n] = e;
3
+ var d = (t, n, e) => u(t, typeof n != "symbol" ? n + "" : n, e);
4
+ const w = "https://cdn-sdk-dev.paynext.com/index.cdn.js", P = "https://cdn-sdk.paynext.com/index.cdn.js";
5
+ let i = null, a = null;
6
+ async function c(t) {
7
+ if (a)
8
+ return a;
9
+ if (i)
10
+ return i;
11
+ const n = t?.toLowerCase()?.includes("develop") || t?.toLowerCase()?.includes("staging") ? "develop" : "production";
12
+ return i = new Promise((e, s) => {
13
+ if (typeof window > "u") {
14
+ s(new Error("PayNext SDK can only be loaded in browser environment"));
15
+ return;
10
16
  }
11
- }, e = (a) => {
12
- try {
13
- i(o.throw(a));
14
- } catch (w) {
15
- l(w);
17
+ if (window.PayNextSDK) {
18
+ console.log("[PayNext CDN] SDK already loaded from cache"), a = window.PayNextSDK, e(a);
19
+ return;
16
20
  }
17
- }, i = (a) => a.done ? r(a.value) : Promise.resolve(a.value).then(u, e);
18
- i((o = o.apply(n, t)).next());
19
- });
20
- const C = "https://cdn-sdk-dev.paynext.com/index.cdn.js", f = "https://cdn-sdk.paynext.com/index.cdn.js", x = "1.0.0";
21
- let d = null, c = null;
22
- function h(n) {
23
- return s(this, null, function* () {
24
- var o, r;
25
- if (c)
26
- return c;
27
- if (d)
28
- return d;
29
- const t = (o = n == null ? void 0 : n.toLowerCase()) != null && o.includes("develop") || (r = n == null ? void 0 : n.toLowerCase()) != null && r.includes("staging") ? "develop" : "production";
30
- return d = new Promise((l, u) => {
31
- if (typeof window == "undefined") {
32
- u(new Error("PayNext SDK can only be loaded in browser environment"));
33
- return;
34
- }
35
- if (window.PayNextSDK) {
36
- console.log("[PayNext CDN] SDK already loaded from cache"), c = window.PayNextSDK, l(c);
37
- return;
38
- }
39
- const e = document.createElement("script");
40
- e.src = t === "develop" ? C : f, e.crossOrigin = "*", e.async = !0, e.onload = () => {
41
- setTimeout(() => {
42
- const i = window.PayNextSDK;
43
- if (!i) {
44
- console.error("[PayNext CDN] PayNextSDK not found in window after load"), d = null, document.head.removeChild(e), u(new Error("PayNextSDK not found in global scope after loading"));
45
- return;
46
- }
47
- c = i, l(i);
48
- }, 10);
49
- }, e.onerror = (i) => {
50
- console.error("[PayNext CDN] Failed to load script:", i), d = null, document.head.removeChild(e), u(new Error("Failed to load PayNext SDK script from CDN"));
51
- }, document.head.appendChild(e);
52
- }), d;
53
- });
21
+ const o = document.createElement("script");
22
+ o.src = n === "develop" ? w : P, o.crossOrigin = "*", o.async = !0, o.onload = () => {
23
+ setTimeout(() => {
24
+ const r = window.PayNextSDK;
25
+ if (!r) {
26
+ console.error("[PayNext CDN] PayNextSDK not found in window after load"), i = null, document.head.removeChild(o), s(new Error("PayNextSDK not found in global scope after loading"));
27
+ return;
28
+ }
29
+ a = r, e(r);
30
+ }, 10);
31
+ }, o.onerror = (r) => {
32
+ console.error("[PayNext CDN] Failed to load script:", r), i = null, document.head.removeChild(o), s(new Error("Failed to load PayNext SDK script from CDN"));
33
+ }, document.head.appendChild(o);
34
+ }), i;
54
35
  }
55
- class N {
36
+ class h {
56
37
  constructor() {
57
- P(this, "cdnInstance", null);
58
- P(this, "initPromise", null);
38
+ d(this, "cdnInstance", null);
39
+ d(this, "initPromise", null);
59
40
  }
60
41
  // initialize
61
- initialize(t) {
62
- return s(this, null, function* () {
63
- try {
64
- if (this.initPromise = yield h(t), !this.initPromise.PayNextCheckout)
65
- throw new Error("PayNextCheckout not found in CDN module");
66
- this.cdnInstance = new this.initPromise.PayNextCheckout();
67
- } catch (o) {
68
- throw console.error("[PayNext CDN] Failed to initialize:", o), o;
69
- }
70
- });
42
+ async initialize(n) {
43
+ try {
44
+ if (this.initPromise = await c(n), !this.initPromise.PayNextCheckout)
45
+ throw new Error("PayNextCheckout not found in CDN module");
46
+ this.cdnInstance = new this.initPromise.PayNextCheckout();
47
+ } catch (e) {
48
+ throw console.error("[PayNext CDN] Failed to initialize:", e), e;
49
+ }
71
50
  }
72
51
  // wait for ready
73
52
  waitForReady() {
@@ -77,48 +56,30 @@ class N {
77
56
  throw new Error("SDK instance not created");
78
57
  }
79
58
  // mount
80
- mount(t, o) {
81
- return s(this, null, function* () {
82
- var r;
83
- return yield this.initialize(o.environment), this.waitForReady(), (r = this.cdnInstance) == null ? void 0 : r.mount(t, o);
84
- });
59
+ async mount(n, e) {
60
+ return await this.initialize(e.environment), this.waitForReady(), this.cdnInstance?.mount(n, e);
85
61
  }
86
62
  // unmount
87
- unmount() {
88
- return s(this, null, function* () {
89
- var t;
90
- if (this.waitForReady(), (t = this.cdnInstance) != null && t.unmount)
91
- return this.cdnInstance.unmount();
92
- });
63
+ async unmount() {
64
+ if (this.waitForReady(), this.cdnInstance?.unmount)
65
+ return this.cdnInstance.unmount();
93
66
  }
94
67
  // update config
95
- updateConfig(t) {
96
- return s(this, null, function* () {
97
- var o;
98
- if (this.waitForReady(), (o = this.cdnInstance) != null && o.updateConfig)
99
- return this.cdnInstance.updateConfig(t);
100
- });
101
- }
102
- // check if loaded
103
- static isLoaded() {
104
- return c !== null;
68
+ async updateConfig(n) {
69
+ if (this.waitForReady(), this.cdnInstance?.updateConfig)
70
+ return this.cdnInstance.updateConfig(n);
105
71
  }
106
72
  // preload (optional optimization)
107
- static preload(t) {
108
- return s(this, null, function* () {
109
- yield h(t);
110
- });
73
+ static async preload(n) {
74
+ await c(n);
111
75
  }
112
76
  }
113
- const E = {
114
- version: x,
115
- preload: N.preload,
116
- isLoaded: N.isLoaded
77
+ const m = {
78
+ preload: h.preload
117
79
  };
118
- var y = /* @__PURE__ */ ((n) => (n.PAYPAL = "PAYPAL", n.APPLE_PAY = "APPLEPAY", n.GOOGLE_PAY = "GPAY", n.CARD = "CARD", n.VENMO = "VENMO", n))(y || {});
80
+ var y = /* @__PURE__ */ ((t) => (t.PAYPAL = "PAYPAL", t.APPLE_PAY = "APPLEPAY", t.GOOGLE_PAY = "GPAY", t.CARD = "CARD", t.VENMO = "VENMO", t))(y || {});
119
81
  export {
120
- N as PayNextCheckout,
121
- E as PayNextSDK,
82
+ h as PayNextCheckout,
83
+ m as PayNextSDK,
122
84
  y as PaymentMethod
123
85
  };
124
- //# sourceMappingURL=index.es.js.map
package/dist/index.umd.js CHANGED
@@ -1,2 +1 @@
1
- (function(t,n){typeof exports=="object"&&typeof module!="undefined"?n(exports):typeof define=="function"&&define.amd?define(["exports"],n):(t=typeof globalThis!="undefined"?globalThis:t||self,n(t["PayNext SDK"]={}))})(this,(function(t){"use strict";var C=Object.defineProperty;var x=(t,n,i)=>n in t?C(t,n,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[n]=i;var y=(t,n,i)=>x(t,typeof n!="symbol"?n+"":n,i);var l=(t,n,i)=>new Promise((N,a)=>{var s=d=>{try{u(i.next(d))}catch(P){a(P)}},w=d=>{try{u(i.throw(d))}catch(P){a(P)}},u=d=>d.done?N(d.value):Promise.resolve(d.value).then(s,w);u((i=i.apply(t,n)).next())});const n="https://cdn-sdk-dev.paynext.com/index.cdn.js",i="https://cdn-sdk.paynext.com/index.cdn.js",N="1.0.0";let a=null,s=null;function w(e){return l(this,null,function*(){var r,f;if(s)return s;if(a)return a;const o=(r=e==null?void 0:e.toLowerCase())!=null&&r.includes("develop")||(f=e==null?void 0:e.toLowerCase())!=null&&f.includes("staging")?"develop":"production";return a=new Promise((D,m)=>{if(typeof window=="undefined"){m(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,D(s);return}const c=document.createElement("script");c.src=o==="develop"?n:i,c.crossOrigin="*",c.async=!0,c.onload=()=>{setTimeout(()=>{const h=window.PayNextSDK;if(!h){console.error("[PayNext CDN] PayNextSDK not found in window after load"),a=null,document.head.removeChild(c),m(new Error("PayNextSDK not found in global scope after loading"));return}s=h,D(h)},10)},c.onerror=h=>{console.error("[PayNext CDN] Failed to load script:",h),a=null,document.head.removeChild(c),m(new Error("Failed to load PayNext SDK script from CDN"))},document.head.appendChild(c)}),a})}class u{constructor(){y(this,"cdnInstance",null);y(this,"initPromise",null)}initialize(o){return l(this,null,function*(){try{if(this.initPromise=yield w(o),!this.initPromise.PayNextCheckout)throw new Error("PayNextCheckout not found in CDN module");this.cdnInstance=new this.initPromise.PayNextCheckout}catch(r){throw console.error("[PayNext CDN] Failed to initialize:",r),r}})}waitForReady(){if(!this.initPromise)throw new Error("SDK initialization not started");if(!this.cdnInstance)throw new Error("SDK instance not created")}mount(o,r){return l(this,null,function*(){var f;return yield this.initialize(r.environment),this.waitForReady(),(f=this.cdnInstance)==null?void 0:f.mount(o,r)})}unmount(){return l(this,null,function*(){var o;if(this.waitForReady(),(o=this.cdnInstance)!=null&&o.unmount)return this.cdnInstance.unmount()})}updateConfig(o){return l(this,null,function*(){var r;if(this.waitForReady(),(r=this.cdnInstance)!=null&&r.updateConfig)return this.cdnInstance.updateConfig(o)})}static isLoaded(){return s!==null}static preload(o){return l(this,null,function*(){yield w(o)})}}const d={version:N,preload:u.preload,isLoaded:u.isLoaded};var P=(e=>(e.PAYPAL="PAYPAL",e.APPLE_PAY="APPLEPAY",e.GOOGLE_PAY="GPAY",e.CARD="CARD",e.VENMO="VENMO",e))(P||{});t.PayNextCheckout=u,t.PayNextSDK=d,t.PaymentMethod=P,Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})}));
2
- //# sourceMappingURL=index.umd.js.map
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 w=Object.defineProperty;var m=(e,n,a)=>n in e?w(e,n,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[n]=a;var l=(e,n,a)=>m(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 o=t?.toLowerCase()?.includes("develop")||t?.toLowerCase()?.includes("staging")?"develop":"production";return d=new Promise((i,u)=>{if(typeof window>"u"){u(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,i(s);return}const r=document.createElement("script");r.src=o==="develop"?n:a,r.crossOrigin="*",r.async=!0,r.onload=()=>{setTimeout(()=>{const c=window.PayNextSDK;if(!c){console.error("[PayNext CDN] PayNextSDK not found in window after load"),d=null,document.head.removeChild(r),u(new Error("PayNextSDK not found in global scope after loading"));return}s=c,i(c)},10)},r.onerror=c=>{console.error("[PayNext CDN] Failed to load script:",c),d=null,document.head.removeChild(r),u(new Error("Failed to load PayNext SDK script from CDN"))},document.head.appendChild(r)}),d}class y{constructor(){l(this,"cdnInstance",null);l(this,"initPromise",null)}async initialize(o){try{if(this.initPromise=await P(o),!this.initPromise.PayNextCheckout)throw new Error("PayNextCheckout not found in CDN module");this.cdnInstance=new this.initPromise.PayNextCheckout}catch(i){throw console.error("[PayNext CDN] Failed to initialize:",i),i}}waitForReady(){if(!this.initPromise)throw new Error("SDK initialization not started");if(!this.cdnInstance)throw new Error("SDK instance not created")}async mount(o,i){return await this.initialize(i.environment),this.waitForReady(),this.cdnInstance?.mount(o,i)}async unmount(){if(this.waitForReady(),this.cdnInstance?.unmount)return this.cdnInstance.unmount()}async updateConfig(o){if(this.waitForReady(),this.cdnInstance?.updateConfig)return this.cdnInstance.updateConfig(o)}static async preload(o){await P(o)}}const h={preload:y.preload};var f=(t=>(t.PAYPAL="PAYPAL",t.APPLE_PAY="APPLEPAY",t.GOOGLE_PAY="GPAY",t.CARD="CARD",t.VENMO="VENMO",t))(f||{});e.PayNextCheckout=y,e.PayNextSDK=h,e.PaymentMethod=f,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paynext/sdk",
3
- "version": "0.0.156",
3
+ "version": "0.0.158",
4
4
  "description": "PayNext SDK - Payment processing with automatic CDN loading",
5
5
  "type": "module",
6
6
  "main": "dist/index.es.js",
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.es.js","sources":["../src/app/sdk-pkg/sdk.pkg.ts","../src/pkg/checkout-api/constants/enums.ts"],"sourcesContent":["import type { PayNextConfig } from \"@/core/modules/checkout/checkout.interface\"\n\n// CDN configuration\nconst CDN_URL_DEV = 'https://cdn-sdk-dev.paynext.com/index.cdn.js'\nconst CDN_URL_PROD = 'https://cdn-sdk.paynext.com/index.cdn.js'\nconst CDN_VERSION = '1.0.0'\n\n// cache for loaded SDK\nlet sdkPromise: Promise<any> | null = null\nlet sdkModule: any = null\n\n// dynamically load SDK from CDN\nasync function loadSDKFromCDN(envType: 'develop' | 'staging' | 'sandbox' | 'production'): Promise<any> {\n if (sdkModule) {\n return sdkModule\n }\n\n if (sdkPromise) {\n return sdkPromise\n }\n\n const environment = (envType?.toLowerCase()?.includes('develop') || envType?.toLowerCase()?.includes('staging')) ? 'develop' : 'production'\n\n sdkPromise = new Promise((resolve, reject) => {\n if (typeof window === 'undefined') {\n reject(new Error('PayNext SDK can only be loaded in browser environment'))\n return\n }\n\n if ((window as any).PayNextSDK) {\n console.log('[PayNext CDN] SDK already loaded from cache')\n sdkModule = (window as any).PayNextSDK\n resolve(sdkModule)\n return\n }\n \n const script = document.createElement('script')\n script.src = environment === 'develop' ? CDN_URL_DEV : CDN_URL_PROD\n script.crossOrigin = '*'\n script.async = true\n \n script.onload = () => { \n setTimeout(() => {\n const module = (window as any).PayNextSDK\n \n if (!module) {\n console.error('[PayNext CDN] PayNextSDK not found in window after load')\n sdkPromise = null\n document.head.removeChild(script)\n reject(new Error('PayNextSDK not found in global scope after loading'))\n return\n }\n \n sdkModule = module\n resolve(module)\n }, 10)\n }\n \n script.onerror = (error) => {\n console.error('[PayNext CDN] Failed to load script:', error)\n sdkPromise = null\n document.head.removeChild(script)\n reject(new Error('Failed to load PayNext SDK script from CDN'))\n }\n \n document.head.appendChild(script)\n })\n\n return sdkPromise\n}\n\n// checkout proxy class\nexport class PayNextCheckout {\n private cdnInstance: any = null\n private initPromise: any | null = null\n\n constructor() {}\n\n // initialize\n private async initialize(envType: 'develop' | 'staging' | 'sandbox' | 'production'): Promise<void> {\n try {\n this.initPromise = await loadSDKFromCDN(envType)\n \n if (!this.initPromise.PayNextCheckout) {\n throw new Error('PayNextCheckout not found in CDN module')\n }\n \n this.cdnInstance = new this.initPromise.PayNextCheckout()\n } catch (error) {\n console.error('[PayNext CDN] Failed to initialize:', error)\n throw error\n }\n }\n\n // wait for ready\n private waitForReady(): void {\n if (!this.initPromise) {\n throw new Error('SDK initialization not started')\n }\n\n if (!this.cdnInstance) {\n throw new Error('SDK instance not created')\n }\n }\n\n // mount\n async mount(containerId: string, config: PayNextConfig): Promise<void> {\n await this.initialize(config.environment)\n this.waitForReady()\n return this.cdnInstance?.mount(containerId, config)\n }\n\n // unmount\n async unmount(): Promise<void> {\n this.waitForReady()\n if (this.cdnInstance?.unmount) {\n return this.cdnInstance.unmount()\n }\n }\n\n // update config\n async updateConfig(config: any): Promise<void> {\n this.waitForReady()\n if (this.cdnInstance?.updateConfig) {\n return this.cdnInstance.updateConfig(config)\n }\n }\n\n // check if loaded\n static isLoaded(): boolean {\n return sdkModule !== null\n }\n\n // preload (optional optimization)\n static async preload(envType: 'develop' | 'staging' | 'sandbox' | 'production'): Promise<void> {\n await loadSDKFromCDN(envType)\n }\n}\n\n// export\nexport const PayNextSDK = {\n version: CDN_VERSION,\n preload: PayNextCheckout.preload,\n isLoaded: PayNextCheckout.isLoaded,\n}\n\nexport default PayNextCheckout\n\n","export enum PaymentMethod {\n PAYPAL = 'PAYPAL',\n APPLE_PAY = 'APPLEPAY',\n GOOGLE_PAY = 'GPAY',\n CARD = 'CARD',\n VENMO = 'VENMO',\n}\n\nexport enum PaymentStatus {\n PENDING = 'PENDING',\n FAILED = 'FAILED',\n AUTHORIZED = 'AUTHORIZED',\n SETTLING = 'SETTLING',\n SETTLED = 'SETTLED',\n DECLINED = 'DECLINED',\n CANCELLED = 'CANCELLED',\n}\n\nexport enum DeclineCode {\n INSUFFICIENT_FUNDS = 'insufficient_funds',\n AUTHENTICATION_REQUIRED = 'authentication_required',\n CARD_ISSUER_DECLINE = 'card_issuer_decline',\n GENERIC_DECLINE = 'generic_decline',\n WITHDRAWAL_LIMIT_EXCEEDED = 'withdrawal_limit_exceeded',\n DO_NOT_HONOR = 'do_not_honor',\n EXPIRED_CARD = 'expired_card',\n SUSPECTED_FRAUD = 'suspected_fraud',\n INCORRECT_CVC = 'incorrect_cvc',\n INVALID_CARD_NUMBER = 'invalid_card_number',\n ISSUER_UNAVAILABLE = 'issuer_unavailable',\n CARD_LOST_OR_STOLEN = 'card_lost_or_stolen',\n CARD_DECLINED = 'card_declined',\n}\n"],"names":["CDN_URL_DEV","CDN_URL_PROD","CDN_VERSION","sdkPromise","sdkModule","loadSDKFromCDN","envType","__async","_a","_b","environment","resolve","reject","script","module","error","PayNextCheckout","__publicField","containerId","config","PayNextSDK","PaymentMethod"],"mappings":";;;;;;;;;;;;;;;;;;;AAGA,MAAMA,IAAc,gDACdC,IAAe,4CACfC,IAAc;AAGpB,IAAIC,IAAkC,MAClCC,IAAiB;AAGrB,SAAeC,EAAeC,GAAyE;AAAA,SAAAC,EAAA;AATvG,QAAAC,GAAAC;AAUE,QAAIL;AACF,aAAOA;AAGT,QAAID;AACF,aAAOA;AAGT,UAAMO,KAAeF,IAAAF,KAAA,gBAAAA,EAAS,kBAAT,QAAAE,EAAwB,SAAS,eAAcC,IAAAH,KAAA,gBAAAA,EAAS,kBAAT,QAAAG,EAAwB,SAAS,aAAc,YAAY;AAE/H,WAAAN,IAAa,IAAI,QAAQ,CAACQ,GAASC,MAAW;AAC5C,UAAI,OAAO,UAAW,aAAa;AACjC,QAAAA,EAAO,IAAI,MAAM,uDAAuD,CAAC;AACzE;AAAA,MACF;AAEA,UAAK,OAAe,YAAY;AAC9B,gBAAQ,IAAI,6CAA6C,GACzDR,IAAa,OAAe,YAC5BO,EAAQP,CAAS;AACjB;AAAA,MACF;AAEA,YAAMS,IAAS,SAAS,cAAc,QAAQ;AAC9C,MAAAA,EAAO,MAAMH,MAAgB,YAAYV,IAAcC,GACvDY,EAAO,cAAc,KACrBA,EAAO,QAAQ,IAEfA,EAAO,SAAS,MAAM;AACpB,mBAAW,MAAM;AACf,gBAAMC,IAAU,OAAe;AAE/B,cAAI,CAACA,GAAQ;AACX,oBAAQ,MAAM,yDAAyD,GACvEX,IAAa,MACb,SAAS,KAAK,YAAYU,CAAM,GAChCD,EAAO,IAAI,MAAM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L,QAAAA,EAAkB;AACpB,eAAO,KAAK,YAAY,QAAA;AAAA,IAE5B;AAAA;AAAA;AAAA,EAGM,aAAaW,GAA4B;AAAA,WAAAZ,EAAA;AAtHjD,UAAAC;AAwHI,UADA,KAAK,aAAA,IACDA,IAAA,KAAK,gBAAL,QAAAA,EAAkB;AACpB,eAAO,KAAK,YAAY,aAAaW,CAAM;AAAA,IAE/C;AAAA;AAAA;AAAA,EAGA,OAAO,WAAoB;AACzB,WAAOf,MAAc;AAAA,EACvB;AAAA;AAAA,EAGA,OAAa,QAAQE,GAA0E;AAAA,WAAAC,EAAA;AAC7F,YAAMF,EAAeC,CAAO;AAAA,IAC9B;AAAA;AACF;AAGO,MAAMc,IAAa;AAAA,EACxB,SAASlB;AAAA,EACT,SAASc,EAAgB;AAAA,EACzB,UAAUA,EAAgB;AAC5B;AChJO,IAAKK,sBAAAA,OACVA,EAAA,SAAS,UACTA,EAAA,YAAY,YACZA,EAAA,aAAa,QACbA,EAAA,OAAO,QACPA,EAAA,QAAQ,SALEA,IAAAA,KAAA,CAAA,CAAA;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.umd.js","sources":["../src/app/sdk-pkg/sdk.pkg.ts","../src/pkg/checkout-api/constants/enums.ts"],"sourcesContent":["import type { PayNextConfig } from \"@/core/modules/checkout/checkout.interface\"\n\n// CDN configuration\nconst CDN_URL_DEV = 'https://cdn-sdk-dev.paynext.com/index.cdn.js'\nconst CDN_URL_PROD = 'https://cdn-sdk.paynext.com/index.cdn.js'\nconst CDN_VERSION = '1.0.0'\n\n// cache for loaded SDK\nlet sdkPromise: Promise<any> | null = null\nlet sdkModule: any = null\n\n// dynamically load SDK from CDN\nasync function loadSDKFromCDN(envType: 'develop' | 'staging' | 'sandbox' | 'production'): Promise<any> {\n if (sdkModule) {\n return sdkModule\n }\n\n if (sdkPromise) {\n return sdkPromise\n }\n\n const environment = (envType?.toLowerCase()?.includes('develop') || envType?.toLowerCase()?.includes('staging')) ? 'develop' : 'production'\n\n sdkPromise = new Promise((resolve, reject) => {\n if (typeof window === 'undefined') {\n reject(new Error('PayNext SDK can only be loaded in browser environment'))\n return\n }\n\n if ((window as any).PayNextSDK) {\n console.log('[PayNext CDN] SDK already loaded from cache')\n sdkModule = (window as any).PayNextSDK\n resolve(sdkModule)\n return\n }\n \n const script = document.createElement('script')\n script.src = environment === 'develop' ? CDN_URL_DEV : CDN_URL_PROD\n script.crossOrigin = '*'\n script.async = true\n \n script.onload = () => { \n setTimeout(() => {\n const module = (window as any).PayNextSDK\n \n if (!module) {\n console.error('[PayNext CDN] PayNextSDK not found in window after load')\n sdkPromise = null\n document.head.removeChild(script)\n reject(new Error('PayNextSDK not found in global scope after loading'))\n return\n }\n \n sdkModule = module\n resolve(module)\n }, 10)\n }\n \n script.onerror = (error) => {\n console.error('[PayNext CDN] Failed to load script:', error)\n sdkPromise = null\n document.head.removeChild(script)\n reject(new Error('Failed to load PayNext SDK script from CDN'))\n }\n \n document.head.appendChild(script)\n })\n\n return sdkPromise\n}\n\n// checkout proxy class\nexport class PayNextCheckout {\n private cdnInstance: any = null\n private initPromise: any | null = null\n\n constructor() {}\n\n // initialize\n private async initialize(envType: 'develop' | 'staging' | 'sandbox' | 'production'): Promise<void> {\n try {\n this.initPromise = await loadSDKFromCDN(envType)\n \n if (!this.initPromise.PayNextCheckout) {\n throw new Error('PayNextCheckout not found in CDN module')\n }\n \n this.cdnInstance = new this.initPromise.PayNextCheckout()\n } catch (error) {\n console.error('[PayNext CDN] Failed to initialize:', error)\n throw error\n }\n }\n\n // wait for ready\n private waitForReady(): void {\n if (!this.initPromise) {\n throw new Error('SDK initialization not started')\n }\n\n if (!this.cdnInstance) {\n throw new Error('SDK instance not created')\n }\n }\n\n // mount\n async mount(containerId: string, config: PayNextConfig): Promise<void> {\n await this.initialize(config.environment)\n this.waitForReady()\n return this.cdnInstance?.mount(containerId, config)\n }\n\n // unmount\n async unmount(): Promise<void> {\n this.waitForReady()\n if (this.cdnInstance?.unmount) {\n return this.cdnInstance.unmount()\n }\n }\n\n // update config\n async updateConfig(config: any): Promise<void> {\n this.waitForReady()\n if (this.cdnInstance?.updateConfig) {\n return this.cdnInstance.updateConfig(config)\n }\n }\n\n // check if loaded\n static isLoaded(): boolean {\n return sdkModule !== null\n }\n\n // preload (optional optimization)\n static async preload(envType: 'develop' | 'staging' | 'sandbox' | 'production'): Promise<void> {\n await loadSDKFromCDN(envType)\n }\n}\n\n// export\nexport const PayNextSDK = {\n version: CDN_VERSION,\n preload: PayNextCheckout.preload,\n isLoaded: PayNextCheckout.isLoaded,\n}\n\nexport default PayNextCheckout\n\n","export enum PaymentMethod {\n PAYPAL = 'PAYPAL',\n APPLE_PAY = 'APPLEPAY',\n GOOGLE_PAY = 'GPAY',\n CARD = 'CARD',\n VENMO = 'VENMO',\n}\n\nexport enum PaymentStatus {\n PENDING = 'PENDING',\n FAILED = 'FAILED',\n AUTHORIZED = 'AUTHORIZED',\n SETTLING = 'SETTLING',\n SETTLED = 'SETTLED',\n DECLINED = 'DECLINED',\n CANCELLED = 'CANCELLED',\n}\n\nexport enum DeclineCode {\n INSUFFICIENT_FUNDS = 'insufficient_funds',\n AUTHENTICATION_REQUIRED = 'authentication_required',\n CARD_ISSUER_DECLINE = 'card_issuer_decline',\n GENERIC_DECLINE = 'generic_decline',\n WITHDRAWAL_LIMIT_EXCEEDED = 'withdrawal_limit_exceeded',\n DO_NOT_HONOR = 'do_not_honor',\n EXPIRED_CARD = 'expired_card',\n SUSPECTED_FRAUD = 'suspected_fraud',\n INCORRECT_CVC = 'incorrect_cvc',\n INVALID_CARD_NUMBER = 'invalid_card_number',\n ISSUER_UNAVAILABLE = 'issuer_unavailable',\n CARD_LOST_OR_STOLEN = 'card_lost_or_stolen',\n CARD_DECLINED = 'card_declined',\n}\n"],"names":["CDN_URL_DEV","CDN_URL_PROD","CDN_VERSION","sdkPromise","sdkModule","loadSDKFromCDN","envType","__async","environment","_a","_b","resolve","reject","script","module","error","PayNextCheckout","__publicField","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