@pisell/pisellos 2.2.244 → 2.2.246

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 (316) hide show
  1. package/dist/model/strategy/adapter/promotion/evaluator.js +3 -2
  2. package/dist/model/strategy/adapter/walletPass/utils.js +7 -4
  3. package/dist/modules/BookingContext/index.d.ts +48 -0
  4. package/dist/modules/BookingContext/index.js +566 -0
  5. package/dist/modules/BookingContext/types.d.ts +102 -0
  6. package/dist/modules/BookingContext/types.js +51 -0
  7. package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +16 -0
  8. package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +284 -0
  9. package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +8 -0
  10. package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +148 -0
  11. package/dist/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +76 -0
  12. package/dist/modules/BookingContext/utils/cacheItemToBookingInput.js +218 -0
  13. package/dist/modules/BookingContext/utils/flexible.d.ts +28 -0
  14. package/dist/modules/BookingContext/utils/flexible.js +56 -0
  15. package/dist/modules/BookingContext/utils/formatResourceList.d.ts +8 -0
  16. package/dist/modules/BookingContext/utils/formatResourceList.js +38 -0
  17. package/dist/modules/BookingContext/utils/index.d.ts +11 -0
  18. package/dist/modules/BookingContext/utils/index.js +11 -0
  19. package/dist/modules/BookingContext/utils/noResource.d.ts +13 -0
  20. package/dist/modules/BookingContext/utils/noResource.js +77 -0
  21. package/dist/modules/BookingContext/utils/orderLineDisplay.d.ts +1 -0
  22. package/dist/modules/BookingContext/utils/orderLineDisplay.js +36 -0
  23. package/dist/modules/BookingContext/utils/productExtend.d.ts +72 -0
  24. package/dist/modules/BookingContext/utils/productExtend.js +339 -0
  25. package/dist/modules/BookingContext/utils/resourceErrors.d.ts +41 -0
  26. package/dist/modules/BookingContext/utils/resourceErrors.js +74 -0
  27. package/dist/modules/BookingContext/utils/resourceSelection.d.ts +7 -0
  28. package/dist/modules/BookingContext/utils/resourceSelection.js +24 -0
  29. package/dist/modules/BookingContext/utils/resources.d.ts +80 -0
  30. package/dist/modules/BookingContext/utils/resources.js +486 -0
  31. package/dist/modules/BookingContext/utils/serviceTimes.d.ts +55 -0
  32. package/dist/modules/BookingContext/utils/serviceTimes.js +151 -0
  33. package/dist/modules/BookingContext/utils/timeSlices.d.ts +42 -0
  34. package/dist/modules/BookingContext/utils/timeSlices.js +100 -0
  35. package/dist/modules/Cart/utils/cartProduct.js +24 -3
  36. package/dist/modules/Cart/utils/changePrice.js +11 -11
  37. package/dist/modules/Customer/index.d.ts +20 -0
  38. package/dist/modules/Customer/index.js +172 -83
  39. package/dist/modules/Customer/types.d.ts +2 -0
  40. package/dist/modules/Discount/index.d.ts +1 -1
  41. package/dist/modules/Discount/index.js +13 -6
  42. package/dist/modules/Discount/types.d.ts +1 -0
  43. package/dist/modules/OpenData/index.d.ts +8 -0
  44. package/dist/modules/OpenData/index.js +37 -17
  45. package/dist/modules/Order/index.d.ts +277 -18
  46. package/dist/modules/Order/index.js +3581 -779
  47. package/dist/modules/Order/types.d.ts +286 -31
  48. package/dist/modules/Order/types.js +38 -0
  49. package/dist/modules/Order/utils/manualProductDiscount.d.ts +106 -0
  50. package/dist/modules/Order/utils/manualProductDiscount.js +210 -0
  51. package/dist/modules/Order/utils.d.ts +147 -5
  52. package/dist/modules/Order/utils.js +750 -104
  53. package/dist/modules/Payment/index.d.ts +10 -13
  54. package/dist/modules/Payment/index.js +467 -837
  55. package/dist/modules/Payment/types.d.ts +2 -0
  56. package/dist/modules/Payment/utils.js +2 -1
  57. package/dist/modules/Payment/walletpass.js +41 -25
  58. package/dist/modules/ProductList/index.d.ts +16 -12
  59. package/dist/modules/ProductList/index.js +133 -59
  60. package/dist/modules/ProductList/types.d.ts +14 -0
  61. package/dist/modules/Quotation/index.d.ts +0 -1
  62. package/dist/modules/Quotation/index.js +25 -22
  63. package/dist/modules/Rules/index.d.ts +4 -0
  64. package/dist/modules/Rules/index.js +97 -70
  65. package/dist/modules/Rules/types.d.ts +1 -0
  66. package/dist/modules/SalesSummary/index.d.ts +8 -25
  67. package/dist/modules/SalesSummary/index.js +86 -35
  68. package/dist/modules/SalesSummary/types.d.ts +4 -1
  69. package/dist/modules/SalesSummary/utils.d.ts +2 -25
  70. package/dist/modules/SalesSummary/utils.js +794 -162
  71. package/dist/modules/Schedule/index.d.ts +7 -0
  72. package/dist/modules/Schedule/index.js +24 -2
  73. package/dist/modules/Summary/index.js +4 -3
  74. package/dist/modules/SurchargeList/index.d.ts +16 -0
  75. package/dist/modules/SurchargeList/index.js +162 -0
  76. package/dist/modules/SurchargeList/types.d.ts +11 -0
  77. package/dist/modules/SurchargeList/types.js +1 -0
  78. package/dist/modules/index.d.ts +2 -0
  79. package/dist/modules/index.js +3 -1
  80. package/dist/plugins/request.d.ts +1 -0
  81. package/dist/server/index.d.ts +204 -1
  82. package/dist/server/index.js +3654 -922
  83. package/dist/server/modules/index.d.ts +2 -0
  84. package/dist/server/modules/index.js +2 -0
  85. package/dist/server/modules/order/index.d.ts +120 -3
  86. package/dist/server/modules/order/index.js +1762 -448
  87. package/dist/server/modules/order/types.d.ts +32 -3
  88. package/dist/server/modules/order/types.js +8 -0
  89. package/dist/server/modules/order/utils/filterBookings.js +26 -3
  90. package/dist/server/modules/order/utils/filterOrders.js +23 -8
  91. package/dist/server/modules/payment/index.d.ts +28 -0
  92. package/dist/server/modules/payment/index.js +305 -0
  93. package/dist/server/modules/payment/types.d.ts +9 -0
  94. package/dist/server/modules/payment/types.js +1 -0
  95. package/dist/server/modules/products/index.d.ts +34 -7
  96. package/dist/server/modules/products/index.js +631 -317
  97. package/dist/server/modules/resource/index.d.ts +2 -0
  98. package/dist/server/modules/resource/index.js +29 -3
  99. package/dist/server/modules/schedule/index.d.ts +4 -4
  100. package/dist/server/modules/schedule/index.js +111 -88
  101. package/dist/server/test.json +713 -0
  102. package/dist/server/utils/small-ticket.d.ts +71 -0
  103. package/dist/server/utils/small-ticket.js +840 -0
  104. package/dist/solution/BaseSales/index.d.ts +133 -10
  105. package/dist/solution/BaseSales/index.js +1950 -447
  106. package/dist/solution/BaseSales/types.d.ts +82 -6
  107. package/dist/solution/BaseSales/types.js +5 -4
  108. package/dist/solution/BaseSales/utils/cartPromotion.d.ts +287 -0
  109. package/dist/solution/BaseSales/utils/cartPromotion.js +1438 -0
  110. package/dist/solution/BaseSales/utils/quotationPrice.d.ts +7 -0
  111. package/dist/solution/BaseSales/utils/quotationPrice.js +237 -0
  112. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +1 -0
  113. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +105 -24
  114. package/dist/solution/BaseSales/utils.d.ts +1 -1
  115. package/dist/solution/BaseSales/utils.js +62 -21
  116. package/dist/solution/BookingByStep/index.d.ts +1 -1
  117. package/dist/solution/BookingTicket/index.d.ts +271 -11
  118. package/dist/solution/BookingTicket/index.js +1777 -242
  119. package/dist/solution/BookingTicket/types.d.ts +118 -1
  120. package/dist/solution/BookingTicket/types.js +41 -2
  121. package/dist/solution/BookingTicket/utils/addProductDecision.d.ts +117 -0
  122. package/dist/solution/BookingTicket/utils/addProductDecision.js +346 -0
  123. package/dist/solution/BookingTicket/utils/addTimeAvailability.d.ts +35 -0
  124. package/dist/solution/BookingTicket/utils/addTimeAvailability.js +95 -0
  125. package/dist/solution/BookingTicket/utils/bookingStatus.d.ts +40 -0
  126. package/dist/solution/BookingTicket/utils/bookingStatus.js +70 -0
  127. package/dist/solution/BookingTicket/utils/cartView.d.ts +9 -1
  128. package/dist/solution/BookingTicket/utils/cartView.js +94 -7
  129. package/dist/solution/BookingTicket/utils/exampleData.d.ts +123 -0
  130. package/dist/solution/BookingTicket/utils/exampleData.js +183 -0
  131. package/dist/solution/BookingTicket/utils/resolveBestAddTimePlan.d.ts +185 -0
  132. package/dist/solution/BookingTicket/utils/resolveBestAddTimePlan.js +438 -0
  133. package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +36 -0
  134. package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +400 -0
  135. package/dist/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +32 -0
  136. package/dist/solution/BookingTicket/utils/scan/formatGlobalScan.js +56 -0
  137. package/dist/solution/BookingTicket/utils/scan/index.d.ts +5 -0
  138. package/dist/solution/BookingTicket/utils/scan/index.js +20 -8
  139. package/dist/solution/BookingTicket/utils/scan/scanProductValues.d.ts +21 -0
  140. package/dist/solution/BookingTicket/utils/scan/scanProductValues.js +150 -0
  141. package/dist/solution/BookingTicket/utils/sessionCatalogStale.d.ts +23 -0
  142. package/dist/solution/BookingTicket/utils/sessionCatalogStale.js +78 -0
  143. package/dist/solution/Checkout/index.d.ts +1 -0
  144. package/dist/solution/Checkout/index.js +10 -9
  145. package/dist/solution/RegisterAndLogin/config.js +2 -10
  146. package/dist/solution/ScanOrder/index.d.ts +9 -3
  147. package/dist/solution/ScanOrder/index.js +241 -134
  148. package/dist/solution/ScanOrder/types.d.ts +9 -5
  149. package/dist/solution/ScanOrder/types.js +2 -3
  150. package/dist/solution/ScanOrder/utils.d.ts +1 -1
  151. package/dist/solution/ScanOrder/utils.js +84 -22
  152. package/dist/solution/VenueBooking/index.d.ts +5 -2
  153. package/dist/solution/VenueBooking/index.js +110 -59
  154. package/dist/solution/VenueBooking/sales-section-4-annotated.json +0 -2
  155. package/dist/solution/VenueBooking/utils/slotMerge.d.ts +4 -0
  156. package/dist/solution/VenueBooking/utils/slotMerge.js +10 -0
  157. package/dist/types/index.d.ts +10 -0
  158. package/lib/model/strategy/adapter/promotion/evaluator.js +2 -1
  159. package/lib/model/strategy/adapter/promotion/index.js +49 -0
  160. package/lib/model/strategy/adapter/walletPass/utils.js +3 -2
  161. package/lib/modules/BookingContext/index.d.ts +48 -0
  162. package/lib/modules/BookingContext/index.js +368 -0
  163. package/lib/modules/BookingContext/types.d.ts +102 -0
  164. package/lib/modules/BookingContext/types.js +34 -0
  165. package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +16 -0
  166. package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +276 -0
  167. package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +8 -0
  168. package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +154 -0
  169. package/lib/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +76 -0
  170. package/lib/modules/BookingContext/utils/cacheItemToBookingInput.js +201 -0
  171. package/lib/modules/BookingContext/utils/flexible.d.ts +28 -0
  172. package/lib/modules/BookingContext/utils/flexible.js +80 -0
  173. package/lib/modules/BookingContext/utils/formatResourceList.d.ts +8 -0
  174. package/lib/modules/BookingContext/utils/formatResourceList.js +50 -0
  175. package/lib/modules/BookingContext/utils/index.d.ts +11 -0
  176. package/lib/modules/BookingContext/utils/index.js +43 -0
  177. package/lib/modules/BookingContext/utils/noResource.d.ts +13 -0
  178. package/lib/modules/BookingContext/utils/noResource.js +90 -0
  179. package/lib/modules/BookingContext/utils/orderLineDisplay.d.ts +1 -0
  180. package/lib/modules/BookingContext/utils/orderLineDisplay.js +56 -0
  181. package/lib/modules/BookingContext/utils/productExtend.d.ts +72 -0
  182. package/lib/modules/BookingContext/utils/productExtend.js +283 -0
  183. package/lib/modules/BookingContext/utils/resourceErrors.d.ts +41 -0
  184. package/lib/modules/BookingContext/utils/resourceErrors.js +80 -0
  185. package/lib/modules/BookingContext/utils/resourceSelection.d.ts +7 -0
  186. package/lib/modules/BookingContext/utils/resourceSelection.js +46 -0
  187. package/lib/modules/BookingContext/utils/resources.d.ts +80 -0
  188. package/lib/modules/BookingContext/utils/resources.js +377 -0
  189. package/lib/modules/BookingContext/utils/serviceTimes.d.ts +55 -0
  190. package/lib/modules/BookingContext/utils/serviceTimes.js +162 -0
  191. package/lib/modules/BookingContext/utils/timeSlices.d.ts +42 -0
  192. package/lib/modules/BookingContext/utils/timeSlices.js +124 -0
  193. package/lib/modules/Cart/utils/cartProduct.js +20 -3
  194. package/lib/modules/Cart/utils/changePrice.js +12 -20
  195. package/lib/modules/Customer/index.d.ts +20 -0
  196. package/lib/modules/Customer/index.js +64 -11
  197. package/lib/modules/Customer/types.d.ts +2 -0
  198. package/lib/modules/Discount/index.d.ts +1 -1
  199. package/lib/modules/Discount/index.js +9 -1
  200. package/lib/modules/Discount/types.d.ts +1 -0
  201. package/lib/modules/OpenData/index.d.ts +8 -0
  202. package/lib/modules/OpenData/index.js +19 -5
  203. package/lib/modules/Order/index.d.ts +277 -18
  204. package/lib/modules/Order/index.js +2317 -337
  205. package/lib/modules/Order/types.d.ts +286 -31
  206. package/lib/modules/Order/types.js +1 -0
  207. package/lib/modules/Order/utils/manualProductDiscount.d.ts +106 -0
  208. package/lib/modules/Order/utils/manualProductDiscount.js +206 -0
  209. package/lib/modules/Order/utils.d.ts +147 -5
  210. package/lib/modules/Order/utils.js +615 -46
  211. package/lib/modules/Payment/index.d.ts +10 -13
  212. package/lib/modules/Payment/index.js +18 -150
  213. package/lib/modules/Payment/types.d.ts +2 -0
  214. package/lib/modules/Payment/utils.js +2 -1
  215. package/lib/modules/Payment/walletpass.js +16 -3
  216. package/lib/modules/ProductList/index.d.ts +16 -12
  217. package/lib/modules/ProductList/index.js +41 -4
  218. package/lib/modules/ProductList/types.d.ts +14 -0
  219. package/lib/modules/Quotation/index.d.ts +0 -1
  220. package/lib/modules/Quotation/index.js +19 -16
  221. package/lib/modules/Rules/index.d.ts +4 -0
  222. package/lib/modules/Rules/index.js +137 -120
  223. package/lib/modules/Rules/types.d.ts +1 -0
  224. package/lib/modules/SalesSummary/index.d.ts +8 -25
  225. package/lib/modules/SalesSummary/index.js +30 -4
  226. package/lib/modules/SalesSummary/types.d.ts +4 -1
  227. package/lib/modules/SalesSummary/utils.d.ts +2 -25
  228. package/lib/modules/SalesSummary/utils.js +645 -91
  229. package/lib/modules/Schedule/index.d.ts +7 -0
  230. package/lib/modules/Schedule/index.js +17 -1
  231. package/lib/modules/Summary/index.js +5 -4
  232. package/lib/modules/SurchargeList/index.d.ts +16 -0
  233. package/lib/modules/SurchargeList/index.js +89 -0
  234. package/lib/modules/SurchargeList/types.d.ts +11 -0
  235. package/lib/modules/SurchargeList/types.js +17 -0
  236. package/lib/modules/index.d.ts +2 -0
  237. package/lib/modules/index.js +5 -1
  238. package/lib/plugins/request.d.ts +1 -0
  239. package/lib/server/index.d.ts +204 -1
  240. package/lib/server/index.js +1891 -59
  241. package/lib/server/modules/index.d.ts +2 -0
  242. package/lib/server/modules/index.js +3 -0
  243. package/lib/server/modules/order/index.d.ts +120 -3
  244. package/lib/server/modules/order/index.js +887 -94
  245. package/lib/server/modules/order/types.d.ts +32 -3
  246. package/lib/server/modules/order/utils/filterBookings.js +24 -5
  247. package/lib/server/modules/order/utils/filterOrders.js +15 -6
  248. package/lib/server/modules/payment/index.d.ts +28 -0
  249. package/lib/server/modules/payment/index.js +192 -0
  250. package/lib/server/modules/payment/types.d.ts +9 -0
  251. package/lib/server/modules/payment/types.js +17 -0
  252. package/lib/server/modules/products/index.d.ts +34 -7
  253. package/lib/server/modules/products/index.js +189 -54
  254. package/lib/server/modules/resource/index.d.ts +2 -0
  255. package/lib/server/modules/resource/index.js +27 -3
  256. package/lib/server/modules/schedule/index.d.ts +4 -4
  257. package/lib/server/modules/schedule/index.js +47 -40
  258. package/lib/server/test.json +713 -0
  259. package/lib/server/utils/small-ticket.d.ts +71 -0
  260. package/lib/server/utils/small-ticket.js +800 -0
  261. package/lib/solution/BaseSales/index.d.ts +133 -10
  262. package/lib/solution/BaseSales/index.js +1111 -63
  263. package/lib/solution/BaseSales/types.d.ts +82 -6
  264. package/lib/solution/BaseSales/types.js +3 -1
  265. package/lib/solution/BaseSales/utils/cartPromotion.d.ts +287 -0
  266. package/lib/solution/BaseSales/utils/cartPromotion.js +992 -0
  267. package/lib/solution/BaseSales/utils/quotationPrice.d.ts +7 -0
  268. package/lib/solution/BaseSales/utils/quotationPrice.js +277 -0
  269. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +1 -0
  270. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +106 -18
  271. package/lib/solution/BaseSales/utils.d.ts +1 -1
  272. package/lib/solution/BaseSales/utils.js +54 -10
  273. package/lib/solution/BookingByStep/index.d.ts +1 -1
  274. package/lib/solution/BookingTicket/index.d.ts +271 -11
  275. package/lib/solution/BookingTicket/index.js +922 -29
  276. package/lib/solution/BookingTicket/types.d.ts +118 -1
  277. package/lib/solution/BookingTicket/types.js +11 -0
  278. package/lib/solution/BookingTicket/utils/addProductDecision.d.ts +117 -0
  279. package/lib/solution/BookingTicket/utils/addProductDecision.js +318 -0
  280. package/lib/solution/BookingTicket/utils/addTimeAvailability.d.ts +35 -0
  281. package/lib/solution/BookingTicket/utils/addTimeAvailability.js +125 -0
  282. package/lib/solution/BookingTicket/utils/bookingStatus.d.ts +40 -0
  283. package/lib/solution/BookingTicket/utils/bookingStatus.js +44 -2
  284. package/lib/solution/BookingTicket/utils/cartView.d.ts +9 -1
  285. package/lib/solution/BookingTicket/utils/cartView.js +61 -6
  286. package/lib/solution/BookingTicket/utils/exampleData.d.ts +123 -0
  287. package/lib/solution/BookingTicket/utils/exampleData.js +0 -0
  288. package/lib/solution/BookingTicket/utils/resolveBestAddTimePlan.d.ts +185 -0
  289. package/lib/solution/BookingTicket/utils/resolveBestAddTimePlan.js +254 -0
  290. package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +36 -0
  291. package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +169 -0
  292. package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +32 -0
  293. package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.js +51 -0
  294. package/lib/solution/BookingTicket/utils/scan/index.d.ts +5 -0
  295. package/lib/solution/BookingTicket/utils/scan/index.js +17 -3
  296. package/lib/solution/BookingTicket/utils/scan/scanProductValues.d.ts +21 -0
  297. package/lib/solution/BookingTicket/utils/scan/scanProductValues.js +127 -0
  298. package/lib/solution/BookingTicket/utils/sessionCatalogStale.d.ts +23 -0
  299. package/lib/solution/BookingTicket/utils/sessionCatalogStale.js +85 -0
  300. package/lib/solution/Checkout/index.d.ts +1 -0
  301. package/lib/solution/Checkout/index.js +1 -2
  302. package/lib/solution/RegisterAndLogin/config.js +2 -10
  303. package/lib/solution/ScanOrder/index.d.ts +9 -3
  304. package/lib/solution/ScanOrder/index.js +153 -70
  305. package/lib/solution/ScanOrder/types.d.ts +9 -5
  306. package/lib/solution/ScanOrder/utils.d.ts +1 -1
  307. package/lib/solution/ScanOrder/utils.js +83 -17
  308. package/lib/solution/VenueBooking/index.d.ts +5 -2
  309. package/lib/solution/VenueBooking/index.js +54 -17
  310. package/lib/solution/VenueBooking/sales-section-4-annotated.json +0 -2
  311. package/lib/solution/VenueBooking/utils/slotMerge.d.ts +4 -0
  312. package/lib/solution/VenueBooking/utils/slotMerge.js +10 -0
  313. package/lib/types/index.d.ts +10 -0
  314. package/package.json +1 -1
  315. package/dist/solution/Checkout/appointmentDemo.json +0 -1
  316. package/lib/solution/Checkout/appointmentDemo.json +0 -1
@@ -0,0 +1,254 @@
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/solution/BookingTicket/utils/resolveBestAddTimePlan.ts
20
+ var resolveBestAddTimePlan_exports = {};
21
+ __export(resolveBestAddTimePlan_exports, {
22
+ ADD_TIME_UNIT_MINUTES: () => ADD_TIME_UNIT_MINUTES,
23
+ buildAddTimeCandidates: () => buildAddTimeCandidates,
24
+ resolveBestAddTimePlan: () => resolveBestAddTimePlan
25
+ });
26
+ module.exports = __toCommonJS(resolveBestAddTimePlan_exports);
27
+ var ADD_TIME_UNIT_MINUTES = [10, 15, 20, 30, 45, 60];
28
+ var toPositiveNumber = (value) => {
29
+ const n = Number(value);
30
+ return Number.isFinite(n) && n > 0 ? n : null;
31
+ };
32
+ var normalizeTargetMinutes = (minutes) => {
33
+ const n = Number(minutes);
34
+ return Number.isFinite(n) ? Math.max(0, Math.ceil(n)) : 0;
35
+ };
36
+ var gcd = (a, b) => {
37
+ let x = Math.abs(a);
38
+ let y = Math.abs(b);
39
+ while (y !== 0) {
40
+ const next = x % y;
41
+ x = y;
42
+ y = next;
43
+ }
44
+ return x;
45
+ };
46
+ var getDpStepMinutes = (candidates) => {
47
+ return candidates.reduce(
48
+ (current, candidate) => gcd(current, candidate.product_add_schedule_time),
49
+ 0
50
+ ) || 1;
51
+ };
52
+ var comparePlans = (left, right) => {
53
+ if (!left)
54
+ return right;
55
+ if (right.totalPrice !== left.totalPrice) {
56
+ return right.totalPrice < left.totalPrice ? right : left;
57
+ }
58
+ const leftOverage = left.coveredMinutes - left.targetMinutes;
59
+ const rightOverage = right.coveredMinutes - right.targetMinutes;
60
+ if (rightOverage !== leftOverage) {
61
+ return rightOverage < leftOverage ? right : left;
62
+ }
63
+ return right.lines.length < left.lines.length ? right : left;
64
+ };
65
+ var toPlanLine = (candidate) => ({
66
+ product_id: candidate.product_id,
67
+ product_title: candidate.product_title,
68
+ product_add_schedule_time: Number.isFinite(candidate.product_add_schedule_time) ? candidate.product_add_schedule_time : 0,
69
+ num: candidate.num,
70
+ price: candidate.price,
71
+ _originalProduct: candidate._originalProduct
72
+ });
73
+ var mergePlanLines = (candidates) => {
74
+ const map = /* @__PURE__ */ new Map();
75
+ for (const candidate of candidates) {
76
+ const key = `${candidate.product_id}-${candidate.product_add_schedule_time}-${candidate.unlimited ? "u" : "n"}`;
77
+ const existing = map.get(key);
78
+ if (existing) {
79
+ existing.num += candidate.num;
80
+ continue;
81
+ }
82
+ map.set(key, toPlanLine(candidate));
83
+ }
84
+ return Array.from(map.values());
85
+ };
86
+ var sumPlanLineMinutes = (lines) => lines.reduce(
87
+ (total, line) => total + line.product_add_schedule_time * line.num,
88
+ 0
89
+ );
90
+ var restoreDpCandidates = (dp, finiteCandidates, index) => {
91
+ const candidates = [];
92
+ let currentIndex = index;
93
+ while (currentIndex > 0) {
94
+ const current = dp[currentIndex];
95
+ if (!current || current.candidateIndex < 0)
96
+ break;
97
+ candidates.push(finiteCandidates[current.candidateIndex]);
98
+ currentIndex = current.prevIndex;
99
+ }
100
+ return candidates.reverse();
101
+ };
102
+ function buildAddTimeCandidates(products) {
103
+ const candidates = [];
104
+ for (const product of products) {
105
+ const price = toPositiveNumber(product.price);
106
+ if (price == null)
107
+ continue;
108
+ if (product.unlimited) {
109
+ candidates.push({
110
+ product_id: product.id,
111
+ product_title: product.title,
112
+ _originalProduct: product._originalProduct ?? product,
113
+ product_add_schedule_time: Number.POSITIVE_INFINITY,
114
+ num: 1,
115
+ price,
116
+ totalPrice: price,
117
+ unlimited: true
118
+ });
119
+ continue;
120
+ }
121
+ const minMinutes = toPositiveNumber(product.minMinutes);
122
+ if (minMinutes == null)
123
+ continue;
124
+ const maxMinutes = toPositiveNumber(product.maxMinutes) ?? minMinutes;
125
+ const unitMinutes = toPositiveNumber(product.unitMinutes) ?? minMinutes;
126
+ const safeMax = Math.max(minMinutes, maxMinutes);
127
+ for (let minutes = minMinutes; minutes <= safeMax; minutes += unitMinutes) {
128
+ candidates.push({
129
+ product_id: product.id,
130
+ product_title: product.title,
131
+ _originalProduct: product._originalProduct ?? product,
132
+ product_add_schedule_time: minutes,
133
+ num: 1,
134
+ price,
135
+ totalPrice: minutes / unitMinutes * price
136
+ });
137
+ }
138
+ }
139
+ return candidates;
140
+ }
141
+ function resolveBestAddTimePlan(products, targetMinutes) {
142
+ const normalizedTarget = normalizeTargetMinutes(targetMinutes);
143
+ if (normalizedTarget <= 0) {
144
+ return {
145
+ available: true,
146
+ targetMinutes: 0,
147
+ coveredMinutes: 0,
148
+ totalPrice: 0,
149
+ lines: []
150
+ };
151
+ }
152
+ if (!products.length) {
153
+ return {
154
+ available: false,
155
+ unavailableReason: "NO_PRODUCTS",
156
+ targetMinutes: normalizedTarget,
157
+ coveredMinutes: 0,
158
+ totalPrice: 0,
159
+ lines: []
160
+ };
161
+ }
162
+ const candidates = buildAddTimeCandidates(products);
163
+ const finiteCandidates = candidates.filter(
164
+ (item) => Number.isFinite(item.product_add_schedule_time)
165
+ );
166
+ const unlimitedCandidates = candidates.filter((item) => item.unlimited);
167
+ const maxFiniteMinutes = Math.max(
168
+ 0,
169
+ ...finiteCandidates.map((item) => item.product_add_schedule_time)
170
+ );
171
+ const searchLimit = normalizedTarget + maxFiniteMinutes;
172
+ let best = null;
173
+ for (const unlimited of unlimitedCandidates) {
174
+ const lines = [
175
+ toPlanLine({
176
+ ...unlimited,
177
+ product_add_schedule_time: normalizedTarget
178
+ })
179
+ ];
180
+ best = comparePlans(best, {
181
+ available: true,
182
+ targetMinutes: normalizedTarget,
183
+ coveredMinutes: sumPlanLineMinutes(lines),
184
+ totalPrice: unlimited.totalPrice,
185
+ lines
186
+ });
187
+ }
188
+ if (finiteCandidates.length && searchLimit > 0) {
189
+ const stepMinutes = getDpStepMinutes(finiteCandidates);
190
+ const searchLimitIndex = Math.ceil(searchLimit / stepMinutes);
191
+ const targetIndex = Math.ceil(normalizedTarget / stepMinutes);
192
+ const finiteCandidateSteps = finiteCandidates.map(
193
+ (candidate) => candidate.product_add_schedule_time / stepMinutes
194
+ );
195
+ const dp = [];
196
+ dp[0] = {
197
+ price: 0,
198
+ itemCount: 0,
199
+ prevIndex: -1,
200
+ candidateIndex: -1
201
+ };
202
+ for (let index = 0; index <= searchLimitIndex; index += 1) {
203
+ const current = dp[index];
204
+ if (!current)
205
+ continue;
206
+ for (let candidateIndex = 0; candidateIndex < finiteCandidates.length; candidateIndex += 1) {
207
+ const nextIndex = index + finiteCandidateSteps[candidateIndex];
208
+ if (nextIndex > searchLimitIndex)
209
+ continue;
210
+ const candidate = finiteCandidates[candidateIndex];
211
+ const nextPrice = current.price + candidate.totalPrice;
212
+ const nextItemCount = current.itemCount + 1;
213
+ const prev = dp[nextIndex];
214
+ if (!prev || nextPrice < prev.price || nextPrice === prev.price && nextItemCount < prev.itemCount) {
215
+ dp[nextIndex] = {
216
+ price: nextPrice,
217
+ itemCount: nextItemCount,
218
+ prevIndex: index,
219
+ candidateIndex
220
+ };
221
+ }
222
+ }
223
+ }
224
+ for (let index = targetIndex; index <= searchLimitIndex; index += 1) {
225
+ const current = dp[index];
226
+ if (!current)
227
+ continue;
228
+ const lines = mergePlanLines(
229
+ restoreDpCandidates(dp, finiteCandidates, index)
230
+ );
231
+ best = comparePlans(best, {
232
+ available: true,
233
+ targetMinutes: normalizedTarget,
234
+ coveredMinutes: sumPlanLineMinutes(lines),
235
+ totalPrice: current.price,
236
+ lines
237
+ });
238
+ }
239
+ }
240
+ return best ?? {
241
+ available: false,
242
+ unavailableReason: "NO_COVERAGE",
243
+ targetMinutes: normalizedTarget,
244
+ coveredMinutes: 0,
245
+ totalPrice: 0,
246
+ lines: []
247
+ };
248
+ }
249
+ // Annotate the CommonJS export names for ESM import in node:
250
+ 0 && (module.exports = {
251
+ ADD_TIME_UNIT_MINUTES,
252
+ buildAddTimeCandidates,
253
+ resolveBestAddTimePlan
254
+ });
@@ -0,0 +1,36 @@
1
+ import type { GlobalScanHandleResult, GlobalScanHostBridge, ICustomer } from '../../types';
2
+ import type { AddProductDecision } from '../addProductDecision';
3
+ import { GlobalScanFormattedResult } from './formatGlobalScan';
4
+ /** applyGlobalScan 所需的 BookingTicket 运行时能力 */
5
+ export interface GlobalScanApplyHost {
6
+ setOrderCustomer(customer: ICustomer | null): void;
7
+ getOrderCustomerSnapshot(): ICustomer | null;
8
+ getBusinessCode(): string | undefined;
9
+ buildAddProductCtx(extra?: Record<string, any>): Record<string, any>;
10
+ decideAddProduct(item: any, options?: Record<string, any>): AddProductDecision;
11
+ decideAfterDetail(cacheItem: any, options?: Record<string, any>): AddProductDecision;
12
+ transformDetailToProductAndBooking(input: {
13
+ item: any;
14
+ cacheItem?: any;
15
+ detailResult?: {
16
+ e: any;
17
+ extension_type?: any;
18
+ detail?: any;
19
+ };
20
+ options?: Record<string, any>;
21
+ }): {
22
+ product: any;
23
+ booking?: any;
24
+ cacheItem: any;
25
+ };
26
+ addProductToOrder(product: any, booking?: any): Promise<any>;
27
+ }
28
+ /**
29
+ * 应用全局扫码格式化结果:设客户 / 加车 / 开单 / 弹窗链。
30
+ *
31
+ * @example
32
+ * ```ts
33
+ * const result = await applyGlobalScan(bookingTicket, formatted, bridge);
34
+ * ```
35
+ */
36
+ export declare function applyGlobalScan(host: GlobalScanApplyHost, formatted: GlobalScanFormattedResult, bridge?: GlobalScanHostBridge): Promise<GlobalScanHandleResult>;
@@ -0,0 +1,169 @@
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/solution/BookingTicket/utils/scan/applyGlobalScan.ts
20
+ var applyGlobalScan_exports = {};
21
+ __export(applyGlobalScan_exports, {
22
+ applyGlobalScan: () => applyGlobalScan
23
+ });
24
+ module.exports = __toCommonJS(applyGlobalScan_exports);
25
+ var import_addProductDecision = require("../addProductDecision");
26
+ var import_cartView = require("../cartView");
27
+ var import_scanProductValues = require("./scanProductValues");
28
+ async function processScannedProductItem(host, item, code, bridge) {
29
+ const ctx = host.buildAddProductCtx();
30
+ if ((0, import_scanProductValues.isScanProductBundle)(item) || (0, import_scanProductValues.isScanProductOption)(item)) {
31
+ return runRequiresDetailFlow(host, item, ctx, bridge);
32
+ }
33
+ if ((0, import_scanProductValues.countScanVariantMatches)(item, code) >= 2) {
34
+ return runRequiresDetailFlow(host, item, ctx, bridge);
35
+ }
36
+ const values = (0, import_scanProductValues.genScanProductValues)(item, code);
37
+ const itemWithSelection = { ...item, cartDetailValue: values };
38
+ const decision = host.decideAddProduct(itemWithSelection, ctx);
39
+ return runAddProductDecision(host, item, decision, ctx, bridge);
40
+ }
41
+ async function runRequiresDetailFlow(host, item, ctx, bridge) {
42
+ if (!(bridge == null ? void 0 : bridge.openProductDetail)) {
43
+ return "pending";
44
+ }
45
+ const payload = (0, import_addProductDecision.buildRequiresDetailPayload)(item, ctx);
46
+ const detailResult = await bridge.openProductDetail(payload);
47
+ if (!detailResult) {
48
+ return "cancelled";
49
+ }
50
+ if (!bridge.confirmDetail) {
51
+ return "pending";
52
+ }
53
+ await bridge.confirmDetail({
54
+ item: payload.productData ?? payload.item ?? item,
55
+ detailResult
56
+ });
57
+ return "added";
58
+ }
59
+ async function runAddProductDecision(host, catalogItem, decision, ctx, bridge) {
60
+ if (decision.action === "reloadCatalog") {
61
+ return "cancelled";
62
+ }
63
+ if (decision.action === "add") {
64
+ const transformed = host.transformDetailToProductAndBooking({
65
+ item: catalogItem,
66
+ cacheItem: decision.cacheItem,
67
+ options: ctx
68
+ });
69
+ await host.addProductToOrder(transformed.product, transformed.booking);
70
+ return "added";
71
+ }
72
+ if (decision.action === "requiresDetail") {
73
+ return runRequiresDetailFlow(host, catalogItem, ctx, bridge);
74
+ }
75
+ if (decision.action === "requiresBookingEdit") {
76
+ if (!(bridge == null ? void 0 : bridge.openBookingEdit)) {
77
+ return "pending";
78
+ }
79
+ const edited = await bridge.openBookingEdit(decision.payload);
80
+ if (!edited) {
81
+ return "cancelled";
82
+ }
83
+ if (!bridge.confirmBookingEdit) {
84
+ return "pending";
85
+ }
86
+ await bridge.confirmBookingEdit({ cacheItem: edited });
87
+ return "added";
88
+ }
89
+ return "pending";
90
+ }
91
+ async function applyGlobalScan(host, formatted, bridge) {
92
+ var _a, _b, _c, _d, _e, _f, _g;
93
+ const { searchType, data, scanCode } = formatted;
94
+ if (searchType === "wallet") {
95
+ if (!data) {
96
+ (_a = bridge == null ? void 0 : bridge.onNotify) == null ? void 0 : _a.call(bridge, "fail", "pisell2.text.scan-global-failed");
97
+ return { status: "failed", reason: "invalid_data" };
98
+ }
99
+ host.setOrderCustomer(data);
100
+ (_b = bridge == null ? void 0 : bridge.onNotify) == null ? void 0 : _b.call(bridge, "success", "pisell2.text.add-client-success");
101
+ return { status: "success", kind: "customer" };
102
+ }
103
+ if (searchType === "walletPass") {
104
+ if (!data) {
105
+ (_c = bridge == null ? void 0 : bridge.onNotify) == null ? void 0 : _c.call(bridge, "fail", "pisell2.text.scan-global-failed");
106
+ return { status: "failed", reason: "invalid_data" };
107
+ }
108
+ const snapshot = host.getOrderCustomerSnapshot();
109
+ const scannedCustomerIsWalkIn = (0, import_cartView.isWalkInCustomer)(data);
110
+ if ((0, import_cartView.isWalkInCustomer)(snapshot) || scannedCustomerIsWalkIn) {
111
+ if (!(bridge == null ? void 0 : bridge.applyPromotionCode)) {
112
+ return { status: "failed", reason: "no_bridge" };
113
+ }
114
+ const result = await bridge.applyPromotionCode(scanCode);
115
+ if (result == null ? void 0 : result.isAvailable) {
116
+ return { status: "success", kind: "promotion" };
117
+ }
118
+ return { status: "failed", reason: "invalid_data" };
119
+ }
120
+ host.setOrderCustomer(data);
121
+ (_d = bridge == null ? void 0 : bridge.onNotify) == null ? void 0 : _d.call(bridge, "success", "pisell2.text.add-client-success");
122
+ return { status: "success", kind: "customer" };
123
+ }
124
+ if (searchType === "product" || searchType === "local_product") {
125
+ const list = data == null ? void 0 : data.list;
126
+ if (!Array.isArray(list) || list.length === 0) {
127
+ (_e = bridge == null ? void 0 : bridge.onNotify) == null ? void 0 : _e.call(bridge, "fail", "pisell2.text.scan-global-failed");
128
+ return { status: "failed", reason: "invalid_data" };
129
+ }
130
+ let addedCount = 0;
131
+ for (const item of list) {
132
+ const outcome = await processScannedProductItem(host, item, scanCode, bridge);
133
+ if (outcome === "added") {
134
+ addedCount += 1;
135
+ }
136
+ if (outcome === "cancelled") {
137
+ return { status: "cancelled" };
138
+ }
139
+ if (outcome === "pending") {
140
+ return { status: "pending", kind: "requiresDetail" };
141
+ }
142
+ }
143
+ if (addedCount > 0) {
144
+ (_f = bridge == null ? void 0 : bridge.onNotify) == null ? void 0 : _f.call(bridge, "success");
145
+ return { status: "success", kind: "products", meta: { count: addedCount } };
146
+ }
147
+ return { status: "failed", reason: "no_bridge" };
148
+ }
149
+ if (searchType === "order") {
150
+ const orderId = (data == null ? void 0 : data.order_id) ?? (data == null ? void 0 : data.id);
151
+ if (!orderId) {
152
+ (_g = bridge == null ? void 0 : bridge.onNotify) == null ? void 0 : _g.call(bridge, "fail", "pisell2.text.scan-global-failed");
153
+ return { status: "failed", reason: "invalid_data" };
154
+ }
155
+ if (!(bridge == null ? void 0 : bridge.openOrder)) {
156
+ return { status: "pending", kind: "openOrder" };
157
+ }
158
+ bridge.openOrder({
159
+ order_id: Number(orderId),
160
+ business_code: (data == null ? void 0 : data.business_code) ?? host.getBusinessCode()
161
+ });
162
+ return { status: "pending", kind: "openOrder" };
163
+ }
164
+ return { status: "failed", reason: "invalid_data" };
165
+ }
166
+ // Annotate the CommonJS export names for ESM import in node:
167
+ 0 && (module.exports = {
168
+ applyGlobalScan
169
+ });
@@ -0,0 +1,32 @@
1
+ /**
2
+ * 全局扫码搜索结果格式化(对齐 ticketBooking `formatScanGlobal`)。
3
+ */
4
+ export type GlobalScanSearchType = 'customer' | 'wallet' | 'walletPass' | 'product' | 'local_product' | 'order';
5
+ export interface GlobalScanFormattedResult {
6
+ searchType: GlobalScanSearchType;
7
+ data: any;
8
+ scanCode: string;
9
+ }
10
+ interface RawScanSearchResult {
11
+ searchType?: GlobalScanSearchType;
12
+ response?: {
13
+ status?: boolean;
14
+ code?: number;
15
+ message?: string;
16
+ data?: any;
17
+ };
18
+ }
19
+ /**
20
+ * 将 handleGlobalScan 返回的原始结构格式化为 UI/OS 统一结构。
21
+ *
22
+ * @example
23
+ * ```ts
24
+ * const formatted = formatGlobalScanResult(
25
+ * { searchType: 'wallet', response: { code: 200, data: { customer: {...} } } },
26
+ * 'WL123',
27
+ * );
28
+ * // => { searchType: 'wallet', data: customerObj, scanCode: 'WL123' }
29
+ * ```
30
+ */
31
+ export declare function formatGlobalScanResult(raw: RawScanSearchResult | null | undefined, scanCode: string): GlobalScanFormattedResult | null;
32
+ export {};
@@ -0,0 +1,51 @@
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/solution/BookingTicket/utils/scan/formatGlobalScan.ts
20
+ var formatGlobalScan_exports = {};
21
+ __export(formatGlobalScan_exports, {
22
+ formatGlobalScanResult: () => formatGlobalScanResult
23
+ });
24
+ module.exports = __toCommonJS(formatGlobalScan_exports);
25
+ function formatGlobalScanResult(raw, scanCode) {
26
+ var _a;
27
+ if (!(raw == null ? void 0 : raw.searchType))
28
+ return null;
29
+ const { searchType } = raw;
30
+ const { data: resultData, code } = raw.response || {};
31
+ if (code !== 200 && searchType !== "local_product") {
32
+ return null;
33
+ }
34
+ if (searchType === "wallet") {
35
+ return { searchType, data: resultData == null ? void 0 : resultData.customer, scanCode };
36
+ }
37
+ if (searchType === "walletPass") {
38
+ return { searchType, data: (_a = resultData == null ? void 0 : resultData[0]) == null ? void 0 : _a.customer, scanCode };
39
+ }
40
+ if (searchType === "product" || searchType === "local_product") {
41
+ return { searchType, data: resultData, scanCode };
42
+ }
43
+ if (searchType === "order") {
44
+ return { searchType, data: resultData, scanCode };
45
+ }
46
+ return null;
47
+ }
48
+ // Annotate the CommonJS export names for ESM import in node:
49
+ 0 && (module.exports = {
50
+ formatGlobalScanResult
51
+ });
@@ -14,12 +14,17 @@ declare enum ScanResultType {
14
14
  NativeScanner = "nativeScanner"
15
15
  }
16
16
  export default class Scan {
17
+ private static scanInstances;
18
+ private static peripheralsListenerMounted;
17
19
  private solution;
18
20
  private watchKey;
19
21
  private listenerConfig;
20
22
  constructor(solution: BookingTicketImpl, watchKey: string);
21
23
  /**
22
24
  * 初始化外设扫码结果监听
25
+ *
26
+ * @example
27
+ * scan.initPeripheralsListener();
23
28
  */
24
29
  initPeripheralsListener(): void;
25
30
  /**
@@ -34,17 +34,24 @@ __export(scan_exports, {
34
34
  module.exports = __toCommonJS(scan_exports);
35
35
  var import_watch = __toESM(require("../../../../utils/watch"));
36
36
  var import_task = __toESM(require("../../../../utils/task"));
37
- var Scan = class {
37
+ var _Scan = class {
38
38
  constructor(solution, watchKey) {
39
39
  this.listenerConfig = /* @__PURE__ */ new Map();
40
40
  this.solution = solution;
41
41
  this.watchKey = watchKey;
42
+ _Scan.scanInstances.add(this);
42
43
  }
43
44
  /**
44
45
  * 初始化外设扫码结果监听
46
+ *
47
+ * @example
48
+ * scan.initPeripheralsListener();
45
49
  */
46
50
  initPeripheralsListener() {
47
51
  var _a, _b, _c, _d, _e;
52
+ if (_Scan.peripheralsListenerMounted)
53
+ return;
54
+ _Scan.peripheralsListenerMounted = true;
48
55
  (_e = (_d = (_c = (_b = (_a = this.solution) == null ? void 0 : _a.window) == null ? void 0 : _b.interaction) == null ? void 0 : _c.utils) == null ? void 0 : _d.mountFunction) == null ? void 0 : _e.call(
49
56
  _d,
50
57
  "global",
@@ -53,7 +60,9 @@ var Scan = class {
53
60
  try {
54
61
  const result = JSON.parse(strVal);
55
62
  console.log("nativeScannerResult>>>>>>>", result);
56
- this.handleScan(result);
63
+ _Scan.scanInstances.forEach((instance) => {
64
+ instance.handleScan(result);
65
+ });
57
66
  } catch (err) {
58
67
  console.error(err);
59
68
  }
@@ -70,8 +79,9 @@ var Scan = class {
70
79
  if (lastEnableEventKey) {
71
80
  const listenerConfig = this.listenerConfig.get(lastEnableEventKey);
72
81
  if (listenerConfig) {
82
+ const taskUuid = this.generateUuid();
73
83
  listenerConfig.task.addTask({
74
- uuid: this.generateUuid(),
84
+ uuid: taskUuid,
75
85
  type: lastEnableEventKey,
76
86
  actionParams: {
77
87
  scanResult: result
@@ -122,6 +132,7 @@ var Scan = class {
122
132
  */
123
133
  removeAllListeners() {
124
134
  var _a, _b, _c, _d;
135
+ _Scan.scanInstances.delete(this);
125
136
  import_watch.default.clearEvent(this.watchKey);
126
137
  (_b = (_a = this.listenerConfig) == null ? void 0 : _a.forEach) == null ? void 0 : _b.call(_a, (item) => {
127
138
  var _a2;
@@ -213,3 +224,6 @@ var Scan = class {
213
224
  }
214
225
  }
215
226
  };
227
+ var Scan = _Scan;
228
+ Scan.scanInstances = /* @__PURE__ */ new Set();
229
+ Scan.peripheralsListenerMounted = false;
@@ -0,0 +1,21 @@
1
+ /**
2
+ * 扫码商品条码预选规格纯函数(对齐 ticketBooking addServiceVariant/utils)。
3
+ */
4
+ /** 套餐商品 */
5
+ export declare function isScanProductBundle(item: any): boolean;
6
+ /** 单规格 / 选项组商品 */
7
+ export declare function isScanProductOption(item: any): boolean;
8
+ /**
9
+ * 根据条码匹配 variant,生成 cartDetailValue(对齐 ticketBooking `genValues`)。
10
+ *
11
+ * @example
12
+ * ```ts
13
+ * const values = genScanProductValues(catalogItem, '6901234567890');
14
+ * const itemWithSelection = { ...catalogItem, cartDetailValue: values };
15
+ * ```
16
+ */
17
+ export declare function genScanProductValues(item: any, code: string): Record<string, any>;
18
+ /**
19
+ * 统计条码命中的 variant 数量(多命中时需弹窗选择)。
20
+ */
21
+ export declare function countScanVariantMatches(item: any, code: string): number;