@pisell/pisellos 2.1.4 → 2.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (287) hide show
  1. package/dist/core/index.js +2 -1
  2. package/dist/effects/index.d.ts +4 -3
  3. package/dist/effects/index.js +15 -6
  4. package/dist/modules/AccountList/index.d.ts +7 -1
  5. package/dist/modules/AccountList/index.js +81 -14
  6. package/dist/modules/AccountList/types.d.ts +28 -0
  7. package/dist/modules/AccountList/types.js +8 -0
  8. package/dist/modules/Cart/index.js +1 -1
  9. package/dist/modules/Customer/constants.d.ts +7 -0
  10. package/dist/modules/Customer/constants.js +12 -0
  11. package/dist/modules/Customer/index.d.ts +122 -0
  12. package/dist/modules/Customer/index.js +697 -0
  13. package/dist/modules/Customer/types.d.ts +146 -0
  14. package/dist/modules/Customer/types.js +41 -0
  15. package/dist/modules/Discount/index.d.ts +1 -0
  16. package/dist/modules/Order/index.d.ts +25 -1
  17. package/dist/modules/Order/index.js +224 -2
  18. package/dist/modules/Order/types.d.ts +45 -0
  19. package/dist/modules/Order/types.js +8 -0
  20. package/dist/modules/Payment/cash.d.ts +19 -0
  21. package/dist/modules/Payment/cash.js +97 -0
  22. package/dist/modules/Payment/cashRecommendationAlgorithm.d.ts +22 -0
  23. package/dist/modules/Payment/cashRecommendationAlgorithm.js +423 -0
  24. package/dist/modules/Payment/eftpos.d.ts +11 -0
  25. package/dist/modules/Payment/eftpos.js +80 -0
  26. package/dist/modules/Payment/index.d.ts +184 -9
  27. package/dist/modules/Payment/index.js +2012 -108
  28. package/dist/modules/Payment/mx51.d.ts +0 -0
  29. package/dist/modules/Payment/mx51.js +0 -0
  30. package/dist/modules/Payment/types.d.ts +750 -30
  31. package/dist/modules/Payment/types.js +236 -12
  32. package/dist/modules/Payment/utils.d.ts +17 -0
  33. package/dist/modules/Payment/utils.js +62 -0
  34. package/dist/modules/Payment/walletpass.d.ts +99 -0
  35. package/dist/modules/Payment/walletpass.js +701 -0
  36. package/dist/modules/Product/index.d.ts +1 -1
  37. package/dist/modules/ProductList/index.d.ts +12 -1
  38. package/dist/modules/ProductList/index.js +27 -3
  39. package/dist/modules/Rules/index.d.ts +2 -0
  40. package/dist/modules/Rules/index.js +39 -17
  41. package/dist/modules/Rules/types.d.ts +1 -0
  42. package/dist/modules/Schedule/index.d.ts +9 -0
  43. package/dist/modules/Schedule/index.js +68 -0
  44. package/dist/modules/index.d.ts +1 -0
  45. package/dist/modules/index.js +1 -0
  46. package/dist/plugins/app-types/app/app.d.ts +83 -0
  47. package/dist/plugins/app-types/app/const.d.ts +4 -0
  48. package/dist/plugins/app-types/app/index.d.ts +14 -0
  49. package/dist/plugins/app-types/applicationManager/application.d.ts +50 -0
  50. package/dist/plugins/app-types/applicationManager/index.d.ts +13 -0
  51. package/dist/plugins/app-types/config.d.ts +3 -0
  52. package/dist/plugins/app-types/cookie/index.d.ts +13 -0
  53. package/dist/plugins/app-types/data/index.d.ts +8 -0
  54. package/dist/plugins/app-types/history/config.d.ts +24 -0
  55. package/dist/plugins/app-types/history/index.d.ts +20 -0
  56. package/dist/plugins/app-types/history/type.d.ts +2 -0
  57. package/dist/plugins/app-types/hooks/index.d.ts +12 -0
  58. package/dist/plugins/app-types/hooks/useDelayedValue/index.d.ts +2 -0
  59. package/dist/plugins/app-types/hooks/useDispatch/index.d.ts +2 -0
  60. package/dist/plugins/app-types/hooks/useLowCode/index.d.ts +13 -0
  61. package/dist/plugins/app-types/hooks/useStore/index.d.ts +6 -0
  62. package/dist/plugins/app-types/index.d.ts +6 -0
  63. package/dist/plugins/app-types/indexDB/index.d.ts +178 -0
  64. package/dist/plugins/app-types/locales/en.d.ts +3 -0
  65. package/dist/plugins/app-types/locales/index.d.ts +37 -0
  66. package/dist/plugins/app-types/locales/original.d.ts +3 -0
  67. package/dist/plugins/app-types/locales/type.d.ts +19 -0
  68. package/dist/plugins/app-types/locales/zh-CN.d.ts +3 -0
  69. package/dist/plugins/app-types/locales/zh-HK.d.ts +3 -0
  70. package/dist/plugins/app-types/logger/feishu.d.ts +11 -0
  71. package/dist/plugins/app-types/logger/index.d.ts +122 -0
  72. package/dist/plugins/app-types/menuManager/hooks.d.ts +17 -0
  73. package/dist/plugins/app-types/menuManager/index.d.ts +28 -0
  74. package/dist/plugins/app-types/models/global.d.ts +32 -0
  75. package/dist/plugins/app-types/models/index.d.ts +45 -0
  76. package/dist/plugins/app-types/models/type.d.ts +2 -0
  77. package/dist/plugins/app-types/package.json +15 -0
  78. package/dist/plugins/app-types/plugin/index.d.ts +0 -0
  79. package/dist/plugins/app-types/pubsub/example.d.ts +5 -0
  80. package/dist/plugins/app-types/pubsub/index.d.ts +63 -0
  81. package/dist/plugins/app-types/request/cache.d.ts +46 -0
  82. package/dist/plugins/app-types/request/cancelToken.d.ts +38 -0
  83. package/dist/plugins/app-types/request/config.d.ts +3 -0
  84. package/dist/plugins/app-types/request/constants.d.ts +2 -0
  85. package/dist/plugins/app-types/request/index.d.ts +24 -0
  86. package/dist/plugins/app-types/request/pisell2Request.d.ts +6 -0
  87. package/dist/plugins/app-types/request/type.d.ts +41 -0
  88. package/dist/plugins/app-types/request/utils.d.ts +46 -0
  89. package/dist/plugins/app-types/routes/config.d.ts +7 -0
  90. package/dist/plugins/app-types/routes/index.d.ts +28 -0
  91. package/dist/plugins/app-types/socket/components/SocketMonitorPage.d.ts +6 -0
  92. package/dist/plugins/app-types/socket/components/index.d.ts +2 -0
  93. package/dist/plugins/app-types/socket/constants.d.ts +33 -0
  94. package/dist/plugins/app-types/socket/events.d.ts +31 -0
  95. package/dist/plugins/app-types/socket/heartbeat.d.ts +66 -0
  96. package/dist/plugins/app-types/socket/index.d.ts +61 -0
  97. package/dist/plugins/app-types/socket/monitor.d.ts +169 -0
  98. package/dist/plugins/app-types/socket/reconnect.d.ts +61 -0
  99. package/dist/plugins/app-types/socket/socket.d.ts +129 -0
  100. package/dist/plugins/app-types/socket/types.d.ts +85 -0
  101. package/dist/plugins/app-types/storage/index.d.ts +17 -0
  102. package/dist/plugins/app-types/tasks/index.d.ts +77 -0
  103. package/dist/plugins/app-types/tasks/type.d.ts +62 -0
  104. package/dist/plugins/app-types/tasks/useTasks.d.ts +5 -0
  105. package/dist/plugins/app-types/type.d.ts +2 -0
  106. package/dist/plugins/app-types/variables/VariablesProvider.d.ts +7 -0
  107. package/dist/plugins/app-types/variables/config.d.ts +3 -0
  108. package/dist/plugins/app-types/variables/index.d.ts +6 -0
  109. package/dist/plugins/app-types/variables/type.d.ts +2 -0
  110. package/dist/plugins/app-types/website/index.d.ts +6 -0
  111. package/dist/plugins/app.d.ts +8 -0
  112. package/dist/plugins/app.js +1 -0
  113. package/dist/plugins/window.d.ts +1 -0
  114. package/dist/solution/BookingByStep/index.d.ts +1 -1
  115. package/dist/solution/BookingByStep/index.js +1 -1
  116. package/dist/solution/BookingTicket/index.d.ts +180 -0
  117. package/dist/solution/BookingTicket/index.js +689 -0
  118. package/dist/solution/BookingTicket/types.d.ts +68 -0
  119. package/dist/solution/BookingTicket/types.js +43 -0
  120. package/dist/solution/BookingTicket/utils/scan/cloudSearch.d.ts +22 -0
  121. package/dist/solution/BookingTicket/utils/scan/cloudSearch.js +159 -0
  122. package/dist/solution/BookingTicket/utils/scan/handleScan.d.ts +22 -0
  123. package/dist/solution/BookingTicket/utils/scan/handleScan.js +189 -0
  124. package/dist/solution/BookingTicket/utils/scan/index.d.ts +81 -0
  125. package/dist/solution/BookingTicket/utils/scan/index.js +285 -0
  126. package/dist/solution/BookingTicket/utils/scan/scanCache.d.ts +78 -0
  127. package/dist/solution/BookingTicket/utils/scan/scanCache.js +305 -0
  128. package/dist/solution/Checkout/appointmentDemo.json +1 -0
  129. package/dist/solution/Checkout/index.d.ts +509 -0
  130. package/dist/solution/Checkout/index.js +4874 -0
  131. package/dist/solution/Checkout/types.d.ts +923 -0
  132. package/dist/solution/Checkout/types.js +148 -0
  133. package/dist/solution/Checkout/utils/index.d.ts +117 -0
  134. package/dist/solution/Checkout/utils/index.js +549 -0
  135. package/dist/solution/ShopDiscount/index.d.ts +4 -9
  136. package/dist/solution/ShopDiscount/index.js +106 -54
  137. package/dist/solution/ShopDiscount/types.d.ts +10 -1
  138. package/dist/solution/index.d.ts +2 -0
  139. package/dist/solution/index.js +3 -1
  140. package/dist/types/index.d.ts +3 -1
  141. package/dist/utils/task.d.ts +40 -0
  142. package/dist/utils/task.js +171 -0
  143. package/dist/utils/watch.d.ts +102 -0
  144. package/dist/utils/watch.js +294 -0
  145. package/lib/core/index.js +1 -1
  146. package/lib/effects/index.d.ts +4 -3
  147. package/lib/effects/index.js +4 -1
  148. package/lib/modules/AccountList/index.d.ts +7 -1
  149. package/lib/modules/AccountList/index.js +27 -0
  150. package/lib/modules/AccountList/types.d.ts +28 -0
  151. package/lib/modules/Cart/index.js +1 -1
  152. package/lib/modules/Customer/constants.d.ts +7 -0
  153. package/lib/modules/Customer/constants.js +39 -0
  154. package/lib/modules/Customer/index.d.ts +122 -0
  155. package/lib/modules/Customer/index.js +440 -0
  156. package/lib/modules/Customer/types.d.ts +146 -0
  157. package/lib/modules/Customer/types.js +37 -0
  158. package/lib/modules/Discount/index.d.ts +1 -0
  159. package/lib/modules/Order/index.d.ts +25 -1
  160. package/lib/modules/Order/index.js +182 -0
  161. package/lib/modules/Order/types.d.ts +45 -0
  162. package/lib/modules/Payment/cash.d.ts +19 -0
  163. package/lib/modules/Payment/cash.js +64 -0
  164. package/lib/modules/Payment/cashRecommendationAlgorithm.d.ts +22 -0
  165. package/lib/modules/Payment/cashRecommendationAlgorithm.js +342 -0
  166. package/lib/modules/Payment/eftpos.d.ts +11 -0
  167. package/lib/modules/Payment/eftpos.js +51 -0
  168. package/lib/modules/Payment/index.d.ts +184 -9
  169. package/lib/modules/Payment/index.js +1044 -50
  170. package/lib/modules/Payment/mx51.d.ts +0 -0
  171. package/lib/modules/Payment/mx51.js +0 -0
  172. package/lib/modules/Payment/types.d.ts +750 -30
  173. package/lib/modules/Payment/types.js +79 -6
  174. package/lib/modules/Payment/utils.d.ts +17 -0
  175. package/lib/modules/Payment/utils.js +67 -0
  176. package/lib/modules/Payment/walletpass.d.ts +99 -0
  177. package/lib/modules/Payment/walletpass.js +468 -0
  178. package/lib/modules/Product/index.d.ts +1 -1
  179. package/lib/modules/ProductList/index.d.ts +12 -1
  180. package/lib/modules/ProductList/index.js +29 -2
  181. package/lib/modules/Rules/index.d.ts +2 -0
  182. package/lib/modules/Rules/index.js +32 -15
  183. package/lib/modules/Rules/types.d.ts +1 -0
  184. package/lib/modules/Schedule/index.d.ts +9 -0
  185. package/lib/modules/Schedule/index.js +51 -0
  186. package/lib/modules/index.d.ts +1 -0
  187. package/lib/modules/index.js +2 -0
  188. package/lib/plugins/app-types/app/app.d.ts +83 -0
  189. package/lib/plugins/app-types/app/const.d.ts +4 -0
  190. package/lib/plugins/app-types/app/index.d.ts +14 -0
  191. package/lib/plugins/app-types/applicationManager/application.d.ts +50 -0
  192. package/lib/plugins/app-types/applicationManager/index.d.ts +13 -0
  193. package/lib/plugins/app-types/config.d.ts +3 -0
  194. package/lib/plugins/app-types/cookie/index.d.ts +13 -0
  195. package/lib/plugins/app-types/data/index.d.ts +8 -0
  196. package/lib/plugins/app-types/history/config.d.ts +24 -0
  197. package/lib/plugins/app-types/history/index.d.ts +20 -0
  198. package/lib/plugins/app-types/history/type.d.ts +2 -0
  199. package/lib/plugins/app-types/hooks/index.d.ts +12 -0
  200. package/lib/plugins/app-types/hooks/useDelayedValue/index.d.ts +2 -0
  201. package/lib/plugins/app-types/hooks/useDispatch/index.d.ts +2 -0
  202. package/lib/plugins/app-types/hooks/useLowCode/index.d.ts +13 -0
  203. package/lib/plugins/app-types/hooks/useStore/index.d.ts +6 -0
  204. package/lib/plugins/app-types/index.d.ts +6 -0
  205. package/lib/plugins/app-types/indexDB/index.d.ts +178 -0
  206. package/lib/plugins/app-types/locales/en.d.ts +3 -0
  207. package/lib/plugins/app-types/locales/index.d.ts +37 -0
  208. package/lib/plugins/app-types/locales/original.d.ts +3 -0
  209. package/lib/plugins/app-types/locales/type.d.ts +19 -0
  210. package/lib/plugins/app-types/locales/zh-CN.d.ts +3 -0
  211. package/lib/plugins/app-types/locales/zh-HK.d.ts +3 -0
  212. package/lib/plugins/app-types/logger/feishu.d.ts +11 -0
  213. package/lib/plugins/app-types/logger/index.d.ts +122 -0
  214. package/lib/plugins/app-types/menuManager/hooks.d.ts +17 -0
  215. package/lib/plugins/app-types/menuManager/index.d.ts +28 -0
  216. package/lib/plugins/app-types/models/global.d.ts +32 -0
  217. package/lib/plugins/app-types/models/index.d.ts +45 -0
  218. package/lib/plugins/app-types/models/type.d.ts +2 -0
  219. package/lib/plugins/app-types/package.json +15 -0
  220. package/lib/plugins/app-types/plugin/index.d.ts +0 -0
  221. package/lib/plugins/app-types/pubsub/example.d.ts +5 -0
  222. package/lib/plugins/app-types/pubsub/index.d.ts +63 -0
  223. package/lib/plugins/app-types/request/cache.d.ts +46 -0
  224. package/lib/plugins/app-types/request/cancelToken.d.ts +38 -0
  225. package/lib/plugins/app-types/request/config.d.ts +3 -0
  226. package/lib/plugins/app-types/request/constants.d.ts +2 -0
  227. package/lib/plugins/app-types/request/index.d.ts +24 -0
  228. package/lib/plugins/app-types/request/pisell2Request.d.ts +6 -0
  229. package/lib/plugins/app-types/request/type.d.ts +41 -0
  230. package/lib/plugins/app-types/request/utils.d.ts +46 -0
  231. package/lib/plugins/app-types/routes/config.d.ts +7 -0
  232. package/lib/plugins/app-types/routes/index.d.ts +28 -0
  233. package/lib/plugins/app-types/socket/components/SocketMonitorPage.d.ts +6 -0
  234. package/lib/plugins/app-types/socket/components/index.d.ts +2 -0
  235. package/lib/plugins/app-types/socket/constants.d.ts +33 -0
  236. package/lib/plugins/app-types/socket/events.d.ts +31 -0
  237. package/lib/plugins/app-types/socket/heartbeat.d.ts +66 -0
  238. package/lib/plugins/app-types/socket/index.d.ts +61 -0
  239. package/lib/plugins/app-types/socket/monitor.d.ts +169 -0
  240. package/lib/plugins/app-types/socket/reconnect.d.ts +61 -0
  241. package/lib/plugins/app-types/socket/socket.d.ts +129 -0
  242. package/lib/plugins/app-types/socket/types.d.ts +85 -0
  243. package/lib/plugins/app-types/storage/index.d.ts +17 -0
  244. package/lib/plugins/app-types/tasks/index.d.ts +77 -0
  245. package/lib/plugins/app-types/tasks/type.d.ts +62 -0
  246. package/lib/plugins/app-types/tasks/useTasks.d.ts +5 -0
  247. package/lib/plugins/app-types/type.d.ts +2 -0
  248. package/lib/plugins/app-types/variables/VariablesProvider.d.ts +7 -0
  249. package/lib/plugins/app-types/variables/config.d.ts +3 -0
  250. package/lib/plugins/app-types/variables/index.d.ts +6 -0
  251. package/lib/plugins/app-types/variables/type.d.ts +2 -0
  252. package/lib/plugins/app-types/website/index.d.ts +6 -0
  253. package/lib/plugins/app.d.ts +8 -0
  254. package/lib/plugins/app.js +17 -0
  255. package/lib/plugins/window.d.ts +1 -0
  256. package/lib/solution/BookingByStep/index.d.ts +1 -1
  257. package/lib/solution/BookingByStep/index.js +1 -2
  258. package/lib/solution/BookingTicket/index.d.ts +180 -0
  259. package/lib/solution/BookingTicket/index.js +420 -0
  260. package/lib/solution/BookingTicket/types.d.ts +68 -0
  261. package/lib/solution/BookingTicket/types.js +72 -0
  262. package/lib/solution/BookingTicket/utils/scan/cloudSearch.d.ts +22 -0
  263. package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +117 -0
  264. package/lib/solution/BookingTicket/utils/scan/handleScan.d.ts +22 -0
  265. package/lib/solution/BookingTicket/utils/scan/handleScan.js +132 -0
  266. package/lib/solution/BookingTicket/utils/scan/index.d.ts +81 -0
  267. package/lib/solution/BookingTicket/utils/scan/index.js +210 -0
  268. package/lib/solution/BookingTicket/utils/scan/scanCache.d.ts +78 -0
  269. package/lib/solution/BookingTicket/utils/scan/scanCache.js +231 -0
  270. package/lib/solution/Checkout/appointmentDemo.json +1 -0
  271. package/lib/solution/Checkout/index.d.ts +509 -0
  272. package/lib/solution/Checkout/index.js +3002 -0
  273. package/lib/solution/Checkout/types.d.ts +923 -0
  274. package/lib/solution/Checkout/types.js +87 -0
  275. package/lib/solution/Checkout/utils/index.d.ts +117 -0
  276. package/lib/solution/Checkout/utils/index.js +403 -0
  277. package/lib/solution/ShopDiscount/index.d.ts +4 -9
  278. package/lib/solution/ShopDiscount/index.js +41 -13
  279. package/lib/solution/ShopDiscount/types.d.ts +10 -1
  280. package/lib/solution/index.d.ts +2 -0
  281. package/lib/solution/index.js +5 -1
  282. package/lib/types/index.d.ts +3 -1
  283. package/lib/utils/task.d.ts +40 -0
  284. package/lib/utils/task.js +109 -0
  285. package/lib/utils/watch.d.ts +102 -0
  286. package/lib/utils/watch.js +217 -0
  287. package/package.json +4 -2
@@ -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,26 +189,30 @@ 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
  });
207
212
  });
208
213
  console.log(sortedProductList, "sortedProductListsortedProductList");
209
214
  sortedProductList.forEach((originProduct, i) => {
210
- var _a, _b, _c, _d, _e, _f, _g, _h;
215
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i;
211
216
  const product = this.hooks.getProduct(originProduct);
212
217
  if ((product == null ? void 0 : product.booking_id) && ((_a = product.discount_list) == null ? void 0 : _a.length) && ((_b = product == null ? void 0 : product.discount_list) == null ? void 0 : _b.every((discount) => discount.id && ["good_pass", "discount_card", "product_discount_card"].includes(discount.tag || discount.type)))) {
213
218
  processedProductsMap.set(product._id, [originProduct]);
@@ -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,16 @@ var RulesModule = class extends import_BaseModule.BaseModule {
242
247
  }))) {
243
248
  isManualDiscount = false;
244
249
  }
245
- if (applicableDiscounts.length === 0 || isManualDiscount) {
250
+ if ((options == null ? void 0 : options.selectedList) && ((_g = product.discount_list) == null ? void 0 : _g.some((item) => {
251
+ var _a2;
252
+ return (_a2 = options == null ? void 0 : options.selectedList) == null ? void 0 : _a2.some((n) => {
253
+ var _a3;
254
+ return n.discountId === ((_a3 = item.discount) == null ? void 0 : _a3.resource_id);
255
+ });
256
+ }))) {
257
+ isManualDiscount = false;
258
+ }
259
+ if (applicableDiscounts.length === 0 || isManualDiscount || (0, import_lodash_es.isBoolean)(product.vouchersApplicable) && !product.vouchersApplicable) {
246
260
  if (product.isClient) {
247
261
  processedProductsMap.set(
248
262
  product._id,
@@ -302,25 +316,28 @@ var RulesModule = class extends import_BaseModule.BaseModule {
302
316
  usedDiscounts.set(selectedDiscount2.id, true);
303
317
  const appliedProducts = appliedDiscountProducts.get(selectedDiscount2.id) || [];
304
318
  let productOriginTotal = product.origin_total || product.total || 0;
305
- if (((_g = product.discount_list) == null ? void 0 : _g.length) && product.origin_total) {
319
+ if (((_h = product.discount_list) == null ? void 0 : _h.length) && product.origin_total) {
306
320
  productOriginTotal = product.origin_total;
307
321
  }
308
- if (Number(((_h = originProduct == null ? void 0 : originProduct._productInit) == null ? void 0 : _h.original_price) || 0) > 0 && product.origin_total && product.total && product.origin_total !== product.total) {
322
+ if (Number(((_i = originProduct == null ? void 0 : originProduct._productInit) == null ? void 0 : _i.original_price) || 0) > 0 && product.origin_total && product.total && product.origin_total !== product.total) {
309
323
  productOriginTotal = product.total;
310
324
  }
311
325
  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();
326
+ const discountType = selectedDiscount2.tag === "product_discount_card" ? "discount_card" : selectedDiscount2.tag;
312
327
  const discountDetail = {
313
328
  amount: new import_decimal.default(productOriginTotal).minus(new import_decimal.default(targetProductTotal)).toNumber(),
314
- type: selectedDiscount2.tag === "product_discount_card" ? "discount_card" : selectedDiscount2.tag,
329
+ type: discountType,
315
330
  discount: {
316
331
  resource_id: selectedDiscount2.id,
317
332
  title: selectedDiscount2.format_title,
318
333
  original_amount: productOriginTotal,
319
334
  product_id: originProduct.id,
320
335
  percent: selectedDiscount2.par_value
321
- },
322
- num: product.num || 1
336
+ }
323
337
  };
338
+ if ((selectedDiscount2.tag || selectedDiscount2.type) !== "good_pass") {
339
+ discountDetail.num = product.num || 1;
340
+ }
324
341
  appliedProducts.push(discountDetail);
325
342
  appliedDiscountProducts.set(selectedDiscount2.id, appliedProducts);
326
343
  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;
@@ -25,4 +25,13 @@ export declare class ScheduleModule extends BaseModule implements Module, Schedu
25
25
  setOtherProductsIds(ids: number[]): void;
26
26
  getOtherProductsIds(): number[];
27
27
  storeChange(): void;
28
+ /**
29
+ * 传入一个时间, 判断改时间是否在schedule 内
30
+ * @param param0 { date: string, schedule: any } date: 日期, schedule: schedule
31
+ * @returns
32
+ */
33
+ static isInScheduleByDate({ date, schedule, }: {
34
+ date: string;
35
+ schedule: any;
36
+ }): true | undefined;
28
37
  }
@@ -38,6 +38,7 @@ var import_dayjs = __toESM(require("dayjs"));
38
38
  var import_isSameOrBefore = __toESM(require("dayjs/plugin/isSameOrBefore"));
39
39
  var import_isSameOrAfter = __toESM(require("dayjs/plugin/isSameOrAfter"));
40
40
  var import_utils = require("../Date/utils");
41
+ var import_utils2 = require("./utils");
41
42
  import_dayjs.default.extend(import_isSameOrBefore.default);
42
43
  import_dayjs.default.extend(import_isSameOrAfter.default);
43
44
  var ScheduleModule = class extends import_BaseModule.BaseModule {
@@ -158,6 +159,56 @@ var ScheduleModule = class extends import_BaseModule.BaseModule {
158
159
  });
159
160
  }
160
161
  }
162
+ /**
163
+ * 传入一个时间, 判断改时间是否在schedule 内
164
+ * @param param0 { date: string, schedule: any } date: 日期, schedule: schedule
165
+ * @returns
166
+ */
167
+ static isInScheduleByDate({
168
+ date,
169
+ schedule
170
+ }) {
171
+ var _a, _b, _c, _d;
172
+ let _schedule = {
173
+ ...schedule,
174
+ // 开始时间向前推一天
175
+ start_time: (0, import_dayjs.default)(date).subtract(1, "day").format("YYYY-MM-DD HH:mm:ss"),
176
+ end_time: (0, import_dayjs.default)(date).add(1, "day").format("YYYY-MM-DD HH:mm:ss")
177
+ };
178
+ if (((_b = (_a = _schedule.repeat_rule) == null ? void 0 : _a.end) == null ? void 0 : _b.type) === "never") {
179
+ _schedule = {
180
+ ..._schedule,
181
+ repeat_rule: {
182
+ ..._schedule.repeat_rule,
183
+ end: {
184
+ type: "date",
185
+ end_date: _schedule.end_time,
186
+ occurrence: null
187
+ }
188
+ }
189
+ };
190
+ }
191
+ if (((_d = (_c = _schedule.repeat_rule) == null ? void 0 : _c.end) == null ? void 0 : _d.type) === "date") {
192
+ _schedule = {
193
+ ..._schedule,
194
+ repeat_rule: {
195
+ ..._schedule.repeat_rule,
196
+ end: {
197
+ ..._schedule.repeat_rule.end,
198
+ end_date: _schedule.end_time
199
+ }
200
+ }
201
+ };
202
+ }
203
+ const dateRanges = (0, import_utils2.calcScheduleDateRange)({ ..._schedule });
204
+ for (const range of dateRanges) {
205
+ const startTime = (0, import_dayjs.default)(range.start);
206
+ const endTime = (0, import_dayjs.default)(range.end);
207
+ if ((0, import_dayjs.default)(date).isSameOrAfter(startTime) && (0, import_dayjs.default)(date).isSameOrBefore(endTime)) {
208
+ return true;
209
+ }
210
+ }
211
+ }
161
212
  };
162
213
  // Annotate the CommonJS export names for ESM import in node:
163
214
  0 && (module.exports = {
@@ -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';