@pisell/private-materials 6.4.50 → 6.4.52

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 (115) 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 +145 -153
  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 +5 -5
  11. package/es/components/appointmentBooking/components/Services/index.js +36 -18
  12. package/es/components/appointmentBooking/hooks.js +6 -0
  13. package/es/components/booking/components/footer/index.js +12 -1
  14. package/es/components/booking/editBookingModal/index.js +8 -2
  15. package/es/components/booking/info/service/addService/utils.d.ts +1 -1
  16. package/es/components/booking/info2/service/addService/utils.d.ts +1 -1
  17. package/es/components/booking/locales.d.ts +6 -0
  18. package/es/components/booking/locales.js +12 -0
  19. package/es/components/checkout/PaymentModal.js +70 -62
  20. package/es/components/checkout/components/AmountSummary/index.js +4 -4
  21. package/es/components/checkout/components/CashPaymentModule/index.d.ts +3 -1
  22. package/es/components/checkout/components/CashPaymentModule/index.js +14 -10
  23. package/es/components/eftposPay/linkly/hooks/normal.js +3 -3
  24. package/es/components/eftposPay/linkly/hooks/useTimeQuery.js +60 -17
  25. package/es/components/eftposPay/payo/config.js +10 -10
  26. package/es/components/eftposPay/serve.js +1 -1
  27. package/es/components/index.d.ts +3 -1
  28. package/es/components/index.js +3 -1
  29. package/es/components/pay/toC/PaymentMethods/MWCreditCard/tds2.js +6 -3
  30. package/es/components/pay/toC/PaymentMethods/WalletPass/List/index.d.ts +2 -0
  31. package/es/components/pay/toC/PaymentMethods/WalletPass/index.js +112 -24
  32. package/es/components/pay/toC/PaymentMethods/WalletPass/serve.d.ts +38 -2
  33. package/es/components/pay/toC/PaymentMethods/WalletPass/serve.js +78 -0
  34. package/es/components/pay/toC/PaymentMethods/WalletPass/utils.d.ts +6 -0
  35. package/es/components/pay/toC/PaymentMethods/WalletPass/utils.js +9 -0
  36. package/es/components/pay/toC/utils.js +1 -1
  37. package/es/components/pinModal/hooks.d.ts +7 -0
  38. package/es/components/pinModal/hooks.js +65 -0
  39. package/es/components/pinModal/index.d.ts +4 -0
  40. package/es/components/pinModal/index.js +98 -0
  41. package/es/components/pinModal/index.less +44 -0
  42. package/es/components/pinModal/locales.d.ts +27 -0
  43. package/es/components/pinModal/locales.js +26 -0
  44. package/es/components/pinModal/serve.d.ts +6 -0
  45. package/es/components/pinModal/serve.js +11 -0
  46. package/es/components/pinModal/types.d.ts +0 -0
  47. package/es/components/pinModal/types.js +0 -0
  48. package/es/components/pinVerifyModal/hooks.d.ts +7 -0
  49. package/es/components/pinVerifyModal/hooks.js +80 -0
  50. package/es/components/pinVerifyModal/index.d.ts +5 -0
  51. package/es/components/pinVerifyModal/index.js +218 -0
  52. package/es/components/pinVerifyModal/index.less +92 -0
  53. package/es/components/pinVerifyModal/locales.d.ts +24 -0
  54. package/es/components/pinVerifyModal/locales.js +23 -0
  55. package/es/components/pinVerifyModal/types.d.ts +33 -0
  56. package/es/components/pinVerifyModal/types.js +1 -0
  57. package/es/components/ticketBooking/components/ticketBooking/index.js +56 -10
  58. package/es/components/ticketBooking/components/timeBar/index.js +2 -1
  59. package/es/components/walletList/index.js +20 -2
  60. package/es/index.d.ts +2 -0
  61. package/es/index.js +3 -1
  62. package/lib/components/appointmentBooking/components/Services/index.js +13 -3
  63. package/lib/components/appointmentBooking/hooks.js +6 -0
  64. package/lib/components/booking/components/footer/index.js +15 -2
  65. package/lib/components/booking/editBookingModal/index.js +6 -1
  66. package/lib/components/booking/info/service/addService/utils.d.ts +1 -1
  67. package/lib/components/booking/info2/service/addService/utils.d.ts +1 -1
  68. package/lib/components/booking/locales.d.ts +6 -0
  69. package/lib/components/booking/locales.js +6 -0
  70. package/lib/components/checkout/PaymentModal.js +5 -4
  71. package/lib/components/checkout/components/AmountSummary/index.js +4 -4
  72. package/lib/components/checkout/components/CashPaymentModule/index.d.ts +3 -1
  73. package/lib/components/checkout/components/CashPaymentModule/index.js +6 -3
  74. package/lib/components/eftposPay/linkly/hooks/normal.js +3 -3
  75. package/lib/components/eftposPay/linkly/hooks/useTimeQuery.js +59 -15
  76. package/lib/components/eftposPay/payo/config.js +9 -9
  77. package/lib/components/eftposPay/serve.js +1 -1
  78. package/lib/components/index.d.ts +3 -1
  79. package/lib/components/index.js +6 -0
  80. package/lib/components/pay/toC/PaymentMethods/MWCreditCard/tds2.js +2 -0
  81. package/lib/components/pay/toC/PaymentMethods/WalletPass/List/index.d.ts +2 -0
  82. package/lib/components/pay/toC/PaymentMethods/WalletPass/index.js +84 -36
  83. package/lib/components/pay/toC/PaymentMethods/WalletPass/serve.d.ts +38 -2
  84. package/lib/components/pay/toC/PaymentMethods/WalletPass/serve.js +18 -0
  85. package/lib/components/pay/toC/PaymentMethods/WalletPass/utils.d.ts +6 -0
  86. package/lib/components/pay/toC/PaymentMethods/WalletPass/utils.js +7 -2
  87. package/lib/components/pay/toC/utils.js +1 -1
  88. package/lib/components/pinModal/hooks.d.ts +7 -0
  89. package/lib/components/pinModal/hooks.js +85 -0
  90. package/lib/components/pinModal/index.d.ts +4 -0
  91. package/lib/components/pinModal/index.js +88 -0
  92. package/lib/components/pinModal/index.less +44 -0
  93. package/lib/components/pinModal/locales.d.ts +27 -0
  94. package/lib/components/pinModal/locales.js +50 -0
  95. package/lib/components/pinModal/serve.d.ts +6 -0
  96. package/lib/components/pinModal/serve.js +37 -0
  97. package/lib/components/pinModal/types.d.ts +0 -0
  98. package/lib/components/pinModal/types.js +0 -0
  99. package/lib/components/pinVerifyModal/hooks.d.ts +7 -0
  100. package/lib/components/pinVerifyModal/hooks.js +93 -0
  101. package/lib/components/pinVerifyModal/index.d.ts +5 -0
  102. package/lib/components/pinVerifyModal/index.js +230 -0
  103. package/lib/components/pinVerifyModal/index.less +92 -0
  104. package/lib/components/pinVerifyModal/locales.d.ts +24 -0
  105. package/lib/components/pinVerifyModal/locales.js +47 -0
  106. package/lib/components/pinVerifyModal/types.d.ts +33 -0
  107. package/lib/components/pinVerifyModal/types.js +17 -0
  108. package/lib/components/ticketBooking/components/ticketBooking/index.js +52 -5
  109. package/lib/components/ticketBooking/components/timeBar/index.js +2 -1
  110. package/lib/components/walletList/index.js +19 -2
  111. package/lib/index.d.ts +2 -0
  112. package/lib/index.js +6 -0
  113. package/lowcode/pin-modal/meta.ts +37 -0
  114. package/lowcode/pin-verify-modal/meta.ts +80 -0
  115. package/package.json +4 -4
@@ -13,10 +13,12 @@ export interface CashPaymentModuleProps {
13
13
  roundingDifference: number;
14
14
  }>;
15
15
  balanceDueAmount?: string;
16
+ balanceDueTotalAmount?: string;
16
17
  syncingLock?: boolean;
17
18
  }
18
19
  export declare function CashPaymentModule({ amountSymbol, orderInfo, onPaymentComplete, customAmount, amountButtons, // 按钮列表,默认5个推荐金额
19
20
  disabled, // 禁用状态
20
- roundingFunction, balanceDueAmount, // 剩余支付金额
21
+ roundingFunction, balanceDueAmount, // 当前阶段剩余支付金额(定金或普通支付)
22
+ balanceDueTotalAmount, // 完整订单剩余待付金额
21
23
  syncingLock, }: CashPaymentModuleProps): JSX.Element;
22
24
  export default CashPaymentModule;
@@ -52,7 +52,9 @@ function CashPaymentModule({
52
52
  // 禁用状态
53
53
  roundingFunction,
54
54
  balanceDueAmount = "0",
55
- // 剩余支付金额
55
+ // 当前阶段剩余支付金额(定金或普通支付)
56
+ balanceDueTotalAmount = "0",
57
+ // 完整订单剩余待付金额
56
58
  syncingLock = false
57
59
  // 是否锁定
58
60
  }) {
@@ -71,7 +73,7 @@ function CashPaymentModule({
71
73
  };
72
74
  (0, import_react.useEffect)(() => {
73
75
  handleKeyboardConfirm(customAmount || "");
74
- }, [customAmount, balanceDueAmount]);
76
+ }, [customAmount, balanceDueAmount, orderInfo == null ? void 0 : orderInfo.isDeposit]);
75
77
  const isAmountButtonsDisabled = disabled || Number(customAmount || 0) === 0;
76
78
  const isInputDisabled = disabled || Number(customAmount || 0) === 0;
77
79
  const handleCashPayInternal = () => {
@@ -120,7 +122,8 @@ function CashPaymentModule({
120
122
  } else {
121
123
  const cleanValue = finalValue.replace(/[$\s]/g, "");
122
124
  const numValue = parseFloat(cleanValue);
123
- const balanceDue = parseFloat(balanceDueAmount);
125
+ debugger;
126
+ const balanceDue = parseFloat((orderInfo == null ? void 0 : orderInfo.isDeposit) ? balanceDueTotalAmount || "0" : balanceDueAmount);
124
127
  const shouldApplyRounding = Math.abs(numValue - balanceDue) < 0.01;
125
128
  let finalAmount = numValue;
126
129
  let roundingDiff = 0;
@@ -63,18 +63,18 @@ var useLinklyPayOrRefund = (handleCheck) => {
63
63
  content: [{ key: "response", value: JSON.stringify(res) }]
64
64
  });
65
65
  const status = (_a = res == null ? void 0 : res.data) == null ? void 0 : _a.status;
66
- if (status === 0) {
66
+ if (status == 0) {
67
67
  numRef.current = (_b = res == null ? void 0 : res.data) == null ? void 0 : _b.session_id;
68
68
  dispatch((0, import_store.updateState)({ number: numRef.current }));
69
69
  dispatch((0, import_store.updateCustom)({ actionStatus: import_const2.LinklyActionStatus.Cancel }));
70
70
  setTimeout(() => {
71
71
  var _a2;
72
72
  (_a2 = resultQueryRef.current) == null ? void 0 : _a2.call(resultQueryRef);
73
- });
73
+ }, 300);
74
74
  return;
75
75
  }
76
76
  dispatch((0, import_store.updateCustom)({ actionStatus: import_const2.LinklyActionStatus.Empty }));
77
- if (status === 1) {
77
+ if (status == 1) {
78
78
  (_c = handleLinklySuccessRef.current) == null ? void 0 : _c.call(handleLinklySuccessRef, res);
79
79
  return;
80
80
  }
@@ -1,6 +1,8 @@
1
+ var __create = Object.create;
1
2
  var __defProp = Object.defineProperty;
2
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
4
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
5
7
  var __export = (target, all) => {
6
8
  for (var name in all)
@@ -14,6 +16,14 @@ var __copyProps = (to, from, except, desc) => {
14
16
  }
15
17
  return to;
16
18
  };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
17
27
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
28
 
19
29
  // src/components/eftposPay/linkly/hooks/useTimeQuery.ts
@@ -24,15 +34,16 @@ __export(useTimeQuery_exports, {
24
34
  module.exports = __toCommonJS(useTimeQuery_exports);
25
35
  var import_react = require("react");
26
36
  var import_utils = require("@pisell/utils");
37
+ var import_dayjs = __toESM(require("dayjs"));
27
38
  var import_store = require("../../store");
28
39
  var import_hooks = require("../../hooks");
29
40
  var import_const = require("../../const");
30
41
  var import_const2 = require("../const");
31
- var GlobalTimeout = 1e3 * 60;
42
+ var GlobalTimeout = 1e3 * 60 * 2;
32
43
  var RequestTimeout = 1e3 * 5;
33
44
  var useTimeResultQuery = (api, resultCheck, handleLinklySuccess) => {
34
45
  const dispatch = (0, import_store.useDispatch)();
35
- const { numRef, modeRef, deviceRef } = (0, import_hooks.useStoreRef)();
46
+ const { numRef, modeRef, deviceRef, orderIdRef } = (0, import_hooks.useStoreRef)();
36
47
  const fail = (0, import_hooks.useFail)(0);
37
48
  const failRef = (0, import_react.useRef)(fail);
38
49
  const isPay = modeRef.current === import_const.ModeEnum.Pay || modeRef.current === import_const.ModeEnum.FullPay;
@@ -80,30 +91,44 @@ var useTimeResultQuery = (api, resultCheck, handleLinklySuccess) => {
80
91
  console.log("Success: 全局超时或不需要处理结果,终止查询");
81
92
  return;
82
93
  }
83
- _log("Success" /* Success */, result);
84
94
  isQueryFinishedRef.current = true;
85
95
  const data = (result == null ? void 0 : result.data) || {};
86
- if (data.status === 1) {
96
+ if (data.status == 1) {
87
97
  console.log("交易成功,终止查询");
98
+ (0, import_utils.sendWarningLog)({
99
+ title: `Linkly-${isPay ? "Pay" : "Refund"}-交易成功`,
100
+ content: [{ key: "response", value: JSON.stringify(result) }]
101
+ });
88
102
  reset();
89
103
  handleLinklySuccess(result);
90
104
  return;
91
105
  }
92
- if (data.status !== void 0 && (data == null ? void 0 : data.status) === 0) {
106
+ if ((data == null ? void 0 : data.status) == 0 && (data == null ? void 0 : data.signature_flag) != 1) {
93
107
  console.log("交易状态为0需要继续查询");
108
+ _log("Querying" /* Querying */, result);
94
109
  isQueryFinishedRef.current = false;
95
- _resultQuery();
110
+ setTimeout(() => {
111
+ _resultQuery();
112
+ }, 1500);
96
113
  return;
97
114
  }
98
115
  if (data.status < 0) {
99
116
  console.log("交易失败,终止查询");
117
+ (0, import_utils.sendWarningLog)({
118
+ title: `Linkly-${isPay ? "Pay" : "Refund"}-交易失败`,
119
+ content: [{ key: "response", value: JSON.stringify(result) }]
120
+ });
100
121
  reset();
101
122
  result.code = import_const.PayStatus.Unknown;
102
123
  (_a2 = failRef.current) == null ? void 0 : _a2.call(failRef, result, false);
103
124
  return;
104
125
  }
105
- if (data.signature_flag === 1) {
126
+ if (data.signature_flag == 1) {
106
127
  console.log("交易需要签名,终止查询");
128
+ (0, import_utils.sendWarningLog)({
129
+ title: `Linkly-${isPay ? "Pay" : "Refund"}-交易需要签名`,
130
+ content: [{ key: "response", value: JSON.stringify(result) }]
131
+ });
107
132
  reset();
108
133
  gotoSignature();
109
134
  return;
@@ -120,7 +145,18 @@ var useTimeResultQuery = (api, resultCheck, handleLinklySuccess) => {
120
145
  _log("AbortError" /* AbortError */);
121
146
  console.log("Error: 请求被取消,将继续查询");
122
147
  isQueryFinishedRef.current = false;
123
- _resultQuery();
148
+ setTimeout(() => {
149
+ _resultQuery();
150
+ }, 1500);
151
+ return;
152
+ }
153
+ if (!(error == null ? void 0 : error.code) || `${error.code}` === import_const.PayStatus.Timeout) {
154
+ _log("NetworkError" /* NetworkError */);
155
+ console.log("Error: 网关类报错,将继续查询");
156
+ isQueryFinishedRef.current = false;
157
+ setTimeout(() => {
158
+ _resultQuery();
159
+ }, 1500);
124
160
  return;
125
161
  }
126
162
  _log("Error" /* Error */, error);
@@ -185,23 +221,29 @@ var useTimeResultQuery = (api, resultCheck, handleLinklySuccess) => {
185
221
  session_id: numRef.current
186
222
  };
187
223
  const content = [
188
- { key: "queryId", value: JSON.stringify(queryIdRef.current) },
224
+ {
225
+ key: "description",
226
+ value: JSON.stringify({
227
+ queryId: queryIdRef.current,
228
+ orderId: orderIdRef.current,
229
+ type,
230
+ date: (0, import_dayjs.default)().format("YYYY-MM-DD HH:mm:ss")
231
+ })
232
+ },
189
233
  { key: "params", value: JSON.stringify(params) }
190
234
  ];
191
- if (type === "Success" /* Success */) {
192
- content.push({ key: "response", value: JSON.stringify(res) });
193
- } else if (type === "Error" /* Error */) {
235
+ if (type === "Error" /* Error */) {
194
236
  content.push({ key: "error", value: JSON.stringify(res) });
237
+ } else {
238
+ content.push({ key: "response", value: JSON.stringify(res) });
195
239
  }
196
240
  (0, import_utils.sendWarningLog)({
197
- title: `Linkly-${isPay ? "Pay" : "Refund"}-结果查询--${type}`,
241
+ title: `Linkly-${isPay ? "Pay" : "Refund"}-交易结果轮询`,
198
242
  content
199
243
  });
200
244
  };
201
245
  const run = () => {
202
246
  reset();
203
- console.log("开始查询linkly结果---->>>>>>>");
204
- _log("Start" /* Start */);
205
247
  globalTimeoutIdRef.current = setTimeout(() => {
206
248
  var _a;
207
249
  console.log("全局超时,终止所有重试");
@@ -212,6 +254,8 @@ var useTimeResultQuery = (api, resultCheck, handleLinklySuccess) => {
212
254
  startTimeRef.current = Date.now();
213
255
  isQueryFinishedRef.current = false;
214
256
  queryIdRef.current = (0, import_utils.getUniqueId)();
257
+ console.log("开始查询linkly结果---->>>>>>>");
258
+ _log("Start" /* Start */);
215
259
  return _resultQuery();
216
260
  };
217
261
  return { run, stop: reset };
@@ -148,15 +148,15 @@ var POS = ({
148
148
  const resultPromise = modeRef.current === import_const.ModeEnum.Pay || modeRef.current === import_const.ModeEnum.FullPay ? api.pay(
149
149
  {
150
150
  ...(custom == null ? void 0 : custom.platform) ? {
151
- "operator_id": custom.operator_id,
152
- "operator_type": custom.operator_type,
153
- "platform": custom.platform,
154
- "custom_payment_id": custom.custom_payment_id,
155
- "service_charge": {
156
- "amount": payRef.current.surMoney,
157
- "percentage": payRef.current.surPercentRate
151
+ operator_id: custom.operator_id,
152
+ operator_type: custom.operator_type,
153
+ platform: custom.platform,
154
+ custom_payment_id: custom.custom_payment_id,
155
+ service_charge: {
156
+ amount: payRef.current.surMoney,
157
+ percentage: payRef.current.surPercentRate
158
158
  },
159
- "original_amount": payRef.current.amount
159
+ original_amount: payRef.current.amount
160
160
  } : {},
161
161
  order_id: orderIdRef.current,
162
162
  amount: payRef.current.total,
@@ -215,7 +215,7 @@ var POS = ({
215
215
  if (unloadRef.current || !netRef.current) {
216
216
  return;
217
217
  }
218
- if (err && `${err.code}` === import_const.PayStatus.Timeout) {
218
+ if (!(err == null ? void 0 : err.code) || `${err.code}` === import_const.PayStatus.Timeout) {
219
219
  checkApi();
220
220
  return;
221
221
  }
@@ -52,7 +52,7 @@ var payData = async (params, config) => import_utils.request.getRequest().post("
52
52
  var refundData = async (params, config) => import_utils.request.getRequest().post("/shop/pay/card-reader/refund", params, config);
53
53
  var addTransaction = async (params, config) => import_utils.request.getRequest().post("/shop/pay/card-reader/transaction", params, config);
54
54
  var editTransaction = async (id, params, config) => import_utils.request.getRequest().put(`/shop/pay/card-reader/transaction/${id}`, params, config);
55
- var linklyPayQuery = async (params, config) => import_utils.request.getRequest().get("/shop/shop/linkly/pay/query", params, config);
55
+ var linklyPayQuery = async (params, config) => import_utils.request.getRequest().get("/shop/linkly/pay/query", params, config);
56
56
  var linklyRefundQuery = async (params, config) => import_utils.request.getRequest().get("/shop/linkly/refund/query", params, config);
57
57
  // Annotate the CommonJS export names for ESM import in node:
58
58
  0 && (module.exports = {
@@ -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, };
@@ -36,6 +36,8 @@ __export(components_exports, {
36
36
  BookingNotes: () => import_notes.default,
37
37
  EditBookingModal: () => import_editBookingModal.default,
38
38
  Login: () => import_login.default,
39
+ PinModal: () => import_pinModal.default,
40
+ PinVerifyModal: () => import_pinVerifyModal.default,
39
41
  PisellSelectCustomerModal: () => import_pisellSelectCustomerModal.default,
40
42
  ProductExtension: () => import_productExtension.default,
41
43
  RuleSetting: () => import_ruleSetting.default,
@@ -69,6 +71,8 @@ var import_pisellSelectCustomerModal = __toESM(require("./pisellSelectCustomerMo
69
71
  var import_subTotal = __toESM(require("./subTotal"));
70
72
  var import_editBookingModal = __toESM(require("./booking/editBookingModal"));
71
73
  var import_stepController = __toESM(require("./stepController"));
74
+ var import_pinModal = __toESM(require("./pinModal"));
75
+ var import_pinVerifyModal = __toESM(require("./pinVerifyModal"));
72
76
  // Annotate the CommonJS export names for ESM import in node:
73
77
  0 && (module.exports = {
74
78
  Booking,
@@ -78,6 +82,8 @@ var import_stepController = __toESM(require("./stepController"));
78
82
  BookingNotes,
79
83
  EditBookingModal,
80
84
  Login,
85
+ PinModal,
86
+ PinVerifyModal,
81
87
  PisellSelectCustomerModal,
82
88
  ProductExtension,
83
89
  RuleSetting,
@@ -171,6 +171,7 @@ var createThreeDSMethodIframe = async (threeDSMethodData, callback) => {
171
171
  return defaultReturnParams;
172
172
  }
173
173
  const displayBox = document.getElementById("threeds-container");
174
+ displayBox.innerHTML = "";
174
175
  let iframe = document.createElement("iframe");
175
176
  iframe.classList.add("hidden_TDS_From");
176
177
  iframe.name = "threeDSMethodIframe";
@@ -286,6 +287,7 @@ var checkTDSAuth = async (step2, step3, callback) => {
286
287
  };
287
288
  var createChallengeIframe = (challengeData, callback) => {
288
289
  const displayBox = document.getElementById("threeds-container");
290
+ displayBox.innerHTML = "";
289
291
  let iframe = document.createElement("iframe");
290
292
  iframe.classList.add("tdsv2challengeIframe");
291
293
  iframe.name = "challengeIframe";
@@ -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;
@@ -37,16 +37,20 @@ var import_materials = require("@pisell/materials");
37
37
  var import_utils = require("@pisell/utils");
38
38
  var import_ahooks = require("ahooks");
39
39
  var import_icons = require("@ant-design/icons");
40
+ var import_pinVerifyModal = __toESM(require("../../../../pinVerifyModal"));
40
41
  var import_MultiModeSearch = __toESM(require("./MultiModeSearch"));
41
42
  var import_List = __toESM(require("./List"));
42
43
  var import_serve = require("./serve");
43
44
  var import_utils2 = require("./utils");
44
45
  var import_utils3 = require("../../utils");
45
46
  var import_index = require("./index.less");
47
+ var import_useEngineContext = __toESM(require("../../../../../hooks/useEngineContext"));
46
48
  var { Amount } = import_materials.PisellText;
47
49
  var WalletPass = (0, import_react.forwardRef)((props, ref) => {
48
- var _a;
50
+ var _a, _b, _c, _d, _e;
49
51
  const { onWalletPassChange, walletPass, walletSetting } = props;
52
+ const context = (0, import_useEngineContext.default)();
53
+ const isWalletCode = (_d = (_c = (_b = (_a = context == null ? void 0 : context.appHelper) == null ? void 0 : _a.utils) == null ? void 0 : _b.businessUtils) == null ? void 0 : _c.getAppByModal) == null ? void 0 : _d.call(_c, "wallet");
50
54
  const [currentWalletPass, setCurrentWalletPass] = (0, import_react.useState)(walletPass);
51
55
  const [loading, setLoading] = (0, import_react.useState)(false);
52
56
  const [open, setOpen] = (0, import_react.useState)(false);
@@ -60,7 +64,8 @@ var WalletPass = (0, import_react.forwardRef)((props, ref) => {
60
64
  });
61
65
  const isAutoSelect = (0, import_react.useRef)(false);
62
66
  const listRef = (0, import_react.useRef)(null);
63
- const searchValRef = (0, import_react.useRef)("");
67
+ const searchValRef = (0, import_react.useRef)(null);
68
+ const pinVerifyModalRef = (0, import_react.useRef)(null);
64
69
  const { cards: walletPassSelectCards, amount } = currentWalletPass || {};
65
70
  const [currentCustomerWalletPass, otherCustomerWalletPass] = (0, import_react.useMemo)(() => {
66
71
  const current = [];
@@ -98,9 +103,9 @@ var WalletPass = (0, import_react.forwardRef)((props, ref) => {
98
103
  return codes;
99
104
  }, [addList, selectValue]);
100
105
  const refreshList = (0, import_ahooks.useMemoizedFn)(() => {
101
- var _a2, _b;
106
+ var _a2, _b2;
102
107
  if ((order == null ? void 0 : order.order_id) && (order == null ? void 0 : order.customer_id)) {
103
- (_b = listRef.current) == null ? void 0 : _b.init(
108
+ (_b2 = listRef.current) == null ? void 0 : _b2.init(
104
109
  {
105
110
  order_id: order.order_id,
106
111
  available: 2,
@@ -146,52 +151,86 @@ var WalletPass = (0, import_react.forwardRef)((props, ref) => {
146
151
  refreshList();
147
152
  });
148
153
  };
149
- const searchList = async (val, isSelectChange) => {
154
+ const searchList = async ({ code, customer_pin_key }, isSelectChange) => {
150
155
  var _a2;
151
156
  if (!(order == null ? void 0 : order.order_id)) return;
152
- const result = await (0, import_serve.searchMachineCodeList)({
153
- order_id: order.order_id,
154
- code: val,
155
- prepare_payments,
156
- filter_prepare_wallet_pass: 1,
157
- sale_channel: ((_a2 = order._order) == null ? void 0 : _a2.sale_channel) || "online-store"
158
- });
159
- if (!result) {
160
- if (!isSelectChange) {
161
- (0, import_materials.PisellToast)({
162
- content: import_utils.locales.getText("tocPay.text.walletSearchEmpty")
163
- });
157
+ setLoading(true);
158
+ try {
159
+ const result = await (0, import_serve.searchMachineCodeList)({
160
+ order_id: order.order_id,
161
+ code,
162
+ prepare_payments,
163
+ // filter_prepare_wallet_pass: 1,
164
+ sale_channel: ((_a2 = order._order) == null ? void 0 : _a2.sale_channel) || "online-store",
165
+ customer_pin_key
166
+ });
167
+ if (!result) {
168
+ if (!isSelectChange) {
169
+ (0, import_materials.PisellToast)({
170
+ content: import_utils.locales.getText("tocPay.text.walletSearchEmpty")
171
+ });
172
+ }
173
+ return;
174
+ }
175
+ if (isSelectChange && !searchValRef.current) {
176
+ return;
164
177
  }
165
- return;
178
+ setSearchData(
179
+ (0, import_utils2.formatMachineCodeServer2CardList)(
180
+ [...searchSelectData.details, ...result],
181
+ searchSelectData.ids
182
+ )
183
+ );
184
+ if (result.length) {
185
+ if (result.length === 1 && result[0].unified_available_status && isAutoSelect.current) {
186
+ setSearchSelectData({
187
+ ids: [result[0].id],
188
+ details: result
189
+ });
190
+ }
191
+ setSearchOpen(true);
192
+ searchValRef.current = { code, customer_pin_key };
193
+ }
194
+ } finally {
195
+ setLoading(false);
166
196
  }
167
- setSearchData(
168
- (0, import_utils2.formatMachineCodeServer2CardList)(
169
- [...searchSelectData.details, ...result],
170
- searchSelectData.ids
171
- )
172
- );
173
- if (result.length) {
174
- if (result.length === 1 && result[0].unified_available_status && isAutoSelect.current) {
175
- setSearchSelectData({
176
- ids: [result[0].id],
177
- details: result
178
- });
197
+ };
198
+ const searchWalletCodeFn = async (val) => {
199
+ var _a2;
200
+ setLoading(true);
201
+ try {
202
+ const result = await (0, import_serve.searchWalletCode)({ code: val, with_customer: 1 });
203
+ console.log(result, "result");
204
+ if (!result) {
205
+ searchList({ code: val });
206
+ return;
179
207
  }
180
- setSearchOpen(true);
181
- searchValRef.current = val;
208
+ (_a2 = pinVerifyModalRef.current) == null ? void 0 : _a2.open({
209
+ wallet_code: result.code,
210
+ wallet_detail_id: result.id,
211
+ failed_count: result.failed_count,
212
+ check_max_count: result.check_max_count,
213
+ customer: result.customer
214
+ });
215
+ } finally {
216
+ setLoading(false);
182
217
  }
183
218
  };
184
219
  const handleSearch = (0, import_ahooks.useMemoizedFn)((val) => {
185
220
  if (!val || searchOpen) return;
186
221
  isAutoSelect.current = true;
187
- searchList(val);
222
+ if ((0, import_utils2.getIsWalletCode)(val) && isWalletCode) {
223
+ searchWalletCodeFn(val);
224
+ } else {
225
+ searchList({ code: val });
226
+ }
188
227
  });
189
228
  (0, import_react.useImperativeHandle)(ref, () => ({
190
229
  init
191
230
  }));
192
231
  const handleSearchModalClose = () => {
193
232
  setSearchOpen(false);
194
- searchValRef.current = "";
233
+ searchValRef.current = null;
195
234
  setSearchSelectData({
196
235
  ids: [],
197
236
  details: []
@@ -309,7 +348,7 @@ var WalletPass = (0, import_react.forwardRef)((props, ref) => {
309
348
  okText: import_utils.locales.getText("tocPay.text.select"),
310
349
  onOk: handleSelectOk,
311
350
  okButtonProps: {
312
- disabled: ((_a = searchSelectData.ids) == null ? void 0 : _a.length) === 0
351
+ disabled: ((_e = searchSelectData.ids) == null ? void 0 : _e.length) === 0
313
352
  }
314
353
  },
315
354
  /* @__PURE__ */ import_react.default.createElement("div", { className: "", style: { marginTop: 24 } }, /* @__PURE__ */ import_react.default.createElement(
@@ -318,9 +357,18 @@ var WalletPass = (0, import_react.forwardRef)((props, ref) => {
318
357
  walletSetting,
319
358
  data: searchData,
320
359
  value: searchSelectData.ids,
321
- onChange: handleAddChange
360
+ onChange: handleAddChange,
361
+ loading
322
362
  }
323
363
  ))
364
+ ), /* @__PURE__ */ import_react.default.createElement(
365
+ import_pinVerifyModal.default,
366
+ {
367
+ ref: pinVerifyModalRef,
368
+ onSuccess: (params) => {
369
+ searchList({ customer_pin_key: params == null ? void 0 : params.customer_pin_key });
370
+ }
371
+ }
324
372
  ));
325
373
  });
326
374
  var WalletPass_default = (0, import_react.memo)(WalletPass);
@@ -84,14 +84,15 @@ export declare const getRecommendMachineCodeList: (order_id: number) => Promise<
84
84
  */
85
85
  export declare const searchMachineCodeList: (params: {
86
86
  order_id: number | string;
87
- code: string;
87
+ code?: string;
88
88
  sale_channel: string;
89
89
  prepare_payments: {
90
90
  voucher_id: number;
91
91
  amount: number;
92
92
  tag: string;
93
93
  }[];
94
- filter_prepare_wallet_pass: 1 | 0;
94
+ filter_prepare_wallet_pass?: 1 | 0;
95
+ customer_pin_key?: string;
95
96
  }) => Promise<WalletPassDataType[]>;
96
97
  /**
97
98
  * walletpass支付
@@ -110,4 +111,39 @@ export declare const walletPassPay: (params: {
110
111
  };
111
112
  }[];
112
113
  }) => Promise<WalletPassDataType[]>;
114
+ /**
115
+ * 搜索wallet code
116
+ */
117
+ export declare const searchWalletCode: (params: {
118
+ code: string;
119
+ with_customer: 1 | 0;
120
+ }) => Promise<{
121
+ code: string;
122
+ id: number;
123
+ status: 'enable' | 'disable' | 'expired';
124
+ expired_at: string;
125
+ customer: Record<string, any>;
126
+ check_max_count: number;
127
+ failed_count: number;
128
+ }>;
129
+ /**
130
+ * 验证pin码
131
+ */
132
+ export declare const verifyPinCode: (params: {
133
+ wallet_detail_id: number;
134
+ pin: string;
135
+ }) => Promise<{
136
+ status: number;
137
+ customer_id: number;
138
+ msg: string;
139
+ customer_pin_key: string;
140
+ }>;
141
+ /**
142
+ * 获取pin码
143
+ */
144
+ export declare const getPin: (params: {
145
+ wallet_detail_id: number;
146
+ }) => Promise<{
147
+ pin: string;
148
+ }>;
113
149
  export {};
@@ -20,8 +20,11 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  var serve_exports = {};
21
21
  __export(serve_exports, {
22
22
  getMachineCodeList: () => getMachineCodeList,
23
+ getPin: () => getPin,
23
24
  getRecommendMachineCodeList: () => getRecommendMachineCodeList,
24
25
  searchMachineCodeList: () => searchMachineCodeList,
26
+ searchWalletCode: () => searchWalletCode,
27
+ verifyPinCode: () => verifyPinCode,
25
28
  walletPassPay: () => walletPassPay
26
29
  });
27
30
  module.exports = __toCommonJS(serve_exports);
@@ -45,10 +48,25 @@ var walletPassPay = async (params) => {
45
48
  const { data } = await import_utils.request.getRequest().post(`/h5/pay/order/wallet-pass-pay/${order_id}`, others);
46
49
  return data;
47
50
  };
51
+ var searchWalletCode = async (params) => {
52
+ const { data } = await import_utils.request.getRequest().post(`/h5/wallet/detail/search`, params);
53
+ return data;
54
+ };
55
+ var verifyPinCode = async (params) => {
56
+ const { data } = await import_utils.request.getRequest().post(`/h5/wallet/detail/pin/validate`, params);
57
+ return data;
58
+ };
59
+ var getPin = async (params) => {
60
+ const { data } = await import_utils.request.getRequest().get(`/h5/wallet/detail/pin`, params);
61
+ return data;
62
+ };
48
63
  // Annotate the CommonJS export names for ESM import in node:
49
64
  0 && (module.exports = {
50
65
  getMachineCodeList,
66
+ getPin,
51
67
  getRecommendMachineCodeList,
52
68
  searchMachineCodeList,
69
+ searchWalletCode,
70
+ verifyPinCode,
53
71
  walletPassPay
54
72
  });
@@ -1,3 +1,9 @@
1
1
  import { WalletPassDataType } from './serve';
2
2
  export declare const formatMachineCodeServer2CardList: (data: WalletPassDataType[], selectId?: number[]) => any;
3
3
  export declare const getDataByIds: (arr: any[], ids: number[]) => any[];
4
+ /**
5
+ * 判断是否是wallet code
6
+ * @param val
7
+ * @returns
8
+ */
9
+ export declare const getIsWalletCode: (val: string) => boolean;
@@ -20,7 +20,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  var utils_exports = {};
21
21
  __export(utils_exports, {
22
22
  formatMachineCodeServer2CardList: () => formatMachineCodeServer2CardList,
23
- getDataByIds: () => getDataByIds
23
+ getDataByIds: () => getDataByIds,
24
+ getIsWalletCode: () => getIsWalletCode
24
25
  });
25
26
  module.exports = __toCommonJS(utils_exports);
26
27
  var import_utils = require("@pisell/utils");
@@ -64,8 +65,12 @@ var formatMachineCodeServer2CardList = (data, selectId = []) => {
64
65
  var getDataByIds = (arr, ids) => {
65
66
  return arr.filter((item) => ids.includes(item.id));
66
67
  };
68
+ var getIsWalletCode = (val) => {
69
+ return val.startsWith("WL");
70
+ };
67
71
  // Annotate the CommonJS export names for ESM import in node:
68
72
  0 && (module.exports = {
69
73
  formatMachineCodeServer2CardList,
70
- getDataByIds
74
+ getDataByIds,
75
+ getIsWalletCode
71
76
  });
@@ -49,7 +49,7 @@ var formatWalletPassParams = (payGroup) => {
49
49
  const payments = (walletPass == null ? void 0 : walletPass.cards.map((item) => {
50
50
  return {
51
51
  amount: getAvailableMaxAmount(item),
52
- wallet_pass_use_value: item.available_max_par_value,
52
+ wallet_pass_use_value: item.recommended_usage_par_value,
53
53
  voucher_id: item.id,
54
54
  tag: item.tag,
55
55
  wallet_pass_usage_unit: item.wallet_pass_usage_unit