@paykka/card-checkout-ui 0.6.0 → 0.7.0

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 (160) hide show
  1. package/dist/card-checkout-ui.js +12 -12
  2. package/dist/card-checkout-ui.umd.cjs +12 -12
  3. package/dist/es/api/index.js +0 -2
  4. package/dist/es/api/modules/checkout/index.js +1 -15
  5. package/dist/es/api/modules/checkout/map.js +20 -3
  6. package/dist/es/api/modules/index.js +0 -2
  7. package/dist/es/components/AccountNameField/index.js +0 -3
  8. package/dist/es/components/AddressField/index.js +2 -7
  9. package/dist/es/components/AliPay/index.js +8 -7
  10. package/dist/es/components/ApplePay/index.js +7 -8
  11. package/dist/es/components/Card/index.js +301 -125
  12. package/dist/es/components/CardBrands/index.js +0 -2
  13. package/dist/es/components/CardExpireDateField/index.js +1 -4
  14. package/dist/es/components/CardHolderNameField/index.js +3 -5
  15. package/dist/es/components/CardIBANField/index.js +0 -3
  16. package/dist/es/components/CardNo/index.js +0 -2
  17. package/dist/es/components/CardNumberField/index.js +1 -4
  18. package/dist/es/components/CardSecurityCodeField/index.js +1 -4
  19. package/dist/es/components/CardSelector/index.js +0 -3
  20. package/dist/es/components/CombinedCardInfo/index.js +99 -0
  21. package/dist/es/components/EmailField/EmailField.js +0 -3
  22. package/dist/es/components/EncryptedCard/index.js +35 -75
  23. package/dist/es/components/GooglePay/index.js +62 -28
  24. package/dist/es/components/RecurringTip/index.js +0 -2
  25. package/dist/es/components/SecuredFieldsProvider/index.js +230 -1
  26. package/dist/es/components/SecuredIframe/index.js +3 -1
  27. package/dist/es/components/Sepa/index.js +21 -27
  28. package/dist/es/components/SubmitButton/index.js +0 -2
  29. package/dist/es/components/ThreeDS/index.js +94 -0
  30. package/dist/es/components/WechatPay/index.js +26 -25
  31. package/dist/es/components/index.js +1 -3
  32. package/dist/es/components/internal/Button/Button.js +0 -2
  33. package/dist/es/components/internal/Button/index.js +0 -2
  34. package/dist/es/components/internal/CheckBox/CheckBox.js +0 -2
  35. package/dist/es/components/internal/CheckBox/index.js +0 -2
  36. package/dist/es/components/internal/Form/type.js +0 -2
  37. package/dist/es/components/internal/Info/Info.js +0 -2
  38. package/dist/es/components/internal/Info/index.js +0 -2
  39. package/dist/es/components/internal/Input/Input.js +2 -2
  40. package/dist/es/components/internal/Input/type.js +0 -2
  41. package/dist/es/components/internal/LoadingCheck/LoadingCheck.js +0 -2
  42. package/dist/es/components/internal/LoadingCheck/index.js +0 -2
  43. package/dist/es/components/internal/Modal/Modal.js +40 -0
  44. package/dist/es/components/internal/Modal/modal2.js +1 -0
  45. package/dist/es/components/internal/Select/Select.js +0 -2
  46. package/dist/es/components/internal/Select/SelectMenu.js +0 -2
  47. package/dist/es/components/internal/Select/SelectMenuItem.js +0 -2
  48. package/dist/es/components/internal/icons/Icon3DSFail.js +3 -0
  49. package/dist/es/components/internal/icons/Icon3DSInfo.js +62 -0
  50. package/dist/es/components/internal/icons/Icon3DSSuccess.js +3 -0
  51. package/dist/es/config.js +0 -2
  52. package/dist/es/constant.js +3 -2
  53. package/dist/es/core/PayKKaCheckout.js +96 -42
  54. package/dist/es/core/Session.js +7 -6
  55. package/dist/es/core/environment.js +26 -0
  56. package/dist/es/core/error.js +21 -0
  57. package/dist/es/core/index.js +0 -2
  58. package/dist/es/core/query.js +0 -2
  59. package/dist/es/core.js +34 -34
  60. package/dist/es/hooks/index.js +0 -2
  61. package/dist/es/hooks/useBreakpoints.js +57 -0
  62. package/dist/es/hooks/useI18n.js +1 -2
  63. package/dist/es/hooks/usePayState.js +18 -24
  64. package/dist/es/i18n/index.js +0 -2
  65. package/dist/es/i18n/locales/de-DE.js +11 -1
  66. package/dist/es/i18n/locales/en-GB.js +11 -1
  67. package/dist/es/i18n/locales/es-ES.js +11 -1
  68. package/dist/es/i18n/locales/fr-FR.js +11 -1
  69. package/dist/es/i18n/locales/index.js +8 -6
  70. package/dist/es/i18n/locales/ja-JP.js +11 -1
  71. package/dist/es/i18n/locales/ko-KR.js +11 -1
  72. package/dist/es/i18n/locales/pt-PT.js +11 -1
  73. package/dist/es/i18n/locales/ru-RU.js +11 -1
  74. package/dist/es/i18n/locales/zh-CN.js +11 -1
  75. package/dist/es/i18n/locales/zh-HK.js +11 -1
  76. package/dist/es/i18n/locales/zh-TW.js +11 -1
  77. package/dist/es/i18n/util.js +11 -8
  78. package/dist/es/index.js +4 -2
  79. package/dist/es/style.css +186 -4
  80. package/dist/es/types/message.js +28 -0
  81. package/dist/es/utils/card-brand/brands.js +12 -10
  82. package/dist/es/utils/card-brand/index.js +3 -2
  83. package/dist/es/utils/iframe.js +23 -0
  84. package/dist/es/utils/index.js +0 -1
  85. package/dist/es/utils/style.js +47 -0
  86. package/dist/style.css +1 -1
  87. package/dist/types/api/modules/checkout/type.d.ts +14 -1
  88. package/dist/types/api/modules/get-browser-params.d.ts +1 -1
  89. package/dist/types/components/AddressField/type.d.ts +1 -0
  90. package/dist/types/components/AliPay/type.d.ts +4 -2
  91. package/dist/types/components/ApplePay/type.d.ts +4 -3
  92. package/dist/types/components/Card/type.d.ts +56 -10
  93. package/dist/types/components/CardHolderNameField/type.d.ts +1 -1
  94. package/dist/types/components/CombinedCardInfo/CombinedCardInfo.d.ts +5 -0
  95. package/dist/types/components/CombinedCardInfo/index.d.ts +2 -0
  96. package/dist/types/components/{CombinedEncryptedField → CombinedCardInfo}/type.d.ts +3 -2
  97. package/dist/types/components/GooglePay/type.d.ts +4 -3
  98. package/dist/types/components/SecuredFieldsProvider/index.d.ts +1 -0
  99. package/dist/types/components/SecuredFieldsProvider/type.d.ts +1 -153
  100. package/dist/types/components/SecuredFieldsProvider/utils/index.d.ts +1 -1
  101. package/dist/types/components/SecuredIframe/useSecuredInput.d.ts +2 -1
  102. package/dist/types/components/Sepa/type.d.ts +4 -2
  103. package/dist/types/components/ThreeDS/components/ThreeDSAuth/ThreeDSAuth.d.ts +3 -0
  104. package/dist/types/components/ThreeDS/components/ThreeDSAuth/index.d.ts +2 -0
  105. package/dist/types/components/ThreeDS/components/ThreeDSAuth/type.d.ts +17 -0
  106. package/dist/types/components/ThreeDS/components/ThreeDSIframe/ThreeDSIframe.d.ts +2 -0
  107. package/dist/types/components/ThreeDS/components/ThreeDSIframe/index.d.ts +1 -0
  108. package/dist/types/components/ThreeDS/components/ThreeDSIframe/output.d.ts +1 -0
  109. package/dist/types/components/ThreeDS/components/ThreeDSIframe/type.d.ts +5 -0
  110. package/dist/types/components/ThreeDS/components/ThreeDSStatus/ThreeDSStatus.d.ts +3 -0
  111. package/dist/types/components/ThreeDS/components/ThreeDSStatus/output.d.ts +1 -0
  112. package/dist/types/components/ThreeDS/components/ThreeDSStatus/type.d.ts +6 -0
  113. package/dist/types/components/ThreeDS/index.d.ts +1 -0
  114. package/dist/types/components/WechatPay/type.d.ts +4 -2
  115. package/dist/types/components/index.d.ts +1 -1
  116. package/dist/types/components/internal/Input/type.d.ts +1 -0
  117. package/dist/types/components/internal/Loading/Loading.d.ts +1 -0
  118. package/dist/types/components/internal/Loading/index.d.ts +1 -0
  119. package/dist/types/components/internal/Modal/Modal.d.ts +5 -0
  120. package/dist/types/components/internal/Modal/index.d.ts +0 -0
  121. package/dist/types/components/internal/Modal/type.d.ts +20 -0
  122. package/dist/types/components/internal/icons/Icon3DSFail.d.ts +2 -0
  123. package/dist/types/components/internal/icons/Icon3DSInfo.d.ts +2 -0
  124. package/dist/types/components/internal/icons/Icon3DSSuccess.d.ts +2 -0
  125. package/dist/types/components/internal/icons/index.d.ts +3 -0
  126. package/dist/types/constant.d.ts +6 -2
  127. package/dist/types/core/PayKKaCheckout.d.ts +22 -6
  128. package/dist/types/core/Session.d.ts +1 -1
  129. package/dist/types/core/context.d.ts +1 -0
  130. package/dist/types/core/environment.d.ts +4 -0
  131. package/dist/types/core/error.d.ts +16 -0
  132. package/dist/types/core/index.d.ts +1 -0
  133. package/dist/types/hooks/index.d.ts +1 -0
  134. package/dist/types/hooks/useBreakpoints.d.ts +15 -0
  135. package/dist/types/hooks/usePayState.d.ts +3 -6
  136. package/dist/types/i18n/locales/de-DE.d.ts +8 -0
  137. package/dist/types/i18n/locales/en-GB.d.ts +8 -0
  138. package/dist/types/i18n/locales/es-ES.d.ts +8 -0
  139. package/dist/types/i18n/locales/fr-FR.d.ts +8 -0
  140. package/dist/types/i18n/locales/index.d.ts +2 -2
  141. package/dist/types/i18n/locales/ja-JP.d.ts +8 -0
  142. package/dist/types/i18n/locales/ko-KR.d.ts +8 -0
  143. package/dist/types/i18n/locales/pt-PT.d.ts +8 -0
  144. package/dist/types/i18n/locales/ru-RU.d.ts +8 -0
  145. package/dist/types/i18n/locales/zh-CN.d.ts +8 -0
  146. package/dist/types/i18n/locales/zh-HK.d.ts +8 -0
  147. package/dist/types/i18n/locales/zh-TW.d.ts +8 -0
  148. package/dist/types/index.d.ts +1 -1
  149. package/dist/types/types/index.d.ts +39 -8
  150. package/dist/types/types/message.d.ts +170 -0
  151. package/dist/types/utils/card-brand/brands.d.ts +1 -8
  152. package/dist/types/utils/card-brand/index.d.ts +2 -2
  153. package/dist/types/utils/index.d.ts +1 -0
  154. package/dist/types/utils/style.d.ts +12 -0
  155. package/package.json +63 -63
  156. package/dist/es/components/CombinedEncryptedField/index.js +0 -75
  157. package/dist/es/components/SecuredFieldsProvider/SecuredFieldsProvider.js +0 -268
  158. package/dist/types/components/CombinedEncryptedField/CombinedEncryptedField.d.ts +0 -4
  159. package/dist/types/components/CombinedEncryptedField/index.d.ts +0 -2
  160. /package/dist/types/{components/SecuredFieldsProvider/utils → utils}/iframe.d.ts +0 -0
@@ -1,15 +1,15 @@
1
- import { w, A, h, F, y, q, T, u } from "../../core.js";
1
+ import { w, A, h, F, y, q, T, u, b } from "../../core.js";
2
2
  import { isTimeoutError } from "../../api/http.js";
3
3
  import { PaymentType, SessionMode, COMMON_CLASS_NAME, CardPaymentMethods, PaymentMethod } from "../../constant.js";
4
4
  import { getBrowserParams } from "../../api/modules/get-browser-params.js";
5
5
  import { getCardPayInfo, cardPay } from "../../api/modules/card/index.js";
6
6
  import { CoreContext } from "../../core/context.js";
7
7
  import { intersection } from "../../utils/index.js";
8
+ import { PayKKaError } from "../../core/error.js";
8
9
  import { hidePaymentButton } from "../../config.js";
10
+ import { defaultInputStyleConfig } from "../../types/index.js";
9
11
  import { createAddressCore } from "../../core/Address.js";
10
12
  import { useBEM } from "../../hooks/useBEM.js";
11
- import "../../i18n/util.js";
12
- import "../../i18n/locales/index.js";
13
13
  import { usePayState } from "../../hooks/usePayState.js";
14
14
  import { useRetry } from "../../hooks/useRetry.js";
15
15
  import { AddressField } from "../AddressField/index.js";
@@ -28,23 +28,37 @@ import { Form } from "../internal/Form/Form.js";
28
28
  import { IconSwitch } from "../internal/icons/IconSwitch.js";
29
29
  import { Info } from "../internal/Info/Info.js";
30
30
  import { RecurringTip } from "../RecurringTip/index.js";
31
- import { EFieldType, SecuredFieldsProvider } from "../SecuredFieldsProvider/SecuredFieldsProvider.js";
31
+ import { EFieldType, SecuredFieldsProvider } from "../SecuredFieldsProvider/index.js";
32
32
  import { SubmitButton } from "../SubmitButton/index.js";
33
- import { defaultInputStyleConfig } from "../../types/index.js";
33
+ import { ThreeDSAuth } from "../ThreeDS/index.js";
34
+ import { CombinedCardInfo } from "../CombinedCardInfo/index.js";
34
35
  import { cssVarPrefix, normalizedClass, trimAll, formatAmount } from "../../utils/format.js";
35
- import { isEmptyObject, isUndefined } from "../../utils/is.js";
36
36
  import { cardBrandCodes } from "../../utils/card-brand/brands.js";
37
37
  import { findCardBrand } from "../../utils/card-brand/index.js";
38
+ import { separateInputStyle } from "../../utils/style.js";
39
+ import { createPromise } from "../../utils/create-promise.js";
40
+ import { isUndefined } from "../../utils/is.js";
38
41
  const { bem } = useBEM("card");
39
42
  const fieldClassNames = bem("field");
40
43
  const Card = w((props, ref) => {
41
- var _a, _b, _c, _d, _e, _f;
42
- const { showCardBrands = true } = props;
44
+ var _a, _b, _c, _d, _e, _f, _g, _h;
45
+ const {
46
+ showCardBrands = true,
47
+ session,
48
+ cardInfoLayout = "split",
49
+ showHolderName = true,
50
+ showEmail = false,
51
+ showAddress = false,
52
+ threeDSFrame,
53
+ styles,
54
+ enable3DSModal = true
55
+ } = props;
43
56
  let addressState = createAddressCore();
44
57
  let emailState = createEmailCore();
45
- const { i18n, session, sessionReady, fraudDetection } = usePayState();
58
+ const { i18n, fraudDetection, sessionReady } = usePayState(session);
46
59
  const addressFieldRef = A(null);
47
60
  const emailFieldRef = A(null);
61
+ const combinedCardInfoRef = A(null);
48
62
  const formRef = A(null);
49
63
  const [form, setForm] = h({
50
64
  email: "",
@@ -52,6 +66,7 @@ const Card = w((props, ref) => {
52
66
  expireDate: "",
53
67
  securityCode: "",
54
68
  holderName: "",
69
+ cardInfo: "",
55
70
  address: {
56
71
  country: "",
57
72
  province: "",
@@ -65,17 +80,22 @@ const Card = w((props, ref) => {
65
80
  const [validated, setValidated] = h(false);
66
81
  const [submitButtonStatus, setSubmitButtonStatus] = h("unSubmit");
67
82
  const [errorMsg, setErrorMsg] = h("");
68
- const disabledEmail = A(false);
69
- const [requiredBill, setRequiredBill] = h(false);
70
83
  const [storePaymentMethod, setStorePaymentMethod] = h(false);
71
84
  const [isEditOtherCard, setIsEditOtherCard] = h(false);
72
85
  const [isCheckoutEnabled, setIsCheckoutEnabled] = h(false);
73
86
  const [supportedCardBrands, setSupportedCardBrands] = h([]);
87
+ const [showThreeDSModal, setShowThreeDSModal] = h(false);
88
+ const [threeDSInfo, setThreeDSInfo] = h();
89
+ const [fieldStatus, setFieldStatus] = h();
90
+ const [security, setSecurity] = h(false);
91
+ const [tokenAddressFilled, setTokenAddressFilled] = h(true);
92
+ const [inputStyle, setInputStyle] = h({});
93
+ const [splitCardInfo] = h(cardInfoLayout === "split");
74
94
  F(ref, () => ({
75
95
  checkThreeDS,
76
96
  updateAddress: () => {
77
97
  var _a2;
78
- if (!requiredBill)
98
+ if (!(fieldStatus == null ? void 0 : fieldStatus.address.show))
79
99
  return;
80
100
  setForm(Object.assign(form, { address: addressState.getAddressState() }));
81
101
  (_a2 = addressFieldRef.current) == null ? void 0 : _a2.update(addressState.getAddressState());
@@ -86,33 +106,57 @@ const Card = w((props, ref) => {
86
106
  (_a2 = emailFieldRef.current) == null ? void 0 : _a2.update(emailState.email);
87
107
  },
88
108
  payment: () => {
89
- !hidePaymentButton && onSubmit();
109
+ hidePaymentButton && onSubmit();
90
110
  }
91
111
  }));
92
- const getPaymentSuccessData = () => ({
93
- returnUrl: session == null ? void 0 : session.checkout.returnUrl
94
- });
95
- y(() => {
112
+ const getPaymentSuccessData = () => {
96
113
  var _a2;
97
- if (!sessionReady) {
114
+ return {
115
+ returnUrl: (_a2 = session == null ? void 0 : session.checkout) == null ? void 0 : _a2.returnUrl
116
+ };
117
+ };
118
+ const initFieldStatus = () => {
119
+ const field = session.checkout.field;
120
+ const { email, address, holderName } = field;
121
+ if (showEmail && !(email == null ? void 0 : email.show)) {
122
+ email.show = true;
123
+ email.disabled = true;
124
+ }
125
+ if (showAddress && !(address == null ? void 0 : address.show)) {
126
+ address.show = true;
127
+ }
128
+ if (showHolderName && !(holderName == null ? void 0 : holderName.show)) {
129
+ holderName.show = true;
130
+ holderName.disabled = true;
131
+ }
132
+ setFieldStatus({ ...field });
133
+ };
134
+ const initElementStyles = () => {
135
+ if (!styles) {
98
136
  return;
99
137
  }
100
- const { status, paymentMethod = [], bill = {} } = (session == null ? void 0 : session.checkout) || {};
101
- console.log(intersection(paymentMethod, CardPaymentMethods));
102
- if (!intersection(paymentMethod, CardPaymentMethods).length) {
138
+ const { input } = separateInputStyle(styles);
139
+ input && setInputStyle(input);
140
+ };
141
+ y(() => {
142
+ if (!sessionReady) {
103
143
  return;
104
144
  }
105
- if (isEmptyObject(session == null ? void 0 : session.checkout)) {
106
- (_a2 = props.onError) == null ? void 0 : _a2.call(props, "FAILURE");
145
+ const { status, paymentMethod = [], bill = {}, sessionMode } = (session == null ? void 0 : session.checkout) || {};
146
+ if (!intersection(paymentMethod, CardPaymentMethods).length) {
107
147
  return;
108
148
  }
109
- setIsCheckoutEnabled(true);
149
+ initFieldStatus();
150
+ initElementStyles();
151
+ setSecurity(sessionMode !== SessionMode.HOSTED);
110
152
  form.email = bill.email ?? "";
111
- disabledEmail.current = !!bill.email;
112
- setRequiredBill(bill.billingAddressCollection === "REQUIRED");
113
153
  setSupportedCardBrands(
114
- cardBrandCodes.filter((code) => session == null ? void 0 : session.checkout.paymentMethod.includes(code))
154
+ cardBrandCodes.filter((code) => {
155
+ var _a2;
156
+ return (_a2 = session == null ? void 0 : session.checkout) == null ? void 0 : _a2.paymentMethod.includes(code);
157
+ })
115
158
  );
159
+ setIsCheckoutEnabled(true);
116
160
  if (status === "SUCCESS") {
117
161
  setSubmitButtonStatus("success");
118
162
  processOnSuccess();
@@ -134,12 +178,44 @@ const Card = w((props, ref) => {
134
178
  const { start: startReFetchPayInfo } = useRetry((timeout) => pay(true, timeout), {
135
179
  onTimeout: () => onTimeout(i18n.get("common.queryTimeout"))
136
180
  });
181
+ const validatePromise = A(createPromise());
182
+ const onValidated = (data) => {
183
+ fieldValidStatusMap.current[data.fieldType].status = data.status;
184
+ const results = Object.values(fieldValidStatusMap.current);
185
+ if (results.includes(null)) {
186
+ return;
187
+ } else {
188
+ const validateResult = results.every((result) => result.status === "success");
189
+ if (validateResult) {
190
+ validatePromise.current.resolve(true);
191
+ } else {
192
+ validatePromise.current.reject(false);
193
+ }
194
+ }
195
+ };
196
+ const validateCombineCardInfo = async () => {
197
+ var _a2;
198
+ validatePromise.current = createPromise();
199
+ Object.keys(fieldValidStatusMap.current).forEach((key) => {
200
+ fieldValidStatusMap.current[key] = null;
201
+ });
202
+ (_a2 = SFPRef.current) == null ? void 0 : _a2.validate();
203
+ try {
204
+ await validatePromise.current;
205
+ console.log("校验通过");
206
+ } catch (error) {
207
+ console.log("校验失败");
208
+ }
209
+ };
137
210
  async function onSubmit() {
138
211
  var _a2;
139
212
  setErrorMsg("");
213
+ if (!splitCardInfo && security) {
214
+ await validateCombineCardInfo();
215
+ }
140
216
  (_a2 = formRef.current) == null ? void 0 : _a2.validate(async (errors) => {
141
217
  var _a3;
142
- requiredBill && addressState.setValidateAllFields(true);
218
+ (fieldStatus == null ? void 0 : fieldStatus.address.show) && addressState.setValidateAllFields(true);
143
219
  (_a3 = props.onSubmit) == null ? void 0 : _a3.call(props, errors);
144
220
  if (errors) {
145
221
  setSubmitButtonStatus("unSubmit");
@@ -151,12 +227,22 @@ const Card = w((props, ref) => {
151
227
  });
152
228
  }
153
229
  const getPaymentParams = async () => {
154
- var _a2, _b2;
230
+ var _a2;
155
231
  const cardNo = trimAll(form.number);
156
232
  const cardBrand = findCardBrand(cardNo);
157
233
  const [expMonth, expYear] = form.expireDate.split("/");
158
234
  const isFastPaymentForm = isFastPayment && !isEditOtherCard;
159
- const paymentMethod = isFastPayment ? PaymentMethod.BANKCARD : ((_a2 = session == null ? void 0 : session.checkout) == null ? void 0 : _a2.sessionMode) === SessionMode.EMBEDDED ? (_b2 = cardNumberFieldRef.current) == null ? void 0 : _b2.getCardBrand().code : cardBrand.code;
235
+ let paymentMethod = null;
236
+ if (isFastPayment) {
237
+ paymentMethod = PaymentMethod.BANKCARD;
238
+ } else {
239
+ if (security) {
240
+ const fieldRef = splitCardInfo ? cardNumberFieldRef : combinedCardInfoRef;
241
+ paymentMethod = (_a2 = fieldRef.current) == null ? void 0 : _a2.getCardBrand().code;
242
+ } else {
243
+ paymentMethod = cardBrand.code;
244
+ }
245
+ }
160
246
  return {
161
247
  sessionId: session.sessionId,
162
248
  clientKey: session.clientKey,
@@ -173,7 +259,7 @@ const Card = w((props, ref) => {
173
259
  ...isShowStoreCheckBox ? { storePaymentMethod } : null
174
260
  }
175
261
  },
176
- bill: requiredBill ? {
262
+ bill: (fieldStatus == null ? void 0 : fieldStatus.address.show) ? {
177
263
  email: form.email,
178
264
  ...form.address,
179
265
  province: addressState.getLabel(form.address.province, addressState.getProvinceOption()) ?? form.address.province,
@@ -187,11 +273,11 @@ const Card = w((props, ref) => {
187
273
  };
188
274
  };
189
275
  async function pay(search = false, timeout) {
190
- var _a2, _b2, _c2;
276
+ var _a2, _b2;
191
277
  try {
192
278
  const paymentParams = await getPaymentParams();
193
- if (!search && ((_a2 = session == null ? void 0 : session.checkout) == null ? void 0 : _a2.sessionMode) === SessionMode.EMBEDDED) {
194
- (_b2 = SFPRef.current) == null ? void 0 : _b2.payment(paymentParams);
279
+ if (!search && security) {
280
+ (_a2 = SFPRef.current) == null ? void 0 : _a2.payment(paymentParams);
195
281
  return { end: true };
196
282
  }
197
283
  const options = { locale: i18n.locale, timeout };
@@ -209,17 +295,39 @@ const Card = w((props, ref) => {
209
295
  return { end: true };
210
296
  }
211
297
  } else {
212
- setErrorMsg(error.i18nKey ? i18n.get(error.i18nKey) : error.message);
213
- (_c2 = props.onError) == null ? void 0 : _c2.call(props, error);
298
+ const message = error.i18nKey ? i18n.get(error.i18nKey) : error.message;
299
+ setErrorMsg(message);
300
+ (_b2 = props.onError) == null ? void 0 : _b2.call(props, new PayKKaError("API_ERROR", message, { code: error.code, cause: error }));
214
301
  setSubmitButtonStatus("unSubmit");
215
302
  stopReFetchCardPay3DSInfo();
216
303
  return { end: true };
217
304
  }
218
305
  }
219
306
  }
307
+ const processThreeDS = (threeDSUrl, incomplete) => {
308
+ var _a2;
309
+ if (enable3DSModal) {
310
+ console.log("3ds open");
311
+ setShowThreeDSModal(true);
312
+ setThreeDSInfo({
313
+ url: threeDSUrl,
314
+ incomplete,
315
+ width: threeDSFrame == null ? void 0 : threeDSFrame.modalWidth,
316
+ height: threeDSFrame == null ? void 0 : threeDSFrame.modalHeight
317
+ });
318
+ } else {
319
+ (_a2 = props.onThreeDS) == null ? void 0 : _a2.call(props, threeDSUrl, incomplete);
320
+ }
321
+ };
322
+ const handleCloseThreeDSModal = () => {
323
+ console.log("3ds close");
324
+ setShowThreeDSModal(false);
325
+ setThreeDSInfo(void 0);
326
+ checkThreeDS();
327
+ };
220
328
  const processAfterPayment = (res, search = false) => {
221
- var _a2, _b2, _c2, _d2, _e2;
222
- const { status, orderStatus, errorMessage, threeDSUrl } = res;
329
+ var _a2, _b2, _c2;
330
+ const { status, orderStatus, errorMessage, errorCode, threeDSUrl } = res;
223
331
  if (status === "PROCESSING") {
224
332
  if (!orderStatus) {
225
333
  setSubmitButtonStatus("unSubmit");
@@ -232,14 +340,14 @@ const Card = w((props, ref) => {
232
340
  } else if (orderStatus === "FAILURE") {
233
341
  setErrorMsg(errorMessage);
234
342
  setSubmitButtonStatus("unSubmit");
235
- (_a2 = props.onError) == null ? void 0 : _a2.call(props, "FAILURE");
343
+ (_a2 = props.onError) == null ? void 0 : _a2.call(props, new PayKKaError("API_ERROR", errorMessage, { code: errorCode }));
236
344
  } else if (orderStatus === "AUTHORIZED") {
237
345
  setSubmitButtonStatus("unSubmit");
238
346
  (_b2 = props.onAuthorized) == null ? void 0 : _b2.call(props);
239
347
  } else if (orderStatus === "IN_THREED") {
240
- (_c2 = props.onThreeDS) == null ? void 0 : _c2.call(props, threeDSUrl, false);
348
+ processThreeDS(threeDSUrl, false);
241
349
  } else if (orderStatus === "IN_PREVIOUS_THREED") {
242
- (_d2 = props.onThreeDS) == null ? void 0 : _d2.call(props, threeDSUrl, true);
350
+ processThreeDS(threeDSUrl, true);
243
351
  }
244
352
  return { end: true };
245
353
  } else if (status === "SUCCESS") {
@@ -248,7 +356,7 @@ const Card = w((props, ref) => {
248
356
  return { end: true };
249
357
  } else if (status === "EXPIRED") {
250
358
  setSubmitButtonStatus("unSubmit");
251
- (_e2 = props.onExpired) == null ? void 0 : _e2.call(props);
359
+ (_c2 = props.onExpired) == null ? void 0 : _c2.call(props);
252
360
  return { end: true };
253
361
  }
254
362
  setSubmitButtonStatus("unSubmit");
@@ -257,18 +365,19 @@ const Card = w((props, ref) => {
257
365
  };
258
366
  const processPaymentError = (error) => {
259
367
  var _a2;
260
- setErrorMsg(error.i18nKey ? i18n.get(error.i18nKey) : error.message);
368
+ const message = error.i18nKey ? i18n.get(error.i18nKey) : error.message;
369
+ setErrorMsg(message);
261
370
  setSubmitButtonStatus("unSubmit");
262
- (_a2 = props.onError) == null ? void 0 : _a2.call(props, error);
371
+ (_a2 = props.onError) == null ? void 0 : _a2.call(props, new PayKKaError("API_ERROR", message, { code: error.code, cause: error }));
263
372
  };
264
- function validateForm() {
373
+ const validateForm = () => {
265
374
  var _a2;
266
375
  (_a2 = formRef.current) == null ? void 0 : _a2.validate(void 0, false).then(() => {
267
376
  setValidated(true);
268
377
  }).catch(() => {
269
378
  setValidated(false);
270
379
  });
271
- }
380
+ };
272
381
  y(() => {
273
382
  validateForm();
274
383
  }, [form]);
@@ -306,7 +415,7 @@ const Card = w((props, ref) => {
306
415
  }
307
416
  );
308
417
  async function checkThreeDS(search = false, timeout = 2e4) {
309
- var _a2, _b2, _c2;
418
+ var _a2, _b2, _c2, _d2;
310
419
  if (!session)
311
420
  return { end: true };
312
421
  try {
@@ -320,16 +429,17 @@ const Card = w((props, ref) => {
320
429
  timeout
321
430
  }
322
431
  );
323
- const { status, orderStatus, errorMessage } = res;
432
+ const { status, orderStatus, errorMessage, errorCode } = res;
324
433
  if (status === "PROCESSING") {
325
434
  if (orderStatus === "PROCESSING") {
326
435
  startReFetchPayInfo();
327
436
  } else if (orderStatus === "FAILURE") {
328
437
  setErrorMsg(errorMessage);
329
438
  setSubmitButtonStatus("unSubmit");
439
+ (_a2 = props.onError) == null ? void 0 : _a2.call(props, new PayKKaError("API_ERROR", errorMessage, { code: errorCode }));
330
440
  } else if (orderStatus === "AUTHORIZED") {
331
441
  setSubmitButtonStatus("unSubmit");
332
- (_a2 = props.onAuthorized) == null ? void 0 : _a2.call(props);
442
+ (_b2 = props.onAuthorized) == null ? void 0 : _b2.call(props);
333
443
  } else if (orderStatus === "IN_THREED") {
334
444
  setSubmitButtonStatus("loading");
335
445
  !search && startReFetchCardPay3DSInfo();
@@ -349,7 +459,7 @@ const Card = w((props, ref) => {
349
459
  return { end: true };
350
460
  } else if (status === "EXPIRED") {
351
461
  setSubmitButtonStatus("unSubmit");
352
- (_b2 = props.onExpired) == null ? void 0 : _b2.call(props);
462
+ (_c2 = props.onExpired) == null ? void 0 : _c2.call(props);
353
463
  stopReFetchCardPay3DSInfo();
354
464
  return { end: true };
355
465
  }
@@ -366,8 +476,9 @@ const Card = w((props, ref) => {
366
476
  return { end: true };
367
477
  }
368
478
  } else {
369
- setErrorMsg(error.i18nKey ? i18n.get(error.i18nKey) : error.message);
370
- (_c2 = props.onError) == null ? void 0 : _c2.call(props, error);
479
+ const message = error.i18nKey ? i18n.get(error.i18nKey) : error.message;
480
+ setErrorMsg(message);
481
+ (_d2 = props.onError) == null ? void 0 : _d2.call(props, new PayKKaError("API_ERROR", message, { code: error.code, cause: error }));
371
482
  setSubmitButtonStatus("unSubmit");
372
483
  stopReFetchCardPay3DSInfo();
373
484
  return { end: true };
@@ -376,31 +487,36 @@ const Card = w((props, ref) => {
376
487
  }
377
488
  const isFastPayment = T(() => {
378
489
  var _a2;
490
+ if (!(session == null ? void 0 : session.checkout)) {
491
+ return;
492
+ }
379
493
  const isPurchase = (session == null ? void 0 : session.checkout.paymentType) === PaymentType.PURCHASE;
380
494
  const hasCardTokens = !!((_a2 = session == null ? void 0 : session.checkout.tokens) == null ? void 0 : _a2.length);
381
495
  return isPurchase && hasCardTokens;
382
496
  }, [session == null ? void 0 : session.checkout]);
383
497
  const isShowStoreCheckBox = T(() => {
498
+ if (!(session == null ? void 0 : session.checkout)) {
499
+ return;
500
+ }
384
501
  return (session == null ? void 0 : session.checkout.paymentType) === PaymentType.PURCHASE && (session == null ? void 0 : session.checkout.storePaymentMethod);
385
502
  }, [session == null ? void 0 : session.checkout]);
386
503
  const storeCheckBox = () => {
387
504
  const onCheck = (checked) => {
388
505
  setStorePaymentMethod(checked);
389
506
  };
390
- return /* @__PURE__ */ u(
507
+ return /* @__PURE__ */ u("div", { className: bem("store-checkbox"), children: /* @__PURE__ */ u(
391
508
  CheckBox,
392
509
  {
393
510
  label: i18n.get("card.storeInfo"),
394
511
  checked: storePaymentMethod,
395
- onChange: onCheck,
396
- style: { marginTop: "40px" }
512
+ onChange: onCheck
397
513
  }
398
- );
514
+ ) });
399
515
  };
400
516
  const changeBox = () => {
401
- var _a2, _b2;
402
- const isPurchase = (session == null ? void 0 : session.checkout.paymentType) === PaymentType.PURCHASE;
403
- const hasCardTokens = !!((_b2 = (_a2 = session == null ? void 0 : session.checkout) == null ? void 0 : _a2.tokens) == null ? void 0 : _b2.length);
517
+ var _a2, _b2, _c2;
518
+ const isPurchase = ((_a2 = session == null ? void 0 : session.checkout) == null ? void 0 : _a2.paymentType) === PaymentType.PURCHASE;
519
+ const hasCardTokens = !!((_c2 = (_b2 = session == null ? void 0 : session.checkout) == null ? void 0 : _b2.tokens) == null ? void 0 : _c2.length);
404
520
  const onClick = () => {
405
521
  var _a3;
406
522
  (_a3 = formRef.current) == null ? void 0 : _a3.resetValidation();
@@ -415,7 +531,6 @@ const Card = w((props, ref) => {
415
531
  var _a2;
416
532
  (_a2 = formRef.current) == null ? void 0 : _a2.resetValidation();
417
533
  setIsEditOtherCard(true);
418
- setRequiredBill((session == null ? void 0 : session.checkout.bill.billingAddressCollection) === "REQUIRED");
419
534
  };
420
535
  const onClickChangeCard = () => {
421
536
  var _a2;
@@ -426,10 +541,8 @@ const Card = w((props, ref) => {
426
541
  onEditOtherCard();
427
542
  };
428
543
  const onCardChange = (option) => {
544
+ setTokenAddressFilled(false);
429
545
  setForm(Object.assign(form, { token: option == null ? void 0 : option.token }));
430
- setRequiredBill(
431
- (session == null ? void 0 : session.checkout.bill.billingAddressCollection) === "REQUIRED" && !(option == null ? void 0 : option.billingAddressFilled)
432
- );
433
546
  };
434
547
  const setFormRef = (dom) => {
435
548
  formRef.current = dom;
@@ -453,25 +566,59 @@ const Card = w((props, ref) => {
453
566
  };
454
567
  const onFieldsFocus = (data) => {
455
568
  var _a2, _b2;
456
- const fieldRef = fieldRefMap[data.fieldType];
569
+ const fieldRef = splitCardInfo ? fieldRefMap[data.fieldType] : combinedCardInfoRef;
457
570
  if (data.focus) {
458
571
  (_a2 = fieldRef.current) == null ? void 0 : _a2.focus();
459
572
  } else {
460
573
  (_b2 = fieldRef.current) == null ? void 0 : _b2.blur();
461
574
  }
462
575
  };
576
+ const validateOrder = [EFieldType.CARD_NUMBER, EFieldType.EXPIRE_DATE, EFieldType.CVV];
577
+ const fieldValidStatusMap = A({
578
+ [EFieldType.CARD_NUMBER]: null,
579
+ [EFieldType.EXPIRE_DATE]: null,
580
+ [EFieldType.CVV]: null
581
+ });
463
582
  const onFieldValidStatusChanged = (data) => {
464
- var _a2;
465
- const fieldRef = fieldRefMap[data.fieldType];
583
+ var _a2, _b2, _c2, _d2;
584
+ const fieldRef = splitCardInfo ? fieldRefMap[data.fieldType] : combinedCardInfoRef;
466
585
  const error = data.errorTip && i18n.get(data.errorTip);
467
- (_a2 = fieldRef.current) == null ? void 0 : _a2.resetValidation(data.status, error);
586
+ if (!splitCardInfo) {
587
+ fieldValidStatusMap.current[data.fieldType] = {
588
+ status: data.status,
589
+ errorTip: error
590
+ };
591
+ for (const key of validateOrder) {
592
+ const currResult = fieldValidStatusMap.current[key];
593
+ if ((currResult == null ? void 0 : currResult.status) === "error") {
594
+ (_a2 = fieldRef.current) == null ? void 0 : _a2.resetValidation(currResult.status, currResult.errorTip);
595
+ return;
596
+ }
597
+ }
598
+ const isSuccess = Object.values(fieldValidStatusMap.current).every(
599
+ (result) => (result == null ? void 0 : result.status) === "success"
600
+ );
601
+ if (isSuccess) {
602
+ (_b2 = fieldRef.current) == null ? void 0 : _b2.resetValidation("success");
603
+ } else {
604
+ (_c2 = fieldRef.current) == null ? void 0 : _c2.resetValidation("unValidate");
605
+ }
606
+ } else {
607
+ (_d2 = fieldRef.current) == null ? void 0 : _d2.resetValidation(data.status, error);
608
+ }
468
609
  setTimeout(() => {
469
610
  validateForm();
470
611
  }, 100);
471
612
  };
613
+ const onBrand = (data) => {
614
+ var _a2;
615
+ const field = splitCardInfo ? cardNumberFieldRef : combinedCardInfoRef;
616
+ (_a2 = field.current) == null ? void 0 : _a2.brandChanged(data.brand);
617
+ };
472
618
  const onBinValueChanged = (data) => {
473
619
  var _a2;
474
- (_a2 = cardNumberFieldRef.current) == null ? void 0 : _a2.binValueChanged(data.binValue);
620
+ const field = splitCardInfo ? cardNumberFieldRef : combinedCardInfoRef;
621
+ (_a2 = field.current) == null ? void 0 : _a2.binValueChanged(data.binValue);
475
622
  };
476
623
  const onAfterPayment = (data) => {
477
624
  processAfterPayment(data.response);
@@ -479,17 +626,41 @@ const Card = w((props, ref) => {
479
626
  const onPaymentError = (data) => {
480
627
  processPaymentError(data.error);
481
628
  };
482
- const cardForm = () => {
483
- var _a2, _b2, _c2, _d2, _e2, _f2, _g;
484
- return /* @__PURE__ */ u(Form, { form, ref: setFormRef, onFormChange: (form2) => setForm(form2), children: /* @__PURE__ */ u("div", { className: normalizedClass(COMMON_CLASS_NAME, bem()), style: cardStyle, children: [
485
- /* @__PURE__ */ u("div", { className: fieldClassNames, children: /* @__PURE__ */ u(EmailField, { ref: emailFieldRef, value: form.email, disabled: !!disabledEmail.current }) }),
629
+ const Email = () => {
630
+ return /* @__PURE__ */ u(b, { children: (fieldStatus == null ? void 0 : fieldStatus.email.show) && /* @__PURE__ */ u("div", { className: fieldClassNames, children: /* @__PURE__ */ u(
631
+ EmailField,
632
+ {
633
+ ref: emailFieldRef,
634
+ value: form.email,
635
+ disabled: fieldStatus == null ? void 0 : fieldStatus.email.disabled
636
+ }
637
+ ) }) });
638
+ };
639
+ const Address = () => {
640
+ var _a2, _b2;
641
+ return /* @__PURE__ */ u(b, { children: (fieldStatus == null ? void 0 : fieldStatus.address.show) && /* @__PURE__ */ u("div", { className: bem("address"), children: /* @__PURE__ */ u(
642
+ AddressField,
643
+ {
644
+ ref: addressFieldRef,
645
+ value: form.address,
646
+ 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),
647
+ onAddressChange: (value) => setForm(Object.assign(form, { address: value }))
648
+ }
649
+ ) }) });
650
+ };
651
+ const ErrorMessage = () => {
652
+ return /* @__PURE__ */ u(b, { children: !!errorMsg && /* @__PURE__ */ u(Info, { content: errorMsg, style: { marginTop: "12px" } }) });
653
+ };
654
+ const CardInfo = q(() => {
655
+ var _a2, _b2, _c2, _d2;
656
+ return splitCardInfo ? /* @__PURE__ */ u(b, { children: [
486
657
  /* @__PURE__ */ u("div", { className: fieldClassNames, children: [
487
658
  /* @__PURE__ */ u("div", { className: bem("card-number-wrapper"), children: [
488
659
  /* @__PURE__ */ u(
489
660
  CardNumberField,
490
661
  {
491
662
  supportedCardBrands: (_b2 = (_a2 = session == null ? void 0 : session.checkout) == null ? void 0 : _a2.paymentMethod) == null ? void 0 : _b2.filter(Boolean),
492
- security: ((_c2 = session == null ? void 0 : session.checkout) == null ? void 0 : _c2.sessionMode) === SessionMode.EMBEDDED,
663
+ security,
493
664
  ref: cardNumberFieldRef
494
665
  }
495
666
  ),
@@ -499,7 +670,7 @@ const Card = w((props, ref) => {
499
670
  CardBrands,
500
671
  {
501
672
  className: bem("card-brands"),
502
- supportedCardBrands: (_e2 = (_d2 = session == null ? void 0 : session.checkout) == null ? void 0 : _d2.paymentMethod) == null ? void 0 : _e2.filter(Boolean)
673
+ supportedCardBrands: (_d2 = (_c2 = session == null ? void 0 : session.checkout) == null ? void 0 : _c2.paymentMethod) == null ? void 0 : _d2.filter(Boolean)
503
674
  }
504
675
  )
505
676
  ] }),
@@ -507,7 +678,7 @@ const Card = w((props, ref) => {
507
678
  /* @__PURE__ */ u(
508
679
  CardExpireDateField,
509
680
  {
510
- security: ((_f2 = session == null ? void 0 : session.checkout) == null ? void 0 : _f2.sessionMode) === SessionMode.EMBEDDED,
681
+ security,
511
682
  className: fieldClassNames,
512
683
  ref: cardExpireDateFieldRef
513
684
  }
@@ -515,32 +686,40 @@ const Card = w((props, ref) => {
515
686
  /* @__PURE__ */ u(
516
687
  CardSecurityCodeField,
517
688
  {
518
- security: ((_g = session == null ? void 0 : session.checkout) == null ? void 0 : _g.sessionMode) === SessionMode.EMBEDDED,
689
+ security,
519
690
  className: fieldClassNames,
520
691
  ref: cardSecurityCodeFieldRef
521
692
  }
522
693
  )
523
- ] }),
524
- /* @__PURE__ */ u("div", { className: bem("holder-name"), children: /* @__PURE__ */ u(CardHolderNameField, {}) }),
525
- requiredBill && /* @__PURE__ */ u("div", { className: bem("address"), children: /* @__PURE__ */ u(
526
- AddressField,
527
- {
528
- ref: addressFieldRef,
529
- value: form.address,
530
- onAddressChange: (value) => setForm(Object.assign(form, { address: value }))
531
- }
532
- ) }),
533
- (session == null ? void 0 : session.checkout.paymentType) === PaymentType.RECURRING && RecurringTip(),
694
+ ] })
695
+ ] }) : /* @__PURE__ */ u("div", { className: bem("card-info"), children: /* @__PURE__ */ u(
696
+ CombinedCardInfo,
697
+ {
698
+ ref: combinedCardInfoRef,
699
+ supportedCardBrands,
700
+ showLabel: true,
701
+ security
702
+ }
703
+ ) });
704
+ }, [splitCardInfo, security]);
705
+ const cardForm = () => {
706
+ var _a2;
707
+ return /* @__PURE__ */ u(Form, { form, ref: setFormRef, onFormChange: (form2) => setForm(form2), children: /* @__PURE__ */ u("div", { className: normalizedClass(COMMON_CLASS_NAME, bem()), style: cardStyle, children: [
708
+ Email(),
709
+ CardInfo(),
710
+ (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 }) }),
711
+ Address(),
712
+ ((_a2 = session == null ? void 0 : session.checkout) == null ? void 0 : _a2.paymentType) === PaymentType.RECURRING && RecurringTip(),
534
713
  isShowStoreCheckBox && storeCheckBox(),
535
- !!errorMsg && /* @__PURE__ */ u(Info, { content: errorMsg, style: { marginTop: "12px" } }),
714
+ ErrorMessage(),
536
715
  !hidePaymentButton && Button()
537
716
  ] }) });
538
717
  };
539
718
  const fastPaymentCardForm = () => {
540
- var _a2, _b2, _c2, _d2, _e2;
719
+ var _a2, _b2, _c2, _d2;
541
720
  return /* @__PURE__ */ u(Form, { form, ref: setFormRef, onFormChange: (form2) => setForm(form2), children: [
542
721
  /* @__PURE__ */ u("div", { className: normalizedClass(COMMON_CLASS_NAME, bem()), style: cardStyle, children: [
543
- /* @__PURE__ */ u("div", { className: fieldClassNames, children: /* @__PURE__ */ u(EmailField, { ref: emailFieldRef, value: form.email, disabled: !!disabledEmail.current }) }),
722
+ Email(),
544
723
  /* @__PURE__ */ u("div", { className: bem("card-selector-wrapper"), children: [
545
724
  /* @__PURE__ */ u(
546
725
  CardSelector,
@@ -558,50 +737,47 @@ const Card = w((props, ref) => {
558
737
  {
559
738
  className: fieldClassNames,
560
739
  style: { flex: 1, marginLeft: "12px" },
561
- security: ((_e2 = session == null ? void 0 : session.checkout) == null ? void 0 : _e2.sessionMode) === SessionMode.EMBEDDED,
740
+ security,
562
741
  ref: cardSecurityCodeFieldRef
563
742
  }
564
743
  )
565
744
  ] })
566
745
  ] }),
567
- requiredBill && /* @__PURE__ */ u("div", { className: bem("address"), children: /* @__PURE__ */ u(
568
- AddressField,
569
- {
570
- ref: addressFieldRef,
571
- value: form.address,
572
- onAddressChange: (value) => setForm(Object.assign(form, { address: value }))
573
- }
574
- ) }),
575
- !!errorMsg && /* @__PURE__ */ u(Info, { content: errorMsg, style: { marginTop: "12px" } }),
746
+ tokenAddressFilled && Address(),
747
+ ErrorMessage(),
576
748
  !hidePaymentButton && Button()
577
749
  ] });
578
750
  };
579
- return /* @__PURE__ */ u(
580
- CoreContext.Provider,
581
- {
582
- value: {
751
+ return /* @__PURE__ */ u(CoreContext.Provider, { value: { i18n }, children: isCheckoutEnabled && i18n.ready.value && /* @__PURE__ */ u(b, { children: [
752
+ /* @__PURE__ */ u(
753
+ SecuredFieldsProvider,
754
+ {
755
+ ref: SFPRef,
583
756
  i18n,
584
- session
585
- },
586
- children: sessionReady && isCheckoutEnabled && i18n.ready.value && /* @__PURE__ */ u(
587
- SecuredFieldsProvider,
588
- {
589
- ref: SFPRef,
590
- i18n,
591
- sessionMode: session.checkout.sessionMode,
592
- supportedCardBrands,
593
- style: defaultInputStyleConfig,
594
- onFocus: onFieldsFocus,
595
- onBinValue: onBinValueChanged,
596
- onAfterPayment,
597
- onPaymentError,
598
- onPaymentTimeout: ({ message }) => onTimeout(i18n.get(message)),
599
- onValidStatusChanged: onFieldValidStatusChanged,
600
- children: showFastPaymentForm ? fastPaymentCardForm() : cardForm()
601
- }
602
- )
603
- }
604
- );
757
+ sessionMode: (_g = session.checkout) == null ? void 0 : _g.sessionMode,
758
+ supportedCardBrands,
759
+ style: inputStyle || defaultInputStyleConfig,
760
+ onFocus: onFieldsFocus,
761
+ onBinValue: onBinValueChanged,
762
+ onBrand,
763
+ onAfterPayment,
764
+ onPaymentError,
765
+ onPaymentTimeout: ({ message }) => onTimeout(i18n.get(message)),
766
+ onValidStatusChanged: onFieldValidStatusChanged,
767
+ onValidated,
768
+ children: showFastPaymentForm ? fastPaymentCardForm() : cardForm()
769
+ }
770
+ ),
771
+ /* @__PURE__ */ u(
772
+ ThreeDSAuth,
773
+ {
774
+ show: showThreeDSModal,
775
+ theme: (_h = session == null ? void 0 : session.checkout) == null ? void 0 : _h.theme,
776
+ onClose: handleCloseThreeDSModal,
777
+ ...threeDSInfo
778
+ }
779
+ )
780
+ ] }) });
605
781
  });
606
782
  export {
607
783
  Card