@pisell/private-materials 3.4.88 → 3.4.90

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 (149) 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/addons/model.d.ts +10 -1
  12. package/es/components/booking/components/footer/utils.js +24 -11
  13. package/es/components/booking/forms/model.d.ts +10 -1
  14. package/es/components/booking/forms/sendModal/useSendModal.d.ts +0 -1
  15. package/es/components/booking/info/clientVariant/hooks/useIsLowSpeedNetwork.d.ts +0 -1
  16. package/es/components/booking/info/hooks/useInfoHolder.d.ts +0 -1
  17. package/es/components/booking/info/model.d.ts +10 -1
  18. package/es/components/booking/info/service/addService/utils.d.ts +1 -1
  19. package/es/components/booking/info2/service/addService/utils.d.ts +1 -1
  20. package/es/components/booking/info2/service/editService/index.js +36 -6
  21. package/es/components/booking/info2/service/editService/utils.d.ts +15 -0
  22. package/es/components/booking/info2/service/editService/utils.js +76 -0
  23. package/es/components/booking/model.d.ts +9 -1
  24. package/es/components/booking/notes/model.d.ts +10 -1
  25. package/es/components/booking/payments/model.d.ts +10 -1
  26. package/es/components/booking/utils.d.ts +2 -2
  27. package/es/components/eftpos/hooks.d.ts +0 -1
  28. package/es/components/eftposPay/amount.d.ts +1 -1
  29. package/es/components/eftposPay/device.d.ts +1 -1
  30. package/es/components/eftposPay/hooks.d.ts +2 -2
  31. package/es/components/eftposPay/store/index.d.ts +6 -6
  32. package/es/components/eftposPay/tyro/hooks.d.ts +0 -1
  33. package/es/components/eventBooking/components/ErrorTip/index.d.ts +0 -1
  34. package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateStatus/index.d.ts +0 -1
  35. package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/CallToBook/index.d.ts +0 -1
  36. package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/WeekItem/index.d.ts +0 -1
  37. package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/index.d.ts +0 -1
  38. package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/Item/DayItem/index.d.ts +0 -1
  39. package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/Item/index.d.ts +0 -1
  40. package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/Status/index.d.ts +0 -1
  41. package/es/components/pay/toC/PaymentList/payment/google_pay.svg +26 -8
  42. package/es/components/pay/toC/PaymentList/payment/google_pay2.svg +9 -0
  43. package/es/components/pay/toC/PaymentMethods/MWCreditCard/Add/index.d.ts +6 -0
  44. package/es/components/pay/toC/PaymentMethods/MWCreditCard/Add/index.js +65 -21
  45. package/es/components/pay/toC/PaymentMethods/MWCreditCard/Add/index.less +110 -9
  46. package/es/components/pay/toC/PaymentMethods/MWCreditCard/List/index.d.ts +2 -0
  47. package/es/components/pay/toC/PaymentMethods/MWCreditCard/List/index.js +28 -16
  48. package/es/components/pay/toC/PaymentMethods/MWCreditCard/TDSPay/ThreedsLoading/index.d.ts +20 -1
  49. package/es/components/pay/toC/PaymentMethods/MWCreditCard/TDSPay/ThreedsLoading/index.js +14 -1
  50. package/es/components/pay/toC/PaymentMethods/MWCreditCard/TDSPay/ThreedsLoading/index.less +20 -0
  51. package/es/components/pay/toC/PaymentMethods/MWCreditCard/TDSPay/index.d.ts +7 -1
  52. package/es/components/pay/toC/PaymentMethods/MWCreditCard/TDSPay/index.js +167 -56
  53. package/es/components/pay/toC/PaymentMethods/MWCreditCard/TDSPay/index.less +47 -0
  54. package/es/components/pay/toC/PaymentMethods/MWCreditCard/components/TDSErrorModal/index.d.ts +34 -0
  55. package/es/components/pay/toC/PaymentMethods/MWCreditCard/components/TDSErrorModal/index.js +83 -0
  56. package/es/components/pay/toC/PaymentMethods/MWCreditCard/components/TDSErrorModal/index.less +52 -0
  57. package/es/components/pay/toC/PaymentMethods/MWCreditCard/index.d.ts +9 -1
  58. package/es/components/pay/toC/PaymentMethods/MWCreditCard/index.js +260 -33
  59. package/es/components/pay/toC/PaymentMethods/MWCreditCard/tds2.d.ts +23 -3
  60. package/es/components/pay/toC/PaymentMethods/MWCreditCard/tds2.js +292 -115
  61. package/es/components/pay/toC/PaymentMethods/StripePay/Stripe/Finish/index.d.ts +0 -1
  62. package/es/components/pay/toC/PaymentMethods/StripePay/Stripe/StripeSDK/index.d.ts +0 -1
  63. package/es/components/pay/toC/PaymentMethods/StripePay/Stripe/components/PageLoading/index.d.ts +0 -1
  64. package/es/components/pay/toC/PaymentMethods/index.js +12 -2
  65. package/es/components/pay/toC/index.js +53 -18
  66. package/es/components/pay/toC/locales.d.ts +115 -0
  67. package/es/components/pay/toC/locales.js +143 -18
  68. package/es/components/pay/toC/model.d.ts +9 -1
  69. package/es/components/pay/toC/serve.d.ts +10 -0
  70. package/es/components/pay/toC/serve.js +40 -1
  71. package/es/components/pay/toC/utils.d.ts +5 -0
  72. package/es/components/pay/toC/utils.js +10 -0
  73. package/es/components/schedules/model.d.ts +9 -1
  74. package/es/components/shoppingCart/components/Empty/index.d.ts +0 -1
  75. package/es/hooks/usePaymentLogger.d.ts +0 -1
  76. package/es/plus/pisellSalesManagement/config/booking.d.ts +6 -7
  77. package/es/plus/selectHolder/components/ErrorTip/index.d.ts +0 -1
  78. package/es/plus/walletEditor/components/ImageUpload/index.d.ts +1 -1
  79. package/es/pro/Selector/Selector.d.ts +1 -1
  80. package/lib/components/booking/addons/model.d.ts +10 -1
  81. package/lib/components/booking/components/footer/utils.js +15 -3
  82. package/lib/components/booking/forms/model.d.ts +10 -1
  83. package/lib/components/booking/forms/sendModal/useSendModal.d.ts +0 -1
  84. package/lib/components/booking/info/clientVariant/hooks/useIsLowSpeedNetwork.d.ts +0 -1
  85. package/lib/components/booking/info/hooks/useInfoHolder.d.ts +0 -1
  86. package/lib/components/booking/info/model.d.ts +10 -1
  87. package/lib/components/booking/info/service/addService/utils.d.ts +1 -1
  88. package/lib/components/booking/info2/service/addService/utils.d.ts +1 -1
  89. package/lib/components/booking/info2/service/editService/index.js +24 -1
  90. package/lib/components/booking/info2/service/editService/utils.d.ts +15 -0
  91. package/lib/components/booking/info2/service/editService/utils.js +38 -2
  92. package/lib/components/booking/model.d.ts +9 -1
  93. package/lib/components/booking/notes/model.d.ts +10 -1
  94. package/lib/components/booking/payments/model.d.ts +10 -1
  95. package/lib/components/booking/utils.d.ts +2 -2
  96. package/lib/components/eftpos/hooks.d.ts +0 -1
  97. package/lib/components/eftposPay/amount.d.ts +1 -1
  98. package/lib/components/eftposPay/device.d.ts +1 -1
  99. package/lib/components/eftposPay/hooks.d.ts +2 -2
  100. package/lib/components/eftposPay/store/index.d.ts +6 -6
  101. package/lib/components/eftposPay/tyro/hooks.d.ts +0 -1
  102. package/lib/components/eventBooking/components/ErrorTip/index.d.ts +0 -1
  103. package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateStatus/index.d.ts +0 -1
  104. package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/CallToBook/index.d.ts +0 -1
  105. package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/WeekItem/index.d.ts +0 -1
  106. package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/index.d.ts +0 -1
  107. package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/Item/DayItem/index.d.ts +0 -1
  108. package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/Item/index.d.ts +0 -1
  109. package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/Status/index.d.ts +0 -1
  110. package/lib/components/pay/toC/PaymentList/payment/google_pay.svg +26 -8
  111. package/lib/components/pay/toC/PaymentList/payment/google_pay2.svg +9 -0
  112. package/lib/components/pay/toC/PaymentMethods/MWCreditCard/Add/index.d.ts +6 -0
  113. package/lib/components/pay/toC/PaymentMethods/MWCreditCard/Add/index.js +40 -17
  114. package/lib/components/pay/toC/PaymentMethods/MWCreditCard/Add/index.less +110 -9
  115. package/lib/components/pay/toC/PaymentMethods/MWCreditCard/List/index.d.ts +2 -0
  116. package/lib/components/pay/toC/PaymentMethods/MWCreditCard/List/index.js +17 -5
  117. package/lib/components/pay/toC/PaymentMethods/MWCreditCard/TDSPay/ThreedsLoading/index.d.ts +20 -1
  118. package/lib/components/pay/toC/PaymentMethods/MWCreditCard/TDSPay/ThreedsLoading/index.js +8 -2
  119. package/lib/components/pay/toC/PaymentMethods/MWCreditCard/TDSPay/ThreedsLoading/index.less +20 -0
  120. package/lib/components/pay/toC/PaymentMethods/MWCreditCard/TDSPay/index.d.ts +7 -1
  121. package/lib/components/pay/toC/PaymentMethods/MWCreditCard/TDSPay/index.js +98 -24
  122. package/lib/components/pay/toC/PaymentMethods/MWCreditCard/TDSPay/index.less +47 -0
  123. package/lib/components/pay/toC/PaymentMethods/MWCreditCard/components/TDSErrorModal/index.d.ts +34 -0
  124. package/lib/components/pay/toC/PaymentMethods/MWCreditCard/components/TDSErrorModal/index.js +107 -0
  125. package/lib/components/pay/toC/PaymentMethods/MWCreditCard/components/TDSErrorModal/index.less +52 -0
  126. package/lib/components/pay/toC/PaymentMethods/MWCreditCard/index.d.ts +9 -1
  127. package/lib/components/pay/toC/PaymentMethods/MWCreditCard/index.js +149 -5
  128. package/lib/components/pay/toC/PaymentMethods/MWCreditCard/tds2.d.ts +23 -3
  129. package/lib/components/pay/toC/PaymentMethods/MWCreditCard/tds2.js +99 -16
  130. package/lib/components/pay/toC/PaymentMethods/StripePay/Stripe/Finish/index.d.ts +0 -1
  131. package/lib/components/pay/toC/PaymentMethods/StripePay/Stripe/StripeSDK/index.d.ts +0 -1
  132. package/lib/components/pay/toC/PaymentMethods/StripePay/Stripe/components/PageLoading/index.d.ts +0 -1
  133. package/lib/components/pay/toC/PaymentMethods/index.js +19 -14
  134. package/lib/components/pay/toC/index.js +34 -3
  135. package/lib/components/pay/toC/locales.d.ts +115 -0
  136. package/lib/components/pay/toC/locales.js +133 -18
  137. package/lib/components/pay/toC/model.d.ts +9 -1
  138. package/lib/components/pay/toC/serve.d.ts +10 -0
  139. package/lib/components/pay/toC/serve.js +10 -0
  140. package/lib/components/pay/toC/utils.d.ts +5 -0
  141. package/lib/components/pay/toC/utils.js +17 -0
  142. package/lib/components/schedules/model.d.ts +9 -1
  143. package/lib/components/shoppingCart/components/Empty/index.d.ts +0 -1
  144. package/lib/hooks/usePaymentLogger.d.ts +0 -1
  145. package/lib/plus/pisellSalesManagement/config/booking.d.ts +6 -7
  146. package/lib/plus/selectHolder/components/ErrorTip/index.d.ts +0 -1
  147. package/lib/plus/walletEditor/components/ImageUpload/index.d.ts +1 -1
  148. package/lib/pro/Selector/Selector.d.ts +1 -1
  149. package/package.json +4 -4
@@ -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
+ }
@@ -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;