@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
@@ -71,7 +71,7 @@ var formatName = (card_name) => {
71
71
  }
72
72
  };
73
73
  var AddMWCreditCard = (props, ref) => {
74
- const { onCreate } = props;
74
+ const { onCreate, shopName = "", btnLoading = false } = props;
75
75
  const [open, setOpen] = (0, import_react.useState)(false);
76
76
  const [form] = import_antd.Form.useForm();
77
77
  const { state } = (0, import_react.useContext)(import_model.Context);
@@ -147,12 +147,16 @@ var AddMWCreditCard = (props, ref) => {
147
147
  const onSubmit = () => {
148
148
  form.submit();
149
149
  };
150
+ const close = () => {
151
+ setOpen(false);
152
+ };
150
153
  (0, import_react.useImperativeHandle)(
151
154
  ref,
152
155
  () => ({
153
156
  init,
154
157
  onReset,
155
- onSubmit
158
+ onSubmit,
159
+ close
156
160
  })
157
161
  );
158
162
  const okText = (0, import_react.useMemo)(() => {
@@ -167,15 +171,37 @@ var AddMWCreditCard = (props, ref) => {
167
171
  return /* @__PURE__ */ import_react.default.createElement(
168
172
  import_materials.PisellModal,
169
173
  {
170
- title: /* @__PURE__ */ import_react.default.createElement("div", null, import_utils.locales.getText("tocPay.text.addCard")),
174
+ title: /* @__PURE__ */ import_react.default.createElement("div", { className: "secure-card-payment-title" }, import_utils.locales.getText("tocPay.text.secureCardPayment"), /* @__PURE__ */ import_react.default.createElement(
175
+ import_materials.Iconfont,
176
+ {
177
+ type: "pisell2-shield-tick",
178
+ className: "secure-card-payment-title-icon"
179
+ }
180
+ )),
171
181
  open,
172
182
  onCancel,
173
183
  cancelVisible: false,
174
184
  onOk: onSubmit,
175
185
  okText,
176
- bodyStyle: { padding: 24 }
186
+ bodyStyle: { padding: 24, display: "flex", flexDirection: "column" },
187
+ okButtonProps: {
188
+ loading: btnLoading,
189
+ style: {
190
+ display: "flex",
191
+ justifyContent: "center",
192
+ alignItems: "center"
193
+ }
194
+ }
177
195
  },
178
- /* @__PURE__ */ import_react.default.createElement("div", { className: "" }, /* @__PURE__ */ import_react.default.createElement(
196
+ /* @__PURE__ */ import_react.default.createElement("div", { className: "add-mw-credit-card-wrap" }, /* @__PURE__ */ import_react.default.createElement(
197
+ import_materials.PisellAlert,
198
+ {
199
+ className: "secure-card-tip-alert",
200
+ icon: /* @__PURE__ */ import_react.default.createElement(import_materials.Iconfont, { type: "pisell2-shield-tick" }),
201
+ showIcon: true,
202
+ message: import_utils.locales.getText("tocPay.text.secureBankInfo")
203
+ }
204
+ ), /* @__PURE__ */ import_react.default.createElement(
179
205
  import_antd.Form,
180
206
  {
181
207
  layout: "vertical",
@@ -246,24 +272,21 @@ var AddMWCreditCard = (props, ref) => {
246
272
  placeholder: import_utils.locales.getText("tocPay.text.incorrectName")
247
273
  }
248
274
  )
249
- )), /* @__PURE__ */ import_react.default.createElement(import_antd.Col, { span: 24 }, /* @__PURE__ */ import_react.default.createElement(
275
+ ))),
276
+ /* @__PURE__ */ import_react.default.createElement("div", { className: "merchant-authorization-text" }, import_utils.locales.getText("tocPay.text.merchantAuthorizationBefore"), /* @__PURE__ */ import_react.default.createElement("span", { className: "merchant-shop-name" }, shopName), import_utils.locales.getText("tocPay.text.merchantAuthorizationAfter")),
277
+ /* @__PURE__ */ import_react.default.createElement(import_antd.Divider, { className: "secure-card-divider" }),
278
+ /* @__PURE__ */ import_react.default.createElement(
250
279
  import_antd.Form.Item,
251
280
  {
252
281
  name: "is_save",
253
282
  valuePropName: "checked",
254
- initialValue: true
283
+ initialValue: true,
284
+ className: "save-card-form-item"
255
285
  },
256
286
  /* @__PURE__ */ import_react.default.createElement(import_antd.Checkbox, null, /* @__PURE__ */ import_react.default.createElement("span", { className: "save-card-checkbox-text" }, import_utils.locales.getText("tocPay.text.saveCardForNextTime")))
257
- )), /* @__PURE__ */ import_react.default.createElement(import_antd.Col, { span: 24 }, /* @__PURE__ */ import_react.default.createElement(
258
- import_materials.PisellAlert,
259
- {
260
- className: "save-card-alert",
261
- icon: /* @__PURE__ */ import_react.default.createElement(import_materials.Iconfont, { type: "pisell2-shield-tick" }),
262
- showIcon: true,
263
- message: import_utils.locales.getText("tocPay.text.secureBankInfo")
264
- }
265
- )))
266
- ))
287
+ ),
288
+ /* @__PURE__ */ import_react.default.createElement("div", { className: "save-card-encryption-text" }, import_utils.locales.getText("tocPay.text.saveCardEncryption"))
289
+ ), /* @__PURE__ */ import_react.default.createElement("div", { className: "three-d-secure-section" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "three-d-secure-badge" }, /* @__PURE__ */ import_react.default.createElement(import_materials.Iconfont, { type: "pisell2-shield-01", className: "three-d-secure-icon" }), /* @__PURE__ */ import_react.default.createElement("span", { className: "three-d-secure-badge-text" }, "3D")), /* @__PURE__ */ import_react.default.createElement("span", { className: "three-d-secure-text" }, import_utils.locales.getText("tocPay.text.threeDSecureProtection"))))
267
290
  );
268
291
  };
269
292
  var Add_default = (0, import_react.forwardRef)(AddMWCreditCard);
@@ -1,3 +1,4 @@
1
+ /* 表单 label 样式 */
1
2
  .pisell-lowcode-form-item-label {
2
3
  color: var(--Gray-900, #101828);
3
4
  font-size: 14px;
@@ -6,20 +7,120 @@
6
7
  line-height: 20px;
7
8
  }
8
9
 
10
+ /* 标题区域 */
11
+ .secure-card-payment-title {
12
+ display: flex;
13
+ align-items: center;
14
+ gap: 6px;
15
+ font-weight: 600;
16
+ }
17
+
18
+ .secure-card-payment-title-icon {
19
+ color: #12b76a;
20
+ font-size: 20px;
21
+ }
22
+
23
+ /* 外层容器 - flex 列布局,使 3D Secure 内容少时贴底 */
24
+ .add-mw-credit-card-wrap {
25
+ display: flex;
26
+ flex-direction: column;
27
+ flex: 1;
28
+ }
29
+
30
+ /* 安全提示 Alert - 顶部 */
31
+ .secure-card-tip-alert {
32
+ margin-bottom: 12px;
33
+ .pisell-lowcode-alert-message {
34
+ font-size: 13px;
35
+ font-style: normal;
36
+ font-weight: 500;
37
+ line-height: 18px;
38
+ color: #027a48;
39
+ }
40
+ }
41
+
42
+ /* 授权说明文案 */
43
+ .merchant-authorization-text {
44
+ color: var(--Gray-600, #475467);
45
+ font-size: 13px;
46
+ font-style: normal;
47
+ font-weight: 400;
48
+ line-height: 18px;
49
+ margin-top: 4px;
50
+ }
51
+
52
+ /* shopName 蓝色高亮 */
53
+ .merchant-shop-name {
54
+ color: #1570EF;
55
+ }
56
+
57
+ /* 分割线 */
58
+ .secure-card-divider {
59
+ margin: 16px 0;
60
+ }
61
+
62
+ /* 保存卡片 Checkbox */
63
+ .save-card-form-item {
64
+ margin-bottom: 4px !important;
65
+ }
66
+
9
67
  .save-card-checkbox-text {
10
68
  color: var(--Gray-900, #101828);
11
- font-size: 16px;
69
+ font-size: 14px;
12
70
  font-style: normal;
13
71
  font-weight: 500;
14
72
  }
15
73
 
16
- .save-card-alert {
74
+ /* 保存卡片加密提示 */
75
+ .save-card-encryption-text {
76
+ color: var(--Gray-500, #667085);
77
+ font-size: 13px;
78
+ font-style: normal;
79
+ font-weight: 400;
80
+ line-height: 18px;
81
+ padding-left: 24px;
82
+ margin-bottom: 24px;
83
+ }
17
84
 
18
- .pisell-lowcode-alert-message {
19
- font-size: 14px;
20
- font-style: normal;
21
- font-weight: 400;
22
- line-height: 20px;
23
- }
85
+ /* 3D Secure 安全说明 - margin-top: auto 使其内容少时贴底,多时跟随流 */
86
+ .three-d-secure-section {
87
+ display: flex;
88
+ align-items: center;
89
+ justify-content: center;
90
+ gap: 8px;
91
+ padding: 16px 0;
92
+ margin-top: auto;
93
+ }
94
+
95
+ .three-d-secure-badge {
96
+ position: relative;
97
+ display: flex;
98
+ align-items: center;
99
+ justify-content: center;
100
+ width: 32px;
101
+ height: 32px;
102
+ }
103
+
104
+ .three-d-secure-icon {
105
+ color: #2e90fa;
106
+ font-size: 32px;
107
+ }
24
108
 
25
- }
109
+ .three-d-secure-badge-text {
110
+ position: absolute;
111
+ top: 50%;
112
+ left: 50%;
113
+ transform: translate(-50%, -50%);
114
+ font-size: 10px;
115
+ font-weight: 700;
116
+ color: #2e90fa;
117
+ line-height: 1;
118
+ }
119
+
120
+ .three-d-secure-text {
121
+ color: var(--Gray-600, #475467);
122
+ font-size: 13px;
123
+ font-style: normal;
124
+ font-weight: 400;
125
+ line-height: 18px;
126
+ }
@@ -2,10 +2,12 @@ import React from 'react';
2
2
  import './index.less';
3
3
  export interface MWCreditCardListRef {
4
4
  init: (order: any) => void;
5
+ close: () => void;
5
6
  }
6
7
  interface MWCreditCardListProps {
7
8
  onAdd?: () => void;
8
9
  onChange?: (cardId: number) => void;
10
+ btnLoading?: boolean;
9
11
  }
10
12
  declare const _default: React.ForwardRefExoticComponent<MWCreditCardListProps & React.RefAttributes<any>>;
11
13
  export default _default;
@@ -50,7 +50,13 @@ var MWCreditCardList = (props, ref) => {
50
50
  const [manage, setManage] = (0, import_react.useState)(false);
51
51
  const [order, setOrder] = (0, import_react.useState)(null);
52
52
  const _getCreditCardList = async () => {
53
+ var _a;
53
54
  const cardList = await (0, import_serve.getCreditCardList)();
55
+ if (!cardList.length) {
56
+ (_a = props.onAdd) == null ? void 0 : _a.call(props);
57
+ setLoading(false);
58
+ return;
59
+ }
54
60
  setCreditCardList(cardList);
55
61
  if (cardList.length) {
56
62
  setCurrentCard(cardList[0].id);
@@ -64,15 +70,18 @@ var MWCreditCardList = (props, ref) => {
64
70
  setOrder(_order);
65
71
  setOpen(true);
66
72
  setManage(false);
67
- setOkLoading(false);
68
73
  setCurrentCard(0);
69
74
  _getCreditCardList();
70
75
  };
71
76
  const cardChange = (id) => {
72
77
  setCurrentCard(id);
73
78
  };
79
+ const close = () => {
80
+ setOpen(false);
81
+ };
74
82
  (0, import_react.useImperativeHandle)(ref, () => ({
75
- init
83
+ init,
84
+ close
76
85
  }));
77
86
  const renderOption = (d, active) => {
78
87
  return /* @__PURE__ */ import_react.default.createElement(
@@ -139,7 +148,6 @@ var MWCreditCardList = (props, ref) => {
139
148
  });
140
149
  }
141
150
  };
142
- const [okLoading, setOkLoading] = (0, import_react.useState)(false);
143
151
  const { run: onOk } = (0, import_ahooks.useDebounceFn)(
144
152
  () => {
145
153
  var _a;
@@ -148,7 +156,6 @@ var MWCreditCardList = (props, ref) => {
148
156
  handleBatchDeleteCards();
149
157
  return;
150
158
  }
151
- setOkLoading(true);
152
159
  let cur = creditCardList.find((d) => d.id === currentCard);
153
160
  (_a = props.onChange) == null ? void 0 : _a.call(props, cur);
154
161
  },
@@ -186,7 +193,12 @@ var MWCreditCardList = (props, ref) => {
186
193
  onOk,
187
194
  okButtonProps: {
188
195
  disabled: !currentCard,
189
- loading: okLoading
196
+ loading: props.btnLoading,
197
+ style: {
198
+ display: "flex",
199
+ justifyContent: "center",
200
+ alignItems: "center"
201
+ }
190
202
  },
191
203
  bodyStyle: { padding: 24 }
192
204
  },
@@ -1,4 +1,23 @@
1
1
  import React from 'react';
2
2
  import './index.less';
3
- declare const ThreedsLoading: ({ title, showSuccessBackButton, onSuccessBack }: any) => React.JSX.Element;
3
+ interface ThreedsLoadingProps {
4
+ /** 主标题(单行模式使用,覆盖默认文案) */
5
+ title?: string;
6
+ /** 副标题(多行模式第二行,可选) */
7
+ subtitle?: string;
8
+ /** 描述说明(多行模式第三行,可选) */
9
+ description?: string;
10
+ /** 是否展示"支付完成返回"按钮 */
11
+ showSuccessBackButton?: boolean;
12
+ /** "支付完成返回"按钮点击回调 */
13
+ onSuccessBack?: () => void;
14
+ }
15
+ /**
16
+ * @title: 等待加载页
17
+ * @description: 通用的支付等待 loading 页面。
18
+ * - 默认单行文案模式(传 title 或使用默认文案)
19
+ * - 传入 subtitle / description 后进入多行文案模式
20
+ * 向后兼容:不传新 props 时行为与原来完全一致。
21
+ */
22
+ declare const ThreedsLoading: React.FC<ThreedsLoadingProps>;
4
23
  export default ThreedsLoading;
@@ -36,7 +36,13 @@ var import_react = __toESM(require("react"));
36
36
  var import_useEngineContext = __toESM(require("../../../../../../../hooks/useEngineContext"));
37
37
  var import_index = require("./index.less");
38
38
  var import_utils = require("@pisell/utils");
39
- var ThreedsLoading = ({ title, showSuccessBackButton, onSuccessBack }) => {
39
+ var ThreedsLoading = ({
40
+ title,
41
+ subtitle,
42
+ description,
43
+ showSuccessBackButton,
44
+ onSuccessBack
45
+ }) => {
40
46
  var _a;
41
47
  const context = (0, import_useEngineContext.default)();
42
48
  const { config } = ((_a = context.appHelper) == null ? void 0 : _a.constants) || {};
@@ -47,6 +53,6 @@ var ThreedsLoading = ({ title, showSuccessBackButton, onSuccessBack }) => {
47
53
  src: config.static + "/static/stripe_loading.gif",
48
54
  alt: ""
49
55
  }
50
- ), /* @__PURE__ */ import_react.default.createElement("div", { className: "threeds-loading-title" }, title || import_utils.locales.getText("tocPay.text.waitingForBankVerification")), showSuccessBackButton && /* @__PURE__ */ import_react.default.createElement("div", { onClick: onSuccessBack, className: "threeds-loading-success-back-button" }, import_utils.locales.getText("tocPay.text.successBack")));
56
+ ), /* @__PURE__ */ import_react.default.createElement("div", { className: "threeds-loading-title" }, title || import_utils.locales.getText("tocPay.text.waitingForBankVerification")), subtitle && /* @__PURE__ */ import_react.default.createElement("div", { className: "threeds-loading-subtitle" }, subtitle), description && /* @__PURE__ */ import_react.default.createElement("div", { className: "threeds-loading-description" }, description), showSuccessBackButton && /* @__PURE__ */ import_react.default.createElement("div", { onClick: onSuccessBack, className: "threeds-loading-success-back-button" }, import_utils.locales.getText("tocPay.text.successBack")));
51
57
  };
52
58
  var ThreedsLoading_default = ThreedsLoading;
@@ -22,6 +22,26 @@
22
22
  color: #353535;
23
23
  }
24
24
 
25
+ .threeds-loading-subtitle {
26
+ margin-top: 8px;
27
+ padding: 0 40px;
28
+ text-align: center;
29
+ font-size: 14px;
30
+ font-weight: 400;
31
+ line-height: 20px;
32
+ color: #475467;
33
+ }
34
+
35
+ .threeds-loading-description {
36
+ margin-top: 4px;
37
+ padding: 0 40px;
38
+ text-align: center;
39
+ font-size: 13px;
40
+ font-weight: 400;
41
+ line-height: 18px;
42
+ color: #667085;
43
+ }
44
+
25
45
  .threeds-loading-success-back-button {
26
46
  margin-top: 20px;
27
47
  color: #4b6b99;
@@ -1,10 +1,16 @@
1
1
  import React from 'react';
2
2
  import './index.less';
3
3
  export interface TDSPayRef {
4
- init: (res: any, order: any) => void;
4
+ /** 初始化 3DS 支付流程
5
+ * @param res 卡信息(已保存卡含 id,新卡含表单字段)
6
+ * @param order 订单信息
7
+ * @param preCheckData 可选,外部预检查已获取的数据(跳过内部 fastPayNew / checkEnrollment)
8
+ */
9
+ init: (res: any, order: any, preCheckData?: any) => void;
5
10
  }
6
11
  export interface TDSPayProps {
7
12
  onChange?: (values: any) => void;
13
+ closeAll: () => void;
8
14
  }
9
15
  declare const _default: React.ForwardRefExoticComponent<TDSPayProps & React.RefAttributes<any>>;
10
16
  export default _default;
@@ -33,6 +33,7 @@ __export(TDSPay_exports, {
33
33
  });
34
34
  module.exports = __toCommonJS(TDSPay_exports);
35
35
  var import_react = __toESM(require("react"));
36
+ var import_antd = require("antd");
36
37
  var import_materials = require("@pisell/materials");
37
38
  var import_ThreedsLoading = __toESM(require("./ThreedsLoading"));
38
39
  var import_tds2 = require("../tds2");
@@ -42,35 +43,69 @@ var import_payGroup = require("../../../payGroup");
42
43
  var import_index = require("./index.less");
43
44
  var import_utils = require("@pisell/utils");
44
45
  var TDSPay = (props, ref) => {
45
- const { onChange } = props;
46
+ const { onChange, closeAll } = props;
46
47
  const [open, setOpen] = (0, import_react.useState)(false);
48
+ const [showCloseConfirm, setShowCloseConfirm] = (0, import_react.useState)(false);
49
+ const sessionIdRef = (0, import_react.useRef)(0);
50
+ const payingRef = (0, import_react.useRef)(false);
47
51
  const { state } = (0, import_react.useContext)(import_model.Context);
48
- const init = async (res, order) => {
52
+ (0, import_react.useEffect)(() => {
53
+ return () => {
54
+ sessionIdRef.current += 1;
55
+ (0, import_tds2.cancelCurrentPayment)();
56
+ };
57
+ }, []);
58
+ const createSessionCallback = (session) => (res) => {
59
+ if (sessionIdRef.current !== session) return;
60
+ setOpen(false);
61
+ setShowCloseConfirm(false);
62
+ payingRef.current = false;
63
+ if (res.key === "hideModal") return;
64
+ onChange == null ? void 0 : onChange(res);
65
+ };
66
+ const init = async (res, order, preCheckData) => {
67
+ if (payingRef.current) return;
68
+ payingRef.current = true;
69
+ sessionIdRef.current += 1;
70
+ (0, import_tds2.cancelCurrentPayment)();
71
+ const session = sessionIdRef.current;
49
72
  setOpen(true);
73
+ const isCancelled = () => sessionIdRef.current !== session;
74
+ const callback = createSessionCallback(session);
75
+ if (preCheckData) {
76
+ (0, import_tds2.startPayment)({ payData: preCheckData }, { callback, isCancelled });
77
+ return;
78
+ }
50
79
  if (res.id) {
51
- _fastPayNew(res);
80
+ _fastPayNew(res, callback, isCancelled);
52
81
  } else {
53
- newCardPay(res);
82
+ newCardPay(res, callback, isCancelled);
54
83
  }
55
84
  };
56
- const payCallback = (res) => {
85
+ const handleCloseClick = () => {
86
+ setShowCloseConfirm(true);
87
+ };
88
+ const handleContinueWaiting = () => {
89
+ setShowCloseConfirm(false);
90
+ };
91
+ const handleViewOrder = () => {
92
+ sessionIdRef.current += 1;
93
+ (0, import_tds2.cancelCurrentPayment)();
94
+ payingRef.current = false;
95
+ setShowCloseConfirm(false);
57
96
  setOpen(false);
58
- if (res.key === "hideModal") {
59
- return;
60
- }
61
- onChange == null ? void 0 : onChange(res);
97
+ closeAll == null ? void 0 : closeAll();
98
+ onChange == null ? void 0 : onChange({ key: "cancel" });
62
99
  };
63
- const _fastPayNew = async (res) => {
100
+ const _fastPayNew = async (res, callback, isCancelled) => {
64
101
  var _a, _b, _c;
65
102
  try {
66
103
  const params = (0, import_payGroup.getPayGroupParamsFromStorage)(
67
104
  (_a = state.payGroup) == null ? void 0 : _a.order_id,
68
- {
69
- card_id: res.id
70
- }
105
+ { card_id: res.id }
71
106
  );
72
107
  if (!params) {
73
- payCallback == null ? void 0 : payCallback({
108
+ callback({
74
109
  key: "fail",
75
110
  data: {
76
111
  res,
@@ -84,15 +119,16 @@ var TDSPay = (props, ref) => {
84
119
  order_id: (_b = state.payGroup) == null ? void 0 : _b.order_id,
85
120
  params
86
121
  });
122
+ if (isCancelled()) return;
87
123
  (0, import_payGroup.setPayNumber)((_c = state.payGroup) == null ? void 0 : _c.order_id, data == null ? void 0 : data.pay_number);
88
124
  if ((data == null ? void 0 : data.type) === "token") {
89
- payCallback == null ? void 0 : payCallback({ key: "success", data });
125
+ callback({ key: "success", data });
90
126
  }
91
127
  if ((data == null ? void 0 : data.type) === "3ds") {
92
- (0, import_tds2.startPayment)({ payData: data }, payCallback);
128
+ (0, import_tds2.startPayment)({ payData: data }, { callback, isCancelled });
93
129
  }
94
130
  } catch (e) {
95
- payCallback == null ? void 0 : payCallback({
131
+ callback({
96
132
  key: "fail",
97
133
  data: {
98
134
  res,
@@ -102,7 +138,7 @@ var TDSPay = (props, ref) => {
102
138
  });
103
139
  }
104
140
  };
105
- const newCardPay = (res) => {
141
+ const newCardPay = (res, callback, isCancelled) => {
106
142
  var _a, _b;
107
143
  let _cardInfo = {
108
144
  card_name: res.card_name,
@@ -117,7 +153,7 @@ var TDSPay = (props, ref) => {
117
153
  _cardInfo
118
154
  );
119
155
  if (!_cardInfo) {
120
- payCallback == null ? void 0 : payCallback({
156
+ callback({
121
157
  key: "fail",
122
158
  data: {
123
159
  _cardInfo,
@@ -129,7 +165,7 @@ var TDSPay = (props, ref) => {
129
165
  }
130
166
  (0, import_tds2.startPayment)(
131
167
  { orderId: (_b = state.payGroup) == null ? void 0 : _b.order_id, cardInfo: _cardInfo },
132
- payCallback
168
+ { callback, isCancelled }
133
169
  );
134
170
  };
135
171
  (0, import_react.useImperativeHandle)(
@@ -138,17 +174,55 @@ var TDSPay = (props, ref) => {
138
174
  init
139
175
  })
140
176
  );
141
- return /* @__PURE__ */ import_react.default.createElement(
177
+ return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement(
142
178
  import_materials.PisellModal,
143
179
  {
144
180
  platform: "h5",
145
181
  open,
146
182
  footer: false,
147
183
  header: false,
148
- closable: false,
184
+ closable: true,
185
+ onCancel: handleCloseClick,
149
186
  bodyStyle: { padding: 0 }
150
187
  },
151
- /* @__PURE__ */ import_react.default.createElement("div", { className: "" }, /* @__PURE__ */ import_react.default.createElement(import_ThreedsLoading.default, null), /* @__PURE__ */ import_react.default.createElement("div", { id: "threeds-container" }))
152
- );
188
+ /* @__PURE__ */ import_react.default.createElement("div", { className: "" }, /* @__PURE__ */ import_react.default.createElement(
189
+ import_ThreedsLoading.default,
190
+ {
191
+ title: import_utils.locales.getText("tocPay.text.processingPayment"),
192
+ subtitle: import_utils.locales.getText("tocPay.text.securityCheckRequired"),
193
+ description: import_utils.locales.getText("tocPay.text.doNotClosePage")
194
+ }
195
+ ), /* @__PURE__ */ import_react.default.createElement("div", { id: "threeds-container" }))
196
+ ), /* @__PURE__ */ import_react.default.createElement(
197
+ import_materials.PisellModal,
198
+ {
199
+ open: showCloseConfirm,
200
+ closable: false,
201
+ footer: null,
202
+ header: false,
203
+ mobileModalHeight: "auto",
204
+ headerDivider: false,
205
+ footerDivider: false,
206
+ bodyStyle: { padding: 24 },
207
+ transitionName: "pisell-move-down"
208
+ },
209
+ /* @__PURE__ */ import_react.default.createElement("div", { className: "tds-close-confirm-modal" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "tds-close-confirm-title" }, import_utils.locales.getText("tocPay.text.stopWaitingTitle")), /* @__PURE__ */ import_react.default.createElement("div", { className: "tds-close-confirm-desc" }, import_utils.locales.getText("tocPay.text.stopWaitingDesc")), /* @__PURE__ */ import_react.default.createElement("div", { className: "tds-close-confirm-actions" }, /* @__PURE__ */ import_react.default.createElement(
210
+ import_antd.Button,
211
+ {
212
+ type: "primary",
213
+ block: true,
214
+ className: "tds-close-confirm-btn-primary",
215
+ onClick: handleContinueWaiting
216
+ },
217
+ import_utils.locales.getText("tocPay.text.continueWaiting")
218
+ ), /* @__PURE__ */ import_react.default.createElement(
219
+ "div",
220
+ {
221
+ className: "tds-close-confirm-link",
222
+ onClick: handleViewOrder
223
+ },
224
+ import_utils.locales.getText("tocPay.text.viewOrder")
225
+ )))
226
+ ));
153
227
  };
154
228
  var TDSPay_default = (0, import_react.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
+ }