@blocklet/payment-react 1.18.33 → 1.18.35

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.
@@ -2,7 +2,7 @@ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
2
  import "react-international-phone/style.css";
3
3
  import { useLocaleContext } from "@arcblock/ux/lib/Locale/context";
4
4
  import Toast from "@arcblock/ux/lib/Toast";
5
- import { Box, Button, CircularProgress, Divider, Fade, FormLabel, Stack, Typography } from "@mui/material";
5
+ import { Box, Button, CircularProgress, Divider, Fade, FormLabel, Stack, Tooltip, Typography } from "@mui/material";
6
6
  import { useMemoizedFn, useSetState } from "ahooks";
7
7
  import pWaitFor from "p-wait-for";
8
8
  import { useEffect, useMemo, useRef } from "react";
@@ -10,7 +10,10 @@ import { Controller, useFormContext, useWatch } from "react-hook-form";
10
10
  import { joinURL } from "ufo";
11
11
  import { dispatch } from "use-bus";
12
12
  import isEmail from "validator/es/lib/isEmail";
13
+ import { fromUnitToToken } from "@ocap/util";
14
+ import DID from "@arcblock/ux/lib/DID";
13
15
  import isEmpty from "lodash/isEmpty";
16
+ import { HelpOutline, OpenInNew } from "@mui/icons-material";
14
17
  import FormInput from "../../components/input.js";
15
18
  import { usePaymentContext } from "../../contexts/payment.js";
16
19
  import { useSubscription } from "../../hooks/subscription.js";
@@ -21,6 +24,7 @@ import {
21
24
  formatQuantityInventory,
22
25
  getPrefix,
23
26
  getStatementDescriptor,
27
+ getTokenBalanceLink,
24
28
  isCrossOrigin
25
29
  } from "../../libs/util.js";
26
30
  import AddressForm from "./address.js";
@@ -32,6 +36,8 @@ import { formatPhone, validatePhoneNumber } from "../../libs/phone-validator.js"
32
36
  import LoadingButton from "../../components/loading-button.js";
33
37
  import OverdueInvoicePayment from "../../components/over-due-invoice-payment.js";
34
38
  import { saveCurrencyPreference } from "../../libs/currency.js";
39
+ import ConfirmDialog from "../../components/confirm.js";
40
+ import { getFieldValidation } from "../../libs/validator.js";
35
41
  export const waitForCheckoutComplete = async (sessionId) => {
36
42
  let result;
37
43
  await pWaitFor(
@@ -96,10 +102,11 @@ export default function PaymentForm({
96
102
  onlyShowBtn,
97
103
  isDonation = false
98
104
  }) {
99
- const { t } = useLocaleContext();
105
+ const { t, locale } = useLocaleContext();
100
106
  const { isMobile } = useMobile();
101
107
  const { session, connect, payable } = usePaymentContext();
102
108
  const subscription = useSubscription("events");
109
+ const formErrorPosition = isMobile ? "bottom" : "right";
103
110
  const {
104
111
  control,
105
112
  getValues,
@@ -126,7 +133,8 @@ export default function PaymentForm({
126
133
  stripeContext: void 0,
127
134
  customer,
128
135
  customerLimited: false,
129
- stripePaying: false
136
+ stripePaying: false,
137
+ fastCheckoutInfo: null
130
138
  });
131
139
  const currencies = flattenPaymentMethods(paymentMethods);
132
140
  const onCheckoutComplete = useMemoizedFn(async ({ response }) => {
@@ -204,6 +212,7 @@ export default function PaymentForm({
204
212
  initUserInfo();
205
213
  }, [session?.user, checkoutSession.phone_number_collection?.enabled]);
206
214
  const paymentMethod = useWatch({ control, name: "payment_method" });
215
+ const paymentCurrencyId = useWatch({ control, name: "payment_currency" });
207
216
  const afterUserLoggedIn = useMemoizedFn(() => {
208
217
  if (hasDidWallet(session.user) || skipBindWallet) {
209
218
  handleSubmit(onFormSubmit, onFormError)();
@@ -228,6 +237,8 @@ export default function PaymentForm({
228
237
  }
229
238
  buttonText = session?.user || isDonation ? buttonText : t("payment.checkout.connect", { action: buttonText });
230
239
  const method = paymentMethods.find((x) => x.id === paymentMethod);
240
+ const paymentCurrency = currencies.find((x) => x.id === paymentCurrencyId);
241
+ const showStake = method.type === "arcblock" && !checkoutSession.subscription_data?.no_stake;
231
242
  const isDonationMode = checkoutSession?.submit_type === "donate" && isDonation;
232
243
  const showForm = !!session?.user;
233
244
  const skipBindWallet = method.type === "stripe";
@@ -261,6 +272,80 @@ export default function PaymentForm({
261
272
  });
262
273
  }
263
274
  };
275
+ const handleFastCheckoutConfirm = async () => {
276
+ if (!state.fastCheckoutInfo)
277
+ return;
278
+ setState({
279
+ fastCheckoutInfo: {
280
+ ...state.fastCheckoutInfo,
281
+ loading: true
282
+ }
283
+ });
284
+ try {
285
+ const result = await api.post(`/api/checkout-sessions/${checkoutSession.id}/fast-checkout-confirm`);
286
+ if (result.data.fastPaid) {
287
+ setState({
288
+ fastCheckoutInfo: null,
289
+ paying: true
290
+ });
291
+ await handleConnected();
292
+ } else {
293
+ Toast.error(t("payment.checkout.fastPay.failed"));
294
+ setState({
295
+ fastCheckoutInfo: null,
296
+ paying: true
297
+ });
298
+ openConnect();
299
+ }
300
+ } catch (err) {
301
+ console.error(err);
302
+ Toast.error(formatError(err));
303
+ setState({
304
+ fastCheckoutInfo: null
305
+ });
306
+ }
307
+ };
308
+ const handleFastCheckoutCancel = () => {
309
+ setState({ fastCheckoutInfo: null });
310
+ };
311
+ const openConnect = () => {
312
+ try {
313
+ if (!["arcblock", "ethereum", "base"].includes(method.type)) {
314
+ return;
315
+ }
316
+ setState({ paying: true });
317
+ connect.open({
318
+ locale,
319
+ containerEl: void 0,
320
+ action: checkoutSession.mode,
321
+ prefix: joinURL(getPrefix(), "/api/did"),
322
+ saveConnect: false,
323
+ useSocket: isCrossOrigin() === false,
324
+ extraParams: { checkoutSessionId: checkoutSession.id, sessionUserDid: session?.user?.did },
325
+ onSuccess: async () => {
326
+ connect.close();
327
+ await handleConnected();
328
+ },
329
+ onClose: () => {
330
+ connect.close();
331
+ setState({ submitting: false, paying: false });
332
+ },
333
+ onError: (err) => {
334
+ console.error(err);
335
+ setState({ submitting: false, paying: false });
336
+ onError(err);
337
+ },
338
+ messages: {
339
+ title: t("payment.checkout.connectModal.title", { action: buttonText }),
340
+ scan: t("payment.checkout.connectModal.scan"),
341
+ confirm: t("payment.checkout.connectModal.confirm"),
342
+ cancel: t("payment.checkout.connectModal.cancel")
343
+ }
344
+ });
345
+ } catch (err) {
346
+ Toast.error(formatError(err));
347
+ }
348
+ };
264
349
  const onFormSubmit = async (data) => {
265
350
  setState({ submitting: true });
266
351
  try {
@@ -278,36 +363,18 @@ export default function PaymentForm({
278
363
  customerLimited: false
279
364
  });
280
365
  if (["arcblock", "ethereum", "base"].includes(method.type)) {
281
- setState({ paying: true });
282
- if ((result.data.balance?.sufficient || result.data.delegation?.sufficient) && !isDonationMode) {
283
- await handleConnected();
284
- } else {
285
- connect.open({
286
- containerEl: void 0,
287
- action: checkoutSession.mode,
288
- prefix: joinURL(getPrefix(), "/api/did"),
289
- saveConnect: false,
290
- useSocket: isCrossOrigin() === false,
291
- extraParams: { checkoutSessionId: checkoutSession.id, sessionUserDid: session?.user?.did },
292
- onSuccess: async () => {
293
- connect.close();
294
- await handleConnected();
295
- },
296
- onClose: () => {
297
- connect.close();
298
- setState({ submitting: false, paying: false });
299
- },
300
- onError: (err) => {
301
- console.error(err);
302
- setState({ submitting: false, paying: false });
303
- onError(err);
304
- },
305
- messages: {
306
- title: "DID Connect",
307
- scan: "Use following methods to complete this payment",
308
- confirm: "Confirm"
366
+ if ((result.data.balance?.sufficient || result.data.delegation?.sufficient) && !isDonationMode && result.data.fastPayInfo) {
367
+ setState({
368
+ fastCheckoutInfo: {
369
+ open: true,
370
+ loading: false,
371
+ sourceType: result.data.fastPayInfo.type,
372
+ amount: result.data.fastPayInfo.amount,
373
+ payer: result.data.fastPayInfo.payer
309
374
  }
310
375
  });
376
+ } else {
377
+ openConnect();
311
378
  }
312
379
  }
313
380
  if (["stripe"].includes(method.type)) {
@@ -392,6 +459,52 @@ export default function PaymentForm({
392
459
  window.removeEventListener("keydown", handleKeyDown);
393
460
  };
394
461
  }, [state.submitting, state.paying, state.stripePaying, quantityInventoryStatus, payable]);
462
+ const balanceLink = getTokenBalanceLink(method, state.fastCheckoutInfo?.payer || "");
463
+ const FastCheckoutConfirmDialog = state.fastCheckoutInfo && /* @__PURE__ */ jsx(
464
+ ConfirmDialog,
465
+ {
466
+ onConfirm: handleFastCheckoutConfirm,
467
+ onCancel: handleFastCheckoutCancel,
468
+ title: t("payment.checkout.fastPay.title"),
469
+ message: /* @__PURE__ */ jsxs(Stack, { children: [
470
+ /* @__PURE__ */ jsx(Typography, { children: t("payment.checkout.fastPay.autoPaymentReason") }),
471
+ /* @__PURE__ */ jsx(Typography, { children: t("payment.checkout.fastPay.confirmPrompt") }),
472
+ /* @__PURE__ */ jsx(Divider, { sx: { mt: 1.5, mb: 1.5 } }),
473
+ /* @__PURE__ */ jsxs(Stack, { spacing: 1, children: [
474
+ /* @__PURE__ */ jsxs(Stack, { flexDirection: "row", alignItems: "center", justifyContent: "space-between", children: [
475
+ /* @__PURE__ */ jsx(Typography, { color: "text.primary", sx: { whiteSpace: "nowrap" }, children: t("payment.checkout.fastPay.payer") }),
476
+ /* @__PURE__ */ jsxs(Box, { sx: { display: "flex", alignItems: "center", gap: 0.5 }, children: [
477
+ /* @__PURE__ */ jsx(DID, { did: state.fastCheckoutInfo.payer || "", compact: true, responsive: false }),
478
+ balanceLink && /* @__PURE__ */ jsx(Tooltip, { title: t("payment.checkout.fastPay.balanceLink"), placement: "top", children: /* @__PURE__ */ jsx(
479
+ OpenInNew,
480
+ {
481
+ sx: {
482
+ color: "text.lighter",
483
+ fontSize: "0.85rem",
484
+ cursor: "pointer",
485
+ "&:hover": { color: "text.primary" }
486
+ },
487
+ onClick: () => {
488
+ window.open(balanceLink, "_blank");
489
+ }
490
+ }
491
+ ) })
492
+ ] })
493
+ ] }),
494
+ /* @__PURE__ */ jsxs(Stack, { flexDirection: "row", alignItems: "center", justifyContent: "space-between", children: [
495
+ /* @__PURE__ */ jsx(Typography, { color: "text.primary", children: t("payment.checkout.fastPay.amount") }),
496
+ /* @__PURE__ */ jsxs(Typography, { children: [
497
+ fromUnitToToken(state.fastCheckoutInfo.amount, paymentCurrency?.decimal || 18).toString(),
498
+ " ",
499
+ paymentCurrency?.symbol
500
+ ] })
501
+ ] })
502
+ ] })
503
+ ] }),
504
+ loading: state.fastCheckoutInfo.loading,
505
+ color: "primary"
506
+ }
507
+ );
395
508
  if (onlyShowBtn) {
396
509
  return /* @__PURE__ */ jsxs(Fragment, { children: [
397
510
  /* @__PURE__ */ jsx(Box, { className: "cko-payment-submit-btn", children: /* @__PURE__ */ jsxs(
@@ -443,7 +556,8 @@ export default function PaymentForm({
443
556
  title: t("payment.customer.pastDue.alert.title")
444
557
  }
445
558
  }
446
- )
559
+ ),
560
+ FastCheckoutConfirmDialog
447
561
  ] });
448
562
  }
449
563
  return /* @__PURE__ */ jsxs(Fragment, { children: [
@@ -515,9 +629,10 @@ export default function PaymentForm({
515
629
  {
516
630
  name: "customer_name",
517
631
  variant: "outlined",
518
- errorPosition: "right",
632
+ errorPosition: formErrorPosition,
519
633
  rules: {
520
- required: t("payment.checkout.required")
634
+ required: t("payment.checkout.required"),
635
+ ...getFieldValidation("customer_name", checkoutSession.metadata?.page_info?.field_validation, locale)
521
636
  }
522
637
  }
523
638
  ),
@@ -527,10 +642,15 @@ export default function PaymentForm({
527
642
  {
528
643
  name: "customer_email",
529
644
  variant: "outlined",
530
- errorPosition: "right",
645
+ errorPosition: formErrorPosition,
531
646
  rules: {
532
647
  required: t("payment.checkout.required"),
533
- validate: (x) => isEmail(x) ? true : t("payment.checkout.invalid")
648
+ validate: (x) => isEmail(x) ? true : t("payment.checkout.invalid"),
649
+ ...getFieldValidation(
650
+ "customer_email",
651
+ checkoutSession.metadata?.page_info?.field_validation,
652
+ locale
653
+ )
534
654
  }
535
655
  }
536
656
  ),
@@ -541,14 +661,19 @@ export default function PaymentForm({
541
661
  {
542
662
  name: "customer_phone",
543
663
  variant: "outlined",
544
- errorPosition: "right",
664
+ errorPosition: formErrorPosition,
545
665
  placeholder: "Phone number",
546
666
  rules: {
547
667
  required: t("payment.checkout.required"),
548
668
  validate: async (x) => {
549
669
  const isValid = await validatePhoneNumber(x);
550
670
  return isValid ? true : t("payment.checkout.invalid");
551
- }
671
+ },
672
+ ...getFieldValidation(
673
+ "customer_phone",
674
+ checkoutSession.metadata?.page_info?.field_validation,
675
+ locale
676
+ )
552
677
  }
553
678
  }
554
679
  )
@@ -558,7 +683,9 @@ export default function PaymentForm({
558
683
  {
559
684
  mode: checkoutSession.billing_address_collection,
560
685
  stripe: method?.type === "stripe",
561
- sx: { marginTop: "0 !important" }
686
+ sx: { marginTop: "0 !important" },
687
+ fieldValidation: checkoutSession.metadata?.page_info?.field_validation,
688
+ errorPosition: formErrorPosition
562
689
  }
563
690
  )
564
691
  ]
@@ -583,7 +710,11 @@ export default function PaymentForm({
583
710
  children: state.submitting || state.paying ? t("payment.checkout.processing") : buttonText
584
711
  }
585
712
  ) }),
586
- ["subscription", "setup"].includes(checkoutSession.mode) && /* @__PURE__ */ jsx(Typography, { sx: { mt: 2.5, color: "text.lighter", fontSize: "0.7875rem", lineHeight: "0.9625rem" }, children: t("payment.checkout.confirm", { payee }) })
713
+ ["subscription", "setup"].includes(checkoutSession.mode) && /* @__PURE__ */ jsx(Typography, { sx: { mt: 2.5, color: "text.lighter", fontSize: "0.7875rem", lineHeight: "0.9625rem" }, children: showStake ? t("payment.checkout.confirm.withStake", { payee }) : t("payment.checkout.confirm.withoutStake", { payee }) }),
714
+ checkoutSession.metadata?.page_info?.form_purpose_description && /* @__PURE__ */ jsxs(Box, { sx: { mt: 1, display: "flex", alignItems: "center", gap: 0.5 }, children: [
715
+ /* @__PURE__ */ jsx(HelpOutline, { sx: { color: "text.lighter", fontSize: "0.75rem" } }),
716
+ /* @__PURE__ */ jsx(Typography, { variant: "body2", sx: { fontSize: "0.75rem", color: "text.lighter" }, children: locale === "zh" ? checkoutSession.metadata.page_info.form_purpose_description.zh : checkoutSession.metadata.page_info.form_purpose_description.en })
717
+ ] })
587
718
  ] }) }),
588
719
  state.customerLimited && /* @__PURE__ */ jsx(
589
720
  OverdueInvoicePayment,
@@ -610,6 +741,7 @@ export default function PaymentForm({
610
741
  title: t("payment.customer.pastDue.alert.title")
611
742
  }
612
743
  }
613
- )
744
+ ),
745
+ FastCheckoutConfirmDialog
614
746
  ] });
615
747
  }
@@ -49,7 +49,8 @@ function OverdueInvoicePayment({
49
49
  authToken
50
50
  }) {
51
51
  const {
52
- t
52
+ t,
53
+ locale
53
54
  } = (0, _context.useLocaleContext)();
54
55
  const {
55
56
  connect,
@@ -193,12 +194,18 @@ function OverdueInvoicePayment({
193
194
  extraParams.customerId = effectiveCustomerId;
194
195
  }
195
196
  connect.open({
197
+ locale,
196
198
  containerEl: void 0,
197
199
  saveConnect: false,
198
200
  action: "collect-batch",
199
201
  prefix: (0, _ufo.joinURL)((0, _util.getPrefix)(), "/api/did"),
200
202
  useSocket: !isCrossOriginRequest,
201
203
  extraParams,
204
+ messages: {
205
+ scan: t("common.connect.defaultScan"),
206
+ title: t("payment.customer.invoice.payBatch"),
207
+ confirm: t("common.connect.confirm")
208
+ },
202
209
  onSuccess: () => {
203
210
  connect.close();
204
211
  handleConnected();
@@ -609,7 +609,8 @@ function CustomerInvoiceList(props) {
609
609
  type
610
610
  } = props;
611
611
  const {
612
- t
612
+ t,
613
+ locale
613
614
  } = (0, _context.useLocaleContext)();
614
615
  const {
615
616
  connect
@@ -627,6 +628,7 @@ function CustomerInvoiceList(props) {
627
628
  connect.open({
628
629
  action: "collect",
629
630
  saveConnect: false,
631
+ locale,
630
632
  useSocket: (0, _util.isCrossOrigin)() === false,
631
633
  messages: {
632
634
  scan: "",
@@ -120,3 +120,4 @@ export declare function parseMarkedText(text: string): Array<{
120
120
  type: 'text' | 'marked';
121
121
  content: string;
122
122
  }>;
123
+ export declare function getTokenBalanceLink(method: TPaymentMethod, address: string): string;
package/lib/libs/util.js CHANGED
@@ -44,7 +44,9 @@ exports.getRefundStatusColor = getRefundStatusColor;
44
44
  exports.getStatementDescriptor = getStatementDescriptor;
45
45
  exports.getSubscriptionAction = void 0;
46
46
  exports.getSubscriptionStatusColor = getSubscriptionStatusColor;
47
- exports.getTxLink = exports.getSubscriptionTimeSummary = void 0;
47
+ exports.getSubscriptionTimeSummary = void 0;
48
+ exports.getTokenBalanceLink = getTokenBalanceLink;
49
+ exports.getTxLink = void 0;
48
50
  exports.getUserProfileLink = getUserProfileLink;
49
51
  exports.getWebhookStatusColor = getWebhookStatusColor;
50
52
  exports.getWordBreakStyle = getWordBreakStyle;
@@ -1169,4 +1171,17 @@ function parseMarkedText(text) {
1169
1171
  }
1170
1172
  }
1171
1173
  return result.filter(p => p.content !== "");
1174
+ }
1175
+ function getTokenBalanceLink(method, address) {
1176
+ if (!method || !address) {
1177
+ return "";
1178
+ }
1179
+ const explorerHost = method?.settings?.[method?.type]?.explorer_host || "";
1180
+ if (method.type === "arcblock" && address) {
1181
+ return (0, _ufo.joinURL)(explorerHost, "accounts", address, "tokens");
1182
+ }
1183
+ if (["ethereum", "base"].includes(method.type) && address) {
1184
+ return (0, _ufo.joinURL)(explorerHost, "address", address);
1185
+ }
1186
+ return "";
1172
1187
  }
@@ -1 +1,2 @@
1
1
  export declare function validatePostalCode(postalCode: string, country?: string): boolean;
2
+ export declare function getFieldValidation(fieldName: string, validations?: Record<string, any>, locale?: string): Record<string, any>;
@@ -3,8 +3,10 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ exports.getFieldValidation = getFieldValidation;
6
7
  exports.validatePostalCode = validatePostalCode;
7
8
  var _isPostalCode = _interopRequireDefault(require("validator/lib/isPostalCode"));
9
+ var _locales = require("../locales");
8
10
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
9
11
  const POSTAL_CODE_SUPPORTED_COUNTRIES = ["AD", "AT", "AU", "BE", "BG", "BR", "CA", "CH", "CN", "CZ", "DE", "DK", "DZ", "EE", "ES", "FI", "FR", "GB", "GR", "HR", "HU", "ID", "IE", "IL", "IN", "IR", "IS", "IT", "JP", "KE", "KR", "LI", "LT", "LU", "LV", "MX", "MT", "NL", "NO", "NZ", "PL", "PR", "PT", "RO", "RU", "SA", "SE", "SI", "SK", "TN", "TW", "UA", "US", "ZA", "ZM"];
10
12
  function validatePostalCode(postalCode, country) {
@@ -17,4 +19,16 @@ function validatePostalCode(postalCode, country) {
17
19
  console.error(error);
18
20
  return false;
19
21
  }
22
+ }
23
+ function getFieldValidation(fieldName, validations, locale = "en") {
24
+ if (!validations || !validations[fieldName]) return {};
25
+ const fieldValidation = validations[fieldName];
26
+ const rules = {};
27
+ if (fieldValidation.pattern) {
28
+ rules.pattern = {
29
+ value: new RegExp(fieldValidation.pattern),
30
+ message: fieldValidation.pattern_message?.[locale] || (0, _locales.t)("payment.checkout.invalid", locale)
31
+ };
32
+ }
33
+ return rules;
20
34
  }
package/lib/locales/en.js CHANGED
@@ -101,7 +101,13 @@ module.exports = (0, _flat.default)({
101
101
  stakeAmount: "Stake Amount",
102
102
  slashStakeAmount: "Slash Stake Amount",
103
103
  know: "I know",
104
- relatedSubscription: "Subscription"
104
+ relatedSubscription: "Subscription",
105
+ connect: {
106
+ defaultScan: "Use following methods to complete this action",
107
+ scan: "Use following methods to complete this {action}",
108
+ confirm: "Confirm",
109
+ cancel: "Cancel"
110
+ }
105
111
  },
106
112
  payment: {
107
113
  checkout: {
@@ -173,7 +179,10 @@ module.exports = (0, _flat.default)({
173
179
  donate: "Thanks for your tip",
174
180
  tip: "A payment to {payee} has been completed. You can view the details of this payment in your account."
175
181
  },
176
- confirm: "Confirming allows {payee} to charge or reduce your staking. You can cancel or revoke staking anytime.",
182
+ confirm: {
183
+ withStake: "By confirming, you allow {payee} to charge your account for future payments and, if necessary, slash your stake. You can cancel your subscription or withdraw your stake at any time.",
184
+ withoutStake: "By confirming, you allow {payee} to charge your account for future payments. You can cancel your subscription at any time."
185
+ },
177
186
  required: "Required",
178
187
  invalid: "Invalid",
179
188
  billing: {
@@ -216,7 +225,23 @@ module.exports = (0, _flat.default)({
216
225
  },
217
226
  orderSummary: "Order Summary",
218
227
  paymentDetails: "Payment Details",
219
- productListTotal: "Includes {total} items"
228
+ productListTotal: "Includes {total} items",
229
+ connectModal: {
230
+ title: "{action}",
231
+ scan: "Use following methods to complete this payment",
232
+ confirm: "Confirm",
233
+ cancel: "Cancel"
234
+ },
235
+ fastPay: {
236
+ title: "Confirm Payment",
237
+ confirmMessage: "You will pay {amount} {symbol} from {sourceType}.",
238
+ autoPaymentReason: "This payment will be processed automatically due to prior delegation or sufficient balance.",
239
+ confirmPrompt: "Please confirm the details before proceeding.",
240
+ payer: "Account",
241
+ amount: "Amount",
242
+ failed: "Account changed, please pay manually.",
243
+ balanceLink: "View Balance"
244
+ }
220
245
  },
221
246
  customer: {
222
247
  payments: "Payment History",
@@ -282,7 +307,8 @@ module.exports = (0, _flat.default)({
282
307
  select: "Select payment method",
283
308
  submit: "Confirm change",
284
309
  confirm: "By confirming this change, you allow {payee} to charge {symbol} from your account for future payments in accordance with their terms. You can always change your payment method.",
285
- completed: "Your payment method has been successfully updated, all future payments will use the new payment method unless you change it again."
310
+ completed: "Your payment method has been successfully updated, all future payments will use the new payment method unless you change it again.",
311
+ title: "Payment Method Change"
286
312
  },
287
313
  invoice: {
288
314
  summary: "Summary",
@@ -303,7 +329,8 @@ module.exports = (0, _flat.default)({
303
329
  next: "No invoices yet, next invoice will be generated on {date}",
304
330
  invoiceNumber: "Invoice Number",
305
331
  emptyList: "No Invoice",
306
- noPaymentRequired: "No Payment Required"
332
+ noPaymentRequired: "No Payment Required",
333
+ payBatch: "Pay Due Invoices"
307
334
  },
308
335
  payment: {
309
336
  empty: "There are no payments",
package/lib/locales/zh.js CHANGED
@@ -101,7 +101,13 @@ module.exports = (0, _flat.default)({
101
101
  stakeAmount: "\u8D28\u62BC\u91D1\u989D",
102
102
  slashStakeAmount: "\u7F5A\u6CA1\u91D1\u989D",
103
103
  know: "\u6211\u77E5\u9053\u4E86",
104
- relatedSubscription: "\u8BA2\u9605"
104
+ relatedSubscription: "\u8BA2\u9605",
105
+ connect: {
106
+ defaultScan: "\u4F7F\u7528\u4EE5\u4E0B\u65B9\u5F0F\u5B8C\u6210\u672C\u6B21\u64CD\u4F5C",
107
+ scan: "\u4F7F\u7528\u4EE5\u4E0B\u65B9\u5F0F\u5B8C\u6210\u672C\u6B21{action}",
108
+ confirm: "\u786E\u8BA4",
109
+ cancel: "\u53D6\u6D88"
110
+ }
105
111
  },
106
112
  payment: {
107
113
  checkout: {
@@ -173,7 +179,10 @@ module.exports = (0, _flat.default)({
173
179
  donate: "\u611F\u8C22\u60A8\u7684\u652F\u6301",
174
180
  tip: "\u5411{payee}\u7684\u4ED8\u6B3E\u5DF2\u5B8C\u6210\u3002\u60A8\u53EF\u4EE5\u5728\u60A8\u7684\u8D26\u6237\u4E2D\u67E5\u770B\u6B64\u4ED8\u6B3E\u7684\u8BE6\u7EC6\u4FE1\u606F\u3002"
175
181
  },
176
- confirm: "\u786E\u8BA4\u5141\u8BB8{payee}\u5BF9\u60A8\u7684\u8D26\u6237\u8FDB\u884C\u4ED8\u6B3E\u6216\u8005\u7F5A\u6CA1\u60A8\u7684\u8D28\u62BC\u3002\u60A8\u968F\u65F6\u53EF\u4EE5\u53D6\u6D88\u60A8\u7684\u8BA2\u9605\uFF0C\u6216\u8005\u64A4\u9500\u8D28\u62BC\u3002",
182
+ confirm: {
183
+ withStake: "\u786E\u8BA4\u8BA2\u9605\uFF0C\u5373\u8868\u793A\u60A8\u6388\u6743 {payee} \u4ECE\u60A8\u7684\u8D26\u6237\u6263\u53D6\u672A\u6765\u6B3E\u9879\uFF0C\u5E76\u5728\u5FC5\u8981\u65F6\u7F5A\u6CA1\u8D28\u62BC\u3002\u60A8\u53EF\u968F\u65F6\u53D6\u6D88\u8BA2\u9605\u6216\u64A4\u9500\u8D28\u62BC\u3002",
184
+ withoutStake: "\u786E\u8BA4\u8BA2\u9605\uFF0C\u5373\u8868\u793A\u60A8\u6388\u6743 {payee} \u4ECE\u60A8\u7684\u8D26\u6237\u6263\u53D6\u672A\u6765\u6B3E\u9879\u3002\u60A8\u53EF\u968F\u65F6\u53D6\u6D88\u8BA2\u9605\u3002"
185
+ },
177
186
  required: "\u5FC5\u586B\u9879",
178
187
  invalid: "\u65E0\u6548",
179
188
  billing: {
@@ -216,7 +225,23 @@ module.exports = (0, _flat.default)({
216
225
  },
217
226
  orderSummary: "\u8BA2\u5355\u6982\u89C8",
218
227
  paymentDetails: "\u652F\u4ED8\u4FE1\u606F",
219
- productListTotal: "\u5305\u62EC {total} \u9879"
228
+ productListTotal: "\u5305\u62EC {total} \u9879",
229
+ connectModal: {
230
+ title: "{action}",
231
+ scan: "\u4F7F\u7528\u4EE5\u4E0B\u65B9\u5F0F\u5B8C\u6210\u672C\u6B21\u652F\u4ED8",
232
+ confirm: "\u786E\u8BA4",
233
+ cancel: "\u53D6\u6D88"
234
+ },
235
+ fastPay: {
236
+ title: "\u786E\u8BA4\u652F\u4ED8",
237
+ confirmMessage: "\u60A8\u5C06\u652F\u4ED8 {amount} {symbol}\uFF0C\u4ECE{sourceType}\u6263\u9664\u3002",
238
+ autoPaymentReason: "\u7531\u4E8E\u6388\u6743\u6216\u4F59\u989D\u5145\u8DB3\uFF0C\u7CFB\u7EDF\u5C06\u65E0\u9700\u94B1\u5305\u786E\u8BA4\u81EA\u52A8\u5B8C\u6210\u652F\u4ED8\u3002",
239
+ confirmPrompt: "\u8BF7\u786E\u8BA4\u652F\u4ED8\u4FE1\u606F\u65E0\u8BEF\u540E\u7EE7\u7EED\u3002",
240
+ payer: "\u8D26\u6237\u5730\u5740",
241
+ amount: "\u652F\u4ED8\u91D1\u989D",
242
+ failed: "\u8D26\u6237\u53D1\u751F\u53D8\u5316\uFF0C\u65E0\u6CD5\u81EA\u52A8\u5B8C\u6210\u652F\u4ED8\uFF0C\u8BF7\u624B\u52A8\u652F\u4ED8\u3002",
243
+ balanceLink: "\u67E5\u770B\u4F59\u989D"
244
+ }
220
245
  },
221
246
  customer: {
222
247
  payments: "\u652F\u4ED8\u5386\u53F2",
@@ -283,7 +308,8 @@ module.exports = (0, _flat.default)({
283
308
  select: "\u9009\u62E9\u652F\u4ED8\u65B9\u5F0F",
284
309
  submit: "\u786E\u8BA4\u53D8\u66F4",
285
310
  confirm: "\u786E\u8BA4\u53D8\u66F4\u65B9\u5F0F\u610F\u5473\u7740\u4F60\u5141\u8BB8 {payee} \u4F7F\u7528\u65B0\u7684\u652F\u4ED8\u65B9\u5F0F\u652F\u4ED8\u4F60\u7684\u672A\u6765\u8D26\u5355\u3002\u4F60\u53EF\u4EE5\u968F\u65F6\u518D\u6B21\u53D8\u66F4\u652F\u4ED8\u65B9\u5F0F\u3002",
286
- completed: "\u4F60\u7684\u652F\u4ED8\u65B9\u5F0F \u5DF2\u7ECF\u66F4\u65B0\u6210\u529F\u3002\u4F60\u53EF\u4EE5\u5728\u4F60\u7684\u8D26\u6237\u4E2D\u67E5\u770B\u6B64\u652F\u4ED8\u65B9\u5F0F\u7684\u8BE6\u7EC6\u4FE1\u606F\u3002"
311
+ completed: "\u4F60\u7684\u652F\u4ED8\u65B9\u5F0F \u5DF2\u7ECF\u66F4\u65B0\u6210\u529F\u3002\u4F60\u53EF\u4EE5\u5728\u4F60\u7684\u8D26\u6237\u4E2D\u67E5\u770B\u6B64\u652F\u4ED8\u65B9\u5F0F\u7684\u8BE6\u7EC6\u4FE1\u606F\u3002",
312
+ title: "\u652F\u4ED8\u65B9\u5F0F\u53D8\u66F4"
287
313
  },
288
314
  invoice: {
289
315
  summary: "\u6458\u8981",
@@ -304,7 +330,8 @@ module.exports = (0, _flat.default)({
304
330
  next: "\u8FD8\u6CA1\u6709\u8D26\u5355\uFF0C\u4E0B\u6B21\u8D26\u5355\u5C06\u5728 {date} \u751F\u6210",
305
331
  invoiceNumber: "\u8D26\u5355\u7F16\u53F7",
306
332
  emptyList: "\u6CA1\u6709\u8D26\u5355",
307
- noPaymentRequired: "\u65E0\u9700\u652F\u4ED8"
333
+ noPaymentRequired: "\u65E0\u9700\u652F\u4ED8",
334
+ payBatch: "\u652F\u4ED8\u6B20\u6B3E"
308
335
  },
309
336
  payment: {
310
337
  empty: "\u6CA1\u6709\u652F\u4ED8\u8BB0\u5F55",
@@ -3,11 +3,15 @@ type Props = {
3
3
  mode: string;
4
4
  stripe: boolean;
5
5
  sx?: SxProps;
6
+ fieldValidation?: Record<string, any>;
7
+ errorPosition?: 'right' | 'bottom';
6
8
  };
7
- declare function AddressForm({ mode, stripe, sx }: Props): import("react").JSX.Element | null;
9
+ declare function AddressForm({ mode, stripe, sx, fieldValidation, errorPosition }: Props): import("react").JSX.Element | null;
8
10
  declare namespace AddressForm {
9
11
  var defaultProps: {
10
12
  sx: {};
13
+ fieldValidation: {};
14
+ errorPosition: string;
11
15
  };
12
16
  }
13
17
  export default AddressForm;