@paykka/card-checkout-ui 0.7.0 → 0.9.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 (266) hide show
  1. package/dist/card-checkout-ui.js +27 -20
  2. package/dist/card-checkout-ui.umd.cjs +27 -20
  3. package/dist/es/_commonjsHelpers.js +1 -0
  4. package/dist/es/api/http.js +19 -21
  5. package/dist/es/api/index.js +1 -0
  6. package/dist/es/api/modules/ali-pay/index.js +19 -11
  7. package/dist/es/api/modules/apple-pay/index.js +10 -26
  8. package/dist/es/api/modules/boost/index.js +56 -0
  9. package/dist/es/api/modules/card/index.js +17 -11
  10. package/dist/es/api/modules/checkout/index.js +6 -6
  11. package/dist/es/api/modules/checkout/map.js +29 -1
  12. package/dist/es/api/modules/gcash/index.js +56 -0
  13. package/dist/es/api/modules/get-browser-params.js +2 -2
  14. package/dist/es/api/modules/google-pay/index.js +10 -26
  15. package/dist/es/api/modules/grab-pay/index.js +56 -0
  16. package/dist/es/api/modules/index.js +1 -0
  17. package/dist/es/api/modules/line-pay/index.js +56 -0
  18. package/dist/es/api/modules/may-bank-qr-pay/index.js +56 -0
  19. package/dist/es/api/modules/nine-pay/index.js +56 -0
  20. package/dist/es/api/modules/paymaya/index.js +56 -0
  21. package/dist/es/api/modules/sepa/index.js +19 -11
  22. package/dist/es/api/modules/shopee-pay/index.js +56 -0
  23. package/dist/es/api/modules/tng-wallet/index.js +56 -0
  24. package/dist/es/api/modules/wechat-pay/index.js +18 -31
  25. package/dist/es/components/AccordionItem/AccordionItem.js +36 -0
  26. package/dist/es/components/AliPay/index.js +58 -60
  27. package/dist/es/components/ApplePay/index.js +29 -43
  28. package/dist/es/components/Boost/index.js +322 -0
  29. package/dist/es/components/Card/index.js +89 -75
  30. package/dist/es/components/CardBrands/index.js +2 -2
  31. package/dist/es/components/CardNumberField/index.js +113 -106
  32. package/dist/es/components/DropIn/index.js +365 -0
  33. package/dist/es/components/GooglePay/index.js +15 -7
  34. package/dist/es/components/GrabPay/index.js +322 -0
  35. package/dist/es/components/GuideCard/index.js +43 -0
  36. package/dist/es/components/LinePay/index.js +322 -0
  37. package/dist/es/components/MayBankQRPay/index.js +322 -0
  38. package/dist/es/components/NinePay/index.js +322 -0
  39. package/dist/es/components/SecuredIframe/index.js +3 -2
  40. package/dist/es/components/Sepa/index.js +8 -9
  41. package/dist/es/components/ShopeePay/index.js +322 -0
  42. package/dist/es/components/SubmitButton/index.js +6 -20
  43. package/dist/es/components/TNGWallet/index.js +322 -0
  44. package/dist/es/components/WechatPay/index.js +51 -61
  45. package/dist/es/components/business/QRCodeModal/QRCodeModal.js +41 -0
  46. package/dist/es/components/business/QRCodeModal/index.js +6 -0
  47. package/dist/es/components/business/QRCodeModal/qr-code-modal.js +1 -0
  48. package/dist/es/components/business/QRCodeModal/type.js +1 -0
  49. package/dist/es/components/business/index.js +6 -0
  50. package/dist/es/components/index.js +10 -0
  51. package/dist/es/components/internal/Accordion/Accordion.js +14 -0
  52. package/dist/es/components/internal/Accordion/accordion2.js +1 -0
  53. package/dist/es/components/internal/Accordion/accordionTransition.js +26 -0
  54. package/dist/es/components/internal/Accordion/index.js +7 -0
  55. package/dist/es/components/internal/Accordion/type.js +10 -0
  56. package/dist/es/components/internal/Modal/Modal.js +17 -3
  57. package/dist/es/components/internal/Modal/index.js +1 -0
  58. package/dist/es/components/internal/Modal/type.js +1 -0
  59. package/dist/es/components/internal/QRCode/QRCode.js +31 -0
  60. package/dist/es/components/internal/QRCode/index.js +4 -0
  61. package/dist/es/components/internal/QRCode/type.js +1 -0
  62. package/dist/es/components/internal/icons/IconBoost.js +63 -0
  63. package/dist/es/components/internal/icons/IconCard.js +3 -0
  64. package/dist/es/components/internal/icons/IconCard2.js +60 -0
  65. package/dist/es/components/internal/icons/IconGCash.js +196 -0
  66. package/dist/es/components/internal/icons/IconGcashComplete.js +184 -0
  67. package/dist/es/components/internal/icons/IconGrabPay.js +59 -0
  68. package/dist/es/components/internal/icons/IconLinePay.js +99 -0
  69. package/dist/es/components/internal/icons/IconMayBankQRPay.js +69 -0
  70. package/dist/es/components/internal/icons/IconNinePay.js +255 -0
  71. package/dist/es/components/internal/icons/IconPaymaya.js +114 -0
  72. package/dist/es/components/internal/icons/IconRedirect.js +58 -0
  73. package/dist/es/components/internal/icons/IconScan.js +102 -0
  74. package/dist/es/components/internal/icons/IconShopeePay.js +108 -0
  75. package/dist/es/components/internal/icons/IconTNGWallet.js +119 -0
  76. package/dist/es/components/internal/icons/IconUnionPay.js +65 -0
  77. package/dist/es/components/wallets/GCash/GCash.js +356 -0
  78. package/dist/es/components/wallets/GCash/g-cash.js +1 -0
  79. package/dist/es/components/wallets/GCash/index.js +1 -0
  80. package/dist/es/components/wallets/GCash/type.js +1 -0
  81. package/dist/es/components/wallets/Paymaya/Paymaya.js +323 -0
  82. package/dist/es/components/wallets/Paymaya/index.js +1 -0
  83. package/dist/es/components/wallets/Paymaya/paymaya2.js +1 -0
  84. package/dist/es/components/wallets/Paymaya/type.js +1 -0
  85. package/dist/es/config.js +12 -12
  86. package/dist/es/constant.js +94 -4
  87. package/dist/es/core/PayKKaCheckout.js +38 -3
  88. package/dist/es/core/Session.js +24 -23
  89. package/dist/es/core/error.js +7 -0
  90. package/dist/es/core/query.js +3 -2
  91. package/dist/es/core.js +2082 -70
  92. package/dist/es/hooks/usePayState.js +3 -4
  93. package/dist/es/i18n/I18n.js +8 -2
  94. package/dist/es/i18n/locales/de-DE.js +19 -1
  95. package/dist/es/i18n/locales/en-GB.js +19 -1
  96. package/dist/es/i18n/locales/es-ES.js +19 -1
  97. package/dist/es/i18n/locales/fr-FR.js +19 -1
  98. package/dist/es/i18n/locales/ja-JP.js +19 -1
  99. package/dist/es/i18n/locales/ko-KR.js +19 -1
  100. package/dist/es/i18n/locales/pt-PT.js +19 -1
  101. package/dist/es/i18n/locales/ru-RU.js +19 -1
  102. package/dist/es/i18n/locales/zh-CN.js +19 -1
  103. package/dist/es/i18n/locales/zh-HK.js +19 -1
  104. package/dist/es/i18n/locales/zh-TW.js +19 -1
  105. package/dist/es/i18n/util.js +20 -0
  106. package/dist/es/index.js +24 -0
  107. package/dist/es/style.css +1 -1096
  108. package/dist/es/types/index.js +1 -0
  109. package/dist/es/utils/array.js +9 -0
  110. package/dist/es/utils/card-brand/brands.js +11 -1
  111. package/dist/es/utils/card-brand/index.js +4 -3
  112. package/dist/es/utils/card-brand/luhn.js +25 -0
  113. package/dist/es/utils/date.js +25 -0
  114. package/dist/es/utils/detect.js +6 -0
  115. package/dist/es/utils/format.js +28 -12
  116. package/dist/es/utils/index.js +9 -1
  117. package/dist/es/utils/location.js +37 -0
  118. package/dist/es/utils/object.js +14 -0
  119. package/dist/es/utils/redirect.js +32 -0
  120. package/dist/es/utils/system-info/get-browser-info.js +4 -4
  121. package/dist/es/utils/system-info/get-system-info.js +11 -7
  122. package/dist/es/utils/system-info/index.js +4 -4
  123. package/dist/style.css +1 -1
  124. package/dist/types/api/http.d.ts +4 -10
  125. package/dist/types/api/modules/ali-pay/index.d.ts +2 -1
  126. package/dist/types/api/modules/apple-pay/index.d.ts +2 -1
  127. package/dist/types/api/modules/boost/index.d.ts +24 -0
  128. package/dist/types/api/modules/card/index.d.ts +1 -1
  129. package/dist/types/api/modules/checkout/index.d.ts +2 -2
  130. package/dist/types/api/modules/checkout/map.d.ts +2 -1
  131. package/dist/types/api/modules/checkout/type.d.ts +20 -2
  132. package/dist/types/api/modules/gcash/index.d.ts +24 -0
  133. package/dist/types/api/modules/get-browser-params.d.ts +2 -2
  134. package/dist/types/api/modules/google-pay/index.d.ts +2 -1
  135. package/dist/types/api/modules/grab-pay/index.d.ts +24 -0
  136. package/dist/types/api/modules/index.d.ts +9 -0
  137. package/dist/types/api/modules/line-pay/index.d.ts +24 -0
  138. package/dist/types/api/modules/may-bank-qr-pay/index.d.ts +24 -0
  139. package/dist/types/api/modules/nine-pay/index.d.ts +24 -0
  140. package/dist/types/api/modules/paymaya/index.d.ts +24 -0
  141. package/dist/types/api/modules/sepa/index.d.ts +2 -1
  142. package/dist/types/api/modules/shopee-pay/index.d.ts +24 -0
  143. package/dist/types/api/modules/tng-wallet/index.d.ts +24 -0
  144. package/dist/types/api/modules/wechat-pay/index.d.ts +2 -1
  145. package/dist/types/components/AliPay/AliPay.d.ts +2 -1
  146. package/dist/types/components/AliPay/type.d.ts +1 -2
  147. package/dist/types/components/ApplePay/ApplePay.d.ts +2 -1
  148. package/dist/types/components/ApplePay/type.d.ts +9 -6
  149. package/dist/types/components/Boost/Boost.d.ts +7 -0
  150. package/dist/types/components/Boost/index.d.ts +2 -0
  151. package/dist/types/components/Boost/type.d.ts +61 -0
  152. package/dist/types/components/Card/Card.d.ts +2 -1
  153. package/dist/types/components/Card/type.d.ts +2 -2
  154. package/dist/types/components/DropIn/DropIn.d.ts +6 -0
  155. package/dist/types/components/DropIn/components/PaymentTabs/PaymentTabs.d.ts +3 -0
  156. package/dist/types/components/DropIn/components/PaymentTabs/index.d.ts +2 -0
  157. package/dist/types/components/DropIn/components/PaymentTabs/type.d.ts +11 -0
  158. package/dist/types/components/DropIn/config.d.ts +7 -0
  159. package/dist/types/components/DropIn/index.d.ts +2 -0
  160. package/dist/types/components/DropIn/type.d.ts +57 -0
  161. package/dist/types/components/GooglePay/GooglePay.d.ts +2 -1
  162. package/dist/types/components/GooglePay/type.d.ts +20 -9
  163. package/dist/types/components/GrabPay/GrabPay.d.ts +7 -0
  164. package/dist/types/components/GrabPay/index.d.ts +2 -0
  165. package/dist/types/components/GrabPay/type.d.ts +61 -0
  166. package/dist/types/components/GuideCard/GuideCard.d.ts +3 -0
  167. package/dist/types/components/GuideCard/index.d.ts +2 -0
  168. package/dist/types/components/GuideCard/type.d.ts +4 -0
  169. package/dist/types/components/LinePay/LinePay.d.ts +7 -0
  170. package/dist/types/components/LinePay/index.d.ts +2 -0
  171. package/dist/types/components/LinePay/type.d.ts +61 -0
  172. package/dist/types/components/MayBankQRPay/MayBankQRPay.d.ts +6 -0
  173. package/dist/types/components/MayBankQRPay/index.d.ts +2 -0
  174. package/dist/types/components/MayBankQRPay/type.d.ts +61 -0
  175. package/dist/types/components/NinePay/NinePay.d.ts +6 -0
  176. package/dist/types/components/NinePay/index.d.ts +2 -0
  177. package/dist/types/components/NinePay/type.d.ts +61 -0
  178. package/dist/types/components/SecuredIframe/useSecuredInput.d.ts +1 -1
  179. package/dist/types/components/Sepa/Sepa.d.ts +2 -1
  180. package/dist/types/components/Sepa/type.d.ts +1 -2
  181. package/dist/types/components/ShopeePay/ShopeePay.d.ts +7 -0
  182. package/dist/types/components/ShopeePay/index.d.ts +2 -0
  183. package/dist/types/components/ShopeePay/type.d.ts +61 -0
  184. package/dist/types/components/SubmitButton/SubmitButton.d.ts +1 -1
  185. package/dist/types/components/TNGWallet/TNGWallet.d.ts +7 -0
  186. package/dist/types/components/TNGWallet/index.d.ts +2 -0
  187. package/dist/types/components/TNGWallet/type.d.ts +61 -0
  188. package/dist/types/components/WechatPay/WechatPay.d.ts +2 -1
  189. package/dist/types/components/WechatPay/type.d.ts +1 -2
  190. package/dist/types/components/business/QRCodeModal/QRCodeModal.d.ts +3 -0
  191. package/dist/types/components/business/QRCodeModal/index.d.ts +2 -0
  192. package/dist/types/components/business/QRCodeModal/type.d.ts +18 -0
  193. package/dist/types/components/business/index.d.ts +1 -0
  194. package/dist/types/components/index.d.ts +10 -0
  195. package/dist/types/components/internal/Accordion/Accordion.d.ts +3 -0
  196. package/dist/types/components/internal/Accordion/accordionTransition.d.ts +8 -0
  197. package/dist/types/components/internal/Accordion/components/AccordionItem/AccordionItem.d.ts +3 -0
  198. package/dist/types/components/internal/Accordion/components/AccordionItem/index.d.ts +2 -0
  199. package/dist/types/components/internal/Accordion/components/AccordionItem/type.d.ts +18 -0
  200. package/dist/types/components/internal/Accordion/index.d.ts +3 -0
  201. package/dist/types/components/internal/Accordion/type.d.ts +18 -0
  202. package/dist/types/components/internal/Modal/index.d.ts +2 -0
  203. package/dist/types/components/internal/Modal/type.d.ts +3 -1
  204. package/dist/types/components/internal/QRCode/QRCode.d.ts +2 -0
  205. package/dist/types/components/internal/QRCode/index.d.ts +2 -0
  206. package/dist/types/components/internal/QRCode/type.d.ts +9 -0
  207. package/dist/types/components/internal/icons/IconBoost.d.ts +2 -0
  208. package/dist/types/components/internal/icons/IconCard.d.ts +2 -0
  209. package/dist/types/components/internal/icons/IconCard2.d.ts +2 -0
  210. package/dist/types/components/internal/icons/IconGCash.d.ts +2 -0
  211. package/dist/types/components/internal/icons/IconGcashComplete.d.ts +2 -0
  212. package/dist/types/components/internal/icons/IconGrabPay.d.ts +2 -0
  213. package/dist/types/components/internal/icons/IconLinePay.d.ts +2 -0
  214. package/dist/types/components/internal/icons/IconMayBankQRPay.d.ts +2 -0
  215. package/dist/types/components/internal/icons/IconNinePay.d.ts +2 -0
  216. package/dist/types/components/internal/icons/IconPaymaya.d.ts +2 -0
  217. package/dist/types/components/internal/icons/IconRedirect.d.ts +2 -0
  218. package/dist/types/components/internal/icons/IconScan.d.ts +2 -0
  219. package/dist/types/components/internal/icons/IconShopeePay.d.ts +2 -0
  220. package/dist/types/components/internal/icons/IconTNGWallet.d.ts +2 -0
  221. package/dist/types/components/internal/icons/IconUnionPay.d.ts +2 -0
  222. package/dist/types/components/internal/icons/index.d.ts +14 -0
  223. package/dist/types/components/wallets/GCash/GCash.d.ts +6 -0
  224. package/dist/types/components/wallets/GCash/index.d.ts +2 -0
  225. package/dist/types/components/wallets/GCash/type.d.ts +66 -0
  226. package/dist/types/components/wallets/Paymaya/Paymaya.d.ts +6 -0
  227. package/dist/types/components/wallets/Paymaya/index.d.ts +2 -0
  228. package/dist/types/components/wallets/Paymaya/type.d.ts +61 -0
  229. package/dist/types/config.d.ts +9 -9
  230. package/dist/types/constant.d.ts +38 -2
  231. package/dist/types/core/PayKKaCheckout.d.ts +11 -0
  232. package/dist/types/core/Session.d.ts +2 -0
  233. package/dist/types/core/error.d.ts +3 -1
  234. package/dist/types/core/query.d.ts +2 -2
  235. package/dist/types/hooks/usePayState.d.ts +0 -3
  236. package/dist/types/i18n/I18n.d.ts +1 -1
  237. package/dist/types/i18n/locales/de-DE.d.ts +15 -0
  238. package/dist/types/i18n/locales/en-GB.d.ts +15 -0
  239. package/dist/types/i18n/locales/es-ES.d.ts +15 -0
  240. package/dist/types/i18n/locales/fr-FR.d.ts +15 -0
  241. package/dist/types/i18n/locales/ja-JP.d.ts +15 -0
  242. package/dist/types/i18n/locales/ko-KR.d.ts +15 -0
  243. package/dist/types/i18n/locales/pt-PT.d.ts +15 -0
  244. package/dist/types/i18n/locales/ru-RU.d.ts +15 -0
  245. package/dist/types/i18n/locales/zh-CN.d.ts +15 -0
  246. package/dist/types/i18n/locales/zh-HK.d.ts +15 -0
  247. package/dist/types/i18n/locales/zh-TW.d.ts +15 -0
  248. package/dist/types/i18n/util.d.ts +10 -0
  249. package/dist/types/index.d.ts +1 -1
  250. package/dist/types/types/index.d.ts +34 -7
  251. package/dist/types/types/message.d.ts +1 -0
  252. package/dist/types/utils/array.d.ts +1 -0
  253. package/dist/types/utils/card-brand/brands.d.ts +4 -3
  254. package/dist/types/utils/card-brand/index.d.ts +9 -6
  255. package/dist/types/utils/card-brand/luhn.d.ts +9 -0
  256. package/dist/types/utils/date.d.ts +9 -0
  257. package/dist/types/utils/detect.d.ts +1 -0
  258. package/dist/types/utils/format.d.ts +7 -1
  259. package/dist/types/utils/index.d.ts +7 -0
  260. package/dist/types/utils/location.d.ts +7 -0
  261. package/dist/types/utils/object.d.ts +1 -0
  262. package/dist/types/utils/redirect.d.ts +5 -0
  263. package/dist/types/utils/system-info/get-browser-info.d.ts +1 -1
  264. package/dist/types/utils/system-info/get-system-info.d.ts +3 -2
  265. package/dist/types/utils/system-info/index.d.ts +3 -3
  266. package/package.json +65 -63
@@ -0,0 +1,322 @@
1
+ import { w, F, A, h, y, q, u, b } from "../../core.js";
2
+ import { useBEM } from "../../hooks/useBEM.js";
3
+ import { CoreContext } from "../../core/context.js";
4
+ import "../../utils/card-brand/brands.js";
5
+ import "../../utils/system-info/get-browser-info.js";
6
+ import { cssVarPrefix, normalizedClass, formatAmount } from "../../utils/format.js";
7
+ import { redirectToPayment } from "../../utils/redirect.js";
8
+ import { isTimeoutError } from "../../api/http.js";
9
+ import { PaymentCategory, COMMON_CLASS_NAME, PaymentMethod, SessionMode } from "../../constant.js";
10
+ import { getBrowserParams } from "../../api/modules/get-browser-params.js";
11
+ import { getBoostPayInfo, boostPay } from "../../api/modules/boost/index.js";
12
+ import { PayKKaError } from "../../core/error.js";
13
+ import { hidePaymentButton } from "../../config.js";
14
+ import { usePayState } from "../../hooks/usePayState.js";
15
+ import { useRetry } from "../../hooks/useRetry.js";
16
+ import { createEmailCore, EmailField } from "../EmailField/EmailField.js";
17
+ import { createAddressCore } from "../../core/Address.js";
18
+ import { SubmitButton } from "../SubmitButton/index.js";
19
+ import "../internal/Form/type.js";
20
+ import "../internal/Form/context.js";
21
+ import "../internal/Form/FormItem.js";
22
+ import { Form } from "../internal/Form/Form.js";
23
+ import { AddressField } from "../AddressField/index.js";
24
+ import { Info } from "../internal/Info/Info.js";
25
+ import { GuideCard } from "../GuideCard/index.js";
26
+ const { bem } = useBEM("boost");
27
+ const fieldClassNames = bem("field");
28
+ const Boost = w((props, ref) => {
29
+ var _a, _b, _c, _d, _e, _f;
30
+ const {
31
+ session,
32
+ showEmail = false,
33
+ showAddress = false,
34
+ redirectMode = "auto",
35
+ core,
36
+ autoQuery = true,
37
+ showGuideCard = true
38
+ } = props;
39
+ F(ref, () => ({
40
+ stopRetry: () => {
41
+ setSubmitButtonStatus("unSubmit");
42
+ stopReFetchPayInfo();
43
+ },
44
+ startRetry: (timeout) => {
45
+ setSubmitButtonStatus("loading");
46
+ startReFetchPayInfo({ timeout });
47
+ },
48
+ updateAddress: () => {
49
+ var _a2;
50
+ if (!(fieldStatus == null ? void 0 : fieldStatus.address.show))
51
+ return;
52
+ setForm(Object.assign(form, { address: addressState.getAddressState() }));
53
+ (_a2 = addressFieldRef.current) == null ? void 0 : _a2.update(addressState.getAddressState());
54
+ },
55
+ updateEmail: () => {
56
+ var _a2;
57
+ if (!(fieldStatus == null ? void 0 : fieldStatus.email.show))
58
+ return;
59
+ setForm(Object.assign(form, { email: emailState.email }));
60
+ (_a2 = emailFieldRef.current) == null ? void 0 : _a2.update(emailState.email);
61
+ },
62
+ payment: () => {
63
+ hidePaymentButton && onSubmit();
64
+ }
65
+ }));
66
+ const addressState = createAddressCore();
67
+ const emailState = createEmailCore();
68
+ const addressFieldRef = A(null);
69
+ const emailFieldRef = A(null);
70
+ const [isCheckoutEnabled, setIsCheckoutEnabled] = h(false);
71
+ const { setErrorMsg, i18n, errorMsg, sessionReady } = usePayState(session);
72
+ const [submitButtonStatus, setSubmitButtonStatus] = h("unSubmit");
73
+ const formRef = A(null);
74
+ const [form, setForm] = h({
75
+ email: "",
76
+ address: {
77
+ country: "",
78
+ province: "",
79
+ city: "",
80
+ area: "",
81
+ postCode: "",
82
+ address1: "",
83
+ address2: ""
84
+ }
85
+ });
86
+ const [validated, setValidated] = h(false);
87
+ const [fieldStatus, setFieldStatus] = h();
88
+ const initFieldStatus = () => {
89
+ const { field, sessionMode } = session.checkout;
90
+ const { email, address } = field;
91
+ if (sessionMode === SessionMode.COMPONENT) {
92
+ if (email.disabled) {
93
+ email.show = showEmail;
94
+ }
95
+ if (showAddress && !(address == null ? void 0 : address.show)) {
96
+ address.show = true;
97
+ }
98
+ }
99
+ setFieldStatus({ ...field });
100
+ };
101
+ y(() => {
102
+ if (!sessionReady) {
103
+ return;
104
+ }
105
+ const { bill = {}, paymentMethod = [] } = (session == null ? void 0 : session.checkout) || {};
106
+ if (!paymentMethod.includes(PaymentMethod.BOOST)) {
107
+ return;
108
+ }
109
+ initFieldStatus();
110
+ setIsCheckoutEnabled(true);
111
+ form.email = bill.email ?? "";
112
+ if (autoQuery && core.processingPaymentMethod === PaymentMethod.BOOST) {
113
+ setSubmitButtonStatus("loading");
114
+ startReFetchPayInfo();
115
+ }
116
+ }, [sessionReady]);
117
+ const processOnError = (error) => {
118
+ var _a2;
119
+ (_a2 = props.onError) == null ? void 0 : _a2.call(props, error);
120
+ core.resetEnablePaymentMethod();
121
+ };
122
+ const onTimeout = q(
123
+ (message) => {
124
+ var _a2;
125
+ setErrorMsg(message || i18n.get("common.payTimeout"));
126
+ setSubmitButtonStatus("unSubmit");
127
+ (_a2 = props.onTimeout) == null ? void 0 : _a2.call(props);
128
+ core.resetEnablePaymentMethod();
129
+ },
130
+ [i18n, props.onTimeout]
131
+ );
132
+ const { start: startReFetchPayInfo, stop: stopReFetchPayInfo } = useRetry(
133
+ (timeout) => pay(true, timeout),
134
+ { onTimeout: () => onTimeout(i18n.get("common.queryTimeout")) }
135
+ );
136
+ const getPaymentParams = async () => {
137
+ return {
138
+ sessionId: session.sessionId,
139
+ clientKey: session.clientKey,
140
+ payment: {
141
+ paymentMethod: PaymentMethod.BOOST
142
+ },
143
+ bill: {
144
+ email: form.email,
145
+ ...form.address,
146
+ province: addressState.getLabel(form.address.province, addressState.getProvinceOption()) ?? form.address.province,
147
+ city: addressState.getLabel(form.address.city, addressState.getCityOptions()) ?? form.address.city
148
+ },
149
+ browser: await getBrowserParams()
150
+ };
151
+ };
152
+ const pay = async (search = false, timeout) => {
153
+ var _a2, _b2, _c2, _d2, _e2;
154
+ try {
155
+ const paymentParams = await getPaymentParams();
156
+ const requestOptions = { locale: i18n.locale, timeout };
157
+ const res = search ? await getBoostPayInfo(
158
+ { sessionId: session.sessionId, clientKey: session.clientKey },
159
+ requestOptions
160
+ ) : await boostPay(paymentParams, props.core, requestOptions);
161
+ !search && ((_a2 = props.onSubmitResponse) == null ? void 0 : _a2.call(props, res));
162
+ const { status, orderStatus, errorMessage, errorCode, payInfo } = res;
163
+ if (status === "PROCESSING") {
164
+ if (!orderStatus) {
165
+ setSubmitButtonStatus("unSubmit");
166
+ return { end: true };
167
+ } else if (orderStatus === "SUCCESS") {
168
+ setSubmitButtonStatus("success");
169
+ (_b2 = props.onSuccess) == null ? void 0 : _b2.call(props);
170
+ return { end: true };
171
+ } else if (orderStatus === "FAILURE") {
172
+ setErrorMsg(errorMessage);
173
+ setSubmitButtonStatus("unSubmit");
174
+ processOnError(new PayKKaError("API_ERROR", errorMessage, { code: errorCode }));
175
+ return { end: true };
176
+ } else if (orderStatus === "PROCESSING") {
177
+ if (!search) {
178
+ if (redirectMode === "auto" && payInfo) {
179
+ redirectToPayment(payInfo);
180
+ return { end: true };
181
+ } else {
182
+ startReFetchPayInfo();
183
+ }
184
+ }
185
+ return { end: false };
186
+ } else if (orderStatus === "CANCELED") {
187
+ setSubmitButtonStatus("unSubmit");
188
+ (_c2 = props.onTimeout) == null ? void 0 : _c2.call(props);
189
+ core.resetEnablePaymentMethod();
190
+ return { end: true };
191
+ }
192
+ } else if (status === "SUCCESS") {
193
+ setSubmitButtonStatus("success");
194
+ (_d2 = props.onSuccess) == null ? void 0 : _d2.call(props);
195
+ return { end: true };
196
+ } else if (status === "EXPIRED") {
197
+ setSubmitButtonStatus("unSubmit");
198
+ (_e2 = props.onExpired) == null ? void 0 : _e2.call(props);
199
+ return { end: true };
200
+ }
201
+ setSubmitButtonStatus("unSubmit");
202
+ return { end: true };
203
+ } catch (error) {
204
+ if (isTimeoutError(error)) {
205
+ if (search) {
206
+ return { end: false };
207
+ } else {
208
+ onTimeout();
209
+ return { end: true };
210
+ }
211
+ } else {
212
+ const message = error.i18nKey ? i18n.get(error.i18nKey) : error.message;
213
+ setErrorMsg(message);
214
+ processOnError(new PayKKaError("API_ERROR", message, { code: error.code, cause: error }));
215
+ setSubmitButtonStatus("unSubmit");
216
+ return { end: true };
217
+ }
218
+ }
219
+ };
220
+ const validateForm = () => {
221
+ var _a2;
222
+ (_a2 = formRef.current) == null ? void 0 : _a2.validate(void 0, false).then(() => {
223
+ setValidated(true);
224
+ }).catch(() => {
225
+ setValidated(false);
226
+ });
227
+ };
228
+ y(() => {
229
+ validateForm();
230
+ }, [form]);
231
+ const onSubmit = async () => {
232
+ var _a2;
233
+ setErrorMsg("");
234
+ (_a2 = formRef.current) == null ? void 0 : _a2.validate(async (errors) => {
235
+ var _a3;
236
+ (fieldStatus == null ? void 0 : fieldStatus.address.show) && addressState.setValidateAllFields(true);
237
+ (_a3 = props.onSubmit) == null ? void 0 : _a3.call(props, errors);
238
+ if (errors) {
239
+ setSubmitButtonStatus("unSubmit");
240
+ return;
241
+ }
242
+ setErrorMsg("");
243
+ setSubmitButtonStatus("loading");
244
+ await pay();
245
+ });
246
+ };
247
+ const setFormRef = (dom) => {
248
+ formRef.current = dom;
249
+ dom && validateForm();
250
+ };
251
+ const Button = () => {
252
+ var _a2;
253
+ const transAmount = (_a2 = session == null ? void 0 : session.checkout) == null ? void 0 : _a2.transAmount;
254
+ const amountText = (transAmount == null ? void 0 : transAmount.amount) ? formatAmount(transAmount).jointSymbol() : "";
255
+ const text = i18n.get("common.pay") + (amountText ? ` ${amountText}` : "");
256
+ return /* @__PURE__ */ u(
257
+ SubmitButton,
258
+ {
259
+ className: bem("button"),
260
+ status: submitButtonStatus,
261
+ text,
262
+ loadingText: i18n.get("common.payProcessing"),
263
+ successText: i18n.get("common.paySuccess"),
264
+ onClick: onSubmit,
265
+ verified: validated
266
+ }
267
+ );
268
+ };
269
+ const Email = () => {
270
+ return /* @__PURE__ */ u(b, { children: (fieldStatus == null ? void 0 : fieldStatus.email.show) && /* @__PURE__ */ u("div", { className: fieldClassNames, children: /* @__PURE__ */ u(
271
+ EmailField,
272
+ {
273
+ ref: emailFieldRef,
274
+ value: form.email,
275
+ disabled: fieldStatus == null ? void 0 : fieldStatus.email.disabled
276
+ }
277
+ ) }) });
278
+ };
279
+ const formStyle = {
280
+ [cssVarPrefix("button-bg-color")]: (_a = session == null ? void 0 : session.colors) == null ? void 0 : _a.primary,
281
+ [cssVarPrefix("button-bg-color-hover")]: (_b = session == null ? void 0 : session.colors) == null ? void 0 : _b.primaryHover,
282
+ [cssVarPrefix("button-bg-color-active")]: (_c = session == null ? void 0 : session.colors) == null ? void 0 : _c.primaryActive,
283
+ [cssVarPrefix("button-text-color")]: (_e = (_d = session == null ? void 0 : session.checkout) == null ? void 0 : _d.theme) == null ? void 0 : _e.payButtonTextColor,
284
+ [cssVarPrefix("input-color")]: (_f = session == null ? void 0 : session.colors) == null ? void 0 : _f.primary
285
+ };
286
+ const ErrorMessage = () => {
287
+ return /* @__PURE__ */ u(b, { children: !!errorMsg && /* @__PURE__ */ u(Info, { content: errorMsg, style: { marginTop: "12px" } }) });
288
+ };
289
+ const Address = () => {
290
+ var _a2, _b2;
291
+ return /* @__PURE__ */ u(b, { children: (fieldStatus == null ? void 0 : fieldStatus.address.show) && /* @__PURE__ */ u("div", { className: fieldClassNames, children: /* @__PURE__ */ u(
292
+ AddressField,
293
+ {
294
+ ref: addressFieldRef,
295
+ value: form.address,
296
+ 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),
297
+ onAddressChange: (value) => setForm(Object.assign(form, { address: value }))
298
+ }
299
+ ) }) });
300
+ };
301
+ return /* @__PURE__ */ u(
302
+ CoreContext.Provider,
303
+ {
304
+ value: {
305
+ i18n,
306
+ session
307
+ },
308
+ children: isCheckoutEnabled && i18n.ready.value && /* @__PURE__ */ u(b, { children: [
309
+ showGuideCard && /* @__PURE__ */ u(GuideCard, { type: PaymentCategory.BOOST }),
310
+ /* @__PURE__ */ u(Form, { form, ref: setFormRef, onFormChange: (form2) => setForm(form2), children: /* @__PURE__ */ u("div", { className: normalizedClass(COMMON_CLASS_NAME, bem()), style: formStyle, children: [
311
+ Email(),
312
+ Address(),
313
+ ErrorMessage(),
314
+ !hidePaymentButton && Button()
315
+ ] }) })
316
+ ] })
317
+ }
318
+ );
319
+ });
320
+ export {
321
+ Boost
322
+ };
@@ -1,10 +1,10 @@
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, COMMON_CLASS_NAME, CardPaymentMethods, PaymentMethod } from "../../constant.js";
3
+ import { PaymentType, SessionMode, CardPaymentMethods, COMMON_CLASS_NAME, PaymentMethod } from "../../constant.js";
4
+ import { intersection } from "../../utils/index.js";
4
5
  import { getBrowserParams } from "../../api/modules/get-browser-params.js";
5
6
  import { getCardPayInfo, cardPay } from "../../api/modules/card/index.js";
6
7
  import { CoreContext } from "../../core/context.js";
7
- import { intersection } from "../../utils/index.js";
8
8
  import { PayKKaError } from "../../core/error.js";
9
9
  import { hidePaymentButton } from "../../config.js";
10
10
  import { defaultInputStyleConfig } from "../../types/index.js";
@@ -32,12 +32,11 @@ import { EFieldType, SecuredFieldsProvider } from "../SecuredFieldsProvider/inde
32
32
  import { SubmitButton } from "../SubmitButton/index.js";
33
33
  import { ThreeDSAuth } from "../ThreeDS/index.js";
34
34
  import { CombinedCardInfo } from "../CombinedCardInfo/index.js";
35
- import { cssVarPrefix, normalizedClass, trimAll, formatAmount } from "../../utils/format.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
38
  import { createPromise } from "../../utils/create-promise.js";
40
- import { isUndefined } from "../../utils/is.js";
39
+ import { cssVarPrefix, 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) => {
@@ -51,10 +50,12 @@ const Card = w((props, ref) => {
51
50
  showAddress = false,
52
51
  threeDSFrame,
53
52
  styles,
54
- enable3DSModal = true
53
+ enable3DSModal = true,
54
+ isDropIn,
55
+ core
55
56
  } = props;
56
- let addressState = createAddressCore();
57
- let emailState = createEmailCore();
57
+ const addressState = createAddressCore();
58
+ const emailState = createEmailCore();
58
59
  const { i18n, fraudDetection, sessionReady } = usePayState(session);
59
60
  const addressFieldRef = A(null);
60
61
  const emailFieldRef = A(null);
@@ -102,6 +103,8 @@ const Card = w((props, ref) => {
102
103
  },
103
104
  updateEmail: () => {
104
105
  var _a2;
106
+ if (!(fieldStatus == null ? void 0 : fieldStatus.email.show))
107
+ return;
105
108
  setForm(Object.assign(form, { email: emailState.email }));
106
109
  (_a2 = emailFieldRef.current) == null ? void 0 : _a2.update(emailState.email);
107
110
  },
@@ -116,18 +119,19 @@ const Card = w((props, ref) => {
116
119
  };
117
120
  };
118
121
  const initFieldStatus = () => {
119
- const field = session.checkout.field;
122
+ const { field, sessionMode } = session.checkout;
120
123
  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;
124
+ if (sessionMode === SessionMode.COMPONENT) {
125
+ if (email.disabled) {
126
+ email.show = showEmail;
127
+ }
128
+ if (showAddress && !(address == null ? void 0 : address.show)) {
129
+ address.show = true;
130
+ }
131
+ if (showHolderName && !(holderName == null ? void 0 : holderName.show)) {
132
+ holderName.show = true;
133
+ holderName.disabled = true;
134
+ }
131
135
  }
132
136
  setFieldStatus({ ...field });
133
137
  };
@@ -139,10 +143,18 @@ const Card = w((props, ref) => {
139
143
  input && setInputStyle(input);
140
144
  };
141
145
  y(() => {
146
+ var _a2, _b2;
142
147
  if (!sessionReady) {
143
148
  return;
144
149
  }
145
150
  const { status, paymentMethod = [], bill = {}, sessionMode } = (session == null ? void 0 : session.checkout) || {};
151
+ if (sessionMode === SessionMode.DROP_IN && !isDropIn) {
152
+ (_b2 = (_a2 = props.core.config).onInitError) == null ? void 0 : _b2.call(
153
+ _a2,
154
+ new PayKKaError("ERROR", "Please send the correct session when creating the checkout")
155
+ );
156
+ return;
157
+ }
146
158
  if (!intersection(paymentMethod, CardPaymentMethods).length) {
147
159
  return;
148
160
  }
@@ -150,12 +162,7 @@ const Card = w((props, ref) => {
150
162
  initElementStyles();
151
163
  setSecurity(sessionMode !== SessionMode.HOSTED);
152
164
  form.email = bill.email ?? "";
153
- setSupportedCardBrands(
154
- cardBrandCodes.filter((code) => {
155
- var _a2;
156
- return (_a2 = session == null ? void 0 : session.checkout) == null ? void 0 : _a2.paymentMethod.includes(code);
157
- })
158
- );
165
+ setSupportedCardBrands(intersection(cardBrandCodes, paymentMethod || []));
159
166
  setIsCheckoutEnabled(true);
160
167
  if (status === "SUCCESS") {
161
168
  setSubmitButtonStatus("success");
@@ -168,6 +175,7 @@ const Card = w((props, ref) => {
168
175
  setErrorMsg(message || i18n.get("common.payTimeout"));
169
176
  setSubmitButtonStatus("unSubmit");
170
177
  (_a2 = props.onTimeout) == null ? void 0 : _a2.call(props);
178
+ core.resetEnablePaymentMethod();
171
179
  },
172
180
  [i18n, props.onTimeout]
173
181
  );
@@ -175,6 +183,11 @@ const Card = w((props, ref) => {
175
183
  var _a2;
176
184
  (_a2 = props.onSuccess) == null ? void 0 : _a2.call(props, getPaymentSuccessData());
177
185
  };
186
+ const processOnError = (error) => {
187
+ var _a2;
188
+ (_a2 = props.onError) == null ? void 0 : _a2.call(props, error);
189
+ core.resetEnablePaymentMethod();
190
+ };
178
191
  const { start: startReFetchPayInfo } = useRetry((timeout) => pay(true, timeout), {
179
192
  onTimeout: () => onTimeout(i18n.get("common.queryTimeout"))
180
193
  });
@@ -273,7 +286,7 @@ const Card = w((props, ref) => {
273
286
  };
274
287
  };
275
288
  async function pay(search = false, timeout) {
276
- var _a2, _b2;
289
+ var _a2, _b2, _c2, _d2;
277
290
  try {
278
291
  const paymentParams = await getPaymentParams();
279
292
  if (!search && security) {
@@ -281,10 +294,16 @@ const Card = w((props, ref) => {
281
294
  return { end: true };
282
295
  }
283
296
  const options = { locale: i18n.locale, timeout };
284
- const res = search ? await getCardPayInfo(
285
- { sessionId: session.sessionId, clientKey: session.clientKey },
286
- options
287
- ) : await cardPay(paymentParams, options);
297
+ let res = {};
298
+ if (search) {
299
+ res = await getCardPayInfo(
300
+ { sessionId: session.sessionId, clientKey: session.clientKey },
301
+ options
302
+ );
303
+ } else {
304
+ const extraParams = (_c2 = (_b2 = core.config)._getExtraParams) == null ? void 0 : _c2.call(_b2, "payment", paymentParams.payment.paymentMethod);
305
+ res = await cardPay(paymentParams, extraParams, options);
306
+ }
288
307
  return processAfterPayment(res, search);
289
308
  } catch (error) {
290
309
  if (isTimeoutError(error)) {
@@ -297,7 +316,7 @@ const Card = w((props, ref) => {
297
316
  } else {
298
317
  const message = error.i18nKey ? i18n.get(error.i18nKey) : error.message;
299
318
  setErrorMsg(message);
300
- (_b2 = props.onError) == null ? void 0 : _b2.call(props, new PayKKaError("API_ERROR", message, { code: error.code, cause: error }));
319
+ (_d2 = props.onError) == null ? void 0 : _d2.call(props, new PayKKaError("API_ERROR", message, { code: error.code, cause: error }));
301
320
  setSubmitButtonStatus("unSubmit");
302
321
  stopReFetchCardPay3DSInfo();
303
322
  return { end: true };
@@ -326,7 +345,7 @@ const Card = w((props, ref) => {
326
345
  checkThreeDS();
327
346
  };
328
347
  const processAfterPayment = (res, search = false) => {
329
- var _a2, _b2, _c2;
348
+ var _a2, _b2;
330
349
  const { status, orderStatus, errorMessage, errorCode, threeDSUrl } = res;
331
350
  if (status === "PROCESSING") {
332
351
  if (!orderStatus) {
@@ -340,10 +359,10 @@ const Card = w((props, ref) => {
340
359
  } else if (orderStatus === "FAILURE") {
341
360
  setErrorMsg(errorMessage);
342
361
  setSubmitButtonStatus("unSubmit");
343
- (_a2 = props.onError) == null ? void 0 : _a2.call(props, new PayKKaError("API_ERROR", errorMessage, { code: errorCode }));
362
+ processOnError(new PayKKaError("API_ERROR", errorMessage, { code: errorCode }));
344
363
  } else if (orderStatus === "AUTHORIZED") {
345
364
  setSubmitButtonStatus("unSubmit");
346
- (_b2 = props.onAuthorized) == null ? void 0 : _b2.call(props);
365
+ (_a2 = props.onAuthorized) == null ? void 0 : _a2.call(props);
347
366
  } else if (orderStatus === "IN_THREED") {
348
367
  processThreeDS(threeDSUrl, false);
349
368
  } else if (orderStatus === "IN_PREVIOUS_THREED") {
@@ -356,19 +375,17 @@ const Card = w((props, ref) => {
356
375
  return { end: true };
357
376
  } else if (status === "EXPIRED") {
358
377
  setSubmitButtonStatus("unSubmit");
359
- (_c2 = props.onExpired) == null ? void 0 : _c2.call(props);
378
+ (_b2 = props.onExpired) == null ? void 0 : _b2.call(props);
360
379
  return { end: true };
361
380
  }
362
381
  setSubmitButtonStatus("unSubmit");
363
- processOnSuccess();
364
382
  return { end: true };
365
383
  };
366
384
  const processPaymentError = (error) => {
367
- var _a2;
368
385
  const message = error.i18nKey ? i18n.get(error.i18nKey) : error.message;
369
386
  setErrorMsg(message);
370
387
  setSubmitButtonStatus("unSubmit");
371
- (_a2 = props.onError) == null ? void 0 : _a2.call(props, new PayKKaError("API_ERROR", message, { code: error.code, cause: error }));
388
+ processOnError(new PayKKaError("API_ERROR", message, { code: error.code, cause: error }));
372
389
  };
373
390
  const validateForm = () => {
374
391
  var _a2;
@@ -382,11 +399,10 @@ const Card = w((props, ref) => {
382
399
  validateForm();
383
400
  }, [form]);
384
401
  const Button = () => {
385
- const { transAmount } = (session == null ? void 0 : session.checkout) ?? {};
386
- let { symbol = "", amount = "", digits } = transAmount ?? {};
387
- if (amount && !isUndefined(digits))
388
- amount = formatAmount(+amount, digits);
389
- const text = i18n.get("common.pay") + (Number(amount) ? ` ${symbol}${amount}` : "");
402
+ var _a2;
403
+ const transAmount = (_a2 = session == null ? void 0 : session.checkout) == null ? void 0 : _a2.transAmount;
404
+ const amountText = (transAmount == null ? void 0 : transAmount.amount) ? formatAmount(transAmount).jointSymbol() : "";
405
+ const text = i18n.get("common.pay") + (amountText ? ` ${amountText}` : "");
390
406
  return /* @__PURE__ */ u(
391
407
  SubmitButton,
392
408
  {
@@ -400,7 +416,7 @@ const Card = w((props, ref) => {
400
416
  }
401
417
  );
402
418
  };
403
- const cardStyle = {
419
+ const formStyle = {
404
420
  [cssVarPrefix("button-bg-color")]: (_a = session == null ? void 0 : session.colors) == null ? void 0 : _a.primary,
405
421
  [cssVarPrefix("button-bg-color-hover")]: (_b = session == null ? void 0 : session.colors) == null ? void 0 : _b.primaryHover,
406
422
  [cssVarPrefix("button-bg-color-active")]: (_c = session == null ? void 0 : session.colors) == null ? void 0 : _c.primaryActive,
@@ -415,7 +431,7 @@ const Card = w((props, ref) => {
415
431
  }
416
432
  );
417
433
  async function checkThreeDS(search = false, timeout = 2e4) {
418
- var _a2, _b2, _c2, _d2;
434
+ var _a2, _b2, _c2;
419
435
  if (!session)
420
436
  return { end: true };
421
437
  try {
@@ -436,10 +452,10 @@ const Card = w((props, ref) => {
436
452
  } else if (orderStatus === "FAILURE") {
437
453
  setErrorMsg(errorMessage);
438
454
  setSubmitButtonStatus("unSubmit");
439
- (_a2 = props.onError) == null ? void 0 : _a2.call(props, new PayKKaError("API_ERROR", errorMessage, { code: errorCode }));
455
+ processOnError(new PayKKaError("API_ERROR", errorMessage, { code: errorCode }));
440
456
  } else if (orderStatus === "AUTHORIZED") {
441
457
  setSubmitButtonStatus("unSubmit");
442
- (_b2 = props.onAuthorized) == null ? void 0 : _b2.call(props);
458
+ (_a2 = props.onAuthorized) == null ? void 0 : _a2.call(props);
443
459
  } else if (orderStatus === "IN_THREED") {
444
460
  setSubmitButtonStatus("loading");
445
461
  !search && startReFetchCardPay3DSInfo();
@@ -459,7 +475,7 @@ const Card = w((props, ref) => {
459
475
  return { end: true };
460
476
  } else if (status === "EXPIRED") {
461
477
  setSubmitButtonStatus("unSubmit");
462
- (_c2 = props.onExpired) == null ? void 0 : _c2.call(props);
478
+ (_b2 = props.onExpired) == null ? void 0 : _b2.call(props);
463
479
  stopReFetchCardPay3DSInfo();
464
480
  return { end: true };
465
481
  }
@@ -478,7 +494,7 @@ const Card = w((props, ref) => {
478
494
  } else {
479
495
  const message = error.i18nKey ? i18n.get(error.i18nKey) : error.message;
480
496
  setErrorMsg(message);
481
- (_d2 = props.onError) == null ? void 0 : _d2.call(props, new PayKKaError("API_ERROR", message, { code: error.code, cause: error }));
497
+ (_c2 = props.onError) == null ? void 0 : _c2.call(props, new PayKKaError("API_ERROR", message, { code: error.code, cause: error }));
482
498
  setSubmitButtonStatus("unSubmit");
483
499
  stopReFetchCardPay3DSInfo();
484
500
  return { end: true };
@@ -704,7 +720,7 @@ const Card = w((props, ref) => {
704
720
  }, [splitCardInfo, security]);
705
721
  const cardForm = () => {
706
722
  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: [
723
+ return /* @__PURE__ */ u(Form, { form, ref: setFormRef, onFormChange: (form2) => setForm(form2), children: /* @__PURE__ */ u("div", { className: normalizedClass(COMMON_CLASS_NAME, bem()), style: formStyle, children: [
708
724
  Email(),
709
725
  CardInfo(),
710
726
  (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 }) }),
@@ -717,36 +733,34 @@ const Card = w((props, ref) => {
717
733
  };
718
734
  const fastPaymentCardForm = () => {
719
735
  var _a2, _b2, _c2, _d2;
720
- return /* @__PURE__ */ u(Form, { form, ref: setFormRef, onFormChange: (form2) => setForm(form2), children: [
721
- /* @__PURE__ */ u("div", { className: normalizedClass(COMMON_CLASS_NAME, bem()), style: cardStyle, children: [
722
- Email(),
723
- /* @__PURE__ */ u("div", { className: bem("card-selector-wrapper"), children: [
724
- /* @__PURE__ */ u(
725
- CardSelector,
726
- {
727
- 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,
728
- cardList: (_d2 = session == null ? void 0 : session.checkout) == null ? void 0 : _d2.tokens,
729
- onClickEdit: onEditOtherCard,
730
- onClickChange: onClickChangeCard,
731
- onCardChange,
732
- style: { flex: 2, marginRight: "12px" }
733
- }
734
- ),
735
- /* @__PURE__ */ u(
736
- CardSecurityCodeField,
737
- {
738
- className: fieldClassNames,
739
- style: { flex: 1, marginLeft: "12px" },
740
- security,
741
- ref: cardSecurityCodeFieldRef
742
- }
743
- )
744
- ] })
736
+ return /* @__PURE__ */ u(Form, { form, ref: setFormRef, onFormChange: (form2) => setForm(form2), children: /* @__PURE__ */ u("div", { className: normalizedClass(COMMON_CLASS_NAME, bem()), style: formStyle, children: [
737
+ Email(),
738
+ /* @__PURE__ */ u("div", { className: bem("card-selector-wrapper"), children: [
739
+ /* @__PURE__ */ u(
740
+ CardSelector,
741
+ {
742
+ 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,
743
+ cardList: (_d2 = session == null ? void 0 : session.checkout) == null ? void 0 : _d2.tokens,
744
+ onClickEdit: onEditOtherCard,
745
+ onClickChange: onClickChangeCard,
746
+ onCardChange,
747
+ style: { flex: 2, marginRight: "12px" }
748
+ }
749
+ ),
750
+ /* @__PURE__ */ u(
751
+ CardSecurityCodeField,
752
+ {
753
+ className: fieldClassNames,
754
+ style: { flex: 1, marginLeft: "12px" },
755
+ security,
756
+ ref: cardSecurityCodeFieldRef
757
+ }
758
+ )
745
759
  ] }),
746
760
  tokenAddressFilled && Address(),
747
761
  ErrorMessage(),
748
762
  !hidePaymentButton && Button()
749
- ] });
763
+ ] }) });
750
764
  };
751
765
  return /* @__PURE__ */ u(CoreContext.Provider, { value: { i18n }, children: isCheckoutEnabled && i18n.ready.value && /* @__PURE__ */ u(b, { children: [
752
766
  /* @__PURE__ */ u(