@blocklet/payment-react 1.18.30 → 1.18.31

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.
Files changed (43) hide show
  1. package/es/checkout/donate.js +51 -23
  2. package/es/components/country-select.js +1 -0
  3. package/es/components/over-due-invoice-payment.js +43 -5
  4. package/es/libs/util.d.ts +1 -0
  5. package/es/libs/util.js +15 -2
  6. package/es/locales/en.js +2 -1
  7. package/es/locales/zh.js +2 -1
  8. package/es/payment/form/currency.d.ts +1 -1
  9. package/es/payment/form/currency.js +3 -3
  10. package/es/payment/form/index.d.ts +1 -1
  11. package/es/payment/form/index.js +19 -35
  12. package/es/payment/form/stripe/form.js +4 -2
  13. package/es/payment/index.js +10 -1
  14. package/es/payment/success.d.ts +3 -1
  15. package/es/payment/success.js +78 -6
  16. package/lib/checkout/donate.js +19 -11
  17. package/lib/components/country-select.js +1 -0
  18. package/lib/components/over-due-invoice-payment.js +42 -4
  19. package/lib/libs/util.d.ts +1 -0
  20. package/lib/libs/util.js +16 -2
  21. package/lib/locales/en.js +2 -1
  22. package/lib/locales/zh.js +2 -1
  23. package/lib/payment/form/currency.d.ts +1 -1
  24. package/lib/payment/form/currency.js +3 -3
  25. package/lib/payment/form/index.d.ts +1 -1
  26. package/lib/payment/form/index.js +20 -35
  27. package/lib/payment/form/stripe/form.js +4 -2
  28. package/lib/payment/index.js +10 -1
  29. package/lib/payment/success.d.ts +3 -1
  30. package/lib/payment/success.js +68 -15
  31. package/package.json +8 -8
  32. package/src/checkout/donate.tsx +23 -5
  33. package/src/components/country-select.tsx +1 -0
  34. package/src/components/over-due-invoice-payment.tsx +46 -4
  35. package/src/libs/util.ts +17 -2
  36. package/src/locales/en.tsx +1 -0
  37. package/src/locales/zh.tsx +1 -0
  38. package/src/payment/form/currency.tsx +4 -4
  39. package/src/payment/form/index.tsx +21 -47
  40. package/src/payment/form/stripe/form.tsx +4 -2
  41. package/src/payment/index.tsx +12 -1
  42. package/src/payment/success.tsx +73 -11
  43. package/src/payment/summary.tsx +1 -0
@@ -11,6 +11,7 @@ var _context = require("@arcblock/ux/lib/Locale/context");
11
11
  var _Toast = _interopRequireDefault(require("@arcblock/ux/lib/Toast"));
12
12
  var _ufo = require("ufo");
13
13
  var _ahooks = require("ahooks");
14
+ var _pWaitFor = _interopRequireDefault(require("p-wait-for"));
14
15
  var _ux = require("@arcblock/ux");
15
16
  var _iconsMaterial = require("@mui/icons-material");
16
17
  var _debounce = _interopRequireDefault(require("lodash/debounce"));
@@ -62,6 +63,7 @@ function OverdueInvoicePayment({
62
63
  const sourceType = subscriptionId ? "subscription" : "customer";
63
64
  const effectiveCustomerId = customerId || session?.user?.did;
64
65
  const sourceId = subscriptionId || effectiveCustomerId;
66
+ const customerIdRef = (0, _react.useRef)(effectiveCustomerId);
65
67
  const {
66
68
  data = {
67
69
  summary: {},
@@ -75,7 +77,12 @@ function OverdueInvoicePayment({
75
77
  customerId: effectiveCustomerId,
76
78
  authToken
77
79
  }), {
78
- ready: !!subscriptionId || !!effectiveCustomerId
80
+ ready: !!subscriptionId || !!effectiveCustomerId,
81
+ onSuccess: res => {
82
+ if (res.customer?.id && res.customer?.id !== customerIdRef.current) {
83
+ customerIdRef.current = res.customer?.id;
84
+ }
85
+ }
79
86
  });
80
87
  const detailUrl = (0, _react.useMemo)(() => {
81
88
  if (subscriptionId) {
@@ -108,15 +115,45 @@ function OverdueInvoicePayment({
108
115
  trailing: true,
109
116
  maxWait: 5e3
110
117
  });
118
+ const isCrossOriginRequest = (0, _util.isCrossOrigin)();
111
119
  const subscription = (0, _subscription.useSubscription)("events");
120
+ const waitForInvoiceAllPaid = async () => {
121
+ let isPaid = false;
122
+ await (0, _pWaitFor.default)(async () => {
123
+ const res = await refresh();
124
+ isPaid = res.invoices?.length === 0;
125
+ return isPaid;
126
+ }, {
127
+ interval: 2e3,
128
+ timeout: 3 * 60 * 1e3
129
+ });
130
+ return isPaid;
131
+ };
132
+ const handleConnected = async () => {
133
+ if (isCrossOriginRequest) {
134
+ try {
135
+ const paid = await waitForInvoiceAllPaid();
136
+ if (successToast) {
137
+ _Toast.default.close();
138
+ _Toast.default.success(t("payment.customer.invoice.paySuccess"));
139
+ }
140
+ if (paid) {
141
+ setDialogOpen(false);
142
+ onPaid(sourceId, selectCurrencyId, sourceType);
143
+ }
144
+ } catch (err) {
145
+ console.error("Check payment status failed:", err);
146
+ }
147
+ }
148
+ };
112
149
  (0, _react.useEffect)(() => {
113
- if (subscription) {
150
+ if (subscription && !isCrossOriginRequest) {
114
151
  subscription.on("invoice.paid", ({
115
152
  response
116
153
  }) => {
117
154
  const relevantId = subscriptionId || response.customer_id;
118
155
  const uniqueKey = `${relevantId}-${response.currency_id}`;
119
- if (subscriptionId && response.subscription_id === subscriptionId || effectiveCustomerId && [data.customer?.id, effectiveCustomerId].includes(response.customer_id)) {
156
+ if (subscriptionId && response.subscription_id === subscriptionId || effectiveCustomerId && effectiveCustomerId === response.customer_id || customerIdRef.current && customerIdRef.current === response.customer_id) {
120
157
  if (!processedCurrencies[uniqueKey]) {
121
158
  setProcessedCurrencies(prev => ({
122
159
  ...prev,
@@ -160,10 +197,11 @@ function OverdueInvoicePayment({
160
197
  saveConnect: false,
161
198
  action: "collect-batch",
162
199
  prefix: (0, _ufo.joinURL)((0, _util.getPrefix)(), "/api/did"),
163
- useSocket: (0, _util.isCrossOrigin)() === false,
200
+ useSocket: !isCrossOriginRequest,
164
201
  extraParams,
165
202
  onSuccess: () => {
166
203
  connect.close();
204
+ handleConnected();
167
205
  setPayLoading(false);
168
206
  setPaymentStatus(prev => ({
169
207
  ...prev,
@@ -50,6 +50,7 @@ export declare function formatPriceDisplay({ amount, then, actualAmount, showThe
50
50
  actualAmount: string;
51
51
  showThen?: boolean;
52
52
  }, recurring: string, hasMetered: boolean, locale?: string): string;
53
+ export declare function hasMultipleRecurringIntervals(items: TLineItemExpanded[]): boolean;
53
54
  export declare function getFreeTrialTime({ trialInDays, trialEnd }: {
54
55
  trialInDays: number;
55
56
  trialEnd: number;
package/lib/libs/util.js CHANGED
@@ -49,6 +49,7 @@ exports.getUserProfileLink = getUserProfileLink;
49
49
  exports.getWebhookStatusColor = getWebhookStatusColor;
50
50
  exports.getWordBreakStyle = getWordBreakStyle;
51
51
  exports.hasDelegateTxHash = hasDelegateTxHash;
52
+ exports.hasMultipleRecurringIntervals = hasMultipleRecurringIntervals;
52
53
  exports.isCrossOrigin = isCrossOrigin;
53
54
  exports.isMobileSafari = isMobileSafari;
54
55
  exports.isPaymentKitMounted = void 0;
@@ -549,6 +550,18 @@ function formatPriceDisplay({
549
550
  }
550
551
  return [amount, then].filter(Boolean).join(" ");
551
552
  }
553
+ function hasMultipleRecurringIntervals(items) {
554
+ const intervals = /* @__PURE__ */new Set();
555
+ for (const item of items) {
556
+ if (item.price?.recurring?.interval && item.price?.type === "recurring") {
557
+ intervals.add(`${item.price.recurring.interval}-${item.price.recurring.interval_count}`);
558
+ if (intervals.size > 1) {
559
+ return true;
560
+ }
561
+ }
562
+ }
563
+ return false;
564
+ }
552
565
  function getFreeTrialTime({
553
566
  trialInDays,
554
567
  trialEnd
@@ -634,6 +647,7 @@ function formatCheckoutHeadlines(items, currency, {
634
647
  const item = items.find(x => x.price.type === "recurring");
635
648
  const recurring = formatRecurring((item?.upsell_price || item?.price)?.recurring, false, "per", locale);
636
649
  const hasMetered = items.some(x => x.price.type === "recurring" && x.price.recurring?.usage_type === "metered");
650
+ const differentRecurring = hasMultipleRecurringIntervals(items);
637
651
  if (items.every(x => x.price.type === "recurring")) {
638
652
  const subscription2 = [hasMetered ? (0, _locales.t)("payment.checkout.least", locale) : "", (0, _util.fromUnitToToken)(items.reduce((acc, x) => {
639
653
  if (x.price.recurring?.usage_type === "metered") {
@@ -704,7 +718,7 @@ function formatCheckoutHeadlines(items, currency, {
704
718
  then: hasMetered ? (0, _locales.t)("payment.checkout.meteredThen", locale, {
705
719
  recurring
706
720
  }) : recurring,
707
- showThen: hasMetered,
721
+ showThen: hasMetered && !differentRecurring,
708
722
  actualAmount
709
723
  };
710
724
  return {
@@ -724,7 +738,7 @@ function formatCheckoutHeadlines(items, currency, {
724
738
  }),
725
739
  amount,
726
740
  then: formatMeteredThen(`${subscription} ${currency.symbol}`, recurring, hasMetered && Number(subscription) === 0, locale),
727
- showThen: true,
741
+ showThen: !differentRecurring,
728
742
  actualAmount
729
743
  };
730
744
  return {
package/lib/locales/en.js CHANGED
@@ -122,7 +122,8 @@ module.exports = (0, _flat.default)({
122
122
  login: "Login to load and save contact information",
123
123
  next: {
124
124
  subscription: "View subscription",
125
- invoice: "View invoice"
125
+ invoice: "View invoice",
126
+ view: "View"
126
127
  },
127
128
  paymentRequired: "Payment Required",
128
129
  staking: {
package/lib/locales/zh.js CHANGED
@@ -122,7 +122,8 @@ module.exports = (0, _flat.default)({
122
122
  login: "\u767B\u5F55\u4EE5\u52A0\u8F7D\u5E76\u4FDD\u5B58\u8054\u7CFB\u4FE1\u606F",
123
123
  next: {
124
124
  subscription: "\u67E5\u770B\u8BA2\u9605",
125
- invoice: "\u67E5\u770B\u8D26\u5355"
125
+ invoice: "\u67E5\u770B\u8D26\u5355",
126
+ view: "\u67E5\u770B"
126
127
  },
127
128
  paymentRequired: "\u652F\u4ED8\u91D1\u989D",
128
129
  staking: {
@@ -1,6 +1,6 @@
1
1
  import type { TPaymentCurrency } from '@blocklet/payment-types';
2
2
  type Props = {
3
- value: number;
3
+ value: string;
4
4
  currencies: TPaymentCurrency[];
5
5
  onChange: Function;
6
6
  };
@@ -20,11 +20,11 @@ function CurrencySelector({
20
20
  gap: 12,
21
21
  gridTemplateColumns: "repeat(auto-fit, minmax(220px, 1fr))"
22
22
  },
23
- children: currencies.map((x, i) => {
24
- const selected = i === value;
23
+ children: currencies.map(x => {
24
+ const selected = x.id === value;
25
25
  return /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Card, {
26
26
  variant: "outlined",
27
- onClick: () => onChange(i),
27
+ onClick: () => onChange(x.id, x.method?.id),
28
28
  className: selected ? "cko-payment-card" : "cko-payment-card-unselect",
29
29
  children: /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
30
30
  direction: "row",
@@ -6,7 +6,7 @@ type PageData = CheckoutContext & CheckoutCallbacks & {
6
6
  onlyShowBtn?: boolean;
7
7
  isDonation?: boolean;
8
8
  };
9
- declare function PaymentForm({ checkoutSession, paymentMethods, paymentIntent, paymentLink, customer, onPaid, onError, action, currencyId, onlyShowBtn, isDonation, }: PageData): import("react").JSX.Element;
9
+ declare function PaymentForm({ checkoutSession, paymentMethods, paymentIntent, paymentLink, customer, onPaid, onError, action, onlyShowBtn, isDonation, }: PageData): import("react").JSX.Element;
10
10
  declare namespace PaymentForm {
11
11
  var defaultProps: {
12
12
  onlyShowBtn: boolean;
@@ -103,7 +103,6 @@ function PaymentForm({
103
103
  onError,
104
104
  // mode,
105
105
  action,
106
- currencyId,
107
106
  onlyShowBtn,
108
107
  isDonation = false
109
108
  }) {
@@ -150,19 +149,6 @@ function PaymentForm({
150
149
  stripePaying: false
151
150
  });
152
151
  const currencies = (0, _util.flattenPaymentMethods)(paymentMethods);
153
- const [paymentCurrencyIndex, setPaymentCurrencyIndex] = (0, _react.useState)(() => {
154
- const query = (0, _util.getQueryParams)(window.location.href);
155
- const queryCurrencyId = query.currencyId || currencyId;
156
- const index = currencies.findIndex(x => x.id === queryCurrencyId);
157
- return index >= 0 ? index : 0;
158
- });
159
- const handleCurrencyChange = index => {
160
- setPaymentCurrencyIndex(index);
161
- const selectedCurrencyId = currencies[index]?.id;
162
- if (selectedCurrencyId) {
163
- (0, _currency2.saveCurrencyPreference)(selectedCurrencyId, session?.user?.did);
164
- }
165
- };
166
152
  const onCheckoutComplete = (0, _ahooks.useMemoizedFn)(async ({
167
153
  response
168
154
  }) => {
@@ -170,17 +156,9 @@ function PaymentForm({
170
156
  await handleConnected();
171
157
  }
172
158
  });
173
- const onInvoicePaid = (0, _ahooks.useMemoizedFn)(async ({
174
- response
175
- }) => {
176
- if (response.customer_id === customer?.id && state.customerLimited) {
177
- await onAction();
178
- }
179
- });
180
159
  (0, _react.useEffect)(() => {
181
160
  if (subscription) {
182
161
  subscription.on("checkout.session.completed", onCheckoutComplete);
183
- subscription.on("invoice.paid", onInvoicePaid);
184
162
  }
185
163
  }, [subscription]);
186
164
  const mergeUserInfo = (customerInfo, userInfo) => {
@@ -247,10 +225,6 @@ function PaymentForm({
247
225
  };
248
226
  initUserInfo();
249
227
  }, [session?.user, checkoutSession.phone_number_collection?.enabled]);
250
- (0, _react.useEffect)(() => {
251
- setValue("payment_method", currencies[paymentCurrencyIndex]?.method?.id);
252
- setValue("payment_currency", currencies[paymentCurrencyIndex]?.id);
253
- }, [paymentCurrencyIndex, currencies, setValue]);
254
228
  const paymentMethod = (0, _reactHookForm.useWatch)({
255
229
  control,
256
230
  name: "payment_method"
@@ -378,6 +352,11 @@ function PaymentForm({
378
352
  paying: false
379
353
  });
380
354
  onError(err);
355
+ },
356
+ messages: {
357
+ title: "DID Connect",
358
+ scan: "Use following methods to complete this payment",
359
+ confirm: "Confirm"
381
360
  }
382
361
  });
383
362
  }
@@ -437,13 +416,13 @@ function PaymentForm({
437
416
  }
438
417
  if (hasDidWallet(session.user)) {
439
418
  handleSubmit(onFormSubmit, onFormError)();
440
- } else {
441
- session.bindWallet(() => {
442
- setTimeout(() => {
443
- handleSubmit(onFormSubmit, onFormError)();
444
- }, 2e3);
445
- });
419
+ return;
446
420
  }
421
+ session.bindWallet(() => {
422
+ setTimeout(() => {
423
+ handleSubmit(onFormSubmit, onFormError)();
424
+ }, 2e3);
425
+ });
447
426
  } else {
448
427
  if (isDonationMode) {
449
428
  handleSubmit(onFormSubmit, onFormError)();
@@ -570,10 +549,16 @@ function PaymentForm({
570
549
  children: /* @__PURE__ */(0, _jsxRuntime.jsx)(_reactHookForm.Controller, {
571
550
  name: "payment_currency",
572
551
  control,
573
- render: () => /* @__PURE__ */(0, _jsxRuntime.jsx)(_currency.default, {
574
- value: paymentCurrencyIndex,
552
+ render: ({
553
+ field
554
+ }) => /* @__PURE__ */(0, _jsxRuntime.jsx)(_currency.default, {
555
+ value: field.value,
575
556
  currencies,
576
- onChange: handleCurrencyChange
557
+ onChange: (id, methodId) => {
558
+ field.onChange(id);
559
+ setValue("payment_method", methodId);
560
+ (0, _currency2.saveCurrencyPreference)(id, session?.user?.did);
561
+ }
577
562
  })
578
563
  })
579
564
  }), state.stripePaying && state.stripeContext && /* @__PURE__ */(0, _jsxRuntime.jsx)(_stripe.default, {
@@ -189,9 +189,11 @@ function StripeCheckoutForm({
189
189
 
190
190
  return /* @__PURE__ */(0, _jsxRuntime.jsxs)(Content, {
191
191
  onSubmit: handleSubmit,
192
- children: [(!state.paymentMethod || state.paymentMethod === "card") && /* @__PURE__ */(0, _jsxRuntime.jsx)(LinkAuthenticationElement, {
192
+ children: [(!state.paymentMethod || ["link", "card"].includes(state.paymentMethod)) && /* @__PURE__ */(0, _jsxRuntime.jsx)(LinkAuthenticationElement, {
193
193
  options: {
194
- defaultEmail: customer.email
194
+ defaultValues: {
195
+ email: customer.email
196
+ }
195
197
  }
196
198
  }), /* @__PURE__ */(0, _jsxRuntime.jsx)(PaymentElementContainer, {
197
199
  className: !state.isTransitioning ? "visible" : "",
@@ -116,6 +116,14 @@ function PaymentInner({
116
116
  })
117
117
  }
118
118
  });
119
+ (0, _react.useEffect)(() => {
120
+ if (defaultCurrencyId) {
121
+ methods.setValue("payment_currency", defaultCurrencyId);
122
+ }
123
+ if (defaultMethodId) {
124
+ methods.setValue("payment_method", defaultMethodId);
125
+ }
126
+ }, [defaultCurrencyId, defaultMethodId]);
119
127
  (0, _react.useEffect)(() => {
120
128
  if (!(0, _util2.isMobileSafari)()) {
121
129
  return () => {};
@@ -258,7 +266,7 @@ function PaymentInner({
258
266
  billingThreshold: Math.max(state.checkoutSession.subscription_data?.billing_threshold_amount || 0,
259
267
  // @ts-ignore
260
268
  state.checkoutSession.subscription_data?.min_stake_amount || 0),
261
- showStaking: method.type === "arcblock",
269
+ showStaking: method.type === "arcblock" && !state.checkoutSession.subscription_data?.no_stake,
262
270
  currency,
263
271
  onUpsell,
264
272
  onDownsell,
@@ -289,6 +297,7 @@ function PaymentInner({
289
297
  action: state.checkoutSession.mode,
290
298
  invoiceId: state.checkoutSession.invoice_id,
291
299
  subscriptionId: state.checkoutSession.subscription_id,
300
+ subscriptions: state.checkoutSession.subscriptions,
292
301
  message: paymentLink?.after_completion?.hosted_confirmation?.custom_message || t(`payment.checkout.completed.${state.checkoutSession.submit_type === "donate" ? "donate" : state.checkoutSession.mode}`)
293
302
  }), !completed && /* @__PURE__ */(0, _jsxRuntime.jsx)(_form.default, {
294
303
  currencyId,
@@ -5,12 +5,14 @@ type Props = {
5
5
  payee: string;
6
6
  invoiceId?: string;
7
7
  subscriptionId?: string;
8
+ subscriptions?: any[];
8
9
  };
9
- declare function PaymentSuccess({ mode, message, action, payee, invoiceId, subscriptionId }: Props): import("react").JSX.Element;
10
+ declare function PaymentSuccess({ mode, message, action, payee, invoiceId, subscriptionId, subscriptions, }: Props): import("react").JSX.Element;
10
11
  declare namespace PaymentSuccess {
11
12
  var defaultProps: {
12
13
  invoiceId: string;
13
14
  subscriptionId: string;
15
+ subscriptions: never[];
14
16
  };
15
17
  }
16
18
  export default PaymentSuccess;
@@ -9,6 +9,7 @@ var _context = require("@arcblock/ux/lib/Locale/context");
9
9
  var _material = require("@mui/material");
10
10
  var _system = require("@mui/system");
11
11
  var _ufo = require("ufo");
12
+ var _ux = require("@arcblock/ux");
12
13
  var _payment = require("../contexts/payment");
13
14
  function PaymentSuccess({
14
15
  mode,
@@ -16,7 +17,8 @@ function PaymentSuccess({
16
17
  action,
17
18
  payee,
18
19
  invoiceId,
19
- subscriptionId
20
+ subscriptionId,
21
+ subscriptions
20
22
  }) {
21
23
  const {
22
24
  t
@@ -25,19 +27,69 @@ function PaymentSuccess({
25
27
  prefix
26
28
  } = (0, _payment.usePaymentContext)();
27
29
  let next = null;
28
- if (["subscription", "setup"].includes(action) && subscriptionId) {
29
- next = /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
30
- textAlign: "center",
31
- sx: {
32
- mt: 2
33
- },
34
- children: /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Link, {
35
- href: (0, _ufo.joinURL)(prefix, `/customer/subscription/${subscriptionId}`),
36
- children: t("payment.checkout.next.subscription", {
37
- payee
30
+ if (["subscription", "setup"].includes(action)) {
31
+ if (subscriptions && subscriptions.length > 1) {
32
+ next = /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Paper, {
33
+ elevation: 0,
34
+ sx: {
35
+ p: 3,
36
+ backgroundColor: "grey.50",
37
+ borderRadius: 2,
38
+ width: "100%",
39
+ mt: 2,
40
+ display: "flex",
41
+ flexDirection: "column",
42
+ gap: 2
43
+ },
44
+ children: subscriptions.map(subscription => /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Box, {
45
+ sx: {
46
+ display: "flex",
47
+ alignItems: "center",
48
+ justifyContent: "space-between"
49
+ },
50
+ children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
51
+ variant: "body2",
52
+ sx: {
53
+ color: "text.secondary",
54
+ fontWeight: 500
55
+ },
56
+ children: subscription.description
57
+ }), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Box, {
58
+ sx: {
59
+ flex: 1,
60
+ borderBottom: "1px dashed",
61
+ borderColor: "grey.300",
62
+ mx: 2
63
+ }
64
+ }), /* @__PURE__ */(0, _jsxRuntime.jsx)(_ux.Button, {
65
+ variant: "text",
66
+ color: "primary",
67
+ size: "small",
68
+ children: /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Link, {
69
+ href: (0, _ufo.joinURL)(prefix, `/customer/subscription/${subscription.id}`),
70
+ sx: {
71
+ color: "text.secondary"
72
+ },
73
+ children: t("payment.checkout.next.view")
74
+ })
75
+ })]
76
+ }, subscription.id))
77
+ });
78
+ } else if (subscriptionId) {
79
+ next = /* @__PURE__ */(0, _jsxRuntime.jsx)(_ux.Button, {
80
+ variant: "outlined",
81
+ color: "primary",
82
+ sx: {
83
+ mt: 2
84
+ },
85
+ children: /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Link, {
86
+ href: (0, _ufo.joinURL)(prefix, `/customer/subscription/${subscriptionId}`),
87
+ children: t("payment.checkout.next.subscription", {
88
+ payee
89
+ })
38
90
  })
39
- })
40
- });
91
+ });
92
+ }
41
93
  } else if (invoiceId) {
42
94
  next = /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
43
95
  textAlign: "center",
@@ -59,7 +111,7 @@ function PaymentSuccess({
59
111
  alignItems: "center",
60
112
  justifyContent: mode === "standalone" ? "center" : "flex-start",
61
113
  sx: {
62
- height: mode === "standalone" ? 360 : 300
114
+ height: mode === "standalone" ? "fit-content" : 300
63
115
  },
64
116
  children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(Div, {
65
117
  children: /* @__PURE__ */(0, _jsxRuntime.jsxs)("div", {
@@ -95,7 +147,8 @@ function PaymentSuccess({
95
147
  }
96
148
  PaymentSuccess.defaultProps = {
97
149
  invoiceId: "",
98
- subscriptionId: ""
150
+ subscriptionId: "",
151
+ subscriptions: []
99
152
  };
100
153
  const Div = (0, _system.styled)("div")`
101
154
  width: 80px;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blocklet/payment-react",
3
- "version": "1.18.30",
3
+ "version": "1.18.31",
4
4
  "description": "Reusable react components for payment kit v2",
5
5
  "keywords": [
6
6
  "react",
@@ -54,15 +54,15 @@
54
54
  }
55
55
  },
56
56
  "dependencies": {
57
- "@arcblock/did-connect": "^2.13.1",
58
- "@arcblock/ux": "^2.13.1",
59
- "@arcblock/ws": "^1.20.0",
60
- "@blocklet/ui-react": "^2.13.1",
57
+ "@arcblock/did-connect": "^2.13.5",
58
+ "@arcblock/ux": "^2.13.5",
59
+ "@arcblock/ws": "^1.20.1",
60
+ "@blocklet/ui-react": "^2.13.5",
61
61
  "@mui/icons-material": "^5.16.6",
62
62
  "@mui/lab": "^5.0.0-alpha.173",
63
63
  "@mui/material": "^5.16.6",
64
64
  "@mui/system": "^5.16.6",
65
- "@ocap/util": "^1.20.0",
65
+ "@ocap/util": "^1.20.1",
66
66
  "@stripe/react-stripe-js": "^2.7.3",
67
67
  "@stripe/stripe-js": "^2.4.0",
68
68
  "@vitejs/plugin-legacy": "^5.4.1",
@@ -93,7 +93,7 @@
93
93
  "@babel/core": "^7.25.2",
94
94
  "@babel/preset-env": "^7.25.2",
95
95
  "@babel/preset-react": "^7.24.7",
96
- "@blocklet/payment-types": "1.18.30",
96
+ "@blocklet/payment-types": "1.18.31",
97
97
  "@storybook/addon-essentials": "^7.6.20",
98
98
  "@storybook/addon-interactions": "^7.6.20",
99
99
  "@storybook/addon-links": "^7.6.20",
@@ -124,5 +124,5 @@
124
124
  "vite-plugin-babel": "^1.2.0",
125
125
  "vite-plugin-node-polyfills": "^0.21.0"
126
126
  },
127
- "gitHead": "ed1753c48ee405a104cd2a0cab87cccb21e70ba8"
127
+ "gitHead": "c9b1eff248ecd07bc1f606df039464dafa786914"
128
128
  }
@@ -368,7 +368,17 @@ function SupporterSimple({ supporters = [], totalAmount = '0', currency, method
368
368
  })
369
369
  )}
370
370
  </Typography>
371
- <AvatarGroup total={customersNum} max={10}>
371
+ <AvatarGroup
372
+ total={customersNum}
373
+ max={10}
374
+ spacing={4}
375
+ sx={{
376
+ '& .MuiAvatar-root': {
377
+ width: 24,
378
+ height: 24,
379
+ fontSize: '0.6rem',
380
+ },
381
+ }}>
372
382
  {customers.map((x) => (
373
383
  <Avatar
374
384
  key={x.id}
@@ -376,7 +386,6 @@ function SupporterSimple({ supporters = [], totalAmount = '0', currency, method
376
386
  alt={x.customer?.metadata?.anonymous ? '' : x.customer?.name}
377
387
  src={getCustomerAvatar(x.customer?.did, x?.updated_at ? new Date(x.updated_at).toISOString() : '', 48)}
378
388
  variant="circular"
379
- sx={{ width: 24, height: 24 }}
380
389
  />
381
390
  ))}
382
391
  </AvatarGroup>
@@ -708,7 +717,17 @@ function CheckoutDonateInner({
708
717
  toolbar={
709
718
  isMobile ? null : (
710
719
  <Box display="flex" alignItems="center" gap={1} sx={{ color: 'text.secondary' }}>
711
- <AvatarGroup total={customers?.length} max={5}>
720
+ <AvatarGroup
721
+ total={customers?.length}
722
+ max={5}
723
+ spacing={4}
724
+ sx={{
725
+ '& .MuiAvatar-root': {
726
+ width: 18,
727
+ height: 18,
728
+ fontSize: '0.6rem',
729
+ },
730
+ }}>
712
731
  {customers.map((x: any) => (
713
732
  <Avatar
714
733
  key={x.id}
@@ -716,10 +735,9 @@ function CheckoutDonateInner({
716
735
  src={getCustomerAvatar(
717
736
  x.customer?.did,
718
737
  x?.updated_at ? new Date(x.updated_at).toISOString() : '',
719
- 18
738
+ 24
720
739
  )}
721
740
  variant="circular"
722
- sx={{ width: 18, height: 18 }}
723
741
  />
724
742
  ))}
725
743
  </AvatarGroup>
@@ -230,6 +230,7 @@ const CountrySelect = forwardRef<HTMLDivElement, CountrySelectProps>(({ value, o
230
230
  }}
231
231
  sx={{
232
232
  width: '100%',
233
+ minWidth: '60px',
233
234
  fieldset: {
234
235
  display: 'none',
235
236
  },