@pisell/pisellos 3.0.56 → 3.0.57

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (268) hide show
  1. package/dist/core/index.js +2 -1
  2. package/dist/effects/index.d.ts +4 -3
  3. package/dist/effects/index.js +15 -6
  4. package/dist/modules/AccountList/index.d.ts +7 -1
  5. package/dist/modules/AccountList/index.js +81 -14
  6. package/dist/modules/AccountList/types.d.ts +28 -0
  7. package/dist/modules/AccountList/types.js +8 -0
  8. package/dist/modules/Cart/index.js +1 -1
  9. package/dist/modules/Cart/utils/changePrice.d.ts +2 -2
  10. package/dist/modules/Cart/utils/changePrice.js +1 -1
  11. package/dist/modules/Customer/constants.d.ts +7 -0
  12. package/dist/modules/Customer/constants.js +12 -0
  13. package/dist/modules/Customer/index.d.ts +122 -0
  14. package/dist/modules/Customer/index.js +697 -0
  15. package/dist/modules/Customer/types.d.ts +146 -0
  16. package/dist/modules/Customer/types.js +41 -0
  17. package/dist/modules/Payment/cash.d.ts +11 -0
  18. package/dist/modules/Payment/cash.js +78 -0
  19. package/dist/modules/Payment/eftpos.d.ts +11 -0
  20. package/dist/modules/Payment/eftpos.js +80 -0
  21. package/dist/modules/Payment/index.d.ts +273 -9
  22. package/dist/modules/Payment/index.js +2525 -109
  23. package/dist/modules/Payment/types.d.ts +382 -30
  24. package/dist/modules/Payment/types.js +116 -14
  25. package/dist/modules/Payment/wallet.d.ts +11 -0
  26. package/dist/modules/Payment/wallet.js +78 -0
  27. package/dist/modules/Payment/walletpass.d.ts +0 -0
  28. package/dist/modules/Payment/walletpass.js +0 -0
  29. package/dist/modules/ProductList/index.d.ts +13 -3
  30. package/dist/modules/ProductList/index.js +52 -42
  31. package/dist/modules/ProductList/types.d.ts +0 -1
  32. package/dist/modules/Rules/index.js +27 -14
  33. package/dist/modules/Rules/types.d.ts +1 -0
  34. package/dist/modules/index.d.ts +1 -0
  35. package/dist/modules/index.js +1 -0
  36. package/dist/plugins/app-types/app/app.d.ts +83 -0
  37. package/dist/plugins/app-types/app/const.d.ts +4 -0
  38. package/dist/plugins/app-types/app/index.d.ts +14 -0
  39. package/dist/plugins/app-types/applicationManager/application.d.ts +50 -0
  40. package/dist/plugins/app-types/applicationManager/index.d.ts +13 -0
  41. package/dist/plugins/app-types/config.d.ts +3 -0
  42. package/dist/plugins/app-types/cookie/index.d.ts +13 -0
  43. package/dist/plugins/app-types/data/index.d.ts +8 -0
  44. package/dist/plugins/app-types/history/config.d.ts +24 -0
  45. package/dist/plugins/app-types/history/index.d.ts +20 -0
  46. package/dist/plugins/app-types/history/type.d.ts +2 -0
  47. package/dist/plugins/app-types/hooks/index.d.ts +12 -0
  48. package/dist/plugins/app-types/hooks/useDelayedValue/index.d.ts +2 -0
  49. package/dist/plugins/app-types/hooks/useDispatch/index.d.ts +2 -0
  50. package/dist/plugins/app-types/hooks/useLowCode/index.d.ts +13 -0
  51. package/dist/plugins/app-types/hooks/useStore/index.d.ts +6 -0
  52. package/dist/plugins/app-types/index.d.ts +6 -0
  53. package/dist/plugins/app-types/indexDB/index.d.ts +178 -0
  54. package/dist/plugins/app-types/locales/en.d.ts +3 -0
  55. package/dist/plugins/app-types/locales/index.d.ts +37 -0
  56. package/dist/plugins/app-types/locales/original.d.ts +3 -0
  57. package/dist/plugins/app-types/locales/type.d.ts +19 -0
  58. package/dist/plugins/app-types/locales/zh-CN.d.ts +3 -0
  59. package/dist/plugins/app-types/locales/zh-HK.d.ts +3 -0
  60. package/dist/plugins/app-types/logger/feishu.d.ts +11 -0
  61. package/dist/plugins/app-types/logger/index.d.ts +122 -0
  62. package/dist/plugins/app-types/menuManager/hooks.d.ts +17 -0
  63. package/dist/plugins/app-types/menuManager/index.d.ts +28 -0
  64. package/dist/plugins/app-types/models/global.d.ts +32 -0
  65. package/dist/plugins/app-types/models/index.d.ts +45 -0
  66. package/dist/plugins/app-types/models/type.d.ts +2 -0
  67. package/dist/plugins/app-types/package.json +15 -0
  68. package/dist/plugins/app-types/plugin/index.d.ts +0 -0
  69. package/dist/plugins/app-types/pubsub/example.d.ts +5 -0
  70. package/dist/plugins/app-types/pubsub/index.d.ts +63 -0
  71. package/dist/plugins/app-types/request/cache.d.ts +46 -0
  72. package/dist/plugins/app-types/request/cancelToken.d.ts +38 -0
  73. package/dist/plugins/app-types/request/config.d.ts +3 -0
  74. package/dist/plugins/app-types/request/constants.d.ts +2 -0
  75. package/dist/plugins/app-types/request/index.d.ts +24 -0
  76. package/dist/plugins/app-types/request/pisell2Request.d.ts +6 -0
  77. package/dist/plugins/app-types/request/type.d.ts +41 -0
  78. package/dist/plugins/app-types/request/utils.d.ts +46 -0
  79. package/dist/plugins/app-types/routes/config.d.ts +7 -0
  80. package/dist/plugins/app-types/routes/index.d.ts +28 -0
  81. package/dist/plugins/app-types/socket/components/SocketMonitorPage.d.ts +6 -0
  82. package/dist/plugins/app-types/socket/components/index.d.ts +2 -0
  83. package/dist/plugins/app-types/socket/constants.d.ts +33 -0
  84. package/dist/plugins/app-types/socket/events.d.ts +31 -0
  85. package/dist/plugins/app-types/socket/heartbeat.d.ts +66 -0
  86. package/dist/plugins/app-types/socket/index.d.ts +61 -0
  87. package/dist/plugins/app-types/socket/monitor.d.ts +169 -0
  88. package/dist/plugins/app-types/socket/reconnect.d.ts +61 -0
  89. package/dist/plugins/app-types/socket/socket.d.ts +129 -0
  90. package/dist/plugins/app-types/socket/types.d.ts +85 -0
  91. package/dist/plugins/app-types/storage/index.d.ts +17 -0
  92. package/dist/plugins/app-types/tasks/index.d.ts +77 -0
  93. package/dist/plugins/app-types/tasks/type.d.ts +62 -0
  94. package/dist/plugins/app-types/tasks/useTasks.d.ts +5 -0
  95. package/dist/plugins/app-types/type.d.ts +2 -0
  96. package/dist/plugins/app-types/variables/VariablesProvider.d.ts +7 -0
  97. package/dist/plugins/app-types/variables/config.d.ts +3 -0
  98. package/dist/plugins/app-types/variables/index.d.ts +6 -0
  99. package/dist/plugins/app-types/variables/type.d.ts +2 -0
  100. package/dist/plugins/app-types/website/index.d.ts +6 -0
  101. package/dist/plugins/app.d.ts +8 -0
  102. package/dist/plugins/app.js +1 -0
  103. package/dist/plugins/window.d.ts +1 -0
  104. package/dist/solution/BookingByStep/index.js +59 -35
  105. package/dist/solution/BookingByStep/types.d.ts +3 -2
  106. package/dist/solution/BookingTicket/index.d.ts +172 -0
  107. package/dist/solution/BookingTicket/index.js +665 -0
  108. package/dist/solution/BookingTicket/types.d.ts +68 -0
  109. package/dist/solution/BookingTicket/types.js +43 -0
  110. package/dist/solution/BookingTicket/utils/scan/cloudSearch.d.ts +22 -0
  111. package/dist/solution/BookingTicket/utils/scan/cloudSearch.js +159 -0
  112. package/dist/solution/BookingTicket/utils/scan/handleScan.d.ts +16 -0
  113. package/dist/solution/BookingTicket/utils/scan/handleScan.js +174 -0
  114. package/dist/solution/BookingTicket/utils/scan/index.d.ts +81 -0
  115. package/dist/solution/BookingTicket/utils/scan/index.js +285 -0
  116. package/dist/solution/BookingTicket/utils/scan/scanCache.d.ts +78 -0
  117. package/dist/solution/BookingTicket/utils/scan/scanCache.js +305 -0
  118. package/dist/solution/BuyTickets/index.d.ts +2 -2
  119. package/dist/solution/BuyTickets/index.js +1 -1
  120. package/dist/solution/Checkout/appointmentDemo.json +1 -0
  121. package/dist/solution/Checkout/index.d.ts +181 -0
  122. package/dist/solution/Checkout/index.js +1596 -0
  123. package/dist/solution/Checkout/types.d.ts +550 -0
  124. package/dist/solution/Checkout/types.js +132 -0
  125. package/dist/solution/Checkout/utils/index.d.ts +73 -0
  126. package/dist/solution/Checkout/utils/index.js +371 -0
  127. package/dist/solution/ShopDiscount/index.js +4 -2
  128. package/dist/solution/index.d.ts +2 -0
  129. package/dist/solution/index.js +3 -1
  130. package/dist/types/index.d.ts +3 -1
  131. package/dist/utils/task.d.ts +40 -0
  132. package/dist/utils/task.js +171 -0
  133. package/dist/utils/watch.d.ts +102 -0
  134. package/dist/utils/watch.js +294 -0
  135. package/lib/core/index.js +1 -1
  136. package/lib/effects/index.d.ts +4 -3
  137. package/lib/effects/index.js +4 -1
  138. package/lib/modules/AccountList/index.d.ts +7 -1
  139. package/lib/modules/AccountList/index.js +27 -0
  140. package/lib/modules/AccountList/types.d.ts +28 -0
  141. package/lib/modules/Cart/index.js +1 -1
  142. package/lib/modules/Cart/utils/changePrice.d.ts +2 -2
  143. package/lib/modules/Cart/utils/changePrice.js +1 -1
  144. package/lib/modules/Customer/constants.d.ts +7 -0
  145. package/lib/modules/Customer/constants.js +39 -0
  146. package/lib/modules/Customer/index.d.ts +122 -0
  147. package/lib/modules/Customer/index.js +440 -0
  148. package/lib/modules/Customer/types.d.ts +146 -0
  149. package/lib/modules/Customer/types.js +37 -0
  150. package/lib/modules/Payment/cash.d.ts +11 -0
  151. package/lib/modules/Payment/cash.js +51 -0
  152. package/lib/modules/Payment/eftpos.d.ts +11 -0
  153. package/lib/modules/Payment/eftpos.js +51 -0
  154. package/lib/modules/Payment/index.d.ts +273 -9
  155. package/lib/modules/Payment/index.js +1285 -50
  156. package/lib/modules/Payment/types.d.ts +382 -30
  157. package/lib/modules/Payment/types.js +41 -6
  158. package/lib/modules/Payment/wallet.d.ts +11 -0
  159. package/lib/modules/Payment/wallet.js +51 -0
  160. package/lib/modules/Payment/walletpass.d.ts +0 -0
  161. package/lib/modules/Payment/walletpass.js +0 -0
  162. package/lib/modules/ProductList/index.d.ts +13 -3
  163. package/lib/modules/ProductList/index.js +37 -26
  164. package/lib/modules/ProductList/types.d.ts +0 -1
  165. package/lib/modules/Rules/index.js +20 -12
  166. package/lib/modules/Rules/types.d.ts +1 -0
  167. package/lib/modules/index.d.ts +1 -0
  168. package/lib/modules/index.js +2 -0
  169. package/lib/plugins/app-types/app/app.d.ts +83 -0
  170. package/lib/plugins/app-types/app/const.d.ts +4 -0
  171. package/lib/plugins/app-types/app/index.d.ts +14 -0
  172. package/lib/plugins/app-types/applicationManager/application.d.ts +50 -0
  173. package/lib/plugins/app-types/applicationManager/index.d.ts +13 -0
  174. package/lib/plugins/app-types/config.d.ts +3 -0
  175. package/lib/plugins/app-types/cookie/index.d.ts +13 -0
  176. package/lib/plugins/app-types/data/index.d.ts +8 -0
  177. package/lib/plugins/app-types/history/config.d.ts +24 -0
  178. package/lib/plugins/app-types/history/index.d.ts +20 -0
  179. package/lib/plugins/app-types/history/type.d.ts +2 -0
  180. package/lib/plugins/app-types/hooks/index.d.ts +12 -0
  181. package/lib/plugins/app-types/hooks/useDelayedValue/index.d.ts +2 -0
  182. package/lib/plugins/app-types/hooks/useDispatch/index.d.ts +2 -0
  183. package/lib/plugins/app-types/hooks/useLowCode/index.d.ts +13 -0
  184. package/lib/plugins/app-types/hooks/useStore/index.d.ts +6 -0
  185. package/lib/plugins/app-types/index.d.ts +6 -0
  186. package/lib/plugins/app-types/indexDB/index.d.ts +178 -0
  187. package/lib/plugins/app-types/locales/en.d.ts +3 -0
  188. package/lib/plugins/app-types/locales/index.d.ts +37 -0
  189. package/lib/plugins/app-types/locales/original.d.ts +3 -0
  190. package/lib/plugins/app-types/locales/type.d.ts +19 -0
  191. package/lib/plugins/app-types/locales/zh-CN.d.ts +3 -0
  192. package/lib/plugins/app-types/locales/zh-HK.d.ts +3 -0
  193. package/lib/plugins/app-types/logger/feishu.d.ts +11 -0
  194. package/lib/plugins/app-types/logger/index.d.ts +122 -0
  195. package/lib/plugins/app-types/menuManager/hooks.d.ts +17 -0
  196. package/lib/plugins/app-types/menuManager/index.d.ts +28 -0
  197. package/lib/plugins/app-types/models/global.d.ts +32 -0
  198. package/lib/plugins/app-types/models/index.d.ts +45 -0
  199. package/lib/plugins/app-types/models/type.d.ts +2 -0
  200. package/lib/plugins/app-types/package.json +15 -0
  201. package/lib/plugins/app-types/plugin/index.d.ts +0 -0
  202. package/lib/plugins/app-types/pubsub/example.d.ts +5 -0
  203. package/lib/plugins/app-types/pubsub/index.d.ts +63 -0
  204. package/lib/plugins/app-types/request/cache.d.ts +46 -0
  205. package/lib/plugins/app-types/request/cancelToken.d.ts +38 -0
  206. package/lib/plugins/app-types/request/config.d.ts +3 -0
  207. package/lib/plugins/app-types/request/constants.d.ts +2 -0
  208. package/lib/plugins/app-types/request/index.d.ts +24 -0
  209. package/lib/plugins/app-types/request/pisell2Request.d.ts +6 -0
  210. package/lib/plugins/app-types/request/type.d.ts +41 -0
  211. package/lib/plugins/app-types/request/utils.d.ts +46 -0
  212. package/lib/plugins/app-types/routes/config.d.ts +7 -0
  213. package/lib/plugins/app-types/routes/index.d.ts +28 -0
  214. package/lib/plugins/app-types/socket/components/SocketMonitorPage.d.ts +6 -0
  215. package/lib/plugins/app-types/socket/components/index.d.ts +2 -0
  216. package/lib/plugins/app-types/socket/constants.d.ts +33 -0
  217. package/lib/plugins/app-types/socket/events.d.ts +31 -0
  218. package/lib/plugins/app-types/socket/heartbeat.d.ts +66 -0
  219. package/lib/plugins/app-types/socket/index.d.ts +61 -0
  220. package/lib/plugins/app-types/socket/monitor.d.ts +169 -0
  221. package/lib/plugins/app-types/socket/reconnect.d.ts +61 -0
  222. package/lib/plugins/app-types/socket/socket.d.ts +129 -0
  223. package/lib/plugins/app-types/socket/types.d.ts +85 -0
  224. package/lib/plugins/app-types/storage/index.d.ts +17 -0
  225. package/lib/plugins/app-types/tasks/index.d.ts +77 -0
  226. package/lib/plugins/app-types/tasks/type.d.ts +62 -0
  227. package/lib/plugins/app-types/tasks/useTasks.d.ts +5 -0
  228. package/lib/plugins/app-types/type.d.ts +2 -0
  229. package/lib/plugins/app-types/variables/VariablesProvider.d.ts +7 -0
  230. package/lib/plugins/app-types/variables/config.d.ts +3 -0
  231. package/lib/plugins/app-types/variables/index.d.ts +6 -0
  232. package/lib/plugins/app-types/variables/type.d.ts +2 -0
  233. package/lib/plugins/app-types/website/index.d.ts +6 -0
  234. package/lib/plugins/app.d.ts +8 -0
  235. package/lib/plugins/app.js +17 -0
  236. package/lib/plugins/window.d.ts +1 -0
  237. package/lib/solution/BookingByStep/index.js +40 -29
  238. package/lib/solution/BookingByStep/types.d.ts +3 -2
  239. package/lib/solution/BookingTicket/index.d.ts +172 -0
  240. package/lib/solution/BookingTicket/index.js +399 -0
  241. package/lib/solution/BookingTicket/types.d.ts +68 -0
  242. package/lib/solution/BookingTicket/types.js +72 -0
  243. package/lib/solution/BookingTicket/utils/scan/cloudSearch.d.ts +22 -0
  244. package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +117 -0
  245. package/lib/solution/BookingTicket/utils/scan/handleScan.d.ts +16 -0
  246. package/lib/solution/BookingTicket/utils/scan/handleScan.js +125 -0
  247. package/lib/solution/BookingTicket/utils/scan/index.d.ts +81 -0
  248. package/lib/solution/BookingTicket/utils/scan/index.js +210 -0
  249. package/lib/solution/BookingTicket/utils/scan/scanCache.d.ts +78 -0
  250. package/lib/solution/BookingTicket/utils/scan/scanCache.js +231 -0
  251. package/lib/solution/BuyTickets/index.d.ts +2 -2
  252. package/lib/solution/BuyTickets/index.js +1 -1
  253. package/lib/solution/Checkout/appointmentDemo.json +1 -0
  254. package/lib/solution/Checkout/index.d.ts +181 -0
  255. package/lib/solution/Checkout/index.js +864 -0
  256. package/lib/solution/Checkout/types.d.ts +550 -0
  257. package/lib/solution/Checkout/types.js +75 -0
  258. package/lib/solution/Checkout/utils/index.d.ts +73 -0
  259. package/lib/solution/Checkout/utils/index.js +266 -0
  260. package/lib/solution/ShopDiscount/index.js +2 -1
  261. package/lib/solution/index.d.ts +2 -0
  262. package/lib/solution/index.js +5 -1
  263. package/lib/types/index.d.ts +3 -1
  264. package/lib/utils/task.d.ts +40 -0
  265. package/lib/utils/task.js +109 -0
  266. package/lib/utils/watch.d.ts +102 -0
  267. package/lib/utils/watch.js +217 -0
  268. package/package.json +4 -2
@@ -24,7 +24,6 @@ __export(ProductList_exports, {
24
24
  });
25
25
  module.exports = __toCommonJS(ProductList_exports);
26
26
  var import_BaseModule = require("../BaseModule");
27
- var import_Product = require("../Product");
28
27
  var import_types = require("./types");
29
28
  var import_lodash_es = require("lodash-es");
30
29
  __reExport(ProductList_exports, require("./types"), module.exports);
@@ -41,43 +40,33 @@ var ProductList = class extends import_BaseModule.BaseModule {
41
40
  this.store = options.store;
42
41
  this.otherParams = options.otherParams || {};
43
42
  if (Array.isArray((_a = options.initialState) == null ? void 0 : _a.list)) {
44
- this.store.list = options.initialState.list;
43
+ this.store.list = options.initialState.list.slice().sort((a, b) => Number(b.sort) - Number(a.sort));
45
44
  this.core.effects.emit(`${this.name}:changed`, this.store.list);
46
- this.storeChange();
47
45
  } else {
48
46
  this.store.list = [];
49
- this.store.productMap = /* @__PURE__ */ new Map();
50
47
  this.store.selectProducts = [];
51
48
  }
52
49
  this.request = core.getPlugin("request");
53
50
  }
54
51
  async storeChange(path, value) {
55
- var _a;
56
- (_a = this.store.list) == null ? void 0 : _a.forEach((product) => {
57
- const productModule = this.store.productMap.get(`product-${product.id}`);
58
- if (!productModule) {
59
- const newProductModule = new import_Product.Product(
60
- `product_${product.id.toString()}`
61
- );
62
- this.core.registerModule(newProductModule, { initialState: product });
63
- this.store.productMap.set(product.id.toString(), newProductModule);
64
- } else {
65
- productModule.updateData(product);
66
- }
67
- });
68
52
  }
69
53
  async loadProducts({
70
54
  category_ids = [],
71
55
  product_ids = [],
72
56
  collection = [],
57
+ menu_list_ids = [],
58
+ customer_id: paramsCustomerId,
59
+ with_count = [],
60
+ schedule_datetime,
73
61
  schedule_date,
74
- cacheId
62
+ cacheId,
63
+ with_schedule
75
64
  }) {
76
65
  var _a, _b;
77
66
  let userPlugin = this.core.getPlugin("user");
78
67
  let customer_id = void 0;
79
68
  try {
80
- customer_id = (_a = userPlugin == null ? void 0 : userPlugin.get()) == null ? void 0 : _a.id;
69
+ customer_id = paramsCustomerId || ((_a = userPlugin == null ? void 0 : userPlugin.get()) == null ? void 0 : _a.id);
81
70
  } catch (error) {
82
71
  console.error(error);
83
72
  }
@@ -103,14 +92,19 @@ var ProductList = class extends import_BaseModule.BaseModule {
103
92
  ids: product_ids,
104
93
  collection,
105
94
  front_end_cache_id: cacheId,
95
+ menu_list_ids,
96
+ with_count,
106
97
  // client_schedule_ids: schedule_ids,
107
98
  schedule_date,
99
+ with_schedule,
100
+ schedule_datetime,
108
101
  application_code: (_b = this.otherParams) == null ? void 0 : _b.channel
109
102
  },
110
103
  { useCache: true }
111
104
  );
112
- this.addProduct(productsData.data.list);
113
- return productsData.data.list;
105
+ const sortedList = (productsData.data.list || []).slice().sort((a, b) => Number(b.sort) - Number(a.sort));
106
+ this.addProduct(sortedList);
107
+ return sortedList;
114
108
  }
115
109
  async loadProductsPrice({
116
110
  ids = [],
@@ -142,10 +136,8 @@ var ProductList = class extends import_BaseModule.BaseModule {
142
136
  import_types.ProductListHooks.onGetProduct,
143
137
  this.store.list
144
138
  );
145
- const product = this.store.productMap.get(`${id}`);
146
- if (product)
147
- return product;
148
- return void 0;
139
+ const product = this.store.list.find((product2) => product2.id === id);
140
+ return product ? (0, import_lodash_es.cloneDeep)(product) : void 0;
149
141
  }
150
142
  async addProduct(products) {
151
143
  if (!this.store.list) {
@@ -159,11 +151,30 @@ var ProductList = class extends import_BaseModule.BaseModule {
159
151
  this.store.list[index] = n;
160
152
  }
161
153
  });
162
- this.storeChange();
154
+ this.store.list.sort((a, b) => Number(b.sort) - Number(a.sort));
155
+ this.core.effects.emit(`${this.name}:changed`, this.store.list);
163
156
  }
164
157
  async selectProducts(products) {
165
158
  this.store.selectProducts = products;
166
159
  }
160
+ /**
161
+ * 根据商品编码或条码搜索商品
162
+ * @param code 商品编码或条码
163
+ * @returns 匹配的商品列表,如果没有匹配则返回空数组
164
+ */
165
+ findProductsByCodeOrBarcode(code) {
166
+ if (!code || typeof code !== "string") {
167
+ return [];
168
+ }
169
+ const trimmedCode = code.trim();
170
+ if (!trimmedCode) {
171
+ return [];
172
+ }
173
+ const matchingProducts = this.store.list.filter((product) => {
174
+ return product.code && product.code.trim() === trimmedCode || product.barcode && product.barcode.trim() === trimmedCode;
175
+ });
176
+ return (0, import_lodash_es.cloneDeep)(matchingProducts);
177
+ }
167
178
  };
168
179
  // Annotate the CommonJS export names for ESM import in node:
169
180
  0 && (module.exports = {
@@ -1,7 +1,6 @@
1
1
  import { ProductData } from '../Product/types';
2
2
  export interface ProductListData {
3
3
  list: ProductData[];
4
- productMap: Map<string, any>;
5
4
  selectProducts: ProductData[];
6
5
  }
7
6
  export declare enum ProductListHooks {
@@ -37,6 +37,7 @@ var import_types = require("./types");
37
37
  var import_utils = require("../../solution/ShopDiscount/utils");
38
38
  var import_utils2 = require("../Cart/utils");
39
39
  var import_decimal = __toESM(require("decimal.js"));
40
+ var import_lodash_es = require("lodash-es");
40
41
  var RulesModule = class extends import_BaseModule.BaseModule {
41
42
  constructor(name, version) {
42
43
  super(name, version);
@@ -188,19 +189,23 @@ var RulesModule = class extends import_BaseModule.BaseModule {
188
189
  if (isAvailableProduct && isLimitedProduct) {
189
190
  (_c = discountApplicability.get(discount.id)) == null ? void 0 : _c.push(product.id);
190
191
  const applicableProducts = discountApplicableProducts.get(discount.id) || [];
191
- applicableProducts.push({
192
+ const discountType = discount.tag || discount.type;
193
+ const productData = {
192
194
  amount: product.price,
193
- type: discount.tag || discount.type,
194
- tag: discount.tag || discount.type,
195
+ type: discountType,
196
+ tag: discountType,
195
197
  discount: {
196
198
  resource_id: discount.id,
197
199
  title: discount.format_title,
198
200
  original_amount: product.origin_total,
199
201
  pre_value: discount.par_value,
200
202
  product_id: originProduct.id
201
- },
202
- num: product.num || 1
203
- });
203
+ }
204
+ };
205
+ if (discountType !== "good_pass") {
206
+ productData.num = product.num || 1;
207
+ }
208
+ applicableProducts.push(productData);
204
209
  discountApplicableProducts.set(discount.id, applicableProducts);
205
210
  }
206
211
  });
@@ -215,9 +220,9 @@ var RulesModule = class extends import_BaseModule.BaseModule {
215
220
  }
216
221
  const applicableDiscounts = sortedDiscountList.filter((discount) => {
217
222
  var _a2;
218
- if ((Number(product.price) === 0 || !product.price) && (discount.tag || discount.type) === "good_pass")
223
+ if ((Number(product.price) <= 0 || !product.price) && (discount.tag || discount.type) === "good_pass")
219
224
  return false;
220
- if ((Number(product.total) === 0 || !product.total) && !((_a2 = product.discount_list) == null ? void 0 : _a2.find((n) => {
225
+ if ((Number(product.total) <= 0 || !product.total) && !((_a2 = product.discount_list) == null ? void 0 : _a2.find((n) => {
221
226
  var _a3;
222
227
  return ((_a3 = n.discount) == null ? void 0 : _a3.resource_id) === discount.id;
223
228
  })) && (discount.tag || discount.type) !== "good_pass")
@@ -242,7 +247,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
242
247
  }))) {
243
248
  isManualDiscount = false;
244
249
  }
245
- if (applicableDiscounts.length === 0 || isManualDiscount) {
250
+ if (applicableDiscounts.length === 0 || isManualDiscount || (0, import_lodash_es.isBoolean)(product.vouchersApplicable) && !product.vouchersApplicable) {
246
251
  if (product.isClient) {
247
252
  processedProductsMap.set(
248
253
  product._id,
@@ -309,18 +314,21 @@ var RulesModule = class extends import_BaseModule.BaseModule {
309
314
  productOriginTotal = product.total;
310
315
  }
311
316
  const targetProductTotal = selectedDiscount2.tag === "good_pass" ? new import_decimal.default(productOriginTotal).minus(new import_decimal.default(product.price || 0)).toNumber() : new import_decimal.default(100).minus(selectedDiscount2.par_value || 0).div(100).mul(new import_decimal.default(productOriginTotal)).toNumber();
317
+ const discountType = selectedDiscount2.tag === "product_discount_card" ? "discount_card" : selectedDiscount2.tag;
312
318
  const discountDetail = {
313
319
  amount: new import_decimal.default(productOriginTotal).minus(new import_decimal.default(targetProductTotal)).toNumber(),
314
- type: selectedDiscount2.tag === "product_discount_card" ? "discount_card" : selectedDiscount2.tag,
320
+ type: discountType,
315
321
  discount: {
316
322
  resource_id: selectedDiscount2.id,
317
323
  title: selectedDiscount2.format_title,
318
324
  original_amount: productOriginTotal,
319
325
  product_id: originProduct.id,
320
326
  percent: selectedDiscount2.par_value
321
- },
322
- num: product.num || 1
327
+ }
323
328
  };
329
+ if ((selectedDiscount2.tag || selectedDiscount2.type) !== "good_pass") {
330
+ discountDetail.num = product.num || 1;
331
+ }
324
332
  appliedProducts.push(discountDetail);
325
333
  appliedDiscountProducts.set(selectedDiscount2.id, appliedProducts);
326
334
  if (product.isClient) {
@@ -39,6 +39,7 @@ type ProductDetail = {
39
39
  original_price?: number | string;
40
40
  num?: number;
41
41
  quantity: number;
42
+ vouchersApplicable?: boolean;
42
43
  };
43
44
  export interface RulesParamsHooks {
44
45
  getProduct: (product: Record<string, any>) => ProductDetail;
@@ -3,6 +3,7 @@ export * from './ProductList';
3
3
  export * from './Cart';
4
4
  export * from './Account';
5
5
  export * from './AccountList';
6
+ export * from './Customer';
6
7
  export * from './Date';
7
8
  export * from './Guests';
8
9
  export * from './Order';
@@ -21,6 +21,7 @@ __reExport(modules_exports, require("./ProductList"), module.exports);
21
21
  __reExport(modules_exports, require("./Cart"), module.exports);
22
22
  __reExport(modules_exports, require("./Account"), module.exports);
23
23
  __reExport(modules_exports, require("./AccountList"), module.exports);
24
+ __reExport(modules_exports, require("./Customer"), module.exports);
24
25
  __reExport(modules_exports, require("./Date"), module.exports);
25
26
  __reExport(modules_exports, require("./Guests"), module.exports);
26
27
  __reExport(modules_exports, require("./Order"), module.exports);
@@ -36,6 +37,7 @@ __reExport(modules_exports, require("./Schedule"), module.exports);
36
37
  ...require("./Cart"),
37
38
  ...require("./Account"),
38
39
  ...require("./AccountList"),
40
+ ...require("./Customer"),
39
41
  ...require("./Date"),
40
42
  ...require("./Guests"),
41
43
  ...require("./Order"),
@@ -0,0 +1,83 @@
1
+ import { RouterManager } from '../routes';
2
+ import { ApplicationManager } from '../applicationManager';
3
+ import { History, HistoryOptions } from '../history';
4
+ import { Data } from '../data';
5
+ import { Locales, LocalesOptions } from '../locales';
6
+ import { Storage, StorageOptions } from '../storage';
7
+ import { MenuManager } from '../menuManager';
8
+ import LoggerManager, { LoggerOptions } from '../logger';
9
+ import { TasksManager } from '../tasks';
10
+ import IndexDBManager, { DBOptions } from '../indexDB';
11
+ declare global {
12
+ interface Window {
13
+ app: App;
14
+ }
15
+ }
16
+ export interface AppOptions {
17
+ logger?: LoggerOptions;
18
+ db?: DBOptions;
19
+ constants?: any;
20
+ history?: HistoryOptions;
21
+ storage?: StorageOptions;
22
+ locales?: LocalesOptions;
23
+ }
24
+ declare class App {
25
+ private static instance;
26
+ private plugins;
27
+ globalData: any;
28
+ router: RouterManager;
29
+ applicationManager: ApplicationManager;
30
+ history: History;
31
+ data: Data;
32
+ hooks: import("../hooks").HooksExport;
33
+ locales: Locales;
34
+ models: {
35
+ getStore: () => import("../models").Store;
36
+ StoreProvider: typeof import("react-redux").Provider;
37
+ setConfig: (models: any[]) => void;
38
+ };
39
+ request: {
40
+ get: (url: import("../request").RequestWrapperProps["url"], data: import("../request").RequestWrapperProps["data"], config: import("../request").RequestWrapperProps["config"]) => Promise<any>;
41
+ post: (url: import("../request").RequestWrapperProps["url"], data: import("../request").RequestWrapperProps["data"], config: import("../request").RequestWrapperProps["config"]) => Promise<any>;
42
+ put: (url: import("../request").RequestWrapperProps["url"], data: import("../request").RequestWrapperProps["data"], config: import("../request").RequestWrapperProps["config"]) => Promise<any>;
43
+ remove: (url: import("../request").RequestWrapperProps["url"], data: import("../request").RequestWrapperProps["data"], config: import("../request").RequestWrapperProps["config"]) => Promise<any>;
44
+ custom: (url: import("../request").RequestWrapperProps["url"], config: import("../request").RequestWrapperProps["config"]) => Promise<any>;
45
+ setConfig: (newConfig: Partial<import("../request").RequestConfig>) => void;
46
+ getConfig: () => import("../request").RequestConfig;
47
+ };
48
+ storage: Storage;
49
+ menuManager: MenuManager;
50
+ cookie: {
51
+ setCookie: (name: string, value: string, domain?: string) => void;
52
+ getCookie: (name: string) => string | null;
53
+ deleteCookie: (name: string, domain?: string) => void;
54
+ checkCookie: (name: string) => boolean;
55
+ updateCookie: (name: string, value: string, domain?: string) => void;
56
+ };
57
+ website: {
58
+ setTitle: (title: string) => void;
59
+ setIcon: (paramsIcon: string) => void;
60
+ setAppleWebAppTitle: (title: string) => void;
61
+ };
62
+ logger: LoggerManager;
63
+ pubsub: import("../pubsub").PubSub;
64
+ tasksManager: TasksManager;
65
+ dbManager: IndexDBManager | null;
66
+ constants: {
67
+ channel: string;
68
+ [key: string]: string;
69
+ };
70
+ private constructor();
71
+ static getInstance(options?: AppOptions): App;
72
+ setGlobalData(globalData: any): void;
73
+ usePlugin(name: string, plugin: any): void;
74
+ usePlugins(plugins: {
75
+ name: string;
76
+ plugin: any;
77
+ }[]): void;
78
+ getPlugin(name: string): any;
79
+ getGlobalData(): any;
80
+ install(): void;
81
+ unInstall(): void;
82
+ }
83
+ export default App;
@@ -0,0 +1,4 @@
1
+ export declare enum APPEvent {
2
+ APP_INSTALL = "app.install",
3
+ APP_UNINSTALL = "app.uninstall"
4
+ }
@@ -0,0 +1,14 @@
1
+ import React from "react";
2
+ import App, { AppOptions } from "./app";
3
+ type AppContextType = {
4
+ globalData: any;
5
+ setGlobalData: React.Dispatch<React.SetStateAction<any>>;
6
+ app: App;
7
+ };
8
+ export declare const AppProvider: React.FC<{
9
+ children: React.ReactNode;
10
+ options: AppOptions;
11
+ }>;
12
+ export declare const useApp: () => AppContextType;
13
+ export declare const getApp: typeof App.getInstance;
14
+ export default App;
@@ -0,0 +1,50 @@
1
+ import App from "../app";
2
+ import { LoadLibraryByUrlParams } from "../locales/type";
3
+ import { MenuItem } from "../menuManager/index";
4
+ export type ApplicationInterface = {
5
+ page_type: "low_code" | "code";
6
+ page_id: number | string;
7
+ page_code: string;
8
+ page_version?: string;
9
+ page_name: string;
10
+ router: string;
11
+ category: "page" | "component" | "function";
12
+ Component?: any;
13
+ children?: any;
14
+ layout?: string;
15
+ originalUrl?: string;
16
+ };
17
+ export type ApplicationData = {
18
+ app_id: number;
19
+ app_name: string;
20
+ app_type: "system" | "custom";
21
+ interfaces: ApplicationInterface[];
22
+ functions?: any[];
23
+ menu?: {
24
+ [key: string]: MenuItem[];
25
+ };
26
+ locales?: LoadLibraryByUrlParams;
27
+ [key: string]: any;
28
+ };
29
+ export declare class Application {
30
+ options: ApplicationData;
31
+ name: ApplicationData["app_name"];
32
+ interfaces: Map<ApplicationInterface["page_name"], ApplicationInterface>;
33
+ components: Map<string, any>;
34
+ functions: Map<string, any>;
35
+ app: App;
36
+ constructor(options: ApplicationData, app: App);
37
+ afterAdd(application: Application): Promise<void>;
38
+ beforeLoad(): Promise<void>;
39
+ load(): Promise<void>;
40
+ initInterfaces(interfaces: ApplicationData["interfaces"]): void;
41
+ initFunctions(functions: ApplicationData["functions"]): void;
42
+ loadInterface(interfaceItem: ApplicationInterface): Promise<ApplicationInterface>;
43
+ setInterface(code: string, interfaceItem: ApplicationInterface): void;
44
+ setComponent(code: string, component: ApplicationInterface): void;
45
+ setFunction(code: string, functionItem: ApplicationInterface): void;
46
+ getInterface(code: string): ApplicationInterface | undefined;
47
+ getComponent(code: string): any;
48
+ getFunction(code: string): any;
49
+ runFunction(code: string, params?: any, ...args: any): any;
50
+ }
@@ -0,0 +1,13 @@
1
+ import APP from "../app";
2
+ import { Application, ApplicationData } from "./application";
3
+ export declare class ApplicationManager {
4
+ applicationList: Application[];
5
+ protected app: APP;
6
+ applications: Map<string, Application>;
7
+ constructor(applicationList: Application[] | undefined, app: APP);
8
+ init(applicationList: Application[] | ApplicationData[]): Promise<unknown>;
9
+ add(application: Application): Promise<void>;
10
+ get(appName: Application["name"]): Application | undefined;
11
+ remove(appName: Application["name"]): void;
12
+ load(): Promise<void>;
13
+ }
@@ -0,0 +1,3 @@
1
+ import { CoreConfig } from './type';
2
+ export declare const setConfig: (newConfig: Partial<CoreConfig>) => void;
3
+ export declare const getConfig: () => CoreConfig;
@@ -0,0 +1,13 @@
1
+ declare function setCookie(name: string, value: string, domain?: string): void;
2
+ declare function getCookie(name: string): string | null;
3
+ declare function deleteCookie(name: string, domain?: string): void;
4
+ declare function checkCookie(name: string): boolean;
5
+ declare function updateCookie(name: string, value: string, domain?: string): void;
6
+ declare const _default: {
7
+ setCookie: typeof setCookie;
8
+ getCookie: typeof getCookie;
9
+ deleteCookie: typeof deleteCookie;
10
+ checkCookie: typeof checkCookie;
11
+ updateCookie: typeof updateCookie;
12
+ };
13
+ export default _default;
@@ -0,0 +1,8 @@
1
+ import { Storage } from '../storage';
2
+ import App from '../app';
3
+ export declare class Data {
4
+ private app;
5
+ storage: Storage;
6
+ store: any;
7
+ constructor(app: App);
8
+ }
@@ -0,0 +1,24 @@
1
+ import { HistoryConfig } from './type';
2
+ /**
3
+ * @title: 默认配置
4
+ * @description:
5
+ * @return {*}
6
+ * @Author: zhiwei.Wang
7
+ */
8
+ export declare const defaultConfig: HistoryConfig;
9
+ /**
10
+ * @title: 设置配置
11
+ * @description:
12
+ * @param {Partial} newConfig
13
+ * @return {*}
14
+ * @Author: zhiwei.Wang
15
+ */
16
+ export declare const setConfig: (newConfig: Partial<HistoryConfig>) => HistoryConfig;
17
+ /**
18
+ * @title: 获取配置
19
+ * @description:
20
+ * @param {*} HistoryConfig
21
+ * @return {*}
22
+ * @Author: zhiwei.Wang
23
+ */
24
+ export declare const getConfig: () => HistoryConfig;
@@ -0,0 +1,20 @@
1
+ import type { History as HistoryType } from "history";
2
+ import { useHistory, useLocation, useParams } from "react-router-dom";
3
+ import App from "../app";
4
+ export interface HistoryOptions {
5
+ basename?: string;
6
+ }
7
+ export declare class History {
8
+ instance: HistoryType<unknown>;
9
+ useHistory: typeof useHistory;
10
+ useLocation: typeof useLocation;
11
+ useParams: typeof useParams;
12
+ app: App;
13
+ constructor(app: App, options?: HistoryOptions);
14
+ push: HistoryType["push"];
15
+ replace: HistoryType["replace"];
16
+ reload: () => void;
17
+ reloadTo: (path: string) => void;
18
+ externalPage: (path: string) => void;
19
+ goLogin: () => any;
20
+ }
@@ -0,0 +1,2 @@
1
+ export interface HistoryConfig {
2
+ }
@@ -0,0 +1,12 @@
1
+ import useLowCode from './useLowCode';
2
+ import useDelayedValue from './useDelayedValue';
3
+ import useStore from './useStore';
4
+ import useDispatch from './useDispatch';
5
+ export interface HooksExport {
6
+ useLowCode: typeof useLowCode;
7
+ useDelayedValue: typeof useDelayedValue;
8
+ useStore: typeof useStore;
9
+ useDispatch: typeof useDispatch;
10
+ }
11
+ declare const _default: HooksExport;
12
+ export default _default;
@@ -0,0 +1,2 @@
1
+ declare function useDelayedValue<T>(value: T, timeout?: number): T;
2
+ export default useDelayedValue;
@@ -0,0 +1,2 @@
1
+ import { useDispatch } from "react-redux";
2
+ export default useDispatch;
@@ -0,0 +1,13 @@
1
+ export interface useLowCodeProps {
2
+ onChange: (e: any) => void;
3
+ onReady: (e: any) => void;
4
+ }
5
+ export interface useLowCodeResult {
6
+ lowcodeRef: {
7
+ onReady: (e: any) => void;
8
+ onChange: (e: any) => void;
9
+ };
10
+ setState: (values: any, callback?: any) => any;
11
+ }
12
+ declare const useLowCode: (props: Partial<useLowCodeProps>) => useLowCodeResult;
13
+ export default useLowCode;
@@ -0,0 +1,6 @@
1
+ import { ModelsState } from "../../models";
2
+ declare const useStore: <T extends keyof ModelsState, D extends keyof ModelsState[T]>(props: {
3
+ models: T;
4
+ key?: D;
5
+ }) => D extends undefined ? ModelsState[T] : ModelsState[T][D];
6
+ export default useStore;
@@ -0,0 +1,6 @@
1
+ export { default as request } from './request';
2
+ export { default as hooks } from './hooks';
3
+ export { default as models } from './models';
4
+ export { default as pubsub } from './pubsub';
5
+ export { default as socket } from './socket';
6
+ export * from './app';