@pisell/private-materials 6.3.109 → 6.3.111

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 (85) hide show
  1. package/build/lowcode/assets-daily.json +11 -11
  2. package/build/lowcode/assets-dev.json +2 -2
  3. package/build/lowcode/assets-prod.json +11 -11
  4. package/build/lowcode/index.js +1 -1
  5. package/build/lowcode/meta.js +1 -1
  6. package/build/lowcode/preview.js +9 -9
  7. package/build/lowcode/render/default/view.css +1 -1
  8. package/build/lowcode/render/default/view.js +10 -10
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +11 -11
  11. package/es/components/booking/forms/sendModal/useSendModal.d.ts +1 -0
  12. package/es/components/eftposPay/hooks.d.ts +1 -1
  13. package/es/components/eftposPay/store/index.d.ts +3 -3
  14. package/es/components/eventBooking/components/ErrorTip/index.d.ts +1 -0
  15. package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/CallToBook/index.d.ts +1 -0
  16. package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/WeekItem/index.d.ts +1 -0
  17. package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/index.d.ts +1 -0
  18. package/es/components/pay/toC/PaymentMethods/MWCreditCard/Add/index.d.ts +6 -0
  19. package/es/components/pay/toC/PaymentMethods/MWCreditCard/Add/index.js +65 -21
  20. package/es/components/pay/toC/PaymentMethods/MWCreditCard/Add/index.less +110 -9
  21. package/es/components/pay/toC/PaymentMethods/MWCreditCard/List/index.d.ts +2 -0
  22. package/es/components/pay/toC/PaymentMethods/MWCreditCard/List/index.js +28 -16
  23. package/es/components/pay/toC/PaymentMethods/MWCreditCard/TDSPay/ThreedsLoading/index.d.ts +20 -1
  24. package/es/components/pay/toC/PaymentMethods/MWCreditCard/TDSPay/ThreedsLoading/index.js +14 -1
  25. package/es/components/pay/toC/PaymentMethods/MWCreditCard/TDSPay/ThreedsLoading/index.less +20 -0
  26. package/es/components/pay/toC/PaymentMethods/MWCreditCard/TDSPay/index.d.ts +7 -1
  27. package/es/components/pay/toC/PaymentMethods/MWCreditCard/TDSPay/index.js +167 -56
  28. package/es/components/pay/toC/PaymentMethods/MWCreditCard/TDSPay/index.less +47 -0
  29. package/es/components/pay/toC/PaymentMethods/MWCreditCard/components/TDSErrorModal/index.d.ts +34 -0
  30. package/es/components/pay/toC/PaymentMethods/MWCreditCard/components/TDSErrorModal/index.js +83 -0
  31. package/es/components/pay/toC/PaymentMethods/MWCreditCard/components/TDSErrorModal/index.less +52 -0
  32. package/es/components/pay/toC/PaymentMethods/MWCreditCard/index.d.ts +9 -1
  33. package/es/components/pay/toC/PaymentMethods/MWCreditCard/index.js +260 -33
  34. package/es/components/pay/toC/PaymentMethods/MWCreditCard/tds2.d.ts +23 -3
  35. package/es/components/pay/toC/PaymentMethods/MWCreditCard/tds2.js +292 -115
  36. package/es/components/pay/toC/PaymentMethods/index.js +12 -2
  37. package/es/components/pay/toC/index.js +53 -18
  38. package/es/components/pay/toC/locales.d.ts +115 -0
  39. package/es/components/pay/toC/locales.js +143 -18
  40. package/es/components/pay/toC/serve.d.ts +10 -0
  41. package/es/components/pay/toC/serve.js +40 -1
  42. package/es/components/pay/toC/utils.d.ts +5 -0
  43. package/es/components/pay/toC/utils.js +10 -0
  44. package/es/plus/pisellSalesManagement/config/booking.d.ts +6 -6
  45. package/es/plus/selectHolder/components/ErrorTip/index.d.ts +1 -0
  46. package/es/plus/walletEditor/components/ImageUpload/index.d.ts +1 -1
  47. package/es/pro/Selector/Selector.d.ts +1 -1
  48. package/lib/components/booking/forms/sendModal/useSendModal.d.ts +1 -0
  49. package/lib/components/eftposPay/hooks.d.ts +1 -1
  50. package/lib/components/eftposPay/store/index.d.ts +3 -3
  51. package/lib/components/eventBooking/components/ErrorTip/index.d.ts +1 -0
  52. package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/CallToBook/index.d.ts +1 -0
  53. package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/WeekItem/index.d.ts +1 -0
  54. package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/index.d.ts +1 -0
  55. package/lib/components/pay/toC/PaymentMethods/MWCreditCard/Add/index.d.ts +6 -0
  56. package/lib/components/pay/toC/PaymentMethods/MWCreditCard/Add/index.js +40 -17
  57. package/lib/components/pay/toC/PaymentMethods/MWCreditCard/Add/index.less +110 -9
  58. package/lib/components/pay/toC/PaymentMethods/MWCreditCard/List/index.d.ts +2 -0
  59. package/lib/components/pay/toC/PaymentMethods/MWCreditCard/List/index.js +17 -5
  60. package/lib/components/pay/toC/PaymentMethods/MWCreditCard/TDSPay/ThreedsLoading/index.d.ts +20 -1
  61. package/lib/components/pay/toC/PaymentMethods/MWCreditCard/TDSPay/ThreedsLoading/index.js +8 -2
  62. package/lib/components/pay/toC/PaymentMethods/MWCreditCard/TDSPay/ThreedsLoading/index.less +20 -0
  63. package/lib/components/pay/toC/PaymentMethods/MWCreditCard/TDSPay/index.d.ts +7 -1
  64. package/lib/components/pay/toC/PaymentMethods/MWCreditCard/TDSPay/index.js +98 -24
  65. package/lib/components/pay/toC/PaymentMethods/MWCreditCard/TDSPay/index.less +47 -0
  66. package/lib/components/pay/toC/PaymentMethods/MWCreditCard/components/TDSErrorModal/index.d.ts +34 -0
  67. package/lib/components/pay/toC/PaymentMethods/MWCreditCard/components/TDSErrorModal/index.js +107 -0
  68. package/lib/components/pay/toC/PaymentMethods/MWCreditCard/components/TDSErrorModal/index.less +52 -0
  69. package/lib/components/pay/toC/PaymentMethods/MWCreditCard/index.d.ts +9 -1
  70. package/lib/components/pay/toC/PaymentMethods/MWCreditCard/index.js +149 -5
  71. package/lib/components/pay/toC/PaymentMethods/MWCreditCard/tds2.d.ts +23 -3
  72. package/lib/components/pay/toC/PaymentMethods/MWCreditCard/tds2.js +99 -16
  73. package/lib/components/pay/toC/PaymentMethods/index.js +17 -12
  74. package/lib/components/pay/toC/index.js +34 -3
  75. package/lib/components/pay/toC/locales.d.ts +115 -0
  76. package/lib/components/pay/toC/locales.js +133 -18
  77. package/lib/components/pay/toC/serve.d.ts +10 -0
  78. package/lib/components/pay/toC/serve.js +10 -0
  79. package/lib/components/pay/toC/utils.d.ts +5 -0
  80. package/lib/components/pay/toC/utils.js +17 -0
  81. package/lib/plus/pisellSalesManagement/config/booking.d.ts +6 -6
  82. package/lib/plus/selectHolder/components/ErrorTip/index.d.ts +1 -0
  83. package/lib/plus/walletEditor/components/ImageUpload/index.d.ts +1 -1
  84. package/lib/pro/Selector/Selector.d.ts +1 -1
  85. package/package.json +4 -4
@@ -0,0 +1,34 @@
1
+ import React from 'react';
2
+ import './index.less';
3
+ /** 弹窗场景类型 */
4
+ export declare type TDSErrorModalType = 'tds-not-supported' | 'bank-verify-failed';
5
+ export interface TDSErrorModalProps {
6
+ /** 弹窗是否可见 */
7
+ open: boolean;
8
+ /**
9
+ * 弹窗场景类型,决定标题与描述文案
10
+ * - 'tds-not-supported':卡不支持 3DS 验证(默认)
11
+ * - 'bank-verify-failed':银行安全验证失败(700500)
12
+ */
13
+ type?: TDSErrorModalType;
14
+ /** 商家联系电话 */
15
+ shopPhone?: string;
16
+ /** 商家联系邮箱 */
17
+ shopEmail?: string;
18
+ /** 更换卡片(留在卡列表页面) */
19
+ onUseAnotherCard?: () => void;
20
+ /** 使用其他支付方式(返回支付方式列表) */
21
+ onUseAnotherPayment?: () => void;
22
+ /** 稍后支付(跳转订单详情页) */
23
+ onPayLater?: () => void;
24
+ }
25
+ /**
26
+ * @title: 支付错误弹窗(通用)
27
+ * @description: 根据 type 展示不同文案,按钮行为一致:
28
+ * 更换卡片 / 使用其他支付方式 / 稍后支付。
29
+ * 支持两种场景:
30
+ * 1. tds-not-supported —— 预检查发现卡不支持 3DS 验证
31
+ * 2. bank-verify-failed —— 3DS 流程中银行安全验证失败(700500)
32
+ */
33
+ declare const TDSErrorModal: React.FC<TDSErrorModalProps>;
34
+ export default TDSErrorModal;
@@ -0,0 +1,107 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+
29
+ // src/components/pay/toC/PaymentMethods/MWCreditCard/components/TDSErrorModal/index.tsx
30
+ var TDSErrorModal_exports = {};
31
+ __export(TDSErrorModal_exports, {
32
+ default: () => TDSErrorModal_default
33
+ });
34
+ module.exports = __toCommonJS(TDSErrorModal_exports);
35
+ var import_react = __toESM(require("react"));
36
+ var import_antd = require("antd");
37
+ var import_materials = require("@pisell/materials");
38
+ var import_utils = require("@pisell/utils");
39
+ var import_index = require("./index.less");
40
+ var TEXT_KEY_MAP = {
41
+ /** 预检查:卡不支持 3DS 验证 */
42
+ "tds-not-supported": {
43
+ title: "tocPay.text.tdsErrorTitle",
44
+ desc: "tocPay.text.tdsErrorDesc"
45
+ },
46
+ /** 支付中:银行安全验证失败(700500) */
47
+ "bank-verify-failed": {
48
+ title: "tocPay.text.bankVerifyFailedTitle",
49
+ desc: "tocPay.text.bankVerifyFailedDesc"
50
+ }
51
+ };
52
+ var TDSErrorModal = ({
53
+ open,
54
+ type = "tds-not-supported",
55
+ shopPhone,
56
+ shopEmail,
57
+ onUseAnotherCard,
58
+ onUseAnotherPayment,
59
+ onPayLater
60
+ }) => {
61
+ const showContact = !!(shopPhone || shopEmail);
62
+ const textKeys = (0, import_react.useMemo)(() => TEXT_KEY_MAP[type], [type]);
63
+ return /* @__PURE__ */ import_react.default.createElement(
64
+ import_materials.PisellModal,
65
+ {
66
+ open,
67
+ closable: false,
68
+ footer: null,
69
+ header: false,
70
+ mobileModalHeight: "auto",
71
+ headerDivider: false,
72
+ footerDivider: false,
73
+ bodyStyle: { padding: 24 },
74
+ transitionName: "pisell-move-down"
75
+ },
76
+ /* @__PURE__ */ import_react.default.createElement("div", { className: "tds-error-modal" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "tds-error-modal-title" }, import_utils.locales.getText(textKeys.title)), /* @__PURE__ */ import_react.default.createElement("div", { className: "tds-error-modal-desc" }, import_utils.locales.getText(textKeys.desc)), /* @__PURE__ */ import_react.default.createElement("div", { className: "tds-error-modal-actions" }, /* @__PURE__ */ import_react.default.createElement(
77
+ import_antd.Button,
78
+ {
79
+ type: "primary",
80
+ block: true,
81
+ className: "tds-error-modal-btn-primary",
82
+ onClick: onUseAnotherCard
83
+ },
84
+ import_utils.locales.getText("tocPay.text.useAnotherCard")
85
+ ), /* @__PURE__ */ import_react.default.createElement(
86
+ import_antd.Button,
87
+ {
88
+ block: true,
89
+ className: "tds-error-modal-btn-secondary",
90
+ onClick: onUseAnotherPayment
91
+ },
92
+ import_utils.locales.getText("tocPay.text.useAnotherPayment")
93
+ ), /* @__PURE__ */ import_react.default.createElement(
94
+ import_antd.Button,
95
+ {
96
+ block: true,
97
+ className: "tds-error-modal-btn-secondary",
98
+ onClick: onPayLater
99
+ },
100
+ import_utils.locales.getText("tocPay.text.payLater")
101
+ )), showContact && /* @__PURE__ */ import_react.default.createElement("div", { className: "tds-error-modal-contact" }, import_utils.locales.getText("tocPay.text.paymentTroubleContact")(
102
+ shopPhone || "",
103
+ shopEmail || ""
104
+ )))
105
+ );
106
+ };
107
+ var TDSErrorModal_default = TDSErrorModal;
@@ -0,0 +1,52 @@
1
+ .tds-error-modal {
2
+ display: flex;
3
+ flex-direction: column;
4
+ gap: 0;
5
+ }
6
+
7
+ .tds-error-modal-title {
8
+ color: var(--Gray-900, #101828);
9
+ font-size: 20px;
10
+ font-weight: 600;
11
+ line-height: 28px;
12
+ margin-bottom: 8px;
13
+ }
14
+
15
+ .tds-error-modal-desc {
16
+ color: var(--Gray-600, #475467);
17
+ font-size: 14px;
18
+ font-weight: 400;
19
+ line-height: 20px;
20
+ margin-bottom: 24px;
21
+ white-space: pre-line;
22
+ }
23
+
24
+ .tds-error-modal-actions {
25
+ display: flex;
26
+ flex-direction: column;
27
+ gap: 12px;
28
+ margin-bottom: 16px;
29
+ }
30
+
31
+ .tds-error-modal-btn-primary {
32
+ font-size: 16px;
33
+ font-weight: 500;
34
+ border-radius: 8px;
35
+ }
36
+
37
+ .tds-error-modal-btn-secondary {
38
+ font-size: 16px;
39
+ font-weight: 500;
40
+ border-radius: 8px;
41
+ }
42
+
43
+ .tds-error-modal-contact {
44
+ color: var(--Gray-500, #667085);
45
+ font-size: 12px;
46
+ font-weight: 400;
47
+ line-height: 18px;
48
+ text-align: center;
49
+ padding-top: 8px;
50
+ border-top: 1px solid var(--Gray-200, #eaecf0);
51
+ word-break: break-word;
52
+ }
@@ -1,7 +1,15 @@
1
1
  import React from 'react';
2
2
  import './index.less';
3
+ interface MWCreditCardProps {
4
+ /** 店铺名称,用于授权说明文案 */
5
+ shopName?: string;
6
+ /** 商家联系电话(用于 3DS 错误弹窗联系方式) */
7
+ shopPhone?: string;
8
+ /** 商家联系邮箱(用于 3DS 错误弹窗联系方式) */
9
+ shopEmail?: string;
10
+ }
3
11
  export interface MWCreditCardRef {
4
12
  init: (res: any) => void;
5
13
  }
6
- declare const _default: React.ForwardRefExoticComponent<Omit<any, "ref"> & React.RefAttributes<unknown>>;
14
+ declare const _default: React.ForwardRefExoticComponent<MWCreditCardProps & React.RefAttributes<unknown>>;
7
15
  export default _default;
@@ -35,27 +35,148 @@ module.exports = __toCommonJS(MWCreditCard_exports);
35
35
  var import_react = __toESM(require("react"));
36
36
  var import_List = __toESM(require("./List"));
37
37
  var import_Add = __toESM(require("./Add"));
38
+ var import_serve = require("./List/serve");
38
39
  var import_TDSPay = __toESM(require("./TDSPay"));
39
40
  var import_model = require("../../model");
41
+ var import_tds2 = require("./tds2");
42
+ var import_payGroup = require("../../payGroup");
43
+ var import_utils = require("@pisell/utils");
44
+ var import_materials = require("@pisell/materials");
45
+ var import_TDSErrorModal = __toESM(require("./components/TDSErrorModal"));
40
46
  var import_index = require("./index.less");
47
+ var import_useEngineContext = __toESM(require("../../../../../hooks/useEngineContext"));
41
48
  var MWCreditCard = (props, ref) => {
42
49
  const MWCreditCardListRef2 = (0, import_react.useRef)();
43
50
  const AddMWCreditCardRef2 = (0, import_react.useRef)();
44
51
  const TDSPayRef2 = (0, import_react.useRef)();
52
+ const context = (0, import_useEngineContext.default)();
53
+ const utils = context.appHelper.utils || {};
45
54
  const [order, setOrder] = (0, import_react.useState)(null);
55
+ const [tdsErrorVisible, setTdsErrorVisible] = (0, import_react.useState)(false);
56
+ const [bankVerifyFailVisible, setBankVerifyFailVisible] = (0, import_react.useState)(false);
57
+ const [loading, setLoading] = (0, import_react.useState)(false);
46
58
  const { state } = (0, import_react.useContext)(import_model.Context);
47
59
  const init = async (res) => {
48
60
  var _a;
49
61
  setOrder(res.order);
50
62
  (_a = MWCreditCardListRef2.current) == null ? void 0 : _a.init(order);
51
63
  };
64
+ const closeAll = () => {
65
+ var _a, _b;
66
+ (_a = MWCreditCardListRef2.current) == null ? void 0 : _a.close();
67
+ (_b = AddMWCreditCardRef2.current) == null ? void 0 : _b.close();
68
+ };
52
69
  const fastPay = async (card) => {
70
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
71
+ try {
72
+ setLoading(true);
73
+ (_b = (_a = utils == null ? void 0 : utils.Toast) == null ? void 0 : _a.loading) == null ? void 0 : _b.call(_a, import_utils.locales.getText("tocPay.text.checkingCard"), 0, void 0, true);
74
+ const params = (0, import_payGroup.getPayGroupParamsFromStorage)(
75
+ (_c = state.payGroup) == null ? void 0 : _c.order_id,
76
+ { card_id: card.id }
77
+ );
78
+ if (!params) {
79
+ (_d = state.payCallback) == null ? void 0 : _d.call(state, {
80
+ key: "fail",
81
+ data: {
82
+ res: card,
83
+ fn: "MWCreditCard.fastPay.noParams",
84
+ message: import_utils.locales.getText("tocPay.text.getParamsFail")
85
+ }
86
+ });
87
+ return;
88
+ }
89
+ const { data } = await (0, import_serve.fastPayNew)({
90
+ order_id: (_e = state.payGroup) == null ? void 0 : _e.order_id,
91
+ params
92
+ });
93
+ (0, import_payGroup.setPayNumber)((_f = state.payGroup) == null ? void 0 : _f.order_id, data == null ? void 0 : data.pay_number);
94
+ if ((data == null ? void 0 : data.type) === "token") {
95
+ (_g = TDSPayRef2.current) == null ? void 0 : _g.init(card, order, data);
96
+ return;
97
+ }
98
+ if ((data == null ? void 0 : data.type) === "3ds") {
99
+ (_h = TDSPayRef2.current) == null ? void 0 : _h.init(card, order, data);
100
+ return;
101
+ }
102
+ } catch (e) {
103
+ if ((e == null ? void 0 : e.code) === 700500) {
104
+ setTdsErrorVisible(true);
105
+ } else {
106
+ (0, import_materials.PisellToast)({ content: (e == null ? void 0 : e.message) || "", duration: 2 });
107
+ }
108
+ } finally {
109
+ setLoading(false);
110
+ (_j = (_i = utils == null ? void 0 : utils.Toast) == null ? void 0 : _i.hide) == null ? void 0 : _j.call(_i);
111
+ }
112
+ };
113
+ const onCreate = async (res) => {
114
+ var _a, _b, _c, _d, _e, _f, _g, _h;
115
+ try {
116
+ setLoading(true);
117
+ (_b = (_a = utils == null ? void 0 : utils.Toast) == null ? void 0 : _a.loading) == null ? void 0 : _b.call(_a, import_utils.locales.getText("tocPay.text.checkingCard"), 0, void 0, true);
118
+ let _cardInfo = {
119
+ card_name: res.card_name,
120
+ card_number: res.card_number,
121
+ card_expiry_month: res.date.format("MM"),
122
+ card_expiry_year: res.date.format("YY"),
123
+ card_ccv: res.card_ccv,
124
+ is_save: res.is_save ? 1 : 0
125
+ };
126
+ _cardInfo = (0, import_payGroup.getPayGroupParamsFromStorage)(
127
+ (_c = state.payGroup) == null ? void 0 : _c.order_id,
128
+ _cardInfo
129
+ );
130
+ if (!_cardInfo) {
131
+ (_d = state.payCallback) == null ? void 0 : _d.call(state, {
132
+ key: "fail",
133
+ data: {
134
+ _cardInfo,
135
+ message: import_utils.locales.getText("tocPay.text.getParamsFail"),
136
+ fn: "MWCreditCard.onCreate.noCardInfo"
137
+ }
138
+ });
139
+ return;
140
+ }
141
+ const preCheckData = await (0, import_tds2.preCheckEnrollment)(
142
+ (_e = state.payGroup) == null ? void 0 : _e.order_id,
143
+ _cardInfo
144
+ );
145
+ (_f = TDSPayRef2.current) == null ? void 0 : _f.init(res, order, preCheckData);
146
+ } catch (e) {
147
+ if ((e == null ? void 0 : e.code) === 700500) {
148
+ setTdsErrorVisible(true);
149
+ } else {
150
+ (0, import_materials.PisellToast)({ content: (e == null ? void 0 : e.message) || "", duration: 2 });
151
+ }
152
+ } finally {
153
+ setLoading(false);
154
+ (_h = (_g = utils == null ? void 0 : utils.Toast) == null ? void 0 : _g.hide) == null ? void 0 : _h.call(_g);
155
+ }
156
+ };
157
+ const handleTDSPayChange = (res) => {
53
158
  var _a;
54
- (_a = TDSPayRef2.current) == null ? void 0 : _a.init(card, order);
159
+ if ((res == null ? void 0 : res.key) === "bankVerifyFailed") {
160
+ setBankVerifyFailVisible(true);
161
+ return;
162
+ }
163
+ (_a = state.payCallback) == null ? void 0 : _a.call(state, res);
55
164
  };
56
- const onCreate = (res) => {
165
+ const handleUseAnotherCard = () => {
166
+ setTdsErrorVisible(false);
167
+ setBankVerifyFailVisible(false);
168
+ };
169
+ const handleUseAnotherPayment = () => {
170
+ setTdsErrorVisible(false);
171
+ setBankVerifyFailVisible(false);
172
+ closeAll();
173
+ };
174
+ const handlePayLater = () => {
57
175
  var _a;
58
- (_a = TDSPayRef2.current) == null ? void 0 : _a.init(res, order);
176
+ setTdsErrorVisible(false);
177
+ setBankVerifyFailVisible(false);
178
+ closeAll();
179
+ (_a = state.payCallback) == null ? void 0 : _a.call(state, { key: "cancel" });
59
180
  };
60
181
  (0, import_react.useImperativeHandle)(
61
182
  ref,
@@ -73,8 +194,31 @@ var MWCreditCard = (props, ref) => {
73
194
  var _a;
74
195
  (_a = AddMWCreditCardRef2.current) == null ? void 0 : _a.init();
75
196
  },
76
- onChange: fastPay
197
+ onChange: fastPay,
198
+ btnLoading: loading
199
+ }
200
+ ), /* @__PURE__ */ import_react.default.createElement(import_Add.default, { ref: AddMWCreditCardRef2, onCreate, shopName: props.shopName, btnLoading: loading }), /* @__PURE__ */ import_react.default.createElement(import_TDSPay.default, { ref: TDSPayRef2, onChange: handleTDSPayChange, closeAll }), /* @__PURE__ */ import_react.default.createElement(
201
+ import_TDSErrorModal.default,
202
+ {
203
+ open: tdsErrorVisible,
204
+ type: "tds-not-supported",
205
+ shopPhone: props.shopPhone,
206
+ shopEmail: props.shopEmail,
207
+ onUseAnotherCard: handleUseAnotherCard,
208
+ onUseAnotherPayment: handleUseAnotherPayment,
209
+ onPayLater: handlePayLater
210
+ }
211
+ ), /* @__PURE__ */ import_react.default.createElement(
212
+ import_TDSErrorModal.default,
213
+ {
214
+ open: bankVerifyFailVisible,
215
+ type: "bank-verify-failed",
216
+ shopPhone: props.shopPhone,
217
+ shopEmail: props.shopEmail,
218
+ onUseAnotherCard: handleUseAnotherCard,
219
+ onUseAnotherPayment: handleUseAnotherPayment,
220
+ onPayLater: handlePayLater
77
221
  }
78
- ), /* @__PURE__ */ import_react.default.createElement(import_Add.default, { ref: AddMWCreditCardRef2, onCreate }), /* @__PURE__ */ import_react.default.createElement(import_TDSPay.default, { ref: TDSPayRef2, onChange: state.payCallback }));
222
+ ));
79
223
  };
80
224
  var MWCreditCard_default = (0, import_react.forwardRef)(MWCreditCard);
@@ -1,3 +1,13 @@
1
+ /**
2
+ * 取消当前支付流程中残留的 message 监听器和定时器,
3
+ * 并 reject 挂起的 Promise 使 startPayment 的 await 结束。
4
+ * reject 值为 0,startPayment catch 中 `if (err === 0) return` 会静默处理。
5
+ */
6
+ export declare const cancelCurrentPayment: () => void;
7
+ interface PaymentOptions {
8
+ callback?: (res: any) => void;
9
+ isCancelled?: () => boolean;
10
+ }
1
11
  /**
2
12
  * @title: 点击支付
3
13
  * @description:
@@ -6,7 +16,16 @@
6
16
  * @Author: Wzw
7
17
  * @Date: 2022-10-22 10:05
8
18
  */
9
- export declare const startPayment: ({ orderId, cardInfo, payData }: any, callback?: any) => Promise<boolean | undefined>;
19
+ export declare const startPayment: ({ orderId, cardInfo, payData }: any, options?: PaymentOptions) => Promise<boolean | undefined>;
20
+ /**
21
+ * @title: 前置检查 - 提交卡信息到后端(预检查版本)
22
+ * @description: 与 checkEnrollment 调用相同 API,但不包含 Toast/callback/closeIframe 等副作用。
23
+ * 失败时直接 throw error,由调用方(MWCreditCard)捕获并展示 3DS 错误弹窗。
24
+ * @param {string} orderId 订单ID
25
+ * @param {any} cardInfo 卡信息
26
+ * @return {Promise<any>} 返回后端数据(含 pay_info),失败则 throw
27
+ */
28
+ export declare const preCheckEnrollment: (orderId: string, cardInfo: any) => Promise<any>;
10
29
  /*******
11
30
  * @title: 步骤2
12
31
  * @description: 提交卡信息到后端
@@ -14,7 +33,7 @@ export declare const startPayment: ({ orderId, cardInfo, payData }: any, callbac
14
33
  * @Author: Wzw
15
34
  * @Date: 2022-10-18 10:26
16
35
  */
17
- export declare const checkEnrollment: (orderId: string, cardInfo: any, callback: any) => Promise<any>;
36
+ export declare const checkEnrollment: (orderId: string, cardInfo: any, options?: PaymentOptions) => Promise<any>;
18
37
  /**
19
38
  * @title: 步骤3
20
39
  * @description: 创建iframe, 监听
@@ -32,7 +51,7 @@ export declare const createThreeDSMethodIframe: (threeDSMethodData: any, callbac
32
51
  * @Author: Wzw
33
52
  * @Date: 2022-10-18 10:43
34
53
  */
35
- export declare const checkTDSAuth: (step2: any, step3: any, callback?: any) => Promise<any>;
54
+ export declare const checkTDSAuth: (step2: any, step3: any, options?: PaymentOptions) => Promise<any>;
36
55
  /**
37
56
  * @title: 步骤5
38
57
  * @description: 监听
@@ -59,3 +78,4 @@ export declare const checkPARes: (step2: any, step4: any, step5: any) => Promise
59
78
  * @Date: 2022-10-18 14:28
60
79
  */
61
80
  export declare const paymentEnd: (props: any, callback: any) => void;
81
+ export {};