@pisell/pisellos 3.0.74 → 3.0.76

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 (319) hide show
  1. package/dist/core/index.js +2 -1
  2. package/dist/effects/index.d.ts +5 -3
  3. package/dist/effects/index.js +40 -8
  4. package/dist/modules/Account/index.js +2 -3
  5. package/dist/modules/AccountList/index.d.ts +7 -1
  6. package/dist/modules/AccountList/index.js +81 -14
  7. package/dist/modules/AccountList/types.d.ts +28 -0
  8. package/dist/modules/AccountList/types.js +8 -0
  9. package/dist/modules/BaseModule.d.ts +3 -0
  10. package/dist/modules/BaseModule.js +15 -0
  11. package/dist/modules/Cart/index.d.ts +1 -0
  12. package/dist/modules/Cart/index.js +2 -1
  13. package/dist/modules/Cart/utils/cartProduct.js +21 -4
  14. package/dist/modules/Customer/constants.d.ts +7 -0
  15. package/dist/modules/Customer/constants.js +12 -0
  16. package/dist/modules/Customer/index.d.ts +122 -0
  17. package/dist/modules/Customer/index.js +696 -0
  18. package/dist/modules/Customer/types.d.ts +146 -0
  19. package/dist/modules/Customer/types.js +41 -0
  20. package/dist/modules/Discount/index.d.ts +1 -0
  21. package/dist/modules/Discount/index.js +3 -3
  22. package/dist/modules/Discount/types.d.ts +9 -0
  23. package/dist/modules/Guests/index.js +9 -9
  24. package/dist/modules/Order/index.d.ts +25 -1
  25. package/dist/modules/Order/index.js +224 -3
  26. package/dist/modules/Order/types.d.ts +45 -0
  27. package/dist/modules/Order/types.js +8 -0
  28. package/dist/modules/Order/utils.js +1 -1
  29. package/dist/modules/Payment/cash.d.ts +19 -0
  30. package/dist/modules/Payment/cash.js +97 -0
  31. package/dist/modules/Payment/cashRecommendationAlgorithm.d.ts +22 -0
  32. package/dist/modules/Payment/cashRecommendationAlgorithm.js +423 -0
  33. package/dist/modules/Payment/eftpos.d.ts +11 -0
  34. package/dist/modules/Payment/eftpos.js +80 -0
  35. package/dist/modules/Payment/index.d.ts +184 -9
  36. package/dist/modules/Payment/index.js +2084 -109
  37. package/dist/modules/Payment/mx51.d.ts +0 -0
  38. package/dist/modules/Payment/mx51.js +0 -0
  39. package/dist/modules/Payment/types.d.ts +772 -30
  40. package/dist/modules/Payment/types.js +236 -12
  41. package/dist/modules/Payment/utils.d.ts +17 -0
  42. package/dist/modules/Payment/utils.js +62 -0
  43. package/dist/modules/Payment/walletpass.d.ts +99 -0
  44. package/dist/modules/Payment/walletpass.js +711 -0
  45. package/dist/modules/ProductList/index.d.ts +12 -1
  46. package/dist/modules/ProductList/index.js +37 -15
  47. package/dist/modules/Resource/index.js +1 -1
  48. package/dist/modules/Rules/index.d.ts +2 -1
  49. package/dist/modules/Rules/index.js +470 -127
  50. package/dist/modules/Rules/types.d.ts +1 -0
  51. package/dist/modules/Schedule/index.d.ts +9 -0
  52. package/dist/modules/Schedule/index.js +77 -0
  53. package/dist/modules/Summary/utils.d.ts +5 -0
  54. package/dist/modules/Summary/utils.js +36 -1
  55. package/dist/modules/index.d.ts +1 -0
  56. package/dist/modules/index.js +1 -0
  57. package/dist/plugins/app-types/app/app.d.ts +83 -0
  58. package/dist/plugins/app-types/app/const.d.ts +4 -0
  59. package/dist/plugins/app-types/app/index.d.ts +14 -0
  60. package/dist/plugins/app-types/applicationManager/application.d.ts +50 -0
  61. package/dist/plugins/app-types/applicationManager/index.d.ts +13 -0
  62. package/dist/plugins/app-types/config.d.ts +3 -0
  63. package/dist/plugins/app-types/cookie/index.d.ts +13 -0
  64. package/dist/plugins/app-types/data/index.d.ts +8 -0
  65. package/dist/plugins/app-types/history/config.d.ts +24 -0
  66. package/dist/plugins/app-types/history/index.d.ts +20 -0
  67. package/dist/plugins/app-types/history/type.d.ts +2 -0
  68. package/dist/plugins/app-types/hooks/index.d.ts +12 -0
  69. package/dist/plugins/app-types/hooks/useDelayedValue/index.d.ts +2 -0
  70. package/dist/plugins/app-types/hooks/useDispatch/index.d.ts +2 -0
  71. package/dist/plugins/app-types/hooks/useLowCode/index.d.ts +13 -0
  72. package/dist/plugins/app-types/hooks/useStore/index.d.ts +6 -0
  73. package/dist/plugins/app-types/index.d.ts +6 -0
  74. package/dist/plugins/app-types/indexDB/index.d.ts +178 -0
  75. package/dist/plugins/app-types/locales/en.d.ts +3 -0
  76. package/dist/plugins/app-types/locales/index.d.ts +37 -0
  77. package/dist/plugins/app-types/locales/original.d.ts +3 -0
  78. package/dist/plugins/app-types/locales/type.d.ts +19 -0
  79. package/dist/plugins/app-types/locales/zh-CN.d.ts +3 -0
  80. package/dist/plugins/app-types/locales/zh-HK.d.ts +3 -0
  81. package/dist/plugins/app-types/logger/feishu.d.ts +11 -0
  82. package/dist/plugins/app-types/logger/index.d.ts +122 -0
  83. package/dist/plugins/app-types/menuManager/hooks.d.ts +17 -0
  84. package/dist/plugins/app-types/menuManager/index.d.ts +28 -0
  85. package/dist/plugins/app-types/models/global.d.ts +32 -0
  86. package/dist/plugins/app-types/models/index.d.ts +45 -0
  87. package/dist/plugins/app-types/models/type.d.ts +2 -0
  88. package/dist/plugins/app-types/package.json +15 -0
  89. package/dist/plugins/app-types/plugin/index.d.ts +0 -0
  90. package/dist/plugins/app-types/pubsub/example.d.ts +5 -0
  91. package/dist/plugins/app-types/pubsub/index.d.ts +63 -0
  92. package/dist/plugins/app-types/request/cache.d.ts +46 -0
  93. package/dist/plugins/app-types/request/cancelToken.d.ts +38 -0
  94. package/dist/plugins/app-types/request/config.d.ts +3 -0
  95. package/dist/plugins/app-types/request/constants.d.ts +2 -0
  96. package/dist/plugins/app-types/request/index.d.ts +24 -0
  97. package/dist/plugins/app-types/request/pisell2Request.d.ts +6 -0
  98. package/dist/plugins/app-types/request/type.d.ts +41 -0
  99. package/dist/plugins/app-types/request/utils.d.ts +46 -0
  100. package/dist/plugins/app-types/routes/config.d.ts +7 -0
  101. package/dist/plugins/app-types/routes/index.d.ts +28 -0
  102. package/dist/plugins/app-types/socket/components/SocketMonitorPage.d.ts +6 -0
  103. package/dist/plugins/app-types/socket/components/index.d.ts +2 -0
  104. package/dist/plugins/app-types/socket/constants.d.ts +33 -0
  105. package/dist/plugins/app-types/socket/events.d.ts +31 -0
  106. package/dist/plugins/app-types/socket/heartbeat.d.ts +66 -0
  107. package/dist/plugins/app-types/socket/index.d.ts +61 -0
  108. package/dist/plugins/app-types/socket/monitor.d.ts +169 -0
  109. package/dist/plugins/app-types/socket/reconnect.d.ts +61 -0
  110. package/dist/plugins/app-types/socket/socket.d.ts +129 -0
  111. package/dist/plugins/app-types/socket/types.d.ts +85 -0
  112. package/dist/plugins/app-types/storage/index.d.ts +17 -0
  113. package/dist/plugins/app-types/tasks/index.d.ts +77 -0
  114. package/dist/plugins/app-types/tasks/type.d.ts +62 -0
  115. package/dist/plugins/app-types/tasks/useTasks.d.ts +5 -0
  116. package/dist/plugins/app-types/type.d.ts +2 -0
  117. package/dist/plugins/app-types/variables/VariablesProvider.d.ts +7 -0
  118. package/dist/plugins/app-types/variables/config.d.ts +3 -0
  119. package/dist/plugins/app-types/variables/index.d.ts +6 -0
  120. package/dist/plugins/app-types/variables/type.d.ts +2 -0
  121. package/dist/plugins/app-types/website/index.d.ts +6 -0
  122. package/dist/plugins/app.d.ts +8 -0
  123. package/dist/plugins/app.js +1 -0
  124. package/dist/plugins/window.d.ts +1 -0
  125. package/dist/solution/BookingByStep/index.js +43 -13
  126. package/dist/solution/BookingByStep/utils/capacity.js +1 -1
  127. package/dist/solution/BookingByStep/utils/products.d.ts +6 -0
  128. package/dist/solution/BookingByStep/utils/products.js +10 -0
  129. package/dist/solution/BookingTicket/index.d.ts +184 -0
  130. package/dist/solution/BookingTicket/index.js +698 -0
  131. package/dist/solution/BookingTicket/types.d.ts +68 -0
  132. package/dist/solution/BookingTicket/types.js +43 -0
  133. package/dist/solution/BookingTicket/utils/scan/cloudSearch.d.ts +22 -0
  134. package/dist/solution/BookingTicket/utils/scan/cloudSearch.js +159 -0
  135. package/dist/solution/BookingTicket/utils/scan/handleScan.d.ts +22 -0
  136. package/dist/solution/BookingTicket/utils/scan/handleScan.js +189 -0
  137. package/dist/solution/BookingTicket/utils/scan/index.d.ts +85 -0
  138. package/dist/solution/BookingTicket/utils/scan/index.js +294 -0
  139. package/dist/solution/BookingTicket/utils/scan/scanCache.d.ts +78 -0
  140. package/dist/solution/BookingTicket/utils/scan/scanCache.js +305 -0
  141. package/dist/solution/BuyTickets/index.js +7 -8
  142. package/dist/solution/Checkout/appointmentDemo.json +1 -0
  143. package/dist/solution/Checkout/index.d.ts +432 -0
  144. package/dist/solution/Checkout/index.js +4452 -0
  145. package/dist/solution/Checkout/types.d.ts +727 -0
  146. package/dist/solution/Checkout/types.js +104 -0
  147. package/dist/solution/Checkout/utils/index.d.ts +121 -0
  148. package/dist/solution/Checkout/utils/index.js +511 -0
  149. package/dist/solution/ShopDiscount/index.d.ts +10 -10
  150. package/dist/solution/ShopDiscount/index.js +111 -60
  151. package/dist/solution/ShopDiscount/types.d.ts +8 -0
  152. package/dist/solution/ShopDiscount/utils.d.ts +24 -0
  153. package/dist/solution/ShopDiscount/utils.js +135 -1
  154. package/dist/solution/index.d.ts +2 -0
  155. package/dist/solution/index.js +3 -1
  156. package/dist/types/index.d.ts +4 -1
  157. package/dist/utils/task.d.ts +40 -0
  158. package/dist/utils/task.js +171 -0
  159. package/dist/utils/watch.d.ts +102 -0
  160. package/dist/utils/watch.js +294 -0
  161. package/lib/core/index.js +1 -1
  162. package/lib/effects/index.d.ts +5 -3
  163. package/lib/effects/index.js +17 -1
  164. package/lib/modules/Account/index.js +2 -3
  165. package/lib/modules/AccountList/index.d.ts +7 -1
  166. package/lib/modules/AccountList/index.js +27 -0
  167. package/lib/modules/AccountList/types.d.ts +28 -0
  168. package/lib/modules/BaseModule.d.ts +3 -0
  169. package/lib/modules/BaseModule.js +9 -0
  170. package/lib/modules/Cart/index.d.ts +1 -0
  171. package/lib/modules/Cart/index.js +5 -2
  172. package/lib/modules/Cart/utils/cartProduct.js +22 -6
  173. package/lib/modules/Customer/constants.d.ts +7 -0
  174. package/lib/modules/Customer/constants.js +39 -0
  175. package/lib/modules/Customer/index.d.ts +122 -0
  176. package/lib/modules/Customer/index.js +439 -0
  177. package/lib/modules/Customer/types.d.ts +146 -0
  178. package/lib/modules/Customer/types.js +37 -0
  179. package/lib/modules/Discount/index.d.ts +1 -0
  180. package/lib/modules/Discount/index.js +3 -3
  181. package/lib/modules/Discount/types.d.ts +9 -0
  182. package/lib/modules/Guests/index.js +9 -9
  183. package/lib/modules/Order/index.d.ts +25 -1
  184. package/lib/modules/Order/index.js +186 -1
  185. package/lib/modules/Order/types.d.ts +45 -0
  186. package/lib/modules/Order/utils.js +1 -1
  187. package/lib/modules/Payment/cash.d.ts +19 -0
  188. package/lib/modules/Payment/cash.js +64 -0
  189. package/lib/modules/Payment/cashRecommendationAlgorithm.d.ts +22 -0
  190. package/lib/modules/Payment/cashRecommendationAlgorithm.js +342 -0
  191. package/lib/modules/Payment/eftpos.d.ts +11 -0
  192. package/lib/modules/Payment/eftpos.js +51 -0
  193. package/lib/modules/Payment/index.d.ts +184 -9
  194. package/lib/modules/Payment/index.js +1084 -51
  195. package/lib/modules/Payment/mx51.d.ts +0 -0
  196. package/lib/modules/Payment/mx51.js +0 -0
  197. package/lib/modules/Payment/types.d.ts +772 -30
  198. package/lib/modules/Payment/types.js +79 -6
  199. package/lib/modules/Payment/utils.d.ts +17 -0
  200. package/lib/modules/Payment/utils.js +67 -0
  201. package/lib/modules/Payment/walletpass.d.ts +99 -0
  202. package/lib/modules/Payment/walletpass.js +484 -0
  203. package/lib/modules/ProductList/index.d.ts +12 -1
  204. package/lib/modules/ProductList/index.js +31 -12
  205. package/lib/modules/Resource/index.js +1 -1
  206. package/lib/modules/Rules/index.d.ts +2 -1
  207. package/lib/modules/Rules/index.js +318 -72
  208. package/lib/modules/Rules/types.d.ts +1 -0
  209. package/lib/modules/Schedule/index.d.ts +9 -0
  210. package/lib/modules/Schedule/index.js +60 -0
  211. package/lib/modules/Summary/utils.d.ts +5 -0
  212. package/lib/modules/Summary/utils.js +27 -3
  213. package/lib/modules/index.d.ts +1 -0
  214. package/lib/modules/index.js +2 -0
  215. package/lib/plugins/app-types/app/app.d.ts +83 -0
  216. package/lib/plugins/app-types/app/const.d.ts +4 -0
  217. package/lib/plugins/app-types/app/index.d.ts +14 -0
  218. package/lib/plugins/app-types/applicationManager/application.d.ts +50 -0
  219. package/lib/plugins/app-types/applicationManager/index.d.ts +13 -0
  220. package/lib/plugins/app-types/config.d.ts +3 -0
  221. package/lib/plugins/app-types/cookie/index.d.ts +13 -0
  222. package/lib/plugins/app-types/data/index.d.ts +8 -0
  223. package/lib/plugins/app-types/history/config.d.ts +24 -0
  224. package/lib/plugins/app-types/history/index.d.ts +20 -0
  225. package/lib/plugins/app-types/history/type.d.ts +2 -0
  226. package/lib/plugins/app-types/hooks/index.d.ts +12 -0
  227. package/lib/plugins/app-types/hooks/useDelayedValue/index.d.ts +2 -0
  228. package/lib/plugins/app-types/hooks/useDispatch/index.d.ts +2 -0
  229. package/lib/plugins/app-types/hooks/useLowCode/index.d.ts +13 -0
  230. package/lib/plugins/app-types/hooks/useStore/index.d.ts +6 -0
  231. package/lib/plugins/app-types/index.d.ts +6 -0
  232. package/lib/plugins/app-types/indexDB/index.d.ts +178 -0
  233. package/lib/plugins/app-types/locales/en.d.ts +3 -0
  234. package/lib/plugins/app-types/locales/index.d.ts +37 -0
  235. package/lib/plugins/app-types/locales/original.d.ts +3 -0
  236. package/lib/plugins/app-types/locales/type.d.ts +19 -0
  237. package/lib/plugins/app-types/locales/zh-CN.d.ts +3 -0
  238. package/lib/plugins/app-types/locales/zh-HK.d.ts +3 -0
  239. package/lib/plugins/app-types/logger/feishu.d.ts +11 -0
  240. package/lib/plugins/app-types/logger/index.d.ts +122 -0
  241. package/lib/plugins/app-types/menuManager/hooks.d.ts +17 -0
  242. package/lib/plugins/app-types/menuManager/index.d.ts +28 -0
  243. package/lib/plugins/app-types/models/global.d.ts +32 -0
  244. package/lib/plugins/app-types/models/index.d.ts +45 -0
  245. package/lib/plugins/app-types/models/type.d.ts +2 -0
  246. package/lib/plugins/app-types/package.json +15 -0
  247. package/lib/plugins/app-types/plugin/index.d.ts +0 -0
  248. package/lib/plugins/app-types/pubsub/example.d.ts +5 -0
  249. package/lib/plugins/app-types/pubsub/index.d.ts +63 -0
  250. package/lib/plugins/app-types/request/cache.d.ts +46 -0
  251. package/lib/plugins/app-types/request/cancelToken.d.ts +38 -0
  252. package/lib/plugins/app-types/request/config.d.ts +3 -0
  253. package/lib/plugins/app-types/request/constants.d.ts +2 -0
  254. package/lib/plugins/app-types/request/index.d.ts +24 -0
  255. package/lib/plugins/app-types/request/pisell2Request.d.ts +6 -0
  256. package/lib/plugins/app-types/request/type.d.ts +41 -0
  257. package/lib/plugins/app-types/request/utils.d.ts +46 -0
  258. package/lib/plugins/app-types/routes/config.d.ts +7 -0
  259. package/lib/plugins/app-types/routes/index.d.ts +28 -0
  260. package/lib/plugins/app-types/socket/components/SocketMonitorPage.d.ts +6 -0
  261. package/lib/plugins/app-types/socket/components/index.d.ts +2 -0
  262. package/lib/plugins/app-types/socket/constants.d.ts +33 -0
  263. package/lib/plugins/app-types/socket/events.d.ts +31 -0
  264. package/lib/plugins/app-types/socket/heartbeat.d.ts +66 -0
  265. package/lib/plugins/app-types/socket/index.d.ts +61 -0
  266. package/lib/plugins/app-types/socket/monitor.d.ts +169 -0
  267. package/lib/plugins/app-types/socket/reconnect.d.ts +61 -0
  268. package/lib/plugins/app-types/socket/socket.d.ts +129 -0
  269. package/lib/plugins/app-types/socket/types.d.ts +85 -0
  270. package/lib/plugins/app-types/storage/index.d.ts +17 -0
  271. package/lib/plugins/app-types/tasks/index.d.ts +77 -0
  272. package/lib/plugins/app-types/tasks/type.d.ts +62 -0
  273. package/lib/plugins/app-types/tasks/useTasks.d.ts +5 -0
  274. package/lib/plugins/app-types/type.d.ts +2 -0
  275. package/lib/plugins/app-types/variables/VariablesProvider.d.ts +7 -0
  276. package/lib/plugins/app-types/variables/config.d.ts +3 -0
  277. package/lib/plugins/app-types/variables/index.d.ts +6 -0
  278. package/lib/plugins/app-types/variables/type.d.ts +2 -0
  279. package/lib/plugins/app-types/website/index.d.ts +6 -0
  280. package/lib/plugins/app.d.ts +8 -0
  281. package/lib/plugins/app.js +17 -0
  282. package/lib/plugins/window.d.ts +1 -0
  283. package/lib/solution/BookingByStep/index.js +18 -6
  284. package/lib/solution/BookingByStep/utils/capacity.js +1 -1
  285. package/lib/solution/BookingByStep/utils/products.d.ts +6 -0
  286. package/lib/solution/BookingByStep/utils/products.js +8 -2
  287. package/lib/solution/BookingTicket/index.d.ts +184 -0
  288. package/lib/solution/BookingTicket/index.js +426 -0
  289. package/lib/solution/BookingTicket/types.d.ts +68 -0
  290. package/lib/solution/BookingTicket/types.js +72 -0
  291. package/lib/solution/BookingTicket/utils/scan/cloudSearch.d.ts +22 -0
  292. package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +117 -0
  293. package/lib/solution/BookingTicket/utils/scan/handleScan.d.ts +22 -0
  294. package/lib/solution/BookingTicket/utils/scan/handleScan.js +132 -0
  295. package/lib/solution/BookingTicket/utils/scan/index.d.ts +85 -0
  296. package/lib/solution/BookingTicket/utils/scan/index.js +216 -0
  297. package/lib/solution/BookingTicket/utils/scan/scanCache.d.ts +78 -0
  298. package/lib/solution/BookingTicket/utils/scan/scanCache.js +231 -0
  299. package/lib/solution/BuyTickets/index.js +7 -8
  300. package/lib/solution/Checkout/appointmentDemo.json +1 -0
  301. package/lib/solution/Checkout/index.d.ts +432 -0
  302. package/lib/solution/Checkout/index.js +2776 -0
  303. package/lib/solution/Checkout/types.d.ts +727 -0
  304. package/lib/solution/Checkout/types.js +63 -0
  305. package/lib/solution/Checkout/utils/index.d.ts +121 -0
  306. package/lib/solution/Checkout/utils/index.js +362 -0
  307. package/lib/solution/ShopDiscount/index.d.ts +10 -10
  308. package/lib/solution/ShopDiscount/index.js +53 -27
  309. package/lib/solution/ShopDiscount/types.d.ts +8 -0
  310. package/lib/solution/ShopDiscount/utils.d.ts +24 -0
  311. package/lib/solution/ShopDiscount/utils.js +88 -1
  312. package/lib/solution/index.d.ts +2 -0
  313. package/lib/solution/index.js +5 -1
  314. package/lib/types/index.d.ts +4 -1
  315. package/lib/utils/task.d.ts +40 -0
  316. package/lib/utils/task.js +109 -0
  317. package/lib/utils/watch.d.ts +102 -0
  318. package/lib/utils/watch.js +217 -0
  319. package/package.json +3 -1
@@ -0,0 +1,129 @@
1
+ import { SocketOptions, SocketStatus } from "./types";
2
+ import { SocketMonitor, SocketMonitorOptions } from "./monitor";
3
+ /**
4
+ * Socket主类
5
+ * 负责管理WebSocket连接、消息收发、事件处理、心跳检测和断线重连
6
+ */
7
+ export declare class Socket {
8
+ private ws;
9
+ private url;
10
+ private options;
11
+ private status;
12
+ private eventHandlers;
13
+ private heartbeatManager;
14
+ private reconnectManager;
15
+ private monitor;
16
+ private messageIdCounter;
17
+ /**
18
+ * 创建Socket实例
19
+ * @param options Socket配置选项
20
+ */
21
+ constructor(options: SocketOptions);
22
+ /**
23
+ * 建立WebSocket连接
24
+ */
25
+ connect(): Promise<void>;
26
+ /**
27
+ * 关闭WebSocket连接
28
+ */
29
+ disconnect(): void;
30
+ /**
31
+ * 发送消息到服务器
32
+ * @param event 事件名称
33
+ * @param data 消息数据
34
+ * @param id 消息ID(可选,默认自动生成)
35
+ */
36
+ send(type: string, data?: any, id?: string): void;
37
+ /**
38
+ * 发送原始消息
39
+ * @param message 消息对象
40
+ */
41
+ private sendRaw;
42
+ /**
43
+ * 注册事件监听器
44
+ * @param event 事件名称
45
+ * @param handler 事件处理函数
46
+ */
47
+ on(event: string, handler: (...args: any[]) => void): void;
48
+ /**
49
+ * 移除事件监听器
50
+ * @param event 事件名称
51
+ * @param handler 事件处理函数(可选,不提供则移除所有该事件的处理函数)
52
+ */
53
+ off(event: string, handler?: (...args: any[]) => void): void;
54
+ /**
55
+ * 触发事件
56
+ * @param event 事件名称
57
+ * @param args 事件参数
58
+ */
59
+ private emit;
60
+ /**
61
+ * 获取当前连接状态
62
+ */
63
+ getStatus(): SocketStatus;
64
+ /**
65
+ * 获取当前状态描述
66
+ */
67
+ getStatusText(): string;
68
+ /**
69
+ * 检查是否已连接
70
+ */
71
+ isConnected(): boolean;
72
+ /**
73
+ * 设置连接状态
74
+ */
75
+ private setStatus;
76
+ /**
77
+ * 设置WebSocket事件监听器
78
+ */
79
+ private setupWebSocketListeners;
80
+ /**
81
+ * 处理接收到的消息
82
+ */
83
+ private handleMessage;
84
+ /**
85
+ * 处理连接关闭
86
+ */
87
+ private handleConnectionClosed;
88
+ /**
89
+ * 处理连接失败
90
+ */
91
+ private handleConnectionFailure;
92
+ /**
93
+ * 处理心跳响应
94
+ */
95
+ private handleHeartbeatResponse;
96
+ /**
97
+ * 初始化心跳检测
98
+ */
99
+ private initHeartbeat;
100
+ /**
101
+ * 初始化重连管理
102
+ */
103
+ private initReconnect;
104
+ /**
105
+ * 开始重连过程
106
+ */
107
+ private startReconnection;
108
+ /**
109
+ * 生成消息ID
110
+ */
111
+ private generateMessageId;
112
+ /**
113
+ * 启用监控功能
114
+ * @param options 监控配置选项
115
+ */
116
+ enableMonitoring(options?: SocketMonitorOptions): SocketMonitor;
117
+ /**
118
+ * 禁用监控功能
119
+ */
120
+ disableMonitoring(): void;
121
+ /**
122
+ * 获取监控器实例
123
+ */
124
+ getMonitor(): SocketMonitor | null;
125
+ /**
126
+ * 释放资源
127
+ */
128
+ destroy(): void;
129
+ }
@@ -0,0 +1,85 @@
1
+ /**
2
+ * Socket配置选项
3
+ */
4
+ export interface SocketOptions {
5
+ /** 是否自动连接 */
6
+ autoConnect?: boolean;
7
+ /** 是否启用重连功能 */
8
+ reconnection?: boolean;
9
+ /** 最大重连尝试次数,默认无限 */
10
+ reconnectionAttempts?: number;
11
+ /** 重连延迟时间(毫秒) */
12
+ reconnectionDelay?: number;
13
+ /** 最大重连延迟时间(毫秒) */
14
+ reconnectionDelayMax?: number;
15
+ /** 是否启用心跳检测 */
16
+ heartbeat?: boolean;
17
+ /** 心跳间隔时间(毫秒) */
18
+ heartbeatInterval?: number;
19
+ /** 请求超时时间(毫秒) */
20
+ timeout?: number;
21
+ /** 心跳超时时间(毫秒) */
22
+ heartbeatTimeout?: number;
23
+ /** 自定义协议 */
24
+ protocols?: string | string[];
25
+ /** 连接URL */
26
+ url: string;
27
+ }
28
+ /**
29
+ * Socket连接状态
30
+ */
31
+ export declare enum SocketStatus {
32
+ CONNECTING = 0,
33
+ OPEN = 1,
34
+ CLOSING = 2,
35
+ CLOSED = 3,
36
+ RECONNECTING = 4
37
+ }
38
+ /**
39
+ * Socket消息格式
40
+ */
41
+ export interface SocketMessage<T = any> {
42
+ /** 事件类型 */
43
+ type: string;
44
+ /** 消息数据 */
45
+ data?: T;
46
+ /** 消息ID */
47
+ id?: string;
48
+ event?: any;
49
+ }
50
+ /**
51
+ * 心跳配置选项
52
+ */
53
+ export interface HeartbeatOptions {
54
+ /** 心跳间隔时间(毫秒) */
55
+ interval: number;
56
+ /** 心跳超时时间(毫秒) */
57
+ timeout: number;
58
+ /** 心跳探测消息 */
59
+ message?: SocketMessage;
60
+ }
61
+ /**
62
+ * 重连配置选项
63
+ */
64
+ export interface ReconnectOptions {
65
+ /** 是否启用重连 */
66
+ enabled: boolean;
67
+ /** 最大重连尝试次数 */
68
+ attempts?: number;
69
+ /** 重连延迟时间(毫秒) */
70
+ delay: number;
71
+ /** 最大重连延迟时间(毫秒) */
72
+ delayMax?: number;
73
+ /** 是否使用指数退避算法 */
74
+ jitter?: boolean;
75
+ }
76
+ /**
77
+ * 事件处理函数类型
78
+ */
79
+ export type EventHandler = (...args: any[]) => void;
80
+ /**
81
+ * 事件处理函数映射
82
+ */
83
+ export interface EventHandlerMap {
84
+ [event: string]: EventHandler[];
85
+ }
@@ -0,0 +1,17 @@
1
+ import App from '../app';
2
+ export interface StorageOptions {
3
+ storageKey?: string;
4
+ removeStorageAfter?: (key: string) => void;
5
+ setStorageAfter?: (key: string, value: string) => void;
6
+ }
7
+ export declare class Storage {
8
+ private storageKey;
9
+ private app?;
10
+ private options;
11
+ constructor(app?: App, options?: StorageOptions);
12
+ createKey: (key: string) => string;
13
+ setStorage: (key: string, value: string) => void;
14
+ getStorage: (key: string) => string | null;
15
+ removeStorage: (key: string) => void;
16
+ clear: () => void;
17
+ }
@@ -0,0 +1,77 @@
1
+ import { Task, TasksModule, RunTaskParams, AddTaskParams, DeleteTaskParams } from "./type";
2
+ import App from "../app";
3
+ export declare class TasksManager {
4
+ private static instance;
5
+ private taskFunctions;
6
+ private tasks;
7
+ private app;
8
+ private db;
9
+ useTasks: () => {
10
+ tasks: TasksModule;
11
+ };
12
+ watchTaskCallback: (taskModule: TasksModule) => void;
13
+ constructor(app: App);
14
+ static getInstance(app?: App): TasksManager;
15
+ addTaskFunction<T>(name: string, fun: T): void;
16
+ addTaskFunctions<T>(tasks: {
17
+ name: string;
18
+ fun: T;
19
+ }[]): void;
20
+ getTasks(): TasksModule;
21
+ getTaskFunction(name: string): any;
22
+ init(): Promise<void>;
23
+ private saveTaskQueueToLocal;
24
+ private loadTaskQueueFromLocal;
25
+ /**
26
+ * @title: 执行任务
27
+ * @description:
28
+ * @param {Task} task
29
+ * @return {*}
30
+ * @Author: zhiwei.Wang
31
+ * @Date: 2024-09-26 13:53
32
+ */
33
+ private runTask;
34
+ /**
35
+ * @title: 启动轮询
36
+ * @description: 根据轮询间隔定期执行任务
37
+ * @param {Task} task
38
+ * @return {*}
39
+ */
40
+ private startPolling;
41
+ /**
42
+ * @title: 创建任务数据
43
+ * @description:
44
+ * @param {Partial} payload
45
+ * @return {*}
46
+ * @Author: zhiwei.Wang
47
+ * @Date: 2024-09-26 13:54
48
+ */
49
+ private createTaskData;
50
+ private getTaskQueue;
51
+ private timeout;
52
+ /**
53
+ * @title: 执行任务队列
54
+ * @description:
55
+ * @return {*}
56
+ * @Author: zhiwei.Wang
57
+ * @Date: 2024-09-26 13:52
58
+ */
59
+ run(payload: RunTaskParams): Promise<void>;
60
+ deleteTask(payload: DeleteTaskParams): void;
61
+ /**
62
+ * @title: 重试任务
63
+ * @description:
64
+ * @return {*}
65
+ * @Author: zhiwei.Wang
66
+ * @Date: 2024-09-26 13:53
67
+ */
68
+ retryTask(payload: RunTaskParams): void;
69
+ addTask(payload: AddTaskParams): void;
70
+ private updateTask;
71
+ private updateQueueStatus;
72
+ private setTasks;
73
+ clearAllTaskTimer(tasks: Task[]): void;
74
+ clearTasks(payload: RunTaskParams): void;
75
+ clearAllTasks(): void;
76
+ watchTask(callback: (taskModule: TasksModule) => void): void;
77
+ }
@@ -0,0 +1,62 @@
1
+ export type TaskRunStatus = "pending" | "in-progress" | "success" | "failure";
2
+ export interface Task {
3
+ id?: string;
4
+ type?: "local" | "cloud";
5
+ retries?: number;
6
+ maxRetries?: number;
7
+ status?: TaskRunStatus;
8
+ action: string;
9
+ payload: any;
10
+ beforeAction?: string;
11
+ beforePayload?: any;
12
+ afterAction?: string;
13
+ afterPayload?: any;
14
+ polling?: {
15
+ interval?: number;
16
+ };
17
+ pollingResult?: {
18
+ count: number;
19
+ timerId?: any;
20
+ };
21
+ manual?: boolean;
22
+ destroy?: boolean;
23
+ [key: string]: any;
24
+ }
25
+ export interface TaskConfig {
26
+ tasks: Task[];
27
+ }
28
+ type TaskModuleName = string;
29
+ type TaskQueueName = string;
30
+ type TaskStatus = "uncompleted" | "completed";
31
+ export interface TaskQueue {
32
+ status: TaskStatus;
33
+ tasks: Task[];
34
+ }
35
+ export interface RunTaskParams {
36
+ module: TaskModuleName;
37
+ queueId: TaskQueueName;
38
+ callback?: () => void;
39
+ }
40
+ export interface DeleteTaskParams {
41
+ module: TaskModuleName;
42
+ queueId: TaskQueueName;
43
+ taskId: string;
44
+ }
45
+ export interface AddTaskParams {
46
+ module: TaskModuleName;
47
+ queueId: TaskQueueName;
48
+ tasks: Task[];
49
+ }
50
+ export interface TaskRunResult {
51
+ status: TaskRunStatus;
52
+ [key: string]: any;
53
+ }
54
+ export interface TasksModule {
55
+ [key: TaskModuleName]: {
56
+ [key: TaskQueueName]: {
57
+ status: TaskStatus;
58
+ tasks: Task[];
59
+ };
60
+ };
61
+ }
62
+ export {};
@@ -0,0 +1,5 @@
1
+ import { TasksModule } from './type';
2
+ declare const useTasks: () => {
3
+ tasks: TasksModule;
4
+ };
5
+ export default useTasks;
@@ -0,0 +1,2 @@
1
+ export interface CoreConfig {
2
+ }
@@ -0,0 +1,7 @@
1
+ import React from "react";
2
+ export declare const useVariablesContext: () => any;
3
+ interface VariablesProviderProps {
4
+ children: React.ReactNode;
5
+ }
6
+ export declare const VariablesProvider: React.FC<VariablesProviderProps>;
7
+ export {};
@@ -0,0 +1,3 @@
1
+ import { VariablesConfig } from './type';
2
+ export declare const setConfig: (newConfig: Partial<VariablesConfig>) => void;
3
+ export declare const getConfig: () => VariablesConfig;
@@ -0,0 +1,6 @@
1
+ export type VariableMap = Record<string, string>;
2
+ declare const _default: {
3
+ setConfig: (newConfig: Partial<import("./type").VariablesConfig>) => void;
4
+ getConfig: () => import("./type").VariablesConfig;
5
+ };
6
+ export default _default;
@@ -0,0 +1,2 @@
1
+ export interface VariablesConfig {
2
+ }
@@ -0,0 +1,6 @@
1
+ declare const _default: {
2
+ setTitle: (title: string) => void;
3
+ setIcon: (paramsIcon: string) => void;
4
+ setAppleWebAppTitle: (title: string) => void;
5
+ };
6
+ export default _default;
@@ -0,0 +1,8 @@
1
+ import { Plugin } from '../types';
2
+ import App from './app-types/app';
3
+ /**
4
+ * AppPlugin 接口定义
5
+ */
6
+ export interface AppPlugin extends Plugin {
7
+ getApp: () => App;
8
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -13,6 +13,7 @@ export interface WindowPlugin extends Plugin {
13
13
  navigator: Partial<Navigator>;
14
14
  document: Partial<Document>;
15
15
  history: History;
16
+ interaction?: any;
16
17
  }
17
18
  /**
18
19
  * 简单的 Storage 接口实现
@@ -29,9 +29,9 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
29
29
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
30
30
  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); }
31
31
  import { BaseModule } from "../../modules/BaseModule";
32
- import { BookingByStepHooks, createModule } from "./types";
32
+ import { createModule } from "./types";
33
33
  import { formatProductToCartItem, createCartItemOrigin, getUniqueId, handleVariantProduct, formatDateToCartItem, formatAccountToCartItem } from "../../modules/Cart/utils";
34
- import { getAvailableProductResources } from "./utils/products";
34
+ import { getAvailableProductResources, isSessionProduct } from "./utils/products";
35
35
  import { getResourcesByProduct, getTimeSlicesByResource, getTimeSlicesByResources, getIsUsableByTimeItem, getOthersSelectedResources, getOthersCartSelectedResources, filterScheduleByDateRange, checkSessionProductLeadTime, sortCombinedResources, filterResourcesByFormItem, checkTwoResourcesIntersection, isConflict } from "./utils/resources";
36
36
  import dayjs from 'dayjs';
37
37
  import isSameOrBefore from 'dayjs/plugin/isSameOrBefore';
@@ -118,7 +118,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
118
118
  this.otherData = ((_data$this$otherParam = data[this.otherParams.cacheId]) === null || _data$this$otherParam === void 0 || (_data$this$otherParam = _data$this$otherParam[this.name]) === null || _data$this$otherParam === void 0 ? void 0 : _data$this$otherParam['otherData']) || {};
119
119
  }
120
120
  }
121
- moduleArr = ['accountList', 'cart', 'schedule', 'summary', 'step', 'products', 'date', 'order', 'payment'];
121
+ moduleArr = ['accountList', 'cart', 'schedule', 'summary', 'step', 'products', 'date', 'order'];
122
122
  moduleArr.forEach(function (step) {
123
123
  var targetModule = createModule(step, _this2.name);
124
124
  if (targetModule) {
@@ -137,7 +137,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
137
137
  }
138
138
  });
139
139
  this.store.schedule.loadAllSchedule();
140
- this.core.effects.emit(BookingByStepHooks.onInited, {});
140
+ this.core.effects.emit("".concat(this.name, ":onInited"), {});
141
141
  case 19:
142
142
  case "end":
143
143
  return _context.stop();
@@ -238,19 +238,29 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
238
238
  key: "loadProducts",
239
239
  value: (function () {
240
240
  var _loadProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_ref) {
241
- var _ref$category_ids, category_ids, _ref$product_ids, product_ids, _ref$collection, collection, schedule_date;
241
+ var _ref$category_ids, category_ids, _ref$product_ids, product_ids, _ref$collection, collection, schedule_date, res;
242
242
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
243
243
  while (1) switch (_context2.prev = _context2.next) {
244
244
  case 0:
245
245
  _ref$category_ids = _ref.category_ids, category_ids = _ref$category_ids === void 0 ? [] : _ref$category_ids, _ref$product_ids = _ref.product_ids, product_ids = _ref$product_ids === void 0 ? [] : _ref$product_ids, _ref$collection = _ref.collection, collection = _ref$collection === void 0 ? [] : _ref$collection, schedule_date = _ref.schedule_date;
246
- return _context2.abrupt("return", this.store.products.loadProducts({
246
+ _context2.next = 3;
247
+ return this.store.products.loadProducts({
247
248
  category_ids: category_ids,
248
249
  product_ids: product_ids,
249
250
  collection: collection,
250
251
  schedule_date: schedule_date,
251
252
  cacheId: this.cacheId
252
- }));
253
- case 2:
253
+ });
254
+ case 3:
255
+ res = _context2.sent;
256
+ // 预拉取当天的资源数据
257
+ this.getAvailableDate({
258
+ startDate: schedule_date || dayjs().format('YYYY-MM-DD'),
259
+ endDate: schedule_date || dayjs().format('YYYY-MM-DD'),
260
+ products: _toConsumableArray(res)
261
+ });
262
+ return _context2.abrupt("return", res);
263
+ case 6:
254
264
  case "end":
255
265
  return _context2.stop();
256
266
  }
@@ -282,7 +292,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
282
292
  value: (function () {
283
293
  var _loadProductByScheduleDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(_ref2) {
284
294
  var _schedule$product_ids;
285
- var date, _ref2$product_ids, product_ids, _ref2$category_ids, category_ids, scheduleList, newProductIds, schedule, otherProductsIds, allProductIds;
295
+ var date, _ref2$product_ids, product_ids, _ref2$category_ids, category_ids, scheduleList, newProductIds, schedule, otherProductsIds, allProductIds, res;
286
296
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
287
297
  while (1) switch (_context3.prev = _context3.next) {
288
298
  case 0:
@@ -329,8 +339,9 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
329
339
  schedule_date: date
330
340
  });
331
341
  case 10:
332
- return _context3.abrupt("return", _context3.sent);
333
- case 11:
342
+ res = _context3.sent;
343
+ return _context3.abrupt("return", res);
344
+ case 12:
334
345
  case "end":
335
346
  return _context3.stop();
336
347
  }
@@ -1150,6 +1161,16 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
1150
1161
  var productData = _objectSpread(_objectSpread({}, origin), {}, {
1151
1162
  product_variant_id: product_variant_id
1152
1163
  });
1164
+ debugger;
1165
+ // 保护,如果进来的是 session 商品,则必须要有 date 和时间片,否则不允许添加
1166
+ if (isSessionProduct(productData)) {
1167
+ if (!date || !date.startTime || !date.endTime) {
1168
+ return {
1169
+ success: false,
1170
+ errorCode: 'date_or_time_required'
1171
+ };
1172
+ }
1173
+ }
1153
1174
 
1154
1175
  // 库存检测
1155
1176
  var currentCartItems = this.store.cart.getItems();
@@ -1235,6 +1256,14 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
1235
1256
  _this6.store.cart.removeItem(n._id);
1236
1257
  });
1237
1258
  }
1259
+ // // 如果 date.startTime 和 dateRange 里的 startTime 不一样,需要修正 dateRange
1260
+ // const dateRange = this.store.date.getDateRange()
1261
+ // if (dateRange?.[0] && !dayjs(dateRange[0].date).isSame(dayjs(date.startTime), 'day')) {
1262
+ // this.setDateRange([
1263
+ // { date: dayjs(date.startTime).format('YYYY-MM-DD'), status: 'available', week: '', weekNum: 0 },
1264
+ // { date: dayjs(date.endTime).format('YYYY-MM-DD'), status: 'available', week: '', weekNum: 0 },
1265
+ // ]);
1266
+ // }
1238
1267
  }
1239
1268
  }
1240
1269
  }, {
@@ -2455,9 +2484,10 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
2455
2484
  // n.start_at 是 2025-06-30 15:00 end_at 2025-06-30 17:00
2456
2485
  // item.start 是 2025-06-30 16:00 item.end 是 2025-06-30 19:00
2457
2486
  // 需要判断 n.start_at 和 n.end_at 是否在 item.start 和 item.end 之间
2458
- // 如果 n.start_at 和 n.end_at 在 item.start 和 item.end 有交集,则此时间需要计算
2487
+ // 如果是仅用于计算的资源, n.start_at 和 n.end_at 在 item.start 和 item.end 有交集,则此时间需要计算
2488
+ // https://project.feishu.cn/v2qint/bug/detail/6657165010
2459
2489
  var mTimes = m.times.filter(function (n) {
2460
- return !dayjs(n.start_at).isAfter(dayjs(item.start), 'minute') && !dayjs(n.end_at).isBefore(dayjs(item.end), 'minute') || dayjs(n.start_at).isBefore(dayjs(item.end), 'minute') && dayjs(n.end_at).isAfter(dayjs(item.start), 'minute');
2490
+ return !dayjs(n.start_at).isAfter(dayjs(item.start), 'minute') && !dayjs(n.end_at).isBefore(dayjs(item.end), 'minute') || m.onlyComputed && dayjs(n.start_at).isBefore(dayjs(item.end), 'minute') && dayjs(n.end_at).isAfter(dayjs(item.start), 'minute');
2461
2491
  });
2462
2492
  // 如果在这个区间的时间一个都没有,可以直接认为这个资源不可用
2463
2493
  if (mTimes.length === 0) {
@@ -320,7 +320,7 @@ export function checkTimeSlotCapacity(timeSlotStart, timeSlotEnd, cartItems, all
320
320
  resourcesInType.forEach(function (resource) {
321
321
  // 过滤出在时间段内的资源时间片
322
322
  var availableTimes = resource.times.filter(function (time) {
323
- return !dayjs(time.start_at).isAfter(dayjs(timeSlotStart), 'minute') && !dayjs(time.end_at).isBefore(dayjs(timeSlotEnd), 'minute') || dayjs(time.start_at).isBefore(dayjs(timeSlotEnd), 'minute') && dayjs(time.end_at).isAfter(dayjs(timeSlotStart), 'minute');
323
+ return !dayjs(time.start_at).isAfter(dayjs(timeSlotStart), 'minute') && !dayjs(time.end_at).isBefore(dayjs(timeSlotEnd), 'minute') || resource.onlyComputed && dayjs(time.start_at).isBefore(dayjs(timeSlotEnd), 'minute') && dayjs(time.end_at).isAfter(dayjs(timeSlotStart), 'minute');
324
324
  });
325
325
  if (availableTimes.length > 0) {
326
326
  // 简化逻辑:如果资源在时间段内有可用时间,就计算其容量
@@ -9,3 +9,9 @@ export declare const getAvailableProductResources: (products: ProductData[]) =>
9
9
  rules: any[];
10
10
  resourcesMap: Record<number, ProductResourceItem>;
11
11
  };
12
+ /**
13
+ * 判断商品是否是 session 商品
14
+ * @param product 商品数据
15
+ * @returns 是否是 session 商品
16
+ */
17
+ export declare const isSessionProduct: (product: ProductData) => boolean;
@@ -47,4 +47,14 @@ export var getAvailableProductResources = function getAvailableProductResources(
47
47
  rules: rules,
48
48
  resourcesMap: resourcesMap
49
49
  };
50
+ };
51
+
52
+ /**
53
+ * 判断商品是否是 session 商品
54
+ * @param product 商品数据
55
+ * @returns 是否是 session 商品
56
+ */
57
+ export var isSessionProduct = function isSessionProduct(product) {
58
+ var _product$scheduleIds, _product$scheduleIds2;
59
+ return ((_product$scheduleIds = product === null || product === void 0 || (_product$scheduleIds2 = product['schedule.ids']) === null || _product$scheduleIds2 === void 0 ? void 0 : _product$scheduleIds2.length) !== null && _product$scheduleIds !== void 0 ? _product$scheduleIds : 0) > 0;
50
60
  };