@blocklet/payment-react 1.15.7 → 1.15.9

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.
@@ -94,7 +94,7 @@ const InvoiceTable = React.memo((props) => {
94
94
  ignore_zero: true
95
95
  }),
96
96
  {
97
- refreshDeps: [search]
97
+ refreshDeps: [search, status, customer_id, currency_id, subscription_id, include_staking, include_recovered_from]
98
98
  }
99
99
  );
100
100
  useEffect(() => {
package/es/libs/api.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import { getLocale } from "@arcblock/ux/lib/Locale/context";
2
- import axios from "axios";
2
+ import { createAxios } from "@blocklet/js-sdk";
3
3
  import isNull from "lodash/isNull";
4
4
  import { getPrefix } from "./util.js";
5
- const api = axios.create();
5
+ const api = createAxios();
6
6
  api.interceptors.request.use(
7
7
  (config) => {
8
8
  const prefix = getPrefix();
@@ -2,7 +2,7 @@
2
2
  import 'react-international-phone/style.css';
3
3
  import { CheckoutCallbacks, CheckoutContext } from '../../types';
4
4
  type PageData = CheckoutContext & CheckoutCallbacks;
5
- declare function PaymentForm({ checkoutSession, paymentMethods, paymentIntent, paymentLink, customer, onPaid, onError, action, }: PageData): import("react").JSX.Element;
5
+ declare function PaymentForm({ checkoutSession, paymentMethods, paymentIntent, paymentLink, customer, onPaid, onError, action, currencyId, }: PageData): import("react").JSX.Element;
6
6
  declare namespace PaymentForm {
7
7
  var defaultProps: {};
8
8
  }
@@ -61,7 +61,8 @@ export default function PaymentForm({
61
61
  onPaid,
62
62
  onError,
63
63
  // mode,
64
- action
64
+ action,
65
+ currencyId
65
66
  }) {
66
67
  const { t } = useLocaleContext();
67
68
  const { isMobile } = useMobile();
@@ -98,7 +99,8 @@ export default function PaymentForm({
98
99
  const currencies = flattenPaymentMethods(paymentMethods);
99
100
  const [paymentCurrencyIndex, setPaymentCurrencyIndex] = useState(() => {
100
101
  const query = getQueryParams(window.location.href);
101
- const index = currencies.findIndex((x) => x.id === query.currencyId);
102
+ const queryCurrencyId = query.currencyId || currencyId;
103
+ const index = currencies.findIndex((x) => x.id === queryCurrencyId);
102
104
  return index >= 0 ? index : 0;
103
105
  });
104
106
  const onCheckoutComplete = useMemoizedFn(async ({ response }) => {
@@ -356,7 +358,8 @@ export default function PaymentForm({
356
358
  customer: state.customer,
357
359
  mode: checkoutSession.mode,
358
360
  onConfirm: onStripeConfirm,
359
- onCancel: onStripeCancel
361
+ onCancel: onStripeCancel,
362
+ returnUrl: checkoutSession?.success_url
360
363
  }
361
364
  )
362
365
  ] }) }),
@@ -8,6 +8,12 @@ type StripeCheckoutProps = {
8
8
  customer: TCustomer;
9
9
  onConfirm: Function;
10
10
  onCancel: Function;
11
+ returnUrl?: string;
11
12
  };
12
- export default function StripeCheckout({ clientSecret, intentType, publicKey, mode, customer, onConfirm, onCancel, }: StripeCheckoutProps): import("react").JSX.Element;
13
- export {};
13
+ declare function StripeCheckout({ clientSecret, intentType, publicKey, mode, customer, onConfirm, onCancel, returnUrl, }: StripeCheckoutProps): import("react").JSX.Element;
14
+ declare namespace StripeCheckout {
15
+ var defaultProps: {
16
+ returnUrl: string;
17
+ };
18
+ }
19
+ export default StripeCheckout;
@@ -9,7 +9,14 @@ import { Elements, PaymentElement, useElements, useStripe } from "@stripe/react-
9
9
  import { loadStripe } from "@stripe/stripe-js";
10
10
  import { useSetState } from "ahooks";
11
11
  import { useEffect, useCallback } from "react";
12
- function StripeCheckoutForm({ clientSecret, intentType, customer, mode, onConfirm }) {
12
+ function StripeCheckoutForm({
13
+ clientSecret,
14
+ intentType,
15
+ customer,
16
+ mode,
17
+ onConfirm,
18
+ returnUrl = ""
19
+ }) {
13
20
  const stripe = useStripe();
14
21
  const elements = useElements();
15
22
  const { t } = useLocaleContext();
@@ -54,6 +61,7 @@ function StripeCheckoutForm({ clientSecret, intentType, customer, mode, onConfir
54
61
  elements,
55
62
  redirect: "if_required",
56
63
  confirmParams: {
64
+ return_url: returnUrl || window.location.href,
57
65
  payment_method_data: {
58
66
  billing_details: {
59
67
  name: customer.name,
@@ -124,7 +132,8 @@ export default function StripeCheckout({
124
132
  mode,
125
133
  customer,
126
134
  onConfirm,
127
- onCancel
135
+ onCancel,
136
+ returnUrl = ""
128
137
  }) {
129
138
  const stripePromise = loadStripe(publicKey);
130
139
  const { t } = useLocaleContext();
@@ -154,9 +163,13 @@ export default function StripeCheckout({
154
163
  intentType,
155
164
  mode,
156
165
  customer,
157
- onConfirm
166
+ onConfirm,
167
+ returnUrl
158
168
  }
159
169
  ) })
160
170
  }
161
171
  );
162
172
  }
173
+ StripeCheckout.defaultProps = {
174
+ returnUrl: ""
175
+ };
@@ -12,7 +12,14 @@ import { FormProvider, useForm, useWatch } from "react-hook-form";
12
12
  import trim from "lodash/trim";
13
13
  import { usePaymentContext } from "../contexts/payment.js";
14
14
  import api from "../libs/api.js";
15
- import { findCurrency, formatError, getStatementDescriptor, isMobileSafari, isValidCountry } from "../libs/util.js";
15
+ import {
16
+ findCurrency,
17
+ formatError,
18
+ getQueryParams,
19
+ getStatementDescriptor,
20
+ isMobileSafari,
21
+ isValidCountry
22
+ } from "../libs/util.js";
16
23
  import PaymentError from "./error.js";
17
24
  import CheckoutFooter from "./footer.js";
18
25
  import PaymentForm from "./form/index.js";
@@ -43,7 +50,8 @@ function PaymentInner({
43
50
  const { settings, session } = usePaymentContext();
44
51
  const { isMobile } = useMobile();
45
52
  const [state, setState] = useSetState({ checkoutSession });
46
- const defaultCurrencyId = state.checkoutSession.currency_id || state.checkoutSession.line_items[0]?.price.currency_id;
53
+ const query = getQueryParams(window.location.href);
54
+ const defaultCurrencyId = query.currencyId || state.checkoutSession.currency_id || state.checkoutSession.line_items[0]?.price.currency_id;
47
55
  const defaultMethodId = paymentMethods.find((m) => m.payment_currencies.some((c) => c.id === defaultCurrencyId))?.id;
48
56
  const hideSummaryCard = mode.endsWith("-minimal") || !showCheckoutSummary;
49
57
  const methods = useForm({
@@ -86,6 +94,14 @@ function PaymentInner({
86
94
  document.body.removeEventListener("focusout", focusoutHandler);
87
95
  };
88
96
  }, []);
97
+ useEffect(() => {
98
+ if (!methods || query.currencyId) {
99
+ return;
100
+ }
101
+ if (state.checkoutSession.currency_id !== defaultCurrencyId) {
102
+ methods.setValue("payment_currency", state.checkoutSession.currency_id);
103
+ }
104
+ }, [state.checkoutSession, defaultCurrencyId, query.currencyId]);
89
105
  const currencyId = useWatch({ control: methods.control, name: "payment_currency", defaultValue: defaultCurrencyId });
90
106
  const currency = findCurrency(paymentMethods, currencyId) || settings.baseCurrency;
91
107
  const method = paymentMethods.find((x) => x.id === currency.payment_method_id);
@@ -207,6 +223,7 @@ function PaymentInner({
207
223
  !completed && /* @__PURE__ */ jsx(
208
224
  PaymentForm,
209
225
  {
226
+ currencyId,
210
227
  checkoutSession: state.checkoutSession,
211
228
  paymentMethods,
212
229
  paymentIntent,
@@ -10,6 +10,7 @@ export type CheckoutContext = {
10
10
  mode: LiteralUnion<'standalone' | 'inline' | 'popup', string>;
11
11
  action?: string;
12
12
  showCheckoutSummary?: boolean;
13
+ currencyId?: string;
13
14
  };
14
15
  export type CheckoutFormData = {
15
16
  customer_name: string;
@@ -96,7 +96,7 @@ const InvoiceTable = _react.default.memo(props => {
96
96
  include_recovered_from,
97
97
  ignore_zero: true
98
98
  }), {
99
- refreshDeps: [search]
99
+ refreshDeps: [search, status, customer_id, currency_id, subscription_id, include_staking, include_recovered_from]
100
100
  });
101
101
  (0, _react.useEffect)(() => {
102
102
  if (onTableDataChange) {
package/lib/libs/api.js CHANGED
@@ -5,11 +5,11 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
 
7
7
  var _context = require("@arcblock/ux/lib/Locale/context");
8
- var _axios = _interopRequireDefault(require("axios"));
8
+ var _jsSdk = require("@blocklet/js-sdk");
9
9
  var _isNull = _interopRequireDefault(require("lodash/isNull"));
10
10
  var _util = require("./util");
11
11
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
- const api = _axios.default.create();
12
+ const api = (0, _jsSdk.createAxios)();
13
13
  api.interceptors.request.use(config => {
14
14
  const prefix = (0, _util.getPrefix)();
15
15
  config.baseURL = prefix || "";
@@ -2,7 +2,7 @@
2
2
  import 'react-international-phone/style.css';
3
3
  import { CheckoutCallbacks, CheckoutContext } from '../../types';
4
4
  type PageData = CheckoutContext & CheckoutCallbacks;
5
- declare function PaymentForm({ checkoutSession, paymentMethods, paymentIntent, paymentLink, customer, onPaid, onError, action, }: PageData): import("react").JSX.Element;
5
+ declare function PaymentForm({ checkoutSession, paymentMethods, paymentIntent, paymentLink, customer, onPaid, onError, action, currencyId, }: PageData): import("react").JSX.Element;
6
6
  declare namespace PaymentForm {
7
7
  var defaultProps: {};
8
8
  }
@@ -63,7 +63,8 @@ function PaymentForm({
63
63
  onPaid,
64
64
  onError,
65
65
  // mode,
66
- action
66
+ action,
67
+ currencyId
67
68
  }) {
68
69
  const {
69
70
  t
@@ -110,7 +111,8 @@ function PaymentForm({
110
111
  const currencies = (0, _util.flattenPaymentMethods)(paymentMethods);
111
112
  const [paymentCurrencyIndex, setPaymentCurrencyIndex] = (0, _react.useState)(() => {
112
113
  const query = (0, _util.getQueryParams)(window.location.href);
113
- const index = currencies.findIndex(x => x.id === query.currencyId);
114
+ const queryCurrencyId = query.currencyId || currencyId;
115
+ const index = currencies.findIndex(x => x.id === queryCurrencyId);
114
116
  return index >= 0 ? index : 0;
115
117
  });
116
118
  const onCheckoutComplete = (0, _ahooks.useMemoizedFn)(async ({
@@ -420,7 +422,8 @@ function PaymentForm({
420
422
  customer: state.customer,
421
423
  mode: checkoutSession.mode,
422
424
  onConfirm: onStripeConfirm,
423
- onCancel: onStripeCancel
425
+ onCancel: onStripeCancel,
426
+ returnUrl: checkoutSession?.success_url
424
427
  })]
425
428
  })
426
429
  }), /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
@@ -8,6 +8,12 @@ type StripeCheckoutProps = {
8
8
  customer: TCustomer;
9
9
  onConfirm: Function;
10
10
  onCancel: Function;
11
+ returnUrl?: string;
11
12
  };
12
- export default function StripeCheckout({ clientSecret, intentType, publicKey, mode, customer, onConfirm, onCancel, }: StripeCheckoutProps): import("react").JSX.Element;
13
- export {};
13
+ declare function StripeCheckout({ clientSecret, intentType, publicKey, mode, customer, onConfirm, onCancel, returnUrl, }: StripeCheckoutProps): import("react").JSX.Element;
14
+ declare namespace StripeCheckout {
15
+ var defaultProps: {
16
+ returnUrl: string;
17
+ };
18
+ }
19
+ export default StripeCheckout;
@@ -21,7 +21,8 @@ function StripeCheckoutForm({
21
21
  intentType,
22
22
  customer,
23
23
  mode,
24
- onConfirm
24
+ onConfirm,
25
+ returnUrl = ""
25
26
  }) {
26
27
  const stripe = (0, _reactStripeJs.useStripe)();
27
28
  const elements = (0, _reactStripeJs.useElements)();
@@ -79,6 +80,7 @@ function StripeCheckoutForm({
79
80
  elements,
80
81
  redirect: "if_required",
81
82
  confirmParams: {
83
+ return_url: returnUrl || window.location.href,
82
84
  payment_method_data: {
83
85
  billing_details: {
84
86
  name: customer.name,
@@ -172,7 +174,8 @@ function StripeCheckout({
172
174
  mode,
173
175
  customer,
174
176
  onConfirm,
175
- onCancel
177
+ onCancel,
178
+ returnUrl = ""
176
179
  }) {
177
180
  const stripePromise = (0, _stripeJs.loadStripe)(publicKey);
178
181
  const {
@@ -209,8 +212,12 @@ function StripeCheckout({
209
212
  intentType,
210
213
  mode,
211
214
  customer,
212
- onConfirm
215
+ onConfirm,
216
+ returnUrl
213
217
  })
214
218
  })
215
219
  });
216
- }
220
+ }
221
+ StripeCheckout.defaultProps = {
222
+ returnUrl: ""
223
+ };
@@ -60,7 +60,8 @@ function PaymentInner({
60
60
  const [state, setState] = (0, _ahooks.useSetState)({
61
61
  checkoutSession
62
62
  });
63
- const defaultCurrencyId = state.checkoutSession.currency_id || state.checkoutSession.line_items[0]?.price.currency_id;
63
+ const query = (0, _util2.getQueryParams)(window.location.href);
64
+ const defaultCurrencyId = query.currencyId || state.checkoutSession.currency_id || state.checkoutSession.line_items[0]?.price.currency_id;
64
65
  const defaultMethodId = paymentMethods.find(m => m.payment_currencies.some(c => c.id === defaultCurrencyId))?.id;
65
66
  const hideSummaryCard = mode.endsWith("-minimal") || !showCheckoutSummary;
66
67
  const methods = (0, _reactHookForm.useForm)({
@@ -100,6 +101,14 @@ function PaymentInner({
100
101
  document.body.removeEventListener("focusout", focusoutHandler);
101
102
  };
102
103
  }, []);
104
+ (0, _react.useEffect)(() => {
105
+ if (!methods || query.currencyId) {
106
+ return;
107
+ }
108
+ if (state.checkoutSession.currency_id !== defaultCurrencyId) {
109
+ methods.setValue("payment_currency", state.checkoutSession.currency_id);
110
+ }
111
+ }, [state.checkoutSession, defaultCurrencyId, query.currencyId]);
103
112
  const currencyId = (0, _reactHookForm.useWatch)({
104
113
  control: methods.control,
105
114
  name: "payment_currency",
@@ -257,6 +266,7 @@ function PaymentInner({
257
266
  subscriptionId: state.checkoutSession.subscription_id,
258
267
  message: paymentLink?.after_completion?.hosted_confirmation?.custom_message || t(`payment.checkout.completed.${state.checkoutSession.submit_type === "donate" ? "donate" : state.checkoutSession.mode}`)
259
268
  }), !completed && /* @__PURE__ */(0, _jsxRuntime.jsx)(_form.default, {
269
+ currencyId,
260
270
  checkoutSession: state.checkoutSession,
261
271
  paymentMethods,
262
272
  paymentIntent,
@@ -10,6 +10,7 @@ export type CheckoutContext = {
10
10
  mode: LiteralUnion<'standalone' | 'inline' | 'popup', string>;
11
11
  action?: string;
12
12
  showCheckoutSummary?: boolean;
13
+ currencyId?: string;
13
14
  };
14
15
  export type CheckoutFormData = {
15
16
  customer_name: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blocklet/payment-react",
3
- "version": "1.15.7",
3
+ "version": "1.15.9",
4
4
  "description": "Reusable react components for payment kit v2",
5
5
  "keywords": [
6
6
  "react",
@@ -92,7 +92,7 @@
92
92
  "@babel/core": "^7.25.2",
93
93
  "@babel/preset-env": "^7.25.2",
94
94
  "@babel/preset-react": "^7.24.7",
95
- "@blocklet/payment-types": "1.15.7",
95
+ "@blocklet/payment-types": "1.15.9",
96
96
  "@storybook/addon-essentials": "^7.6.20",
97
97
  "@storybook/addon-interactions": "^7.6.20",
98
98
  "@storybook/addon-links": "^7.6.20",
@@ -122,5 +122,5 @@
122
122
  "vite-plugin-babel": "^1.2.0",
123
123
  "vite-plugin-node-polyfills": "^0.21.0"
124
124
  },
125
- "gitHead": "9aae61000ca85dc8199f750e3989d756a8747307"
125
+ "gitHead": "d2919fe52ba2b7aee1c6c1275c325f91b81027da"
126
126
  }
@@ -124,7 +124,7 @@ const InvoiceTable = React.memo((props: Props & { onPay: (invoiceId: string) =>
124
124
  ignore_zero: true,
125
125
  }),
126
126
  {
127
- refreshDeps: [search],
127
+ refreshDeps: [search, status, customer_id, currency_id, subscription_id, include_staking, include_recovered_from],
128
128
  }
129
129
  );
130
130
  useEffect(() => {
package/src/libs/api.ts CHANGED
@@ -1,10 +1,11 @@
1
1
  import { getLocale } from '@arcblock/ux/lib/Locale/context';
2
- import axios from 'axios';
2
+ // eslint-disable-next-line import/no-extraneous-dependencies
3
+ import { createAxios } from '@blocklet/js-sdk';
3
4
  import isNull from 'lodash/isNull';
4
5
 
5
6
  import { getPrefix } from './util';
6
7
 
7
- const api = axios.create();
8
+ const api = createAxios();
8
9
 
9
10
  api.interceptors.request.use(
10
11
  (config) => {
@@ -96,6 +96,7 @@ export default function PaymentForm({
96
96
  onError,
97
97
  // mode,
98
98
  action,
99
+ currencyId,
99
100
  }: PageData) {
100
101
  // const theme = useTheme();
101
102
  const { t } = useLocaleContext();
@@ -148,7 +149,8 @@ export default function PaymentForm({
148
149
 
149
150
  const [paymentCurrencyIndex, setPaymentCurrencyIndex] = useState(() => {
150
151
  const query = getQueryParams(window.location.href);
151
- const index = currencies.findIndex((x) => x.id === query.currencyId);
152
+ const queryCurrencyId = query.currencyId || currencyId;
153
+ const index = currencies.findIndex((x) => x.id === queryCurrencyId);
152
154
  return index >= 0 ? index : 0;
153
155
  });
154
156
 
@@ -439,6 +441,7 @@ export default function PaymentForm({
439
441
  mode={checkoutSession.mode}
440
442
  onConfirm={onStripeConfirm}
441
443
  onCancel={onStripeCancel}
444
+ returnUrl={checkoutSession?.success_url}
442
445
  />
443
446
  )}
444
447
  </Stack>
@@ -16,10 +16,18 @@ type StripeCheckoutFormProps = {
16
16
  customer: TCustomer;
17
17
  mode: string;
18
18
  onConfirm: Function;
19
+ returnUrl: string;
19
20
  };
20
21
 
21
22
  // @doc https://stripe.com/docs/js/elements_object/create_payment_element
22
- function StripeCheckoutForm({ clientSecret, intentType, customer, mode, onConfirm }: StripeCheckoutFormProps) {
23
+ function StripeCheckoutForm({
24
+ clientSecret,
25
+ intentType,
26
+ customer,
27
+ mode,
28
+ onConfirm,
29
+ returnUrl = '',
30
+ }: StripeCheckoutFormProps) {
23
31
  const stripe = useStripe();
24
32
  const elements = useElements();
25
33
  const { t } = useLocaleContext();
@@ -72,6 +80,7 @@ function StripeCheckoutForm({ clientSecret, intentType, customer, mode, onConfir
72
80
  elements,
73
81
  redirect: 'if_required',
74
82
  confirmParams: {
83
+ return_url: returnUrl || window.location.href,
75
84
  payment_method_data: {
76
85
  billing_details: {
77
86
  name: customer.name,
@@ -82,7 +91,6 @@ function StripeCheckoutForm({ clientSecret, intentType, customer, mode, onConfir
82
91
  },
83
92
  },
84
93
  });
85
-
86
94
  setState({ confirming: false });
87
95
  if (error) {
88
96
  if (error.type === 'validation_error') {
@@ -150,6 +158,7 @@ type StripeCheckoutProps = {
150
158
  customer: TCustomer;
151
159
  onConfirm: Function;
152
160
  onCancel: Function;
161
+ returnUrl?: string;
153
162
  };
154
163
 
155
164
  export default function StripeCheckout({
@@ -160,6 +169,7 @@ export default function StripeCheckout({
160
169
  customer,
161
170
  onConfirm,
162
171
  onCancel,
172
+ returnUrl = '',
163
173
  }: StripeCheckoutProps) {
164
174
  const stripePromise = loadStripe(publicKey);
165
175
  const { t } = useLocaleContext();
@@ -191,8 +201,13 @@ export default function StripeCheckout({
191
201
  mode={mode}
192
202
  customer={customer}
193
203
  onConfirm={onConfirm}
204
+ returnUrl={returnUrl}
194
205
  />
195
206
  </Elements>
196
207
  </Dialog>
197
208
  );
198
209
  }
210
+
211
+ StripeCheckout.defaultProps = {
212
+ returnUrl: '',
213
+ };
@@ -23,7 +23,14 @@ import type { LiteralUnion } from 'type-fest';
23
23
 
24
24
  import { usePaymentContext } from '../contexts/payment';
25
25
  import api from '../libs/api';
26
- import { findCurrency, formatError, getStatementDescriptor, isMobileSafari, isValidCountry } from '../libs/util';
26
+ import {
27
+ findCurrency,
28
+ formatError,
29
+ getQueryParams,
30
+ getStatementDescriptor,
31
+ isMobileSafari,
32
+ isValidCountry,
33
+ } from '../libs/util';
27
34
  import { CheckoutCallbacks, CheckoutContext, CheckoutFormData } from '../types';
28
35
  import PaymentError from './error';
29
36
  import CheckoutFooter from './footer';
@@ -61,8 +68,9 @@ function PaymentInner({
61
68
  const { settings, session } = usePaymentContext();
62
69
  const { isMobile } = useMobile();
63
70
  const [state, setState] = useSetState<{ checkoutSession: TCheckoutSessionExpanded }>({ checkoutSession });
64
-
65
- const defaultCurrencyId = state.checkoutSession.currency_id || state.checkoutSession.line_items[0]?.price.currency_id;
71
+ const query = getQueryParams(window.location.href);
72
+ const defaultCurrencyId =
73
+ query.currencyId || state.checkoutSession.currency_id || state.checkoutSession.line_items[0]?.price.currency_id;
66
74
  const defaultMethodId = paymentMethods.find((m) => m.payment_currencies.some((c) => c.id === defaultCurrencyId))?.id;
67
75
  const hideSummaryCard = mode.endsWith('-minimal') || !showCheckoutSummary;
68
76
 
@@ -107,6 +115,16 @@ function PaymentInner({
107
115
  };
108
116
  }, []);
109
117
 
118
+ useEffect(() => {
119
+ if (!methods || query.currencyId) {
120
+ return;
121
+ }
122
+ if (state.checkoutSession.currency_id !== defaultCurrencyId) {
123
+ methods.setValue('payment_currency', state.checkoutSession.currency_id);
124
+ }
125
+ // eslint-disable-next-line react-hooks/exhaustive-deps
126
+ }, [state.checkoutSession, defaultCurrencyId, query.currencyId]);
127
+
110
128
  const currencyId = useWatch({ control: methods.control, name: 'payment_currency', defaultValue: defaultCurrencyId });
111
129
  const currency =
112
130
  (findCurrency(paymentMethods as TPaymentMethodExpanded[], currencyId as string) as TPaymentCurrency) ||
@@ -248,6 +266,7 @@ function PaymentInner({
248
266
  )}
249
267
  {!completed && (
250
268
  <PaymentForm
269
+ currencyId={currencyId}
251
270
  checkoutSession={state.checkoutSession}
252
271
  paymentMethods={paymentMethods as TPaymentMethodExpanded[]}
253
272
  paymentIntent={paymentIntent}
@@ -18,6 +18,7 @@ export type CheckoutContext = {
18
18
  mode: LiteralUnion<'standalone' | 'inline' | 'popup', string>;
19
19
  action?: string;
20
20
  showCheckoutSummary?: boolean;
21
+ currencyId?: string;
21
22
  };
22
23
 
23
24
  export type CheckoutFormData = {