@paykka/card-checkout-ui 0.18.0 → 0.21.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 (141) hide show
  1. package/dist/card-checkout-ui.js +15 -15
  2. package/dist/card-checkout-ui.umd.cjs +15 -15
  3. package/dist/es/api/modules/checkout/map.js +1 -1
  4. package/dist/es/api/modules/get-browser-params.js +1 -1
  5. package/dist/es/components/Card/index.js +48 -31
  6. package/dist/es/components/DropIn/index.js +21 -5
  7. package/dist/es/components/GuideCard/index.js +7 -50
  8. package/dist/es/components/Sepa/index.js +2 -1
  9. package/dist/es/components/business/QRCodeContent/QRCodeContent.js +68 -0
  10. package/dist/es/components/business/QRCodeContent/index.js +8 -0
  11. package/dist/es/components/business/QRCodeModal/QRCodeModal.js +5 -44
  12. package/dist/es/components/business/QRCodeModal/index.js +2 -1
  13. package/dist/es/components/business/index.js +2 -1
  14. package/dist/es/components/index.js +3 -1
  15. package/dist/es/components/internal/Button/Button2.js +2 -2
  16. package/dist/es/components/internal/icons/IconAlipay.js +43 -0
  17. package/dist/es/components/internal/icons/IconAlipayHK.js +66 -0
  18. package/dist/es/components/wallets/Alipay/Alipay.js +148 -0
  19. package/dist/es/components/wallets/Alipay/index.js +1 -0
  20. package/dist/es/components/wallets/Alipay/type.js +1 -0
  21. package/dist/es/components/wallets/AlipayHK/AlipayHK.js +148 -0
  22. package/dist/es/components/wallets/AlipayHK/alipay-hk.js +1 -0
  23. package/dist/es/components/wallets/AlipayHK/index.js +1 -0
  24. package/dist/es/components/wallets/AlipayHK/type.js +1 -0
  25. package/dist/es/components/wallets/{AliPay/AliPay.js → AlipayPlus/AlipayPlus.js} +13 -15
  26. package/dist/es/components/wallets/AlipayPlus/ali-pay-plus.js +1 -0
  27. package/dist/es/components/wallets/AlipayPlus/index.js +1 -0
  28. package/dist/es/components/wallets/AlipayPlus/type.js +1 -0
  29. package/dist/es/components/wallets/Bancontact/Bancontact.js +4 -3
  30. package/dist/es/components/wallets/Blik/Blik.js +4 -3
  31. package/dist/es/components/wallets/Doku/Doku.js +2 -1
  32. package/dist/es/components/wallets/EPS/EPS.js +4 -3
  33. package/dist/es/components/wallets/GCash/GCash.js +2 -0
  34. package/dist/es/components/wallets/GoPay/GoPay.js +2 -1
  35. package/dist/es/components/wallets/IDeal/IDeal.js +4 -3
  36. package/dist/es/components/wallets/Jenius/Jenius.js +2 -1
  37. package/dist/es/components/wallets/LinkAja/LinkAja.js +2 -1
  38. package/dist/es/components/wallets/NuPay/NuPay.js +2 -1
  39. package/dist/es/components/wallets/OVO/OVO.js +2 -1
  40. package/dist/es/components/wallets/P24/P24.js +2 -1
  41. package/dist/es/components/wallets/PayByBank/PayByBank.js +2 -1
  42. package/dist/es/components/wallets/PayU/PayU.js +2 -1
  43. package/dist/es/components/wallets/Skrill/Skrill.js +2 -1
  44. package/dist/es/components/wallets/Trustly/Trustly.js +2 -1
  45. package/dist/es/components/wallets/Twint/Twint.js +2 -1
  46. package/dist/es/components/wallets/Vietqr/Vietqr.js +2 -0
  47. package/dist/es/components/wallets/WechatPay/WechatPay.js +4 -2
  48. package/dist/es/components/wallets/Zalopay/Zalopay.js +2 -0
  49. package/dist/es/components/wallets/index.js +3 -1
  50. package/dist/es/constant.js +15 -3
  51. package/dist/es/core/environment.js +17 -3
  52. package/dist/es/core/logger.js +1 -1
  53. package/dist/es/hooks/useBaseWallet.js +13 -5
  54. package/dist/es/hooks/useRetry.js +6 -0
  55. package/dist/es/i18n/locales/cs-CZ.js +8 -1
  56. package/dist/es/i18n/locales/da-DK.js +8 -1
  57. package/dist/es/i18n/locales/de-DE.js +8 -1
  58. package/dist/es/i18n/locales/en-GB.js +8 -1
  59. package/dist/es/i18n/locales/es-ES.js +8 -1
  60. package/dist/es/i18n/locales/fi-FI.js +8 -1
  61. package/dist/es/i18n/locales/fil-PH.js +8 -1
  62. package/dist/es/i18n/locales/fr-FR.js +8 -1
  63. package/dist/es/i18n/locales/hi-IN.js +8 -1
  64. package/dist/es/i18n/locales/id-ID.js +8 -1
  65. package/dist/es/i18n/locales/it-IT.js +8 -1
  66. package/dist/es/i18n/locales/ja-JP.js +8 -1
  67. package/dist/es/i18n/locales/ko-KR.js +8 -1
  68. package/dist/es/i18n/locales/ms-MY.js +8 -1
  69. package/dist/es/i18n/locales/nb-NO.js +8 -1
  70. package/dist/es/i18n/locales/nl-NL.js +8 -1
  71. package/dist/es/i18n/locales/pl-PL.js +8 -1
  72. package/dist/es/i18n/locales/pt-PT.js +8 -1
  73. package/dist/es/i18n/locales/ru-RU.js +8 -1
  74. package/dist/es/i18n/locales/sv-SE.js +8 -1
  75. package/dist/es/i18n/locales/th-TH.js +8 -1
  76. package/dist/es/i18n/locales/zh-CN.js +8 -1
  77. package/dist/es/i18n/locales/zh-HK.js +8 -1
  78. package/dist/es/i18n/locales/zh-TW.js +8 -1
  79. package/dist/es/index.js +6 -2
  80. package/dist/es/style.css +1 -1
  81. package/dist/es/utils/date.js +5 -1
  82. package/dist/style.css +1 -1
  83. package/dist/types/components/DropIn/type.d.ts +1 -1
  84. package/dist/types/components/business/QRCodeContent/QRCodeContent.d.ts +3 -0
  85. package/dist/types/components/business/QRCodeContent/index.d.ts +2 -0
  86. package/dist/types/components/business/QRCodeContent/type.d.ts +23 -0
  87. package/dist/types/components/business/QRCodeModal/QRCodeModal.d.ts +0 -1
  88. package/dist/types/components/business/QRCodeModal/type.d.ts +2 -28
  89. package/dist/types/components/business/index.d.ts +1 -0
  90. package/dist/types/components/internal/Button/type.d.ts +1 -0
  91. package/dist/types/components/internal/icons/IconAlipay.d.ts +2 -0
  92. package/dist/types/components/internal/icons/IconAlipayHK.d.ts +2 -0
  93. package/dist/types/components/internal/icons/index.d.ts +2 -0
  94. package/dist/types/components/wallets/Alipay/Alipay.d.ts +15 -0
  95. package/dist/types/components/wallets/Alipay/index.d.ts +2 -0
  96. package/dist/types/components/wallets/{AliPay → Alipay}/type.d.ts +2 -2
  97. package/dist/types/components/wallets/AlipayHK/AlipayHK.d.ts +15 -0
  98. package/dist/types/components/wallets/AlipayHK/index.d.ts +2 -0
  99. package/dist/types/components/wallets/AlipayHK/type.d.ts +7 -0
  100. package/dist/types/components/wallets/AlipayPlus/AlipayPlus.d.ts +15 -0
  101. package/dist/types/components/wallets/AlipayPlus/index.d.ts +2 -0
  102. package/dist/types/components/wallets/AlipayPlus/type.d.ts +7 -0
  103. package/dist/types/components/wallets/index.d.ts +3 -1
  104. package/dist/types/constant.d.ts +6 -2
  105. package/dist/types/hooks/useBaseWallet.d.ts +13 -0
  106. package/dist/types/hooks/useRetry.d.ts +2 -0
  107. package/dist/types/i18n/locales/cs-CZ.d.ts +7 -0
  108. package/dist/types/i18n/locales/da-DK.d.ts +7 -0
  109. package/dist/types/i18n/locales/de-DE.d.ts +7 -0
  110. package/dist/types/i18n/locales/en-GB.d.ts +7 -0
  111. package/dist/types/i18n/locales/es-ES.d.ts +7 -0
  112. package/dist/types/i18n/locales/fi-FI.d.ts +7 -0
  113. package/dist/types/i18n/locales/fil-PH.d.ts +7 -0
  114. package/dist/types/i18n/locales/fr-FR.d.ts +7 -0
  115. package/dist/types/i18n/locales/hi-IN.d.ts +7 -0
  116. package/dist/types/i18n/locales/id-ID.d.ts +7 -0
  117. package/dist/types/i18n/locales/it-IT.d.ts +7 -0
  118. package/dist/types/i18n/locales/ja-JP.d.ts +7 -0
  119. package/dist/types/i18n/locales/ko-KR.d.ts +7 -0
  120. package/dist/types/i18n/locales/ms-MY.d.ts +7 -0
  121. package/dist/types/i18n/locales/nb-NO.d.ts +7 -0
  122. package/dist/types/i18n/locales/nl-NL.d.ts +7 -0
  123. package/dist/types/i18n/locales/pl-PL.d.ts +7 -0
  124. package/dist/types/i18n/locales/pt-PT.d.ts +7 -0
  125. package/dist/types/i18n/locales/ru-RU.d.ts +7 -0
  126. package/dist/types/i18n/locales/sv-SE.d.ts +7 -0
  127. package/dist/types/i18n/locales/th-TH.d.ts +7 -0
  128. package/dist/types/i18n/locales/zh-CN.d.ts +7 -0
  129. package/dist/types/i18n/locales/zh-HK.d.ts +7 -0
  130. package/dist/types/i18n/locales/zh-TW.d.ts +7 -0
  131. package/dist/types/utils/date.d.ts +1 -0
  132. package/package.json +1 -1
  133. package/dist/es/components/RecurringTip/index.js +0 -21
  134. package/dist/es/components/wallets/AliPay/index.js +0 -1
  135. package/dist/types/components/RecurringTip/RecurringTip.d.ts +0 -2
  136. package/dist/types/components/RecurringTip/index.d.ts +0 -1
  137. package/dist/types/components/wallets/AliPay/AliPay.d.ts +0 -15
  138. package/dist/types/components/wallets/AliPay/index.d.ts +0 -2
  139. /package/dist/es/components/business/{QRCodeModal/qr-code-modal.js → QRCodeContent/qr-code-content.js} +0 -0
  140. /package/dist/es/components/{wallets/AliPay → business/QRCodeContent}/type.js +0 -0
  141. /package/dist/es/components/wallets/{AliPay → Alipay}/ali-pay.js +0 -0
@@ -0,0 +1,43 @@
1
+ import { u } from "../../../core.js";
2
+ import { COMMON_CLASS_NAME } from "../../../constant.js";
3
+ import { isUndefined } from "../../../utils/is.js";
4
+ import "../../../utils/card-brand/brands.js";
5
+ import "../../../utils/system-info/get-browser-info.js";
6
+ import { normalizedClass } from "../../../utils/format.js";
7
+ import "../../../core/context.js";
8
+ import "../../../out/fraud-detection.js";
9
+ import "../../../core/logger.js";
10
+ const IconAlipay = ({ size, style, className }) => {
11
+ const computedSize = !isUndefined(size) ? `${size}px` : "1em";
12
+ return /* @__PURE__ */ u(
13
+ "svg",
14
+ {
15
+ width: computedSize,
16
+ height: computedSize,
17
+ viewBox: "0 0 24 24",
18
+ fill: "none",
19
+ style,
20
+ xmlns: "http://www.w3.org/2000/svg",
21
+ className: normalizedClass(COMMON_CLASS_NAME, className),
22
+ children: [
23
+ /* @__PURE__ */ u(
24
+ "path",
25
+ {
26
+ d: "M20.9984 18.0073V18.1189C20.9984 18.8826 20.695 19.615 20.155 20.155C19.615 20.695 18.8826 20.9984 18.1189 20.9984H5.88139C5.50326 20.9984 5.12883 20.9239 4.77948 20.7792C4.43013 20.6345 4.1127 20.4224 3.84532 20.155C3.57794 19.8876 3.36584 19.5702 3.22114 19.2208C3.07643 18.8715 3.00195 18.4971 3.00195 18.1189L3.00195 5.88139C3.00195 5.50326 3.07643 5.12883 3.22113 4.77948C3.36583 4.43013 3.57793 4.1127 3.84531 3.84532C4.11269 3.57794 4.43011 3.36584 4.77946 3.22114C5.12881 3.07643 5.50324 3.00195 5.88137 3.00195H18.1189C18.8826 3.00195 19.615 3.30532 20.155 3.84532C20.695 4.38531 20.9984 5.1177 20.9984 5.88137V18.0073Z",
27
+ fill: "#009FE9"
28
+ }
29
+ ),
30
+ /* @__PURE__ */ u(
31
+ "path",
32
+ {
33
+ d: "M17.8525 14.3973C17.1326 14.1454 16.1716 13.7855 15.0954 13.3931C15.7868 12.1613 16.319 10.8466 16.6791 9.48071H13.0798V8.40096H17.399V7.63789L13.0799 7.6811V5.52148H11.3018C10.9814 5.52148 10.9203 5.88141 10.9203 5.88141V7.68106H6.60113V8.40092H10.9203V9.48069H7.32101V10.2006H14.5196C14.2277 11.1053 13.8454 11.9783 13.3786 12.8064C11.1218 12.0542 8.69954 11.4423 7.15184 11.8382C6.39686 11.9978 5.7094 12.3861 5.18304 12.9504C3.50577 15.0056 4.72231 18.119 8.26402 18.119C10.3732 18.119 12.414 16.9348 13.9905 14.9948C16.3516 16.1538 20.9983 18.0938 20.9983 18.0938V15.3295C20.9983 15.3295 20.4296 15.2576 17.8525 14.3973ZM7.94366 16.9456C5.15062 16.9456 4.34438 14.7537 5.72291 13.5335C6.17244 13.1231 6.72465 12.842 7.32099 12.7201C8.96587 12.5401 10.6575 13.3464 12.4824 14.2426C11.165 15.9054 9.55254 16.9456 7.94368 16.9456H7.94366Z",
34
+ fill: "white"
35
+ }
36
+ )
37
+ ]
38
+ }
39
+ );
40
+ };
41
+ export {
42
+ IconAlipay
43
+ };
@@ -0,0 +1,66 @@
1
+ import { u } from "../../../core.js";
2
+ import { COMMON_CLASS_NAME } from "../../../constant.js";
3
+ import { isUndefined } from "../../../utils/is.js";
4
+ import "../../../utils/card-brand/brands.js";
5
+ import "../../../utils/system-info/get-browser-info.js";
6
+ import { normalizedClass } from "../../../utils/format.js";
7
+ import "../../../core/context.js";
8
+ import "../../../out/fraud-detection.js";
9
+ import "../../../core/logger.js";
10
+ const IconAlipayHK = ({ size, style, className }) => {
11
+ const computedSize = !isUndefined(size) ? `${size}px` : "1em";
12
+ return /* @__PURE__ */ u(
13
+ "svg",
14
+ {
15
+ width: computedSize,
16
+ height: computedSize,
17
+ viewBox: "0 0 24 24",
18
+ fill: "none",
19
+ style,
20
+ xmlns: "http://www.w3.org/2000/svg",
21
+ className: normalizedClass(COMMON_CLASS_NAME, className),
22
+ children: [
23
+ /* @__PURE__ */ u(
24
+ "path",
25
+ {
26
+ fillRule: "evenodd",
27
+ clipRule: "evenodd",
28
+ d: "M16.7106 3C19.3121 3 20.9996 4.68746 20.9996 7.28897V16.7106C20.9996 19.3121 19.3121 20.9996 16.7106 20.9996H7.28897C4.68746 20.9996 3 19.3121 3 16.7106V7.28897C3 4.68746 4.68746 3 7.28897 3H16.7106Z",
29
+ fill: "white"
30
+ }
31
+ ),
32
+ /* @__PURE__ */ u(
33
+ "path",
34
+ {
35
+ fillRule: "evenodd",
36
+ clipRule: "evenodd",
37
+ d: "M16.7106 3C19.3121 3 20.9996 4.68746 20.9996 7.28897L21 15.0149C20.8311 14.9718 19.7477 14.7303 17.5907 14.0064C16.9167 13.7893 16.0365 13.4596 15.0725 13.1024C15.6453 12.1021 16.1148 10.9386 16.4284 9.68038H13.1678V8.51817H17.1387V7.8725H13.1678V5.93548H11.5536C11.282 5.93548 11.265 6.17409 11.2633 6.19303L11.2631 7.8725H7.2599V8.51817H11.2954V9.68038H7.97014V10.3261H14.3946C14.1588 11.1132 13.8458 11.8694 13.4584 12.5536C11.3813 11.8888 9.15142 11.3265 7.74416 11.682C6.84335 11.8888 6.27611 12.2767 5.93627 12.6828C4.35924 14.5649 5.47415 17.3962 8.77723 17.3962C10.7162 17.3962 12.594 16.3296 14.0395 14.5552C16.0448 15.5126 20.2966 17.2587 20.941 17.5277C20.621 19.6598 19.0287 20.9996 16.7106 20.9996H7.28897C4.68746 20.9996 3 19.3121 3 16.7106V11.5714L11.5472 3H16.7106Z",
38
+ fill: "#00A0E9"
39
+ }
40
+ ),
41
+ /* @__PURE__ */ u(
42
+ "path",
43
+ {
44
+ fillRule: "evenodd",
45
+ clipRule: "evenodd",
46
+ d: "M8.45332 16.3347C5.90095 16.3347 5.13721 14.3372 6.41945 13.2594C6.84093 12.8828 7.60467 12.7083 8.00135 12.6767C9.54338 12.5143 10.9534 13.0961 12.6179 13.9068C11.4625 15.3844 9.95462 16.3347 8.45332 16.3347Z",
47
+ fill: "#00A0E9"
48
+ }
49
+ ),
50
+ /* @__PURE__ */ u("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M11.6312 3L3 11.6312L3 7.30065C3 4.69206 4.68746 3 7.28897 3L11.6312 3Z", fill: "#F8F8F8" }),
51
+ /* @__PURE__ */ u(
52
+ "path",
53
+ {
54
+ fillRule: "evenodd",
55
+ clipRule: "evenodd",
56
+ d: "M6.54827 6.84334L6.35164 7.03998L5.63055 6.3189L4.76536 7.1841L5.48644 7.90518L5.2898 8.10181L3.70605 6.51807L3.90269 6.32143L4.58755 7.00629L5.45275 6.1411L4.76789 5.45623L4.96453 5.2596L6.54827 6.84334ZM6.95135 6.44026C6.95135 6.44026 6.94152 6.4501 6.92186 6.46976C6.90219 6.48942 6.87925 6.51236 6.85303 6.53858C6.82682 6.5648 6.80387 6.58774 6.78421 6.6074C6.76455 6.62707 6.75472 6.6369 6.75472 6.6369L5.17097 5.05315L5.3676 4.85652L6.14027 5.62918L6.1512 5.61826L6.0744 4.14972L6.32238 3.90174L6.3759 5.25087L7.96403 5.42759L7.71277 5.67885L6.37983 5.52791L6.39819 5.8871L6.95135 6.44026Z",
57
+ fill: "#00A0E9"
58
+ }
59
+ )
60
+ ]
61
+ }
62
+ );
63
+ };
64
+ export {
65
+ IconAlipayHK
66
+ };
@@ -0,0 +1,148 @@
1
+ import { w, F, 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 { normalizedClass } from "../../../utils/format.js";
7
+ import { PaymentMethod, PaymentCategory, COMMON_CLASS_NAME, PAY_FORM_CLASS_NAME, PAY_FORM_FOOTER_CLASS_NAME } from "../../../constant.js";
8
+ import { getTimeDiff } from "../../../utils/date.js";
9
+ import "../../../out/fraud-detection.js";
10
+ import "../../../core/logger.js";
11
+ import { usePayState } from "../../../hooks/usePayState.js";
12
+ import { SCAN_CODE_RETRY_POLL_TIERS } from "../../../hooks/useRetry.js";
13
+ import { useBaseWallet } from "../../../hooks/useBaseWallet.js";
14
+ import { GuideCard } from "../../GuideCard/index.js";
15
+ import { Info } from "../../internal/Info/Info.js";
16
+ import "./ali-pay.js";
17
+ import { PaymentButton } from "../../PaymentButton/index.js";
18
+ import "../../internal/Modal/Modal.js";
19
+ import { QRCodeContent } from "../../business/QRCodeContent/QRCodeContent.js";
20
+ import "../../internal/Form/type.js";
21
+ import "../../internal/Form/context.js";
22
+ import "../../internal/Form/FormItem.js";
23
+ import "../../internal/Form/Form.js";
24
+ import "../../internal/Input/Input.js";
25
+ import "../../internal/Input/type.js";
26
+ import "../../internal/Select/Select.js";
27
+ import "../../business/PhoneField/config.js";
28
+ import "../../business/PhoneField/phone-field.js";
29
+ import "../../business/Tooltip/tooltip.js";
30
+ import "../../business/BlikCodeField/blik-code-field.js";
31
+ import { Button } from "../../internal/Button/Button2.js";
32
+ import "../../business/PaymentConfirmModal/payment-confirm-modal.js";
33
+ import "../../internal/LoadingCheck/loading-check.js";
34
+ const { bem } = useBEM("ali-pay");
35
+ const CURR_PAYMENT_METHOD = PaymentMethod.ALIPAY;
36
+ const Alipay = w((props, ref) => {
37
+ const {
38
+ session,
39
+ core,
40
+ showGuideCard = true,
41
+ hidePaymentButton = false
42
+ } = props;
43
+ const { i18n, disabled } = usePayState(session, props.core);
44
+ const {
45
+ isEnabled,
46
+ paymentButtonStatus,
47
+ setPaymentButtonStatus,
48
+ errorMessage,
49
+ setErrorMessage,
50
+ payment,
51
+ startRetry,
52
+ stopRetry,
53
+ showQRCodeModal,
54
+ qrCodeInfo,
55
+ processCloseQRCodeModal,
56
+ paymentTimeout,
57
+ getPaymentMethodContext
58
+ } = useBaseWallet(CURR_PAYMENT_METHOD, props, {
59
+ retryTimeout: 2 * 60 * 1e3,
60
+ supportQRCodeModal: true,
61
+ getRetryOptions: (paymentInfo) => {
62
+ var _a;
63
+ const expiredAt = (_a = paymentInfo.payInfo) == null ? void 0 : _a.paymentExpiredAt;
64
+ if (!expiredAt)
65
+ return void 0;
66
+ const timeout = getTimeDiff(expiredAt);
67
+ return Number.isNaN(timeout) ? void 0 : { timeout: Math.max(timeout, 0), pollTiers: SCAN_CODE_RETRY_POLL_TIERS };
68
+ },
69
+ timeoutMessage: i18n.get("common.paymentTimeout"),
70
+ expiredMessage: i18n.get("common.paymentTimeout"),
71
+ getFormData: () => ({})
72
+ });
73
+ F(ref, () => ({
74
+ stopRetry: () => stopRetry(),
75
+ startRetry: (timeout) => startRetry(timeout),
76
+ updateAddress: () => {
77
+ },
78
+ updateEmail: () => {
79
+ },
80
+ payment: () => {
81
+ hidePaymentButton && onSubmit();
82
+ }
83
+ }));
84
+ const onSubmit = async () => {
85
+ var _a;
86
+ setErrorMessage("");
87
+ const submitResult = await ((_a = props.onSubmit) == null ? void 0 : _a.call(props, void 0, getPaymentMethodContext()));
88
+ if (submitResult === false)
89
+ return;
90
+ setPaymentButtonStatus("loading");
91
+ await payment();
92
+ };
93
+ const PaymentButtonView = () => {
94
+ return /* @__PURE__ */ u(
95
+ PaymentButton,
96
+ {
97
+ className: bem("button"),
98
+ status: paymentButtonStatus,
99
+ disabled,
100
+ verified: true,
101
+ onClick: onSubmit,
102
+ children: paymentTimeout ? i18n.get("common.repay") : void 0
103
+ }
104
+ );
105
+ };
106
+ const ErrorMessage = () => {
107
+ return /* @__PURE__ */ u(b, { children: !!errorMessage && /* @__PURE__ */ u(Info, { content: errorMessage }) });
108
+ };
109
+ const QRCode = () => {
110
+ var _a;
111
+ if (!showQRCodeModal || !qrCodeInfo)
112
+ return null;
113
+ return /* @__PURE__ */ u("div", { className: bem("qr-code"), children: [
114
+ /* @__PURE__ */ u(
115
+ QRCodeContent,
116
+ {
117
+ title: i18n.get("qrCode.scanBy", { method: i18n.get("dropIn.aliPay.label") }),
118
+ qrCode: qrCodeInfo.qrCode,
119
+ mode: "iframe",
120
+ borderColor: "#009fe9",
121
+ expiredTime: qrCodeInfo.expiredTime,
122
+ amount: (_a = session == null ? void 0 : session.checkout) == null ? void 0 : _a.transAmount
123
+ }
124
+ ),
125
+ /* @__PURE__ */ u(Button, { ghost: true, className: bem("cancel-button"), onClick: processCloseQRCodeModal, children: i18n.get("common.cancel") })
126
+ ] });
127
+ };
128
+ return /* @__PURE__ */ u(
129
+ CoreContext.Provider,
130
+ {
131
+ value: {
132
+ i18n,
133
+ session,
134
+ core
135
+ },
136
+ children: isEnabled && i18n.ready.value && /* @__PURE__ */ u("div", { className: core.theme.className, children: [
137
+ showGuideCard && /* @__PURE__ */ u(GuideCard, { type: PaymentCategory.ALIPAY }),
138
+ /* @__PURE__ */ u("div", { className: normalizedClass(COMMON_CLASS_NAME, PAY_FORM_CLASS_NAME, bem()), children: /* @__PURE__ */ u("div", { className: PAY_FORM_FOOTER_CLASS_NAME, children: [
139
+ ErrorMessage(),
140
+ showQRCodeModal ? QRCode() : !hidePaymentButton && PaymentButtonView()
141
+ ] }) })
142
+ ] })
143
+ }
144
+ );
145
+ });
146
+ export {
147
+ Alipay
148
+ };
@@ -0,0 +1 @@
1
+ import "./Alipay.js";
@@ -0,0 +1,148 @@
1
+ import { w, F, 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 { normalizedClass } from "../../../utils/format.js";
7
+ import { PaymentMethod, PaymentCategory, COMMON_CLASS_NAME, PAY_FORM_CLASS_NAME, PAY_FORM_FOOTER_CLASS_NAME } from "../../../constant.js";
8
+ import { getTimeDiff } from "../../../utils/date.js";
9
+ import "../../../out/fraud-detection.js";
10
+ import "../../../core/logger.js";
11
+ import { usePayState } from "../../../hooks/usePayState.js";
12
+ import { SCAN_CODE_RETRY_POLL_TIERS } from "../../../hooks/useRetry.js";
13
+ import { useBaseWallet } from "../../../hooks/useBaseWallet.js";
14
+ import { GuideCard } from "../../GuideCard/index.js";
15
+ import { Info } from "../../internal/Info/Info.js";
16
+ import "./alipay-hk.js";
17
+ import { PaymentButton } from "../../PaymentButton/index.js";
18
+ import "../../internal/Modal/Modal.js";
19
+ import { QRCodeContent } from "../../business/QRCodeContent/QRCodeContent.js";
20
+ import "../../internal/Form/type.js";
21
+ import "../../internal/Form/context.js";
22
+ import "../../internal/Form/FormItem.js";
23
+ import "../../internal/Form/Form.js";
24
+ import "../../internal/Input/Input.js";
25
+ import "../../internal/Input/type.js";
26
+ import "../../internal/Select/Select.js";
27
+ import "../../business/PhoneField/config.js";
28
+ import "../../business/PhoneField/phone-field.js";
29
+ import "../../business/Tooltip/tooltip.js";
30
+ import "../../business/BlikCodeField/blik-code-field.js";
31
+ import { Button } from "../../internal/Button/Button2.js";
32
+ import "../../business/PaymentConfirmModal/payment-confirm-modal.js";
33
+ import "../../internal/LoadingCheck/loading-check.js";
34
+ const { bem } = useBEM("ali-pay-hk");
35
+ const CURR_PAYMENT_METHOD = PaymentMethod.ALIPAY_HK;
36
+ const AlipayHK = w((props, ref) => {
37
+ const {
38
+ session,
39
+ core,
40
+ showGuideCard = true,
41
+ hidePaymentButton = false
42
+ } = props;
43
+ const { i18n, disabled } = usePayState(session, props.core);
44
+ const {
45
+ isEnabled,
46
+ paymentButtonStatus,
47
+ setPaymentButtonStatus,
48
+ errorMessage,
49
+ setErrorMessage,
50
+ payment,
51
+ startRetry,
52
+ stopRetry,
53
+ showQRCodeModal,
54
+ qrCodeInfo,
55
+ processCloseQRCodeModal,
56
+ paymentTimeout,
57
+ getPaymentMethodContext
58
+ } = useBaseWallet(CURR_PAYMENT_METHOD, props, {
59
+ retryTimeout: 2 * 60 * 1e3,
60
+ supportQRCodeModal: true,
61
+ getRetryOptions: (paymentInfo) => {
62
+ var _a;
63
+ const expiredAt = (_a = paymentInfo.payInfo) == null ? void 0 : _a.paymentExpiredAt;
64
+ if (!expiredAt)
65
+ return void 0;
66
+ const timeout = getTimeDiff(expiredAt);
67
+ return Number.isNaN(timeout) ? void 0 : { timeout: Math.max(timeout, 0), pollTiers: SCAN_CODE_RETRY_POLL_TIERS };
68
+ },
69
+ timeoutMessage: i18n.get("common.paymentTimeout"),
70
+ expiredMessage: i18n.get("common.paymentTimeout"),
71
+ getFormData: () => ({})
72
+ });
73
+ F(ref, () => ({
74
+ stopRetry: () => stopRetry(),
75
+ startRetry: (timeout) => startRetry(timeout),
76
+ updateAddress: () => {
77
+ },
78
+ updateEmail: () => {
79
+ },
80
+ payment: () => {
81
+ hidePaymentButton && onSubmit();
82
+ }
83
+ }));
84
+ const onSubmit = async () => {
85
+ var _a;
86
+ setErrorMessage("");
87
+ const submitResult = await ((_a = props.onSubmit) == null ? void 0 : _a.call(props, void 0, getPaymentMethodContext()));
88
+ if (submitResult === false)
89
+ return;
90
+ setPaymentButtonStatus("loading");
91
+ await payment();
92
+ };
93
+ const PaymentButtonView = () => {
94
+ return /* @__PURE__ */ u(
95
+ PaymentButton,
96
+ {
97
+ className: bem("button"),
98
+ status: paymentButtonStatus,
99
+ disabled,
100
+ verified: true,
101
+ onClick: onSubmit,
102
+ children: paymentTimeout ? i18n.get("common.repay") : void 0
103
+ }
104
+ );
105
+ };
106
+ const ErrorMessage = () => {
107
+ return /* @__PURE__ */ u(b, { children: !!errorMessage && /* @__PURE__ */ u(Info, { content: errorMessage }) });
108
+ };
109
+ const QRCode = () => {
110
+ var _a;
111
+ if (!showQRCodeModal || !qrCodeInfo)
112
+ return null;
113
+ return /* @__PURE__ */ u("div", { className: bem("qr-code"), children: [
114
+ /* @__PURE__ */ u(
115
+ QRCodeContent,
116
+ {
117
+ title: i18n.get("qrCode.scanBy", { method: i18n.get("dropIn.aliPayHK.label") }),
118
+ qrCode: qrCodeInfo.qrCode,
119
+ mode: "iframe",
120
+ borderColor: "#009fe9",
121
+ expiredTime: qrCodeInfo.expiredTime,
122
+ amount: (_a = session == null ? void 0 : session.checkout) == null ? void 0 : _a.transAmount
123
+ }
124
+ ),
125
+ /* @__PURE__ */ u(Button, { ghost: true, className: bem("cancel-button"), onClick: processCloseQRCodeModal, children: i18n.get("common.cancel") })
126
+ ] });
127
+ };
128
+ return /* @__PURE__ */ u(
129
+ CoreContext.Provider,
130
+ {
131
+ value: {
132
+ i18n,
133
+ session,
134
+ core
135
+ },
136
+ children: isEnabled && i18n.ready.value && /* @__PURE__ */ u("div", { className: core.theme.className, children: [
137
+ showGuideCard && /* @__PURE__ */ u(GuideCard, { type: PaymentCategory.ALIPAY_HK }),
138
+ /* @__PURE__ */ u("div", { className: normalizedClass(COMMON_CLASS_NAME, PAY_FORM_CLASS_NAME, bem()), children: /* @__PURE__ */ u("div", { className: PAY_FORM_FOOTER_CLASS_NAME, children: [
139
+ ErrorMessage(),
140
+ showQRCodeModal ? QRCode() : !hidePaymentButton && PaymentButtonView()
141
+ ] }) })
142
+ ] })
143
+ }
144
+ );
145
+ });
146
+ export {
147
+ AlipayHK
148
+ };
@@ -0,0 +1 @@
1
+ import "./AlipayHK.js";
@@ -1,5 +1,5 @@
1
1
  import { w, A, h, F, y, u, b } from "../../../core.js";
2
- import "./ali-pay.js";
2
+ import "./ali-pay-plus.js";
3
3
  import { PaymentMethod, PaymentCategory, COMMON_CLASS_NAME, PAY_FORM_CLASS_NAME, PaymentType, PAY_FORM_FOOTER_CLASS_NAME } from "../../../constant.js";
4
4
  import { CoreContext } from "../../../core/context.js";
5
5
  import "../../../utils/card-brand/brands.js";
@@ -17,14 +17,13 @@ import "../../internal/Form/context.js";
17
17
  import "../../internal/Form/FormItem.js";
18
18
  import { Form } from "../../internal/Form/Form.js";
19
19
  import { Info } from "../../internal/Info/Info.js";
20
- import { RecurringTip } from "../../RecurringTip/index.js";
20
+ import { Tip } from "../../Tip/index.js";
21
21
  import { PaymentButton } from "../../PaymentButton/index.js";
22
22
  import { calcAmountWithFee } from "../../../utils/business/amount.js";
23
23
  import { GuideCard } from "../../GuideCard/index.js";
24
- const { bem } = useBEM("ali-pay");
25
- const fieldClassNames = bem("field");
26
- const CURR_PAYMENT_METHOD = PaymentMethod.ALI_PAY;
27
- const AliPay = w((props, ref) => {
24
+ const { bem } = useBEM("ali-pay-plus");
25
+ const CURR_PAYMENT_METHOD = PaymentMethod.ALIPAY_PLUS;
26
+ const AlipayPlus = w((props, ref) => {
28
27
  const {
29
28
  session,
30
29
  core,
@@ -126,7 +125,6 @@ const AliPay = w((props, ref) => {
126
125
  return /* @__PURE__ */ u(
127
126
  PaymentButton,
128
127
  {
129
- className: bem("button"),
130
128
  status: paymentButtonStatus,
131
129
  disabled,
132
130
  verified: validated,
@@ -136,17 +134,17 @@ const AliPay = w((props, ref) => {
136
134
  );
137
135
  };
138
136
  const Email = () => {
139
- return /* @__PURE__ */ u(b, { children: (fieldStatus == null ? void 0 : fieldStatus.email.show) && /* @__PURE__ */ u("div", { className: fieldClassNames, children: /* @__PURE__ */ u(
137
+ return /* @__PURE__ */ u(b, { children: (fieldStatus == null ? void 0 : fieldStatus.email.show) && /* @__PURE__ */ u(
140
138
  EmailField,
141
139
  {
142
140
  ref: emailFieldRef,
143
141
  value: form.email,
144
142
  disabled: (fieldStatus == null ? void 0 : fieldStatus.email.disabled) || disabled
145
143
  }
146
- ) }) });
144
+ ) });
147
145
  };
148
146
  const Address = () => {
149
- return /* @__PURE__ */ u(b, { children: (fieldStatus == null ? void 0 : fieldStatus.address.show) && /* @__PURE__ */ u("div", { className: fieldClassNames, children: /* @__PURE__ */ u(
147
+ return /* @__PURE__ */ u(b, { children: (fieldStatus == null ? void 0 : fieldStatus.address.show) && /* @__PURE__ */ u(
150
148
  AddressField,
151
149
  {
152
150
  ref: addressFieldRef,
@@ -154,10 +152,10 @@ const AliPay = w((props, ref) => {
154
152
  disabled,
155
153
  onChange: (value) => setForm(Object.assign(form, { address: value }))
156
154
  }
157
- ) }) });
155
+ ) });
158
156
  };
159
157
  const ErrorMessage = () => {
160
- return /* @__PURE__ */ u(b, { children: !!errorMessage && /* @__PURE__ */ u(Info, { className: bem("error"), content: errorMessage }) });
158
+ return /* @__PURE__ */ u(b, { children: !!errorMessage && /* @__PURE__ */ u(Info, { content: errorMessage }) });
161
159
  };
162
160
  return /* @__PURE__ */ u(
163
161
  CoreContext.Provider,
@@ -168,11 +166,11 @@ const AliPay = w((props, ref) => {
168
166
  core
169
167
  },
170
168
  children: isEnabled && i18n.ready.value && /* @__PURE__ */ u(b, { children: [
171
- showGuideCard && /* @__PURE__ */ u(GuideCard, { type: PaymentCategory.ALI_PAY }),
169
+ showGuideCard && /* @__PURE__ */ u(GuideCard, { type: PaymentCategory.ALIPAY_PLUS }),
172
170
  /* @__PURE__ */ u("div", { className: core.theme.className, children: /* @__PURE__ */ u(Form, { form, ref: setFormRef, onFormChange: (form2) => setForm(form2), children: /* @__PURE__ */ u("div", { className: normalizedClass(COMMON_CLASS_NAME, PAY_FORM_CLASS_NAME, bem()), children: [
173
171
  Email(),
174
172
  Address(),
175
- (session == null ? void 0 : session.checkout.paymentType) === PaymentType.RECURRING && RecurringTip(),
173
+ (session == null ? void 0 : session.checkout.paymentType) === PaymentType.RECURRING && /* @__PURE__ */ u(Tip, { text: i18n.get("common.recurringTip") }),
176
174
  /* @__PURE__ */ u("div", { className: PAY_FORM_FOOTER_CLASS_NAME, children: [
177
175
  ErrorMessage(),
178
176
  !hidePaymentButton && Button()
@@ -183,5 +181,5 @@ const AliPay = w((props, ref) => {
183
181
  );
184
182
  });
185
183
  export {
186
- AliPay
184
+ AlipayPlus
187
185
  };
@@ -0,0 +1 @@
1
+ import "./AlipayPlus.js";
@@ -18,7 +18,8 @@ import { Form } from "../../internal/Form/Form.js";
18
18
  import { PaymentButton } from "../../PaymentButton/index.js";
19
19
  import { Info } from "../../internal/Info/Info.js";
20
20
  import "../../internal/Modal/Modal.js";
21
- import "../../business/QRCodeModal/qr-code-modal.js";
21
+ import "../../internal/Loading/loading.js";
22
+ import "../../business/QRCodeContent/qr-code-content.js";
22
23
  import { NameField } from "../../business/NameField/NameField.js";
23
24
  import "../../internal/Select/Select.js";
24
25
  import "../../internal/Input/Input.js";
@@ -31,7 +32,7 @@ import "../../internal/Button/button.js";
31
32
  import "../../business/PaymentConfirmModal/payment-confirm-modal.js";
32
33
  import "../../internal/LoadingCheck/loading-check.js";
33
34
  import { createEmailCore, EmailField } from "../../EmailField/EmailField.js";
34
- import { RecurringTip } from "../../RecurringTip/index.js";
35
+ import { Tip } from "../../Tip/index.js";
35
36
  import { DEFAULT_ADDRESS, AddressField } from "../../AddressField/index.js";
36
37
  const { bem } = useBEM("bancontact");
37
38
  const CURR_PAYMENT_METHOD = PaymentMethod.BANCONTACT;
@@ -183,7 +184,7 @@ const Bancontact = w((props, ref) => {
183
184
  Email(),
184
185
  /* @__PURE__ */ u(NameField, { disabled }),
185
186
  Address(),
186
- ((_a = session == null ? void 0 : session.checkout) == null ? void 0 : _a.paymentType) === PaymentType.RECURRING && RecurringTip(false),
187
+ ((_a = session == null ? void 0 : session.checkout) == null ? void 0 : _a.paymentType) === PaymentType.RECURRING && /* @__PURE__ */ u(Tip, { text: i18n.get("common.recurringTip2") }),
187
188
  /* @__PURE__ */ u("div", { className: PAY_FORM_FOOTER_CLASS_NAME, children: [
188
189
  ErrorMessage(),
189
190
  !hidePaymentButton && Button()
@@ -17,7 +17,8 @@ import { Form } from "../../internal/Form/Form.js";
17
17
  import { PaymentButton } from "../../PaymentButton/index.js";
18
18
  import { Info } from "../../internal/Info/Info.js";
19
19
  import "../../internal/Modal/Modal.js";
20
- import "../../business/QRCodeModal/qr-code-modal.js";
20
+ import "../../internal/Loading/loading.js";
21
+ import "../../business/QRCodeContent/qr-code-content.js";
21
22
  import { NameField } from "../../business/NameField/NameField.js";
22
23
  import "../../internal/Select/Select.js";
23
24
  import "../../internal/Input/Input.js";
@@ -28,7 +29,7 @@ import { BlikCodeField } from "../../business/BlikCodeField/BlikCodeField.js";
28
29
  import { PaymentConfirmModal } from "../../business/PaymentConfirmModal/PaymentConfirmModal.js";
29
30
  import "../../business/Tooltip/tooltip.js";
30
31
  import { createEmailCore, EmailField } from "../../EmailField/EmailField.js";
31
- import { RecurringTip } from "../../RecurringTip/index.js";
32
+ import { Tip } from "../../Tip/index.js";
32
33
  import { DEFAULT_ADDRESS, AddressField } from "../../AddressField/index.js";
33
34
  const { bem } = useBEM("blik");
34
35
  const CURR_PAYMENT_METHOD = PaymentMethod.BLIK;
@@ -219,7 +220,7 @@ const Blik = w((props, ref) => {
219
220
  /* @__PURE__ */ u(NameField, { disabled }),
220
221
  Address(),
221
222
  /* @__PURE__ */ u("div", { children: /* @__PURE__ */ u(BlikCodeField, { disabled }) }),
222
- ((_a = session == null ? void 0 : session.checkout) == null ? void 0 : _a.paymentType) === PaymentType.RECURRING && RecurringTip(false),
223
+ ((_a = session == null ? void 0 : session.checkout) == null ? void 0 : _a.paymentType) === PaymentType.RECURRING && /* @__PURE__ */ u(Tip, { text: i18n.get("common.recurringTip2") }),
223
224
  /* @__PURE__ */ u("div", { className: PAY_FORM_FOOTER_CLASS_NAME, children: [
224
225
  ErrorMessage(),
225
226
  !hidePaymentButton && Button()
@@ -18,7 +18,8 @@ import { Form } from "../../internal/Form/Form.js";
18
18
  import { PaymentButton } from "../../PaymentButton/index.js";
19
19
  import { Info } from "../../internal/Info/Info.js";
20
20
  import "../../internal/Modal/Modal.js";
21
- import "../../business/QRCodeModal/qr-code-modal.js";
21
+ import "../../internal/Loading/loading.js";
22
+ import "../../business/QRCodeContent/qr-code-content.js";
22
23
  import { NameField } from "../../business/NameField/NameField.js";
23
24
  import { PhoneField } from "../../business/PhoneField/PhoneField.js";
24
25
  import { AREA_CODE_ID } from "../../business/PhoneField/area-codes.js";
@@ -16,7 +16,8 @@ import "../../internal/Form/context.js";
16
16
  import "../../internal/Form/FormItem.js";
17
17
  import { Form } from "../../internal/Form/Form.js";
18
18
  import "../../internal/Modal/Modal.js";
19
- import "../../business/QRCodeModal/qr-code-modal.js";
19
+ import "../../internal/Loading/loading.js";
20
+ import "../../business/QRCodeContent/qr-code-content.js";
20
21
  import { NameField } from "../../business/NameField/NameField.js";
21
22
  import "../../internal/Select/Select.js";
22
23
  import "../../internal/Input/Input.js";
@@ -32,7 +33,7 @@ import { createEmailCore, EmailField } from "../../EmailField/EmailField.js";
32
33
  import { PaymentButton } from "../../PaymentButton/index.js";
33
34
  import { Info } from "../../internal/Info/Info.js";
34
35
  import { DEFAULT_ADDRESS, AddressField } from "../../AddressField/index.js";
35
- import { RecurringTip } from "../../RecurringTip/index.js";
36
+ import { Tip } from "../../Tip/index.js";
36
37
  const { bem } = useBEM("eps");
37
38
  const CURR_PAYMENT_METHOD = PaymentMethod.EPS;
38
39
  const DEFAULT_COUNTRY = "AT";
@@ -164,7 +165,7 @@ const EPS = w((props, ref) => {
164
165
  Email(),
165
166
  isRecurring && /* @__PURE__ */ u(NameField, { disabled }),
166
167
  Address(),
167
- isRecurring && RecurringTip(false),
168
+ isRecurring && /* @__PURE__ */ u(Tip, { text: i18n.get("common.recurringTip2") }),
168
169
  /* @__PURE__ */ u("div", { className: PAY_FORM_FOOTER_CLASS_NAME, children: [
169
170
  ErrorMessage(),
170
171
  !hidePaymentButton && Button()
@@ -17,6 +17,8 @@ import "../../internal/Form/context.js";
17
17
  import "../../internal/Form/FormItem.js";
18
18
  import { Form } from "../../internal/Form/Form.js";
19
19
  import { QRCodeModal } from "../../business/QRCodeModal/QRCodeModal.js";
20
+ import "../../internal/Loading/loading.js";
21
+ import "../../business/QRCodeContent/qr-code-content.js";
20
22
  import "../../internal/Input/Input.js";
21
23
  import "../../internal/Input/type.js";
22
24
  import "../../internal/Select/Select.js";
@@ -18,7 +18,8 @@ import { Form } from "../../internal/Form/Form.js";
18
18
  import { PaymentButton } from "../../PaymentButton/index.js";
19
19
  import { Info } from "../../internal/Info/Info.js";
20
20
  import "../../internal/Modal/Modal.js";
21
- import "../../business/QRCodeModal/qr-code-modal.js";
21
+ import "../../internal/Loading/loading.js";
22
+ import "../../business/QRCodeContent/qr-code-content.js";
22
23
  import { NameField } from "../../business/NameField/NameField.js";
23
24
  import "../../internal/Select/Select.js";
24
25
  import "../../internal/Input/Input.js";