@pisell/pisellos 3.0.55 → 3.0.57

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 (268) hide show
  1. package/dist/core/index.js +2 -1
  2. package/dist/effects/index.d.ts +4 -3
  3. package/dist/effects/index.js +15 -6
  4. package/dist/modules/AccountList/index.d.ts +7 -1
  5. package/dist/modules/AccountList/index.js +81 -14
  6. package/dist/modules/AccountList/types.d.ts +28 -0
  7. package/dist/modules/AccountList/types.js +8 -0
  8. package/dist/modules/Cart/index.js +1 -1
  9. package/dist/modules/Cart/utils/changePrice.d.ts +2 -2
  10. package/dist/modules/Cart/utils/changePrice.js +1 -1
  11. package/dist/modules/Customer/constants.d.ts +7 -0
  12. package/dist/modules/Customer/constants.js +12 -0
  13. package/dist/modules/Customer/index.d.ts +122 -0
  14. package/dist/modules/Customer/index.js +697 -0
  15. package/dist/modules/Customer/types.d.ts +146 -0
  16. package/dist/modules/Customer/types.js +41 -0
  17. package/dist/modules/Payment/cash.d.ts +11 -0
  18. package/dist/modules/Payment/cash.js +78 -0
  19. package/dist/modules/Payment/eftpos.d.ts +11 -0
  20. package/dist/modules/Payment/eftpos.js +80 -0
  21. package/dist/modules/Payment/index.d.ts +273 -9
  22. package/dist/modules/Payment/index.js +2525 -109
  23. package/dist/modules/Payment/types.d.ts +382 -30
  24. package/dist/modules/Payment/types.js +116 -14
  25. package/dist/modules/Payment/wallet.d.ts +11 -0
  26. package/dist/modules/Payment/wallet.js +78 -0
  27. package/dist/modules/Payment/walletpass.d.ts +0 -0
  28. package/dist/modules/Payment/walletpass.js +0 -0
  29. package/dist/modules/ProductList/index.d.ts +14 -3
  30. package/dist/modules/ProductList/index.js +58 -44
  31. package/dist/modules/ProductList/types.d.ts +0 -1
  32. package/dist/modules/Rules/index.js +27 -14
  33. package/dist/modules/Rules/types.d.ts +1 -0
  34. package/dist/modules/index.d.ts +1 -0
  35. package/dist/modules/index.js +1 -0
  36. package/dist/plugins/app-types/app/app.d.ts +83 -0
  37. package/dist/plugins/app-types/app/const.d.ts +4 -0
  38. package/dist/plugins/app-types/app/index.d.ts +14 -0
  39. package/dist/plugins/app-types/applicationManager/application.d.ts +50 -0
  40. package/dist/plugins/app-types/applicationManager/index.d.ts +13 -0
  41. package/dist/plugins/app-types/config.d.ts +3 -0
  42. package/dist/plugins/app-types/cookie/index.d.ts +13 -0
  43. package/dist/plugins/app-types/data/index.d.ts +8 -0
  44. package/dist/plugins/app-types/history/config.d.ts +24 -0
  45. package/dist/plugins/app-types/history/index.d.ts +20 -0
  46. package/dist/plugins/app-types/history/type.d.ts +2 -0
  47. package/dist/plugins/app-types/hooks/index.d.ts +12 -0
  48. package/dist/plugins/app-types/hooks/useDelayedValue/index.d.ts +2 -0
  49. package/dist/plugins/app-types/hooks/useDispatch/index.d.ts +2 -0
  50. package/dist/plugins/app-types/hooks/useLowCode/index.d.ts +13 -0
  51. package/dist/plugins/app-types/hooks/useStore/index.d.ts +6 -0
  52. package/dist/plugins/app-types/index.d.ts +6 -0
  53. package/dist/plugins/app-types/indexDB/index.d.ts +178 -0
  54. package/dist/plugins/app-types/locales/en.d.ts +3 -0
  55. package/dist/plugins/app-types/locales/index.d.ts +37 -0
  56. package/dist/plugins/app-types/locales/original.d.ts +3 -0
  57. package/dist/plugins/app-types/locales/type.d.ts +19 -0
  58. package/dist/plugins/app-types/locales/zh-CN.d.ts +3 -0
  59. package/dist/plugins/app-types/locales/zh-HK.d.ts +3 -0
  60. package/dist/plugins/app-types/logger/feishu.d.ts +11 -0
  61. package/dist/plugins/app-types/logger/index.d.ts +122 -0
  62. package/dist/plugins/app-types/menuManager/hooks.d.ts +17 -0
  63. package/dist/plugins/app-types/menuManager/index.d.ts +28 -0
  64. package/dist/plugins/app-types/models/global.d.ts +32 -0
  65. package/dist/plugins/app-types/models/index.d.ts +45 -0
  66. package/dist/plugins/app-types/models/type.d.ts +2 -0
  67. package/dist/plugins/app-types/package.json +15 -0
  68. package/dist/plugins/app-types/plugin/index.d.ts +0 -0
  69. package/dist/plugins/app-types/pubsub/example.d.ts +5 -0
  70. package/dist/plugins/app-types/pubsub/index.d.ts +63 -0
  71. package/dist/plugins/app-types/request/cache.d.ts +46 -0
  72. package/dist/plugins/app-types/request/cancelToken.d.ts +38 -0
  73. package/dist/plugins/app-types/request/config.d.ts +3 -0
  74. package/dist/plugins/app-types/request/constants.d.ts +2 -0
  75. package/dist/plugins/app-types/request/index.d.ts +24 -0
  76. package/dist/plugins/app-types/request/pisell2Request.d.ts +6 -0
  77. package/dist/plugins/app-types/request/type.d.ts +41 -0
  78. package/dist/plugins/app-types/request/utils.d.ts +46 -0
  79. package/dist/plugins/app-types/routes/config.d.ts +7 -0
  80. package/dist/plugins/app-types/routes/index.d.ts +28 -0
  81. package/dist/plugins/app-types/socket/components/SocketMonitorPage.d.ts +6 -0
  82. package/dist/plugins/app-types/socket/components/index.d.ts +2 -0
  83. package/dist/plugins/app-types/socket/constants.d.ts +33 -0
  84. package/dist/plugins/app-types/socket/events.d.ts +31 -0
  85. package/dist/plugins/app-types/socket/heartbeat.d.ts +66 -0
  86. package/dist/plugins/app-types/socket/index.d.ts +61 -0
  87. package/dist/plugins/app-types/socket/monitor.d.ts +169 -0
  88. package/dist/plugins/app-types/socket/reconnect.d.ts +61 -0
  89. package/dist/plugins/app-types/socket/socket.d.ts +129 -0
  90. package/dist/plugins/app-types/socket/types.d.ts +85 -0
  91. package/dist/plugins/app-types/storage/index.d.ts +17 -0
  92. package/dist/plugins/app-types/tasks/index.d.ts +77 -0
  93. package/dist/plugins/app-types/tasks/type.d.ts +62 -0
  94. package/dist/plugins/app-types/tasks/useTasks.d.ts +5 -0
  95. package/dist/plugins/app-types/type.d.ts +2 -0
  96. package/dist/plugins/app-types/variables/VariablesProvider.d.ts +7 -0
  97. package/dist/plugins/app-types/variables/config.d.ts +3 -0
  98. package/dist/plugins/app-types/variables/index.d.ts +6 -0
  99. package/dist/plugins/app-types/variables/type.d.ts +2 -0
  100. package/dist/plugins/app-types/website/index.d.ts +6 -0
  101. package/dist/plugins/app.d.ts +8 -0
  102. package/dist/plugins/app.js +1 -0
  103. package/dist/plugins/window.d.ts +1 -0
  104. package/dist/solution/BookingByStep/index.js +59 -35
  105. package/dist/solution/BookingByStep/types.d.ts +3 -2
  106. package/dist/solution/BookingTicket/index.d.ts +172 -0
  107. package/dist/solution/BookingTicket/index.js +665 -0
  108. package/dist/solution/BookingTicket/types.d.ts +68 -0
  109. package/dist/solution/BookingTicket/types.js +43 -0
  110. package/dist/solution/BookingTicket/utils/scan/cloudSearch.d.ts +22 -0
  111. package/dist/solution/BookingTicket/utils/scan/cloudSearch.js +159 -0
  112. package/dist/solution/BookingTicket/utils/scan/handleScan.d.ts +16 -0
  113. package/dist/solution/BookingTicket/utils/scan/handleScan.js +174 -0
  114. package/dist/solution/BookingTicket/utils/scan/index.d.ts +81 -0
  115. package/dist/solution/BookingTicket/utils/scan/index.js +285 -0
  116. package/dist/solution/BookingTicket/utils/scan/scanCache.d.ts +78 -0
  117. package/dist/solution/BookingTicket/utils/scan/scanCache.js +305 -0
  118. package/dist/solution/BuyTickets/index.d.ts +2 -2
  119. package/dist/solution/BuyTickets/index.js +1 -1
  120. package/dist/solution/Checkout/appointmentDemo.json +1 -0
  121. package/dist/solution/Checkout/index.d.ts +181 -0
  122. package/dist/solution/Checkout/index.js +1596 -0
  123. package/dist/solution/Checkout/types.d.ts +550 -0
  124. package/dist/solution/Checkout/types.js +132 -0
  125. package/dist/solution/Checkout/utils/index.d.ts +73 -0
  126. package/dist/solution/Checkout/utils/index.js +371 -0
  127. package/dist/solution/ShopDiscount/index.js +4 -2
  128. package/dist/solution/index.d.ts +2 -0
  129. package/dist/solution/index.js +3 -1
  130. package/dist/types/index.d.ts +3 -1
  131. package/dist/utils/task.d.ts +40 -0
  132. package/dist/utils/task.js +171 -0
  133. package/dist/utils/watch.d.ts +102 -0
  134. package/dist/utils/watch.js +294 -0
  135. package/lib/core/index.js +1 -1
  136. package/lib/effects/index.d.ts +4 -3
  137. package/lib/effects/index.js +4 -1
  138. package/lib/modules/AccountList/index.d.ts +7 -1
  139. package/lib/modules/AccountList/index.js +27 -0
  140. package/lib/modules/AccountList/types.d.ts +28 -0
  141. package/lib/modules/Cart/index.js +1 -1
  142. package/lib/modules/Cart/utils/changePrice.d.ts +2 -2
  143. package/lib/modules/Cart/utils/changePrice.js +1 -1
  144. package/lib/modules/Customer/constants.d.ts +7 -0
  145. package/lib/modules/Customer/constants.js +39 -0
  146. package/lib/modules/Customer/index.d.ts +122 -0
  147. package/lib/modules/Customer/index.js +440 -0
  148. package/lib/modules/Customer/types.d.ts +146 -0
  149. package/lib/modules/Customer/types.js +37 -0
  150. package/lib/modules/Payment/cash.d.ts +11 -0
  151. package/lib/modules/Payment/cash.js +51 -0
  152. package/lib/modules/Payment/eftpos.d.ts +11 -0
  153. package/lib/modules/Payment/eftpos.js +51 -0
  154. package/lib/modules/Payment/index.d.ts +273 -9
  155. package/lib/modules/Payment/index.js +1285 -50
  156. package/lib/modules/Payment/types.d.ts +382 -30
  157. package/lib/modules/Payment/types.js +41 -6
  158. package/lib/modules/Payment/wallet.d.ts +11 -0
  159. package/lib/modules/Payment/wallet.js +51 -0
  160. package/lib/modules/Payment/walletpass.d.ts +0 -0
  161. package/lib/modules/Payment/walletpass.js +0 -0
  162. package/lib/modules/ProductList/index.d.ts +14 -3
  163. package/lib/modules/ProductList/index.js +42 -28
  164. package/lib/modules/ProductList/types.d.ts +0 -1
  165. package/lib/modules/Rules/index.js +20 -12
  166. package/lib/modules/Rules/types.d.ts +1 -0
  167. package/lib/modules/index.d.ts +1 -0
  168. package/lib/modules/index.js +2 -0
  169. package/lib/plugins/app-types/app/app.d.ts +83 -0
  170. package/lib/plugins/app-types/app/const.d.ts +4 -0
  171. package/lib/plugins/app-types/app/index.d.ts +14 -0
  172. package/lib/plugins/app-types/applicationManager/application.d.ts +50 -0
  173. package/lib/plugins/app-types/applicationManager/index.d.ts +13 -0
  174. package/lib/plugins/app-types/config.d.ts +3 -0
  175. package/lib/plugins/app-types/cookie/index.d.ts +13 -0
  176. package/lib/plugins/app-types/data/index.d.ts +8 -0
  177. package/lib/plugins/app-types/history/config.d.ts +24 -0
  178. package/lib/plugins/app-types/history/index.d.ts +20 -0
  179. package/lib/plugins/app-types/history/type.d.ts +2 -0
  180. package/lib/plugins/app-types/hooks/index.d.ts +12 -0
  181. package/lib/plugins/app-types/hooks/useDelayedValue/index.d.ts +2 -0
  182. package/lib/plugins/app-types/hooks/useDispatch/index.d.ts +2 -0
  183. package/lib/plugins/app-types/hooks/useLowCode/index.d.ts +13 -0
  184. package/lib/plugins/app-types/hooks/useStore/index.d.ts +6 -0
  185. package/lib/plugins/app-types/index.d.ts +6 -0
  186. package/lib/plugins/app-types/indexDB/index.d.ts +178 -0
  187. package/lib/plugins/app-types/locales/en.d.ts +3 -0
  188. package/lib/plugins/app-types/locales/index.d.ts +37 -0
  189. package/lib/plugins/app-types/locales/original.d.ts +3 -0
  190. package/lib/plugins/app-types/locales/type.d.ts +19 -0
  191. package/lib/plugins/app-types/locales/zh-CN.d.ts +3 -0
  192. package/lib/plugins/app-types/locales/zh-HK.d.ts +3 -0
  193. package/lib/plugins/app-types/logger/feishu.d.ts +11 -0
  194. package/lib/plugins/app-types/logger/index.d.ts +122 -0
  195. package/lib/plugins/app-types/menuManager/hooks.d.ts +17 -0
  196. package/lib/plugins/app-types/menuManager/index.d.ts +28 -0
  197. package/lib/plugins/app-types/models/global.d.ts +32 -0
  198. package/lib/plugins/app-types/models/index.d.ts +45 -0
  199. package/lib/plugins/app-types/models/type.d.ts +2 -0
  200. package/lib/plugins/app-types/package.json +15 -0
  201. package/lib/plugins/app-types/plugin/index.d.ts +0 -0
  202. package/lib/plugins/app-types/pubsub/example.d.ts +5 -0
  203. package/lib/plugins/app-types/pubsub/index.d.ts +63 -0
  204. package/lib/plugins/app-types/request/cache.d.ts +46 -0
  205. package/lib/plugins/app-types/request/cancelToken.d.ts +38 -0
  206. package/lib/plugins/app-types/request/config.d.ts +3 -0
  207. package/lib/plugins/app-types/request/constants.d.ts +2 -0
  208. package/lib/plugins/app-types/request/index.d.ts +24 -0
  209. package/lib/plugins/app-types/request/pisell2Request.d.ts +6 -0
  210. package/lib/plugins/app-types/request/type.d.ts +41 -0
  211. package/lib/plugins/app-types/request/utils.d.ts +46 -0
  212. package/lib/plugins/app-types/routes/config.d.ts +7 -0
  213. package/lib/plugins/app-types/routes/index.d.ts +28 -0
  214. package/lib/plugins/app-types/socket/components/SocketMonitorPage.d.ts +6 -0
  215. package/lib/plugins/app-types/socket/components/index.d.ts +2 -0
  216. package/lib/plugins/app-types/socket/constants.d.ts +33 -0
  217. package/lib/plugins/app-types/socket/events.d.ts +31 -0
  218. package/lib/plugins/app-types/socket/heartbeat.d.ts +66 -0
  219. package/lib/plugins/app-types/socket/index.d.ts +61 -0
  220. package/lib/plugins/app-types/socket/monitor.d.ts +169 -0
  221. package/lib/plugins/app-types/socket/reconnect.d.ts +61 -0
  222. package/lib/plugins/app-types/socket/socket.d.ts +129 -0
  223. package/lib/plugins/app-types/socket/types.d.ts +85 -0
  224. package/lib/plugins/app-types/storage/index.d.ts +17 -0
  225. package/lib/plugins/app-types/tasks/index.d.ts +77 -0
  226. package/lib/plugins/app-types/tasks/type.d.ts +62 -0
  227. package/lib/plugins/app-types/tasks/useTasks.d.ts +5 -0
  228. package/lib/plugins/app-types/type.d.ts +2 -0
  229. package/lib/plugins/app-types/variables/VariablesProvider.d.ts +7 -0
  230. package/lib/plugins/app-types/variables/config.d.ts +3 -0
  231. package/lib/plugins/app-types/variables/index.d.ts +6 -0
  232. package/lib/plugins/app-types/variables/type.d.ts +2 -0
  233. package/lib/plugins/app-types/website/index.d.ts +6 -0
  234. package/lib/plugins/app.d.ts +8 -0
  235. package/lib/plugins/app.js +17 -0
  236. package/lib/plugins/window.d.ts +1 -0
  237. package/lib/solution/BookingByStep/index.js +40 -29
  238. package/lib/solution/BookingByStep/types.d.ts +3 -2
  239. package/lib/solution/BookingTicket/index.d.ts +172 -0
  240. package/lib/solution/BookingTicket/index.js +399 -0
  241. package/lib/solution/BookingTicket/types.d.ts +68 -0
  242. package/lib/solution/BookingTicket/types.js +72 -0
  243. package/lib/solution/BookingTicket/utils/scan/cloudSearch.d.ts +22 -0
  244. package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +117 -0
  245. package/lib/solution/BookingTicket/utils/scan/handleScan.d.ts +16 -0
  246. package/lib/solution/BookingTicket/utils/scan/handleScan.js +125 -0
  247. package/lib/solution/BookingTicket/utils/scan/index.d.ts +81 -0
  248. package/lib/solution/BookingTicket/utils/scan/index.js +210 -0
  249. package/lib/solution/BookingTicket/utils/scan/scanCache.d.ts +78 -0
  250. package/lib/solution/BookingTicket/utils/scan/scanCache.js +231 -0
  251. package/lib/solution/BuyTickets/index.d.ts +2 -2
  252. package/lib/solution/BuyTickets/index.js +1 -1
  253. package/lib/solution/Checkout/appointmentDemo.json +1 -0
  254. package/lib/solution/Checkout/index.d.ts +181 -0
  255. package/lib/solution/Checkout/index.js +864 -0
  256. package/lib/solution/Checkout/types.d.ts +550 -0
  257. package/lib/solution/Checkout/types.js +75 -0
  258. package/lib/solution/Checkout/utils/index.d.ts +73 -0
  259. package/lib/solution/Checkout/utils/index.js +266 -0
  260. package/lib/solution/ShopDiscount/index.js +2 -1
  261. package/lib/solution/index.d.ts +2 -0
  262. package/lib/solution/index.js +5 -1
  263. package/lib/types/index.d.ts +3 -1
  264. package/lib/utils/task.d.ts +40 -0
  265. package/lib/utils/task.js +109 -0
  266. package/lib/utils/watch.d.ts +102 -0
  267. package/lib/utils/watch.js +217 -0
  268. package/package.json +4 -2
@@ -0,0 +1,231 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // src/solution/BookingTicket/utils/scan/scanCache.ts
20
+ var scanCache_exports = {};
21
+ __export(scanCache_exports, {
22
+ default: () => scanCache_default
23
+ });
24
+ module.exports = __toCommonJS(scanCache_exports);
25
+ var compressData = (data) => {
26
+ try {
27
+ if (data === void 0) {
28
+ return "undefined";
29
+ }
30
+ return JSON.stringify(data);
31
+ } catch (error) {
32
+ console.warn("数据压缩失败:", error);
33
+ return JSON.stringify(data);
34
+ }
35
+ };
36
+ var decompressData = (compressedData) => {
37
+ try {
38
+ if (compressedData === "undefined") {
39
+ return void 0;
40
+ }
41
+ return JSON.parse(compressedData);
42
+ } catch (error) {
43
+ console.warn("数据解压缩失败:", error);
44
+ return null;
45
+ }
46
+ };
47
+ var LRUCache = class {
48
+ constructor(maxSize = 100) {
49
+ this.head = null;
50
+ // 最久未使用的节点
51
+ this.tail = null;
52
+ // 最近使用的节点
53
+ this.keyMap = /* @__PURE__ */ new Map();
54
+ this.maxSize = maxSize;
55
+ }
56
+ /**
57
+ * 将节点移动到链表尾部(最近使用)
58
+ * @param node 要移动的节点
59
+ */
60
+ moveToTail(node) {
61
+ if (this.tail === node)
62
+ return;
63
+ if (node.prev) {
64
+ node.prev.next = node.next;
65
+ }
66
+ if (node.next) {
67
+ node.next.prev = node.prev;
68
+ }
69
+ if (this.head === node) {
70
+ this.head = node.next;
71
+ }
72
+ if (this.tail) {
73
+ this.tail.next = node;
74
+ }
75
+ node.prev = this.tail;
76
+ node.next = null;
77
+ this.tail = node;
78
+ if (!this.head) {
79
+ this.head = node;
80
+ }
81
+ }
82
+ /**
83
+ * 添加新节点到链表尾部
84
+ * @param key 缓存键
85
+ * @param compressedData 压缩后的数据
86
+ * @param timestamp 时间戳
87
+ */
88
+ addToTail(key, compressedData, timestamp) {
89
+ const oldTail = this.tail;
90
+ const node = {
91
+ key,
92
+ compressedData,
93
+ timestamp,
94
+ prev: oldTail,
95
+ // 使用保存的引用,避免循环引用
96
+ next: null
97
+ };
98
+ this.keyMap.set(key, node);
99
+ if (oldTail) {
100
+ oldTail.next = node;
101
+ }
102
+ this.tail = node;
103
+ if (!this.head) {
104
+ this.head = node;
105
+ }
106
+ return node;
107
+ }
108
+ /**
109
+ * 从链表中移除节点
110
+ * @param node 要移除的节点
111
+ */
112
+ removeNode(node) {
113
+ if (node.prev) {
114
+ node.prev.next = node.next;
115
+ }
116
+ if (node.next) {
117
+ node.next.prev = node.prev;
118
+ }
119
+ if (this.head === node) {
120
+ this.head = node.next;
121
+ }
122
+ if (this.tail === node) {
123
+ this.tail = node.prev;
124
+ }
125
+ this.keyMap.delete(node.key);
126
+ }
127
+ /**
128
+ * 移除最久未使用的节点(链表头部)
129
+ */
130
+ removeOldest() {
131
+ if (this.head) {
132
+ this.removeNode(this.head);
133
+ }
134
+ }
135
+ /**
136
+ * 设置缓存
137
+ * @param key 缓存键
138
+ * @param data 缓存数据
139
+ */
140
+ set(key, data) {
141
+ const compressedData = compressData(data);
142
+ const timestamp = Date.now();
143
+ const existingNode = this.keyMap.get(key);
144
+ if (existingNode) {
145
+ existingNode.compressedData = compressedData;
146
+ existingNode.timestamp = timestamp;
147
+ this.moveToTail(existingNode);
148
+ } else {
149
+ if (this.keyMap.size >= this.maxSize) {
150
+ this.removeOldest();
151
+ }
152
+ this.addToTail(key, compressedData, timestamp);
153
+ }
154
+ }
155
+ /**
156
+ * 获取缓存
157
+ * @param key 缓存键
158
+ * @returns 缓存数据或undefined
159
+ */
160
+ get(key) {
161
+ const node = this.keyMap.get(key);
162
+ if (node) {
163
+ const decompressedData = decompressData(node.compressedData);
164
+ if (decompressedData !== null) {
165
+ node.timestamp = Date.now();
166
+ this.moveToTail(node);
167
+ return decompressedData;
168
+ } else {
169
+ this.removeNode(node);
170
+ return void 0;
171
+ }
172
+ }
173
+ return void 0;
174
+ }
175
+ /**
176
+ * 检查是否存在缓存
177
+ * @param key 缓存键
178
+ * @returns 是否存在
179
+ */
180
+ has(key) {
181
+ return this.keyMap.has(key);
182
+ }
183
+ /**
184
+ * 清除所有缓存
185
+ */
186
+ clear() {
187
+ let current = this.head;
188
+ while (current) {
189
+ const next = current.next;
190
+ current.prev = null;
191
+ current.next = null;
192
+ current = next;
193
+ }
194
+ this.keyMap.clear();
195
+ this.head = null;
196
+ this.tail = null;
197
+ }
198
+ /**
199
+ * 获取缓存大小
200
+ * @returns 当前缓存数量
201
+ */
202
+ size() {
203
+ return this.keyMap.size;
204
+ }
205
+ /**
206
+ * 获取缓存统计信息
207
+ * @returns 缓存统计信息
208
+ */
209
+ getStats() {
210
+ return {
211
+ size: this.keyMap.size,
212
+ maxSize: this.maxSize,
213
+ usage: Math.round(this.keyMap.size / this.maxSize * 100)
214
+ };
215
+ }
216
+ /**
217
+ * 删除指定的缓存项
218
+ * @param key 要删除的缓存键
219
+ * @returns 是否删除成功
220
+ */
221
+ delete(key) {
222
+ const node = this.keyMap.get(key);
223
+ if (node) {
224
+ this.removeNode(node);
225
+ return true;
226
+ }
227
+ return false;
228
+ }
229
+ };
230
+ var scanCache = new LRUCache();
231
+ var scanCache_default = scanCache;
@@ -1,5 +1,5 @@
1
1
  import { Module, PisellCore } from '../../types';
2
- import { Product, ProductData } from '../../modules/';
2
+ import { ProductData } from '../../modules/';
3
3
  import { BaseModule } from '../../modules/BaseModule';
4
4
  export * from './types';
5
5
  export declare class BuyTicketsImpl extends BaseModule implements Module {
@@ -16,7 +16,7 @@ export declare class BuyTicketsImpl extends BaseModule implements Module {
16
16
  loadProductsByCategory(categoryId: number): Promise<void>;
17
17
  destroy(): Promise<void>;
18
18
  getProducts(): Promise<ProductData[]>;
19
- getProduct(id: number): Promise<Product>;
19
+ getProduct(id: number): Promise<ProductData>;
20
20
  listSubmit(data: Record<string, any>): Promise<{
21
21
  status: boolean;
22
22
  data: any;
@@ -98,7 +98,7 @@ var BuyTicketsImpl = class extends import_BaseModule.BaseModule {
98
98
  return mainProduct;
99
99
  if (otherProduct)
100
100
  return otherProduct;
101
- return Promise.reject("Not fund product for id: " + id);
101
+ throw new Error(`Product not found: ${id}`);
102
102
  }
103
103
  // 商品列表页提交
104
104
  async listSubmit(data) {
@@ -0,0 +1 @@
1
+ {"type":"appointment_booking","platform":"PC","sales_channel":"my_pisel","order_sales_channel":"online_store","bookings":[{"id":0,"number":1,"registration_type":"all","relation_products":[],"is_all":false,"product":{"num":1,"product_id":61170,"product_variant_id":0,"product_bundle":[],"product_option_item":[],"discount_list":[{"amount":100,"type":"good_pass","discount":{"resource_id":64523,"title":{"auto":"玄-商品券","original":"玄-商品券","en":null,"zh-CN":null,"zh-HK":null},"original_amount":100,"product_id":61170,"percent":"1.00"}}]},"sub_type":"minutes","duration":480,"like_status":"common","resources":[{"relation_type":"form","like_status":"common","form_id":35,"relation_id":40357,"capacity":1,"metadata":{"combined_resource":{"status":1,"resource_ids":[40262,40263]},"form_name":"桌台","resource_name":"组合资源测试table-0422-01"},"children":[{"relation_type":"form","like_status":"common","id":40262,"main_field":"A01(组合资源-小桌-4 人)","resourceType":"single","form_id":35,"relation_id":40262,"capacity":1,"metadata":{"combined_resource":null,"form_name":"桌台","resource_name":"A01(组合资源-小桌-4 人)"}},{"relation_type":"form","like_status":"common","id":40263,"main_field":"A02(组合资源-小桌-4 人)","resourceType":"single","form_id":35,"relation_id":40263,"capacity":0,"metadata":{"combined_resource":null,"form_name":"桌台","resource_name":"A02(组合资源-小桌-4 人)"}}]},{"relation_type":"form","like_status":"common","form_id":214,"relation_id":38350,"capacity":1,"metadata":{"combined_resource":null,"form_name":"校区2","resource_name":"West Campus"}}],"schedule_id":0,"start_date":"2025-08-22","start_time":"09:00","select_date":"2025-08-22","end_time":"17:00","end_date":"2025-08-22","metadata":{"account":{"id":13433,"username":"a a"},"capacity":[{"id":0,"value":1,"name":""}]},"holder":null,"relation_forms":[]}],"shop_note":"","schedule_date":"2025-08-22 09:00:00","is_deposit":0,"relation_products":[],"relation_forms":[]}
@@ -0,0 +1,181 @@
1
+ import { Module, PisellCore, ModuleOptions } from '../../types';
2
+ import { BaseModule } from '../../modules/BaseModule';
3
+ import { OrderModule } from '../../modules/Order';
4
+ import { PaymentModule } from '../../modules/Payment';
5
+ import { CheckoutModuleAPI, CheckoutStep, CheckoutInitParams, CreateLocalOrderParams, PlaceOrderParams, CreateOrderParams, ProcessPaymentParams, CheckoutStatusInfo, CheckoutSummary, CurrentOrderInfo } from './types';
6
+ import { PaymentOrder, PaymentMethod } from '../../modules/Payment/types';
7
+ export * from './types';
8
+ /**
9
+ * 结账解决方案实现
10
+ *
11
+ * 整合订单处理和支付功能,提供完整的结账流程管理。
12
+ * 支持多种支付方式,提供实时状态跟踪和错误处理。
13
+ */
14
+ export declare class CheckoutImpl extends BaseModule implements Module, CheckoutModuleAPI {
15
+ protected defaultName: string;
16
+ protected defaultVersion: string;
17
+ isSolution: boolean;
18
+ private request;
19
+ private store;
20
+ private otherParams;
21
+ constructor(name?: string, version?: string);
22
+ initialize(core: PisellCore, options: ModuleOptions): Promise<void>;
23
+ /**
24
+ * 初始化子模块
25
+ */
26
+ private initializeSubModules;
27
+ /**
28
+ * 设置支付模块事件监听
29
+ */
30
+ private setupPaymentEventListeners;
31
+ /**
32
+ * 初始化结账流程
33
+ */
34
+ initializeCheckoutAsync(params: CheckoutInitParams): Promise<void>;
35
+ /**
36
+ * 创建本地订单 (前端模拟下单流程)
37
+ *
38
+ * 此方法用于在前端模拟整个下单流程,创建一个本地的虚拟订单。
39
+ * 用户在购物车点击下单时,会把购物车参数传递给此方法,
40
+ * 方法会记录参数并创建本地虚拟订单,然后用 Payment 模块管理支付流程。
41
+ */
42
+ createLocalOrderAsync(params: CreateLocalOrderParams): Promise<PaymentOrder>;
43
+ /**
44
+ * 手动下单 (根据虚拟订单生成实际订单)
45
+ *
46
+ * 使用当前存储的本地订单数据调用 Order 模块创建真实订单
47
+ */
48
+ placeOrderAsync(params?: PlaceOrderParams): Promise<{
49
+ success: boolean;
50
+ orderId?: string;
51
+ error?: string;
52
+ }>;
53
+ /**
54
+ * 创建订单
55
+ */
56
+ createOrderAsync(params: CreateOrderParams): Promise<PaymentOrder>;
57
+ /**
58
+ * 处理支付
59
+ */
60
+ processPaymentAsync(params: ProcessPaymentParams): Promise<void>;
61
+ /**
62
+ * 完成结账
63
+ */
64
+ completeCheckoutAsync(): Promise<{
65
+ success: boolean;
66
+ orderId?: string;
67
+ }>;
68
+ /**
69
+ * 取消结账
70
+ */
71
+ cancelCheckoutAsync(): Promise<void>;
72
+ /**
73
+ * 获取结账状态
74
+ */
75
+ getCheckoutStatus(): CheckoutStatusInfo;
76
+ /**
77
+ * 获取结账摘要
78
+ */
79
+ getCheckoutSummaryAsync(): Promise<CheckoutSummary>;
80
+ /**
81
+ * 获取可用支付方式
82
+ */
83
+ getAvailablePaymentMethodsAsync(): Promise<PaymentMethod[]>;
84
+ /**
85
+ * 刷新支付方式缓存
86
+ *
87
+ * 强制重新从服务器获取支付方式列表,更新本地缓存
88
+ */
89
+ refreshPaymentMethodsAsync(): Promise<PaymentMethod[]>;
90
+ /**
91
+ * 获取当前订单基础信息
92
+ *
93
+ * 返回当前订单的基础信息,包括订单状态、金额、支付状态等
94
+ */
95
+ getCurrentOrderInfo(): CurrentOrderInfo | null;
96
+ /**
97
+ * 验证结账前置条件
98
+ */
99
+ validateCheckoutAsync(): Promise<{
100
+ valid: boolean;
101
+ errors: string[];
102
+ }>;
103
+ /**
104
+ * 重试失败的操作
105
+ */
106
+ retryFailedOperationAsync(): Promise<void>;
107
+ /**
108
+ * 设置当前步骤
109
+ */
110
+ setCurrentStep(step: CheckoutStep): void;
111
+ /**
112
+ * 获取订单模块
113
+ */
114
+ getOrderModule(): OrderModule;
115
+ /**
116
+ * 获取支付模块
117
+ */
118
+ getPaymentModule(): PaymentModule;
119
+ /**
120
+ * 替换本地订单ID为真实订单ID
121
+ *
122
+ * 当后端订单创建完成后,调用此方法将本地虚拟订单ID替换为真实订单ID
123
+ *
124
+ * @param newOrderId 后端返回的真实订单ID
125
+ * @returns 更新后的订单对象,如果当前没有订单则返回null
126
+ */
127
+ replaceLocalOrderIdAsync(newOrderId: string): Promise<PaymentOrder | null>;
128
+ /**
129
+ * 设置状态
130
+ */
131
+ private setStatus;
132
+ /**
133
+ * 设置步骤
134
+ */
135
+ private setStep;
136
+ /**
137
+ * 处理错误
138
+ */
139
+ private handleError;
140
+ /**
141
+ * 处理支付成功
142
+ */
143
+ private handlePaymentSuccess;
144
+ /**
145
+ * 处理支付错误
146
+ */
147
+ private handlePaymentError;
148
+ /**
149
+ * 验证结账参数
150
+ */
151
+ private validateCheckoutParams;
152
+ /**
153
+ * 验证本地订单数据
154
+ */
155
+ private validateLocalOrderData;
156
+ /**
157
+ * 生成本地订单ID
158
+ */
159
+ private generateLocalOrderId;
160
+ /**
161
+ * 从购物车小计数据中提取金额信息
162
+ */
163
+ private extractAmountFromCartSummary;
164
+ /**
165
+ * 预加载支付方式(在初始化时调用)
166
+ */
167
+ private preloadPaymentMethods;
168
+ /**
169
+ * 计算总金额
170
+ */
171
+ private calculateTotalAmount;
172
+ /**
173
+ * 计算已支付金额
174
+ */
175
+ private calculatePaidAmount;
176
+ /**
177
+ * 获取状态消息
178
+ */
179
+ private getStatusMessage;
180
+ destroy(): Promise<void>;
181
+ }