@pisell/private-materials 6.5.10 → 6.5.12

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 (145) 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 +2 -2
  6. package/build/lowcode/preview.js +148 -164
  7. package/build/lowcode/render/default/view.css +1 -1
  8. package/build/lowcode/render/default/view.js +3 -3
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +7 -7
  11. package/es/components/Sales/Summary/utils.d.ts +1 -1
  12. package/es/components/appointmentBooking/components/Services/index.js +36 -18
  13. package/es/components/appointmentBooking/hooks.js +6 -0
  14. package/es/components/booking/components/footer/index.js +24 -5
  15. package/es/components/booking/editBookingModal/index.js +8 -2
  16. package/es/components/booking/forms/sendModal/useSendModal.d.ts +1 -1
  17. package/es/components/booking/info/service2/utils.d.ts +1 -1
  18. package/es/components/booking/locales.d.ts +6 -0
  19. package/es/components/booking/locales.js +12 -0
  20. package/es/components/booking/utils.d.ts +2 -2
  21. package/es/components/checkout/PaymentModal.js +145 -101
  22. package/es/components/checkout/components/AmountSummary/index.js +6 -4
  23. package/es/components/checkout/components/CashPaymentModule/index.d.ts +3 -1
  24. package/es/components/checkout/components/CashPaymentModule/index.js +14 -10
  25. package/es/components/checkout/components/PaymentDetailModal/index.js +76 -27
  26. package/es/components/checkout/components/PaymentDetailModal/index.less +23 -2
  27. package/es/components/checkout/components/PaymentOptionsModule/index.js +4 -1
  28. package/es/components/checkout/hooks/useWalletPass.d.ts +1 -1
  29. package/es/components/checkout/hooks/useWalletPass.js +1 -0
  30. package/es/components/eftposPay/amount.d.ts +1 -1
  31. package/es/components/eftposPay/device.d.ts +1 -1
  32. package/es/components/eftposPay/hooks.d.ts +1 -1
  33. package/es/components/eftposPay/linkly/hooks/normal.js +3 -3
  34. package/es/components/eftposPay/linkly/hooks/useTimeQuery.js +60 -17
  35. package/es/components/eftposPay/payo/config.js +10 -10
  36. package/es/components/eftposPay/serve.js +1 -1
  37. package/es/components/eftposPay/store/index.d.ts +3 -3
  38. package/es/components/index.d.ts +3 -1
  39. package/es/components/index.js +3 -1
  40. package/es/components/pay/toC/PaymentMethods/MWCreditCard/tds2.js +6 -3
  41. package/es/components/pay/toC/PaymentMethods/WalletPass/List/index.d.ts +2 -0
  42. package/es/components/pay/toC/PaymentMethods/WalletPass/index.js +112 -24
  43. package/es/components/pay/toC/PaymentMethods/WalletPass/serve.d.ts +38 -2
  44. package/es/components/pay/toC/PaymentMethods/WalletPass/serve.js +78 -0
  45. package/es/components/pay/toC/PaymentMethods/WalletPass/utils.d.ts +6 -0
  46. package/es/components/pay/toC/PaymentMethods/WalletPass/utils.js +9 -0
  47. package/es/components/pay/toC/utils.js +1 -1
  48. package/es/components/pinModal/hooks.d.ts +7 -0
  49. package/es/components/pinModal/hooks.js +65 -0
  50. package/es/components/pinModal/index.d.ts +4 -0
  51. package/es/components/pinModal/index.js +98 -0
  52. package/es/components/pinModal/index.less +44 -0
  53. package/es/components/pinModal/locales.d.ts +27 -0
  54. package/es/components/pinModal/locales.js +26 -0
  55. package/es/components/pinModal/serve.d.ts +6 -0
  56. package/es/components/pinModal/serve.js +11 -0
  57. package/es/components/pinModal/types.d.ts +0 -0
  58. package/es/components/pinModal/types.js +0 -0
  59. package/es/components/pinVerifyModal/hooks.d.ts +7 -0
  60. package/es/components/pinVerifyModal/hooks.js +80 -0
  61. package/es/components/pinVerifyModal/index.d.ts +5 -0
  62. package/es/components/pinVerifyModal/index.js +218 -0
  63. package/es/components/pinVerifyModal/index.less +92 -0
  64. package/es/components/pinVerifyModal/locales.d.ts +24 -0
  65. package/es/components/pinVerifyModal/locales.js +23 -0
  66. package/es/components/pinVerifyModal/types.d.ts +33 -0
  67. package/es/components/pinVerifyModal/types.js +1 -0
  68. package/es/components/schedules/utils.d.ts +1 -1
  69. package/es/components/ticketBooking/components/ticketBooking/index.d.ts +7 -0
  70. package/es/components/ticketBooking/components/ticketBooking/index.js +56 -10
  71. package/es/components/ticketBooking/components/timeBar/index.js +2 -1
  72. package/es/components/ticketBooking/utils/index.d.ts +1 -1
  73. package/es/components/walletList/index.js +20 -2
  74. package/es/index.d.ts +2 -0
  75. package/es/index.js +3 -1
  76. package/es/utils/index.d.ts +1 -1
  77. package/lib/components/Sales/Summary/utils.d.ts +1 -1
  78. package/lib/components/appointmentBooking/components/Services/index.js +13 -3
  79. package/lib/components/appointmentBooking/hooks.js +6 -0
  80. package/lib/components/booking/components/footer/index.js +21 -3
  81. package/lib/components/booking/editBookingModal/index.js +6 -1
  82. package/lib/components/booking/forms/sendModal/useSendModal.d.ts +1 -1
  83. package/lib/components/booking/info/service2/utils.d.ts +1 -1
  84. package/lib/components/booking/locales.d.ts +6 -0
  85. package/lib/components/booking/locales.js +6 -0
  86. package/lib/components/booking/utils.d.ts +2 -2
  87. package/lib/components/checkout/PaymentModal.js +37 -9
  88. package/lib/components/checkout/components/AmountSummary/index.js +4 -4
  89. package/lib/components/checkout/components/CashPaymentModule/index.d.ts +3 -1
  90. package/lib/components/checkout/components/CashPaymentModule/index.js +6 -3
  91. package/lib/components/checkout/components/PaymentDetailModal/index.js +47 -14
  92. package/lib/components/checkout/components/PaymentDetailModal/index.less +23 -2
  93. package/lib/components/checkout/components/PaymentOptionsModule/index.js +3 -1
  94. package/lib/components/checkout/hooks/useWalletPass.d.ts +1 -1
  95. package/lib/components/checkout/hooks/useWalletPass.js +1 -0
  96. package/lib/components/eftposPay/amount.d.ts +1 -1
  97. package/lib/components/eftposPay/device.d.ts +1 -1
  98. package/lib/components/eftposPay/hooks.d.ts +1 -1
  99. package/lib/components/eftposPay/linkly/hooks/normal.js +3 -3
  100. package/lib/components/eftposPay/linkly/hooks/useTimeQuery.js +59 -15
  101. package/lib/components/eftposPay/payo/config.js +9 -9
  102. package/lib/components/eftposPay/serve.js +1 -1
  103. package/lib/components/eftposPay/store/index.d.ts +3 -3
  104. package/lib/components/index.d.ts +3 -1
  105. package/lib/components/index.js +6 -0
  106. package/lib/components/pay/toC/PaymentMethods/MWCreditCard/tds2.js +2 -0
  107. package/lib/components/pay/toC/PaymentMethods/WalletPass/List/index.d.ts +2 -0
  108. package/lib/components/pay/toC/PaymentMethods/WalletPass/index.js +84 -36
  109. package/lib/components/pay/toC/PaymentMethods/WalletPass/serve.d.ts +38 -2
  110. package/lib/components/pay/toC/PaymentMethods/WalletPass/serve.js +18 -0
  111. package/lib/components/pay/toC/PaymentMethods/WalletPass/utils.d.ts +6 -0
  112. package/lib/components/pay/toC/PaymentMethods/WalletPass/utils.js +7 -2
  113. package/lib/components/pay/toC/utils.js +1 -1
  114. package/lib/components/pinModal/hooks.d.ts +7 -0
  115. package/lib/components/pinModal/hooks.js +85 -0
  116. package/lib/components/pinModal/index.d.ts +4 -0
  117. package/lib/components/pinModal/index.js +88 -0
  118. package/lib/components/pinModal/index.less +44 -0
  119. package/lib/components/pinModal/locales.d.ts +27 -0
  120. package/lib/components/pinModal/locales.js +50 -0
  121. package/lib/components/pinModal/serve.d.ts +6 -0
  122. package/lib/components/pinModal/serve.js +37 -0
  123. package/lib/components/pinModal/types.d.ts +0 -0
  124. package/lib/components/pinModal/types.js +0 -0
  125. package/lib/components/pinVerifyModal/hooks.d.ts +7 -0
  126. package/lib/components/pinVerifyModal/hooks.js +93 -0
  127. package/lib/components/pinVerifyModal/index.d.ts +5 -0
  128. package/lib/components/pinVerifyModal/index.js +230 -0
  129. package/lib/components/pinVerifyModal/index.less +92 -0
  130. package/lib/components/pinVerifyModal/locales.d.ts +24 -0
  131. package/lib/components/pinVerifyModal/locales.js +47 -0
  132. package/lib/components/pinVerifyModal/types.d.ts +33 -0
  133. package/lib/components/pinVerifyModal/types.js +17 -0
  134. package/lib/components/schedules/utils.d.ts +1 -1
  135. package/lib/components/ticketBooking/components/ticketBooking/index.d.ts +7 -0
  136. package/lib/components/ticketBooking/components/ticketBooking/index.js +52 -5
  137. package/lib/components/ticketBooking/components/timeBar/index.js +2 -1
  138. package/lib/components/ticketBooking/utils/index.d.ts +1 -1
  139. package/lib/components/walletList/index.js +19 -2
  140. package/lib/index.d.ts +2 -0
  141. package/lib/index.js +6 -0
  142. package/lib/utils/index.d.ts +1 -1
  143. package/lowcode/pin-modal/meta.ts +37 -0
  144. package/lowcode/pin-verify-modal/meta.ts +80 -0
  145. package/package.json +1 -1
@@ -104,16 +104,9 @@ function PaymentDetailModal(_ref) {
104
104
  return paymentItems.filter(function (item) {
105
105
  return !item.voucher_id || item.isSynced;
106
106
  }).reduce(function (total, item) {
107
- return total + Math.abs(item.amount) + Math.abs(item.rounding_amount);
108
- }, 0);
109
- };
110
-
111
- // 计算优惠券扣减总额 (只计算带voucher_id的支付项)
112
- var getTotalVoucherAmount = function getTotalVoucherAmount() {
113
- return paymentItems.filter(function (item) {
114
- return item.voucher_id;
115
- }).reduce(function (total, item) {
116
- return total + Math.abs(item.amount);
107
+ var amount = new Decimal(Math.abs(item.amount));
108
+ var roundingAmount = new Decimal(Number(item.rounding_amount) > 0 ? 0 : item.rounding_amount || 0);
109
+ return new Decimal(total).plus(amount).plus(roundingAmount).toNumber();
117
110
  }, 0);
118
111
  };
119
112
 
@@ -136,25 +129,76 @@ function PaymentDetailModal(_ref) {
136
129
 
137
130
  // 渲染支付项 (只渲染不带voucher_id的支付项)
138
131
  var renderPaymentItems = function renderPaymentItems() {
132
+ var depositPayments = paymentItems.filter(function (item) {
133
+ return item.order_payment_type === 'deposit' && item.isSynced;
134
+ });
139
135
  var regularPayments = paymentItems.filter(function (item) {
140
- return !item.voucher_id;
136
+ return item.isSynced && item.order_payment_type !== 'deposit';
141
137
  });
142
- if (!paymentItems || paymentItems.length === 0 || regularPayments.length === 0) {
138
+ if (!paymentItems || paymentItems.length === 0 || regularPayments.length === 0 && depositPayments.length === 0) {
143
139
  return /*#__PURE__*/React.createElement("div", {
144
140
  className: classNames('section-content')
145
141
  }, /*#__PURE__*/React.createElement("div", {
146
142
  className: classNames('no-payment-text')
147
143
  }, getText('no.payments.recorded') || 'No payments recorded'));
148
144
  }
145
+ var depositPaymentSummary = depositPayments.reduce(function (acc, item) {
146
+ return new Decimal(acc).plus(new Decimal(item.amount)).plus(new Decimal(Number(item.rounding_amount) > 0 ? 0 : item.rounding_amount || 0)).toNumber();
147
+ }, 0);
148
+ var regularPaymentSummary = regularPayments.reduce(function (acc, item) {
149
+ return new Decimal(acc).plus(new Decimal(item.amount)).plus(new Decimal(Number(item.rounding_amount) > 0 ? 0 : item.rounding_amount || 0)).toNumber();
150
+ }, 0);
149
151
  return /*#__PURE__*/React.createElement("div", {
150
152
  className: classNames('section-content')
151
153
  }, /*#__PURE__*/React.createElement("div", {
152
154
  className: classNames('payment-record-container')
153
- }, regularPayments.map(function (item) {
155
+ }, depositPayments.length > 0 && /*#__PURE__*/React.createElement("div", {
156
+ className: classNames('payment-item-header')
157
+ }, /*#__PURE__*/React.createElement("div", null, getText('pisell2.subtotal.deposit') || 'Deposit'), /*#__PURE__*/React.createElement("div", null, formatAmountWithOptions(depositPaymentSummary, amountSymbol, {
158
+ precision: 2,
159
+ hideDecimalForWholeNumbers: false,
160
+ useThousandsSeparator: true,
161
+ showCurrencySymbol: true
162
+ }))), depositPayments.map(function (item) {
163
+ return /*#__PURE__*/React.createElement("div", {
164
+ key: item.uuid,
165
+ className: classNames('payment-item')
166
+ }, /*#__PURE__*/React.createElement("div", {
167
+ className: classNames('payment-item-bullet')
168
+ }), /*#__PURE__*/React.createElement("div", {
169
+ className: classNames('payment-item-content')
170
+ }, /*#__PURE__*/React.createElement("div", {
171
+ className: classNames('payment-item-text')
172
+ }, item.name, " - ", new Date().toLocaleDateString(), ' ', getText('pisell2.checkout.payment-detail.by') || 'by', ' ', getCustomerInfo().nickname), /*#__PURE__*/React.createElement("div", {
173
+ className: classNames('payment-item-actions')
174
+ }, /*#__PURE__*/React.createElement("div", {
175
+ className: classNames('payment-item-amount')
176
+ }, "-", formatAmountWithOptions(new Decimal(Math.abs(item.amount)).plus(new Decimal(Number(item.rounding_amount) > 0 ? 0 : item.rounding_amount || 0)).toNumber(), amountSymbol, {
177
+ precision: 2,
178
+ hideDecimalForWholeNumbers: false,
179
+ useThousandsSeparator: true,
180
+ showCurrencySymbol: true
181
+ })), shouldShowVoidButton(item) && /*#__PURE__*/React.createElement("button", {
182
+ className: classNames('void-button'),
183
+ onClick: function onClick() {
184
+ return handleVoidPayment(item);
185
+ },
186
+ type: "button"
187
+ }, getText('void') || 'Void'))));
188
+ }), regularPayments.length > 0 && /*#__PURE__*/React.createElement("div", {
189
+ className: classNames('payment-item-header')
190
+ }, /*#__PURE__*/React.createElement("div", null, getText('payment.text') || 'Payment'), /*#__PURE__*/React.createElement("div", null, formatAmountWithOptions(regularPaymentSummary, amountSymbol, {
191
+ precision: 2,
192
+ hideDecimalForWholeNumbers: false,
193
+ useThousandsSeparator: true,
194
+ showCurrencySymbol: true
195
+ }))), regularPayments.map(function (item) {
154
196
  return /*#__PURE__*/React.createElement("div", {
155
197
  key: item.uuid,
156
198
  className: classNames('payment-item')
157
199
  }, /*#__PURE__*/React.createElement("div", {
200
+ className: classNames('payment-item-bullet')
201
+ }), /*#__PURE__*/React.createElement("div", {
158
202
  className: classNames('payment-item-content')
159
203
  }, /*#__PURE__*/React.createElement("div", {
160
204
  className: classNames('payment-item-text')
@@ -162,7 +206,7 @@ function PaymentDetailModal(_ref) {
162
206
  className: classNames('payment-item-actions')
163
207
  }, /*#__PURE__*/React.createElement("div", {
164
208
  className: classNames('payment-item-amount')
165
- }, "-", formatAmountWithOptions(Math.abs(item.amount) + Math.abs(item.rounding_amount), amountSymbol, {
209
+ }, "-", formatAmountWithOptions(new Decimal(Math.abs(item.amount)).plus(new Decimal(Number(item.rounding_amount) > 0 ? 0 : item.rounding_amount || 0)).toNumber(), amountSymbol, {
166
210
  precision: 2,
167
211
  hideDecimalForWholeNumbers: false,
168
212
  useThousandsSeparator: true,
@@ -184,19 +228,24 @@ function PaymentDetailModal(_ref) {
184
228
 
185
229
  // 1. 添加 paymentItems 中带 voucher_id 的支付项
186
230
  // 这块先不用 下面钱包卡券应该包含了
187
- var voucherPayments = paymentItems.filter(function (item) {
188
- return item.voucher_id && item.isSynced;
189
- });
190
- voucherPayments.forEach(function (item) {
191
- items.push( /*#__PURE__*/React.createElement("div", {
192
- key: "payment-".concat(item.uuid),
193
- className: classNames('balance-item-row')
194
- }, /*#__PURE__*/React.createElement("div", {
195
- className: classNames('balance-item-text')
196
- }, item.name, " - ", item.voucher_id), /*#__PURE__*/React.createElement("div", {
197
- className: classNames('balance-item-amount')
198
- }, "-$", Math.abs(item.amount).toFixed(2))));
199
- });
231
+ // const voucherPayments = paymentItems.filter(item => item.voucher_id && !item.isSynced);
232
+ // voucherPayments.forEach((item) => {
233
+ // items.push(
234
+ // <div key={`payment-${item.uuid}`} className={classNames('balance-item-row')}>
235
+ // <div className={classNames('balance-item-text')}>
236
+ // {item.name} - {item.voucher_id}
237
+ // </div>
238
+ // <div className={classNames('balance-item-amount')}>
239
+ // -{formatAmountWithOptions(Math.abs(item.amount), amountSymbol, {
240
+ // precision: 2,
241
+ // hideDecimalForWholeNumbers: false,
242
+ // useThousandsSeparator: true,
243
+ // showCurrencySymbol: true,
244
+ // })}
245
+ // </div>
246
+ // </div>
247
+ // );
248
+ // });
200
249
 
201
250
  // 2. 添加选中的钱包卡券 (商品券、储值卡等)
202
251
  if (walletPassData !== null && walletPassData !== void 0 && (_walletPassData$selec = walletPassData.selectedWallet) !== null && _walletPassData$selec !== void 0 && _walletPassData$selec.length) {
@@ -263,7 +263,7 @@
263
263
  flex-direction: column;
264
264
  justify-content: flex-start;
265
265
  align-items: flex-start;
266
- gap: 16px;
266
+ gap: 8px;
267
267
  }
268
268
 
269
269
  .payment-record-header {
@@ -299,12 +299,33 @@
299
299
  line-height: 20px;
300
300
  word-wrap: break-word;
301
301
  }
302
+ .payment-item-header {
303
+ width: 100%;
304
+ color: black;
305
+ font-size: 14px;
306
+ font-weight: 500;
307
+ line-height: 20px;
308
+ word-wrap: break-word;
309
+ display: flex;
310
+ justify-content: space-between;
311
+ }
302
312
 
303
313
  .payment-item {
304
314
  align-self: stretch;
305
315
  display: flex;
306
- justify-content: space-between;
316
+ justify-content: flex-start;
307
317
  align-items: center;
318
+ gap: 8px;
319
+ margin-left: 10px;
320
+ margin-right: 64px;
321
+ }
322
+
323
+ .payment-item-bullet {
324
+ width: 6px;
325
+ height: 6px;
326
+ background-color: #475467;
327
+ border-radius: 50%;
328
+ flex-shrink: 0;
308
329
  }
309
330
 
310
331
  .payment-item-content {
@@ -57,7 +57,10 @@ function PaymentOptionsModule(_ref) {
57
57
  onClick(method);
58
58
  }
59
59
  }, {
60
- wait: 500 // 500ms 防抖延迟
60
+ wait: 1000,
61
+ // 500ms 防抖延迟
62
+ leading: true,
63
+ trailing: false
61
64
  }),
62
65
  handlePaymentClick = _useDebounceFn.run;
63
66
  return /*#__PURE__*/React.createElement("div", {
@@ -17,7 +17,7 @@ export declare const useWalletPass: (props: {
17
17
  cardData: any;
18
18
  handleSelectWallet: (value: number[]) => void;
19
19
  selectedWalletIds: any[];
20
- expiredWalletIds: any[];
20
+ expiredWalletIds: any;
21
21
  expiredWalletData: any;
22
22
  disabledWalletData: any[];
23
23
  clearAllSelectedWallet: () => void;
@@ -433,6 +433,7 @@ export var useWalletPass = function useWalletPass(props) {
433
433
  } else {
434
434
  setWalletSelect([]);
435
435
  notSetWalletSelectRef.current = false;
436
+ onSelectChange === null || onSelectChange === void 0 || onSelectChange([]);
436
437
  }
437
438
 
438
439
  // 获取折扣列表并按初始顺序排序(isSelected为true的在前)
@@ -8,7 +8,7 @@ import { PosProps } from './const';
8
8
  */
9
9
  declare const _default: ({ className, onChange, onClose, formatAmount, isMobile, net, client }: {
10
10
  className?: string | undefined;
11
- onChange?: ((status: "success" | "page" | "print" | "fail" | "mark_tx_processed", params?: string | {
11
+ onChange?: ((status: "page" | "success" | "print" | "fail" | "mark_tx_processed", params?: string | {
12
12
  [keys: string]: unknown;
13
13
  } | undefined, other?: any) => void) | undefined;
14
14
  onClose: () => void;
@@ -11,7 +11,7 @@ import './device.less';
11
11
  declare const _default: ({ api, onChange, onClose, className, device_number, isMobile, net, client, formatAmount, containerStyle, }: {
12
12
  api: PayProps['api'];
13
13
  className?: string | undefined;
14
- onChange?: ((status: "success" | "page" | "print" | "fail" | "mark_tx_processed", params?: string | {
14
+ onChange?: ((status: "page" | "success" | "print" | "fail" | "mark_tx_processed", params?: string | {
15
15
  [keys: string]: unknown;
16
16
  } | undefined, other?: any) => void) | undefined;
17
17
  onClose: () => void;
@@ -15,7 +15,7 @@ export declare const useStoreRef: <T extends {
15
15
  readonly numRef: React.MutableRefObject<string | number | undefined>;
16
16
  readonly orderIdRef: React.MutableRefObject<string | number>;
17
17
  readonly modeRef: React.MutableRefObject<ModeEnum>;
18
- readonly statusRef: React.MutableRefObject<"success" | "warn" | "loading" | "fail" | "pedding" | "resove" | "reject" | "question">;
18
+ readonly statusRef: React.MutableRefObject<"loading" | "warn" | "success" | "fail" | "pedding" | "resove" | "reject" | "question">;
19
19
  readonly netRef: React.MutableRefObject<boolean | undefined>;
20
20
  readonly symbolRef: React.MutableRefObject<string>;
21
21
  readonly amountRef: React.MutableRefObject<string | number>;
@@ -74,7 +74,7 @@ export var useLinklyPayOrRefund = function useLinklyPayOrRefund(handleCheck) {
74
74
  var status = res === null || res === void 0 || (_res$data = res.data) === null || _res$data === void 0 ? void 0 : _res$data.status;
75
75
 
76
76
  // 继续查询交易状态
77
- if (status === 0) {
77
+ if (status == 0) {
78
78
  var _res$data2;
79
79
  // 交易流水号
80
80
  numRef.current = res === null || res === void 0 || (_res$data2 = res.data) === null || _res$data2 === void 0 ? void 0 : _res$data2.session_id;
@@ -89,7 +89,7 @@ export var useLinklyPayOrRefund = function useLinklyPayOrRefund(handleCheck) {
89
89
  setTimeout(function () {
90
90
  var _resultQueryRef$curre;
91
91
  (_resultQueryRef$curre = resultQueryRef.current) === null || _resultQueryRef$curre === void 0 || _resultQueryRef$curre.call(resultQueryRef);
92
- });
92
+ }, 300);
93
93
  return;
94
94
  }
95
95
 
@@ -99,7 +99,7 @@ export var useLinklyPayOrRefund = function useLinklyPayOrRefund(handleCheck) {
99
99
  }));
100
100
 
101
101
  // 交易成功
102
- if (status === 1) {
102
+ if (status == 1) {
103
103
  var _handleLinklySuccessR;
104
104
  (_handleLinklySuccessR = handleLinklySuccessRef.current) === null || _handleLinklySuccessR === void 0 || _handleLinklySuccessR.call(handleLinklySuccessRef, res);
105
105
  return;
@@ -4,13 +4,14 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try
4
4
  function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
5
5
  import { useRef } from 'react';
6
6
  import { getUniqueId, locales, sendWarningLog } from '@pisell/utils';
7
+ import dayjs from 'dayjs';
7
8
  import { useDispatch, updateCustom, updateStatus, updateState } from "../../store";
8
9
  import { useFail, useStoreRef } from "../../hooks";
9
10
  import { ModeEnum, PayStatus, StatusEnum } from "../../const";
10
11
  import { LinklyActionStatus } from "../const";
11
12
 
12
13
  // 全局超时时间
13
- var GlobalTimeout = 1000 * 60;
14
+ var GlobalTimeout = 1000 * 60 * 2;
14
15
  // 单次请求超时时间
15
16
  var RequestTimeout = 1000 * 5;
16
17
  export var useTimeResultQuery = function useTimeResultQuery(api, resultCheck, handleLinklySuccess) {
@@ -18,7 +19,8 @@ export var useTimeResultQuery = function useTimeResultQuery(api, resultCheck, ha
18
19
  var _useStoreRef = useStoreRef(),
19
20
  numRef = _useStoreRef.numRef,
20
21
  modeRef = _useStoreRef.modeRef,
21
- deviceRef = _useStoreRef.deviceRef;
22
+ deviceRef = _useStoreRef.deviceRef,
23
+ orderIdRef = _useStoreRef.orderIdRef;
22
24
  var fail = useFail(0);
23
25
  var failRef = useRef(fail);
24
26
  var isPay = modeRef.current === ModeEnum.Pay || modeRef.current === ModeEnum.FullPay;
@@ -82,22 +84,31 @@ export var useTimeResultQuery = function useTimeResultQuery(api, resultCheck, ha
82
84
  console.log('Success: 全局超时或不需要处理结果,终止查询');
83
85
  return;
84
86
  }
85
- _log("Success", result);
86
87
  isQueryFinishedRef.current = true;
87
88
  var data = (result === null || result === void 0 ? void 0 : result.data) || {};
88
89
  // 交易成功,终止查询
89
- if (data.status === 1) {
90
+ if (data.status == 1) {
90
91
  console.log('交易成功,终止查询');
92
+ sendWarningLog({
93
+ title: "Linkly-".concat(isPay ? 'Pay' : 'Refund', "-\u4EA4\u6613\u6210\u529F"),
94
+ content: [{
95
+ key: 'response',
96
+ value: JSON.stringify(result)
97
+ }]
98
+ });
91
99
  reset();
92
100
  handleLinklySuccess(result);
93
101
  return;
94
102
  }
95
103
 
96
104
  // 交易状态为0,且不需要签名,则继续查询
97
- if (data.status !== undefined && (data === null || data === void 0 ? void 0 : data.status) === 0) {
105
+ if ((data === null || data === void 0 ? void 0 : data.status) == 0 && (data === null || data === void 0 ? void 0 : data.signature_flag) != 1) {
98
106
  console.log('交易状态为0需要继续查询');
107
+ _log("Querying", result);
99
108
  isQueryFinishedRef.current = false;
100
- _resultQuery();
109
+ setTimeout(function () {
110
+ _resultQuery();
111
+ }, 1500);
101
112
  return;
102
113
  }
103
114
 
@@ -105,6 +116,13 @@ export var useTimeResultQuery = function useTimeResultQuery(api, resultCheck, ha
105
116
  if (data.status < 0) {
106
117
  var _failRef$current;
107
118
  console.log('交易失败,终止查询');
119
+ sendWarningLog({
120
+ title: "Linkly-".concat(isPay ? 'Pay' : 'Refund', "-\u4EA4\u6613\u5931\u8D25"),
121
+ content: [{
122
+ key: 'response',
123
+ value: JSON.stringify(result)
124
+ }]
125
+ });
108
126
  reset();
109
127
  // 交易失败,code码转换为支付失败code码
110
128
  result.code = PayStatus.Unknown;
@@ -113,8 +131,15 @@ export var useTimeResultQuery = function useTimeResultQuery(api, resultCheck, ha
113
131
  }
114
132
 
115
133
  // 需要签名
116
- if (data.signature_flag === 1) {
134
+ if (data.signature_flag == 1) {
117
135
  console.log('交易需要签名,终止查询');
136
+ sendWarningLog({
137
+ title: "Linkly-".concat(isPay ? 'Pay' : 'Refund', "-\u4EA4\u6613\u9700\u8981\u7B7E\u540D"),
138
+ content: [{
139
+ key: 'response',
140
+ value: JSON.stringify(result)
141
+ }]
142
+ });
118
143
  reset();
119
144
  gotoSignature();
120
145
  return;
@@ -132,7 +157,20 @@ export var useTimeResultQuery = function useTimeResultQuery(api, resultCheck, ha
132
157
  _log("AbortError");
133
158
  console.log('Error: 请求被取消,将继续查询');
134
159
  isQueryFinishedRef.current = false;
135
- _resultQuery();
160
+ setTimeout(function () {
161
+ _resultQuery();
162
+ }, 1500);
163
+ return;
164
+ }
165
+
166
+ // 网关类报错,继续查询
167
+ if (!(error !== null && error !== void 0 && error.code) || "".concat(error.code) === PayStatus.Timeout) {
168
+ _log("NetworkError");
169
+ console.log('Error: 网关类报错,将继续查询');
170
+ isQueryFinishedRef.current = false;
171
+ setTimeout(function () {
172
+ _resultQuery();
173
+ }, 1500);
136
174
  return;
137
175
  }
138
176
  _log("Error", error);
@@ -222,33 +260,36 @@ export var useTimeResultQuery = function useTimeResultQuery(api, resultCheck, ha
222
260
  session_id: numRef.current
223
261
  };
224
262
  var content = [{
225
- key: 'queryId',
226
- value: JSON.stringify(queryIdRef.current)
263
+ key: 'description',
264
+ value: JSON.stringify({
265
+ queryId: queryIdRef.current,
266
+ orderId: orderIdRef.current,
267
+ type: type,
268
+ date: dayjs().format('YYYY-MM-DD HH:mm:ss')
269
+ })
227
270
  }, {
228
271
  key: 'params',
229
272
  value: JSON.stringify(params)
230
273
  }];
231
- if (type === "Success") {
274
+ if (type === "Error") {
232
275
  content.push({
233
- key: 'response',
276
+ key: 'error',
234
277
  value: JSON.stringify(res)
235
278
  });
236
- } else if (type === "Error") {
279
+ } else {
237
280
  content.push({
238
- key: 'error',
281
+ key: 'response',
239
282
  value: JSON.stringify(res)
240
283
  });
241
284
  }
242
285
  sendWarningLog({
243
- title: "Linkly-".concat(isPay ? 'Pay' : 'Refund', "-\u7ED3\u679C\u67E5\u8BE2--").concat(type),
286
+ title: "Linkly-".concat(isPay ? 'Pay' : 'Refund', "-\u4EA4\u6613\u7ED3\u679C\u8F6E\u8BE2"),
244
287
  content: content
245
288
  });
246
289
  };
247
290
  var run = function run() {
248
291
  // 重置状态
249
292
  reset();
250
- console.log('开始查询linkly结果---->>>>>>>');
251
- _log("Start");
252
293
 
253
294
  // 设置全局超时定时器
254
295
  globalTimeoutIdRef.current = setTimeout(function () {
@@ -264,6 +305,8 @@ export var useTimeResultQuery = function useTimeResultQuery(api, resultCheck, ha
264
305
  startTimeRef.current = Date.now();
265
306
  isQueryFinishedRef.current = false;
266
307
  queryIdRef.current = getUniqueId();
308
+ console.log('开始查询linkly结果---->>>>>>>');
309
+ _log("Start");
267
310
  return _resultQuery();
268
311
  };
269
312
  return {
@@ -152,15 +152,15 @@ export var POS = function POS(_ref) {
152
152
  controllerRef.current = new AbortController();
153
153
  // 支付 or 退款
154
154
  var resultPromise = modeRef.current === ModeEnum.Pay || modeRef.current === ModeEnum.FullPay ? api.pay(_objectSpread(_objectSpread({}, custom !== null && custom !== void 0 && custom.platform ? {
155
- "operator_id": custom.operator_id,
156
- "operator_type": custom.operator_type,
157
- "platform": custom.platform,
158
- "custom_payment_id": custom.custom_payment_id,
159
- "service_charge": {
160
- "amount": payRef.current.surMoney,
161
- "percentage": payRef.current.surPercentRate
155
+ operator_id: custom.operator_id,
156
+ operator_type: custom.operator_type,
157
+ platform: custom.platform,
158
+ custom_payment_id: custom.custom_payment_id,
159
+ service_charge: {
160
+ amount: payRef.current.surMoney,
161
+ percentage: payRef.current.surPercentRate
162
162
  },
163
- "original_amount": payRef.current.amount
163
+ original_amount: payRef.current.amount
164
164
  } : {}), {}, {
165
165
  order_id: orderIdRef.current,
166
166
  amount: payRef.current.total,
@@ -199,8 +199,8 @@ export var POS = function POS(_ref) {
199
199
  if (unloadRef.current || !netRef.current) {
200
200
  return;
201
201
  }
202
- // 支付接口超时 进行支付状态查询
203
- if (err && "".concat(err.code) === PayStatus.Timeout) {
202
+ // 支付接口超时 进行支付状态查询(超时或者其它错误)
203
+ if (!(err !== null && err !== void 0 && err.code) || "".concat(err.code) === PayStatus.Timeout) {
204
204
  checkApi();
205
205
  return;
206
206
  }
@@ -232,7 +232,7 @@ export var linklyPayQuery = /*#__PURE__*/function () {
232
232
  return _regeneratorRuntime().wrap(function _callee15$(_context15) {
233
233
  while (1) switch (_context15.prev = _context15.next) {
234
234
  case 0:
235
- return _context15.abrupt("return", request.getRequest().get('/shop/shop/linkly/pay/query', params, config));
235
+ return _context15.abrupt("return", request.getRequest().get('/shop/linkly/pay/query', params, config));
236
236
  case 1:
237
237
  case "end":
238
238
  return _context15.stop();
@@ -174,7 +174,7 @@ export declare const updateCustom: (payload: {
174
174
  export declare const updateStatus: (status: 'loading' | 'warn' | 'fail' | 'success' | 'question') => {
175
175
  type: EActionTypes;
176
176
  payload: {
177
- status: "success" | "warn" | "loading" | "fail" | "question";
177
+ status: "loading" | "warn" | "success" | "fail" | "question";
178
178
  };
179
179
  };
180
180
  /**
@@ -295,7 +295,7 @@ export declare const backUpFree: (payload: Partial<State>) => {
295
295
  name?: string | undefined;
296
296
  symbol?: string | undefined;
297
297
  amount?: string | number | undefined;
298
- mode?: "refund" | "pay" | "fullPay" | "query" | undefined;
298
+ mode?: "refund" | "fullPay" | "pay" | "query" | undefined;
299
299
  order_id?: string | number | undefined;
300
300
  eftpos?: "stripe" | "payo" | "tyro" | "windcave" | "linkly" | undefined;
301
301
  action?: "amount" | "pay" | "deviceList" | undefined;
@@ -308,7 +308,7 @@ export declare const backUpFree: (payload: Partial<State>) => {
308
308
  net?: boolean | undefined;
309
309
  component?: string | undefined;
310
310
  form?: string | undefined;
311
- status?: "success" | "warn" | "loading" | "fail" | "pedding" | "resove" | "reject" | "question" | undefined;
311
+ status?: "loading" | "warn" | "success" | "fail" | "pedding" | "resove" | "reject" | "question" | undefined;
312
312
  warn?: string | undefined;
313
313
  steps?: {
314
314
  /** 用于重置当前步骤 */
@@ -17,4 +17,6 @@ import PisellSelectCustomerModal from './pisellSelectCustomerModal';
17
17
  import SubTotal from './subTotal';
18
18
  import EditBookingModal from './booking/editBookingModal';
19
19
  import StepController from './stepController';
20
- export { Login, BookingInfo, Booking, BookingNotes, BookingAddons, BookingForms, Schedules, ProductExtension, RuleSetting, TaxSelect, ToCPay, PisellSelectCustomerModal, Wallet, WalletList, WorkspaceList, WorkspaceListDetail, SubTotal, EditBookingModal, StepController };
20
+ import PinModal from './pinModal';
21
+ import PinVerifyModal from './pinVerifyModal';
22
+ export { Login, BookingInfo, Booking, BookingNotes, BookingAddons, BookingForms, Schedules, ProductExtension, RuleSetting, TaxSelect, ToCPay, PisellSelectCustomerModal, Wallet, WalletList, WorkspaceList, WorkspaceListDetail, SubTotal, EditBookingModal, StepController, PinModal, PinVerifyModal, };
@@ -17,4 +17,6 @@ import PisellSelectCustomerModal from "./pisellSelectCustomerModal";
17
17
  import SubTotal from "./subTotal";
18
18
  import EditBookingModal from "./booking/editBookingModal";
19
19
  import StepController from "./stepController";
20
- export { Login, BookingInfo, Booking, BookingNotes, BookingAddons, BookingForms, Schedules, ProductExtension, RuleSetting, TaxSelect, ToCPay, PisellSelectCustomerModal, Wallet, WalletList, WorkspaceList, WorkspaceListDetail, SubTotal, EditBookingModal, StepController };
20
+ import PinModal from "./pinModal";
21
+ import PinVerifyModal from "./pinVerifyModal";
22
+ export { Login, BookingInfo, Booking, BookingNotes, BookingAddons, BookingForms, Schedules, ProductExtension, RuleSetting, TaxSelect, ToCPay, PisellSelectCustomerModal, Wallet, WalletList, WorkspaceList, WorkspaceListDetail, SubTotal, EditBookingModal, StepController, PinModal, PinVerifyModal };
@@ -262,7 +262,9 @@ export var createThreeDSMethodIframe = /*#__PURE__*/function () {
262
262
  }
263
263
  return _context3.abrupt("return", defaultReturnParams);
264
264
  case 5:
265
- displayBox = document.getElementById('threeds-container'); // 创建iframe
265
+ displayBox = document.getElementById('threeds-container'); // 清空dom中的内容
266
+ displayBox.innerHTML = '';
267
+ // 创建iframe
266
268
  iframe = document.createElement('iframe'); // iframe.src = "about:blank";
267
269
  iframe.classList.add('hidden_TDS_From');
268
270
  iframe.name = 'threeDSMethodIframe';
@@ -315,7 +317,7 @@ export var createThreeDSMethodIframe = /*#__PURE__*/function () {
315
317
  }
316
318
  }, false);
317
319
  }));
318
- case 27:
320
+ case 28:
319
321
  case "end":
320
322
  return _context3.stop();
321
323
  }
@@ -436,7 +438,8 @@ export var checkTDSAuth = /*#__PURE__*/function () {
436
438
  */
437
439
  export var createChallengeIframe = function createChallengeIframe(challengeData, callback) {
438
440
  var displayBox = document.getElementById('threeds-container');
439
-
441
+ // 清空dom中的内容
442
+ displayBox.innerHTML = '';
440
443
  // 创建iframe
441
444
  var iframe = document.createElement('iframe');
442
445
  iframe.classList.add('tdsv2challengeIframe');
@@ -11,6 +11,8 @@ export interface WalletPassListProps {
11
11
  name: string;
12
12
  };
13
13
  onChangeDebounce?: boolean;
14
+ loading?: boolean;
15
+ onLoadingChange?: (loading: boolean) => void;
14
16
  }
15
17
  export declare type WalletPassListRef = {
16
18
  init: (params: MachineCodeListParams, formatList?: (val: WalletPassDataType[]) => WalletPassDataType[]) => void;