@paynext/sdk 1.0.1 → 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/_headers CHANGED
@@ -1,21 +1,65 @@
1
1
  /*
2
2
  Access-Control-Allow-Origin: *
3
- Access-Control-Allow-Methods: GET, HEAD, OPTIONS
4
- Access-Control-Allow-Headers: Content-Type, Authorization
5
- Access-Control-Max-Age: 86400
6
- Cache-Control: public, max-age=3600
3
+ # Access-Control-Allow-Methods: GET, HEAD, OPTIONS
4
+ # Access-Control-Allow-Headers: Content-Type, Authorization
5
+ Vary: Accept-Encoding
7
6
  X-Content-Type-Options: nosniff
8
- X-Frame-Options: SAMEORIGIN
7
+ Content-Encoding: gzip
8
+ X-Xss-Protection: 1; mode=block
9
9
 
10
10
  /*.js
11
- Content-Type: text/javascript; charset=utf-8
12
- Cache-Control: public, max-age=3600
11
+ Content-Type: application/javascript
12
+ Cache-Control: public, max-age=0, s-maxage=60, must-revalidate
13
+ # Cache-Control: no-cache
13
14
 
14
15
  /*.css
15
16
  Content-Type: text/css; charset=utf-8
16
- Cache-Control: public, max-age=3600
17
+ Cache-Control: public, max-age=1800, s-maxage=86400, stale-while-revalidate=3600
18
+
19
+ /*.html
20
+ Content-Type: text/html; charset=utf-8
21
+ Cache-Control: no-cache
22
+ Pragma: no-cache
23
+ Expires: 0
17
24
 
18
25
  /*.map
26
+ Content-Type: application/json
27
+ Cache-Control: public, max-age=300, s-maxage=60
28
+
29
+ /*.json
19
30
  Content-Type: application/json
20
31
  Cache-Control: public, max-age=3600
21
32
 
33
+ /*.png
34
+ Cache-Control: public, max-age=31536000, immutable
35
+
36
+ /*.jpg
37
+ Cache-Control: public, max-age=31536000, immutable
38
+
39
+ /*.jpeg
40
+ Cache-Control: public, max-age=31536000, immutable
41
+
42
+ /*.gif
43
+ Cache-Control: public, max-age=31536000, immutable
44
+
45
+ /*.svg
46
+ Cache-Control: public, max-age=31536000, immutable
47
+
48
+ /*.webp
49
+ Cache-Control: public, max-age=31536000, immutable
50
+
51
+ /*.ico
52
+ Cache-Control: public, max-age=31536000, immutable
53
+
54
+ /*.woff
55
+ Cache-Control: public, max-age=31536000, immutable
56
+
57
+ /*.woff2
58
+ Cache-Control: public, max-age=31536000, immutable
59
+
60
+ /*.ttf
61
+ Cache-Control: public, max-age=31536000, immutable
62
+
63
+ /*.eot
64
+ Cache-Control: public, max-age=31536000, immutable
65
+
package/dist/index.d.ts CHANGED
@@ -128,10 +128,12 @@ declare enum DeclineCode {
128
128
  INVALID_CARD_NUMBER = "invalid_card_number",
129
129
  ISSUER_UNAVAILABLE = "issuer_unavailable",
130
130
  CARD_LOST_OR_STOLEN = "card_lost_or_stolen",
131
- CARD_DECLINED = "card_declined"
131
+ CARD_DECLINED = "card_declined",
132
+ PAYMENT_ATTEMPT_AUTHENTICATION_CANCELLED = "payment_attempt_authentication_cancelled",
133
+ PAYMENT_ATTEMPT_AUTHENTICATION_FAILED = "payment_attempt_authentication_failed"
132
134
  }
133
135
 
134
- declare type DeclineStatus = 'declined' | 'failed' | 'sdk_failed';
136
+ declare type DeclineStatus = 'declined' | 'failed' | 'sdk_failed' | 'blocked' | 'cancelled';
135
137
 
136
138
  export declare type DeepPartial<T> = T extends object ? {
137
139
  [P in keyof T]?: DeepPartial<T[P]>;
@@ -182,7 +184,8 @@ export declare enum PaymentMethod {
182
184
  APPLE_PAY = "APPLEPAY",
183
185
  GOOGLE_PAY = "GPAY",
184
186
  CARD = "CARD",
185
- VENMO = "VENMO"
187
+ VENMO = "VENMO",
188
+ CASHAPP = "CASHAPP"
186
189
  }
187
190
 
188
191
  export declare interface PaymentResult {
@@ -347,7 +350,8 @@ declare enum PaymentStatus {
347
350
  SETTLING = "SETTLING",
348
351
  SETTLED = "SETTLED",
349
352
  DECLINED = "DECLINED",
350
- CANCELLED = "CANCELLED"
353
+ CANCELLED = "CANCELLED",
354
+ BLOCKED = "BLOCKED"
351
355
  }
352
356
 
353
357
  export declare class PayNextCheckout {
@@ -358,7 +362,6 @@ export declare class PayNextCheckout {
358
362
  private waitForReady;
359
363
  mount(containerId: string, config: PayNextConfig): Promise<void>;
360
364
  unmount(): Promise<void>;
361
- updateConfig(config: any): Promise<void>;
362
365
  static preload(envType: 'develop' | 'staging' | 'sandbox' | 'production'): Promise<void>;
363
366
  }
364
367
 
@@ -391,6 +394,7 @@ export declare interface StylesConfig {
391
394
  GooglePayButton?: IGooglePayButtonStyles;
392
395
  WalletButton?: HTMLStyles;
393
396
  BraintreeButton?: HTMLStyles;
397
+ CashAppButton?: HTMLStyles;
394
398
  BackButton?: HTMLStyles;
395
399
  }
396
400
 
package/dist/index.es.js CHANGED
@@ -1,49 +1,49 @@
1
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) {
2
+ var u = (n, e, t) => e in n ? l(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
3
+ var d = (n, e, t) => u(n, typeof e != "symbol" ? e + "" : e, t);
4
+ const P = "https://cdn-sdk-dev.paynext.com/index.cdn.js", w = "https://cdn-sdk.paynext.com/index.cdn.js";
5
+ let r = null, a = null;
6
+ async function c(n) {
7
7
  if (a)
8
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) => {
9
+ if (r)
10
+ return r;
11
+ const e = n?.toLowerCase()?.includes("develop") || n?.toLowerCase()?.includes("staging") ? "develop" : "production";
12
+ return r = new Promise((t, s) => {
13
13
  if (typeof window > "u") {
14
14
  s(new Error("PayNext SDK can only be loaded in browser environment"));
15
15
  return;
16
16
  }
17
17
  if (window.PayNextSDK) {
18
- console.log("[PayNext CDN] SDK already loaded from cache"), a = window.PayNextSDK, e(a);
18
+ console.log("[PayNext CDN] SDK already loaded from cache"), a = window.PayNextSDK, t(a);
19
19
  return;
20
20
  }
21
21
  const o = document.createElement("script");
22
- o.src = n === "develop" ? w : P, o.crossOrigin = "*", o.async = !0, o.onload = () => {
23
- const r = window.PayNextSDK;
24
- if (!r) {
25
- 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"));
22
+ o.src = e === "develop" ? P : w, o.crossOrigin = "anonymous", o.async = !0, o.onload = () => {
23
+ const i = window.PayNextSDK;
24
+ if (!i) {
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"));
26
26
  return;
27
27
  }
28
- a = r, e(r);
29
- }, o.onerror = (r) => {
30
- 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"));
28
+ a = i, t(i);
29
+ }, o.onerror = (i) => {
30
+ console.error("[PayNext CDN] Failed to load script:", i), r = null, document.head.removeChild(o), s(new Error("Failed to load PayNext SDK script from CDN"));
31
31
  }, document.head.appendChild(o);
32
- }), i;
32
+ }), r;
33
33
  }
34
- class h {
34
+ class N {
35
35
  constructor() {
36
36
  d(this, "cdnInstance", null);
37
37
  d(this, "initPromise", null);
38
38
  }
39
39
  // initialize
40
- async initialize(n) {
40
+ async initialize(e) {
41
41
  try {
42
- if (this.initPromise = await c(n), !this.initPromise.PayNextCheckout)
42
+ if (this.initPromise = await c(e), !this.initPromise.PayNextCheckout)
43
43
  throw new Error("PayNextCheckout not found in CDN module");
44
44
  this.cdnInstance = new this.initPromise.PayNextCheckout();
45
- } catch (e) {
46
- throw console.error("[PayNext CDN] Failed to initialize:", e), e;
45
+ } catch (t) {
46
+ throw console.error("[PayNext CDN] Failed to initialize:", t), t;
47
47
  }
48
48
  }
49
49
  // wait for ready
@@ -54,30 +54,25 @@ class h {
54
54
  throw new Error("SDK instance not created");
55
55
  }
56
56
  // mount
57
- async mount(n, e) {
58
- return await this.initialize(e.environment), this.waitForReady(), this.cdnInstance?.mount(n, e);
57
+ async mount(e, t) {
58
+ return await this.initialize(t.environment), this.waitForReady(), this.cdnInstance?.mount(e, t);
59
59
  }
60
60
  // unmount
61
61
  async unmount() {
62
62
  if (this.waitForReady(), this.cdnInstance?.unmount)
63
63
  return this.cdnInstance.unmount();
64
64
  }
65
- // update config
66
- async updateConfig(n) {
67
- if (this.waitForReady(), this.cdnInstance?.updateConfig)
68
- return this.cdnInstance.updateConfig(n);
69
- }
70
65
  // preload (optional optimization)
71
- static async preload(n) {
72
- await c(n);
66
+ static async preload(e) {
67
+ await c(e);
73
68
  }
74
69
  }
75
70
  const m = {
76
- preload: h.preload
71
+ preload: N.preload
77
72
  };
78
- var y = /* @__PURE__ */ ((t) => (t.PAYPAL = "PAYPAL", t.APPLE_PAY = "APPLEPAY", t.GOOGLE_PAY = "GPAY", t.CARD = "CARD", t.VENMO = "VENMO", t))(y || {});
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 || {});
79
74
  export {
80
- h as PayNextCheckout,
75
+ N as PayNextCheckout,
81
76
  m as PayNextSDK,
82
77
  y as PaymentMethod
83
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 w=Object.defineProperty;var N=(e,n,a)=>n in e?w(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 o=t?.toLowerCase()?.includes("develop")||t?.toLowerCase()?.includes("staging")?"develop":"production";return d=new Promise((i,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,i(s);return}const r=document.createElement("script");r.src=o==="develop"?n:a,r.crossOrigin="*",r.async=!0,r.onload=()=>{const c=window.PayNextSDK;if(!c){console.error("[PayNext CDN] PayNextSDK not found in window after load"),d=null,document.head.removeChild(r),l(new Error("PayNextSDK not found in global scope after loading"));return}s=c,i(c)},r.onerror=c=>{console.error("[PayNext CDN] Failed to load script:",c),d=null,document.head.removeChild(r),l(new Error("Failed to load PayNext SDK script from CDN"))},document.head.appendChild(r)}),d}class y{constructor(){u(this,"cdnInstance",null);u(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"})}));
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"})}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paynext/sdk",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "PayNext SDK - Payment processing with automatic CDN loading",
5
5
  "type": "module",
6
6
  "main": "dist/index.es.js",
@@ -60,27 +60,28 @@
60
60
  }
61
61
  },
62
62
  "devDependencies": {
63
- "@eslint/js": "^9.38.0",
63
+ "@eslint/js": "^9.39.1",
64
64
  "@evervault/js": "^2.6.0",
65
65
  "@evervault/react": "^2.22.0",
66
66
  "@heroui/react": "^2.8.5",
67
67
  "@paypal/paypal-js": "^8.4.2",
68
68
  "@paypal/react-paypal-js": "^8.9.2",
69
- "@sentry/browser": "^10.22.0",
69
+ "@sentry/browser": "^10.24.0",
70
+ "@stripe/stripe-js": "^8.3.0",
70
71
  "@types/braintree-web": "^3.96.17",
71
72
  "@types/node": "^22",
72
73
  "@types/react": "^19.2.2",
73
74
  "@types/react-dom": "^19.2.2",
74
75
  "@vitejs/plugin-legacy": "^7.2.1",
75
76
  "@vitejs/plugin-react": "^5.1.0",
76
- "autoprefixer": "^10.4.21",
77
+ "autoprefixer": "^10.4.22",
77
78
  "braintree-web": "^3.132.0",
78
79
  "credit-card-type": "^10.1.0",
79
- "eslint": "^9.38.0",
80
+ "eslint": "^9.39.1",
80
81
  "eslint-plugin-prettier": "^5.5.4",
81
82
  "eslint-plugin-react-hooks": "^7.0.1",
82
83
  "eslint-plugin-react-refresh": "^0.4.24",
83
- "globals": "^16.4.0",
84
+ "globals": "^16.5.0",
84
85
  "motion": "^12.23.24",
85
86
  "prettier": "^3.6.2",
86
87
  "prettier-plugin-tailwindcss": "^0.6.9",
@@ -88,16 +89,16 @@
88
89
  "react-dom": "^19.2.0",
89
90
  "react-router": "^7.9.5",
90
91
  "tailwindcss": "^3.4.17",
91
- "terser": "^5.44.0",
92
+ "terser": "^5.44.1",
92
93
  "typescript": "~5.9.3",
93
- "typescript-eslint": "^8.46.2",
94
- "vite": "^7.1.12",
94
+ "typescript-eslint": "^8.46.4",
95
+ "vite": "^7.2.2",
95
96
  "vite-bundle-analyzer": "^1.2.3",
96
97
  "vite-plugin-css-injected-by-js": "^3.5.2",
97
98
  "vite-plugin-dts": "^4.5.4",
98
99
  "vite-plugin-static-copy": "^3.1.4",
99
100
  "vite-plugin-svgr": "^4.5.0",
100
- "wrangler": "^4.45.3"
101
+ "wrangler": "^4.46.0"
101
102
  },
102
103
  "browserslist": [
103
104
  "last 2 versions",