@pisell/pisellos 2.1.3 → 2.1.5

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 (291) 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/Customer/constants.d.ts +7 -0
  10. package/dist/modules/Customer/constants.js +12 -0
  11. package/dist/modules/Customer/index.d.ts +122 -0
  12. package/dist/modules/Customer/index.js +697 -0
  13. package/dist/modules/Customer/types.d.ts +146 -0
  14. package/dist/modules/Customer/types.js +41 -0
  15. package/dist/modules/Date/index.d.ts +17 -0
  16. package/dist/modules/Date/index.js +92 -4
  17. package/dist/modules/Discount/index.d.ts +1 -0
  18. package/dist/modules/Order/index.d.ts +25 -1
  19. package/dist/modules/Order/index.js +224 -2
  20. package/dist/modules/Order/types.d.ts +45 -0
  21. package/dist/modules/Order/types.js +8 -0
  22. package/dist/modules/Payment/cash.d.ts +19 -0
  23. package/dist/modules/Payment/cash.js +97 -0
  24. package/dist/modules/Payment/cashRecommendationAlgorithm.d.ts +22 -0
  25. package/dist/modules/Payment/cashRecommendationAlgorithm.js +423 -0
  26. package/dist/modules/Payment/eftpos.d.ts +11 -0
  27. package/dist/modules/Payment/eftpos.js +80 -0
  28. package/dist/modules/Payment/index.d.ts +184 -9
  29. package/dist/modules/Payment/index.js +2012 -108
  30. package/dist/modules/Payment/mx51.d.ts +0 -0
  31. package/dist/modules/Payment/mx51.js +0 -0
  32. package/dist/modules/Payment/types.d.ts +750 -30
  33. package/dist/modules/Payment/types.js +236 -12
  34. package/dist/modules/Payment/utils.d.ts +17 -0
  35. package/dist/modules/Payment/utils.js +62 -0
  36. package/dist/modules/Payment/walletpass.d.ts +99 -0
  37. package/dist/modules/Payment/walletpass.js +701 -0
  38. package/dist/modules/Product/index.d.ts +1 -1
  39. package/dist/modules/ProductList/index.d.ts +12 -1
  40. package/dist/modules/ProductList/index.js +27 -3
  41. package/dist/modules/Rules/index.d.ts +2 -0
  42. package/dist/modules/Rules/index.js +39 -17
  43. package/dist/modules/Rules/types.d.ts +1 -0
  44. package/dist/modules/Schedule/index.d.ts +9 -0
  45. package/dist/modules/Schedule/index.js +68 -0
  46. package/dist/modules/index.d.ts +1 -0
  47. package/dist/modules/index.js +1 -0
  48. package/dist/plugins/app-types/app/app.d.ts +83 -0
  49. package/dist/plugins/app-types/app/const.d.ts +4 -0
  50. package/dist/plugins/app-types/app/index.d.ts +14 -0
  51. package/dist/plugins/app-types/applicationManager/application.d.ts +50 -0
  52. package/dist/plugins/app-types/applicationManager/index.d.ts +13 -0
  53. package/dist/plugins/app-types/config.d.ts +3 -0
  54. package/dist/plugins/app-types/cookie/index.d.ts +13 -0
  55. package/dist/plugins/app-types/data/index.d.ts +8 -0
  56. package/dist/plugins/app-types/history/config.d.ts +24 -0
  57. package/dist/plugins/app-types/history/index.d.ts +20 -0
  58. package/dist/plugins/app-types/history/type.d.ts +2 -0
  59. package/dist/plugins/app-types/hooks/index.d.ts +12 -0
  60. package/dist/plugins/app-types/hooks/useDelayedValue/index.d.ts +2 -0
  61. package/dist/plugins/app-types/hooks/useDispatch/index.d.ts +2 -0
  62. package/dist/plugins/app-types/hooks/useLowCode/index.d.ts +13 -0
  63. package/dist/plugins/app-types/hooks/useStore/index.d.ts +6 -0
  64. package/dist/plugins/app-types/index.d.ts +6 -0
  65. package/dist/plugins/app-types/indexDB/index.d.ts +178 -0
  66. package/dist/plugins/app-types/locales/en.d.ts +3 -0
  67. package/dist/plugins/app-types/locales/index.d.ts +37 -0
  68. package/dist/plugins/app-types/locales/original.d.ts +3 -0
  69. package/dist/plugins/app-types/locales/type.d.ts +19 -0
  70. package/dist/plugins/app-types/locales/zh-CN.d.ts +3 -0
  71. package/dist/plugins/app-types/locales/zh-HK.d.ts +3 -0
  72. package/dist/plugins/app-types/logger/feishu.d.ts +11 -0
  73. package/dist/plugins/app-types/logger/index.d.ts +122 -0
  74. package/dist/plugins/app-types/menuManager/hooks.d.ts +17 -0
  75. package/dist/plugins/app-types/menuManager/index.d.ts +28 -0
  76. package/dist/plugins/app-types/models/global.d.ts +32 -0
  77. package/dist/plugins/app-types/models/index.d.ts +45 -0
  78. package/dist/plugins/app-types/models/type.d.ts +2 -0
  79. package/dist/plugins/app-types/package.json +15 -0
  80. package/dist/plugins/app-types/plugin/index.d.ts +0 -0
  81. package/dist/plugins/app-types/pubsub/example.d.ts +5 -0
  82. package/dist/plugins/app-types/pubsub/index.d.ts +63 -0
  83. package/dist/plugins/app-types/request/cache.d.ts +46 -0
  84. package/dist/plugins/app-types/request/cancelToken.d.ts +38 -0
  85. package/dist/plugins/app-types/request/config.d.ts +3 -0
  86. package/dist/plugins/app-types/request/constants.d.ts +2 -0
  87. package/dist/plugins/app-types/request/index.d.ts +24 -0
  88. package/dist/plugins/app-types/request/pisell2Request.d.ts +6 -0
  89. package/dist/plugins/app-types/request/type.d.ts +41 -0
  90. package/dist/plugins/app-types/request/utils.d.ts +46 -0
  91. package/dist/plugins/app-types/routes/config.d.ts +7 -0
  92. package/dist/plugins/app-types/routes/index.d.ts +28 -0
  93. package/dist/plugins/app-types/socket/components/SocketMonitorPage.d.ts +6 -0
  94. package/dist/plugins/app-types/socket/components/index.d.ts +2 -0
  95. package/dist/plugins/app-types/socket/constants.d.ts +33 -0
  96. package/dist/plugins/app-types/socket/events.d.ts +31 -0
  97. package/dist/plugins/app-types/socket/heartbeat.d.ts +66 -0
  98. package/dist/plugins/app-types/socket/index.d.ts +61 -0
  99. package/dist/plugins/app-types/socket/monitor.d.ts +169 -0
  100. package/dist/plugins/app-types/socket/reconnect.d.ts +61 -0
  101. package/dist/plugins/app-types/socket/socket.d.ts +129 -0
  102. package/dist/plugins/app-types/socket/types.d.ts +85 -0
  103. package/dist/plugins/app-types/storage/index.d.ts +17 -0
  104. package/dist/plugins/app-types/tasks/index.d.ts +77 -0
  105. package/dist/plugins/app-types/tasks/type.d.ts +62 -0
  106. package/dist/plugins/app-types/tasks/useTasks.d.ts +5 -0
  107. package/dist/plugins/app-types/type.d.ts +2 -0
  108. package/dist/plugins/app-types/variables/VariablesProvider.d.ts +7 -0
  109. package/dist/plugins/app-types/variables/config.d.ts +3 -0
  110. package/dist/plugins/app-types/variables/index.d.ts +6 -0
  111. package/dist/plugins/app-types/variables/type.d.ts +2 -0
  112. package/dist/plugins/app-types/website/index.d.ts +6 -0
  113. package/dist/plugins/app.d.ts +8 -0
  114. package/dist/plugins/app.js +1 -0
  115. package/dist/plugins/window.d.ts +1 -0
  116. package/dist/solution/BookingByStep/index.d.ts +1 -1
  117. package/dist/solution/BookingByStep/index.js +1 -1
  118. package/dist/solution/BookingTicket/index.d.ts +180 -0
  119. package/dist/solution/BookingTicket/index.js +689 -0
  120. package/dist/solution/BookingTicket/types.d.ts +68 -0
  121. package/dist/solution/BookingTicket/types.js +43 -0
  122. package/dist/solution/BookingTicket/utils/scan/cloudSearch.d.ts +22 -0
  123. package/dist/solution/BookingTicket/utils/scan/cloudSearch.js +159 -0
  124. package/dist/solution/BookingTicket/utils/scan/handleScan.d.ts +22 -0
  125. package/dist/solution/BookingTicket/utils/scan/handleScan.js +189 -0
  126. package/dist/solution/BookingTicket/utils/scan/index.d.ts +81 -0
  127. package/dist/solution/BookingTicket/utils/scan/index.js +285 -0
  128. package/dist/solution/BookingTicket/utils/scan/scanCache.d.ts +78 -0
  129. package/dist/solution/BookingTicket/utils/scan/scanCache.js +305 -0
  130. package/dist/solution/Checkout/appointmentDemo.json +1 -0
  131. package/dist/solution/Checkout/index.d.ts +509 -0
  132. package/dist/solution/Checkout/index.js +4874 -0
  133. package/dist/solution/Checkout/types.d.ts +923 -0
  134. package/dist/solution/Checkout/types.js +148 -0
  135. package/dist/solution/Checkout/utils/index.d.ts +117 -0
  136. package/dist/solution/Checkout/utils/index.js +549 -0
  137. package/dist/solution/ShopDiscount/index.d.ts +4 -9
  138. package/dist/solution/ShopDiscount/index.js +106 -54
  139. package/dist/solution/ShopDiscount/types.d.ts +10 -1
  140. package/dist/solution/index.d.ts +2 -0
  141. package/dist/solution/index.js +3 -1
  142. package/dist/types/index.d.ts +3 -1
  143. package/dist/utils/task.d.ts +40 -0
  144. package/dist/utils/task.js +171 -0
  145. package/dist/utils/watch.d.ts +102 -0
  146. package/dist/utils/watch.js +294 -0
  147. package/lib/core/index.js +1 -1
  148. package/lib/effects/index.d.ts +4 -3
  149. package/lib/effects/index.js +4 -1
  150. package/lib/modules/AccountList/index.d.ts +7 -1
  151. package/lib/modules/AccountList/index.js +27 -0
  152. package/lib/modules/AccountList/types.d.ts +28 -0
  153. package/lib/modules/Cart/index.js +1 -1
  154. package/lib/modules/Customer/constants.d.ts +7 -0
  155. package/lib/modules/Customer/constants.js +39 -0
  156. package/lib/modules/Customer/index.d.ts +122 -0
  157. package/lib/modules/Customer/index.js +440 -0
  158. package/lib/modules/Customer/types.d.ts +146 -0
  159. package/lib/modules/Customer/types.js +37 -0
  160. package/lib/modules/Date/index.d.ts +17 -0
  161. package/lib/modules/Date/index.js +64 -0
  162. package/lib/modules/Discount/index.d.ts +1 -0
  163. package/lib/modules/Order/index.d.ts +25 -1
  164. package/lib/modules/Order/index.js +182 -0
  165. package/lib/modules/Order/types.d.ts +45 -0
  166. package/lib/modules/Payment/cash.d.ts +19 -0
  167. package/lib/modules/Payment/cash.js +64 -0
  168. package/lib/modules/Payment/cashRecommendationAlgorithm.d.ts +22 -0
  169. package/lib/modules/Payment/cashRecommendationAlgorithm.js +342 -0
  170. package/lib/modules/Payment/eftpos.d.ts +11 -0
  171. package/lib/modules/Payment/eftpos.js +51 -0
  172. package/lib/modules/Payment/index.d.ts +184 -9
  173. package/lib/modules/Payment/index.js +1044 -50
  174. package/lib/modules/Payment/mx51.d.ts +0 -0
  175. package/lib/modules/Payment/mx51.js +0 -0
  176. package/lib/modules/Payment/types.d.ts +750 -30
  177. package/lib/modules/Payment/types.js +79 -6
  178. package/lib/modules/Payment/utils.d.ts +17 -0
  179. package/lib/modules/Payment/utils.js +67 -0
  180. package/lib/modules/Payment/walletpass.d.ts +99 -0
  181. package/lib/modules/Payment/walletpass.js +468 -0
  182. package/lib/modules/Product/index.d.ts +1 -1
  183. package/lib/modules/ProductList/index.d.ts +12 -1
  184. package/lib/modules/ProductList/index.js +29 -2
  185. package/lib/modules/Rules/index.d.ts +2 -0
  186. package/lib/modules/Rules/index.js +32 -15
  187. package/lib/modules/Rules/types.d.ts +1 -0
  188. package/lib/modules/Schedule/index.d.ts +9 -0
  189. package/lib/modules/Schedule/index.js +51 -0
  190. package/lib/modules/index.d.ts +1 -0
  191. package/lib/modules/index.js +2 -0
  192. package/lib/plugins/app-types/app/app.d.ts +83 -0
  193. package/lib/plugins/app-types/app/const.d.ts +4 -0
  194. package/lib/plugins/app-types/app/index.d.ts +14 -0
  195. package/lib/plugins/app-types/applicationManager/application.d.ts +50 -0
  196. package/lib/plugins/app-types/applicationManager/index.d.ts +13 -0
  197. package/lib/plugins/app-types/config.d.ts +3 -0
  198. package/lib/plugins/app-types/cookie/index.d.ts +13 -0
  199. package/lib/plugins/app-types/data/index.d.ts +8 -0
  200. package/lib/plugins/app-types/history/config.d.ts +24 -0
  201. package/lib/plugins/app-types/history/index.d.ts +20 -0
  202. package/lib/plugins/app-types/history/type.d.ts +2 -0
  203. package/lib/plugins/app-types/hooks/index.d.ts +12 -0
  204. package/lib/plugins/app-types/hooks/useDelayedValue/index.d.ts +2 -0
  205. package/lib/plugins/app-types/hooks/useDispatch/index.d.ts +2 -0
  206. package/lib/plugins/app-types/hooks/useLowCode/index.d.ts +13 -0
  207. package/lib/plugins/app-types/hooks/useStore/index.d.ts +6 -0
  208. package/lib/plugins/app-types/index.d.ts +6 -0
  209. package/lib/plugins/app-types/indexDB/index.d.ts +178 -0
  210. package/lib/plugins/app-types/locales/en.d.ts +3 -0
  211. package/lib/plugins/app-types/locales/index.d.ts +37 -0
  212. package/lib/plugins/app-types/locales/original.d.ts +3 -0
  213. package/lib/plugins/app-types/locales/type.d.ts +19 -0
  214. package/lib/plugins/app-types/locales/zh-CN.d.ts +3 -0
  215. package/lib/plugins/app-types/locales/zh-HK.d.ts +3 -0
  216. package/lib/plugins/app-types/logger/feishu.d.ts +11 -0
  217. package/lib/plugins/app-types/logger/index.d.ts +122 -0
  218. package/lib/plugins/app-types/menuManager/hooks.d.ts +17 -0
  219. package/lib/plugins/app-types/menuManager/index.d.ts +28 -0
  220. package/lib/plugins/app-types/models/global.d.ts +32 -0
  221. package/lib/plugins/app-types/models/index.d.ts +45 -0
  222. package/lib/plugins/app-types/models/type.d.ts +2 -0
  223. package/lib/plugins/app-types/package.json +15 -0
  224. package/lib/plugins/app-types/plugin/index.d.ts +0 -0
  225. package/lib/plugins/app-types/pubsub/example.d.ts +5 -0
  226. package/lib/plugins/app-types/pubsub/index.d.ts +63 -0
  227. package/lib/plugins/app-types/request/cache.d.ts +46 -0
  228. package/lib/plugins/app-types/request/cancelToken.d.ts +38 -0
  229. package/lib/plugins/app-types/request/config.d.ts +3 -0
  230. package/lib/plugins/app-types/request/constants.d.ts +2 -0
  231. package/lib/plugins/app-types/request/index.d.ts +24 -0
  232. package/lib/plugins/app-types/request/pisell2Request.d.ts +6 -0
  233. package/lib/plugins/app-types/request/type.d.ts +41 -0
  234. package/lib/plugins/app-types/request/utils.d.ts +46 -0
  235. package/lib/plugins/app-types/routes/config.d.ts +7 -0
  236. package/lib/plugins/app-types/routes/index.d.ts +28 -0
  237. package/lib/plugins/app-types/socket/components/SocketMonitorPage.d.ts +6 -0
  238. package/lib/plugins/app-types/socket/components/index.d.ts +2 -0
  239. package/lib/plugins/app-types/socket/constants.d.ts +33 -0
  240. package/lib/plugins/app-types/socket/events.d.ts +31 -0
  241. package/lib/plugins/app-types/socket/heartbeat.d.ts +66 -0
  242. package/lib/plugins/app-types/socket/index.d.ts +61 -0
  243. package/lib/plugins/app-types/socket/monitor.d.ts +169 -0
  244. package/lib/plugins/app-types/socket/reconnect.d.ts +61 -0
  245. package/lib/plugins/app-types/socket/socket.d.ts +129 -0
  246. package/lib/plugins/app-types/socket/types.d.ts +85 -0
  247. package/lib/plugins/app-types/storage/index.d.ts +17 -0
  248. package/lib/plugins/app-types/tasks/index.d.ts +77 -0
  249. package/lib/plugins/app-types/tasks/type.d.ts +62 -0
  250. package/lib/plugins/app-types/tasks/useTasks.d.ts +5 -0
  251. package/lib/plugins/app-types/type.d.ts +2 -0
  252. package/lib/plugins/app-types/variables/VariablesProvider.d.ts +7 -0
  253. package/lib/plugins/app-types/variables/config.d.ts +3 -0
  254. package/lib/plugins/app-types/variables/index.d.ts +6 -0
  255. package/lib/plugins/app-types/variables/type.d.ts +2 -0
  256. package/lib/plugins/app-types/website/index.d.ts +6 -0
  257. package/lib/plugins/app.d.ts +8 -0
  258. package/lib/plugins/app.js +17 -0
  259. package/lib/plugins/window.d.ts +1 -0
  260. package/lib/solution/BookingByStep/index.d.ts +1 -1
  261. package/lib/solution/BookingByStep/index.js +1 -2
  262. package/lib/solution/BookingTicket/index.d.ts +180 -0
  263. package/lib/solution/BookingTicket/index.js +420 -0
  264. package/lib/solution/BookingTicket/types.d.ts +68 -0
  265. package/lib/solution/BookingTicket/types.js +72 -0
  266. package/lib/solution/BookingTicket/utils/scan/cloudSearch.d.ts +22 -0
  267. package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +117 -0
  268. package/lib/solution/BookingTicket/utils/scan/handleScan.d.ts +22 -0
  269. package/lib/solution/BookingTicket/utils/scan/handleScan.js +132 -0
  270. package/lib/solution/BookingTicket/utils/scan/index.d.ts +81 -0
  271. package/lib/solution/BookingTicket/utils/scan/index.js +210 -0
  272. package/lib/solution/BookingTicket/utils/scan/scanCache.d.ts +78 -0
  273. package/lib/solution/BookingTicket/utils/scan/scanCache.js +231 -0
  274. package/lib/solution/Checkout/appointmentDemo.json +1 -0
  275. package/lib/solution/Checkout/index.d.ts +509 -0
  276. package/lib/solution/Checkout/index.js +3002 -0
  277. package/lib/solution/Checkout/types.d.ts +923 -0
  278. package/lib/solution/Checkout/types.js +87 -0
  279. package/lib/solution/Checkout/utils/index.d.ts +117 -0
  280. package/lib/solution/Checkout/utils/index.js +403 -0
  281. package/lib/solution/ShopDiscount/index.d.ts +4 -9
  282. package/lib/solution/ShopDiscount/index.js +41 -13
  283. package/lib/solution/ShopDiscount/types.d.ts +10 -1
  284. package/lib/solution/index.d.ts +2 -0
  285. package/lib/solution/index.js +5 -1
  286. package/lib/types/index.d.ts +3 -1
  287. package/lib/utils/task.d.ts +40 -0
  288. package/lib/utils/task.js +109 -0
  289. package/lib/utils/watch.d.ts +102 -0
  290. package/lib/utils/watch.js +217 -0
  291. package/package.json +4 -2
@@ -0,0 +1,102 @@
1
+ /**
2
+ * 监听模块
3
+ *
4
+ */
5
+ export type WatchEventCallback = (...args: any[]) => void;
6
+ export type WatchEventItem = {
7
+ key: string;
8
+ callback: WatchEventCallback;
9
+ };
10
+ export interface WatchEventSubscription {
11
+ unsubscribe: () => void;
12
+ }
13
+ declare class Watch {
14
+ private events;
15
+ private enableListMap;
16
+ /**
17
+ * 订阅事件
18
+ * @param event 事件名称
19
+ * @param callback 回调函数
20
+ * @returns 订阅对象,可用于取消订阅
21
+ */
22
+ subscribe(watchKey: string, event: WatchEventItem): WatchEventSubscription;
23
+ /**
24
+ * 启用事件
25
+ * @param watchKey 监听的key
26
+ * @param event 事件名称
27
+ */
28
+ enableEvent(watchKey: string, eventKey: string): void;
29
+ /**
30
+ * 禁用某个事件
31
+ * @param watchKey 监听的key
32
+ * @param eventKey 事件名称
33
+ */
34
+ disableEvent(watchKey: string, eventKey: string): void;
35
+ /**
36
+ * 冻结某个监听下的所有事件
37
+ * @param watchKey 监听的key
38
+ */
39
+ disabledAllEventByWatchKey(watchKey: string): void;
40
+ /**
41
+ * 启用某个监听下的所有事件
42
+ * @param watchKey 监听的key
43
+ */
44
+ enableAllEventByWatchKey(watchKey: string): void;
45
+ /**
46
+ * 取消订阅事件
47
+ * @param event 事件名称
48
+ * @param callback 回调函数
49
+ * @returns 是否成功取消订阅
50
+ */
51
+ unsubscribe(watchKey: string, event: WatchEventItem): void;
52
+ /**
53
+ * 发布事件
54
+ * @param event 事件名称
55
+ * @param args 事件参数
56
+ */
57
+ publish(watchKey: string, ...args: any[]): void;
58
+ /**
59
+ * 根据事件名称发布事件
60
+ * @param watchKey 监听的key
61
+ * @param eventKey 事件名称
62
+ * @param args 事件参数
63
+ */
64
+ publishByEventKey(watchKey: string, eventKey: string, ...args: any[]): void;
65
+ /**
66
+ * 获取最后一个启用的事件
67
+ * @param watchKey 监听的key
68
+ * @returns 最后一个启用的事件
69
+ */
70
+ getLastEnableEventKey(watchKey: string): WatchEventItem['key'] | undefined;
71
+ /**
72
+ * 移除某个事件的所有订阅
73
+ * @param event 事件名称
74
+ * @returns 是否成功移除
75
+ */
76
+ clearEvent(watchKey: string): void;
77
+ /**
78
+ * 移除所有事件订阅
79
+ */
80
+ clearAllEvents(): void;
81
+ /**
82
+ * 获取事件的订阅数量
83
+ * @param event 事件名称
84
+ * @returns 订阅数量
85
+ */
86
+ getSubscriberCount(event: string): number;
87
+ /**
88
+ * 检查事件是否有订阅者
89
+ * @param event 事件名称
90
+ * @returns 是否有订阅者
91
+ */
92
+ hasSubscribers(event: string): boolean;
93
+ /**
94
+ * 一次性订阅事件,事件触发后自动取消订阅
95
+ * @param event 事件名称
96
+ * @param callback 回调函数
97
+ * @returns 订阅对象,可用于取消订阅
98
+ */
99
+ once(watchKey: string, event: WatchEventItem): WatchEventSubscription;
100
+ }
101
+ declare const watch: Watch;
102
+ export default watch;
@@ -0,0 +1,294 @@
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); }
2
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
3
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
4
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
5
+ 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; }
6
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
7
+ 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); }
8
+ /**
9
+ * 监听模块
10
+ *
11
+ */
12
+ var Watch = /*#__PURE__*/function () {
13
+ function Watch() {
14
+ _classCallCheck(this, Watch);
15
+ // 监听列表
16
+ _defineProperty(this, "events", new Map());
17
+ // 启用列表 - 使用数组保持顺序
18
+ _defineProperty(this, "enableListMap", new Map());
19
+ }
20
+ _createClass(Watch, [{
21
+ key: "subscribe",
22
+ value:
23
+ /**
24
+ * 订阅事件
25
+ * @param event 事件名称
26
+ * @param callback 回调函数
27
+ * @returns 订阅对象,可用于取消订阅
28
+ */
29
+ function subscribe(watchKey, event) {
30
+ var _this = this;
31
+ // 如果监听列表不存在,则创建
32
+ if (!this.events.has(watchKey)) {
33
+ this.events.set(watchKey, new Map());
34
+ }
35
+
36
+ // 获取监听列表
37
+ var callbacks = this.events.get(watchKey);
38
+ // 设置事件
39
+ callbacks.set(event.key, event.callback);
40
+
41
+ // 启用事件
42
+ this.enableEvent(watchKey, event.key);
43
+ return {
44
+ // 取消订阅
45
+ unsubscribe: function unsubscribe() {
46
+ // 取消订阅事件
47
+ _this.unsubscribe(watchKey, event);
48
+ }
49
+ };
50
+ }
51
+
52
+ /**
53
+ * 启用事件
54
+ * @param watchKey 监听的key
55
+ * @param event 事件名称
56
+ */
57
+ }, {
58
+ key: "enableEvent",
59
+ value: function enableEvent(watchKey, eventKey) {
60
+ // 获取启用列表
61
+ var enableList = this.enableListMap.get(watchKey);
62
+ // 如果启用列表存在,则添加事件
63
+ if (enableList) {
64
+ if (enableList.includes(eventKey)) {
65
+ return;
66
+ }
67
+ enableList.push(eventKey);
68
+ } else {
69
+ // 如果启用列表不存在,则创建启用列表
70
+ this.enableListMap.set(watchKey, [eventKey]);
71
+ }
72
+ }
73
+
74
+ /**
75
+ * 禁用某个事件
76
+ * @param watchKey 监听的key
77
+ * @param eventKey 事件名称
78
+ */
79
+ }, {
80
+ key: "disableEvent",
81
+ value: function disableEvent(watchKey, eventKey) {
82
+ // 获取启用列表
83
+ var enableList = this.enableListMap.get(watchKey);
84
+ if (enableList) {
85
+ // 找到当前事件的索引
86
+ var index = enableList.indexOf(eventKey);
87
+ if (index !== -1) {
88
+ // 删除当前事件以及之后的所有事件
89
+ enableList.splice(index);
90
+ }
91
+ }
92
+ }
93
+
94
+ /**
95
+ * 冻结某个监听下的所有事件
96
+ * @param watchKey 监听的key
97
+ */
98
+ }, {
99
+ key: "disabledAllEventByWatchKey",
100
+ value: function disabledAllEventByWatchKey(watchKey) {
101
+ // 设置启用列表为空
102
+ this.enableListMap.set(watchKey, []);
103
+ }
104
+
105
+ /**
106
+ * 启用某个监听下的所有事件
107
+ * @param watchKey 监听的key
108
+ */
109
+ }, {
110
+ key: "enableAllEventByWatchKey",
111
+ value: function enableAllEventByWatchKey(watchKey) {
112
+ var _this$events$get;
113
+ // 遍历当前监听下的所有事件, 并启用
114
+ this.enableListMap.set(watchKey, Array.from(((_this$events$get = this.events.get(watchKey)) === null || _this$events$get === void 0 ? void 0 : _this$events$get.keys()) || []));
115
+ }
116
+
117
+ /**
118
+ * 取消订阅事件
119
+ * @param event 事件名称
120
+ * @param callback 回调函数
121
+ * @returns 是否成功取消订阅
122
+ */
123
+ }, {
124
+ key: "unsubscribe",
125
+ value: function unsubscribe(watchKey, event) {
126
+ // 获取监听列表
127
+ var callbacks = this.events.get(watchKey);
128
+ // 如果监听列表不存在,则返回false
129
+ if (!callbacks) {
130
+ return;
131
+ }
132
+ // 禁用事件
133
+ this.disableEvent(watchKey, event.key);
134
+ // 删除事件
135
+ callbacks.delete(event.key);
136
+ return;
137
+ }
138
+
139
+ /**
140
+ * 发布事件
141
+ * @param event 事件名称
142
+ * @param args 事件参数
143
+ */
144
+ }, {
145
+ key: "publish",
146
+ value: function publish(watchKey) {
147
+ // 获取监听列表
148
+ var callbacks = this.events.get(watchKey);
149
+ // 如果监听列表不存在,则返回
150
+ if (!callbacks) {
151
+ return;
152
+ }
153
+
154
+ // 获取启用列表
155
+ var enableList = this.enableListMap.get(watchKey);
156
+ // 如果启用列表不存在,则返回
157
+ if (!enableList || enableList.length === 0) {
158
+ return;
159
+ }
160
+
161
+ // 只执行最后一个事件
162
+ var lastCallbackKey = enableList.at(-1);
163
+ // 如果最后一个事件存在,则执行
164
+ if (lastCallbackKey) {
165
+ try {
166
+ var _callbacks$get;
167
+ for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
168
+ args[_key - 1] = arguments[_key];
169
+ }
170
+ (_callbacks$get = callbacks.get(lastCallbackKey)) === null || _callbacks$get === void 0 || _callbacks$get.apply(void 0, args);
171
+ } catch (error) {
172
+ console.error("\u6267\u884C\u4E8B\u4EF6\"".concat(watchKey, "\"\u7684\u56DE\u8C03\u65F6\u51FA\u9519:"), error);
173
+ }
174
+ }
175
+ }
176
+
177
+ /**
178
+ * 根据事件名称发布事件
179
+ * @param watchKey 监听的key
180
+ * @param eventKey 事件名称
181
+ * @param args 事件参数
182
+ */
183
+ }, {
184
+ key: "publishByEventKey",
185
+ value: function publishByEventKey(watchKey, eventKey) {
186
+ var _callbacks$get2;
187
+ var callbacks = this.events.get(watchKey);
188
+ if (!callbacks) {
189
+ return;
190
+ }
191
+ for (var _len2 = arguments.length, args = new Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
192
+ args[_key2 - 2] = arguments[_key2];
193
+ }
194
+ (_callbacks$get2 = callbacks.get(eventKey)) === null || _callbacks$get2 === void 0 || _callbacks$get2.apply(void 0, args);
195
+ }
196
+
197
+ /**
198
+ * 获取最后一个启用的事件
199
+ * @param watchKey 监听的key
200
+ * @returns 最后一个启用的事件
201
+ */
202
+ }, {
203
+ key: "getLastEnableEventKey",
204
+ value: function getLastEnableEventKey(watchKey) {
205
+ var enableList = this.enableListMap.get(watchKey);
206
+ console.log('enableList', enableList);
207
+ if (!enableList) {
208
+ return undefined;
209
+ }
210
+ return enableList.at(-1) || undefined;
211
+ }
212
+
213
+ /**
214
+ * 移除某个事件的所有订阅
215
+ * @param event 事件名称
216
+ * @returns 是否成功移除
217
+ */
218
+ }, {
219
+ key: "clearEvent",
220
+ value: function clearEvent(watchKey) {
221
+ // 禁用所有事件
222
+ this.disabledAllEventByWatchKey(watchKey);
223
+ // 删除监听列表
224
+ this.events.delete(watchKey);
225
+ }
226
+
227
+ /**
228
+ * 移除所有事件订阅
229
+ */
230
+ }, {
231
+ key: "clearAllEvents",
232
+ value: function clearAllEvents() {
233
+ // 清空监听列表
234
+ this.events.clear();
235
+ // 清空启用列表
236
+ this.enableListMap.clear();
237
+ }
238
+
239
+ /**
240
+ * 获取事件的订阅数量
241
+ * @param event 事件名称
242
+ * @returns 订阅数量
243
+ */
244
+ }, {
245
+ key: "getSubscriberCount",
246
+ value: function getSubscriberCount(event) {
247
+ // 获取监听列表
248
+ var callbacks = this.events.get(event);
249
+ // 如果监听列表不存在,则返回0
250
+ return callbacks ? callbacks.size : 0;
251
+ }
252
+
253
+ /**
254
+ * 检查事件是否有订阅者
255
+ * @param event 事件名称
256
+ * @returns 是否有订阅者
257
+ */
258
+ }, {
259
+ key: "hasSubscribers",
260
+ value: function hasSubscribers(event) {
261
+ // 获取监听列表
262
+ return this.getSubscriberCount(event) > 0;
263
+ }
264
+
265
+ /**
266
+ * 一次性订阅事件,事件触发后自动取消订阅
267
+ * @param event 事件名称
268
+ * @param callback 回调函数
269
+ * @returns 订阅对象,可用于取消订阅
270
+ */
271
+ }, {
272
+ key: "once",
273
+ value: function once(watchKey, event) {
274
+ var _this2 = this;
275
+ // 包装回调函数
276
+ var wrappedCallback = function wrappedCallback() {
277
+ // 取消订阅
278
+ _this2.unsubscribe(watchKey, {
279
+ key: event.key,
280
+ callback: wrappedCallback
281
+ });
282
+ // 执行回调
283
+ event.callback.apply(event, arguments);
284
+ };
285
+ return this.subscribe(watchKey, {
286
+ key: event.key,
287
+ callback: wrappedCallback
288
+ });
289
+ }
290
+ }]);
291
+ return Watch;
292
+ }(); // 创建单例实例
293
+ var watch = new Watch();
294
+ export default watch;
package/lib/core/index.js CHANGED
@@ -61,7 +61,7 @@ var PisellOSCore = class {
61
61
  console.log(`${prefix} ${message}`);
62
62
  break;
63
63
  case "warn":
64
- console.warn(`${prefix} ${message}`);
64
+ console.log(`%c${prefix}%c ${message}`, "color: #f59e0b; font-weight: bold;", "color: #f59e0b;");
65
65
  break;
66
66
  case "error":
67
67
  console.error(`${prefix} ${message}`);
@@ -2,16 +2,17 @@ type EffectCallback = (payload: any) => void | Promise<void | {
2
2
  status: boolean;
3
3
  message?: string;
4
4
  }>;
5
+ type UnsubscribeFunction = () => void;
5
6
  declare class EffectsManager {
6
7
  private listeners;
7
- on(event: string, callback: EffectCallback): void;
8
+ on(event: string, callback: EffectCallback): UnsubscribeFunction;
8
9
  off(event: string, callback: EffectCallback): void;
9
10
  offByModuleDestroy(module: string): void;
10
- once(event: string, callback: EffectCallback): void;
11
+ once(event: string, callback: EffectCallback): UnsubscribeFunction;
11
12
  emit(event: string, payload: any): Promise<{
12
13
  status: boolean;
13
14
  data: any;
14
15
  }>;
15
16
  clear(): void;
16
17
  }
17
- export { EffectsManager };
18
+ export { EffectsManager, UnsubscribeFunction };
@@ -31,6 +31,9 @@ var EffectsManager = class {
31
31
  if (!this.listeners.has(event))
32
32
  this.listeners.set(event, /* @__PURE__ */ new Set());
33
33
  (_a = this.listeners.get(event)) == null ? void 0 : _a.add(callback);
34
+ return () => {
35
+ this.off(event, callback);
36
+ };
34
37
  }
35
38
  off(event, callback) {
36
39
  var _a;
@@ -49,7 +52,7 @@ var EffectsManager = class {
49
52
  await callback(payload);
50
53
  this.off(event, wrapper);
51
54
  };
52
- this.on(event, wrapper);
55
+ return this.on(event, wrapper);
53
56
  }
54
57
  async emit(event, payload) {
55
58
  const callbacks = this.listeners.get(event);
@@ -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 } from './types';
4
+ import { IFetchHolderAccountsParams, IHolder, IGetCustomerListParams } from './types';
5
5
  export declare class AccountListModule extends BaseModule implements Module {
6
6
  protected defaultName: string;
7
7
  protected defaultVersion: string;
@@ -37,6 +37,12 @@ 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>;
40
46
  /**
41
47
  * 获取holder类型账户列表
42
48
  * @param params
@@ -288,6 +288,33 @@ var AccountListModule = class extends import_BaseModule.BaseModule {
288
288
  );
289
289
  return accountModules;
290
290
  }
291
+ /**
292
+ * 获取客户列表
293
+ * @param params 查询参数
294
+ * @returns 客户列表
295
+ */
296
+ async getCustomerList(params = {}) {
297
+ const url = "/customer/es/data";
298
+ const { page = 1, pageSize = 20, keyword, ...otherParams } = params;
299
+ try {
300
+ this.store.isLoading = true;
301
+ this.store.error = null;
302
+ const queryParams = {
303
+ page,
304
+ pageSize,
305
+ ...keyword && { keyword },
306
+ ...otherParams
307
+ };
308
+ const res = await this.request.get(url, queryParams);
309
+ return (res == null ? void 0 : res.data) || [];
310
+ } catch (error) {
311
+ console.error("Failed to fetch customer list:", error);
312
+ this.store.error = error instanceof Error ? error.message : "Failed to fetch customer list";
313
+ throw error;
314
+ } finally {
315
+ this.store.isLoading = false;
316
+ }
317
+ }
291
318
  /**
292
319
  * 获取holder类型账户列表
293
320
  * @param params
@@ -67,3 +67,31 @@ 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
+ }
@@ -31,7 +31,7 @@ var import_utils2 = require("../Product/utils");
31
31
  __reExport(Cart_exports, require("./types"), module.exports);
32
32
  var CartModule = class extends import_BaseModule.BaseModule {
33
33
  constructor(name, version) {
34
- super(name, version);
34
+ super(name || "cart", version || "1.0.0");
35
35
  // 提供给 baseModule 用的默认名称 和 默认版本
36
36
  this.defaultName = "cart";
37
37
  this.defaultVersion = "1.0.0";
@@ -0,0 +1,7 @@
1
+ export declare const SORT_BY = "id";
2
+ export declare const DEFAULT_PAGE_SIZE = 20;
3
+ export declare const DEFAULT_CUSTOMER: {
4
+ id: number;
5
+ nickname: string;
6
+ name: string;
7
+ };
@@ -0,0 +1,39 @@
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/modules/Customer/constants.ts
20
+ var constants_exports = {};
21
+ __export(constants_exports, {
22
+ DEFAULT_CUSTOMER: () => DEFAULT_CUSTOMER,
23
+ DEFAULT_PAGE_SIZE: () => DEFAULT_PAGE_SIZE,
24
+ SORT_BY: () => SORT_BY
25
+ });
26
+ module.exports = __toCommonJS(constants_exports);
27
+ var SORT_BY = "id";
28
+ var DEFAULT_PAGE_SIZE = 20;
29
+ var DEFAULT_CUSTOMER = {
30
+ "id": 1,
31
+ "nickname": "Select a customer",
32
+ "name": "选择一个客户"
33
+ };
34
+ // Annotate the CommonJS export names for ESM import in node:
35
+ 0 && (module.exports = {
36
+ DEFAULT_CUSTOMER,
37
+ DEFAULT_PAGE_SIZE,
38
+ SORT_BY
39
+ });