@paynext/sdk 0.0.48 → 0.0.49

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/README.md CHANGED
@@ -18,7 +18,10 @@ import '@paynext/sdk/styles'
18
18
  const checkout = new PayNextCheckout(document.getElementById('checkout-form'))
19
19
 
20
20
  await checkout.mount({
21
- clientToken: 'your-client-token',
21
+ clientToken: '<you-client-token>',
22
+ environment: 'sandbox',
23
+ apiVersion: '1.0.0'
24
+ locale: 'en',
22
25
  onCheckoutComplete: (result: PaymentResult) => {
23
26
  console.log('Payment successful!', result)
24
27
  },
@@ -48,10 +51,6 @@ export const CheckoutComponent: FC<Readonly<IProps> = (props) => {
48
51
  const checkoutRef = useRef<HTMLDivElement>(null)
49
52
 
50
53
  useEffect(() => {
51
- if (!clientToken) {
52
- return
53
- }
54
-
55
54
  const checkout = new PayNextCheckout(checkoutRef.current)
56
55
 
57
56
  checkout.mount({
package/dist/index.es.js CHANGED
@@ -3752,6 +3752,7 @@ class Uc {
3752
3752
  const Bc = (n, e, t) => e.concat(n.filter((r) => e.every((i) => !t(r, i)))), _n = (n = "sandbox") => ({
3753
3753
  develop: "https://api-dev.paynext.com",
3754
3754
  sandbox: "https://api-sandbox.paynext.com",
3755
+ staging: "https://api-staging.paynext.com",
3755
3756
  production: "https://api.paynext.com"
3756
3757
  })[n], zc = [
3757
3758
  {
@@ -3776,7 +3777,7 @@ const Bc = (n, e, t) => e.concat(n.filter((r) => e.every((i) => !t(r, i)))), _n
3776
3777
  }
3777
3778
  ], jc = (n, e, t) => j(void 0, null, function* () {
3778
3779
  var o, l, c, u, d, h, p, m, f, v, y, w, T, x, A, I, L, k, B, G, q, M, F, K, J, S, W, z, g, E, R, U, _, O, C, P, V, N, H, X, re, D, ee, me, ze, je, Ke, qe, He, We, Ge, Ye, Qe, An, wn, Tn, In, On, Nn, xn, Ln, Pn, Rn, Sn, kn, Mn, Dn, Vn, Fn, Un, Bn, zn, jn, Kn, qn, Hn, Wn, Gn, Yn, Qn, $n, Zn, Xn, Jn, er, tr, nr, rr, ir, ar, sr, or, lr, cr, ur, dr, pr, hr, mr, fr, vr, gr, yr, br, Er, _r, Cr, Ar, wr, Tr, Ir, Or;
3779
- const r = `${_n(e)}/payments/create`, i = new Headers();
3780
+ const r = `${_n(e)}/internal/payments/create`, i = new Headers();
3780
3781
  return i.append("Content-Type", "application/json"), i.append("X-API-Version", t), yield (yield fetch(r, {
3781
3782
  method: "POST",
3782
3783
  headers: i,
@@ -3833,14 +3834,14 @@ const Bc = (n, e, t) => e.concat(n.filter((r) => e.every((i) => !t(r, i)))), _n
3833
3834
  })
3834
3835
  })).json();
3835
3836
  }), Kc = (n, e, t) => j(void 0, null, function* () {
3836
- const r = `${_n(e)}/payments/create/billing/agreement`, i = new Headers();
3837
+ const r = `${_n(e)}/internal/payments/create/billing/agreement`, i = new Headers();
3837
3838
  return i.append("Content-Type", "application/json"), i.append("X-API-Version", t), (yield (yield fetch(r, {
3838
3839
  method: "POST",
3839
3840
  headers: i,
3840
3841
  body: JSON.stringify({ client_session: n })
3841
3842
  })).json()).paypal_agreement_token_response.token_id || "";
3842
3843
  }), qc = (n, e, t) => j(void 0, null, function* () {
3843
- const r = `${_n(e)}/payments/config?client_session_id=${n}`, i = new Headers();
3844
+ const r = `${_n(e)}/internal/payments/config?client_session_id=${n}`, i = new Headers();
3844
3845
  i.append("X-API-Version", t);
3845
3846
  const s = yield (yield fetch(r, { headers: i })).json();
3846
3847
  return s.checkout_config || (s.checkout_config = zc), s;