@paykka/card-checkout-ui 0.15.2 → 0.16.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 (133) 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/http.js +12 -1
  4. package/dist/es/api/modules/apple-pay/index.js +0 -12
  5. package/dist/es/api/modules/common/index.js +29 -0
  6. package/dist/es/api/modules/get-browser-params.js +1 -1
  7. package/dist/es/api/modules/index.js +1 -1
  8. package/dist/es/api/modules/threeDS/index.js +1 -1
  9. package/dist/es/api/utils/index.js +3 -0
  10. package/dist/es/components/AccountNameField/index.js +2 -2
  11. package/dist/es/components/AddressField/index.js +2 -2
  12. package/dist/es/components/ApplePay/index.js +26 -10
  13. package/dist/es/components/CPFField/index.js +2 -2
  14. package/dist/es/components/Card/index.js +20 -6
  15. package/dist/es/components/CardHolderNameField/index.js +2 -2
  16. package/dist/es/components/CardSecurityCodeField/index.js +2 -2
  17. package/dist/es/components/CombinedCardInfo/index.js +3 -3
  18. package/dist/es/components/EmailField/EmailField.js +2 -2
  19. package/dist/es/components/EncryptedCard/index.js +1 -1
  20. package/dist/es/components/GooglePay/index.js +35 -21
  21. package/dist/es/components/SecuredFieldsProvider/index.js +2 -0
  22. package/dist/es/components/SecuredIframe/index.js +19 -10
  23. package/dist/es/components/Sepa/index.js +21 -6
  24. package/dist/es/components/business/BlikConfirmModal/BlikConfirmModal.js +1 -1
  25. package/dist/es/components/business/NameField/NameField.js +2 -2
  26. package/dist/es/components/business/QRCodeModal/QRCodeModal.js +1 -1
  27. package/dist/es/components/business/SegmentedDigitInput/format.js +3 -0
  28. package/dist/es/components/business/SegmentedDigitInput/index.js +2 -0
  29. package/dist/es/components/internal/Accordion/accordionTransition.js +3 -0
  30. package/dist/es/components/internal/Form/Form.js +2 -0
  31. package/dist/es/components/internal/Form/FormItem.js +2 -0
  32. package/dist/es/components/internal/Input/Input.js +2 -0
  33. package/dist/es/components/internal/icons/Icon3DSFail.js +2 -0
  34. package/dist/es/components/internal/icons/Icon3DSInfo.js +2 -0
  35. package/dist/es/components/internal/icons/Icon3DSSuccess.js +2 -0
  36. package/dist/es/components/internal/icons/IconAdd.js +2 -0
  37. package/dist/es/components/internal/icons/IconAlipayPlus.js +2 -0
  38. package/dist/es/components/internal/icons/IconAmex.js +2 -0
  39. package/dist/es/components/internal/icons/IconArrowDown.js +2 -0
  40. package/dist/es/components/internal/icons/IconBancontact.js +2 -0
  41. package/dist/es/components/internal/icons/IconBlik.js +2 -0
  42. package/dist/es/components/internal/icons/IconBoost.js +2 -0
  43. package/dist/es/components/internal/icons/IconCard.js +2 -0
  44. package/dist/es/components/internal/icons/IconCard2.js +2 -0
  45. package/dist/es/components/internal/icons/IconCardNo.js +2 -0
  46. package/dist/es/components/internal/icons/IconDinnersClub.js +2 -0
  47. package/dist/es/components/internal/icons/IconDiscover.js +2 -0
  48. package/dist/es/components/internal/icons/IconError.js +2 -0
  49. package/dist/es/components/internal/icons/IconGCash.js +2 -0
  50. package/dist/es/components/internal/icons/IconGcashComplete.js +2 -0
  51. package/dist/es/components/internal/icons/IconGrabPay.js +2 -0
  52. package/dist/es/components/internal/icons/IconIdeal.js +2 -0
  53. package/dist/es/components/internal/icons/IconInfo.js +2 -0
  54. package/dist/es/components/internal/icons/IconJcb.js +2 -0
  55. package/dist/es/components/internal/icons/IconLinePay.js +2 -0
  56. package/dist/es/components/internal/icons/IconMasterCard.js +2 -0
  57. package/dist/es/components/internal/icons/IconMayBankQRPay.js +2 -0
  58. package/dist/es/components/internal/icons/IconNinePay.js +2 -0
  59. package/dist/es/components/internal/icons/IconOpayWallet.js +2 -0
  60. package/dist/es/components/internal/icons/IconOvo.js +2 -0
  61. package/dist/es/components/internal/icons/IconP24.js +2 -0
  62. package/dist/es/components/internal/icons/IconPagaWallet.js +2 -0
  63. package/dist/es/components/internal/icons/IconPaymaya.js +2 -0
  64. package/dist/es/components/internal/icons/IconPhone.js +2 -0
  65. package/dist/es/components/internal/icons/IconPicPay.js +2 -0
  66. package/dist/es/components/internal/icons/IconPix.js +2 -0
  67. package/dist/es/components/internal/icons/IconRedirect.js +2 -0
  68. package/dist/es/components/internal/icons/IconSafe.js +2 -0
  69. package/dist/es/components/internal/icons/IconScan.js +2 -0
  70. package/dist/es/components/internal/icons/IconShopeePay.js +2 -0
  71. package/dist/es/components/internal/icons/IconSkrill.js +2 -0
  72. package/dist/es/components/internal/icons/IconSuccess.js +2 -0
  73. package/dist/es/components/internal/icons/IconSwitch.js +2 -0
  74. package/dist/es/components/internal/icons/IconTNGWallet.js +2 -0
  75. package/dist/es/components/internal/icons/IconTick.js +2 -0
  76. package/dist/es/components/internal/icons/IconTrustly.js +2 -0
  77. package/dist/es/components/internal/icons/IconUnionPay.js +2 -0
  78. package/dist/es/components/internal/icons/IconVietqr.js +2 -0
  79. package/dist/es/components/internal/icons/IconVietqrComplete.js +2 -0
  80. package/dist/es/components/internal/icons/IconVisa.js +2 -0
  81. package/dist/es/components/internal/icons/IconWechatPayGlobal.js +2 -0
  82. package/dist/es/components/internal/icons/IconWechatPayGlobalComplete.js +2 -0
  83. package/dist/es/components/internal/icons/IconZalopay.js +2 -0
  84. package/dist/es/components/internal/icons/IconZalopayComplete.js +2 -0
  85. package/dist/es/components/internal/icons/iconChecked.js +2 -0
  86. package/dist/es/components/internal/icons/index.js +2 -0
  87. package/dist/es/components/wallets/WechatPay/WechatPay.js +5 -10
  88. package/dist/es/config.js +2 -0
  89. package/dist/es/core/address.js +3 -0
  90. package/dist/es/core/checkout.js +3 -2
  91. package/dist/es/core/create.js +2 -0
  92. package/dist/es/core/logger.js +4 -1
  93. package/dist/es/core/payment.js +2 -0
  94. package/dist/es/core/query.js +1 -1
  95. package/dist/es/core.js +36 -36
  96. package/dist/es/hooks/useBEM.js +3 -0
  97. package/dist/es/hooks/useBaseWallet.js +45 -9
  98. package/dist/es/hooks/usePayState.js +1 -0
  99. package/dist/es/i18n/I18n.js +2 -0
  100. package/dist/es/i18n/index.js +2 -0
  101. package/dist/es/i18n/locales/de-DE.js +1 -1
  102. package/dist/es/i18n/locales/en-GB.js +1 -1
  103. package/dist/es/i18n/locales/es-ES.js +1 -1
  104. package/dist/es/i18n/locales/fr-FR.js +1 -1
  105. package/dist/es/i18n/locales/ja-JP.js +1 -1
  106. package/dist/es/i18n/locales/ko-KR.js +1 -1
  107. package/dist/es/i18n/locales/nl-NL.js +1 -1
  108. package/dist/es/i18n/locales/pt-PT.js +1 -1
  109. package/dist/es/i18n/locales/ru-RU.js +1 -1
  110. package/dist/es/i18n/locales/zh-CN.js +1 -1
  111. package/dist/es/i18n/locales/zh-HK.js +1 -1
  112. package/dist/es/i18n/locales/zh-TW.js +1 -1
  113. package/dist/es/i18n/util.js +3 -0
  114. package/dist/es/index.js +1 -1
  115. package/dist/es/utils/bem.js +3 -0
  116. package/dist/es/utils/card-brand/brands.js +2 -0
  117. package/dist/es/utils/index.js +3 -0
  118. package/dist/es/utils/payment.js +76 -1
  119. package/dist/types/api/http.d.ts +6 -1
  120. package/dist/types/api/modules/apple-pay/index.d.ts +0 -3
  121. package/dist/types/api/modules/common/index.d.ts +39 -0
  122. package/dist/types/api/modules/index.d.ts +1 -4
  123. package/dist/types/hooks/useBaseWallet.d.ts +16 -4
  124. package/dist/types/utils/payment.d.ts +13 -2
  125. package/package.json +1 -1
  126. package/dist/es/api/modules/card/index.js +0 -16
  127. package/dist/es/api/modules/google-pay/index.js +0 -16
  128. package/dist/es/api/modules/sepa/index.js +0 -16
  129. package/dist/es/api/modules/wallet/index.js +0 -16
  130. package/dist/types/api/modules/card/index.d.ts +0 -4
  131. package/dist/types/api/modules/google-pay/index.d.ts +0 -4
  132. package/dist/types/api/modules/sepa/index.d.ts +0 -4
  133. package/dist/types/api/modules/wallet/index.d.ts +0 -18
@@ -4,6 +4,8 @@ import { isUndefined } from "../../../utils/is.js";
4
4
  import "../../../utils/card-brand/brands.js";
5
5
  import "../../../utils/system-info/get-browser-info.js";
6
6
  import { normalizedClass } from "../../../utils/format.js";
7
+ import "../../../core/context.js";
8
+ import "../../../out/fraud-detection.js";
7
9
  function IconUnionPay({ size, style, className }) {
8
10
  const computedSize = !isUndefined(size) ? `${size}px` : "1em";
9
11
  return /* @__PURE__ */ u(
@@ -4,6 +4,8 @@ import { isUndefined } from "../../../utils/is.js";
4
4
  import "../../../utils/card-brand/brands.js";
5
5
  import "../../../utils/system-info/get-browser-info.js";
6
6
  import { normalizedClass } from "../../../utils/format.js";
7
+ import "../../../core/context.js";
8
+ import "../../../out/fraud-detection.js";
7
9
  const IconVietqr = ({ size, style, className }) => {
8
10
  const computedSize = !isUndefined(size) ? `${size}px` : "1em";
9
11
  return /* @__PURE__ */ u(
@@ -4,6 +4,8 @@ import { isUndefined } from "../../../utils/is.js";
4
4
  import "../../../utils/card-brand/brands.js";
5
5
  import "../../../utils/system-info/get-browser-info.js";
6
6
  import { normalizedClass } from "../../../utils/format.js";
7
+ import "../../../core/context.js";
8
+ import "../../../out/fraud-detection.js";
7
9
  const IconVietqrComplete = ({ size, style, className }) => {
8
10
  const computedSize = !isUndefined(size) ? `${size}px` : "1em";
9
11
  return /* @__PURE__ */ u(
@@ -4,6 +4,8 @@ import { isUndefined } from "../../../utils/is.js";
4
4
  import "../../../utils/card-brand/brands.js";
5
5
  import "../../../utils/system-info/get-browser-info.js";
6
6
  import { normalizedClass } from "../../../utils/format.js";
7
+ import "../../../core/context.js";
8
+ import "../../../out/fraud-detection.js";
7
9
  function IconVisa({ size, style, className }) {
8
10
  const computedSize = !isUndefined(size) ? `${size}px` : "1em";
9
11
  return /* @__PURE__ */ u(
@@ -4,6 +4,8 @@ import { isUndefined } from "../../../utils/is.js";
4
4
  import "../../../utils/card-brand/brands.js";
5
5
  import "../../../utils/system-info/get-browser-info.js";
6
6
  import { normalizedClass } from "../../../utils/format.js";
7
+ import "../../../core/context.js";
8
+ import "../../../out/fraud-detection.js";
7
9
  const IconWechatPayGlobal = ({ size, style, className }) => {
8
10
  const computedSize = !isUndefined(size) ? `${size}px` : "1em";
9
11
  return /* @__PURE__ */ u(
@@ -4,6 +4,8 @@ import { isUndefined } from "../../../utils/is.js";
4
4
  import "../../../utils/card-brand/brands.js";
5
5
  import "../../../utils/system-info/get-browser-info.js";
6
6
  import { normalizedClass } from "../../../utils/format.js";
7
+ import "../../../core/context.js";
8
+ import "../../../out/fraud-detection.js";
7
9
  const IconWechatPayGlobalComplete = ({ size, style, className }) => {
8
10
  const computedSize = !isUndefined(size) ? `${size}px` : "1em";
9
11
  return /* @__PURE__ */ u(
@@ -4,6 +4,8 @@ import { isUndefined } from "../../../utils/is.js";
4
4
  import "../../../utils/card-brand/brands.js";
5
5
  import "../../../utils/system-info/get-browser-info.js";
6
6
  import { normalizedClass } from "../../../utils/format.js";
7
+ import "../../../core/context.js";
8
+ import "../../../out/fraud-detection.js";
7
9
  const IconZalopay = ({ size, style, className }) => {
8
10
  const computedSize = !isUndefined(size) ? `${size}px` : "1em";
9
11
  return /* @__PURE__ */ u(
@@ -4,6 +4,8 @@ import { isUndefined } from "../../../utils/is.js";
4
4
  import "../../../utils/card-brand/brands.js";
5
5
  import "../../../utils/system-info/get-browser-info.js";
6
6
  import { normalizedClass } from "../../../utils/format.js";
7
+ import "../../../core/context.js";
8
+ import "../../../out/fraud-detection.js";
7
9
  const IconZalopayComplete = ({ size, style, className }) => {
8
10
  const computedSize = !isUndefined(size) ? `${size}px` : "1em";
9
11
  return /* @__PURE__ */ u(
@@ -4,6 +4,8 @@ import { isUndefined } from "../../../utils/is.js";
4
4
  import "../../../utils/card-brand/brands.js";
5
5
  import "../../../utils/system-info/get-browser-info.js";
6
6
  import { normalizedClass } from "../../../utils/format.js";
7
+ import "../../../core/context.js";
8
+ import "../../../out/fraud-detection.js";
7
9
  function IconChecked({ size, style, className }) {
8
10
  const computedSize = !isUndefined(size) ? `${size}px` : "1em";
9
11
  return /* @__PURE__ */ u(
@@ -1,3 +1,5 @@
1
1
  import "../../../core.js";
2
2
  import "../../../utils/card-brand/brands.js";
3
3
  import "../../../utils/system-info/get-browser-info.js";
4
+ import "../../../core/context.js";
5
+ import "../../../out/fraud-detection.js";
@@ -94,25 +94,20 @@ const WechatPay = w((props, ref) => {
94
94
  },
95
95
  onProcessing: getPayEnv() === PayEnv.WX_WEB ? async (res) => {
96
96
  var _a2, _b2, _c, _d, _e, _f, _g, _h;
97
- if (!res.payInfo)
98
- return true;
99
- console.log("微信支付开始", res.payInfo);
97
+ if (!res.payInfo) {
98
+ return { continueSearch: true, actionHandled: false };
99
+ }
100
100
  (_b2 = (_a2 = core.config).onEvent) == null ? void 0 : _b2.call(_a2, WechatPayEventType.WECHAT_PAY_START);
101
101
  try {
102
102
  await launchWechatPay(res.payInfo);
103
- console.log("微信支付box回调成功");
104
103
  (_d = (_c = core.config).onEvent) == null ? void 0 : _d.call(_c, WechatPayEventType.WECHAT_PAY_SUCCESS);
105
- return true;
104
+ return { continueSearch: true, actionHandled: true };
106
105
  } catch (error) {
107
- console.log("微信支付box回调失败", error);
108
106
  const message = error instanceof Error ? error.message : String(error);
109
- console.log("微信支付box回调失败消息", message);
110
107
  if (message === WechatPayResult.CANCEL) {
111
- console.log("微信支付box回调取消");
112
108
  (_f = (_e = core.config).onEvent) == null ? void 0 : _f.call(_e, WechatPayEventType.WECHAT_PAY_CANCELLED);
113
- return false;
109
+ return { continueSearch: false, actionHandled: true };
114
110
  } else {
115
- console.log("微信支付box回调失败,发送失败事件");
116
111
  (_h = (_g = core.config).onEvent) == null ? void 0 : _h.call(_g, WechatPayEventType.WECHAT_PAY_FAILURE, { message });
117
112
  throw error;
118
113
  }
package/dist/es/config.js CHANGED
@@ -1,6 +1,8 @@
1
1
  import "./utils/card-brand/brands.js";
2
2
  import "./utils/system-info/get-browser-info.js";
3
+ import "./core/context.js";
3
4
  import "./core.js";
5
+ import "./out/fraud-detection.js";
4
6
  let apiUrl = "";
5
7
  let cdnOrigin = "";
6
8
  let cdnDir = "";
@@ -29,6 +29,9 @@ import { isNil, isArray } from "../utils/is.js";
29
29
  import "../utils/card-brand/brands.js";
30
30
  import "../utils/system-info/get-browser-info.js";
31
31
  import { createPromise } from "../utils/create-promise.js";
32
+ import "../core.js";
33
+ import "./context.js";
34
+ import "../out/fraud-detection.js";
32
35
  class AddressCore {
33
36
  constructor() {
34
37
  __privateAdd(this, _countryOptionsReadyPromise, void 0);
@@ -32,12 +32,13 @@ import { isEmptyObject } from "../utils/is.js";
32
32
  import "../utils/card-brand/brands.js";
33
33
  import "../utils/system-info/get-browser-info.js";
34
34
  import { deepMerge } from "../utils/object.js";
35
- import { genShortId } from "../utils/string.js";
35
+ import "./context.js";
36
36
  import { AddressCore } from "./address.js";
37
37
  import { PayKKaTheme } from "./theme.js";
38
38
  import { PayKKaLogger } from "./logger.js";
39
39
  import { PayKKaPayment } from "./payment.js";
40
40
  import { genPreviewData } from "./preview.js";
41
+ import { genShortId } from "../utils/string.js";
41
42
  const DEFAULT_CHECKOUT_CONFIG = {
42
43
  enableInitValidation: true,
43
44
  apiPrefix: "/session",
@@ -238,7 +239,7 @@ class PayKKaCheckout {
238
239
  onError: (error, context) => {
239
240
  var _a2, _b, _c;
240
241
  (_b = (_a2 = this.config).onEvent) == null ? void 0 : _b.call(_a2, PaymentEventType.PAYMENT_FAILURE, {
241
- message: error.message,
242
+ message: error.msg,
242
243
  code: error.code,
243
244
  ...context
244
245
  });
@@ -3,6 +3,8 @@ import { isString } from "../utils/is.js";
3
3
  import "../utils/card-brand/brands.js";
4
4
  import "../utils/system-info/get-browser-info.js";
5
5
  import { deepFreeze } from "../utils/object.js";
6
+ import "./context.js";
7
+ import "../out/fraud-detection.js";
6
8
  const internalInstMap = /* @__PURE__ */ new WeakMap();
7
9
  const setInternalInst = (inst, internalInst) => {
8
10
  const _internalInst = Object.assign(
@@ -3,6 +3,9 @@ import { STRIPE_RADAR_SCRIPT_ORIGIN, WORLDPAY_JSC_ORIGIN } from "../out/config.j
3
3
  import "../utils/card-brand/brands.js";
4
4
  import "../utils/system-info/get-browser-info.js";
5
5
  import { parseUrl } from "../utils/location.js";
6
+ import "../core.js";
7
+ import "./context.js";
8
+ import "../out/fraud-detection.js";
6
9
  const COMPONENT_PID = "71667dde4a0247c187c1c26bdc3aadcf";
7
10
  const REPORT_ORIGINS = [
8
11
  DEV_ORIGIN,
@@ -34,7 +37,7 @@ class PayKKaLogger {
34
37
  (_b = window.JlFeLogger) == null ? void 0 : _b.init({
35
38
  pid: options.pid || COMPONENT_PID,
36
39
  env: loggerEnvInfo.env,
37
- release: "0.15.2",
40
+ release: "0.16.0",
38
41
  imgUrl: loggerEnvInfo.imgUrl,
39
42
  postUrl: loggerEnvInfo.postUrl,
40
43
  beforeSend: this.beforeSendEvent
@@ -27,6 +27,8 @@ import { d } from "../core.js";
27
27
  import "../utils/card-brand/brands.js";
28
28
  import "../utils/system-info/get-browser-info.js";
29
29
  import { getUrlParam } from "../utils/location.js";
30
+ import "./context.js";
31
+ import "../out/fraud-detection.js";
30
32
  const PROCESSING_PARAM_NAME = "m";
31
33
  class PayKKaPayment {
32
34
  constructor(session) {
@@ -1,8 +1,8 @@
1
1
  import { http } from "../api/http.js";
2
+ import { onceGetCheckoutInfo } from "../api/modules/checkout/index.js";
2
3
  import { apiPrefix } from "../config.js";
3
4
  import "../utils/card-brand/brands.js";
4
5
  import "../utils/system-info/get-browser-info.js";
5
- import { onceGetCheckoutInfo } from "../api/modules/checkout/index.js";
6
6
  const querySession = async (params, extraParams = {}, options) => {
7
7
  return onceGetCheckoutInfo(params, extraParams, options);
8
8
  };
package/dist/es/core.js CHANGED
@@ -3521,7 +3521,37 @@ function isValidCSSUnit(color) {
3521
3521
  }
3522
3522
  return matchers.CSS_UNIT.test(color);
3523
3523
  }
3524
- var t$1, r, u$1, i$1, o$1 = 0, f$1 = [], c$1 = l$3, e$2 = c$1.__b, a$1 = c$1.__r, v$1 = c$1.diffed, l$2 = c$1.__c, m = c$1.unmount, s$2 = c$1.__;
3524
+ function e$2(e2, n2) {
3525
+ return n2 = n2 || {}, new Promise(function(t2, r2) {
3526
+ var s2 = new XMLHttpRequest(), o2 = [], u2 = {}, a2 = function e3() {
3527
+ return { ok: 2 == (s2.status / 100 | 0), statusText: s2.statusText, status: s2.status, url: s2.responseURL, text: function() {
3528
+ return Promise.resolve(s2.responseText);
3529
+ }, json: function() {
3530
+ return Promise.resolve(s2.responseText).then(JSON.parse);
3531
+ }, blob: function() {
3532
+ return Promise.resolve(new Blob([s2.response]));
3533
+ }, clone: e3, headers: { keys: function() {
3534
+ return o2;
3535
+ }, entries: function() {
3536
+ return o2.map(function(e4) {
3537
+ return [e4, s2.getResponseHeader(e4)];
3538
+ });
3539
+ }, get: function(e4) {
3540
+ return s2.getResponseHeader(e4);
3541
+ }, has: function(e4) {
3542
+ return null != s2.getResponseHeader(e4);
3543
+ } } };
3544
+ };
3545
+ for (var i2 in s2.open(n2.method || "get", e2, true), s2.onload = function() {
3546
+ s2.getAllResponseHeaders().toLowerCase().replace(/^(.+?):/gm, function(e3, n3) {
3547
+ u2[n3] || o2.push(u2[n3] = n3);
3548
+ }), t2(a2());
3549
+ }, s2.onerror = r2, s2.withCredentials = "include" == n2.credentials, n2.headers)
3550
+ s2.setRequestHeader(i2, n2.headers[i2]);
3551
+ s2.send(n2.body || null);
3552
+ });
3553
+ }
3554
+ var t$1, r, u$1, i$1, o$1 = 0, f$1 = [], c$1 = l$3, e$1 = c$1.__b, a$1 = c$1.__r, v$1 = c$1.diffed, l$2 = c$1.__c, m = c$1.unmount, s$2 = c$1.__;
3525
3555
  function d$2(n2, t2) {
3526
3556
  c$1.__h && c$1.__h(r, n2, o$1 || t2), o$1 = 0;
3527
3557
  var u2 = r.__H || (r.__H = { __: [], __h: [] });
@@ -3611,7 +3641,7 @@ function j$1() {
3611
3641
  }
3612
3642
  }
3613
3643
  c$1.__b = function(n2) {
3614
- r = null, e$2 && e$2(n2);
3644
+ r = null, e$1 && e$1(n2);
3615
3645
  }, c$1.__ = function(n2, t2) {
3616
3646
  n2 && t2.__k && t2.__k.__m && (n2.__m = t2.__k.__m), s$2 && s$2(n2, t2);
3617
3647
  }, c$1.__r = function(n2) {
@@ -3705,7 +3735,7 @@ function t() {
3705
3735
  }
3706
3736
  var o = void 0;
3707
3737
  var h = void 0, s$1 = 0, f = 0, v = 0;
3708
- function e$1(i2) {
3738
+ function e(i2) {
3709
3739
  if (void 0 !== o) {
3710
3740
  var t2 = i2.n;
3711
3741
  if (void 0 === t2 || t2.t !== o) {
@@ -3796,7 +3826,7 @@ u.prototype.peek = function() {
3796
3826
  }
3797
3827
  };
3798
3828
  Object.defineProperty(u.prototype, "value", { get: function() {
3799
- var i2 = e$1(this);
3829
+ var i2 = e(this);
3800
3830
  if (void 0 !== i2)
3801
3831
  i2.i = this.i;
3802
3832
  return this.v;
@@ -3927,7 +3957,7 @@ y.prototype.N = function() {
3927
3957
  Object.defineProperty(y.prototype, "value", { get: function() {
3928
3958
  if (1 & this.f)
3929
3959
  throw new Error("Cycle detected");
3930
- var i2 = e$1(this);
3960
+ var i2 = e(this);
3931
3961
  this.h();
3932
3962
  if (void 0 !== i2)
3933
3963
  i2.i = this.i;
@@ -4210,36 +4240,6 @@ function useSignal(n2) {
4210
4240
  return d$1(n2);
4211
4241
  }, []);
4212
4242
  }
4213
- function e(e2, n2) {
4214
- return n2 = n2 || {}, new Promise(function(t2, r2) {
4215
- var s2 = new XMLHttpRequest(), o2 = [], u2 = {}, a2 = function e3() {
4216
- return { ok: 2 == (s2.status / 100 | 0), statusText: s2.statusText, status: s2.status, url: s2.responseURL, text: function() {
4217
- return Promise.resolve(s2.responseText);
4218
- }, json: function() {
4219
- return Promise.resolve(s2.responseText).then(JSON.parse);
4220
- }, blob: function() {
4221
- return Promise.resolve(new Blob([s2.response]));
4222
- }, clone: e3, headers: { keys: function() {
4223
- return o2;
4224
- }, entries: function() {
4225
- return o2.map(function(e4) {
4226
- return [e4, s2.getResponseHeader(e4)];
4227
- });
4228
- }, get: function(e4) {
4229
- return s2.getResponseHeader(e4);
4230
- }, has: function(e4) {
4231
- return null != s2.getResponseHeader(e4);
4232
- } } };
4233
- };
4234
- for (var i2 in s2.open(n2.method || "get", e2, true), s2.onload = function() {
4235
- s2.getAllResponseHeaders().toLowerCase().replace(/^(.+?):/gm, function(e3, n3) {
4236
- u2[n3] || o2.push(u2[n3] = n3);
4237
- }), t2(a2());
4238
- }, s2.onerror = r2, s2.withCredentials = "include" == n2.credentials, n2.headers)
4239
- s2.setRequestHeader(i2, n2.headers[i2]);
4240
- s2.send(n2.body || null);
4241
- });
4242
- }
4243
4243
  /*! noble-ciphers - MIT License (c) 2023 Paul Miller (paulmillr.com) */
4244
4244
  function isBytes(a2) {
4245
4245
  return a2 instanceof Uint8Array || ArrayBuffer.isView(a2) && a2.constructor.name === "Uint8Array";
@@ -7019,7 +7019,7 @@ export {
7019
7019
  b$1 as b,
7020
7020
  browser,
7021
7021
  d$1 as d,
7022
- e,
7022
+ e$2 as e,
7023
7023
  gcm,
7024
7024
  h$1 as h,
7025
7025
  index,
@@ -2,6 +2,9 @@ import { PREFIX } from "../constant.js";
2
2
  import "../utils/card-brand/brands.js";
3
3
  import "../utils/system-info/get-browser-info.js";
4
4
  import { createBEM } from "../utils/bem.js";
5
+ import "../core.js";
6
+ import "../core/context.js";
7
+ import "../out/fraud-detection.js";
5
8
  function useBEM(name) {
6
9
  return createBEM(`${PREFIX}-${name}`);
7
10
  }
@@ -2,10 +2,10 @@ import { SessionMode } from "../constant.js";
2
2
  import { PaymentAction } from "../types/index.js";
3
3
  import { isTimeoutError } from "../api/http.js";
4
4
  import { safeParse, safeStringify } from "../utils/index.js";
5
- import { h, y } from "../core.js";
6
- import { buildPaymentParams } from "../api/utils/index.js";
7
- import { getWalletPayInfo, walletPay } from "../api/modules/wallet/index.js";
5
+ import { h, A, y } from "../core.js";
6
+ import { commonPaymentQuery, commonPayment } from "../api/modules/common/index.js";
8
7
  import { getBrowserParams } from "../api/modules/get-browser-params.js";
8
+ import { buildPaymentParams } from "../api/utils/index.js";
9
9
  import { usePayState } from "./usePayState.js";
10
10
  import { useRetry, DEFAULT_RETRY_POLL_TIERS } from "./useRetry.js";
11
11
  import "../core/context.js";
@@ -39,6 +39,11 @@ const useBaseWallet = (paymentMethod, baseProps, options) => {
39
39
  const [showQRCodeModal, setShowQRCodeModal] = h(false);
40
40
  const [qrCodeInfo, setQrCodeInfo] = h();
41
41
  const mobile = isMobile();
42
+ const queryFromPaymentRef = A(false);
43
+ const actionHandledRef = A(false);
44
+ const markActionHandled = () => {
45
+ actionHandledRef.current = true;
46
+ };
42
47
  const getPaymentMethodContext = () => {
43
48
  return {
44
49
  paymentMethod
@@ -140,6 +145,7 @@ const useBaseWallet = (paymentMethod, baseProps, options) => {
140
145
  }
141
146
  );
142
147
  const startRetry = (timeout) => {
148
+ queryFromPaymentRef.current = false;
143
149
  setPaymentButtonStatus("loading");
144
150
  startSearch({ timeout });
145
151
  };
@@ -148,12 +154,12 @@ const useBaseWallet = (paymentMethod, baseProps, options) => {
148
154
  stopSearch();
149
155
  };
150
156
  const getPaymentInfo = async (search2 = false, timeout) => {
151
- var _a, _b, _c, _d, _e;
157
+ var _a, _b, _c, _d, _e, _f, _g;
152
158
  const requestOptions = { locale: i18n.locale, timeout };
153
159
  if (search2) {
154
160
  const extraParams = (_b = (_a = core.config)._getExtraParams) == null ? void 0 : _b.call(_a, "query", paymentMethod);
155
161
  const params = getSearchParams();
156
- return await getWalletPayInfo(params, extraParams, requestOptions);
162
+ return await commonPaymentQuery(params, extraParams, requestOptions);
157
163
  } else {
158
164
  const params = await getPaymentParams();
159
165
  const extraParams = (_d = (_c = core.config)._getExtraParams) == null ? void 0 : _d.call(_c, "payment", paymentMethod);
@@ -165,11 +171,26 @@ const useBaseWallet = (paymentMethod, baseProps, options) => {
165
171
  executePayment(params, extraParams);
166
172
  return;
167
173
  }
168
- return await walletPay(params, extraParams, requestOptions);
174
+ return await commonPayment({
175
+ params,
176
+ extraParams,
177
+ options: {
178
+ request: requestOptions,
179
+ query: {
180
+ enable: true,
181
+ params: getSearchParams(),
182
+ extraParams: (_g = (_f = core.config)._getExtraParams) == null ? void 0 : _g.call(_f, "query", paymentMethod)
183
+ }
184
+ }
185
+ });
169
186
  }
170
187
  };
171
188
  const processPayment = async (search2 = false, timeout) => {
172
189
  try {
190
+ if (!search2) {
191
+ queryFromPaymentRef.current = false;
192
+ actionHandledRef.current = false;
193
+ }
173
194
  core.payment.currPaymentMethod.value = paymentMethod;
174
195
  const paymentInfo = await getPaymentInfo(search2, timeout);
175
196
  if (!paymentInfo) {
@@ -200,6 +221,7 @@ const useBaseWallet = (paymentMethod, baseProps, options) => {
200
221
  onProcessing: async () => {
201
222
  var _a2;
202
223
  const { action } = payInfo || {};
224
+ const canHandleAction = !search2 || queryFromPaymentRef.current && !actionHandledRef.current;
203
225
  const processScanCode = () => {
204
226
  const qrCodeUrl = (payInfo == null ? void 0 : payInfo.qr_code) || (payInfo == null ? void 0 : payInfo.targetUrl);
205
227
  if (qrCodeUrl) {
@@ -208,12 +230,21 @@ const useBaseWallet = (paymentMethod, baseProps, options) => {
208
230
  expiredTime: payInfo.paymentExpiredAt
209
231
  });
210
232
  setShowQRCodeModal(true);
233
+ markActionHandled();
211
234
  }
212
235
  };
213
236
  let continueSearch = true;
214
- if (!search2 && onProcessing) {
237
+ if (search2 && !canHandleAction) {
238
+ end = false;
239
+ return;
240
+ }
241
+ if (onProcessing) {
215
242
  const res = await onProcessing(paymentInfo);
216
- continueSearch = res !== false;
243
+ const { actionHandled = false } = res || {};
244
+ if (actionHandled) {
245
+ markActionHandled();
246
+ }
247
+ continueSearch = (res == null ? void 0 : res.continueSearch) ?? true;
217
248
  } else {
218
249
  switch (action) {
219
250
  case PaymentAction.SCAN_CODE: {
@@ -225,6 +256,7 @@ const useBaseWallet = (paymentMethod, baseProps, options) => {
225
256
  case PaymentAction.REDIRECT:
226
257
  case PaymentAction.REDIRECT_POST: {
227
258
  if (redirectMode === "auto" && (payInfo == null ? void 0 : payInfo.targetUrl)) {
259
+ markActionHandled();
228
260
  if (action === PaymentAction.REDIRECT) {
229
261
  redirectByGet(payInfo.targetUrl);
230
262
  } else {
@@ -240,6 +272,7 @@ const useBaseWallet = (paymentMethod, baseProps, options) => {
240
272
  processScanCode();
241
273
  } else {
242
274
  if (redirectMode === "auto" && (payInfo == null ? void 0 : payInfo.targetUrl)) {
275
+ markActionHandled();
243
276
  redirectToPayment(payInfo);
244
277
  end = false;
245
278
  return;
@@ -249,7 +282,10 @@ const useBaseWallet = (paymentMethod, baseProps, options) => {
249
282
  }
250
283
  }
251
284
  }
252
- !search2 && continueSearch && startSearch();
285
+ if (!search2 && continueSearch) {
286
+ queryFromPaymentRef.current = true;
287
+ startSearch();
288
+ }
253
289
  end = !continueSearch;
254
290
  if (end) {
255
291
  (_a2 = core.payment) == null ? void 0 : _a2.resetCurrPaymentMethod();
@@ -4,6 +4,7 @@ import { useI18n } from "./useI18n.js";
4
4
  import { fraudDetectionEnv, customLocale } from "../config.js";
5
5
  import "../utils/card-brand/brands.js";
6
6
  import { getBrowserInfo } from "../utils/system-info/get-browser-info.js";
7
+ import "../core/context.js";
7
8
  import { getRealLocale } from "../i18n/util.js";
8
9
  const usePayState = (session, core) => {
9
10
  var _a;
@@ -8,6 +8,8 @@ import "../utils/card-brand/brands.js";
8
8
  import { getBrowserInfo } from "../utils/system-info/get-browser-info.js";
9
9
  import { loadTranslation } from "./util.js";
10
10
  import { d } from "../core.js";
11
+ import "../core/context.js";
12
+ import "../out/fraud-detection.js";
11
13
  const _I18n = class _I18n {
12
14
  constructor() {
13
15
  /** 语言 */
@@ -1,3 +1,5 @@
1
1
  import "../utils/card-brand/brands.js";
2
2
  import "../utils/system-info/get-browser-info.js";
3
+ import "../core/context.js";
3
4
  import "../core.js";
5
+ import "../out/fraud-detection.js";
@@ -58,7 +58,7 @@ const deDE = {
58
58
  "common.pay": "Jetzt kaufen",
59
59
  "common.payProcessing": "Wird bearbeitet...",
60
60
  "common.paySuccess": "Zahlung erfolgreich",
61
- "common.payTimeout": "Verbindung verloren",
61
+ "common.payTimeout": "Ihre Netzwerkverbindung ist instabil. Die Zahlung wurde möglicherweise abgeschlossen.",
62
62
  "common.pay3DSIncomplete": "3DS-Authentifizierung unvollständig",
63
63
  "common.queryTimeout": "Abfragezeitüberschreitung, bitte aktualisieren Sie die Seite oder versuchen Sie erneut zu bezahlen",
64
64
  "common.generateQrCode": "QR-Code erstellen",
@@ -58,7 +58,7 @@ const enGB = {
58
58
  "common.pay": "Buy now",
59
59
  "common.payProcessing": "Processing...",
60
60
  "common.paySuccess": "Payment Successful",
61
- "common.payTimeout": "Connection lost",
61
+ "common.payTimeout": "Your network connection is unstable. The payment may have been completed.",
62
62
  "common.pay3DSIncomplete": "3DS Authentication Incomplete",
63
63
  "common.queryTimeout": "Query timed out. Please refresh the page or pay again",
64
64
  "common.generateQrCode": "Generate QR code",
@@ -58,7 +58,7 @@ const esES = {
58
58
  "common.pay": "Comprar ahora",
59
59
  "common.payProcessing": "Procesando...",
60
60
  "common.paySuccess": "Pago exitoso",
61
- "common.payTimeout": "Conexión perdida",
61
+ "common.payTimeout": "Su conexión de red es inestable. Es posible que el pago se haya completado.",
62
62
  "common.pay3DSIncomplete": "Autenticación 3DS incompleta",
63
63
  "common.queryTimeout": "Tiempo de consulta agotado, por favor actualice la página o intente pagar nuevamente.",
64
64
  "common.generateQrCode": "Generar código QR",
@@ -58,7 +58,7 @@ const frFR = {
58
58
  "common.pay": "Acheter maintenant",
59
59
  "common.payProcessing": "Traitement en cours...",
60
60
  "common.paySuccess": "Paiement réussi",
61
- "common.payTimeout": "Connexion perdue",
61
+ "common.payTimeout": "Votre connexion réseau est instable. Le paiement a peut-être été effectué.",
62
62
  "common.pay3DSIncomplete": "Authentification 3DS incomplète",
63
63
  "common.queryTimeout": "Délai d'attente de la requête dépassé, veuillez actualiser la page ou réessayer de payer",
64
64
  "common.generateQrCode": "Générer le code QR",
@@ -58,7 +58,7 @@ const jaJP = {
58
58
  "common.pay": "今すぐ購入",
59
59
  "common.payProcessing": "処理中...",
60
60
  "common.paySuccess": "支払いが成功しました",
61
- "common.payTimeout": "接続が失われました",
61
+ "common.payTimeout": "ネットワーク接続が不安定です。支払いはすでに完了している可能性があります。",
62
62
  "common.pay3DSIncomplete": "3DS認証が不完全です",
63
63
  "common.queryTimeout": "クエリのタイムアウト、ページを更新するか、再度支払ってください",
64
64
  "common.generateQrCode": "QRコードを生成",
@@ -58,7 +58,7 @@ const koKR = {
58
58
  "common.pay": "지금 구매",
59
59
  "common.payProcessing": "처리 중...",
60
60
  "common.paySuccess": "결제 성공",
61
- "common.payTimeout": "연결 끊김",
61
+ "common.payTimeout": "네트워크 연결이 불안정합니다. 결제가 이미 완료되었을 수 있습니다.",
62
62
  "common.pay3DSIncomplete": "3DS 인증 불완전",
63
63
  "common.queryTimeout": "조회 시간 초과, 페이지를 새로 고치거나 다시 결제해 주세요.",
64
64
  "common.generateQrCode": "QR 코드 생성",
@@ -58,7 +58,7 @@ const nlNL = {
58
58
  "common.pay": "Nu kopen",
59
59
  "common.payProcessing": "Verwerken...",
60
60
  "common.paySuccess": "Betaling succesvol",
61
- "common.payTimeout": "Verbinding verbroken",
61
+ "common.payTimeout": "Uw netwerkverbinding is instabiel. De betaling is mogelijk al voltooid.",
62
62
  "common.pay3DSIncomplete": "3DS Authenticatie onvolledig",
63
63
  "common.queryTimeout": "Query time-out. Vernieuw de pagina of betaal opnieuw",
64
64
  "common.generateQrCode": "QR-code genereren",
@@ -58,7 +58,7 @@ const ptPT = {
58
58
  "common.pay": "Comprar agora",
59
59
  "common.payProcessing": "Processando...",
60
60
  "common.paySuccess": "Pagamento bem-sucedido",
61
- "common.payTimeout": "Conexão perdida",
61
+ "common.payTimeout": "A sua ligação de rede está instável. O pagamento pode ter sido concluído.",
62
62
  "common.pay3DSIncomplete": "Autenticação 3DS Incompleta",
63
63
  "common.queryTimeout": "Tempo de consulta esgotado, por favor atualize a página ou tente pagar novamente",
64
64
  "common.generateQrCode": "Gerar código QR",
@@ -58,7 +58,7 @@ const ruRU = {
58
58
  "common.pay": "Купить сейчас",
59
59
  "common.payProcessing": "Обработка...",
60
60
  "common.paySuccess": "Оплата успешна",
61
- "common.payTimeout": "Соединение потеряно",
61
+ "common.payTimeout": "Ваше сетевое соединение нестабильно. Платеж, возможно, уже выполнен.",
62
62
  "common.pay3DSIncomplete": "Аутентификация 3DS не завершена",
63
63
  "common.queryTimeout": "Время ожидания запроса истекло, пожалуйста, обновите страницу или попробуйте оплатить снова",
64
64
  "common.generateQrCode": "Сгенерировать QR-код",
@@ -58,7 +58,7 @@ const zhCN = {
58
58
  "common.pay": "支付",
59
59
  "common.payProcessing": "处理中...",
60
60
  "common.paySuccess": "支付成功",
61
- "common.payTimeout": "支付超时",
61
+ "common.payTimeout": "您的网络连接不稳定,付款可能已经成功。",
62
62
  "common.pay3DSIncomplete": "未完成3DS认证",
63
63
  "common.queryTimeout": "查询超时,请刷新页面或者重新支付查询结果",
64
64
  "common.generateQrCode": "生成二维码",
@@ -58,7 +58,7 @@ const zhHK = {
58
58
  "common.pay": "支付",
59
59
  "common.payProcessing": "處理中...",
60
60
  "common.paySuccess": "支付成功",
61
- "common.payTimeout": "支付超時",
61
+ "common.payTimeout": "您的網絡連線不穩定,付款可能已經成功。",
62
62
  "common.pay3DSIncomplete": "未完成3DS認證",
63
63
  "common.queryTimeout": "查詢超時,請刷新頁面或者重新支付查詢結果",
64
64
  "common.generateQrCode": "生成二維碼",