@pisell/pisellos 3.0.57 → 3.0.59

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 (256) hide show
  1. package/dist/core/index.js +1 -2
  2. package/dist/effects/index.d.ts +3 -4
  3. package/dist/effects/index.js +6 -15
  4. package/dist/modules/AccountList/index.d.ts +1 -7
  5. package/dist/modules/AccountList/index.js +14 -81
  6. package/dist/modules/AccountList/types.d.ts +0 -28
  7. package/dist/modules/AccountList/types.js +0 -8
  8. package/dist/modules/Cart/index.js +1 -1
  9. package/dist/modules/Payment/index.d.ts +9 -273
  10. package/dist/modules/Payment/index.js +109 -2525
  11. package/dist/modules/Payment/types.d.ts +30 -382
  12. package/dist/modules/Payment/types.js +14 -116
  13. package/dist/modules/ProductList/index.d.ts +1 -12
  14. package/dist/modules/ProductList/index.js +3 -27
  15. package/dist/modules/Rules/index.js +14 -27
  16. package/dist/modules/Rules/types.d.ts +0 -1
  17. package/dist/modules/index.d.ts +0 -1
  18. package/dist/modules/index.js +0 -1
  19. package/dist/plugins/window.d.ts +0 -1
  20. package/dist/solution/BookingByStep/index.js +1 -9
  21. package/dist/solution/ShopDiscount/index.js +2 -4
  22. package/dist/solution/index.d.ts +0 -2
  23. package/dist/solution/index.js +1 -3
  24. package/dist/types/index.d.ts +1 -3
  25. package/lib/core/index.js +1 -1
  26. package/lib/effects/index.d.ts +3 -4
  27. package/lib/effects/index.js +1 -4
  28. package/lib/modules/AccountList/index.d.ts +1 -7
  29. package/lib/modules/AccountList/index.js +0 -27
  30. package/lib/modules/AccountList/types.d.ts +0 -28
  31. package/lib/modules/Cart/index.js +1 -1
  32. package/lib/modules/Payment/index.d.ts +9 -273
  33. package/lib/modules/Payment/index.js +50 -1285
  34. package/lib/modules/Payment/types.d.ts +30 -382
  35. package/lib/modules/Payment/types.js +6 -41
  36. package/lib/modules/ProductList/index.d.ts +1 -12
  37. package/lib/modules/ProductList/index.js +2 -29
  38. package/lib/modules/Rules/index.js +12 -20
  39. package/lib/modules/Rules/types.d.ts +0 -1
  40. package/lib/modules/index.d.ts +0 -1
  41. package/lib/modules/index.js +0 -2
  42. package/lib/plugins/window.d.ts +0 -1
  43. package/lib/solution/BookingByStep/index.js +2 -1
  44. package/lib/solution/ShopDiscount/index.js +1 -2
  45. package/lib/solution/index.d.ts +0 -2
  46. package/lib/solution/index.js +1 -5
  47. package/lib/types/index.d.ts +1 -3
  48. package/package.json +2 -4
  49. package/dist/modules/Customer/constants.d.ts +0 -7
  50. package/dist/modules/Customer/constants.js +0 -12
  51. package/dist/modules/Customer/index.d.ts +0 -122
  52. package/dist/modules/Customer/index.js +0 -697
  53. package/dist/modules/Customer/types.d.ts +0 -146
  54. package/dist/modules/Customer/types.js +0 -41
  55. package/dist/modules/Payment/cash.d.ts +0 -11
  56. package/dist/modules/Payment/cash.js +0 -78
  57. package/dist/modules/Payment/eftpos.d.ts +0 -11
  58. package/dist/modules/Payment/eftpos.js +0 -80
  59. package/dist/modules/Payment/wallet.d.ts +0 -11
  60. package/dist/modules/Payment/wallet.js +0 -78
  61. package/dist/modules/Payment/walletpass.d.ts +0 -0
  62. package/dist/modules/Payment/walletpass.js +0 -0
  63. package/dist/plugins/app-types/app/app.d.ts +0 -83
  64. package/dist/plugins/app-types/app/const.d.ts +0 -4
  65. package/dist/plugins/app-types/app/index.d.ts +0 -14
  66. package/dist/plugins/app-types/applicationManager/application.d.ts +0 -50
  67. package/dist/plugins/app-types/applicationManager/index.d.ts +0 -13
  68. package/dist/plugins/app-types/config.d.ts +0 -3
  69. package/dist/plugins/app-types/cookie/index.d.ts +0 -13
  70. package/dist/plugins/app-types/data/index.d.ts +0 -8
  71. package/dist/plugins/app-types/history/config.d.ts +0 -24
  72. package/dist/plugins/app-types/history/index.d.ts +0 -20
  73. package/dist/plugins/app-types/history/type.d.ts +0 -2
  74. package/dist/plugins/app-types/hooks/index.d.ts +0 -12
  75. package/dist/plugins/app-types/hooks/useDelayedValue/index.d.ts +0 -2
  76. package/dist/plugins/app-types/hooks/useDispatch/index.d.ts +0 -2
  77. package/dist/plugins/app-types/hooks/useLowCode/index.d.ts +0 -13
  78. package/dist/plugins/app-types/hooks/useStore/index.d.ts +0 -6
  79. package/dist/plugins/app-types/index.d.ts +0 -6
  80. package/dist/plugins/app-types/indexDB/index.d.ts +0 -178
  81. package/dist/plugins/app-types/locales/en.d.ts +0 -3
  82. package/dist/plugins/app-types/locales/index.d.ts +0 -37
  83. package/dist/plugins/app-types/locales/original.d.ts +0 -3
  84. package/dist/plugins/app-types/locales/type.d.ts +0 -19
  85. package/dist/plugins/app-types/locales/zh-CN.d.ts +0 -3
  86. package/dist/plugins/app-types/locales/zh-HK.d.ts +0 -3
  87. package/dist/plugins/app-types/logger/feishu.d.ts +0 -11
  88. package/dist/plugins/app-types/logger/index.d.ts +0 -122
  89. package/dist/plugins/app-types/menuManager/hooks.d.ts +0 -17
  90. package/dist/plugins/app-types/menuManager/index.d.ts +0 -28
  91. package/dist/plugins/app-types/models/global.d.ts +0 -32
  92. package/dist/plugins/app-types/models/index.d.ts +0 -45
  93. package/dist/plugins/app-types/models/type.d.ts +0 -2
  94. package/dist/plugins/app-types/package.json +0 -15
  95. package/dist/plugins/app-types/plugin/index.d.ts +0 -0
  96. package/dist/plugins/app-types/pubsub/example.d.ts +0 -5
  97. package/dist/plugins/app-types/pubsub/index.d.ts +0 -63
  98. package/dist/plugins/app-types/request/cache.d.ts +0 -46
  99. package/dist/plugins/app-types/request/cancelToken.d.ts +0 -38
  100. package/dist/plugins/app-types/request/config.d.ts +0 -3
  101. package/dist/plugins/app-types/request/constants.d.ts +0 -2
  102. package/dist/plugins/app-types/request/index.d.ts +0 -24
  103. package/dist/plugins/app-types/request/pisell2Request.d.ts +0 -6
  104. package/dist/plugins/app-types/request/type.d.ts +0 -41
  105. package/dist/plugins/app-types/request/utils.d.ts +0 -46
  106. package/dist/plugins/app-types/routes/config.d.ts +0 -7
  107. package/dist/plugins/app-types/routes/index.d.ts +0 -28
  108. package/dist/plugins/app-types/socket/components/SocketMonitorPage.d.ts +0 -6
  109. package/dist/plugins/app-types/socket/components/index.d.ts +0 -2
  110. package/dist/plugins/app-types/socket/constants.d.ts +0 -33
  111. package/dist/plugins/app-types/socket/events.d.ts +0 -31
  112. package/dist/plugins/app-types/socket/heartbeat.d.ts +0 -66
  113. package/dist/plugins/app-types/socket/index.d.ts +0 -61
  114. package/dist/plugins/app-types/socket/monitor.d.ts +0 -169
  115. package/dist/plugins/app-types/socket/reconnect.d.ts +0 -61
  116. package/dist/plugins/app-types/socket/socket.d.ts +0 -129
  117. package/dist/plugins/app-types/socket/types.d.ts +0 -85
  118. package/dist/plugins/app-types/storage/index.d.ts +0 -17
  119. package/dist/plugins/app-types/tasks/index.d.ts +0 -77
  120. package/dist/plugins/app-types/tasks/type.d.ts +0 -62
  121. package/dist/plugins/app-types/tasks/useTasks.d.ts +0 -5
  122. package/dist/plugins/app-types/type.d.ts +0 -2
  123. package/dist/plugins/app-types/variables/VariablesProvider.d.ts +0 -7
  124. package/dist/plugins/app-types/variables/config.d.ts +0 -3
  125. package/dist/plugins/app-types/variables/index.d.ts +0 -6
  126. package/dist/plugins/app-types/variables/type.d.ts +0 -2
  127. package/dist/plugins/app-types/website/index.d.ts +0 -6
  128. package/dist/plugins/app.d.ts +0 -8
  129. package/dist/plugins/app.js +0 -1
  130. package/dist/solution/BookingTicket/index.d.ts +0 -172
  131. package/dist/solution/BookingTicket/index.js +0 -665
  132. package/dist/solution/BookingTicket/types.d.ts +0 -68
  133. package/dist/solution/BookingTicket/types.js +0 -43
  134. package/dist/solution/BookingTicket/utils/scan/cloudSearch.d.ts +0 -22
  135. package/dist/solution/BookingTicket/utils/scan/cloudSearch.js +0 -159
  136. package/dist/solution/BookingTicket/utils/scan/handleScan.d.ts +0 -16
  137. package/dist/solution/BookingTicket/utils/scan/handleScan.js +0 -174
  138. package/dist/solution/BookingTicket/utils/scan/index.d.ts +0 -81
  139. package/dist/solution/BookingTicket/utils/scan/index.js +0 -285
  140. package/dist/solution/BookingTicket/utils/scan/scanCache.d.ts +0 -78
  141. package/dist/solution/BookingTicket/utils/scan/scanCache.js +0 -305
  142. package/dist/solution/Checkout/appointmentDemo.json +0 -1
  143. package/dist/solution/Checkout/index.d.ts +0 -181
  144. package/dist/solution/Checkout/index.js +0 -1596
  145. package/dist/solution/Checkout/types.d.ts +0 -550
  146. package/dist/solution/Checkout/types.js +0 -132
  147. package/dist/solution/Checkout/utils/index.d.ts +0 -73
  148. package/dist/solution/Checkout/utils/index.js +0 -371
  149. package/dist/utils/task.d.ts +0 -40
  150. package/dist/utils/task.js +0 -171
  151. package/dist/utils/watch.d.ts +0 -102
  152. package/dist/utils/watch.js +0 -294
  153. package/lib/modules/Customer/constants.d.ts +0 -7
  154. package/lib/modules/Customer/constants.js +0 -39
  155. package/lib/modules/Customer/index.d.ts +0 -122
  156. package/lib/modules/Customer/index.js +0 -440
  157. package/lib/modules/Customer/types.d.ts +0 -146
  158. package/lib/modules/Customer/types.js +0 -37
  159. package/lib/modules/Payment/cash.d.ts +0 -11
  160. package/lib/modules/Payment/cash.js +0 -51
  161. package/lib/modules/Payment/eftpos.d.ts +0 -11
  162. package/lib/modules/Payment/eftpos.js +0 -51
  163. package/lib/modules/Payment/wallet.d.ts +0 -11
  164. package/lib/modules/Payment/wallet.js +0 -51
  165. package/lib/modules/Payment/walletpass.d.ts +0 -0
  166. package/lib/modules/Payment/walletpass.js +0 -0
  167. package/lib/plugins/app-types/app/app.d.ts +0 -83
  168. package/lib/plugins/app-types/app/const.d.ts +0 -4
  169. package/lib/plugins/app-types/app/index.d.ts +0 -14
  170. package/lib/plugins/app-types/applicationManager/application.d.ts +0 -50
  171. package/lib/plugins/app-types/applicationManager/index.d.ts +0 -13
  172. package/lib/plugins/app-types/config.d.ts +0 -3
  173. package/lib/plugins/app-types/cookie/index.d.ts +0 -13
  174. package/lib/plugins/app-types/data/index.d.ts +0 -8
  175. package/lib/plugins/app-types/history/config.d.ts +0 -24
  176. package/lib/plugins/app-types/history/index.d.ts +0 -20
  177. package/lib/plugins/app-types/history/type.d.ts +0 -2
  178. package/lib/plugins/app-types/hooks/index.d.ts +0 -12
  179. package/lib/plugins/app-types/hooks/useDelayedValue/index.d.ts +0 -2
  180. package/lib/plugins/app-types/hooks/useDispatch/index.d.ts +0 -2
  181. package/lib/plugins/app-types/hooks/useLowCode/index.d.ts +0 -13
  182. package/lib/plugins/app-types/hooks/useStore/index.d.ts +0 -6
  183. package/lib/plugins/app-types/index.d.ts +0 -6
  184. package/lib/plugins/app-types/indexDB/index.d.ts +0 -178
  185. package/lib/plugins/app-types/locales/en.d.ts +0 -3
  186. package/lib/plugins/app-types/locales/index.d.ts +0 -37
  187. package/lib/plugins/app-types/locales/original.d.ts +0 -3
  188. package/lib/plugins/app-types/locales/type.d.ts +0 -19
  189. package/lib/plugins/app-types/locales/zh-CN.d.ts +0 -3
  190. package/lib/plugins/app-types/locales/zh-HK.d.ts +0 -3
  191. package/lib/plugins/app-types/logger/feishu.d.ts +0 -11
  192. package/lib/plugins/app-types/logger/index.d.ts +0 -122
  193. package/lib/plugins/app-types/menuManager/hooks.d.ts +0 -17
  194. package/lib/plugins/app-types/menuManager/index.d.ts +0 -28
  195. package/lib/plugins/app-types/models/global.d.ts +0 -32
  196. package/lib/plugins/app-types/models/index.d.ts +0 -45
  197. package/lib/plugins/app-types/models/type.d.ts +0 -2
  198. package/lib/plugins/app-types/package.json +0 -15
  199. package/lib/plugins/app-types/plugin/index.d.ts +0 -0
  200. package/lib/plugins/app-types/pubsub/example.d.ts +0 -5
  201. package/lib/plugins/app-types/pubsub/index.d.ts +0 -63
  202. package/lib/plugins/app-types/request/cache.d.ts +0 -46
  203. package/lib/plugins/app-types/request/cancelToken.d.ts +0 -38
  204. package/lib/plugins/app-types/request/config.d.ts +0 -3
  205. package/lib/plugins/app-types/request/constants.d.ts +0 -2
  206. package/lib/plugins/app-types/request/index.d.ts +0 -24
  207. package/lib/plugins/app-types/request/pisell2Request.d.ts +0 -6
  208. package/lib/plugins/app-types/request/type.d.ts +0 -41
  209. package/lib/plugins/app-types/request/utils.d.ts +0 -46
  210. package/lib/plugins/app-types/routes/config.d.ts +0 -7
  211. package/lib/plugins/app-types/routes/index.d.ts +0 -28
  212. package/lib/plugins/app-types/socket/components/SocketMonitorPage.d.ts +0 -6
  213. package/lib/plugins/app-types/socket/components/index.d.ts +0 -2
  214. package/lib/plugins/app-types/socket/constants.d.ts +0 -33
  215. package/lib/plugins/app-types/socket/events.d.ts +0 -31
  216. package/lib/plugins/app-types/socket/heartbeat.d.ts +0 -66
  217. package/lib/plugins/app-types/socket/index.d.ts +0 -61
  218. package/lib/plugins/app-types/socket/monitor.d.ts +0 -169
  219. package/lib/plugins/app-types/socket/reconnect.d.ts +0 -61
  220. package/lib/plugins/app-types/socket/socket.d.ts +0 -129
  221. package/lib/plugins/app-types/socket/types.d.ts +0 -85
  222. package/lib/plugins/app-types/storage/index.d.ts +0 -17
  223. package/lib/plugins/app-types/tasks/index.d.ts +0 -77
  224. package/lib/plugins/app-types/tasks/type.d.ts +0 -62
  225. package/lib/plugins/app-types/tasks/useTasks.d.ts +0 -5
  226. package/lib/plugins/app-types/type.d.ts +0 -2
  227. package/lib/plugins/app-types/variables/VariablesProvider.d.ts +0 -7
  228. package/lib/plugins/app-types/variables/config.d.ts +0 -3
  229. package/lib/plugins/app-types/variables/index.d.ts +0 -6
  230. package/lib/plugins/app-types/variables/type.d.ts +0 -2
  231. package/lib/plugins/app-types/website/index.d.ts +0 -6
  232. package/lib/plugins/app.d.ts +0 -8
  233. package/lib/plugins/app.js +0 -17
  234. package/lib/solution/BookingTicket/index.d.ts +0 -172
  235. package/lib/solution/BookingTicket/index.js +0 -399
  236. package/lib/solution/BookingTicket/types.d.ts +0 -68
  237. package/lib/solution/BookingTicket/types.js +0 -72
  238. package/lib/solution/BookingTicket/utils/scan/cloudSearch.d.ts +0 -22
  239. package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +0 -117
  240. package/lib/solution/BookingTicket/utils/scan/handleScan.d.ts +0 -16
  241. package/lib/solution/BookingTicket/utils/scan/handleScan.js +0 -125
  242. package/lib/solution/BookingTicket/utils/scan/index.d.ts +0 -81
  243. package/lib/solution/BookingTicket/utils/scan/index.js +0 -210
  244. package/lib/solution/BookingTicket/utils/scan/scanCache.d.ts +0 -78
  245. package/lib/solution/BookingTicket/utils/scan/scanCache.js +0 -231
  246. package/lib/solution/Checkout/appointmentDemo.json +0 -1
  247. package/lib/solution/Checkout/index.d.ts +0 -181
  248. package/lib/solution/Checkout/index.js +0 -864
  249. package/lib/solution/Checkout/types.d.ts +0 -550
  250. package/lib/solution/Checkout/types.js +0 -75
  251. package/lib/solution/Checkout/utils/index.d.ts +0 -73
  252. package/lib/solution/Checkout/utils/index.js +0 -266
  253. package/lib/utils/task.d.ts +0 -40
  254. package/lib/utils/task.js +0 -109
  255. package/lib/utils/watch.d.ts +0 -102
  256. package/lib/utils/watch.js +0 -217
@@ -67,8 +67,7 @@ var PisellOSCore = /*#__PURE__*/function () {
67
67
  console.log("".concat(prefix, " ").concat(message));
68
68
  break;
69
69
  case 'warn':
70
- // 使用 console.log 避免显示堆栈跟踪,提升性能
71
- console.log("%c".concat(prefix, "%c ").concat(message), 'color: #f59e0b; font-weight: bold;', 'color: #f59e0b;');
70
+ console.warn("".concat(prefix, " ").concat(message));
72
71
  break;
73
72
  case 'error':
74
73
  console.error("".concat(prefix, " ").concat(message));
@@ -2,17 +2,16 @@ type EffectCallback = (payload: any) => void | Promise<void | {
2
2
  status: boolean;
3
3
  message?: string;
4
4
  }>;
5
- type UnsubscribeFunction = () => void;
6
5
  declare class EffectsManager {
7
6
  private listeners;
8
- on(event: string, callback: EffectCallback): UnsubscribeFunction;
7
+ on(event: string, callback: EffectCallback): void;
9
8
  off(event: string, callback: EffectCallback): void;
10
9
  offByModuleDestroy(module: string): void;
11
- once(event: string, callback: EffectCallback): UnsubscribeFunction;
10
+ once(event: string, callback: EffectCallback): void;
12
11
  emit(event: string, payload: any): Promise<{
13
12
  status: boolean;
14
13
  data: any;
15
14
  }>;
16
15
  clear(): void;
17
16
  }
18
- export { EffectsManager, UnsubscribeFunction };
17
+ export { EffectsManager };
@@ -11,7 +11,6 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
11
11
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
12
12
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
13
13
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
14
- // 取消监听函数类型
15
14
  var EffectsManager = /*#__PURE__*/function () {
16
15
  function EffectsManager() {
17
16
  _classCallCheck(this, EffectsManager);
@@ -20,15 +19,9 @@ var EffectsManager = /*#__PURE__*/function () {
20
19
  _createClass(EffectsManager, [{
21
20
  key: "on",
22
21
  value: function on(event, callback) {
23
- var _this$listeners$get,
24
- _this = this;
22
+ var _this$listeners$get;
25
23
  if (!this.listeners.has(event)) this.listeners.set(event, new Set());
26
24
  (_this$listeners$get = this.listeners.get(event)) === null || _this$listeners$get === void 0 || _this$listeners$get.add(callback);
27
-
28
- // 返回取消函数
29
- return function () {
30
- _this.off(event, callback);
31
- };
32
25
  }
33
26
  }, {
34
27
  key: "off",
@@ -41,17 +34,17 @@ var EffectsManager = /*#__PURE__*/function () {
41
34
  }, {
42
35
  key: "offByModuleDestroy",
43
36
  value: function offByModuleDestroy(module) {
44
- var _this2 = this;
37
+ var _this = this;
45
38
  Array.from(this.listeners.keys()).forEach(function (item) {
46
39
  if (item.startsWith(module)) {
47
- _this2.listeners.delete(item);
40
+ _this.listeners.delete(item);
48
41
  }
49
42
  });
50
43
  }
51
44
  }, {
52
45
  key: "once",
53
46
  value: function once(event, callback) {
54
- var _this3 = this;
47
+ var _this2 = this;
55
48
  var wrapper = /*#__PURE__*/function () {
56
49
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(payload) {
57
50
  return _regeneratorRuntime().wrap(function _callee$(_context) {
@@ -60,7 +53,7 @@ var EffectsManager = /*#__PURE__*/function () {
60
53
  _context.next = 2;
61
54
  return callback(payload);
62
55
  case 2:
63
- _this3.off(event, wrapper);
56
+ _this2.off(event, wrapper);
64
57
  case 3:
65
58
  case "end":
66
59
  return _context.stop();
@@ -71,9 +64,7 @@ var EffectsManager = /*#__PURE__*/function () {
71
64
  return _ref.apply(this, arguments);
72
65
  };
73
66
  }();
74
-
75
- // 调用修改后的on方法,它会返回取消函数
76
- return this.on(event, wrapper);
67
+ this.on(event, wrapper);
77
68
  }
78
69
  }, {
79
70
  key: "emit",
@@ -1,7 +1,7 @@
1
1
  import { Module, PisellCore, ModuleOptions } from '../../types';
2
2
  import { AccountModule, Account } from '../Account';
3
3
  import { BaseModule } from '../BaseModule';
4
- import { IFetchHolderAccountsParams, IHolder, IGetCustomerListParams } from './types';
4
+ import { IFetchHolderAccountsParams, IHolder } from './types';
5
5
  export declare class AccountListModule extends BaseModule implements Module {
6
6
  protected defaultName: string;
7
7
  protected defaultVersion: string;
@@ -37,12 +37,6 @@ export declare class AccountListModule extends BaseModule implements Module {
37
37
  customerId: number;
38
38
  type?: 'unshift' | 'push';
39
39
  }): Promise<AccountModule[]>;
40
- /**
41
- * 获取客户列表
42
- * @param params 查询参数
43
- * @returns 客户列表
44
- */
45
- getCustomerList(params?: IGetCustomerListParams): Promise<any>;
46
40
  /**
47
41
  * 获取holder类型账户列表
48
42
  * @param params
@@ -1,9 +1,4 @@
1
- var _excluded = ["page", "pageSize", "keyword"];
2
1
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
3
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
4
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
5
- function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
6
- function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
7
2
  function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
8
3
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
9
4
  function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
@@ -509,68 +504,6 @@ export var AccountListModule = /*#__PURE__*/function (_BaseModule) {
509
504
  }
510
505
  return addHolderAccounts;
511
506
  }()
512
- /**
513
- * 获取客户列表
514
- * @param params 查询参数
515
- * @returns 客户列表
516
- */
517
- )
518
- }, {
519
- key: "getCustomerList",
520
- value: (function () {
521
- var _getCustomerList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
522
- var params,
523
- url,
524
- _params$page,
525
- page,
526
- _params$pageSize,
527
- pageSize,
528
- keyword,
529
- otherParams,
530
- queryParams,
531
- res,
532
- _args9 = arguments;
533
- return _regeneratorRuntime().wrap(function _callee9$(_context9) {
534
- while (1) switch (_context9.prev = _context9.next) {
535
- case 0:
536
- params = _args9.length > 0 && _args9[0] !== undefined ? _args9[0] : {};
537
- url = '/customer/es/data';
538
- _params$page = params.page, page = _params$page === void 0 ? 1 : _params$page, _params$pageSize = params.pageSize, pageSize = _params$pageSize === void 0 ? 20 : _params$pageSize, keyword = params.keyword, otherParams = _objectWithoutProperties(params, _excluded);
539
- _context9.prev = 3;
540
- this.store.isLoading = true;
541
- this.store.error = null;
542
- queryParams = _objectSpread(_objectSpread({
543
- page: page,
544
- pageSize: pageSize
545
- }, keyword && {
546
- keyword: keyword
547
- }), otherParams);
548
- _context9.next = 9;
549
- return this.request.get(url, queryParams);
550
- case 9:
551
- res = _context9.sent;
552
- return _context9.abrupt("return", (res === null || res === void 0 ? void 0 : res.data) || []);
553
- case 13:
554
- _context9.prev = 13;
555
- _context9.t0 = _context9["catch"](3);
556
- console.error('Failed to fetch customer list:', _context9.t0);
557
- this.store.error = _context9.t0 instanceof Error ? _context9.t0.message : 'Failed to fetch customer list';
558
- throw _context9.t0;
559
- case 18:
560
- _context9.prev = 18;
561
- this.store.isLoading = false;
562
- return _context9.finish(18);
563
- case 21:
564
- case "end":
565
- return _context9.stop();
566
- }
567
- }, _callee9, this, [[3, 13, 18, 21]]);
568
- }));
569
- function getCustomerList() {
570
- return _getCustomerList.apply(this, arguments);
571
- }
572
- return getCustomerList;
573
- }()
574
507
  /**
575
508
  * 获取holder类型账户列表
576
509
  * @param params
@@ -579,15 +512,15 @@ export var AccountListModule = /*#__PURE__*/function (_BaseModule) {
579
512
  }, {
580
513
  key: "fetchHolderAccounts",
581
514
  value: (function () {
582
- var _fetchHolderAccounts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(params) {
515
+ var _fetchHolderAccounts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(params) {
583
516
  var url, _ref, form_id, shop_id, num, skip, customer_id, _res$data, res;
584
- return _regeneratorRuntime().wrap(function _callee10$(_context10) {
585
- while (1) switch (_context10.prev = _context10.next) {
517
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
518
+ while (1) switch (_context9.prev = _context9.next) {
586
519
  case 0:
587
520
  url = params.url || '/account/holder';
588
521
  _ref = (params === null || params === void 0 ? void 0 : params.query) || {}, form_id = _ref.form_id, shop_id = _ref.shop_id, num = _ref.num, skip = _ref.skip, customer_id = _ref.customer_id;
589
- _context10.prev = 2;
590
- _context10.next = 5;
522
+ _context9.prev = 2;
523
+ _context9.next = 5;
591
524
  return this.request.get(url, {
592
525
  customer_id: customer_id,
593
526
  form_id: form_id,
@@ -596,30 +529,30 @@ export var AccountListModule = /*#__PURE__*/function (_BaseModule) {
596
529
  skip: skip || 1
597
530
  });
598
531
  case 5:
599
- res = _context10.sent;
532
+ res = _context9.sent;
600
533
  this.store.accountList = [];
601
534
  this.store.accounts = [];
602
535
  if (!(res !== null && res !== void 0 && (_res$data = res.data) !== null && _res$data !== void 0 && (_res$data = _res$data.list) !== null && _res$data !== void 0 && _res$data.length)) {
603
- _context10.next = 11;
536
+ _context9.next = 11;
604
537
  break;
605
538
  }
606
- _context10.next = 11;
539
+ _context9.next = 11;
607
540
  return this.addHolderAccounts({
608
541
  holders: res.data.list,
609
542
  customerId: customer_id
610
543
  });
611
544
  case 11:
612
- _context10.next = 16;
545
+ _context9.next = 16;
613
546
  break;
614
547
  case 13:
615
- _context10.prev = 13;
616
- _context10.t0 = _context10["catch"](2);
617
- console.error(_context10.t0);
548
+ _context9.prev = 13;
549
+ _context9.t0 = _context9["catch"](2);
550
+ console.error(_context9.t0);
618
551
  case 16:
619
552
  case "end":
620
- return _context10.stop();
553
+ return _context9.stop();
621
554
  }
622
- }, _callee10, this, [[2, 13]]);
555
+ }, _callee9, this, [[2, 13]]);
623
556
  }));
624
557
  function fetchHolderAccounts(_x11) {
625
558
  return _fetchHolderAccounts.apply(this, arguments);
@@ -67,31 +67,3 @@ export interface IHolder {
67
67
  main_field: string;
68
68
  customer_cover?: string;
69
69
  }
70
- /**
71
- * 获取客户列表参数
72
- */
73
- export interface IGetCustomerListParams {
74
- /** 页码 */
75
- page?: number;
76
- /** 每页数量 */
77
- pageSize?: number;
78
- /** 搜索关键词 */
79
- keyword?: string;
80
- /** 其他筛选参数 */
81
- [key: string]: any;
82
- }
83
- /**
84
- * 客户数据
85
- */
86
- export interface ICustomer {
87
- /** 客户ID */
88
- id: string | number;
89
- /** 客户姓名 */
90
- name: string;
91
- /** 客户电话 */
92
- phone?: string;
93
- /** 客户邮箱 */
94
- email?: string;
95
- /** 其他客户信息 */
96
- [key: string]: any;
97
- }
@@ -22,12 +22,4 @@ export var AccountListHooks = /*#__PURE__*/function (AccountListHooks) {
22
22
 
23
23
  /**
24
24
  * holder类型数据
25
- */
26
-
27
- /**
28
- * 获取客户列表参数
29
- */
30
-
31
- /**
32
- * 客户数据
33
25
  */
@@ -39,7 +39,7 @@ export var CartModule = /*#__PURE__*/function (_BaseModule) {
39
39
  function CartModule(name, version) {
40
40
  var _this;
41
41
  _classCallCheck(this, CartModule);
42
- _this = _super.call(this, name || 'cart', version || '1.0.0');
42
+ _this = _super.call(this, name, version);
43
43
  // 提供给 baseModule 用的默认名称 和 默认版本
44
44
  _defineProperty(_assertThisInitialized(_this), "defaultName", 'cart');
45
45
  _defineProperty(_assertThisInitialized(_this), "defaultVersion", '1.0.0');
@@ -1,280 +1,16 @@
1
1
  import { Module, PisellCore, ModuleOptions } from '../../types';
2
2
  import { BaseModule } from '../BaseModule';
3
- import { PaymentModuleAPI, PaymentMethod, PaymentOrder, PaymentItem, PaymentItemInput, PaymentUpdateFields, PushOrderParams, CashPayment, EftposPayment, WalletPayment } from './types';
4
- export * from './types';
5
- export { generateRequestUniqueId };
6
- /**
7
- * 生成请求唯一ID
8
- * 格式: 年月日时分秒毫秒+4位随机数
9
- * 示例: 20241201143025123456
10
- */
11
- declare function generateRequestUniqueId(): string;
12
- /**
13
- * 支付模块实现
14
- *
15
- * 支付流程说明:
16
- * 1. 用户操作 → 调用支付API (pushPaymentAsync, submitPayAsync等)
17
- * 2. 数据处理 → 更新本地IndexDB中的订单和支付项数据
18
- * 3. 立即完成 → 本地订单状态立即更新为PaymentStatus.Finished(isSynced保持false)
19
- * 4. 后台同步 → 网络请求推送到TasksManager异步同步到服务器
20
- * 5. 同步成功 → 网络请求成功后,isSynced设为true
21
- * 6. 自动重试 → TasksManager自动重试失败的网络请求,直到isSynced为true
22
- *
23
- * 数据状态说明:
24
- * - PaymentStatus.Processing: 订单正在进行支付操作
25
- * - PaymentStatus.PartiallyPaid + isSynced=false: 部分支付完成,等待服务器同步
26
- * - PaymentStatus.PartiallyPaid + isSynced=true: 部分支付且已同步到服务器
27
- * - PaymentStatus.Finished + isSynced=false: 本地支付完成,等待服务器同步
28
- * - PaymentStatus.Finished + isSynced=true: 支付完成且已同步到服务器
29
- *
30
- * 这种设计的优势:
31
- * - 即时反馈:支付操作后立即显示完成状态,用户体验更佳
32
- * - 离线支持:即使网络断开也能正常操作,数据保存在本地
33
- * - 同步追踪:通过isSynced清楚知道哪些数据还未同步到服务器
34
- * - 自动重试:TasksManager会自动重试失败的网络请求
35
- * - 异步处理:不阻塞用户界面,网络同步在后台进行
36
- * - 数据一致性:通过事件系统确保数据状态同步
37
- */
3
+ import { Payment, PaymentModuleAPI, PaymentMethod, PaymentStatus } from './types';
38
4
  export declare class PaymentModule extends BaseModule implements Module, PaymentModuleAPI {
39
5
  protected defaultName: string;
40
6
  protected defaultVersion: string;
41
- private request;
42
- private app;
43
- private store;
44
- private dbManager;
45
- private logger;
46
- cash: CashPayment;
47
- eftpos: EftposPayment;
48
- wallet: WalletPayment;
7
+ private state;
49
8
  constructor(name?: string, version?: string);
50
- initialize(core: PisellCore, options: ModuleOptions): Promise<void>;
51
- /**
52
- * 记录信息日志
53
- */
54
- private logInfo;
55
- /**
56
- * 记录警告日志
57
- */
58
- private logWarning;
59
- /**
60
- * 记录错误日志
61
- */
62
- private logError;
63
- /**
64
- * 记录调试日志
65
- */
66
- private logDebug;
67
- /**
68
- * 网络恢复以后,尝试执行队列
69
- *
70
- */
71
- private registerNetworkHandlers;
72
- /**
73
- * 获取支付方式列表
74
- */
75
- getPayMethodListAsync(): Promise<PaymentMethod[]>;
76
- /**
77
- * 后台刷新支付方式列表
78
- */
79
- private refreshPaymentMethodsInBackground;
80
- /**
81
- * 检查支付方式列表是否有变化
82
- */
83
- private hasPaymentMethodsChanged;
84
- /**
85
- * 获取订单列表
86
- */
87
- getOrderListAsync(): Promise<PaymentOrder[]>;
88
- /**
89
- * 根据订单UUID获取支付订单(新方法)
90
- */
91
- getPaymentOrderByUuidAsync(orderUuid: string): Promise<PaymentOrder | null>;
92
- /**
93
- * 创建支付订单(新方法,专注支付数据)
94
- */
95
- createPaymentOrderAsync(params: PushOrderParams): Promise<PaymentOrder>;
96
- /**
97
- * 往交易组中添加订单(兼容性方法)
98
- * @deprecated 使用 createPaymentOrderAsync 替代
99
- */
100
- pushOrderAsync(params: PushOrderParams): Promise<PaymentOrder>;
101
- /**
102
- * 删除支付订单(新方法)
103
- */
104
- deletePaymentOrderAsync(orderUuid: string): Promise<void>;
105
- /**
106
- * 删除订单(兼容性方法)
107
- * @deprecated 使用 deletePaymentOrderAsync 替代
108
- */
109
- deleteOrderAsync(orderUuid: string): Promise<void>;
110
- /**
111
- * 更新订单
112
- */
113
- updateOrderAsync(orderUuid: string, params: Partial<PaymentOrder>): Promise<void>;
114
- /**
115
- * 基于UUID替换订单ID
116
- *
117
- * 此方法用于将本地虚拟订单ID替换为真实的订单ID。
118
- * 当前端模拟下单流程完成后,后端返回真实订单ID时调用此方法。
119
- *
120
- * @param orderUuid 订单的UUID
121
- * @param newOrderId 新的订单ID (来自后端)
122
- * @returns 更新后的订单对象,如果订单不存在则返回null
123
- */
124
- replaceOrderIdByUuidAsync(orderUuid: string, newOrderId: string): Promise<PaymentOrder | null>;
125
- /**
126
- * 获取支付项(新方法)
127
- */
128
- getPaymentItemsAsync(orderUuid: string): Promise<PaymentItem[]>;
129
- /**
130
- * 获取支付项(兼容性方法)
131
- * @deprecated 使用 getPaymentItemsAsync 替代
132
- */
133
- getPaymentAsync(orderUuid: string): Promise<PaymentItem[]>;
134
- /**
135
- * 为某个订单添加支付项(新方法)
136
- */
137
- addPaymentItemAsync(orderUuid: string, paymentItem: PaymentItemInput): Promise<void>;
138
- /**
139
- * 为某个订单设置一个支付项(兼容性方法)
140
- * @deprecated 使用 addPaymentItemAsync 替代
141
- */
142
- pushPaymentAsync(orderUuid: string, paymentItem: PaymentItemInput): Promise<void>;
143
- /**
144
- * 删除一个支付项
145
- */
146
- deletePaymentAsync(orderUuid: string, paymentUuid: string): Promise<void>;
147
- /**
148
- * 更新一个支付项
149
- */
150
- updatePaymentAsync(orderUuid: string, paymentUuid: string, params: PaymentUpdateFields): Promise<void>;
151
- /**
152
- * 提交支付
153
- */
154
- submitPayAsync(orderUuid?: string): Promise<{
155
- status: 'success' | 'failed';
156
- }>;
157
- /**
158
- * 提交单个订单的支付(推送到任务队列)
159
- */
160
- private submitSingleOrderPayment;
161
- /**
162
- * 添加到同步任务队列
163
- */
164
- private addToSyncQueue;
165
- /**
166
- * 获取订单剩余待付金额
167
- */
168
- getRemainingOrderAmountAsync(orderUuid: string): Promise<number>;
169
- /**
170
- * 在比如现金支付界面的地方,用户输入了一个金额,在下方显示剩余多少金额,通过此方法获取
171
- */
172
- getRemainingOrderAmountWithInputAsync(inputAmount: string | number, orderUuid: string): Promise<number>;
173
- /**
174
- * 重新计算订单金额
175
- */
176
- private recalculateOrderAmount;
177
- /**
178
- * 获取现金支付方式
179
- */
180
- getCashPaymentMethod(): Promise<PaymentMethod | null>;
181
- /**
182
- * 获取Eftpos支付方式
183
- */
184
- getEftposPaymentMethod(): Promise<PaymentMethod | null>;
185
- /**
186
- * 获取钱包支付方式
187
- */
188
- getWalletPaymentMethod(): Promise<PaymentMethod | null>;
189
- /**
190
- * 注册任务处理函数
191
- */
192
- private registerTaskHandlers;
193
- /**
194
- * 静态方法:处理支付同步任务(后台网络同步)
195
- * 这个方法里不允许用 this,因为需要作为静态方法注入到任务队列里
196
- */
197
- static syncPaymentTask(payload: any): Promise<any>;
198
- /**
199
- * 确保支付模块所需的数据库表已创建
200
- */
201
- private ensurePaymentTables;
202
- /**
203
- * 获取部分支付的订单
204
- */
205
- getPartiallyPaidOrdersAsync(): Promise<PaymentOrder[]>;
206
- /**
207
- * 获取未同步到服务器的订单
208
- */
209
- getUnsyncedOrdersAsync(): Promise<PaymentOrder[]>;
210
- /**
211
- * 清理已完成且已同步的订单
212
- * 注意:只清理完全支付的订单,部分支付的订单保留以便继续支付
213
- */
214
- cleanupFinishedOrders(): Promise<void>;
215
- /**
216
- * 检测未同步的订单并重新加入任务队列
217
- *
218
- * 此方法专门用于处理因网络问题导致任务队列执行失败但队列被清空的情况。
219
- * 它会检查本地 IndexDB 中所有未同步的订单(isSynced: false),
220
- * 并将这些订单重新添加到任务队列中。
221
- *
222
- * 使用场景:
223
- * - 网络恢复后重新检查未同步的订单
224
- * - 应用启动时检查并重新排队未完成的支付
225
- * - 用户手动重试前的预检查
226
- *
227
- * @returns Promise<number> 返回重新加入队列的订单数量
228
- */
229
- recheckAndRequeueUnsyncedOrders(): Promise<number>;
230
- /**
231
- * 手动执行支付同步队列
232
- * 外部可以调用此方法来触发支付同步任务的执行
233
- *
234
- * 注意:此方法只执行现有队列中的任务,不会检查未同步的订单。
235
- * 如果需要检查未同步订单,请先调用 recheckAndRequeueUnsyncedOrders()
236
- *
237
- * 使用示例:
238
- * ```typescript
239
- * // 1. 先检查并重新排队未同步订单,然后执行队列
240
- * const requeuedCount = await paymentModule.recheckAndRequeueUnsyncedOrders();
241
- * if (requeuedCount > 0) {
242
- * await paymentModule.runPaymentSyncQueue();
243
- * }
244
- *
245
- * // 2. 或者直接执行现有队列(不检查未同步订单)
246
- * await paymentModule.runPaymentSyncQueue();
247
- * ```
248
- */
249
- runPaymentSyncQueue(): Promise<void>;
250
- /**
251
- * 重新将订单添加到同步队列
252
- * 用于处理因网络问题导致任务队列清空但订单未同步的情况
253
- *
254
- * @param order 要重新添加的订单
255
- * @returns Promise<boolean> 是否成功添加到队列
256
- */
257
- private reAddOrderToSyncQueue;
258
- /**
259
- * 删除支付项(新方法)
260
- */
261
- deletePaymentItemAsync(orderUuid: string, paymentUuid: string): Promise<void>;
262
- /**
263
- * 更新支付项(新方法)
264
- */
265
- updatePaymentItemAsync(orderUuid: string, paymentUuid: string, params: PaymentUpdateFields): Promise<void>;
266
- /**
267
- * 获取订单剩余待付金额(新方法)
268
- */
269
- getRemainingAmountAsync(orderUuid: string): Promise<number>;
270
- /**
271
- * 获取订单剩余待付金额(基于用户输入的金额)(新方法)
272
- */
273
- getRemainingAmountWithInputAsync(inputAmount: string | number, orderUuid: string): Promise<number>;
274
- /**
275
- * 提交支付(新方法)
276
- */
277
- submitPaymentAsync(orderUuid: string): Promise<{
278
- status: 'success' | 'failed';
279
- }>;
9
+ initialize(core: PisellCore, options?: ModuleOptions): Promise<void>;
10
+ processPayment(paymentId: string): Promise<void>;
11
+ getPayment(paymentId: string): Promise<Payment>;
12
+ getPaymentHistory(): Promise<Payment[]>;
13
+ refund(paymentId: string): Promise<void>;
14
+ getAvailablePaymentMethods(): PaymentMethod[];
15
+ checkPaymentStatus(paymentId: string): Promise<PaymentStatus>;
280
16
  }