@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
@@ -8,10 +8,11 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
8
8
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
9
9
  function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
10
10
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
11
- import React, { useState, useImperativeHandle, forwardRef, useContext } from 'react';
11
+ import React, { useState, useRef, useEffect, useImperativeHandle, forwardRef, useContext } from 'react';
12
+ import { Button } from 'antd';
12
13
  import { PisellModal } from '@pisell/materials';
13
14
  import ThreedsLoading from "./ThreedsLoading";
14
- import { startPayment } from "../tds2";
15
+ import { startPayment, cancelCurrentPayment } from "../tds2";
15
16
  import { fastPayNew } from "../List/serve";
16
17
  import { Context } from "../../../model";
17
18
  import { getPayGroupParamsFromStorage, setPayNumber } from "../../../payGroup";
@@ -30,62 +31,138 @@ import { locales } from '@pisell/utils';
30
31
  * @Date: 2024-08-16 11:15
31
32
  */
32
33
  var TDSPay = function TDSPay(props, ref) {
33
- var onChange = props.onChange;
34
+ var onChange = props.onChange,
35
+ closeAll = props.closeAll;
34
36
  var _useState = useState(false),
35
37
  _useState2 = _slicedToArray(_useState, 2),
36
38
  open = _useState2[0],
37
39
  setOpen = _useState2[1];
40
+ // 关闭确认弹窗可见性
41
+ var _useState3 = useState(false),
42
+ _useState4 = _slicedToArray(_useState3, 2),
43
+ showCloseConfirm = _useState4[0],
44
+ setShowCloseConfirm = _useState4[1];
45
+ /**
46
+ * 递增会话 ID:每次 init 递增,旧流程通过比对 ID 判断自身是否已被取代。
47
+ * 解决了旧 cancelledRef 的缺陷——旧方案用单一 boolean,新 init 的 reset 会误将
48
+ * 上一次仍在运行的 startPayment 重新"激活"。
49
+ */
50
+ var sessionIdRef = useRef(0);
51
+ // 支付流程进行中标记,阻止并发 init 调用
52
+ var payingRef = useRef(false);
38
53
  var _useContext = useContext(Context),
39
54
  state = _useContext.state;
40
55
 
56
+ /** 组件卸载时:递增 sessionId 使旧流程的 isCancelled 失效 + 清理残留的 message 监听器 */
57
+ useEffect(function () {
58
+ return function () {
59
+ sessionIdRef.current += 1;
60
+ cancelCurrentPayment();
61
+ };
62
+ }, []);
63
+
41
64
  /**
42
- * @title: 初始化
43
- * @description:
44
- * @param {any} res
45
- * @param {any} order
46
- * @return {*}
47
- * @Author: zhiwei.Wang
48
- * @Date: 2024-08-16 11:15
65
+ * @title: 创建绑定当前会话的回调
66
+ * @description: 回调内部比对 sessionId,若已被新会话取代则忽略调用。
67
+ * hideModal 为中间态回调(不释放锁);其他 key 为终态(释放锁 + 通知外部)。
68
+ */
69
+ var createSessionCallback = function createSessionCallback(session) {
70
+ return function (res) {
71
+ if (sessionIdRef.current !== session) return;
72
+ setOpen(false);
73
+ setShowCloseConfirm(false);
74
+ payingRef.current = false;
75
+ if (res.key === 'hideModal') return;
76
+ onChange === null || onChange === void 0 || onChange(res);
77
+ };
78
+ };
79
+
80
+ /**
81
+ * @title: 初始化 3DS 支付流程
82
+ * @description: 若已有流程在执行中则忽略本次调用。
83
+ * 通过递增 sessionId 自动废弃前一次残留的异步流程。
49
84
  */
50
85
  var init = /*#__PURE__*/function () {
51
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(res, order) {
86
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(res, order, preCheckData) {
87
+ var session, isCancelled, callback;
52
88
  return _regeneratorRuntime().wrap(function _callee$(_context) {
53
89
  while (1) switch (_context.prev = _context.next) {
54
90
  case 0:
91
+ if (!payingRef.current) {
92
+ _context.next = 2;
93
+ break;
94
+ }
95
+ return _context.abrupt("return");
96
+ case 2:
97
+ payingRef.current = true;
98
+ sessionIdRef.current += 1;
99
+ cancelCurrentPayment();
100
+ session = sessionIdRef.current;
55
101
  setOpen(true);
56
-
102
+ isCancelled = function isCancelled() {
103
+ return sessionIdRef.current !== session;
104
+ };
105
+ callback = createSessionCallback(session); // 如果有预检查数据,直接走 startPayment(跳过 checkEnrollment)
106
+ if (!preCheckData) {
107
+ _context.next = 12;
108
+ break;
109
+ }
110
+ startPayment({
111
+ payData: preCheckData
112
+ }, {
113
+ callback: callback,
114
+ isCancelled: isCancelled
115
+ });
116
+ return _context.abrupt("return");
117
+ case 12:
57
118
  // 已保存的卡
58
119
  if (res.id) {
59
- _fastPayNew(res);
120
+ _fastPayNew(res, callback, isCancelled);
60
121
  } else {
61
122
  // 新卡
62
- newCardPay(res);
123
+ newCardPay(res, callback, isCancelled);
63
124
  }
64
- case 2:
125
+ case 13:
65
126
  case "end":
66
127
  return _context.stop();
67
128
  }
68
129
  }, _callee);
69
130
  }));
70
- return function init(_x, _x2) {
131
+ return function init(_x, _x2, _x3) {
71
132
  return _ref.apply(this, arguments);
72
133
  };
73
134
  }();
74
135
 
75
136
  /**
76
- * @title: 支付结果回调
77
- * @description:
78
- * @param {any} res
79
- * @return {*}
80
- * @Author: zhiwei.Wang
81
- * @Date: 2024-08-16 11:15
137
+ * @title: 等待页关闭按钮点击
138
+ * @description: 点击 PisellModal 关闭按钮时,弹出确认弹窗而非直接关闭
82
139
  */
83
- var payCallback = function payCallback(res) {
140
+ var handleCloseClick = function handleCloseClick() {
141
+ setShowCloseConfirm(true);
142
+ };
143
+
144
+ /**
145
+ * @title: 确认弹窗 - 继续等待
146
+ * @description: 关闭确认弹窗,继续等待支付结果
147
+ */
148
+ var handleContinueWaiting = function handleContinueWaiting() {
149
+ setShowCloseConfirm(false);
150
+ };
151
+
152
+ /**
153
+ * @title: 确认弹窗 - 查看订单
154
+ * @description: 递增 sessionId 使旧流程的 isCancelled 返回 true,释放锁并关闭弹窗
155
+ */
156
+ var handleViewOrder = function handleViewOrder() {
157
+ sessionIdRef.current += 1;
158
+ cancelCurrentPayment();
159
+ payingRef.current = false;
160
+ setShowCloseConfirm(false);
84
161
  setOpen(false);
85
- if (res.key === 'hideModal') {
86
- return;
87
- }
88
- onChange === null || onChange === void 0 || onChange(res);
162
+ closeAll === null || closeAll === void 0 || closeAll();
163
+ onChange === null || onChange === void 0 || onChange({
164
+ key: 'cancel'
165
+ });
89
166
  };
90
167
 
91
168
  /**
@@ -97,13 +174,12 @@ var TDSPay = function TDSPay(props, ref) {
97
174
  * @Date: 2024-08-16 11:15
98
175
  */
99
176
  var _fastPayNew = /*#__PURE__*/function () {
100
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(res) {
177
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(res, callback, isCancelled) {
101
178
  var _state$payGroup, _state$payGroup2, _state$payGroup3, params, _yield$fastPayNew, data;
102
179
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
103
180
  while (1) switch (_context2.prev = _context2.next) {
104
181
  case 0:
105
182
  _context2.prev = 0;
106
- // 获取交易组
107
183
  params = getPayGroupParamsFromStorage((_state$payGroup = state.payGroup) === null || _state$payGroup === void 0 ? void 0 : _state$payGroup.order_id, {
108
184
  card_id: res.id
109
185
  });
@@ -111,7 +187,7 @@ var TDSPay = function TDSPay(props, ref) {
111
187
  _context2.next = 5;
112
188
  break;
113
189
  }
114
- payCallback === null || payCallback === void 0 || payCallback({
190
+ callback({
115
191
  key: 'fail',
116
192
  data: {
117
193
  res: res,
@@ -129,30 +205,33 @@ var TDSPay = function TDSPay(props, ref) {
129
205
  case 7:
130
206
  _yield$fastPayNew = _context2.sent;
131
207
  data = _yield$fastPayNew.data;
132
- // 设置交易号
208
+ if (!isCancelled()) {
209
+ _context2.next = 11;
210
+ break;
211
+ }
212
+ return _context2.abrupt("return");
213
+ case 11:
133
214
  setPayNumber((_state$payGroup3 = state.payGroup) === null || _state$payGroup3 === void 0 ? void 0 : _state$payGroup3.order_id, data === null || data === void 0 ? void 0 : data.pay_number);
134
-
135
- // token 直接跳转成功页面
136
215
  if ((data === null || data === void 0 ? void 0 : data.type) === 'token') {
137
- payCallback === null || payCallback === void 0 || payCallback({
216
+ callback({
138
217
  key: 'success',
139
218
  data: data
140
219
  });
141
220
  }
142
-
143
- // 3DS 跳转3DS验证页面
144
221
  if ((data === null || data === void 0 ? void 0 : data.type) === '3ds') {
145
222
  startPayment({
146
223
  payData: data
147
- }, payCallback);
224
+ }, {
225
+ callback: callback,
226
+ isCancelled: isCancelled
227
+ });
148
228
  }
149
- _context2.next = 17;
229
+ _context2.next = 19;
150
230
  break;
151
- case 14:
152
- _context2.prev = 14;
231
+ case 16:
232
+ _context2.prev = 16;
153
233
  _context2.t0 = _context2["catch"](0);
154
- // 失败
155
- payCallback === null || payCallback === void 0 || payCallback({
234
+ callback({
156
235
  key: 'fail',
157
236
  data: {
158
237
  res: res,
@@ -160,13 +239,13 @@ var TDSPay = function TDSPay(props, ref) {
160
239
  message: locales.getText('tocPay.text.getParamsFail')
161
240
  }
162
241
  });
163
- case 17:
242
+ case 19:
164
243
  case "end":
165
244
  return _context2.stop();
166
245
  }
167
- }, _callee2, null, [[0, 14]]);
246
+ }, _callee2, null, [[0, 16]]);
168
247
  }));
169
- return function _fastPayNew(_x3) {
248
+ return function _fastPayNew(_x4, _x5, _x6) {
170
249
  return _ref2.apply(this, arguments);
171
250
  };
172
251
  }();
@@ -179,7 +258,7 @@ var TDSPay = function TDSPay(props, ref) {
179
258
  * @Author: zhiwei.Wang
180
259
  * @Date: 2024-08-16 11:16
181
260
  */
182
- var newCardPay = function newCardPay(res) {
261
+ var newCardPay = function newCardPay(res, callback, isCancelled) {
183
262
  var _state$payGroup4, _state$payGroup5;
184
263
  var _cardInfo = {
185
264
  card_name: res.card_name,
@@ -189,11 +268,9 @@ var TDSPay = function TDSPay(props, ref) {
189
268
  card_ccv: res.card_ccv,
190
269
  is_save: res.is_save ? 1 : 0
191
270
  };
192
-
193
- // 补全交易组信息
194
271
  _cardInfo = getPayGroupParamsFromStorage((_state$payGroup4 = state.payGroup) === null || _state$payGroup4 === void 0 ? void 0 : _state$payGroup4.order_id, _cardInfo);
195
272
  if (!_cardInfo) {
196
- payCallback === null || payCallback === void 0 || payCallback({
273
+ callback({
197
274
  key: 'fail',
198
275
  data: {
199
276
  _cardInfo: _cardInfo,
@@ -203,31 +280,65 @@ var TDSPay = function TDSPay(props, ref) {
203
280
  });
204
281
  return;
205
282
  }
206
-
207
- // 3ds支付
208
283
  startPayment({
209
284
  orderId: (_state$payGroup5 = state.payGroup) === null || _state$payGroup5 === void 0 ? void 0 : _state$payGroup5.order_id,
210
285
  cardInfo: _cardInfo
211
- }, payCallback);
286
+ }, {
287
+ callback: callback,
288
+ isCancelled: isCancelled
289
+ });
212
290
  };
213
291
  useImperativeHandle(ref, function () {
214
292
  return {
215
293
  init: init
216
294
  };
217
295
  });
218
- return /*#__PURE__*/React.createElement(PisellModal, {
296
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(PisellModal, {
219
297
  platform: 'h5',
220
298
  open: open,
221
299
  footer: false,
222
300
  header: false,
223
- closable: false,
301
+ closable: true,
302
+ onCancel: handleCloseClick,
224
303
  bodyStyle: {
225
304
  padding: 0
226
305
  }
227
306
  }, /*#__PURE__*/React.createElement("div", {
228
307
  className: ""
229
- }, /*#__PURE__*/React.createElement(ThreedsLoading, null), /*#__PURE__*/React.createElement("div", {
308
+ }, /*#__PURE__*/React.createElement(ThreedsLoading, {
309
+ title: locales.getText('tocPay.text.processingPayment'),
310
+ subtitle: locales.getText('tocPay.text.securityCheckRequired'),
311
+ description: locales.getText('tocPay.text.doNotClosePage')
312
+ }), /*#__PURE__*/React.createElement("div", {
230
313
  id: "threeds-container"
231
- })));
314
+ }))), /*#__PURE__*/React.createElement(PisellModal, {
315
+ open: showCloseConfirm,
316
+ closable: false,
317
+ footer: null,
318
+ header: false,
319
+ mobileModalHeight: "auto",
320
+ headerDivider: false,
321
+ footerDivider: false,
322
+ bodyStyle: {
323
+ padding: 24
324
+ },
325
+ transitionName: "pisell-move-down"
326
+ }, /*#__PURE__*/React.createElement("div", {
327
+ className: "tds-close-confirm-modal"
328
+ }, /*#__PURE__*/React.createElement("div", {
329
+ className: "tds-close-confirm-title"
330
+ }, locales.getText('tocPay.text.stopWaitingTitle')), /*#__PURE__*/React.createElement("div", {
331
+ className: "tds-close-confirm-desc"
332
+ }, locales.getText('tocPay.text.stopWaitingDesc')), /*#__PURE__*/React.createElement("div", {
333
+ className: "tds-close-confirm-actions"
334
+ }, /*#__PURE__*/React.createElement(Button, {
335
+ type: "primary",
336
+ block: true,
337
+ className: "tds-close-confirm-btn-primary",
338
+ onClick: handleContinueWaiting
339
+ }, locales.getText('tocPay.text.continueWaiting')), /*#__PURE__*/React.createElement("div", {
340
+ className: "tds-close-confirm-link",
341
+ onClick: handleViewOrder
342
+ }, locales.getText('tocPay.text.viewOrder'))))));
232
343
  };
233
344
  export default /*#__PURE__*/forwardRef(TDSPay);
@@ -0,0 +1,47 @@
1
+ /** 关闭确认弹窗样式 */
2
+ .tds-close-confirm-modal {
3
+ display: flex;
4
+ flex-direction: column;
5
+ gap: 0;
6
+ }
7
+
8
+ .tds-close-confirm-title {
9
+ color: var(--Gray-900, #101828);
10
+ font-size: 20px;
11
+ font-weight: 600;
12
+ line-height: 28px;
13
+ margin-bottom: 8px;
14
+ }
15
+
16
+ .tds-close-confirm-desc {
17
+ color: var(--Gray-600, #475467);
18
+ font-size: 14px;
19
+ font-weight: 400;
20
+ line-height: 20px;
21
+ margin-bottom: 24px;
22
+ white-space: pre-line;
23
+ }
24
+
25
+ .tds-close-confirm-actions {
26
+ display: flex;
27
+ flex-direction: column;
28
+ align-items: center;
29
+ gap: 12px;
30
+ }
31
+
32
+ .tds-close-confirm-btn-primary {
33
+ height: 44px;
34
+ font-size: 16px;
35
+ font-weight: 500;
36
+ border-radius: 8px;
37
+ }
38
+
39
+ .tds-close-confirm-link {
40
+ color: var(--Gray-500, #667085);
41
+ font-size: 14px;
42
+ font-weight: 400;
43
+ line-height: 20px;
44
+ cursor: pointer;
45
+ text-decoration: underline;
46
+ padding: 4px 0;
47
+ }
@@ -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,83 @@
1
+ import React, { useMemo } from 'react';
2
+ import { Button } from 'antd';
3
+ import { PisellModal } from '@pisell/materials';
4
+ import { locales } from '@pisell/utils';
5
+ import "./index.less";
6
+
7
+ /** 弹窗场景类型 */
8
+
9
+ /** 不同场景对应的 i18n key 映射 */
10
+ var TEXT_KEY_MAP = {
11
+ /** 预检查:卡不支持 3DS 验证 */
12
+ 'tds-not-supported': {
13
+ title: 'tocPay.text.tdsErrorTitle',
14
+ desc: 'tocPay.text.tdsErrorDesc'
15
+ },
16
+ /** 支付中:银行安全验证失败(700500) */
17
+ 'bank-verify-failed': {
18
+ title: 'tocPay.text.bankVerifyFailedTitle',
19
+ desc: 'tocPay.text.bankVerifyFailedDesc'
20
+ }
21
+ };
22
+ /**
23
+ * @title: 支付错误弹窗(通用)
24
+ * @description: 根据 type 展示不同文案,按钮行为一致:
25
+ * 更换卡片 / 使用其他支付方式 / 稍后支付。
26
+ * 支持两种场景:
27
+ * 1. tds-not-supported —— 预检查发现卡不支持 3DS 验证
28
+ * 2. bank-verify-failed —— 3DS 流程中银行安全验证失败(700500)
29
+ */
30
+ var TDSErrorModal = function TDSErrorModal(_ref) {
31
+ var open = _ref.open,
32
+ _ref$type = _ref.type,
33
+ type = _ref$type === void 0 ? 'tds-not-supported' : _ref$type,
34
+ shopPhone = _ref.shopPhone,
35
+ shopEmail = _ref.shopEmail,
36
+ onUseAnotherCard = _ref.onUseAnotherCard,
37
+ onUseAnotherPayment = _ref.onUseAnotherPayment,
38
+ onPayLater = _ref.onPayLater;
39
+ /** 是否展示底部联系方式(电话或邮箱至少有一个) */
40
+ var showContact = !!(shopPhone || shopEmail);
41
+
42
+ /** 根据 type 获取对应的 i18n key */
43
+ var textKeys = useMemo(function () {
44
+ return TEXT_KEY_MAP[type];
45
+ }, [type]);
46
+ return /*#__PURE__*/React.createElement(PisellModal, {
47
+ open: open,
48
+ closable: false,
49
+ footer: null,
50
+ header: false,
51
+ mobileModalHeight: "auto",
52
+ headerDivider: false,
53
+ footerDivider: false,
54
+ bodyStyle: {
55
+ padding: 24
56
+ },
57
+ transitionName: "pisell-move-down"
58
+ }, /*#__PURE__*/React.createElement("div", {
59
+ className: "tds-error-modal"
60
+ }, /*#__PURE__*/React.createElement("div", {
61
+ className: "tds-error-modal-title"
62
+ }, locales.getText(textKeys.title)), /*#__PURE__*/React.createElement("div", {
63
+ className: "tds-error-modal-desc"
64
+ }, locales.getText(textKeys.desc)), /*#__PURE__*/React.createElement("div", {
65
+ className: "tds-error-modal-actions"
66
+ }, /*#__PURE__*/React.createElement(Button, {
67
+ type: "primary",
68
+ block: true,
69
+ className: "tds-error-modal-btn-primary",
70
+ onClick: onUseAnotherCard
71
+ }, locales.getText('tocPay.text.useAnotherCard')), /*#__PURE__*/React.createElement(Button, {
72
+ block: true,
73
+ className: "tds-error-modal-btn-secondary",
74
+ onClick: onUseAnotherPayment
75
+ }, locales.getText('tocPay.text.useAnotherPayment')), /*#__PURE__*/React.createElement(Button, {
76
+ block: true,
77
+ className: "tds-error-modal-btn-secondary",
78
+ onClick: onPayLater
79
+ }, locales.getText('tocPay.text.payLater'))), showContact && /*#__PURE__*/React.createElement("div", {
80
+ className: "tds-error-modal-contact"
81
+ }, locales.getText('tocPay.text.paymentTroubleContact')(shopPhone || '', shopEmail || ''))));
82
+ };
83
+ export 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;