@paykka/card-checkout-ui 0.11.6 → 0.13.2

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 (217) hide show
  1. package/dist/card-checkout-ui.js +19 -19
  2. package/dist/card-checkout-ui.umd.cjs +19 -19
  3. package/dist/es/_commonjsHelpers.js +82 -1
  4. package/dist/es/api/index.js +1 -0
  5. package/dist/es/api/modules/address/index.js +9 -9
  6. package/dist/es/api/modules/ali-pay/index.js +10 -49
  7. package/dist/es/api/modules/apple-pay/index.js +13 -59
  8. package/dist/es/api/modules/boost/index.js +8 -48
  9. package/dist/es/api/modules/card/index.js +10 -54
  10. package/dist/es/api/modules/checkout/index.js +11 -9
  11. package/dist/es/api/modules/checkout/map.js +25 -18
  12. package/dist/es/api/modules/encrypted-card/index.js +3 -2
  13. package/dist/es/api/modules/gcash/index.js +8 -48
  14. package/dist/es/api/modules/get-browser-params.js +4 -1
  15. package/dist/es/api/modules/google-pay/index.js +10 -56
  16. package/dist/es/api/modules/grab-pay/index.js +8 -48
  17. package/dist/es/api/modules/index.js +1 -0
  18. package/dist/es/api/modules/line-pay/index.js +8 -48
  19. package/dist/es/api/modules/map.js +17 -11
  20. package/dist/es/api/modules/may-bank-qr-pay/index.js +8 -48
  21. package/dist/es/api/modules/nine-pay/index.js +8 -48
  22. package/dist/es/api/modules/paymaya/index.js +8 -48
  23. package/dist/es/api/modules/risk/index.js +2 -1
  24. package/dist/es/api/modules/sepa/index.js +10 -51
  25. package/dist/es/api/modules/shopee-pay/index.js +8 -48
  26. package/dist/es/api/modules/threeDS/index.js +3 -0
  27. package/dist/es/api/modules/tng-wallet/index.js +8 -48
  28. package/dist/es/api/modules/wechat-pay/index.js +10 -51
  29. package/dist/es/api/modules/zalopay/index.js +16 -0
  30. package/dist/es/api/utils/index.js +59 -0
  31. package/dist/es/components/AddressField/index.js +37 -37
  32. package/dist/es/components/AliPay/index.js +158 -111
  33. package/dist/es/components/ApplePay/index.js +99 -67
  34. package/dist/es/components/Boost/index.js +91 -70
  35. package/dist/es/components/Card/index.js +114 -107
  36. package/dist/es/components/CardSelector/index.js +1 -1
  37. package/dist/es/components/DropIn/index.js +12 -4
  38. package/dist/es/components/EncryptedCard/index.js +6 -2
  39. package/dist/es/components/GooglePay/index.js +94 -60
  40. package/dist/es/components/GrabPay/index.js +91 -70
  41. package/dist/es/components/GuideCard/index.js +10 -7
  42. package/dist/es/components/LinePay/index.js +91 -70
  43. package/dist/es/components/MayBankQRPay/index.js +302 -275
  44. package/dist/es/components/NinePay/index.js +91 -70
  45. package/dist/es/components/SecuredFieldsProvider/index.js +26 -9
  46. package/dist/es/components/SecuredIframe/index.js +40 -61
  47. package/dist/es/components/Sepa/index.js +72 -53
  48. package/dist/es/components/ShopeePay/index.js +91 -70
  49. package/dist/es/components/SubmitButton/index.js +8 -7
  50. package/dist/es/components/TNGWallet/index.js +91 -70
  51. package/dist/es/components/ThreeDS/index.js +32 -7
  52. package/dist/es/components/WechatPay/index.js +151 -102
  53. package/dist/es/components/business/QRCodeModal/QRCodeModal.js +26 -6
  54. package/dist/es/components/index.js +1 -0
  55. package/dist/es/components/internal/Form/FormItem.js +1 -1
  56. package/dist/es/components/internal/Form/util.js +1 -1
  57. package/dist/es/components/internal/Modal/Modal.js +1 -1
  58. package/dist/es/components/internal/Select/Select.js +19 -8
  59. package/dist/es/components/internal/Select/SelectMenu.js +2 -2
  60. package/dist/es/components/internal/Select/SelectMenuItem.js +12 -4
  61. package/dist/es/components/internal/icons/IconError.js +7 -4
  62. package/dist/es/components/internal/icons/IconZalopay.js +47 -0
  63. package/dist/es/components/internal/icons/IconZalopayComplete.js +48 -0
  64. package/dist/es/components/wallets/GCash/GCash.js +80 -56
  65. package/dist/es/components/wallets/Paymaya/Paymaya.js +91 -70
  66. package/dist/es/components/wallets/Zalopay/Zalopay.js +381 -0
  67. package/dist/es/components/wallets/Zalopay/index.js +1 -0
  68. package/dist/es/components/wallets/Zalopay/type.js +1 -0
  69. package/dist/es/components/wallets/Zalopay/zalopay2.js +1 -0
  70. package/dist/es/config.js +5 -5
  71. package/dist/es/constant.js +8 -2
  72. package/dist/es/core/{Address.js → address.js} +8 -16
  73. package/dist/es/core/{PayKKaCheckout.js → checkout.js} +101 -27
  74. package/dist/es/core/create.js +1 -1
  75. package/dist/es/core/query.js +3 -2
  76. package/dist/es/core/{Session.js → session.js} +28 -32
  77. package/dist/es/core/theme.js +65 -0
  78. package/dist/es/core.js +0 -4
  79. package/dist/es/hooks/usePayment.js +14 -0
  80. package/dist/es/i18n/locales/de-DE.js +3 -1
  81. package/dist/es/i18n/locales/en-GB.js +3 -1
  82. package/dist/es/i18n/locales/es-ES.js +3 -1
  83. package/dist/es/i18n/locales/fr-FR.js +3 -1
  84. package/dist/es/i18n/locales/ja-JP.js +3 -1
  85. package/dist/es/i18n/locales/ko-KR.js +3 -1
  86. package/dist/es/i18n/locales/nl-NL.js +3 -1
  87. package/dist/es/i18n/locales/pt-PT.js +3 -1
  88. package/dist/es/i18n/locales/ru-RU.js +3 -1
  89. package/dist/es/i18n/locales/zh-CN.js +3 -1
  90. package/dist/es/i18n/locales/zh-HK.js +3 -1
  91. package/dist/es/i18n/locales/zh-TW.js +3 -1
  92. package/dist/es/index.js +21 -7
  93. package/dist/es/style.css +1 -1
  94. package/dist/es/types/index.js +7 -0
  95. package/dist/es/utils/colors.js +5 -1
  96. package/dist/es/utils/format.js +0 -5
  97. package/dist/es/utils/object.js +31 -1
  98. package/dist/es/utils/payment.js +82 -0
  99. package/dist/es/utils/redirect.js +4 -4
  100. package/dist/es/utils/string.js +10 -0
  101. package/dist/es/utils/system-info/is-ua-webview.js +14 -12
  102. package/dist/es/utils/theme.js +7 -0
  103. package/dist/style.css +1 -1
  104. package/dist/types/api/modules/address/index.d.ts +15 -6
  105. package/dist/types/api/modules/ali-pay/index.d.ts +3 -19
  106. package/dist/types/api/modules/apple-pay/index.d.ts +4 -14
  107. package/dist/types/api/modules/boost/index.d.ts +3 -23
  108. package/dist/types/api/modules/card/index.d.ts +3 -30
  109. package/dist/types/api/modules/checkout/index.d.ts +3 -3
  110. package/dist/types/api/modules/checkout/map.d.ts +3 -3
  111. package/dist/types/api/modules/checkout/type.d.ts +33 -4
  112. package/dist/types/api/modules/gcash/index.d.ts +3 -23
  113. package/dist/types/api/modules/get-browser-params.d.ts +1 -0
  114. package/dist/types/api/modules/google-pay/index.d.ts +3 -13
  115. package/dist/types/api/modules/grab-pay/index.d.ts +3 -23
  116. package/dist/types/api/modules/index.d.ts +1 -0
  117. package/dist/types/api/modules/line-pay/index.d.ts +3 -23
  118. package/dist/types/api/modules/map.d.ts +2 -2
  119. package/dist/types/api/modules/may-bank-qr-pay/index.d.ts +3 -23
  120. package/dist/types/api/modules/nine-pay/index.d.ts +3 -23
  121. package/dist/types/api/modules/paymaya/index.d.ts +3 -23
  122. package/dist/types/api/modules/sepa/index.d.ts +3 -24
  123. package/dist/types/api/modules/shopee-pay/index.d.ts +3 -23
  124. package/dist/types/api/modules/tng-wallet/index.d.ts +3 -23
  125. package/dist/types/api/modules/type.d.ts +74 -21
  126. package/dist/types/api/modules/wechat-pay/index.d.ts +3 -20
  127. package/dist/types/api/modules/zalopay/index.d.ts +4 -0
  128. package/dist/types/api/utils/index.d.ts +48 -0
  129. package/dist/types/components/AddressField/type.d.ts +3 -9
  130. package/dist/types/components/AliPay/AliPay.d.ts +6 -2
  131. package/dist/types/components/AliPay/type.d.ts +15 -2
  132. package/dist/types/components/ApplePay/ApplePay.d.ts +6 -2
  133. package/dist/types/components/ApplePay/type.d.ts +10 -14
  134. package/dist/types/components/ApplePay/utils.d.ts +1 -1
  135. package/dist/types/components/Boost/Boost.d.ts +6 -2
  136. package/dist/types/components/Boost/type.d.ts +2 -24
  137. package/dist/types/components/Card/Card.d.ts +6 -2
  138. package/dist/types/components/Card/type.d.ts +3 -43
  139. package/dist/types/components/DropIn/DropIn.d.ts +6 -2
  140. package/dist/types/components/DropIn/type.d.ts +4 -10
  141. package/dist/types/components/GooglePay/GooglePay.d.ts +6 -2
  142. package/dist/types/components/GooglePay/createGooglePay.d.ts +2 -1
  143. package/dist/types/components/GooglePay/type.d.ts +10 -26
  144. package/dist/types/components/GrabPay/GrabPay.d.ts +6 -2
  145. package/dist/types/components/GrabPay/type.d.ts +3 -25
  146. package/dist/types/components/LinePay/LinePay.d.ts +6 -2
  147. package/dist/types/components/LinePay/type.d.ts +3 -25
  148. package/dist/types/components/MayBankQRPay/MayBankQRPay.d.ts +6 -2
  149. package/dist/types/components/MayBankQRPay/type.d.ts +3 -25
  150. package/dist/types/components/NinePay/NinePay.d.ts +6 -2
  151. package/dist/types/components/NinePay/type.d.ts +3 -25
  152. package/dist/types/components/SecuredFieldsProvider/type.d.ts +5 -0
  153. package/dist/types/components/SecuredIframe/HiddenIframe.d.ts +3 -1
  154. package/dist/types/components/Sepa/Sepa.d.ts +6 -2
  155. package/dist/types/components/Sepa/type.d.ts +3 -2
  156. package/dist/types/components/ShopeePay/ShopeePay.d.ts +6 -2
  157. package/dist/types/components/ShopeePay/type.d.ts +3 -25
  158. package/dist/types/components/TNGWallet/TNGWallet.d.ts +6 -2
  159. package/dist/types/components/TNGWallet/type.d.ts +3 -25
  160. package/dist/types/components/ThreeDS/components/ThreeDSAuth/type.d.ts +2 -0
  161. package/dist/types/components/WechatPay/WechatPay.d.ts +6 -2
  162. package/dist/types/components/WechatPay/type.d.ts +15 -2
  163. package/dist/types/components/business/QRCodeModal/type.d.ts +2 -0
  164. package/dist/types/components/index.d.ts +1 -0
  165. package/dist/types/components/internal/Loading/Loading.d.ts +1 -0
  166. package/dist/types/components/internal/Select/SelectMenu.d.ts +1 -1
  167. package/dist/types/components/internal/icons/IconZalopay.d.ts +2 -0
  168. package/dist/types/components/internal/icons/IconZalopayComplete.d.ts +2 -0
  169. package/dist/types/components/internal/icons/index.d.ts +3 -0
  170. package/dist/types/components/wallets/GCash/GCash.d.ts +6 -2
  171. package/dist/types/components/wallets/GCash/type.d.ts +3 -35
  172. package/dist/types/components/wallets/Paymaya/Paymaya.d.ts +6 -2
  173. package/dist/types/components/wallets/Paymaya/type.d.ts +3 -25
  174. package/dist/types/components/wallets/Zalopay/Zalopay.d.ts +10 -0
  175. package/dist/types/components/wallets/Zalopay/index.d.ts +2 -0
  176. package/dist/types/components/wallets/Zalopay/type.d.ts +39 -0
  177. package/dist/types/config.d.ts +2 -4
  178. package/dist/types/constant.d.ts +3 -1
  179. package/dist/types/core/{Address.d.ts → address.d.ts} +23 -24
  180. package/dist/types/core/{PayKKaCheckout.d.ts → checkout.d.ts} +9 -3
  181. package/dist/types/core/context.d.ts +3 -2
  182. package/dist/types/core/index.d.ts +3 -2
  183. package/dist/types/core/query.d.ts +2 -2
  184. package/dist/types/core/session.d.ts +23 -0
  185. package/dist/types/core/theme.d.ts +7 -0
  186. package/dist/types/hooks/index.d.ts +1 -0
  187. package/dist/types/hooks/usePayment.d.ts +8 -0
  188. package/dist/types/i18n/locales/de-DE.d.ts +2 -0
  189. package/dist/types/i18n/locales/en-GB.d.ts +2 -0
  190. package/dist/types/i18n/locales/es-ES.d.ts +2 -0
  191. package/dist/types/i18n/locales/fr-FR.d.ts +2 -0
  192. package/dist/types/i18n/locales/ja-JP.d.ts +2 -0
  193. package/dist/types/i18n/locales/ko-KR.d.ts +2 -0
  194. package/dist/types/i18n/locales/nl-NL.d.ts +2 -0
  195. package/dist/types/i18n/locales/pt-PT.d.ts +2 -0
  196. package/dist/types/i18n/locales/ru-RU.d.ts +2 -0
  197. package/dist/types/i18n/locales/zh-CN.d.ts +2 -0
  198. package/dist/types/i18n/locales/zh-HK.d.ts +2 -0
  199. package/dist/types/i18n/locales/zh-TW.d.ts +2 -0
  200. package/dist/types/index.d.ts +2 -1
  201. package/dist/types/types/index.d.ts +70 -32
  202. package/dist/types/types/message.d.ts +30 -25
  203. package/dist/types/utils/card-brand/index.d.ts +3 -3
  204. package/dist/types/utils/colors.d.ts +1 -0
  205. package/dist/types/utils/index.d.ts +4 -2
  206. package/dist/types/utils/object.d.ts +7 -0
  207. package/dist/types/utils/payment.d.ts +37 -0
  208. package/dist/types/utils/string.d.ts +1 -0
  209. package/dist/types/utils/style.d.ts +1 -1
  210. package/dist/types/utils/system-info/is-ua-webview.d.ts +1 -1
  211. package/dist/types/utils/theme.d.ts +4 -0
  212. package/package.json +3 -3
  213. package/dist/es/utils/deep-freeze.js +0 -13
  214. package/dist/es/utils/obj.js +0 -22
  215. package/dist/types/core/Session.d.ts +0 -16
  216. package/dist/types/utils/deep-freeze.d.ts +0 -1
  217. package/dist/types/utils/obj.d.ts +0 -6
@@ -1,15 +1,14 @@
1
1
  import { w, A, h, F, y, q, T, u, b } from "../../core.js";
2
2
  import { isTimeoutError } from "../../api/http.js";
3
- import { PaymentType, SessionMode, CardPaymentMethods, COMMON_CLASS_NAME, PaymentMethod } from "../../constant.js";
4
3
  import { intersection } from "../../utils/index.js";
5
- import { getBrowserParams } from "../../api/modules/get-browser-params.js";
4
+ import { defaultInputStyleConfig } from "../../types/index.js";
6
5
  import { getCardPayInfo, cardPay } from "../../api/modules/card/index.js";
6
+ import { getBrowserParams } from "../../api/modules/get-browser-params.js";
7
+ import { PaymentType, SessionMode, CardPaymentMethods, PaymentMethod, COMMON_CLASS_NAME } from "../../constant.js";
7
8
  import { CoreContext } from "../../core/context.js";
8
9
  import { PayKKaError } from "../../core/error.js";
9
- import { hidePaymentButton } from "../../config.js";
10
- import { defaultInputStyleConfig } from "../../types/index.js";
11
10
  import { WorldpayDDC } from "../../out/worldpay-ddc.js";
12
- import { createAddressCore } from "../../core/Address.js";
11
+ import { createPromise } from "../../utils/create-promise.js";
13
12
  import { useBEM } from "../../hooks/useBEM.js";
14
13
  import { usePayState } from "../../hooks/usePayState.js";
15
14
  import { useRetry } from "../../hooks/useRetry.js";
@@ -36,12 +35,12 @@ import { CombinedCardInfo } from "../CombinedCardInfo/index.js";
36
35
  import { cardBrandCodes } from "../../utils/card-brand/brands.js";
37
36
  import { findCardBrand } from "../../utils/card-brand/index.js";
38
37
  import { separateInputStyle } from "../../utils/style.js";
39
- import { createPromise } from "../../utils/create-promise.js";
40
- import { cssVarPrefix, normalizedClass, trimAll, formatAmount } from "../../utils/format.js";
38
+ import { formatPaymentResult } from "../../utils/payment.js";
39
+ import { normalizedClass, trimAll, formatAmount } from "../../utils/format.js";
41
40
  const { bem } = useBEM("card");
42
41
  const fieldClassNames = bem("field");
43
42
  const Card = w((props, ref) => {
44
- var _a, _b, _c, _d, _e, _f, _g, _h;
43
+ var _a, _b;
45
44
  const {
46
45
  showCardBrands = true,
47
46
  session,
@@ -53,9 +52,10 @@ const Card = w((props, ref) => {
53
52
  styles,
54
53
  enable3DSModal = true,
55
54
  isDropIn,
56
- core
55
+ core,
56
+ hidePaymentButton = false
57
57
  } = props;
58
- const addressState = createAddressCore();
58
+ const addressCore = core.getAddressCore();
59
59
  const emailState = createEmailCore();
60
60
  const { i18n, fraudDetection, sessionReady } = usePayState(session, core);
61
61
  const addressFieldRef = A(null);
@@ -70,13 +70,13 @@ const Card = w((props, ref) => {
70
70
  holderName: "",
71
71
  cardInfo: "",
72
72
  address: {
73
- country: "",
74
- province: "",
75
- city: "",
76
- area: "",
77
- postCode: "",
78
- address1: "",
79
- address2: ""
73
+ country: void 0,
74
+ province: void 0,
75
+ city: void 0,
76
+ area: void 0,
77
+ postCode: void 0,
78
+ address1: void 0,
79
+ address2: void 0
80
80
  }
81
81
  });
82
82
  const [validated, setValidated] = h(false);
@@ -99,15 +99,17 @@ const Card = w((props, ref) => {
99
99
  var _a2;
100
100
  if (!(fieldStatus == null ? void 0 : fieldStatus.address.show))
101
101
  return;
102
- setForm(Object.assign(form, { address: addressState.getAddressState() }));
103
- (_a2 = addressFieldRef.current) == null ? void 0 : _a2.update(addressState.getAddressState());
102
+ const newForm = Object.assign(form, { address: addressCore.getAddressState() });
103
+ setForm(newForm);
104
+ (_a2 = addressFieldRef.current) == null ? void 0 : _a2.update(addressCore.getAddressState());
105
+ validateForm();
104
106
  },
105
107
  updateEmail: () => {
106
108
  var _a2;
107
109
  if (!(fieldStatus == null ? void 0 : fieldStatus.email.show))
108
110
  return;
109
- setForm(Object.assign(form, { email: emailState.email }));
110
- form.email = emailState.email;
111
+ const newForm = Object.assign(form, { email: emailState.email });
112
+ setForm(newForm);
111
113
  (_a2 = emailFieldRef.current) == null ? void 0 : _a2.update(emailState.email);
112
114
  validateForm();
113
115
  },
@@ -115,12 +117,6 @@ const Card = w((props, ref) => {
115
117
  hidePaymentButton && onSubmit();
116
118
  }
117
119
  }));
118
- const getPaymentSuccessData = () => {
119
- var _a2;
120
- return {
121
- returnUrl: (_a2 = session == null ? void 0 : session.checkout) == null ? void 0 : _a2.returnUrl
122
- };
123
- };
124
120
  const initFieldStatus = () => {
125
121
  const { field, sessionMode } = session.checkout;
126
122
  const { email, address, holderName } = field;
@@ -150,7 +146,7 @@ const Card = w((props, ref) => {
150
146
  if (!sessionReady) {
151
147
  return;
152
148
  }
153
- const { status, paymentMethod = [], bill = {}, sessionMode } = (session == null ? void 0 : session.checkout) || {};
149
+ const { status, supportMethods = [], bill = {}, sessionMode, country } = (session == null ? void 0 : session.checkout) || {};
154
150
  if (sessionMode === SessionMode.DROP_IN && !isDropIn) {
155
151
  (_b2 = (_a2 = props.core.config).onInitError) == null ? void 0 : _b2.call(
156
152
  _a2,
@@ -158,18 +154,19 @@ const Card = w((props, ref) => {
158
154
  );
159
155
  return;
160
156
  }
161
- if (!intersection(paymentMethod, CardPaymentMethods).length) {
157
+ if (!intersection(supportMethods, CardPaymentMethods).length) {
162
158
  return;
163
159
  }
164
160
  initFieldStatus();
165
161
  initElementStyles();
166
162
  setSecurity(sessionMode !== SessionMode.HOSTED);
163
+ country && addressCore.setCountry(country);
167
164
  form.email = bill.email ?? "";
168
- setSupportedCardBrands(intersection(cardBrandCodes, paymentMethod || []));
165
+ form.address.country = country;
166
+ setSupportedCardBrands(intersection(cardBrandCodes, supportMethods || []));
169
167
  setIsCheckoutEnabled(true);
170
168
  if (status === "SUCCESS") {
171
- setSubmitButtonStatus("success");
172
- processOnSuccess();
169
+ processOnSuccess(session == null ? void 0 : session.checkout);
173
170
  }
174
171
  }, [sessionReady]);
175
172
  const onTimeout = q(
@@ -182,9 +179,13 @@ const Card = w((props, ref) => {
182
179
  },
183
180
  [i18n, props.onTimeout]
184
181
  );
185
- const processOnSuccess = () => {
186
- var _a2;
187
- (_a2 = props.onSuccess) == null ? void 0 : _a2.call(props, getPaymentSuccessData());
182
+ const processOnSuccess = (res) => {
183
+ var _a2, _b2;
184
+ setSubmitButtonStatus("success");
185
+ (_b2 = props.onSuccess) == null ? void 0 : _b2.call(props, formatPaymentResult({
186
+ ...res,
187
+ returnUrl: (_a2 = session == null ? void 0 : session.checkout) == null ? void 0 : _a2.returnUrl
188
+ }));
188
189
  };
189
190
  const processOnError = (error) => {
190
191
  var _a2;
@@ -231,7 +232,7 @@ const Card = w((props, ref) => {
231
232
  }
232
233
  (_a2 = formRef.current) == null ? void 0 : _a2.validate(async (errors) => {
233
234
  var _a3;
234
- (fieldStatus == null ? void 0 : fieldStatus.address.show) && addressState.setValidateAllFields(true);
235
+ (fieldStatus == null ? void 0 : fieldStatus.address.show) && addressCore.setValidateAllFields(true);
235
236
  (_a3 = props.onSubmit) == null ? void 0 : _a3.call(props, errors);
236
237
  if (errors) {
237
238
  setSubmitButtonStatus("unSubmit");
@@ -243,7 +244,7 @@ const Card = w((props, ref) => {
243
244
  });
244
245
  }
245
246
  const getPaymentParams = async () => {
246
- var _a2, _b2, _c2;
247
+ var _a2, _b2, _c;
247
248
  const cardNo = trimAll(form.number);
248
249
  const cardBrand = findCardBrand(cardNo);
249
250
  const [expMonth, expYear] = form.expireDate.split("/");
@@ -261,7 +262,7 @@ const Card = w((props, ref) => {
261
262
  }
262
263
  let cardBin;
263
264
  if (security) {
264
- cardBin = splitCardInfo ? (_b2 = cardNumberFieldRef.current) == null ? void 0 : _b2.binValue() : (_c2 = combinedCardInfoRef.current) == null ? void 0 : _c2.binValue();
265
+ cardBin = splitCardInfo ? (_b2 = cardNumberFieldRef.current) == null ? void 0 : _b2.binValue() : (_c = combinedCardInfoRef.current) == null ? void 0 : _c.binValue();
265
266
  }
266
267
  return {
267
268
  sessionId: session.sessionId,
@@ -281,9 +282,13 @@ const Card = w((props, ref) => {
281
282
  },
282
283
  bill: (fieldStatus == null ? void 0 : fieldStatus.address.show) ? {
283
284
  email: form.email,
284
- ...form.address,
285
- province: addressState.getLabel(form.address.province, addressState.getProvinceOption()) ?? form.address.province,
286
- city: addressState.getLabel(form.address.city, addressState.getCityOptions()) ?? form.address.city
285
+ addressLine1: form.address.address1,
286
+ addressLine2: form.address.address2,
287
+ postalCode: form.address.postCode,
288
+ country: form.address.country,
289
+ district: form.address.area,
290
+ state: form.address.province ? addressCore.getLabel(form.address.province, addressCore.getProvinceOption()) ?? form.address.province : void 0,
291
+ city: form.address.city ? addressCore.getLabel(form.address.city, addressCore.getCityOptions()) ?? form.address.city : void 0
287
292
  } : {
288
293
  email: form.email
289
294
  },
@@ -295,27 +300,29 @@ const Card = w((props, ref) => {
295
300
  };
296
301
  };
297
302
  async function pay(search = false, timeout) {
298
- var _a2, _b2, _c2, _d2;
303
+ var _a2, _b2, _c, _d, _e, _f;
299
304
  try {
300
- const paymentParams = await getPaymentParams();
301
- const extraParams = (_b2 = (_a2 = core.config)._getExtraParams) == null ? void 0 : _b2.call(
302
- _a2,
303
- "payment",
304
- paymentParams.payment.paymentMethod
305
- );
306
- if (!search && security) {
307
- (_c2 = SFPRef.current) == null ? void 0 : _c2.payment(paymentParams, extraParams);
308
- return { end: true };
309
- }
310
- const options = { locale: i18n.locale, timeout };
311
- let res = {};
305
+ const requestOptions = { locale: i18n.locale, timeout };
306
+ let res = null;
312
307
  if (search) {
308
+ const extraParams = (_b2 = (_a2 = core.config)._getExtraParams) == null ? void 0 : _b2.call(_a2, "query", PaymentMethod.BANKCARD);
313
309
  res = await getCardPayInfo(
314
- { sessionId: session.sessionId, clientKey: session.clientKey },
315
- options
310
+ {
311
+ sessionId: session.sessionId,
312
+ clientKey: session.clientKey
313
+ },
314
+ extraParams,
315
+ requestOptions
316
316
  );
317
317
  } else {
318
- res = await cardPay(paymentParams, extraParams, options);
318
+ const paymentParams = await getPaymentParams();
319
+ const extraParams = (_d = (_c = core.config)._getExtraParams) == null ? void 0 : _d.call(_c, "payment", PaymentMethod.BANKCARD);
320
+ if (security) {
321
+ (_e = SFPRef.current) == null ? void 0 : _e.payment(paymentParams, extraParams);
322
+ return { end: true };
323
+ } else {
324
+ res = await cardPay(paymentParams, extraParams, requestOptions);
325
+ }
319
326
  }
320
327
  return processAfterPayment(res, search);
321
328
  } catch (error) {
@@ -329,7 +336,7 @@ const Card = w((props, ref) => {
329
336
  } else {
330
337
  const message = error.i18nKey ? i18n.get(error.i18nKey) : error.message;
331
338
  setErrorMsg(message);
332
- (_d2 = props.onError) == null ? void 0 : _d2.call(props, new PayKKaError("API_ERROR", message, { code: error.code, cause: error }));
339
+ (_f = props.onError) == null ? void 0 : _f.call(props, new PayKKaError("API_ERROR", message, { code: error.code, cause: error }));
333
340
  setSubmitButtonStatus("unSubmit");
334
341
  stopReFetchCardPay3DSInfo();
335
342
  return { end: true };
@@ -359,32 +366,32 @@ const Card = w((props, ref) => {
359
366
  };
360
367
  const processAfterPayment = (res, search = false) => {
361
368
  var _a2, _b2;
362
- const { status, orderStatus, errorMessage, errorCode, threeDSUrl } = res;
369
+ const { status, orderStatus, errorMessage, errorCode, payInfo = {}, sessionId } = res;
370
+ const { threeDSUrl } = payInfo;
371
+ sessionId && (session.sessionId = sessionId);
363
372
  if (status === "PROCESSING") {
364
373
  if (!orderStatus) {
365
374
  setSubmitButtonStatus("unSubmit");
366
375
  } else if (orderStatus === "SUCCESS") {
367
- setSubmitButtonStatus("success");
368
- processOnSuccess();
376
+ processOnSuccess(res);
369
377
  } else if (orderStatus === "PROCESSING") {
370
378
  !search && startReFetchPayInfo();
371
379
  return { end: false };
372
380
  } else if (orderStatus === "FAILURE") {
373
- setErrorMsg(errorMessage);
381
+ errorMessage && setErrorMsg(errorMessage);
374
382
  setSubmitButtonStatus("unSubmit");
375
383
  processOnError(new PayKKaError("API_ERROR", errorMessage, { code: errorCode }));
376
384
  } else if (orderStatus === "AUTHORIZED") {
377
385
  setSubmitButtonStatus("unSubmit");
378
386
  (_a2 = props.onAuthorized) == null ? void 0 : _a2.call(props);
379
387
  } else if (orderStatus === "IN_THREED") {
380
- processThreeDS(threeDSUrl, false);
388
+ threeDSUrl && processThreeDS(threeDSUrl, false);
381
389
  } else if (orderStatus === "IN_PREVIOUS_THREED") {
382
- processThreeDS(threeDSUrl, true);
390
+ threeDSUrl && processThreeDS(threeDSUrl, true);
383
391
  }
384
392
  return { end: true };
385
393
  } else if (status === "SUCCESS") {
386
- setSubmitButtonStatus("success");
387
- processOnSuccess();
394
+ processOnSuccess(res);
388
395
  return { end: true };
389
396
  } else if (status === "EXPIRED") {
390
397
  setSubmitButtonStatus("unSubmit");
@@ -429,13 +436,6 @@ const Card = w((props, ref) => {
429
436
  }
430
437
  );
431
438
  };
432
- const formStyle = {
433
- [cssVarPrefix("button-bg-color")]: (_a = session == null ? void 0 : session.colors) == null ? void 0 : _a.primary,
434
- [cssVarPrefix("button-bg-color-hover")]: (_b = session == null ? void 0 : session.colors) == null ? void 0 : _b.primaryHover,
435
- [cssVarPrefix("button-bg-color-active")]: (_c = session == null ? void 0 : session.colors) == null ? void 0 : _c.primaryActive,
436
- [cssVarPrefix("button-text-color")]: (_e = (_d = session == null ? void 0 : session.checkout) == null ? void 0 : _d.theme) == null ? void 0 : _e.payButtonTextColor,
437
- [cssVarPrefix("input-color")]: (_f = session == null ? void 0 : session.colors) == null ? void 0 : _f.primary
438
- };
439
439
  const { start: startReFetchCardPay3DSInfo, stop: stopReFetchCardPay3DSInfo } = useRetry(
440
440
  (timeout) => checkThreeDS(true, timeout),
441
441
  {
@@ -444,15 +444,17 @@ const Card = w((props, ref) => {
444
444
  }
445
445
  );
446
446
  async function checkThreeDS(search = false, timeout = 2e4) {
447
- var _a2, _b2, _c2;
447
+ var _a2, _b2, _c, _d, _e;
448
448
  if (!session)
449
449
  return { end: true };
450
450
  try {
451
+ const extraParams = (_b2 = (_a2 = core.config)._getExtraParams) == null ? void 0 : _b2.call(_a2, "query", PaymentMethod.BANKCARD);
451
452
  const res = await getCardPayInfo(
452
453
  {
453
454
  sessionId: session.sessionId,
454
455
  clientKey: session.clientKey
455
456
  },
457
+ extraParams,
456
458
  {
457
459
  locale: i18n.locale,
458
460
  timeout
@@ -463,12 +465,12 @@ const Card = w((props, ref) => {
463
465
  if (orderStatus === "PROCESSING") {
464
466
  startReFetchPayInfo();
465
467
  } else if (orderStatus === "FAILURE") {
466
- setErrorMsg(errorMessage);
468
+ errorMessage && setErrorMsg(errorMessage);
467
469
  setSubmitButtonStatus("unSubmit");
468
470
  processOnError(new PayKKaError("API_ERROR", errorMessage, { code: errorCode }));
469
471
  } else if (orderStatus === "AUTHORIZED") {
470
472
  setSubmitButtonStatus("unSubmit");
471
- (_a2 = props.onAuthorized) == null ? void 0 : _a2.call(props);
473
+ (_c = props.onAuthorized) == null ? void 0 : _c.call(props);
472
474
  } else if (orderStatus === "IN_THREED") {
473
475
  setSubmitButtonStatus("loading");
474
476
  !search && startReFetchCardPay3DSInfo();
@@ -482,17 +484,15 @@ const Card = w((props, ref) => {
482
484
  stopReFetchCardPay3DSInfo();
483
485
  return { end: true };
484
486
  } else if (status === "SUCCESS") {
485
- setSubmitButtonStatus("success");
486
- processOnSuccess();
487
+ processOnSuccess(res);
487
488
  stopReFetchCardPay3DSInfo();
488
489
  return { end: true };
489
490
  } else if (status === "EXPIRED") {
490
491
  setSubmitButtonStatus("unSubmit");
491
- (_b2 = props.onExpired) == null ? void 0 : _b2.call(props);
492
+ (_d = props.onExpired) == null ? void 0 : _d.call(props);
492
493
  stopReFetchCardPay3DSInfo();
493
494
  return { end: true };
494
495
  }
495
- processOnSuccess();
496
496
  setSubmitButtonStatus("unSubmit");
497
497
  stopReFetchCardPay3DSInfo();
498
498
  return { end: true };
@@ -507,7 +507,7 @@ const Card = w((props, ref) => {
507
507
  } else {
508
508
  const message = error.i18nKey ? i18n.get(error.i18nKey) : error.message;
509
509
  setErrorMsg(message);
510
- (_c2 = props.onError) == null ? void 0 : _c2.call(props, new PayKKaError("API_ERROR", message, { code: error.code, cause: error }));
510
+ (_e = props.onError) == null ? void 0 : _e.call(props, new PayKKaError("API_ERROR", message, { code: error.code, cause: error }));
511
511
  setSubmitButtonStatus("unSubmit");
512
512
  stopReFetchCardPay3DSInfo();
513
513
  return { end: true };
@@ -529,7 +529,7 @@ const Card = w((props, ref) => {
529
529
  }
530
530
  return (session == null ? void 0 : session.checkout.paymentType) === PaymentType.PURCHASE && (session == null ? void 0 : session.checkout.storePaymentMethod);
531
531
  }, [session == null ? void 0 : session.checkout]);
532
- const storeCheckBox = () => {
532
+ const StoreCheckBox = () => {
533
533
  const onCheck = (checked) => {
534
534
  setStorePaymentMethod(checked);
535
535
  };
@@ -543,9 +543,9 @@ const Card = w((props, ref) => {
543
543
  ) });
544
544
  };
545
545
  const changeBox = () => {
546
- var _a2, _b2, _c2;
546
+ var _a2, _b2, _c;
547
547
  const isPurchase = ((_a2 = session == null ? void 0 : session.checkout) == null ? void 0 : _a2.paymentType) === PaymentType.PURCHASE;
548
- const hasCardTokens = !!((_c2 = (_b2 = session == null ? void 0 : session.checkout) == null ? void 0 : _b2.tokens) == null ? void 0 : _c2.length);
548
+ const hasCardTokens = !!((_c = (_b2 = session == null ? void 0 : session.checkout) == null ? void 0 : _b2.tokens) == null ? void 0 : _c.length);
549
549
  const onClick = () => {
550
550
  var _a3;
551
551
  (_a3 = formRef.current) == null ? void 0 : _a3.resetValidation();
@@ -609,7 +609,7 @@ const Card = w((props, ref) => {
609
609
  [EFieldType.CVV]: null
610
610
  });
611
611
  const onFieldValidStatusChanged = (data) => {
612
- var _a2, _b2, _c2, _d2;
612
+ var _a2, _b2, _c, _d;
613
613
  const fieldRef = splitCardInfo ? fieldRefMap[data.fieldType] : combinedCardInfoRef;
614
614
  const error = data.errorTip && i18n.get(data.errorTip);
615
615
  if (!splitCardInfo) {
@@ -630,10 +630,10 @@ const Card = w((props, ref) => {
630
630
  if (isSuccess) {
631
631
  (_b2 = fieldRef.current) == null ? void 0 : _b2.resetValidation("success");
632
632
  } else {
633
- (_c2 = fieldRef.current) == null ? void 0 : _c2.resetValidation("unValidate");
633
+ (_c = fieldRef.current) == null ? void 0 : _c.resetValidation("unValidate");
634
634
  }
635
635
  } else {
636
- (_d2 = fieldRef.current) == null ? void 0 : _d2.resetValidation(data.status, error);
636
+ (_d = fieldRef.current) == null ? void 0 : _d.resetValidation(data.status, error);
637
637
  }
638
638
  setTimeout(() => {
639
639
  validateForm();
@@ -685,17 +685,17 @@ const Card = w((props, ref) => {
685
685
  ) }) });
686
686
  };
687
687
  const ErrorMessage = () => {
688
- return /* @__PURE__ */ u(b, { children: !!errorMsg && /* @__PURE__ */ u(Info, { content: errorMsg, style: { marginTop: "12px" } }) });
688
+ return /* @__PURE__ */ u(b, { children: !!errorMsg && /* @__PURE__ */ u(Info, { content: errorMsg }) });
689
689
  };
690
690
  const CardInfo = q(() => {
691
- var _a2, _b2, _c2, _d2;
691
+ var _a2, _b2, _c, _d;
692
692
  return splitCardInfo ? /* @__PURE__ */ u(b, { children: [
693
693
  /* @__PURE__ */ u("div", { className: fieldClassNames, children: [
694
694
  /* @__PURE__ */ u("div", { className: bem("card-number-wrapper"), children: [
695
695
  /* @__PURE__ */ u(
696
696
  CardNumberField,
697
697
  {
698
- supportedCardBrands: (_b2 = (_a2 = session == null ? void 0 : session.checkout) == null ? void 0 : _a2.paymentMethod) == null ? void 0 : _b2.filter(Boolean),
698
+ supportedCardBrands: (_b2 = (_a2 = session == null ? void 0 : session.checkout) == null ? void 0 : _a2.supportMethods) == null ? void 0 : _b2.filter(Boolean),
699
699
  security,
700
700
  ref: cardNumberFieldRef,
701
701
  onBinValue: onBinValueChanged
@@ -707,7 +707,7 @@ const Card = w((props, ref) => {
707
707
  CardBrands,
708
708
  {
709
709
  className: bem("card-brands"),
710
- supportedCardBrands: (_d2 = (_c2 = session == null ? void 0 : session.checkout) == null ? void 0 : _c2.paymentMethod) == null ? void 0 : _d2.filter(Boolean)
710
+ supportedCardBrands: (_d = (_c = session == null ? void 0 : session.checkout) == null ? void 0 : _c.supportMethods) == null ? void 0 : _d.filter(Boolean)
711
711
  }
712
712
  )
713
713
  ] }),
@@ -741,55 +741,61 @@ const Card = w((props, ref) => {
741
741
  }, [splitCardInfo, security]);
742
742
  const cardForm = () => {
743
743
  var _a2;
744
- return /* @__PURE__ */ u(Form, { form, ref: setFormRef, onFormChange: (form2) => setForm(form2), children: /* @__PURE__ */ u("div", { className: normalizedClass(COMMON_CLASS_NAME, bem()), style: formStyle, children: [
744
+ return /* @__PURE__ */ u(Form, { form, ref: setFormRef, onFormChange: (form2) => setForm(form2), children: /* @__PURE__ */ u("div", { className: normalizedClass(COMMON_CLASS_NAME, bem()), children: [
745
745
  Email(),
746
746
  CardInfo(),
747
747
  (fieldStatus == null ? void 0 : fieldStatus.holderName.show) && /* @__PURE__ */ u("div", { className: bem("holder-name"), children: /* @__PURE__ */ u(CardHolderNameField, { disabled: fieldStatus == null ? void 0 : fieldStatus.holderName.disabled }) }),
748
748
  Address(),
749
749
  ((_a2 = session == null ? void 0 : session.checkout) == null ? void 0 : _a2.paymentType) === PaymentType.RECURRING && RecurringTip(),
750
- isShowStoreCheckBox && storeCheckBox(),
751
- ErrorMessage(),
752
- !hidePaymentButton && Button()
750
+ /* @__PURE__ */ u("div", { className: bem("footer-wrapper"), children: [
751
+ isShowStoreCheckBox && StoreCheckBox(),
752
+ ErrorMessage(),
753
+ !hidePaymentButton && Button()
754
+ ] })
753
755
  ] }) });
754
756
  };
755
757
  const fastPaymentCardForm = () => {
756
- var _a2, _b2, _c2, _d2;
757
- return /* @__PURE__ */ u(Form, { form, ref: setFormRef, onFormChange: (form2) => setForm(form2), children: /* @__PURE__ */ u("div", { className: normalizedClass(COMMON_CLASS_NAME, bem()), style: formStyle, children: [
758
+ var _a2, _b2, _c, _d;
759
+ return /* @__PURE__ */ u(Form, { form, ref: setFormRef, onFormChange: (form2) => setForm(form2), children: /* @__PURE__ */ u("div", { className: normalizedClass(COMMON_CLASS_NAME, bem()), children: [
758
760
  Email(),
759
761
  /* @__PURE__ */ u("div", { className: bem("card-selector-wrapper"), children: [
760
762
  /* @__PURE__ */ u(
761
763
  CardSelector,
762
764
  {
763
- value: (_c2 = (_b2 = (_a2 = session == null ? void 0 : session.checkout) == null ? void 0 : _a2.tokens) == null ? void 0 : _b2[0]) == null ? void 0 : _c2.token,
764
- cardList: (_d2 = session == null ? void 0 : session.checkout) == null ? void 0 : _d2.tokens,
765
+ value: (_c = (_b2 = (_a2 = session == null ? void 0 : session.checkout) == null ? void 0 : _a2.tokens) == null ? void 0 : _b2[0]) == null ? void 0 : _c.token,
766
+ cardList: (_d = session == null ? void 0 : session.checkout) == null ? void 0 : _d.tokens,
765
767
  onClickEdit: onEditOtherCard,
766
768
  onClickChange: onClickChangeCard,
767
769
  onCardChange,
768
- style: { flex: 2, marginRight: "12px" }
770
+ className: bem("card-selector", fieldClassNames),
771
+ style: { flex: 2 }
769
772
  }
770
773
  ),
771
774
  /* @__PURE__ */ u(
772
775
  CardSecurityCodeField,
773
776
  {
774
- className: fieldClassNames,
775
- style: { flex: 1, marginLeft: "12px" },
777
+ className: bem("card-security-code", fieldClassNames),
778
+ style: { flex: 1 },
776
779
  security,
777
780
  ref: cardSecurityCodeFieldRef
778
781
  }
779
782
  )
780
783
  ] }),
781
784
  tokenAddressFilled && Address(),
782
- ErrorMessage(),
783
- !hidePaymentButton && Button()
785
+ /* @__PURE__ */ u("div", { className: bem("footer-wrapper"), children: [
786
+ ErrorMessage(),
787
+ !hidePaymentButton && Button()
788
+ ] })
784
789
  ] }) });
785
790
  };
786
- return /* @__PURE__ */ u(CoreContext.Provider, { value: { i18n }, children: isCheckoutEnabled && i18n.ready.value && /* @__PURE__ */ u(b, { children: [
791
+ return /* @__PURE__ */ u(CoreContext.Provider, { value: { i18n, core }, children: isCheckoutEnabled && i18n.ready.value && /* @__PURE__ */ u("div", { className: core.theme.className, children: [
787
792
  /* @__PURE__ */ u(
788
793
  SecuredFieldsProvider,
789
794
  {
790
795
  ref: SFPRef,
791
796
  i18n,
792
- sessionMode: (_g = session.checkout) == null ? void 0 : _g.sessionMode,
797
+ checkoutId: core.id,
798
+ sessionMode: (_a = session.checkout) == null ? void 0 : _a.sessionMode,
793
799
  supportedCardBrands,
794
800
  style: inputStyle || defaultInputStyleConfig,
795
801
  onFocus: onFieldsFocus,
@@ -807,8 +813,9 @@ const Card = w((props, ref) => {
807
813
  ThreeDSAuth,
808
814
  {
809
815
  show: showThreeDSModal,
810
- theme: (_h = session == null ? void 0 : session.checkout) == null ? void 0 : _h.theme,
816
+ theme: (_b = session == null ? void 0 : session.checkout) == null ? void 0 : _b.theme,
811
817
  onClose: handleCloseThreeDSModal,
818
+ checkoutId: core.id,
812
819
  ...threeDSInfo
813
820
  }
814
821
  )
@@ -1,9 +1,9 @@
1
1
  import { A, h, y, u } from "../../core.js";
2
2
  import { useBEM } from "../../hooks/useBEM.js";
3
3
  import { useI18n } from "../../hooks/useI18n.js";
4
- import "../../api/http.js";
5
4
  import { finCardBrandInfoByCode } from "../../utils/card-brand/index.js";
6
5
  import "../../utils/system-info/get-browser-info.js";
6
+ import "../../api/http.js";
7
7
  import "../internal/Form/type.js";
8
8
  import "../internal/Form/context.js";
9
9
  import { FormItem } from "../internal/Form/FormItem.js";
@@ -16,6 +16,7 @@ import { ShopeePay } from "../ShopeePay/index.js";
16
16
  import { GrabPay } from "../GrabPay/index.js";
17
17
  import { GCash } from "../wallets/GCash/GCash.js";
18
18
  import { Paymaya } from "../wallets/Paymaya/Paymaya.js";
19
+ import { Zalopay } from "../wallets/Zalopay/Zalopay.js";
19
20
  import { useBEM } from "../../hooks/useBEM.js";
20
21
  import { intersection } from "../../utils/index.js";
21
22
  import { PayKKaError } from "../../core/error.js";
@@ -32,6 +33,7 @@ import { IconTNGWallet } from "../internal/icons/IconTNGWallet.js";
32
33
  import { IconCard2 } from "../internal/icons/IconCard2.js";
33
34
  import { IconGCash } from "../internal/icons/IconGCash.js";
34
35
  import { IconPaymaya } from "../internal/icons/IconPaymaya.js";
36
+ import { IconZalopay } from "../internal/icons/IconZalopay.js";
35
37
  import { removeElementFromArray } from "../../utils/array.js";
36
38
  const dropInSupportedPaymentMethods = [
37
39
  ...CardPaymentMethods,
@@ -45,7 +47,8 @@ const dropInSupportedPaymentMethods = [
45
47
  PaymentMethod.TNG_WALLET,
46
48
  PaymentMethod.MAY_BANK_QR_PAY,
47
49
  PaymentMethod.GCASH,
48
- PaymentMethod.PAYMAYA
50
+ PaymentMethod.PAYMAYA,
51
+ PaymentMethod.ZALOPAY
49
52
  ];
50
53
  const PaymentComponentMap = {
51
54
  [PaymentCategory.CARD]: Card,
@@ -59,7 +62,8 @@ const PaymentComponentMap = {
59
62
  [PaymentCategory.SHOPEE_PAY]: ShopeePay,
60
63
  [PaymentCategory.GRAB_PAY]: GrabPay,
61
64
  [PaymentCategory.GCASH]: GCash,
62
- [PaymentCategory.PAYMAYA]: Paymaya
65
+ [PaymentCategory.PAYMAYA]: Paymaya,
66
+ [PaymentCategory.ZALOPAY]: Zalopay
63
67
  // [PaymentCategory.WECHAT_PAY]: WechatPay,
64
68
  // [PaymentCategory.ALI_PAY]: AliPay,
65
69
  // [PaymentCategory.SEPA_DEBIT]: Sepa
@@ -134,6 +138,10 @@ const paymentCategoryOptionMap = {
134
138
  [PaymentCategory.PAYMAYA]: {
135
139
  icon: IconPaymaya,
136
140
  nameKey: "dropIn.paymaya.label"
141
+ },
142
+ [PaymentCategory.ZALOPAY]: {
143
+ icon: IconZalopay,
144
+ nameKey: "dropIn.zalopay.label"
137
145
  }
138
146
  };
139
147
  const { bem } = useBEM("drop-in");
@@ -272,9 +280,9 @@ const DropIn = w((props, ref) => {
272
280
  );
273
281
  return;
274
282
  }
275
- const { paymentMethod = [] } = (session == null ? void 0 : session.checkout) || {};
283
+ const { supportMethods = [] } = (session == null ? void 0 : session.checkout) || {};
276
284
  const enablePaymentMethods = intersection(
277
- paymentMethod,
285
+ supportMethods,
278
286
  dropInSupportedPaymentMethods
279
287
  );
280
288
  if (!enablePaymentMethods.length) {
@@ -1,14 +1,15 @@
1
1
  import { setApiUrl, setCDNUrl } from "../../config.js";
2
2
  import { CoreContext } from "../../core/context.js";
3
3
  import { create } from "../../core/create.js";
4
+ import { w, F, h, A, y, u } from "../../core.js";
4
5
  import "../../api/http.js";
5
6
  import "../../utils/card-brand/brands.js";
6
7
  import { getBrowserInfo } from "../../utils/system-info/get-browser-info.js";
7
- import { w, F, h, A, y, u } from "../../core.js";
8
8
  import { useBEM } from "../../hooks/useBEM.js";
9
9
  import { useI18n } from "../../hooks/useI18n.js";
10
10
  import { defaultInputStyleConfig } from "../../types/index.js";
11
11
  import { intersection } from "../../utils/index.js";
12
+ import { createPromise } from "../../utils/create-promise.js";
12
13
  import { EFieldType, SecuredFieldsProvider } from "../SecuredFieldsProvider/index.js";
13
14
  import { CardNumberField } from "../CardNumberField/index.js";
14
15
  import { CardExpireDateField } from "../CardExpireDateField/index.js";
@@ -22,7 +23,7 @@ import { CombinedCardInfo } from "../CombinedCardInfo/index.js";
22
23
  import "../internal/Input/Input.js";
23
24
  import { inputWrapperClassName } from "../internal/Input/type.js";
24
25
  import { separateInputStyle, genComponentStyle, loadStyle } from "../../utils/style.js";
25
- import { createPromise } from "../../utils/create-promise.js";
26
+ import { genShortId } from "../../utils/string.js";
26
27
  const ENCRYPTED_CARD_WRAPPER_ID = "encryptedCardWrapper";
27
28
  const ENCRYPTED_CARD_ITEM_ATTR = "data-eci";
28
29
  var EEncryptedCardType = /* @__PURE__ */ ((EEncryptedCardType2) => {
@@ -52,6 +53,7 @@ const EncryptedCard = w((props, ref) => {
52
53
  var _a2;
53
54
  console.log("校验通过");
54
55
  (_a2 = SFPRef.current) == null ? void 0 : _a2.encryptCard({
56
+ checkoutId,
55
57
  merchantId,
56
58
  clientKey
57
59
  });
@@ -60,6 +62,7 @@ const EncryptedCard = w((props, ref) => {
60
62
  });
61
63
  }
62
64
  }));
65
+ const [checkoutId] = h(genShortId(6));
63
66
  const { i18n } = useI18n(locale || getBrowserInfo().language);
64
67
  const [single, setSingle] = h(false);
65
68
  const [showEncryptedCard, setShowEncryptedCard] = h(false);
@@ -371,6 +374,7 @@ const EncryptedCard = w((props, ref) => {
371
374
  {
372
375
  ref: SFPRef,
373
376
  targetElement,
377
+ checkoutId,
374
378
  i18n,
375
379
  style: inputStyle || defaultInputStyleConfig,
376
380
  supportedCardBrands: supportedBrands,