@pisell/pisellos 3.0.75 → 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
@@ -41,8 +41,8 @@ var GuestListModule = class extends import_BaseModule.BaseModule {
41
41
  }
42
42
  async addGuest(guest) {
43
43
  this.state.list.push(guest);
44
- await this.core.effects.emit(import_types.GuestHooks.OnGuestAdd, guest);
45
- await this.core.effects.emit(import_types.GuestHooks.OnGuestChange, this.state.list);
44
+ await this.core.effects.emit(`${this.name}:onGuestAdd`, guest);
45
+ await this.core.effects.emit(`${this.name}:onGuestChange`, this.state.list);
46
46
  }
47
47
  async updateGuest(id, updates) {
48
48
  const index = this.state.list.findIndex((g) => g.id === id);
@@ -56,15 +56,15 @@ var GuestListModule = class extends import_BaseModule.BaseModule {
56
56
  import_types.GuestHooks.OnGuestUpdate,
57
57
  this.state.list[index]
58
58
  );
59
- await this.core.effects.emit(import_types.GuestHooks.OnGuestChange, this.state.list);
59
+ await this.core.effects.emit(`${this.name}:onGuestChange`, this.state.list);
60
60
  }
61
61
  async removeGuest(id) {
62
62
  const index = this.state.list.findIndex((g) => g.id === id);
63
63
  if (index === -1)
64
64
  return;
65
65
  const [removed] = this.state.list.splice(index, 1);
66
- await this.core.effects.emit(import_types.GuestHooks.OnGuestRemove, removed);
67
- await this.core.effects.emit(import_types.GuestHooks.OnGuestChange, this.state.list);
66
+ await this.core.effects.emit(`${this.name}:onGuestRemove`, removed);
67
+ await this.core.effects.emit(`${this.name}:onGuestChange`, this.state.list);
68
68
  }
69
69
  async getGuests() {
70
70
  return this.state.list;
@@ -77,8 +77,8 @@ var GuestListModule = class extends import_BaseModule.BaseModule {
77
77
  if (!guest)
78
78
  return;
79
79
  guest.items.push(item);
80
- await this.core.effects.emit(import_types.GuestHooks.OnGuestUpdate, guest);
81
- await this.core.effects.emit(import_types.GuestHooks.OnGuestChange, this.state.list);
80
+ await this.core.effects.emit(`${this.name}:onGuestUpdate`, guest);
81
+ await this.core.effects.emit(`${this.name}:onGuestChange`, this.state.list);
82
82
  }
83
83
  async removeItemFromGuest(guestId, itemId) {
84
84
  const guest = this.state.list.find((g) => g.id === guestId);
@@ -88,8 +88,8 @@ var GuestListModule = class extends import_BaseModule.BaseModule {
88
88
  if (index === -1)
89
89
  return;
90
90
  guest.items.splice(index, 1);
91
- await this.core.effects.emit(import_types.GuestHooks.OnGuestUpdate, guest);
92
- await this.core.effects.emit(import_types.GuestHooks.OnGuestChange, this.state.list);
91
+ await this.core.effects.emit(`${this.name}:onGuestUpdate`, guest);
92
+ await this.core.effects.emit(`${this.name}:onGuestChange`, this.state.list);
93
93
  }
94
94
  };
95
95
  // Annotate the CommonJS export names for ESM import in node:
@@ -1,14 +1,27 @@
1
1
  import { Module, PisellCore, ModuleOptions } from '../../types';
2
2
  import { BaseModule } from '../BaseModule';
3
- import { OrderModuleAPI, CommitOrderParams } from './types';
3
+ import { OrderModuleAPI, CommitOrderParams, CheckoutOrderParams } from './types';
4
4
  import { CartItem } from '../Cart/types';
5
5
  export declare class OrderModule extends BaseModule implements Module, OrderModuleAPI {
6
6
  protected defaultName: string;
7
7
  protected defaultVersion: string;
8
8
  private store;
9
9
  private request;
10
+ private logger;
10
11
  constructor(name?: string, version?: string);
11
12
  initialize(core: PisellCore, options: ModuleOptions): Promise<void>;
13
+ /**
14
+ * 记录信息日志
15
+ */
16
+ private logInfo;
17
+ /**
18
+ * 记录警告日志
19
+ */
20
+ private logWarning;
21
+ /**
22
+ * 记录错误日志
23
+ */
24
+ private logError;
12
25
  createOrder(params: CommitOrderParams['query']): {
13
26
  type: "virtual" | "appointment_booking";
14
27
  platform: string;
@@ -26,4 +39,15 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
26
39
  type: 'holder' | 'account';
27
40
  }): boolean;
28
41
  submitOrder(order: CommitOrderParams): Promise<void>;
42
+ /**
43
+ * Checkout 专用:创建订单到后端
44
+ *
45
+ * 专门为 Checkout 模块设计的订单创建方法,
46
+ * 直接调用 /order/checkout 接口创建订单
47
+ * 接收已经处理好的订单数据,无需再处理购物车
48
+ *
49
+ * @param params Checkout 订单参数(已处理的订单数据)
50
+ * @returns 后端返回的订单数据(包含订单ID等)
51
+ */
52
+ createOrderByCheckout(params: CheckoutOrderParams): Promise<any>;
29
53
  }
@@ -1,6 +1,8 @@
1
+ var __create = Object.create;
1
2
  var __defProp = Object.defineProperty;
2
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
4
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
5
7
  var __export = (target, all) => {
6
8
  for (var name in all)
@@ -14,6 +16,14 @@ var __copyProps = (to, from, except, desc) => {
14
16
  }
15
17
  return to;
16
18
  };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
17
27
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
28
 
19
29
  // src/modules/Order/index.ts
@@ -25,9 +35,11 @@ module.exports = __toCommonJS(Order_exports);
25
35
  var import_BaseModule = require("../BaseModule");
26
36
  var import_utils = require("./utils");
27
37
  var import_utils2 = require("../Product/utils");
38
+ var import_dayjs = __toESM(require("dayjs"));
28
39
  var OrderModule = class extends import_BaseModule.BaseModule {
40
+ // LoggerManager 实例
29
41
  constructor(name, version) {
30
- super(name, version);
42
+ super(name || "order", version);
31
43
  this.defaultName = "order";
32
44
  this.defaultVersion = "1.0.0";
33
45
  }
@@ -35,6 +47,49 @@ var OrderModule = class extends import_BaseModule.BaseModule {
35
47
  this.core = core;
36
48
  this.store = options.store;
37
49
  this.request = this.core.getPlugin("request");
50
+ const appPlugin = this.core.getPlugin("app");
51
+ if (!appPlugin) {
52
+ throw new Error("Order 模块需要 app 插件支持");
53
+ }
54
+ const app = appPlugin.getApp();
55
+ this.logger = app.logger;
56
+ this.logInfo("OrderModule initialized successfully");
57
+ }
58
+ /**
59
+ * 记录信息日志
60
+ */
61
+ logInfo(title, metadata) {
62
+ if (this.logger) {
63
+ this.logger.addLog({
64
+ type: "info",
65
+ title: `[OrderModule] ${title}`,
66
+ metadata: metadata || {}
67
+ });
68
+ }
69
+ }
70
+ /**
71
+ * 记录警告日志
72
+ */
73
+ logWarning(title, metadata) {
74
+ if (this.logger) {
75
+ this.logger.addLog({
76
+ type: "warning",
77
+ title: `[OrderModule] ${title}`,
78
+ metadata: metadata || {}
79
+ });
80
+ }
81
+ }
82
+ /**
83
+ * 记录错误日志
84
+ */
85
+ logError(title, metadata) {
86
+ if (this.logger) {
87
+ this.logger.addLog({
88
+ type: "error",
89
+ title: `[OrderModule] ${title}`,
90
+ metadata: metadata || {}
91
+ });
92
+ }
38
93
  }
39
94
  createOrder(params) {
40
95
  var _a;
@@ -91,6 +146,11 @@ var OrderModule = class extends import_BaseModule.BaseModule {
91
146
  return order;
92
147
  }
93
148
  checkBeforeSubmitOrder(params) {
149
+ var _a;
150
+ this.logInfo("checkBeforeSubmitOrder called", {
151
+ cartItemsCount: ((_a = params.cartItems) == null ? void 0 : _a.length) || 0,
152
+ type: params.type
153
+ });
94
154
  const { cartItems, type } = params;
95
155
  if (type === "holder") {
96
156
  const hasNoHolderId = cartItems.some((item) => !item.holder_id);
@@ -101,11 +161,136 @@ var OrderModule = class extends import_BaseModule.BaseModule {
101
161
  return true;
102
162
  }
103
163
  async submitOrder(order) {
164
+ var _a, _b, _c;
165
+ this.logInfo("submitOrder called", {
166
+ url: order.url,
167
+ orderType: order.query.type,
168
+ platform: order.query.platform,
169
+ cartItemsCount: ((_a = order.query.cartItems) == null ? void 0 : _a.length) || 0
170
+ });
104
171
  const { url, query } = order;
105
172
  const fetchUrl = url || "/order/appointment";
106
173
  const params = this.createOrder(query);
174
+ this.logInfo("Calling backend order API", {
175
+ url: fetchUrl,
176
+ orderType: params.type,
177
+ platform: params.platform,
178
+ isDeposit: params.is_deposit,
179
+ bookingsCount: ((_b = params.bookings) == null ? void 0 : _b.length) || 0,
180
+ relationProductsCount: ((_c = params.relation_products) == null ? void 0 : _c.length) || 0,
181
+ scheduleDate: params.schedule_date
182
+ });
107
183
  return this.request.post(fetchUrl, params);
108
184
  }
185
+ /**
186
+ * Checkout 专用:创建订单到后端
187
+ *
188
+ * 专门为 Checkout 模块设计的订单创建方法,
189
+ * 直接调用 /order/checkout 接口创建订单
190
+ * 接收已经处理好的订单数据,无需再处理购物车
191
+ *
192
+ * @param params Checkout 订单参数(已处理的订单数据)
193
+ * @returns 后端返回的订单数据(包含订单ID等)
194
+ */
195
+ async createOrderByCheckout(params) {
196
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q;
197
+ this.logInfo("createOrderByCheckout called", {
198
+ type: params.type,
199
+ platform: params.platform,
200
+ is_deposit: params.is_deposit,
201
+ customer_id: params.customer_id,
202
+ bookingsCount: ((_a = params.bookings) == null ? void 0 : _a.length) || 0,
203
+ relationProductsCount: ((_b = params.relation_products) == null ? void 0 : _b.length) || 0,
204
+ paymentsCount: ((_c = params.payments) == null ? void 0 : _c.length) || 0,
205
+ depositAmount: params.deposit_amount,
206
+ productTaxFee: params.product_tax_fee,
207
+ note: params.note,
208
+ scheduleDate: params.schedule_date,
209
+ hasOrderId: !!params.order_id,
210
+ orderIdIncluded: params.order_id,
211
+ paymentMethods: ((_d = params.payments) == null ? void 0 : _d.map((p) => p.code)) || []
212
+ });
213
+ console.log("[Order] createOrderByCheckout 开始创建订单:", {
214
+ type: params.type,
215
+ platform: params.platform,
216
+ is_deposit: params.is_deposit,
217
+ customer_id: params.customer_id,
218
+ bookingsCount: ((_e = params.bookings) == null ? void 0 : _e.length) || 0,
219
+ relationProductsCount: ((_f = params.relation_products) == null ? void 0 : _f.length) || 0,
220
+ paymentsCount: ((_g = params.payments) == null ? void 0 : _g.length) || 0
221
+ });
222
+ try {
223
+ const orderData = {
224
+ sales_channel: "my_pisel",
225
+ order_sales_channel: "online_store",
226
+ shop_note: "",
227
+ schedule_date: "",
228
+ is_deposit: 0,
229
+ bookings: [],
230
+ relation_products: [],
231
+ relation_forms: [],
232
+ payments: [],
233
+ is_full_overwrite_flag: 1,
234
+ ...params
235
+ // 使用传入的参数覆盖默认值
236
+ };
237
+ if ((_h = orderData.payments) == null ? void 0 : _h.length) {
238
+ orderData.small_ticket_data_flag = 1;
239
+ }
240
+ if (!params.order_id && !orderData.schedule_date) {
241
+ orderData.schedule_date = (0, import_dayjs.default)().format("YYYY-MM-DD HH:mm:ss");
242
+ }
243
+ console.log("[Order] 调用后端接口创建订单:", {
244
+ url: "/order/checkout",
245
+ orderType: orderData.type,
246
+ platform: orderData.platform,
247
+ isDeposit: orderData.is_deposit,
248
+ customerId: orderData.customer_id,
249
+ bookingsCount: ((_i = orderData.bookings) == null ? void 0 : _i.length) || 0,
250
+ relationProductsCount: ((_j = orderData.relation_products) == null ? void 0 : _j.length) || 0,
251
+ paymentsCount: ((_k = orderData.payments) == null ? void 0 : _k.length) || 0,
252
+ paymentsMethods: ((_l = orderData.payments) == null ? void 0 : _l.map((p) => p.code)) || []
253
+ });
254
+ this.logInfo("Calling backend checkout API", {
255
+ url: "/order/checkout",
256
+ orderType: orderData.type,
257
+ platform: orderData.platform,
258
+ isDeposit: orderData.is_deposit,
259
+ customerId: orderData.customer_id,
260
+ depositAmount: orderData.deposit_amount,
261
+ bookingsCount: ((_m = orderData.bookings) == null ? void 0 : _m.length) || 0,
262
+ relationProductsCount: ((_n = orderData.relation_products) == null ? void 0 : _n.length) || 0,
263
+ paymentsCount: ((_o = orderData.payments) == null ? void 0 : _o.length) || 0,
264
+ paymentMethods: ((_p = orderData.payments) == null ? void 0 : _p.map((p) => ({
265
+ code: p.code,
266
+ amount: p.amount,
267
+ type: p.type,
268
+ hasVoucherId: !!p.voucher_id,
269
+ orderPaymentType: p.order_payment_type
270
+ }))) || [],
271
+ productTaxFee: orderData.product_tax_fee,
272
+ note: orderData.note,
273
+ scheduleDate: orderData.schedule_date,
274
+ hasOrderId: !!orderData.order_id,
275
+ smallTicketDataFlag: orderData.small_ticket_data_flag
276
+ });
277
+ const response = await this.request.post("/order/checkout", orderData);
278
+ this.logInfo("Order API called successfully", {
279
+ response
280
+ });
281
+ console.log("[Order] 订单创建成功,后端响应:", {
282
+ success: !!response,
283
+ hasOrderId: !!(((_q = response == null ? void 0 : response.data) == null ? void 0 : _q.order_id) || (response == null ? void 0 : response.order_id))
284
+ });
285
+ return response;
286
+ } catch (error) {
287
+ console.error("[Order] createOrderByCheckout 创建订单失败:", error);
288
+ this.logInfo("Order API called failed", {
289
+ error: error instanceof Error ? error.message : String(error)
290
+ });
291
+ throw error;
292
+ }
293
+ }
109
294
  };
110
295
  // Annotate the CommonJS export names for ESM import in node:
111
296
  0 && (module.exports = {
@@ -19,6 +19,45 @@ export interface CommitOrderParams {
19
19
  extraData?: Record<string, any>;
20
20
  };
21
21
  }
22
+ /**
23
+ * 支付项数据
24
+ */
25
+ export interface PaymentItemData {
26
+ /** 当前支付项的唯一 ID */
27
+ uuid: string;
28
+ /** 当前支付方式付出去多少钱 */
29
+ amount: string;
30
+ /** 支付类型代码 */
31
+ code: string;
32
+ /** 支付类型id */
33
+ id: number;
34
+ /** 支付类型名称 */
35
+ name: string;
36
+ /** 支付类型 */
37
+ type: string;
38
+ /** 是否已同步到后端 */
39
+ isSynced?: boolean;
40
+ }
41
+ /**
42
+ * Checkout 专用订单创建参数
43
+ */
44
+ export interface CheckoutOrderParams {
45
+ type: 'virtual' | 'appointment_booking';
46
+ platform: 'PC' | 'H5';
47
+ sales_channel?: string;
48
+ order_sales_channel?: string;
49
+ bookings?: any[];
50
+ shop_note?: string;
51
+ schedule_date?: string;
52
+ is_deposit?: number;
53
+ relation_products?: any[];
54
+ relation_forms?: any[];
55
+ payments?: PaymentItemData[];
56
+ customer_id?: string;
57
+ /** 小票数据标记,当有支付项时设置为1 */
58
+ small_ticket_data_flag?: number;
59
+ [key: string]: any;
60
+ }
22
61
  /**
23
62
  * 订单模块 API
24
63
  */
@@ -41,4 +80,10 @@ export interface OrderModuleAPI {
41
80
  * @param params 订单信息
42
81
  */
43
82
  submitOrder: (params: CommitOrderParams) => Promise<void>;
83
+ /**
84
+ * Checkout 专用:创建订单到后端
85
+ * @param params 订单参数
86
+ * @returns 后端返回的订单数据
87
+ */
88
+ createOrderByCheckout: (params: CheckoutOrderParams) => Promise<any>;
44
89
  }
@@ -60,7 +60,7 @@ var getAllDiscountList = (cartItem) => {
60
60
  var _a, _b, _c, _d;
61
61
  let discountList = ((_b = (_a = cartItem == null ? void 0 : cartItem._origin) == null ? void 0 : _a.product) == null ? void 0 : _b.discount_list) || [];
62
62
  (((_d = (_c = cartItem == null ? void 0 : cartItem._origin) == null ? void 0 : _c.product) == null ? void 0 : _d.product_bundle) || []).forEach((item) => {
63
- discountList = [...discountList, ...item.discount_list || []];
63
+ discountList = [...discountList, ...(item == null ? void 0 : item.discount_list) || []];
64
64
  item.discount_list = void 0;
65
65
  });
66
66
  return discountList;
@@ -0,0 +1,19 @@
1
+ import { CashPayment } from './types';
2
+ import type { PaymentModule } from './index';
3
+ /**
4
+ * 现金支付实现
5
+ */
6
+ export declare class CashPaymentImpl implements CashPayment {
7
+ private paymentModule;
8
+ constructor(paymentModule: PaymentModule);
9
+ processCashPayment(amount: number, orderUuid: string): Promise<void>;
10
+ getCashBalance(): Promise<number>;
11
+ /**
12
+ * 获取推荐支付金额
13
+ * 基于目标金额和货币类型,返回最优支付金额建议
14
+ * @param money 目标支付金额
15
+ * @param currency 货币代码 (如: 'CNY', 'USD', 'EUR' 等)
16
+ * @returns 推荐支付金额数组
17
+ */
18
+ getRecommendedAmount(money: number, currency: string): number[];
19
+ }
@@ -0,0 +1,64 @@
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/Payment/cash.ts
20
+ var cash_exports = {};
21
+ __export(cash_exports, {
22
+ CashPaymentImpl: () => CashPaymentImpl
23
+ });
24
+ module.exports = __toCommonJS(cash_exports);
25
+ var import_cashRecommendationAlgorithm = require("./cashRecommendationAlgorithm");
26
+ var CashPaymentImpl = class {
27
+ constructor(paymentModule) {
28
+ this.paymentModule = paymentModule;
29
+ }
30
+ async processCashPayment(amount, orderUuid) {
31
+ const cashMethod = await this.paymentModule.getCashPaymentMethod();
32
+ if (!cashMethod) {
33
+ throw new Error("现金支付方式未找到");
34
+ }
35
+ const paymentItem = {
36
+ amount: amount.toString(),
37
+ code: cashMethod.code,
38
+ id: cashMethod.id,
39
+ name: cashMethod.name,
40
+ type: cashMethod.type,
41
+ voucher_id: ""
42
+ };
43
+ await this.paymentModule.addPaymentItemAsync(orderUuid, paymentItem);
44
+ }
45
+ async getCashBalance() {
46
+ return 0;
47
+ }
48
+ /**
49
+ * 获取推荐支付金额
50
+ * 基于目标金额和货币类型,返回最优支付金额建议
51
+ * @param money 目标支付金额
52
+ * @param currency 货币代码 (如: 'CNY', 'USD', 'EUR' 等)
53
+ * @returns 推荐支付金额数组
54
+ */
55
+ getRecommendedAmount(money, currency) {
56
+ const upperCurrency = currency.toUpperCase();
57
+ const denominations = import_cashRecommendationAlgorithm.CURRENCY_DENOMINATIONS[upperCurrency] || import_cashRecommendationAlgorithm.CURRENCY_DENOMINATIONS["DEFAULT"];
58
+ return (0, import_cashRecommendationAlgorithm.recommendOptimalPayments)(money, denominations);
59
+ }
60
+ };
61
+ // Annotate the CommonJS export names for ESM import in node:
62
+ 0 && (module.exports = {
63
+ CashPaymentImpl
64
+ });
@@ -0,0 +1,22 @@
1
+ /**
2
+ * 现金支付推荐算法
3
+ *
4
+ * 核心原理:
5
+ * 1. 每个推荐金额都应该是独立的最优组合
6
+ * 2. 不推荐在已有最优解基础上添加额外面额的组合
7
+ * 3. 优先推荐使用不同数量币种的组合
8
+ * 4. 根据组合判断去重,避免扩展组合
9
+ */
10
+ /**
11
+ * 常见国家货币面额配置
12
+ */
13
+ export declare const CURRENCY_DENOMINATIONS: Record<string, number[]>;
14
+ /**
15
+ * 最优支付金额推荐算法
16
+ * 推荐通过不同数量面额组合刚好足够支付的最小金额
17
+ *
18
+ * @param targetAmount 目标金额
19
+ * @param denominations 币种面值数组
20
+ * @returns 推荐支付金额数组
21
+ */
22
+ export declare function recommendOptimalPayments(targetAmount: number, denominations: number[]): number[];