@paykka/card-checkout-ui 0.13.1 → 0.13.5

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 (158) hide show
  1. package/dist/card-checkout-ui.js +21 -21
  2. package/dist/card-checkout-ui.umd.cjs +21 -21
  3. package/dist/es/_commonjsHelpers.js +82 -1
  4. package/dist/es/api/modules/get-browser-params.js +4 -1
  5. package/dist/es/api/modules/opay-wallet/index.js +16 -0
  6. package/dist/es/api/modules/paga-wallet/index.js +16 -0
  7. package/dist/es/api/modules/pic-pay/index.js +16 -0
  8. package/dist/es/api/modules/pix/index.js +16 -0
  9. package/dist/es/api/modules/vietqr/index.js +4 -0
  10. package/dist/es/components/AliPay/index.js +29 -35
  11. package/dist/es/components/Boost/index.js +34 -40
  12. package/dist/es/components/Card/index.js +35 -39
  13. package/dist/es/components/DropIn/index.js +42 -2
  14. package/dist/es/components/EncryptedCard/index.js +5 -1
  15. package/dist/es/components/GooglePay/index.js +1 -0
  16. package/dist/es/components/GrabPay/index.js +34 -40
  17. package/dist/es/components/GuideCard/index.js +6 -1
  18. package/dist/es/components/LinePay/index.js +34 -40
  19. package/dist/es/components/MayBankQRPay/index.js +35 -41
  20. package/dist/es/components/NinePay/index.js +34 -40
  21. package/dist/es/components/SecuredFieldsProvider/index.js +23 -7
  22. package/dist/es/components/SecuredIframe/index.js +36 -59
  23. package/dist/es/components/Sepa/index.js +17 -21
  24. package/dist/es/components/ShopeePay/index.js +34 -40
  25. package/dist/es/components/TNGWallet/index.js +34 -40
  26. package/dist/es/components/ThreeDS/index.js +32 -7
  27. package/dist/es/components/WechatPay/index.js +19 -24
  28. package/dist/es/components/business/QRCodeModal/QRCodeModal.js +6 -6
  29. package/dist/es/components/index.js +5 -0
  30. package/dist/es/components/internal/Form/FormItem.js +1 -1
  31. package/dist/es/components/internal/Form/util.js +1 -1
  32. package/dist/es/components/internal/Select/SelectMenu.js +2 -2
  33. package/dist/es/components/internal/icons/IconError.js +7 -4
  34. package/dist/es/components/internal/icons/IconOpayWallet.js +71 -0
  35. package/dist/es/components/internal/icons/IconPagaWallet.js +141 -0
  36. package/dist/es/components/internal/icons/IconPaymaya.js +42 -86
  37. package/dist/es/components/internal/icons/IconPicPay.js +49 -0
  38. package/dist/es/components/internal/icons/IconPix.js +75 -0
  39. package/dist/es/components/internal/icons/IconVietqr.js +45 -0
  40. package/dist/es/components/internal/icons/IconVietqrComplete.js +49 -0
  41. package/dist/es/components/wallets/GCash/GCash.js +20 -25
  42. package/dist/es/components/wallets/OpayWallet/OpayWallet.js +346 -0
  43. package/dist/es/components/wallets/OpayWallet/index.js +1 -0
  44. package/dist/es/components/wallets/OpayWallet/opay-wallet.js +1 -0
  45. package/dist/es/components/wallets/OpayWallet/type.js +1 -0
  46. package/dist/es/components/wallets/PagaWallet/PagaWallet.js +346 -0
  47. package/dist/es/components/wallets/PagaWallet/index.js +1 -0
  48. package/dist/es/components/wallets/PagaWallet/paga-wallet.js +1 -0
  49. package/dist/es/components/wallets/PagaWallet/type.js +1 -0
  50. package/dist/es/components/wallets/Paymaya/Paymaya.js +34 -40
  51. package/dist/es/components/wallets/PicPay/PicPay.js +346 -0
  52. package/dist/es/components/wallets/PicPay/index.js +1 -0
  53. package/dist/es/components/wallets/PicPay/pic-pay.js +1 -0
  54. package/dist/es/components/wallets/PicPay/type.js +1 -0
  55. package/dist/es/components/wallets/Pix/Pix.js +346 -0
  56. package/dist/es/components/wallets/Pix/index.js +1 -0
  57. package/dist/es/components/wallets/Pix/pix2.js +1 -0
  58. package/dist/es/components/wallets/Pix/type.js +1 -0
  59. package/dist/es/components/wallets/Vietqr/Vietqr.js +380 -0
  60. package/dist/es/components/wallets/Vietqr/index.js +1 -0
  61. package/dist/es/components/wallets/Vietqr/type.js +1 -0
  62. package/dist/es/components/wallets/Vietqr/vietqr2.js +1 -0
  63. package/dist/es/components/wallets/Zalopay/Zalopay.js +17 -21
  64. package/dist/es/components/wallets/index.js +8 -0
  65. package/dist/es/constant.js +32 -2
  66. package/dist/es/core/checkout.js +24 -1
  67. package/dist/es/core/create.js +1 -1
  68. package/dist/es/core/session.js +2 -23
  69. package/dist/es/core/theme.js +65 -0
  70. package/dist/es/core.js +34 -34
  71. package/dist/es/i18n/locales/de-DE.js +8 -2
  72. package/dist/es/i18n/locales/en-GB.js +8 -2
  73. package/dist/es/i18n/locales/es-ES.js +8 -2
  74. package/dist/es/i18n/locales/fr-FR.js +8 -2
  75. package/dist/es/i18n/locales/ja-JP.js +8 -2
  76. package/dist/es/i18n/locales/ko-KR.js +8 -2
  77. package/dist/es/i18n/locales/nl-NL.js +8 -2
  78. package/dist/es/i18n/locales/pt-PT.js +8 -2
  79. package/dist/es/i18n/locales/ru-RU.js +8 -2
  80. package/dist/es/i18n/locales/zh-CN.js +10 -4
  81. package/dist/es/i18n/locales/zh-HK.js +10 -4
  82. package/dist/es/i18n/locales/zh-TW.js +10 -4
  83. package/dist/es/index.js +17 -5
  84. package/dist/es/style.css +1 -1
  85. package/dist/es/utils/format.js +0 -5
  86. package/dist/es/utils/object.js +31 -1
  87. package/dist/es/utils/string.js +10 -0
  88. package/dist/es/utils/system-info/is-ua-webview.js +14 -12
  89. package/dist/es/utils/theme.js +7 -0
  90. package/dist/style.css +1 -1
  91. package/dist/types/api/modules/get-browser-params.d.ts +1 -0
  92. package/dist/types/api/modules/index.d.ts +5 -0
  93. package/dist/types/api/modules/opay-wallet/index.d.ts +4 -0
  94. package/dist/types/api/modules/paga-wallet/index.d.ts +4 -0
  95. package/dist/types/api/modules/pic-pay/index.d.ts +4 -0
  96. package/dist/types/api/modules/pix/index.d.ts +4 -0
  97. package/dist/types/api/modules/vietqr/index.d.ts +4 -0
  98. package/dist/types/components/DropIn/type.d.ts +3 -2
  99. package/dist/types/components/SecuredFieldsProvider/type.d.ts +5 -0
  100. package/dist/types/components/SecuredIframe/HiddenIframe.d.ts +3 -1
  101. package/dist/types/components/ThreeDS/components/ThreeDSAuth/type.d.ts +2 -0
  102. package/dist/types/components/business/QRCodeModal/type.d.ts +2 -0
  103. package/dist/types/components/index.d.ts +1 -3
  104. package/dist/types/components/internal/Loading/Loading.d.ts +1 -0
  105. package/dist/types/components/internal/Select/SelectMenu.d.ts +1 -1
  106. package/dist/types/components/internal/icons/IconOpayWallet.d.ts +2 -0
  107. package/dist/types/components/internal/icons/IconPagaWallet.d.ts +2 -0
  108. package/dist/types/components/internal/icons/IconPicPay.d.ts +2 -0
  109. package/dist/types/components/internal/icons/IconPix.d.ts +2 -0
  110. package/dist/types/components/internal/icons/IconVietqr.d.ts +2 -0
  111. package/dist/types/components/internal/icons/IconVietqrComplete.d.ts +2 -0
  112. package/dist/types/components/internal/icons/index.d.ts +6 -0
  113. package/dist/types/components/wallets/OpayWallet/OpayWallet.d.ts +10 -0
  114. package/dist/types/components/wallets/OpayWallet/index.d.ts +2 -0
  115. package/dist/types/components/wallets/OpayWallet/type.d.ts +40 -0
  116. package/dist/types/components/wallets/PagaWallet/PagaWallet.d.ts +10 -0
  117. package/dist/types/components/wallets/PagaWallet/index.d.ts +2 -0
  118. package/dist/types/components/wallets/PagaWallet/type.d.ts +40 -0
  119. package/dist/types/components/wallets/PicPay/PicPay.d.ts +10 -0
  120. package/dist/types/components/wallets/PicPay/index.d.ts +2 -0
  121. package/dist/types/components/wallets/PicPay/type.d.ts +40 -0
  122. package/dist/types/components/wallets/Pix/Pix.d.ts +10 -0
  123. package/dist/types/components/wallets/Pix/index.d.ts +2 -0
  124. package/dist/types/components/wallets/Pix/type.d.ts +40 -0
  125. package/dist/types/components/wallets/Vietqr/Vietqr.d.ts +10 -0
  126. package/dist/types/components/wallets/Vietqr/index.d.ts +2 -0
  127. package/dist/types/components/wallets/Vietqr/type.d.ts +39 -0
  128. package/dist/types/components/wallets/index.d.ts +8 -0
  129. package/dist/types/components/wallets/type.d.ts +9 -0
  130. package/dist/types/constant.d.ts +11 -1
  131. package/dist/types/core/checkout.d.ts +4 -0
  132. package/dist/types/core/index.d.ts +1 -0
  133. package/dist/types/core/session.d.ts +1 -11
  134. package/dist/types/core/theme.d.ts +7 -0
  135. package/dist/types/i18n/locales/de-DE.d.ts +6 -0
  136. package/dist/types/i18n/locales/en-GB.d.ts +6 -0
  137. package/dist/types/i18n/locales/es-ES.d.ts +6 -0
  138. package/dist/types/i18n/locales/fr-FR.d.ts +6 -0
  139. package/dist/types/i18n/locales/ja-JP.d.ts +6 -0
  140. package/dist/types/i18n/locales/ko-KR.d.ts +6 -0
  141. package/dist/types/i18n/locales/nl-NL.d.ts +6 -0
  142. package/dist/types/i18n/locales/pt-PT.d.ts +6 -0
  143. package/dist/types/i18n/locales/ru-RU.d.ts +6 -0
  144. package/dist/types/i18n/locales/zh-CN.d.ts +6 -0
  145. package/dist/types/i18n/locales/zh-HK.d.ts +6 -0
  146. package/dist/types/i18n/locales/zh-TW.d.ts +6 -0
  147. package/dist/types/types/message.d.ts +29 -25
  148. package/dist/types/utils/index.d.ts +3 -2
  149. package/dist/types/utils/object.d.ts +7 -0
  150. package/dist/types/utils/string.d.ts +1 -0
  151. package/dist/types/utils/style.d.ts +1 -1
  152. package/dist/types/utils/system-info/is-ua-webview.d.ts +1 -1
  153. package/dist/types/utils/theme.d.ts +4 -0
  154. package/package.json +67 -67
  155. package/dist/es/utils/deep-freeze.js +0 -13
  156. package/dist/es/utils/obj.js +0 -22
  157. package/dist/types/utils/deep-freeze.d.ts +0 -1
  158. package/dist/types/utils/obj.d.ts +0 -6
@@ -3,7 +3,7 @@ import { useBEM } from "../../hooks/useBEM.js";
3
3
  import { CoreContext } from "../../core/context.js";
4
4
  import "../../utils/card-brand/brands.js";
5
5
  import "../../utils/system-info/get-browser-info.js";
6
- import { cssVarPrefix, normalizedClass, formatAmount } from "../../utils/format.js";
6
+ import { normalizedClass, formatAmount } from "../../utils/format.js";
7
7
  import { redirectToPayment } from "../../utils/redirect.js";
8
8
  import { formatPaymentResult } from "../../utils/payment.js";
9
9
  import { isTimeoutError } from "../../api/http.js";
@@ -25,7 +25,6 @@ import { GuideCard } from "../GuideCard/index.js";
25
25
  const { bem } = useBEM("line-pay");
26
26
  const fieldClassNames = bem("field");
27
27
  const LinePay = w((props, ref) => {
28
- var _a, _b, _c, _d, _e, _f;
29
28
  const {
30
29
  session,
31
30
  showEmail = false,
@@ -46,21 +45,21 @@ const LinePay = w((props, ref) => {
46
45
  startReFetchPayInfo({ timeout });
47
46
  },
48
47
  updateAddress: () => {
49
- var _a2;
48
+ var _a;
50
49
  if (!(fieldStatus == null ? void 0 : fieldStatus.address.show))
51
50
  return;
52
51
  const newForm = Object.assign(form, { address: addressCore.getAddressState() });
53
52
  setForm(newForm);
54
- (_a2 = addressFieldRef.current) == null ? void 0 : _a2.update(addressCore.getAddressState());
53
+ (_a = addressFieldRef.current) == null ? void 0 : _a.update(addressCore.getAddressState());
55
54
  validateForm();
56
55
  },
57
56
  updateEmail: () => {
58
- var _a2;
57
+ var _a;
59
58
  if (!(fieldStatus == null ? void 0 : fieldStatus.email.show))
60
59
  return;
61
60
  const newForm = Object.assign(form, { email: emailState.email });
62
61
  setForm(newForm);
63
- (_a2 = emailFieldRef.current) == null ? void 0 : _a2.update(emailState.email);
62
+ (_a = emailFieldRef.current) == null ? void 0 : _a.update(emailState.email);
64
63
  validateForm();
65
64
  },
66
65
  payment: () => {
@@ -103,11 +102,11 @@ const LinePay = w((props, ref) => {
103
102
  setFieldStatus({ ...field });
104
103
  };
105
104
  const processOnSuccess = (res) => {
106
- var _a2, _b2;
105
+ var _a, _b;
107
106
  setSubmitButtonStatus("success");
108
- (_b2 = props.onSuccess) == null ? void 0 : _b2.call(props, formatPaymentResult({
107
+ (_b = props.onSuccess) == null ? void 0 : _b.call(props, formatPaymentResult({
109
108
  ...res,
110
- returnUrl: (_a2 = session == null ? void 0 : session.checkout) == null ? void 0 : _a2.returnUrl
109
+ returnUrl: (_a = session == null ? void 0 : session.checkout) == null ? void 0 : _a.returnUrl
111
110
  }));
112
111
  };
113
112
  y(() => {
@@ -129,16 +128,16 @@ const LinePay = w((props, ref) => {
129
128
  }
130
129
  }, [sessionReady]);
131
130
  const processOnError = (error) => {
132
- var _a2;
133
- (_a2 = props.onError) == null ? void 0 : _a2.call(props, error);
131
+ var _a;
132
+ (_a = props.onError) == null ? void 0 : _a.call(props, error);
134
133
  core.resetEnablePaymentMethod();
135
134
  };
136
135
  const onTimeout = q(
137
136
  (message) => {
138
- var _a2;
137
+ var _a;
139
138
  setErrorMsg(message || i18n.get("common.payTimeout"));
140
139
  setSubmitButtonStatus("unSubmit");
141
- (_a2 = props.onTimeout) == null ? void 0 : _a2.call(props);
140
+ (_a = props.onTimeout) == null ? void 0 : _a.call(props);
142
141
  core.resetEnablePaymentMethod();
143
142
  },
144
143
  [i18n, props.onTimeout]
@@ -168,12 +167,12 @@ const LinePay = w((props, ref) => {
168
167
  };
169
168
  };
170
169
  const pay = async (search = false, timeout) => {
171
- var _a2, _b2, _c2, _d2, _e2, _f2, _g;
170
+ var _a, _b, _c, _d, _e, _f, _g;
172
171
  try {
173
172
  const requestOptions = { locale: i18n.locale, timeout };
174
173
  let res = null;
175
174
  if (search) {
176
- const extraParams = (_b2 = (_a2 = core.config)._getExtraParams) == null ? void 0 : _b2.call(_a2, "query", PaymentMethod.LINE_PAY);
175
+ const extraParams = (_b = (_a = core.config)._getExtraParams) == null ? void 0 : _b.call(_a, "query", PaymentMethod.LINE_PAY);
177
176
  res = await getLinePayInfo(
178
177
  {
179
178
  sessionId: session.sessionId,
@@ -184,10 +183,10 @@ const LinePay = w((props, ref) => {
184
183
  requestOptions
185
184
  );
186
185
  } else {
187
- const extraParams = (_d2 = (_c2 = core.config)._getExtraParams) == null ? void 0 : _d2.call(_c2, "payment", PaymentMethod.LINE_PAY);
186
+ const extraParams = (_d = (_c = core.config)._getExtraParams) == null ? void 0 : _d.call(_c, "payment", PaymentMethod.LINE_PAY);
188
187
  res = await linePay(await getPaymentParams(), extraParams, requestOptions);
189
188
  }
190
- !search && ((_e2 = props.onSubmitResponse) == null ? void 0 : _e2.call(props, res));
189
+ !search && ((_e = props.onSubmitResponse) == null ? void 0 : _e.call(props, res));
191
190
  const { status, orderStatus, errorMessage, errorCode, payInfo, sessionId } = res;
192
191
  sessionId && (session.sessionId = sessionId);
193
192
  if (status === "PROCESSING") {
@@ -214,7 +213,7 @@ const LinePay = w((props, ref) => {
214
213
  return { end: false };
215
214
  } else if (orderStatus === "CANCELED") {
216
215
  setSubmitButtonStatus("unSubmit");
217
- (_f2 = props.onTimeout) == null ? void 0 : _f2.call(props);
216
+ (_f = props.onTimeout) == null ? void 0 : _f.call(props);
218
217
  core.resetEnablePaymentMethod();
219
218
  return { end: true };
220
219
  }
@@ -246,8 +245,8 @@ const LinePay = w((props, ref) => {
246
245
  }
247
246
  };
248
247
  const validateForm = () => {
249
- var _a2;
250
- (_a2 = formRef.current) == null ? void 0 : _a2.validate(void 0, false).then(() => {
248
+ var _a;
249
+ (_a = formRef.current) == null ? void 0 : _a.validate(void 0, false).then(() => {
251
250
  setValidated(true);
252
251
  }).catch(() => {
253
252
  setValidated(false);
@@ -257,12 +256,12 @@ const LinePay = w((props, ref) => {
257
256
  validateForm();
258
257
  }, [form]);
259
258
  const onSubmit = async () => {
260
- var _a2;
259
+ var _a;
261
260
  setErrorMsg("");
262
- (_a2 = formRef.current) == null ? void 0 : _a2.validate(async (errors) => {
263
- var _a3;
261
+ (_a = formRef.current) == null ? void 0 : _a.validate(async (errors) => {
262
+ var _a2;
264
263
  (fieldStatus == null ? void 0 : fieldStatus.address.show) && addressCore.setValidateAllFields(true);
265
- (_a3 = props.onSubmit) == null ? void 0 : _a3.call(props, errors);
264
+ (_a2 = props.onSubmit) == null ? void 0 : _a2.call(props, errors);
266
265
  if (errors) {
267
266
  setSubmitButtonStatus("unSubmit");
268
267
  return;
@@ -277,8 +276,8 @@ const LinePay = w((props, ref) => {
277
276
  dom && validateForm();
278
277
  };
279
278
  const Button = () => {
280
- var _a2;
281
- const transAmount = (_a2 = session == null ? void 0 : session.checkout) == null ? void 0 : _a2.transAmount;
279
+ var _a;
280
+ const transAmount = (_a = session == null ? void 0 : session.checkout) == null ? void 0 : _a.transAmount;
282
281
  const amountText = (transAmount == null ? void 0 : transAmount.amount) ? formatAmount(transAmount).jointSymbol() : "";
283
282
  const text = i18n.get("common.pay") + (amountText ? ` ${amountText}` : "");
284
283
  return /* @__PURE__ */ u(
@@ -304,24 +303,17 @@ const LinePay = w((props, ref) => {
304
303
  }
305
304
  ) }) });
306
305
  };
307
- const formStyle = {
308
- [cssVarPrefix("button-bg-color")]: (_a = session == null ? void 0 : session.colors) == null ? void 0 : _a.primary,
309
- [cssVarPrefix("button-bg-color-hover")]: (_b = session == null ? void 0 : session.colors) == null ? void 0 : _b.primaryHover,
310
- [cssVarPrefix("button-bg-color-active")]: (_c = session == null ? void 0 : session.colors) == null ? void 0 : _c.primaryActive,
311
- [cssVarPrefix("button-text-color")]: (_e = (_d = session == null ? void 0 : session.checkout) == null ? void 0 : _d.theme) == null ? void 0 : _e.payButtonTextColor,
312
- [cssVarPrefix("input-color")]: (_f = session == null ? void 0 : session.colors) == null ? void 0 : _f.primary
313
- };
314
306
  const ErrorMessage = () => {
315
- return /* @__PURE__ */ u(b, { children: !!errorMsg && /* @__PURE__ */ u(Info, { content: errorMsg, style: { marginTop: "12px" } }) });
307
+ return /* @__PURE__ */ u(b, { children: !!errorMsg && /* @__PURE__ */ u(Info, { content: errorMsg }) });
316
308
  };
317
309
  const Address = () => {
318
- var _a2, _b2;
310
+ var _a, _b;
319
311
  return /* @__PURE__ */ u(b, { children: (fieldStatus == null ? void 0 : fieldStatus.address.show) && /* @__PURE__ */ u("div", { className: fieldClassNames, children: /* @__PURE__ */ u(
320
312
  AddressField,
321
313
  {
322
314
  ref: addressFieldRef,
323
315
  value: form.address,
324
- country: ((_a2 = session == null ? void 0 : session.checkout) == null ? void 0 : _a2.country) || ((_b2 = session == null ? void 0 : session.checkout) == null ? void 0 : _b2.bill.country),
316
+ country: ((_a = session == null ? void 0 : session.checkout) == null ? void 0 : _a.country) || ((_b = session == null ? void 0 : session.checkout) == null ? void 0 : _b.bill.country),
325
317
  onAddressChange: (value) => setForm(Object.assign(form, { address: value }))
326
318
  }
327
319
  ) }) });
@@ -334,13 +326,15 @@ const LinePay = w((props, ref) => {
334
326
  session,
335
327
  core
336
328
  },
337
- children: isCheckoutEnabled && i18n.ready.value && /* @__PURE__ */ u(b, { children: [
329
+ children: isCheckoutEnabled && i18n.ready.value && /* @__PURE__ */ u("div", { className: core.theme.className, children: [
338
330
  showGuideCard && /* @__PURE__ */ u(GuideCard, { type: PaymentCategory.LINE_PAY }),
339
- /* @__PURE__ */ u(Form, { form, ref: setFormRef, onFormChange: (form2) => setForm(form2), children: /* @__PURE__ */ u("div", { className: normalizedClass(COMMON_CLASS_NAME, bem()), style: formStyle, children: [
331
+ /* @__PURE__ */ u(Form, { form, ref: setFormRef, onFormChange: (form2) => setForm(form2), children: /* @__PURE__ */ u("div", { className: normalizedClass(COMMON_CLASS_NAME, bem()), children: [
340
332
  Email(),
341
333
  Address(),
342
- ErrorMessage(),
343
- !hidePaymentButton && Button()
334
+ /* @__PURE__ */ u("div", { className: bem("footer-wrapper"), children: [
335
+ ErrorMessage(),
336
+ !hidePaymentButton && Button()
337
+ ] })
344
338
  ] }) })
345
339
  ] })
346
340
  }
@@ -3,7 +3,7 @@ import { useBEM } from "../../hooks/useBEM.js";
3
3
  import { CoreContext } from "../../core/context.js";
4
4
  import "../../utils/card-brand/brands.js";
5
5
  import "../../utils/system-info/get-browser-info.js";
6
- import { cssVarPrefix, normalizedClass, formatAmount } from "../../utils/format.js";
6
+ import { normalizedClass, formatAmount } from "../../utils/format.js";
7
7
  import { redirectToPayment } from "../../utils/redirect.js";
8
8
  import { formatPaymentResult } from "../../utils/payment.js";
9
9
  import { isTimeoutError } from "../../api/http.js";
@@ -26,7 +26,6 @@ const { bem } = useBEM("may-bank-qr-pay");
26
26
  const fieldClassNames = bem("field");
27
27
  const MayBankQRPay = w(
28
28
  (props, ref) => {
29
- var _a, _b, _c, _d, _e, _f;
30
29
  const {
31
30
  session,
32
31
  showEmail = false,
@@ -47,21 +46,21 @@ const MayBankQRPay = w(
47
46
  startReFetchPayInfo({ timeout });
48
47
  },
49
48
  updateAddress: () => {
50
- var _a2;
49
+ var _a;
51
50
  if (!(fieldStatus == null ? void 0 : fieldStatus.address.show))
52
51
  return;
53
52
  const newForm = Object.assign(form, { address: addressCore.getAddressState() });
54
53
  setForm(newForm);
55
- (_a2 = addressFieldRef.current) == null ? void 0 : _a2.update(addressCore.getAddressState());
54
+ (_a = addressFieldRef.current) == null ? void 0 : _a.update(addressCore.getAddressState());
56
55
  validateForm();
57
56
  },
58
57
  updateEmail: () => {
59
- var _a2;
58
+ var _a;
60
59
  if (!(fieldStatus == null ? void 0 : fieldStatus.email.show))
61
60
  return;
62
61
  const newForm = Object.assign(form, { email: emailState.email });
63
62
  setForm(newForm);
64
- (_a2 = emailFieldRef.current) == null ? void 0 : _a2.update(emailState.email);
63
+ (_a = emailFieldRef.current) == null ? void 0 : _a.update(emailState.email);
65
64
  validateForm();
66
65
  },
67
66
  payment: () => {
@@ -104,11 +103,11 @@ const MayBankQRPay = w(
104
103
  setFieldStatus({ ...field });
105
104
  };
106
105
  const processOnSuccess = (res) => {
107
- var _a2, _b2;
106
+ var _a, _b;
108
107
  setSubmitButtonStatus("success");
109
- (_b2 = props.onSuccess) == null ? void 0 : _b2.call(props, formatPaymentResult({
108
+ (_b = props.onSuccess) == null ? void 0 : _b.call(props, formatPaymentResult({
110
109
  ...res,
111
- returnUrl: (_a2 = session == null ? void 0 : session.checkout) == null ? void 0 : _a2.returnUrl
110
+ returnUrl: (_a = session == null ? void 0 : session.checkout) == null ? void 0 : _a.returnUrl
112
111
  }));
113
112
  };
114
113
  y(() => {
@@ -130,16 +129,16 @@ const MayBankQRPay = w(
130
129
  }
131
130
  }, [sessionReady]);
132
131
  const processOnError = (error) => {
133
- var _a2;
134
- (_a2 = props.onError) == null ? void 0 : _a2.call(props, error);
132
+ var _a;
133
+ (_a = props.onError) == null ? void 0 : _a.call(props, error);
135
134
  core.resetEnablePaymentMethod();
136
135
  };
137
136
  const onTimeout = q(
138
137
  (message) => {
139
- var _a2;
138
+ var _a;
140
139
  setErrorMsg(message || i18n.get("common.payTimeout"));
141
140
  setSubmitButtonStatus("unSubmit");
142
- (_a2 = props.onTimeout) == null ? void 0 : _a2.call(props);
141
+ (_a = props.onTimeout) == null ? void 0 : _a.call(props);
143
142
  core.resetEnablePaymentMethod();
144
143
  },
145
144
  [i18n, props.onTimeout]
@@ -169,12 +168,12 @@ const MayBankQRPay = w(
169
168
  };
170
169
  };
171
170
  const pay = async (search = false, timeout) => {
172
- var _a2, _b2, _c2, _d2, _e2, _f2, _g;
171
+ var _a, _b, _c, _d, _e, _f, _g;
173
172
  try {
174
173
  const requestOptions = { locale: i18n.locale, timeout };
175
174
  let res = null;
176
175
  if (search) {
177
- const extraParams = (_b2 = (_a2 = core.config)._getExtraParams) == null ? void 0 : _b2.call(_a2, "query", PaymentMethod.MAY_BANK_QR_PAY);
176
+ const extraParams = (_b = (_a = core.config)._getExtraParams) == null ? void 0 : _b.call(_a, "query", PaymentMethod.MAY_BANK_QR_PAY);
178
177
  res = await getMayBankQRPayInfo(
179
178
  {
180
179
  sessionId: session.sessionId,
@@ -185,14 +184,14 @@ const MayBankQRPay = w(
185
184
  requestOptions
186
185
  );
187
186
  } else {
188
- const extraParams = (_d2 = (_c2 = core.config)._getExtraParams) == null ? void 0 : _d2.call(
189
- _c2,
187
+ const extraParams = (_d = (_c = core.config)._getExtraParams) == null ? void 0 : _d.call(
188
+ _c,
190
189
  "payment",
191
190
  PaymentMethod.MAY_BANK_QR_PAY
192
191
  );
193
192
  res = await mayBankQRPay(await getPaymentParams(), extraParams, requestOptions);
194
193
  }
195
- !search && ((_e2 = props.onSubmitResponse) == null ? void 0 : _e2.call(props, res));
194
+ !search && ((_e = props.onSubmitResponse) == null ? void 0 : _e.call(props, res));
196
195
  const { status, orderStatus, errorMessage, errorCode, payInfo, sessionId } = res;
197
196
  sessionId && (session.sessionId = sessionId);
198
197
  if (status === "PROCESSING") {
@@ -219,7 +218,7 @@ const MayBankQRPay = w(
219
218
  return { end: false };
220
219
  } else if (orderStatus === "CANCELED") {
221
220
  setSubmitButtonStatus("unSubmit");
222
- (_f2 = props.onTimeout) == null ? void 0 : _f2.call(props);
221
+ (_f = props.onTimeout) == null ? void 0 : _f.call(props);
223
222
  core.resetEnablePaymentMethod();
224
223
  return { end: true };
225
224
  }
@@ -251,8 +250,8 @@ const MayBankQRPay = w(
251
250
  }
252
251
  };
253
252
  const validateForm = () => {
254
- var _a2;
255
- (_a2 = formRef.current) == null ? void 0 : _a2.validate(void 0, false).then(() => {
253
+ var _a;
254
+ (_a = formRef.current) == null ? void 0 : _a.validate(void 0, false).then(() => {
256
255
  setValidated(true);
257
256
  }).catch(() => {
258
257
  setValidated(false);
@@ -262,12 +261,12 @@ const MayBankQRPay = w(
262
261
  validateForm();
263
262
  }, [form]);
264
263
  const onSubmit = async () => {
265
- var _a2;
264
+ var _a;
266
265
  setErrorMsg("");
267
- (_a2 = formRef.current) == null ? void 0 : _a2.validate(async (errors) => {
268
- var _a3;
266
+ (_a = formRef.current) == null ? void 0 : _a.validate(async (errors) => {
267
+ var _a2;
269
268
  (fieldStatus == null ? void 0 : fieldStatus.address.show) && addressCore.setValidateAllFields(true);
270
- (_a3 = props.onSubmit) == null ? void 0 : _a3.call(props, errors);
269
+ (_a2 = props.onSubmit) == null ? void 0 : _a2.call(props, errors);
271
270
  if (errors) {
272
271
  setSubmitButtonStatus("unSubmit");
273
272
  return;
@@ -282,8 +281,8 @@ const MayBankQRPay = w(
282
281
  dom && validateForm();
283
282
  };
284
283
  const Button = () => {
285
- var _a2;
286
- const transAmount = (_a2 = session == null ? void 0 : session.checkout) == null ? void 0 : _a2.transAmount;
284
+ var _a;
285
+ const transAmount = (_a = session == null ? void 0 : session.checkout) == null ? void 0 : _a.transAmount;
287
286
  const amountText = (transAmount == null ? void 0 : transAmount.amount) ? formatAmount(transAmount).jointSymbol() : "";
288
287
  const text = i18n.get("common.pay") + (amountText ? ` ${amountText}` : "");
289
288
  return /* @__PURE__ */ u(
@@ -309,24 +308,17 @@ const MayBankQRPay = w(
309
308
  }
310
309
  ) }) });
311
310
  };
312
- const formStyle = {
313
- [cssVarPrefix("button-bg-color")]: (_a = session == null ? void 0 : session.colors) == null ? void 0 : _a.primary,
314
- [cssVarPrefix("button-bg-color-hover")]: (_b = session == null ? void 0 : session.colors) == null ? void 0 : _b.primaryHover,
315
- [cssVarPrefix("button-bg-color-active")]: (_c = session == null ? void 0 : session.colors) == null ? void 0 : _c.primaryActive,
316
- [cssVarPrefix("button-text-color")]: (_e = (_d = session == null ? void 0 : session.checkout) == null ? void 0 : _d.theme) == null ? void 0 : _e.payButtonTextColor,
317
- [cssVarPrefix("input-color")]: (_f = session == null ? void 0 : session.colors) == null ? void 0 : _f.primary
318
- };
319
311
  const ErrorMessage = () => {
320
- return /* @__PURE__ */ u(b, { children: !!errorMsg && /* @__PURE__ */ u(Info, { content: errorMsg, style: { marginTop: "12px" } }) });
312
+ return /* @__PURE__ */ u(b, { children: !!errorMsg && /* @__PURE__ */ u(Info, { content: errorMsg }) });
321
313
  };
322
314
  const Address = () => {
323
- var _a2, _b2;
315
+ var _a, _b;
324
316
  return /* @__PURE__ */ u(b, { children: (fieldStatus == null ? void 0 : fieldStatus.address.show) && /* @__PURE__ */ u("div", { className: fieldClassNames, children: /* @__PURE__ */ u(
325
317
  AddressField,
326
318
  {
327
319
  ref: addressFieldRef,
328
320
  value: form.address,
329
- country: ((_a2 = session == null ? void 0 : session.checkout) == null ? void 0 : _a2.country) || ((_b2 = session == null ? void 0 : session.checkout) == null ? void 0 : _b2.bill.country),
321
+ country: ((_a = session == null ? void 0 : session.checkout) == null ? void 0 : _a.country) || ((_b = session == null ? void 0 : session.checkout) == null ? void 0 : _b.bill.country),
330
322
  onAddressChange: (value) => setForm(Object.assign(form, { address: value }))
331
323
  }
332
324
  ) }) });
@@ -339,13 +331,15 @@ const MayBankQRPay = w(
339
331
  session,
340
332
  core
341
333
  },
342
- children: isCheckoutEnabled && i18n.ready.value && /* @__PURE__ */ u(b, { children: [
334
+ children: isCheckoutEnabled && i18n.ready.value && /* @__PURE__ */ u("div", { className: core.theme.className, children: [
343
335
  showGuideCard && /* @__PURE__ */ u(GuideCard, { type: PaymentCategory.MAY_BANK_QR_PAY }),
344
- /* @__PURE__ */ u(Form, { form, ref: setFormRef, onFormChange: (form2) => setForm(form2), children: /* @__PURE__ */ u("div", { className: normalizedClass(COMMON_CLASS_NAME, bem()), style: formStyle, children: [
336
+ /* @__PURE__ */ u(Form, { form, ref: setFormRef, onFormChange: (form2) => setForm(form2), children: /* @__PURE__ */ u("div", { className: normalizedClass(COMMON_CLASS_NAME, bem()), children: [
345
337
  Email(),
346
338
  Address(),
347
- ErrorMessage(),
348
- !hidePaymentButton && Button()
339
+ /* @__PURE__ */ u("div", { className: bem("footer-wrapper"), children: [
340
+ ErrorMessage(),
341
+ !hidePaymentButton && Button()
342
+ ] })
349
343
  ] }) })
350
344
  ] })
351
345
  }
@@ -3,7 +3,7 @@ import { useBEM } from "../../hooks/useBEM.js";
3
3
  import { CoreContext } from "../../core/context.js";
4
4
  import "../../utils/card-brand/brands.js";
5
5
  import "../../utils/system-info/get-browser-info.js";
6
- import { cssVarPrefix, normalizedClass, formatAmount } from "../../utils/format.js";
6
+ import { normalizedClass, formatAmount } from "../../utils/format.js";
7
7
  import { redirectToPayment } from "../../utils/redirect.js";
8
8
  import { formatPaymentResult } from "../../utils/payment.js";
9
9
  import { isTimeoutError } from "../../api/http.js";
@@ -25,7 +25,6 @@ import { GuideCard } from "../GuideCard/index.js";
25
25
  const { bem } = useBEM("nine-pay");
26
26
  const fieldClassNames = bem("field");
27
27
  const NinePay = w((props, ref) => {
28
- var _a, _b, _c, _d, _e, _f;
29
28
  const {
30
29
  session,
31
30
  showEmail = false,
@@ -46,21 +45,21 @@ const NinePay = w((props, ref) => {
46
45
  startReFetchPayInfo({ timeout });
47
46
  },
48
47
  updateAddress: () => {
49
- var _a2;
48
+ var _a;
50
49
  if (!(fieldStatus == null ? void 0 : fieldStatus.address.show))
51
50
  return;
52
51
  const newForm = Object.assign(form, { address: addressCore.getAddressState() });
53
52
  setForm(newForm);
54
- (_a2 = addressFieldRef.current) == null ? void 0 : _a2.update(addressCore.getAddressState());
53
+ (_a = addressFieldRef.current) == null ? void 0 : _a.update(addressCore.getAddressState());
55
54
  validateForm();
56
55
  },
57
56
  updateEmail: () => {
58
- var _a2;
57
+ var _a;
59
58
  if (!(fieldStatus == null ? void 0 : fieldStatus.email.show))
60
59
  return;
61
60
  const newForm = Object.assign(form, { email: emailState.email });
62
61
  setForm(newForm);
63
- (_a2 = emailFieldRef.current) == null ? void 0 : _a2.update(emailState.email);
62
+ (_a = emailFieldRef.current) == null ? void 0 : _a.update(emailState.email);
64
63
  validateForm();
65
64
  },
66
65
  payment: () => {
@@ -103,11 +102,11 @@ const NinePay = w((props, ref) => {
103
102
  setFieldStatus({ ...field });
104
103
  };
105
104
  const processOnSuccess = (res) => {
106
- var _a2, _b2;
105
+ var _a, _b;
107
106
  setSubmitButtonStatus("success");
108
- (_b2 = props.onSuccess) == null ? void 0 : _b2.call(props, formatPaymentResult({
107
+ (_b = props.onSuccess) == null ? void 0 : _b.call(props, formatPaymentResult({
109
108
  ...res,
110
- returnUrl: (_a2 = session == null ? void 0 : session.checkout) == null ? void 0 : _a2.returnUrl
109
+ returnUrl: (_a = session == null ? void 0 : session.checkout) == null ? void 0 : _a.returnUrl
111
110
  }));
112
111
  };
113
112
  y(() => {
@@ -129,16 +128,16 @@ const NinePay = w((props, ref) => {
129
128
  }
130
129
  }, [sessionReady]);
131
130
  const processOnError = (error) => {
132
- var _a2;
133
- (_a2 = props.onError) == null ? void 0 : _a2.call(props, error);
131
+ var _a;
132
+ (_a = props.onError) == null ? void 0 : _a.call(props, error);
134
133
  core.resetEnablePaymentMethod();
135
134
  };
136
135
  const onTimeout = q(
137
136
  (message) => {
138
- var _a2;
137
+ var _a;
139
138
  setErrorMsg(message || i18n.get("common.payTimeout"));
140
139
  setSubmitButtonStatus("unSubmit");
141
- (_a2 = props.onTimeout) == null ? void 0 : _a2.call(props);
140
+ (_a = props.onTimeout) == null ? void 0 : _a.call(props);
142
141
  core.resetEnablePaymentMethod();
143
142
  },
144
143
  [i18n, props.onTimeout]
@@ -168,12 +167,12 @@ const NinePay = w((props, ref) => {
168
167
  };
169
168
  };
170
169
  const pay = async (search = false, timeout) => {
171
- var _a2, _b2, _c2, _d2, _e2, _f2, _g;
170
+ var _a, _b, _c, _d, _e, _f, _g;
172
171
  try {
173
172
  const requestOptions = { locale: i18n.locale, timeout };
174
173
  let res = null;
175
174
  if (search) {
176
- const extraParams = (_b2 = (_a2 = core.config)._getExtraParams) == null ? void 0 : _b2.call(_a2, "query", PaymentMethod.NINE_PAY);
175
+ const extraParams = (_b = (_a = core.config)._getExtraParams) == null ? void 0 : _b.call(_a, "query", PaymentMethod.NINE_PAY);
177
176
  res = await getNinePayInfo(
178
177
  {
179
178
  sessionId: session.sessionId,
@@ -184,10 +183,10 @@ const NinePay = w((props, ref) => {
184
183
  requestOptions
185
184
  );
186
185
  } else {
187
- const extraParams = (_d2 = (_c2 = core.config)._getExtraParams) == null ? void 0 : _d2.call(_c2, "payment", PaymentMethod.NINE_PAY);
186
+ const extraParams = (_d = (_c = core.config)._getExtraParams) == null ? void 0 : _d.call(_c, "payment", PaymentMethod.NINE_PAY);
188
187
  res = await ninePay(await getPaymentParams(), extraParams, requestOptions);
189
188
  }
190
- !search && ((_e2 = props.onSubmitResponse) == null ? void 0 : _e2.call(props, res));
189
+ !search && ((_e = props.onSubmitResponse) == null ? void 0 : _e.call(props, res));
191
190
  const { status, orderStatus, errorMessage, errorCode, payInfo, sessionId } = res;
192
191
  sessionId && (session.sessionId = sessionId);
193
192
  if (status === "PROCESSING") {
@@ -214,7 +213,7 @@ const NinePay = w((props, ref) => {
214
213
  return { end: false };
215
214
  } else if (orderStatus === "CANCELED") {
216
215
  setSubmitButtonStatus("unSubmit");
217
- (_f2 = props.onTimeout) == null ? void 0 : _f2.call(props);
216
+ (_f = props.onTimeout) == null ? void 0 : _f.call(props);
218
217
  core.resetEnablePaymentMethod();
219
218
  return { end: true };
220
219
  }
@@ -246,8 +245,8 @@ const NinePay = w((props, ref) => {
246
245
  }
247
246
  };
248
247
  const validateForm = () => {
249
- var _a2;
250
- (_a2 = formRef.current) == null ? void 0 : _a2.validate(void 0, false).then(() => {
248
+ var _a;
249
+ (_a = formRef.current) == null ? void 0 : _a.validate(void 0, false).then(() => {
251
250
  setValidated(true);
252
251
  }).catch(() => {
253
252
  setValidated(false);
@@ -257,12 +256,12 @@ const NinePay = w((props, ref) => {
257
256
  validateForm();
258
257
  }, [form]);
259
258
  const onSubmit = async () => {
260
- var _a2;
259
+ var _a;
261
260
  setErrorMsg("");
262
- (_a2 = formRef.current) == null ? void 0 : _a2.validate(async (errors) => {
263
- var _a3;
261
+ (_a = formRef.current) == null ? void 0 : _a.validate(async (errors) => {
262
+ var _a2;
264
263
  (fieldStatus == null ? void 0 : fieldStatus.address.show) && addressCore.setValidateAllFields(true);
265
- (_a3 = props.onSubmit) == null ? void 0 : _a3.call(props, errors);
264
+ (_a2 = props.onSubmit) == null ? void 0 : _a2.call(props, errors);
266
265
  if (errors) {
267
266
  setSubmitButtonStatus("unSubmit");
268
267
  return;
@@ -277,8 +276,8 @@ const NinePay = w((props, ref) => {
277
276
  dom && validateForm();
278
277
  };
279
278
  const Button = () => {
280
- var _a2;
281
- const transAmount = (_a2 = session == null ? void 0 : session.checkout) == null ? void 0 : _a2.transAmount;
279
+ var _a;
280
+ const transAmount = (_a = session == null ? void 0 : session.checkout) == null ? void 0 : _a.transAmount;
282
281
  const amountText = (transAmount == null ? void 0 : transAmount.amount) ? formatAmount(transAmount).jointSymbol() : "";
283
282
  const text = i18n.get("common.pay") + (amountText ? ` ${amountText}` : "");
284
283
  return /* @__PURE__ */ u(
@@ -304,24 +303,17 @@ const NinePay = w((props, ref) => {
304
303
  }
305
304
  ) }) });
306
305
  };
307
- const formStyle = {
308
- [cssVarPrefix("button-bg-color")]: (_a = session == null ? void 0 : session.colors) == null ? void 0 : _a.primary,
309
- [cssVarPrefix("button-bg-color-hover")]: (_b = session == null ? void 0 : session.colors) == null ? void 0 : _b.primaryHover,
310
- [cssVarPrefix("button-bg-color-active")]: (_c = session == null ? void 0 : session.colors) == null ? void 0 : _c.primaryActive,
311
- [cssVarPrefix("button-text-color")]: (_e = (_d = session == null ? void 0 : session.checkout) == null ? void 0 : _d.theme) == null ? void 0 : _e.payButtonTextColor,
312
- [cssVarPrefix("input-color")]: (_f = session == null ? void 0 : session.colors) == null ? void 0 : _f.primary
313
- };
314
306
  const ErrorMessage = () => {
315
- return /* @__PURE__ */ u(b, { children: !!errorMsg && /* @__PURE__ */ u(Info, { content: errorMsg, style: { marginTop: "12px" } }) });
307
+ return /* @__PURE__ */ u(b, { children: !!errorMsg && /* @__PURE__ */ u(Info, { content: errorMsg }) });
316
308
  };
317
309
  const Address = () => {
318
- var _a2, _b2;
310
+ var _a, _b;
319
311
  return /* @__PURE__ */ u(b, { children: (fieldStatus == null ? void 0 : fieldStatus.address.show) && /* @__PURE__ */ u("div", { className: fieldClassNames, children: /* @__PURE__ */ u(
320
312
  AddressField,
321
313
  {
322
314
  ref: addressFieldRef,
323
315
  value: form.address,
324
- country: ((_a2 = session == null ? void 0 : session.checkout) == null ? void 0 : _a2.country) || ((_b2 = session == null ? void 0 : session.checkout) == null ? void 0 : _b2.bill.country),
316
+ country: ((_a = session == null ? void 0 : session.checkout) == null ? void 0 : _a.country) || ((_b = session == null ? void 0 : session.checkout) == null ? void 0 : _b.bill.country),
325
317
  onAddressChange: (value) => setForm(Object.assign(form, { address: value }))
326
318
  }
327
319
  ) }) });
@@ -334,13 +326,15 @@ const NinePay = w((props, ref) => {
334
326
  session,
335
327
  core
336
328
  },
337
- children: isCheckoutEnabled && i18n.ready.value && /* @__PURE__ */ u(b, { children: [
329
+ children: isCheckoutEnabled && i18n.ready.value && /* @__PURE__ */ u("div", { className: core.theme.className, children: [
338
330
  showGuideCard && /* @__PURE__ */ u(GuideCard, { type: PaymentCategory.NINE_PAY }),
339
- /* @__PURE__ */ u(Form, { form, ref: setFormRef, onFormChange: (form2) => setForm(form2), children: /* @__PURE__ */ u("div", { className: normalizedClass(COMMON_CLASS_NAME, bem()), style: formStyle, children: [
331
+ /* @__PURE__ */ u(Form, { form, ref: setFormRef, onFormChange: (form2) => setForm(form2), children: /* @__PURE__ */ u("div", { className: normalizedClass(COMMON_CLASS_NAME, bem()), children: [
340
332
  Email(),
341
333
  Address(),
342
- ErrorMessage(),
343
- !hidePaymentButton && Button()
334
+ /* @__PURE__ */ u("div", { className: bem("footer-wrapper"), children: [
335
+ ErrorMessage(),
336
+ !hidePaymentButton && Button()
337
+ ] })
344
338
  ] }) })
345
339
  ] })
346
340
  }