@pisell/private-materials 6.2.48 → 6.2.50

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 (170) 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 +7 -7
  7. package/build/lowcode/render/default/view.css +1 -1
  8. package/build/lowcode/render/default/view.js +7 -7
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +7 -7
  11. package/es/components/appointmentBooking/components/ConfirmInformation/index.js +27 -3
  12. package/es/components/appointmentBooking/components/Content/index.js +3 -3
  13. package/es/components/appointmentBooking/components/Services/index.js +36 -18
  14. package/es/components/appointmentBooking/components/Voucher/index.js +6 -5
  15. package/es/components/appointmentBooking/hooks.js +10 -2
  16. package/es/components/appointmentBooking/index.js +10 -0
  17. package/es/components/booking/addons/model.d.ts +1 -10
  18. package/es/components/booking/components/footer/index.js +12 -1
  19. package/es/components/booking/editBookingModal/index.js +8 -2
  20. package/es/components/booking/forms/model.d.ts +1 -10
  21. package/es/components/booking/info/model.d.ts +1 -10
  22. package/es/components/booking/info/service/addService/utils.d.ts +1 -1
  23. package/es/components/booking/info2/service/addService/utils.d.ts +1 -1
  24. package/es/components/booking/locales.d.ts +6 -0
  25. package/es/components/booking/locales.js +21 -9
  26. package/es/components/booking/model.d.ts +1 -9
  27. package/es/components/booking/notes/model.d.ts +1 -10
  28. package/es/components/booking/payments/model.d.ts +1 -10
  29. package/es/components/eftposPay/hooks.d.ts +1 -1
  30. package/es/components/eftposPay/linkly/hooks/normal.js +3 -3
  31. package/es/components/eftposPay/linkly/hooks/useTimeQuery.js +25 -4
  32. package/es/components/eftposPay/store/index.d.ts +2 -2
  33. package/es/components/eventBooking/components/Provider/Cart/ContinueButton/index.js +34 -8
  34. package/es/components/index.d.ts +3 -1
  35. package/es/components/index.js +3 -1
  36. package/es/components/pay/toC/PaymentMethods/MWCreditCard/tds2.js +6 -3
  37. package/es/components/pay/toC/PaymentMethods/WalletPass/List/index.d.ts +2 -0
  38. package/es/components/pay/toC/PaymentMethods/WalletPass/index.js +112 -24
  39. package/es/components/pay/toC/PaymentMethods/WalletPass/serve.d.ts +38 -2
  40. package/es/components/pay/toC/PaymentMethods/WalletPass/serve.js +78 -0
  41. package/es/components/pay/toC/PaymentMethods/WalletPass/utils.d.ts +6 -0
  42. package/es/components/pay/toC/PaymentMethods/WalletPass/utils.js +9 -0
  43. package/es/components/pay/toC/model.d.ts +1 -9
  44. package/es/components/pay/toC/utils.js +1 -1
  45. package/es/components/pinModal/hooks.d.ts +7 -0
  46. package/es/components/pinModal/hooks.js +65 -0
  47. package/es/components/pinModal/index.d.ts +4 -0
  48. package/es/components/pinModal/index.js +98 -0
  49. package/es/components/pinModal/index.less +44 -0
  50. package/es/components/pinModal/locales.d.ts +27 -0
  51. package/es/components/pinModal/locales.js +26 -0
  52. package/es/components/pinModal/serve.d.ts +6 -0
  53. package/es/components/pinModal/serve.js +11 -0
  54. package/es/components/pinModal/types.d.ts +0 -0
  55. package/es/components/pinModal/types.js +0 -0
  56. package/es/components/pinVerifyModal/hooks.d.ts +7 -0
  57. package/es/components/pinVerifyModal/hooks.js +80 -0
  58. package/es/components/pinVerifyModal/index.d.ts +5 -0
  59. package/es/components/pinVerifyModal/index.js +218 -0
  60. package/es/components/pinVerifyModal/index.less +92 -0
  61. package/es/components/pinVerifyModal/locales.d.ts +24 -0
  62. package/es/components/pinVerifyModal/locales.js +23 -0
  63. package/es/components/pinVerifyModal/types.d.ts +33 -0
  64. package/es/components/pinVerifyModal/types.js +1 -0
  65. package/es/components/ruleSetting/locales.js +3 -3
  66. package/es/components/schedules/model.d.ts +1 -9
  67. package/es/components/ticketBooking/components/ticketBooking/index.js +58 -10
  68. package/es/components/ticketBooking/components/timeBar/index.js +2 -1
  69. package/es/components/ticketBooking/utils/index.d.ts +1 -1
  70. package/es/components/wallet/Detail/index.js +251 -63
  71. package/es/components/wallet/Detail/locales.d.ts +51 -0
  72. package/es/components/wallet/Detail/locales.js +57 -3
  73. package/es/components/wallet/Detail/model.d.ts +1 -13
  74. package/es/components/wallet/Detail/serve.js +5 -1
  75. package/es/components/wallet/DiscountCard/model.d.ts +1 -14
  76. package/es/components/wallet/PointCard/model.d.ts +1 -13
  77. package/es/components/wallet/RechargeableCard/model.d.ts +1 -29
  78. package/es/components/wallet/Voucher/model.d.ts +1 -13
  79. package/es/components/wallet/components/UsageRules/index.d.ts +23 -0
  80. package/es/components/wallet/components/UsageRules/index.js +147 -0
  81. package/es/components/wallet/components/UsageRules/index.less +157 -0
  82. package/es/components/wallet/components/WalletCard.js +8 -3
  83. package/es/components/wallet/components/index.d.ts +1 -0
  84. package/es/components/wallet/components/index.js +2 -1
  85. package/es/components/wallet/model.d.ts +1 -9
  86. package/es/components/walletList/index.js +20 -2
  87. package/es/index.d.ts +2 -0
  88. package/es/index.js +3 -1
  89. package/lib/components/appointmentBooking/components/ConfirmInformation/index.js +22 -2
  90. package/lib/components/appointmentBooking/components/Content/index.js +2 -2
  91. package/lib/components/appointmentBooking/components/Services/index.js +13 -3
  92. package/lib/components/appointmentBooking/components/Voucher/index.js +2 -1
  93. package/lib/components/appointmentBooking/hooks.js +10 -2
  94. package/lib/components/appointmentBooking/index.js +6 -0
  95. package/lib/components/booking/addons/model.d.ts +1 -10
  96. package/lib/components/booking/components/footer/index.js +15 -2
  97. package/lib/components/booking/components/voucher/index.js +1 -3
  98. package/lib/components/booking/editBookingModal/index.js +6 -1
  99. package/lib/components/booking/forms/model.d.ts +1 -10
  100. package/lib/components/booking/info/model.d.ts +1 -10
  101. package/lib/components/booking/info/service/addService/utils.d.ts +1 -1
  102. package/lib/components/booking/info2/service/addService/utils.d.ts +1 -1
  103. package/lib/components/booking/locales.d.ts +6 -0
  104. package/lib/components/booking/locales.js +15 -9
  105. package/lib/components/booking/model.d.ts +1 -9
  106. package/lib/components/booking/notes/model.d.ts +1 -10
  107. package/lib/components/booking/payments/model.d.ts +1 -10
  108. package/lib/components/eftposPay/hooks.d.ts +1 -1
  109. package/lib/components/eftposPay/linkly/hooks/normal.js +3 -3
  110. package/lib/components/eftposPay/linkly/hooks/useTimeQuery.js +16 -4
  111. package/lib/components/eftposPay/store/index.d.ts +2 -2
  112. package/lib/components/eventBooking/components/Provider/Cart/ContinueButton/index.js +30 -8
  113. package/lib/components/index.d.ts +3 -1
  114. package/lib/components/index.js +6 -0
  115. package/lib/components/pay/toC/PaymentMethods/MWCreditCard/tds2.js +2 -0
  116. package/lib/components/pay/toC/PaymentMethods/WalletPass/List/index.d.ts +2 -0
  117. package/lib/components/pay/toC/PaymentMethods/WalletPass/index.js +84 -36
  118. package/lib/components/pay/toC/PaymentMethods/WalletPass/serve.d.ts +38 -2
  119. package/lib/components/pay/toC/PaymentMethods/WalletPass/serve.js +18 -0
  120. package/lib/components/pay/toC/PaymentMethods/WalletPass/utils.d.ts +6 -0
  121. package/lib/components/pay/toC/PaymentMethods/WalletPass/utils.js +7 -2
  122. package/lib/components/pay/toC/model.d.ts +1 -9
  123. package/lib/components/pay/toC/utils.js +1 -1
  124. package/lib/components/pinModal/hooks.d.ts +7 -0
  125. package/lib/components/pinModal/hooks.js +85 -0
  126. package/lib/components/pinModal/index.d.ts +4 -0
  127. package/lib/components/pinModal/index.js +88 -0
  128. package/lib/components/pinModal/index.less +44 -0
  129. package/lib/components/pinModal/locales.d.ts +27 -0
  130. package/lib/components/pinModal/locales.js +50 -0
  131. package/lib/components/pinModal/serve.d.ts +6 -0
  132. package/lib/components/pinModal/serve.js +37 -0
  133. package/lib/components/pinModal/types.d.ts +0 -0
  134. package/lib/components/pinModal/types.js +0 -0
  135. package/lib/components/pinVerifyModal/hooks.d.ts +7 -0
  136. package/lib/components/pinVerifyModal/hooks.js +93 -0
  137. package/lib/components/pinVerifyModal/index.d.ts +5 -0
  138. package/lib/components/pinVerifyModal/index.js +230 -0
  139. package/lib/components/pinVerifyModal/index.less +92 -0
  140. package/lib/components/pinVerifyModal/locales.d.ts +24 -0
  141. package/lib/components/pinVerifyModal/locales.js +47 -0
  142. package/lib/components/pinVerifyModal/types.d.ts +33 -0
  143. package/lib/components/pinVerifyModal/types.js +17 -0
  144. package/lib/components/ruleSetting/locales.js +3 -3
  145. package/lib/components/schedules/model.d.ts +1 -9
  146. package/lib/components/ticketBooking/components/ticketBooking/index.js +50 -6
  147. package/lib/components/ticketBooking/components/timeBar/index.js +2 -1
  148. package/lib/components/ticketBooking/utils/index.d.ts +1 -1
  149. package/lib/components/wallet/Detail/index.js +140 -8
  150. package/lib/components/wallet/Detail/locales.d.ts +51 -0
  151. package/lib/components/wallet/Detail/locales.js +57 -3
  152. package/lib/components/wallet/Detail/model.d.ts +1 -13
  153. package/lib/components/wallet/Detail/serve.js +6 -1
  154. package/lib/components/wallet/DiscountCard/model.d.ts +1 -14
  155. package/lib/components/wallet/PointCard/model.d.ts +1 -13
  156. package/lib/components/wallet/RechargeableCard/model.d.ts +1 -29
  157. package/lib/components/wallet/Voucher/model.d.ts +1 -13
  158. package/lib/components/wallet/components/UsageRules/index.d.ts +23 -0
  159. package/lib/components/wallet/components/UsageRules/index.js +113 -0
  160. package/lib/components/wallet/components/UsageRules/index.less +157 -0
  161. package/lib/components/wallet/components/WalletCard.js +3 -1
  162. package/lib/components/wallet/components/index.d.ts +1 -0
  163. package/lib/components/wallet/components/index.js +3 -0
  164. package/lib/components/wallet/model.d.ts +1 -9
  165. package/lib/components/walletList/index.js +19 -2
  166. package/lib/index.d.ts +2 -0
  167. package/lib/index.js +6 -0
  168. package/lowcode/pin-modal/meta.ts +37 -0
  169. package/lowcode/pin-verify-modal/meta.ts +80 -0
  170. package/package.json +3 -3
@@ -86,15 +86,22 @@ export var useTimeResultQuery = function useTimeResultQuery(api, resultCheck, ha
86
86
  isQueryFinishedRef.current = true;
87
87
  var data = (result === null || result === void 0 ? void 0 : result.data) || {};
88
88
  // 交易成功,终止查询
89
- if (data.status === 1) {
89
+ if (data.status == 1) {
90
90
  console.log('交易成功,终止查询');
91
+ sendWarningLog({
92
+ title: "Linkly-".concat(isPay ? 'Pay' : 'Refund', "-\u4EA4\u6613\u6210\u529F"),
93
+ content: [{
94
+ key: 'response',
95
+ value: JSON.stringify(result)
96
+ }]
97
+ });
91
98
  reset();
92
99
  handleLinklySuccess(result);
93
100
  return;
94
101
  }
95
102
 
96
103
  // 交易状态为0,且不需要签名,则继续查询
97
- if (data.status !== undefined && (data === null || data === void 0 ? void 0 : data.status) === 0) {
104
+ if ((data === null || data === void 0 ? void 0 : data.status) == 0 && (data === null || data === void 0 ? void 0 : data.signature_flag) != 1) {
98
105
  console.log('交易状态为0需要继续查询');
99
106
  isQueryFinishedRef.current = false;
100
107
  _resultQuery();
@@ -105,6 +112,13 @@ export var useTimeResultQuery = function useTimeResultQuery(api, resultCheck, ha
105
112
  if (data.status < 0) {
106
113
  var _failRef$current;
107
114
  console.log('交易失败,终止查询');
115
+ sendWarningLog({
116
+ title: "Linkly-".concat(isPay ? 'Pay' : 'Refund', "-\u4EA4\u6613\u5931\u8D25"),
117
+ content: [{
118
+ key: 'response',
119
+ value: JSON.stringify(result)
120
+ }]
121
+ });
108
122
  reset();
109
123
  // 交易失败,code码转换为支付失败code码
110
124
  result.code = PayStatus.Unknown;
@@ -113,8 +127,15 @@ export var useTimeResultQuery = function useTimeResultQuery(api, resultCheck, ha
113
127
  }
114
128
 
115
129
  // 需要签名
116
- if (data.signature_flag === 1) {
130
+ if (data.signature_flag == 1) {
117
131
  console.log('交易需要签名,终止查询');
132
+ sendWarningLog({
133
+ title: "Linkly-".concat(isPay ? 'Pay' : 'Refund', "-\u4EA4\u6613\u9700\u8981\u7B7E\u540D"),
134
+ content: [{
135
+ key: 'response',
136
+ value: JSON.stringify(result)
137
+ }]
138
+ });
118
139
  reset();
119
140
  gotoSignature();
120
141
  return;
@@ -240,7 +261,7 @@ export var useTimeResultQuery = function useTimeResultQuery(api, resultCheck, ha
240
261
  });
241
262
  }
242
263
  sendWarningLog({
243
- title: "Linkly-".concat(isPay ? 'Pay' : 'Refund', "-\u7ED3\u679C\u67E5\u8BE2--").concat(type),
264
+ title: "Linkly-".concat(isPay ? 'Pay' : 'Refund', "-\u4EA4\u6613\u7ED3\u679C\u8F6E\u8BE2"),
244
265
  content: content
245
266
  });
246
267
  };
@@ -297,8 +297,8 @@ export declare const backUpFree: (payload: Partial<State>) => {
297
297
  amount?: string | number | undefined;
298
298
  mode?: "refund" | "pay" | "fullPay" | "query" | undefined;
299
299
  order_id?: string | number | undefined;
300
- eftpos?: "stripe" | "payo" | "tyro" | "windcave" | "linkly" | undefined;
301
- action?: "amount" | "pay" | "deviceList" | undefined;
300
+ eftpos?: "payo" | "tyro" | "windcave" | "stripe" | "linkly" | undefined;
301
+ action?: "pay" | "amount" | "deviceList" | undefined;
302
302
  key?: number | undefined;
303
303
  step?: number | undefined;
304
304
  title?: string | undefined;
@@ -13,7 +13,7 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
13
13
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
14
14
  function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
15
15
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
16
- import React, { useMemo, useState } from 'react';
16
+ import React, { useEffect, useMemo, useState, useRef } from 'react';
17
17
  import { locales } from '@pisell/utils';
18
18
  import { Button, PisellToast } from '@pisell/materials';
19
19
  import { useCart, useHolder, useStep, useCheckout, useSales, useCustomer, useSummary } from "../../../../../Sales";
@@ -26,7 +26,9 @@ import useEngineContext from "../../../../../../hooks/useEngineContext";
26
26
  import "./index.less";
27
27
  import { Toast } from "../../../../../appointmentBooking/utils";
28
28
  var ContinueButton = function ContinueButton() {
29
- var _context$appHelper, _cartData$cartItems;
29
+ var _context$appHelper, _context$appHelper2, _context$appHelper3, _cartData$cartItems;
30
+ // 用于跟踪是否已经订阅了事件,避免重复订阅
31
+ var hasSubscribedRef = useRef(false);
30
32
  var _useSales = useSales(),
31
33
  data = _useSales.data;
32
34
  var _useHolder = useHolder(),
@@ -71,7 +73,10 @@ var ContinueButton = function ContinueButton() {
71
73
  setData = _useSales2.setData,
72
74
  removeSessionStorage = _useSales2.removeSessionStorage;
73
75
  var context = useEngineContext();
74
- var _ref = ((_context$appHelper = context.appHelper) === null || _context$appHelper === void 0 ? void 0 : _context$appHelper.utils) || {},
76
+ var config = (context === null || context === void 0 || (_context$appHelper = context.appHelper) === null || _context$appHelper === void 0 || (_context$appHelper = _context$appHelper.constants) === null || _context$appHelper === void 0 ? void 0 : _context$appHelper.config) || {};
77
+ var utils = (context === null || context === void 0 || (_context$appHelper2 = context.appHelper) === null || _context$appHelper2 === void 0 ? void 0 : _context$appHelper2.utils) || {};
78
+ var pubsub = context.appHelper.utils.pubsub;
79
+ var _ref = ((_context$appHelper3 = context.appHelper) === null || _context$appHelper3 === void 0 ? void 0 : _context$appHelper3.utils) || {},
75
80
  store = _ref.store,
76
81
  action = _ref.action,
77
82
  getStore = _ref.getStore;
@@ -95,7 +100,7 @@ var ContinueButton = function ContinueButton() {
95
100
  data: params,
96
101
  callback: function () {
97
102
  var _callback = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(e) {
98
- var _context$appHelper2;
103
+ var _context$appHelper4;
99
104
  var value, result, _result$err;
100
105
  return _regeneratorRuntime().wrap(function _callee$(_context) {
101
106
  while (1) switch (_context.prev = _context.next) {
@@ -108,7 +113,7 @@ var ContinueButton = function ContinueButton() {
108
113
  case 2:
109
114
  value = formatValues({
110
115
  state: data,
111
- platform: context === null || context === void 0 || (_context$appHelper2 = context.appHelper) === null || _context$appHelper2 === void 0 || (_context$appHelper2 = _context$appHelper2.constants) === null || _context$appHelper2 === void 0 ? void 0 : _context$appHelper2.platform,
116
+ platform: context === null || context === void 0 || (_context$appHelper4 = context.appHelper) === null || _context$appHelper4 === void 0 || (_context$appHelper4 = _context$appHelper4.constants) === null || _context$appHelper4 === void 0 ? void 0 : _context$appHelper4.platform,
112
117
  excludeDisabled: false,
113
118
  extra: {
114
119
  relation_forms: e
@@ -395,7 +400,7 @@ var ContinueButton = function ContinueButton() {
395
400
  */
396
401
  var handleContinue = /*#__PURE__*/function () {
397
402
  var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
398
- var _context$appHelper3, _deposit$protocols, value, checkRes, emptyHolders;
403
+ var _context$appHelper5, _deposit$protocols, value, checkRes, emptyHolders;
399
404
  return _regeneratorRuntime().wrap(function _callee6$(_context6) {
400
405
  while (1) switch (_context6.prev = _context6.next) {
401
406
  case 0:
@@ -405,7 +410,7 @@ var ContinueButton = function ContinueButton() {
405
410
  }
406
411
  value = formatValues({
407
412
  state: data,
408
- platform: context === null || context === void 0 || (_context$appHelper3 = context.appHelper) === null || _context$appHelper3 === void 0 || (_context$appHelper3 = _context$appHelper3.constants) === null || _context$appHelper3 === void 0 ? void 0 : _context$appHelper3.platform
413
+ platform: context === null || context === void 0 || (_context$appHelper5 = context.appHelper) === null || _context$appHelper5 === void 0 || (_context$appHelper5 = _context$appHelper5.constants) === null || _context$appHelper5 === void 0 ? void 0 : _context$appHelper5.platform
409
414
  }); // 如果未同意定金政策,则提示
410
415
  if (!(deposit !== null && deposit !== void 0 && deposit.hasDeposit && (deposit === null || deposit === void 0 || (_deposit$protocols = deposit.protocols) === null || _deposit$protocols === void 0 ? void 0 : _deposit$protocols.length) > 0 && !isAgreeDepositPolicy)) {
411
416
  _context6.next = 5;
@@ -481,6 +486,27 @@ var ContinueButton = function ContinueButton() {
481
486
  return _ref7.apply(this, arguments);
482
487
  };
483
488
  }();
489
+ var handleSubmit = function handleSubmit() {
490
+ var _utils$businessUtils, _utils$businessUtils$;
491
+ // 如果用户是guest用户,下单时则拉起注册弹窗
492
+ if (utils !== null && utils !== void 0 && (_utils$businessUtils = utils.businessUtils) !== null && _utils$businessUtils !== void 0 && (_utils$businessUtils$ = _utils$businessUtils.isGuestUser) !== null && _utils$businessUtils$ !== void 0 && _utils$businessUtils$.call(_utils$businessUtils)) {
493
+ var _utils$businessUtils2, _utils$businessUtils3;
494
+ // 避免重复订阅
495
+ if (!hasSubscribedRef.current) {
496
+ pubsub.subscribe('bind.guest.user', handleContinue);
497
+ hasSubscribedRef.current = true;
498
+ }
499
+ utils === null || utils === void 0 || (_utils$businessUtils2 = utils.businessUtils) === null || _utils$businessUtils2 === void 0 || (_utils$businessUtils3 = _utils$businessUtils2.openRegisterModal) === null || _utils$businessUtils3 === void 0 || _utils$businessUtils3.call(_utils$businessUtils2, true);
500
+ return;
501
+ }
502
+ handleContinue();
503
+ };
504
+ useEffect(function () {
505
+ return function () {
506
+ pubsub.unsubscribe('bind.guest.user', handleContinue);
507
+ hasSubscribedRef.current = false;
508
+ };
509
+ }, []);
484
510
 
485
511
  /**
486
512
  * @title: 确认按钮文案
@@ -515,7 +541,7 @@ var ContinueButton = function ContinueButton() {
515
541
  size: "large",
516
542
  type: "primary",
517
543
  onClick: function onClick() {
518
- return handleContinue();
544
+ return isLastStep ? handleSubmit() : handleContinue();
519
545
  },
520
546
  loading: confirmLoading
521
547
  }, continueText), /*#__PURE__*/React.createElement(OrderProductModal, {
@@ -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;
@@ -22,18 +22,22 @@ import { PisellModal, PisellText, PisellToast } from '@pisell/materials';
22
22
  import { locales, uniqueByKey } from '@pisell/utils';
23
23
  import { useMemoizedFn } from 'ahooks';
24
24
  import { InfoCircleOutlined } from '@ant-design/icons';
25
+ import PinVerifyModal from "../../../../pinVerifyModal";
25
26
  import MultiModeSearch from "./MultiModeSearch";
26
27
  import List from "./List";
27
- import { searchMachineCodeList } from "./serve";
28
- import { formatMachineCodeServer2CardList } from "./utils";
28
+ import { searchMachineCodeList, searchWalletCode } from "./serve";
29
+ import { formatMachineCodeServer2CardList, getIsWalletCode } from "./utils";
29
30
  import { calcWalletPassListAmount, formatWalletPassList2PreparePayments } from "../../utils";
30
31
  import "./index.less";
32
+ import useEngineContext from "../../../../../hooks/useEngineContext";
31
33
  var Amount = PisellText.Amount;
32
34
  var WalletPass = /*#__PURE__*/forwardRef(function (props, ref) {
33
- var _searchSelectData$ids;
35
+ var _context$appHelper, _context$appHelper$ge, _searchSelectData$ids;
34
36
  var onWalletPassChange = props.onWalletPassChange,
35
37
  walletPass = props.walletPass,
36
38
  walletSetting = props.walletSetting;
39
+ var context = useEngineContext();
40
+ var isWalletCode = context === null || context === void 0 || (_context$appHelper = context.appHelper) === null || _context$appHelper === void 0 || (_context$appHelper = _context$appHelper.utils) === null || _context$appHelper === void 0 || (_context$appHelper = _context$appHelper.businessUtils) === null || _context$appHelper === void 0 || (_context$appHelper$ge = _context$appHelper.getAppByModal) === null || _context$appHelper$ge === void 0 ? void 0 : _context$appHelper$ge.call(_context$appHelper, 'wallet');
37
41
 
38
42
  /** 当前 walletPass信息 弹窗操作时都在内部进行,点击 redeem时同步到外层 */
39
43
  var _useState = useState(walletPass),
@@ -87,7 +91,8 @@ var WalletPass = /*#__PURE__*/forwardRef(function (props, ref) {
87
91
  var listRef = useRef(null);
88
92
 
89
93
  /** 当前搜索框搜索值 */
90
- var searchValRef = useRef('');
94
+ var searchValRef = useRef(null);
95
+ var pinVerifyModalRef = useRef(null);
91
96
  var _ref = currentWalletPass || {},
92
97
  walletPassSelectCards = _ref.cards,
93
98
  amount = _ref.amount;
@@ -207,30 +212,33 @@ var WalletPass = /*#__PURE__*/forwardRef(function (props, ref) {
207
212
  * @param val
208
213
  */
209
214
  var searchList = /*#__PURE__*/function () {
210
- var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(val, isSelectChange) {
211
- var _order$_order2;
212
- var result;
215
+ var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_ref3, isSelectChange) {
216
+ var code, customer_pin_key, _order$_order2, result;
213
217
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
214
218
  while (1) switch (_context2.prev = _context2.next) {
215
219
  case 0:
220
+ code = _ref3.code, customer_pin_key = _ref3.customer_pin_key;
216
221
  if (order !== null && order !== void 0 && order.order_id) {
217
- _context2.next = 2;
222
+ _context2.next = 3;
218
223
  break;
219
224
  }
220
225
  return _context2.abrupt("return");
221
- case 2:
222
- _context2.next = 4;
226
+ case 3:
227
+ setLoading(true);
228
+ _context2.prev = 4;
229
+ _context2.next = 7;
223
230
  return searchMachineCodeList({
224
231
  order_id: order.order_id,
225
- code: val,
232
+ code: code,
226
233
  prepare_payments: prepare_payments,
227
- filter_prepare_wallet_pass: 1,
228
- sale_channel: ((_order$_order2 = order._order) === null || _order$_order2 === void 0 ? void 0 : _order$_order2.sale_channel) || 'online-store'
234
+ // filter_prepare_wallet_pass: 1,
235
+ sale_channel: ((_order$_order2 = order._order) === null || _order$_order2 === void 0 ? void 0 : _order$_order2.sale_channel) || 'online-store',
236
+ customer_pin_key: customer_pin_key
229
237
  });
230
- case 4:
238
+ case 7:
231
239
  result = _context2.sent;
232
240
  if (result) {
233
- _context2.next = 8;
241
+ _context2.next = 11;
234
242
  break;
235
243
  }
236
244
  if (!isSelectChange) {
@@ -239,7 +247,13 @@ var WalletPass = /*#__PURE__*/forwardRef(function (props, ref) {
239
247
  });
240
248
  }
241
249
  return _context2.abrupt("return");
242
- case 8:
250
+ case 11:
251
+ if (!(isSelectChange && !searchValRef.current)) {
252
+ _context2.next = 13;
253
+ break;
254
+ }
255
+ return _context2.abrupt("return");
256
+ case 13:
243
257
  setSearchData(formatMachineCodeServer2CardList([].concat(_toConsumableArray(searchSelectData.details), _toConsumableArray(result)), searchSelectData.ids));
244
258
  if (result.length) {
245
259
  // 如果搜索结果只有一个并且可用,则直接选中
@@ -250,22 +264,88 @@ var WalletPass = /*#__PURE__*/forwardRef(function (props, ref) {
250
264
  });
251
265
  }
252
266
  setSearchOpen(true);
253
- searchValRef.current = val;
267
+ searchValRef.current = {
268
+ code: code,
269
+ customer_pin_key: customer_pin_key
270
+ };
254
271
  }
255
- case 10:
272
+ case 15:
273
+ _context2.prev = 15;
274
+ setLoading(false);
275
+ return _context2.finish(15);
276
+ case 18:
256
277
  case "end":
257
278
  return _context2.stop();
258
279
  }
259
- }, _callee2);
280
+ }, _callee2, null, [[4,, 15, 18]]);
260
281
  }));
261
282
  return function searchList(_x2, _x3) {
262
- return _ref3.apply(this, arguments);
283
+ return _ref4.apply(this, arguments);
284
+ };
285
+ }();
286
+ var searchWalletCodeFn = /*#__PURE__*/function () {
287
+ var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(val) {
288
+ var _pinVerifyModalRef$cu, result;
289
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
290
+ while (1) switch (_context3.prev = _context3.next) {
291
+ case 0:
292
+ setLoading(true);
293
+ _context3.prev = 1;
294
+ _context3.next = 4;
295
+ return searchWalletCode({
296
+ code: val,
297
+ with_customer: 1
298
+ });
299
+ case 4:
300
+ result = _context3.sent;
301
+ console.log(result, 'result');
302
+ // 如果搜索不到wallet code则走原始搜索逻辑
303
+ if (result) {
304
+ _context3.next = 9;
305
+ break;
306
+ }
307
+ searchList({
308
+ code: val
309
+ });
310
+ return _context3.abrupt("return");
311
+ case 9:
312
+ (_pinVerifyModalRef$cu = pinVerifyModalRef.current) === null || _pinVerifyModalRef$cu === void 0 || _pinVerifyModalRef$cu.open({
313
+ wallet_code: result.code,
314
+ wallet_detail_id: result.id,
315
+ failed_count: result.failed_count,
316
+ check_max_count: result.check_max_count,
317
+ customer: result.customer
318
+ });
319
+ // const pin = await getPin({ wallet_detail_id: result.id });
320
+ // const pinResult = await verifyPinCode({ wallet_detail_id: result.id, pin: pin.pin });
321
+ // searchList({ customer_pin_key: pinResult.customer_pin_key });
322
+ // console.log(pinResult, 'pinResult');
323
+ case 10:
324
+ _context3.prev = 10;
325
+ setLoading(false);
326
+ return _context3.finish(10);
327
+ case 13:
328
+ case "end":
329
+ return _context3.stop();
330
+ }
331
+ }, _callee3, null, [[1,, 10, 13]]);
332
+ }));
333
+ return function searchWalletCodeFn(_x4) {
334
+ return _ref5.apply(this, arguments);
263
335
  };
264
336
  }();
265
337
  var handleSearch = useMemoizedFn(function (val) {
266
338
  if (!val || searchOpen) return;
267
339
  isAutoSelect.current = true;
268
- searchList(val);
340
+
341
+ // 如果是wallet code 并且安装wallet应用 则搜索wallet code
342
+ if (getIsWalletCode(val) && isWalletCode) {
343
+ searchWalletCodeFn(val);
344
+ } else {
345
+ searchList({
346
+ code: val
347
+ });
348
+ }
269
349
  });
270
350
  useImperativeHandle(ref, function () {
271
351
  return {
@@ -274,7 +354,7 @@ var WalletPass = /*#__PURE__*/forwardRef(function (props, ref) {
274
354
  });
275
355
  var handleSearchModalClose = function handleSearchModalClose() {
276
356
  setSearchOpen(false);
277
- searchValRef.current = '';
357
+ searchValRef.current = null;
278
358
  setSearchSelectData({
279
359
  ids: [],
280
360
  details: []
@@ -398,7 +478,15 @@ var WalletPass = /*#__PURE__*/forwardRef(function (props, ref) {
398
478
  walletSetting: walletSetting,
399
479
  data: searchData,
400
480
  value: searchSelectData.ids,
401
- onChange: handleAddChange
402
- }))));
481
+ onChange: handleAddChange,
482
+ loading: loading
483
+ }))), /*#__PURE__*/React.createElement(PinVerifyModal, {
484
+ ref: pinVerifyModalRef,
485
+ onSuccess: function onSuccess(params) {
486
+ searchList({
487
+ customer_pin_key: params === null || params === void 0 ? void 0 : params.customer_pin_key
488
+ });
489
+ }
490
+ }));
403
491
  });
404
492
  export default /*#__PURE__*/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 {};
@@ -111,4 +111,82 @@ export var walletPassPay = /*#__PURE__*/function () {
111
111
  return function walletPassPay(_x4) {
112
112
  return _ref4.apply(this, arguments);
113
113
  };
114
+ }();
115
+
116
+ /**
117
+ * 搜索wallet code
118
+ */
119
+ export var searchWalletCode = /*#__PURE__*/function () {
120
+ var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(params) {
121
+ var _yield$request$getReq5, data;
122
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
123
+ while (1) switch (_context5.prev = _context5.next) {
124
+ case 0:
125
+ _context5.next = 2;
126
+ return request.getRequest().post("/h5/wallet/detail/search", params);
127
+ case 2:
128
+ _yield$request$getReq5 = _context5.sent;
129
+ data = _yield$request$getReq5.data;
130
+ return _context5.abrupt("return", data);
131
+ case 5:
132
+ case "end":
133
+ return _context5.stop();
134
+ }
135
+ }, _callee5);
136
+ }));
137
+ return function searchWalletCode(_x5) {
138
+ return _ref5.apply(this, arguments);
139
+ };
140
+ }();
141
+
142
+ /**
143
+ * 验证pin码
144
+ */
145
+ export var verifyPinCode = /*#__PURE__*/function () {
146
+ var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(params) {
147
+ var _yield$request$getReq6, data;
148
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
149
+ while (1) switch (_context6.prev = _context6.next) {
150
+ case 0:
151
+ _context6.next = 2;
152
+ return request.getRequest().post("/h5/wallet/detail/pin/validate", params);
153
+ case 2:
154
+ _yield$request$getReq6 = _context6.sent;
155
+ data = _yield$request$getReq6.data;
156
+ return _context6.abrupt("return", data);
157
+ case 5:
158
+ case "end":
159
+ return _context6.stop();
160
+ }
161
+ }, _callee6);
162
+ }));
163
+ return function verifyPinCode(_x6) {
164
+ return _ref6.apply(this, arguments);
165
+ };
166
+ }();
167
+
168
+ /**
169
+ * 获取pin码
170
+ */
171
+ export var getPin = /*#__PURE__*/function () {
172
+ var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(params) {
173
+ var _yield$request$getReq7, data;
174
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
175
+ while (1) switch (_context7.prev = _context7.next) {
176
+ case 0:
177
+ _context7.next = 2;
178
+ return request.getRequest().get("/h5/wallet/detail/pin", params);
179
+ case 2:
180
+ _yield$request$getReq7 = _context7.sent;
181
+ data = _yield$request$getReq7.data;
182
+ return _context7.abrupt("return", data);
183
+ case 5:
184
+ case "end":
185
+ return _context7.stop();
186
+ }
187
+ }, _callee7);
188
+ }));
189
+ return function getPin(_x7) {
190
+ return _ref7.apply(this, arguments);
191
+ };
114
192
  }();
@@ -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;
@@ -38,4 +38,13 @@ export var getDataByIds = function getDataByIds(arr, ids) {
38
38
  return arr.filter(function (item) {
39
39
  return ids.includes(item.id);
40
40
  });
41
+ };
42
+
43
+ /**
44
+ * 判断是否是wallet code
45
+ * @param val
46
+ * @returns
47
+ */
48
+ export var getIsWalletCode = function getIsWalletCode(val) {
49
+ return val.startsWith('WL');
41
50
  };
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export interface FormState {
3
2
  platform: 'pc' | 'h5' | '' | undefined;
4
3
  order: any;
@@ -29,11 +28,4 @@ export interface PayGroup {
29
28
  pay_number?: string;
30
29
  _order: any;
31
30
  }
32
- export declare const Provider: (ComponentUi: any) => any, Context: import("react").Context<{
33
- state: FormState;
34
- } & {
35
- dispatch: (params: {
36
- type: string;
37
- payload: any;
38
- }) => void;
39
- }>;
31
+ export declare const Provider: any, Context: any;
@@ -41,7 +41,7 @@ export var formatWalletPassParams = function formatWalletPassParams(payGroup) {
41
41
  var payments = (walletPass === null || walletPass === void 0 ? void 0 : walletPass.cards.map(function (item) {
42
42
  return {
43
43
  amount: getAvailableMaxAmount(item),
44
- wallet_pass_use_value: item.available_max_par_value,
44
+ wallet_pass_use_value: item.recommended_usage_par_value,
45
45
  voucher_id: item.id,
46
46
  tag: item.tag,
47
47
  wallet_pass_usage_unit: item.wallet_pass_usage_unit
@@ -0,0 +1,7 @@
1
+ export declare const usePin: () => {
2
+ pin: string;
3
+ lastUpdateTime: string;
4
+ getPin: (id: string | number) => void;
5
+ resetPin: (id: string | number) => void;
6
+ resetPinLoading: boolean;
7
+ };