@pisell/pisellos 0.0.569 → 0.10.1

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 (329) hide show
  1. package/dist/core/index.js +10 -6
  2. package/dist/index.d.ts +0 -1
  3. package/dist/index.js +0 -3
  4. package/dist/model/strategy/adapter/walletPass/evaluator.js +7 -5
  5. package/dist/model/strategy/adapter/walletPass/example.js +26 -3
  6. package/dist/model/strategy/adapter/walletPass/index.js +5 -5
  7. package/dist/model/strategy/adapter/walletPass/type.d.ts +0 -3
  8. package/dist/model/strategy/adapter/walletPass/utils.d.ts +0 -26
  9. package/dist/model/strategy/adapter/walletPass/utils.js +17 -92
  10. package/dist/model/strategy/strategy-example.js +19 -5
  11. package/dist/modules/BaseModule.d.ts +1 -1
  12. package/dist/modules/BaseModule.js +8 -10
  13. package/dist/modules/Cart/index.js +3 -0
  14. package/dist/modules/Cart/utils/cartProduct.js +1 -0
  15. package/dist/modules/Cart/utils/cartResource.js +0 -2
  16. package/dist/modules/Cart/utils/changePrice.js +9 -16
  17. package/dist/modules/Date/index.js +5 -1
  18. package/dist/modules/Discount/index.d.ts +0 -1
  19. package/dist/modules/Discount/index.js +7 -22
  20. package/dist/modules/Discount/types.d.ts +0 -1
  21. package/dist/modules/OpenData/index.js +2 -0
  22. package/dist/modules/Order/index.d.ts +1 -1
  23. package/dist/modules/Order/index.js +70 -40
  24. package/dist/modules/Payment/index.js +162 -97
  25. package/dist/modules/Payment/types.d.ts +4 -8
  26. package/dist/modules/Payment/walletpass.d.ts +0 -2
  27. package/dist/modules/Payment/walletpass.js +5 -4
  28. package/dist/modules/ProductList/index.d.ts +1 -1
  29. package/dist/modules/ProductList/index.js +3 -12
  30. package/dist/modules/ProductList/types.d.ts +0 -1
  31. package/dist/modules/Rules/index.js +126 -427
  32. package/dist/modules/SalesSummary/utils.js +1 -2
  33. package/dist/modules/Schedule/getDateIsInSchedule.js +0 -5
  34. package/dist/modules/Schedule/index.js +1 -0
  35. package/dist/modules/Schedule/utils.js +1 -0
  36. package/dist/modules/Step/index.js +1 -0
  37. package/dist/modules/Summary/utils.js +22 -43
  38. package/dist/plugins/request.js +4 -1
  39. package/dist/plugins/window.js +6 -2
  40. package/dist/server/index.js +129 -97
  41. package/dist/server/modules/menu/index.js +41 -32
  42. package/dist/server/modules/order/index.js +4 -2
  43. package/dist/server/modules/products/index.js +42 -24
  44. package/dist/server/modules/quotation/index.js +38 -29
  45. package/dist/server/modules/resource/index.js +4 -3
  46. package/dist/server/modules/schedule/index.js +35 -27
  47. package/dist/server/utils/product.js +1 -0
  48. package/dist/solution/BaseSales/index.js +41 -38
  49. package/dist/solution/BookingByStep/index.d.ts +1 -1
  50. package/dist/solution/BookingByStep/index.js +60 -11
  51. package/dist/solution/BookingByStep/utils/capacity.js +11 -1
  52. package/dist/solution/BookingByStep/utils/resources.js +3 -1
  53. package/dist/solution/BookingByStep/utils/timeslots.js +43 -2
  54. package/dist/solution/BookingTicket/index.d.ts +1 -1
  55. package/dist/solution/BookingTicket/index.js +2 -0
  56. package/dist/solution/BookingTicket/utils/scan/cloudSearch.js +7 -6
  57. package/dist/solution/BookingTicket/utils/scan/handleScan.js +31 -25
  58. package/dist/solution/BookingTicket/utils/scan/index.js +10 -6
  59. package/dist/solution/BuyTickets/index.js +12 -9
  60. package/dist/solution/Checkout/index.js +252 -177
  61. package/dist/solution/Checkout/utils/index.js +16 -4
  62. package/dist/solution/RegisterAndLogin/index.js +76 -30
  63. package/dist/solution/ScanOrder/index.js +60 -50
  64. package/dist/solution/ShopDiscount/index.js +14 -15
  65. package/dist/solution/ShopDiscount/types.d.ts +4 -5
  66. package/dist/solution/ShopDiscount/utils.d.ts +0 -9
  67. package/dist/solution/ShopDiscount/utils.js +0 -9
  68. package/dist/solution/VenueBooking/index.d.ts +3 -31
  69. package/dist/solution/VenueBooking/index.js +496 -651
  70. package/dist/solution/VenueBooking/types.d.ts +1 -3
  71. package/dist/solution/VenueBooking/types.js +0 -1
  72. package/dist/solution/VenueBooking/utils/dateSummary.d.ts +2 -2
  73. package/dist/solution/VenueBooking/utils/dateSummary.js +25 -12
  74. package/dist/solution/VenueBooking/utils/timeSlot.d.ts +0 -2
  75. package/dist/solution/VenueBooking/utils/timeSlot.js +4 -9
  76. package/dist/types/index.d.ts +1 -1
  77. package/dist/utils/task.js +18 -15
  78. package/dist/utils/watch.js +1 -0
  79. package/lib/apis/picoding.js +0 -2
  80. package/lib/core/index.js +132 -130
  81. package/lib/effects/index.js +57 -46
  82. package/lib/index.d.ts +0 -1
  83. package/lib/index.js +50 -92
  84. package/lib/model/index.js +21 -14
  85. package/lib/model/strategy/adapter/dataVariant/adapter.js +50 -38
  86. package/lib/model/strategy/adapter/dataVariant/evaluator.js +236 -162
  87. package/lib/model/strategy/adapter/dataVariant/examples.js +237 -229
  88. package/lib/model/strategy/adapter/dataVariant/index.js +34 -39
  89. package/lib/model/strategy/adapter/dataVariant/type.js +28 -57
  90. package/lib/model/strategy/adapter/index.js +64 -100
  91. package/lib/model/strategy/adapter/itemRule/adapter.js +144 -156
  92. package/lib/model/strategy/adapter/itemRule/evaluator.js +48 -36
  93. package/lib/model/strategy/adapter/itemRule/examples.js +225 -295
  94. package/lib/model/strategy/adapter/itemRule/index.js +57 -83
  95. package/lib/model/strategy/adapter/itemRule/type.js +36 -97
  96. package/lib/model/strategy/adapter/promotion/adapter.js +63 -84
  97. package/lib/model/strategy/adapter/promotion/evaluator.js +231 -381
  98. package/lib/model/strategy/adapter/promotion/examples.js +159 -139
  99. package/lib/model/strategy/adapter/promotion/index.js +0 -1
  100. package/lib/model/strategy/adapter/promotion/type.js +35 -199
  101. package/lib/model/strategy/adapter/type.js +16 -4
  102. package/lib/model/strategy/adapter/walletPass/evaluator.js +152 -180
  103. package/lib/model/strategy/adapter/walletPass/example.js +190 -217
  104. package/lib/model/strategy/adapter/walletPass/index.js +51 -75
  105. package/lib/model/strategy/adapter/walletPass/locales.js +58 -36
  106. package/lib/model/strategy/adapter/walletPass/type.d.ts +0 -3
  107. package/lib/model/strategy/adapter/walletPass/type.js +16 -4
  108. package/lib/model/strategy/adapter/walletPass/utils.d.ts +0 -26
  109. package/lib/model/strategy/adapter/walletPass/utils.js +383 -678
  110. package/lib/model/strategy/engine.js +168 -270
  111. package/lib/model/strategy/index.js +34 -49
  112. package/lib/model/strategy/strategy-example.js +239 -243
  113. package/lib/model/strategy/type.js +40 -100
  114. package/lib/modules/Account/index.js +53 -39
  115. package/lib/modules/Account/types.js +33 -20
  116. package/lib/modules/AccountList/index.js +154 -116
  117. package/lib/modules/AccountList/types.js +31 -30
  118. package/lib/modules/AccountList/utils.js +30 -18
  119. package/lib/modules/BaseModule.d.ts +1 -1
  120. package/lib/modules/BaseModule.js +46 -25
  121. package/lib/modules/BookingContext/index.js +136 -158
  122. package/lib/modules/BookingContext/types.js +32 -46
  123. package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +143 -131
  124. package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +82 -75
  125. package/lib/modules/BookingContext/utils/cacheItemToBookingInput.js +150 -170
  126. package/lib/modules/BookingContext/utils/flexible.js +55 -38
  127. package/lib/modules/BookingContext/utils/formatResourceList.js +34 -19
  128. package/lib/modules/BookingContext/utils/index.js +41 -124
  129. package/lib/modules/BookingContext/utils/noResource.js +70 -58
  130. package/lib/modules/BookingContext/utils/orderLineDisplay.js +41 -14
  131. package/lib/modules/BookingContext/utils/productExtend.js +155 -202
  132. package/lib/modules/BookingContext/utils/resourceErrors.js +53 -53
  133. package/lib/modules/BookingContext/utils/resourceSelection.js +41 -19
  134. package/lib/modules/BookingContext/utils/resources.js +167 -209
  135. package/lib/modules/BookingContext/utils/serviceTimes.js +116 -115
  136. package/lib/modules/BookingContext/utils/timeSlices.js +80 -70
  137. package/lib/modules/Cart/index.js +124 -170
  138. package/lib/modules/Cart/types.js +51 -46
  139. package/lib/modules/Cart/utils/cartAccount.js +39 -40
  140. package/lib/modules/Cart/utils/cartDate.js +61 -56
  141. package/lib/modules/Cart/utils/cartDiscount.js +33 -28
  142. package/lib/modules/Cart/utils/cartNote.js +32 -27
  143. package/lib/modules/Cart/utils/cartProduct.js +251 -321
  144. package/lib/modules/Cart/utils/cartRelationForms.js +35 -29
  145. package/lib/modules/Cart/utils/cartResource.js +78 -72
  146. package/lib/modules/Cart/utils/changePrice.js +50 -28
  147. package/lib/modules/Cart/utils/index.js +48 -106
  148. package/lib/modules/Customer/constants.js +34 -13
  149. package/lib/modules/Customer/index.js +169 -232
  150. package/lib/modules/Customer/types.js +35 -38
  151. package/lib/modules/Date/index.js +115 -116
  152. package/lib/modules/Date/types.js +28 -16
  153. package/lib/modules/Date/utils.js +123 -174
  154. package/lib/modules/Discount/index.d.ts +0 -1
  155. package/lib/modules/Discount/index.js +128 -130
  156. package/lib/modules/Discount/types.d.ts +0 -1
  157. package/lib/modules/Discount/types.js +31 -9
  158. package/lib/modules/Guests/index.js +56 -30
  159. package/lib/modules/Guests/types.js +33 -23
  160. package/lib/modules/Holder/index.js +189 -209
  161. package/lib/modules/Holder/types.js +16 -4
  162. package/lib/modules/Holder/utils.js +49 -20
  163. package/lib/modules/OpenData/index.js +76 -69
  164. package/lib/modules/OpenData/types.js +16 -4
  165. package/lib/modules/OpenData/utils.js +78 -44
  166. package/lib/modules/Order/index.d.ts +1 -1
  167. package/lib/modules/Order/index.js +1909 -1572
  168. package/lib/modules/Order/types.js +35 -78
  169. package/lib/modules/Order/utils/bundleDiscountHydration.js +74 -41
  170. package/lib/modules/Order/utils/manualProductDiscount.js +123 -124
  171. package/lib/modules/Order/utils/orderCollectionIdentity.js +210 -148
  172. package/lib/modules/Order/utils.js +634 -799
  173. package/lib/modules/Payment/cash.js +33 -20
  174. package/lib/modules/Payment/cashRecommendationAlgorithm.js +76 -145
  175. package/lib/modules/Payment/eftpos.js +30 -16
  176. package/lib/modules/Payment/index.js +378 -518
  177. package/lib/modules/Payment/mx51.js +0 -1
  178. package/lib/modules/Payment/types.d.ts +4 -8
  179. package/lib/modules/Payment/types.js +107 -216
  180. package/lib/modules/Payment/utils.js +48 -51
  181. package/lib/modules/Payment/walletpass.d.ts +0 -2
  182. package/lib/modules/Payment/walletpass.js +211 -226
  183. package/lib/modules/Product/index.js +46 -51
  184. package/lib/modules/Product/types.js +16 -4
  185. package/lib/modules/Product/utils.js +33 -32
  186. package/lib/modules/ProductList/index.d.ts +1 -1
  187. package/lib/modules/ProductList/index.js +117 -117
  188. package/lib/modules/ProductList/types.d.ts +0 -1
  189. package/lib/modules/ProductList/types.js +31 -9
  190. package/lib/modules/Quotation/index.js +100 -66
  191. package/lib/modules/Quotation/types.js +16 -4
  192. package/lib/modules/Resource/index.js +59 -27
  193. package/lib/modules/Resource/types.js +32 -22
  194. package/lib/modules/Resource/utils.js +38 -30
  195. package/lib/modules/ResourcePlanner/index.js +61 -60
  196. package/lib/modules/ResourcePlanner/planner.js +384 -346
  197. package/lib/modules/ResourcePlanner/types.js +16 -4
  198. package/lib/modules/Rules/index.js +903 -1475
  199. package/lib/modules/Rules/types.js +40 -17
  200. package/lib/modules/SalesSummary/index.js +90 -85
  201. package/lib/modules/SalesSummary/types.js +16 -4
  202. package/lib/modules/SalesSummary/utils.js +427 -351
  203. package/lib/modules/ScanOrderLogger/index.js +79 -59
  204. package/lib/modules/ScanOrderLogger/providers/feishu.js +78 -54
  205. package/lib/modules/ScanOrderLogger/providers/grafana.js +36 -13
  206. package/lib/modules/ScanOrderLogger/types.js +16 -4
  207. package/lib/modules/Schedule/getDateIsInSchedule.js +163 -339
  208. package/lib/modules/Schedule/index.js +114 -100
  209. package/lib/modules/Schedule/type.js +16 -4
  210. package/lib/modules/Schedule/types.js +16 -4
  211. package/lib/modules/Schedule/utils.js +291 -433
  212. package/lib/modules/Step/index.js +52 -40
  213. package/lib/modules/Step/tyeps.js +16 -4
  214. package/lib/modules/Summary/index.js +71 -66
  215. package/lib/modules/Summary/types.js +16 -4
  216. package/lib/modules/Summary/utils.js +418 -791
  217. package/lib/modules/SurchargeList/index.js +60 -46
  218. package/lib/modules/SurchargeList/types.js +16 -4
  219. package/lib/modules/index.js +63 -245
  220. package/lib/plugins/app.js +16 -4
  221. package/lib/plugins/index.js +25 -36
  222. package/lib/plugins/request.js +126 -137
  223. package/lib/plugins/shopStore.js +16 -4
  224. package/lib/plugins/user.js +16 -4
  225. package/lib/plugins/window.js +179 -171
  226. package/lib/server/index.js +2337 -2675
  227. package/lib/server/modules/floor-plan/index.js +123 -102
  228. package/lib/server/modules/floor-plan/types.js +30 -15
  229. package/lib/server/modules/index.js +68 -106
  230. package/lib/server/modules/menu/index.js +122 -146
  231. package/lib/server/modules/menu/types.js +31 -18
  232. package/lib/server/modules/order/index.js +642 -567
  233. package/lib/server/modules/order/types.js +32 -117
  234. package/lib/server/modules/order/utils/filterBookings.js +194 -219
  235. package/lib/server/modules/order/utils/filterOrders.js +92 -118
  236. package/lib/server/modules/payment/index.js +83 -59
  237. package/lib/server/modules/payment/types.js +16 -4
  238. package/lib/server/modules/products/index.js +459 -575
  239. package/lib/server/modules/products/types.js +34 -44
  240. package/lib/server/modules/quotation/index.js +172 -137
  241. package/lib/server/modules/quotation/types.js +31 -21
  242. package/lib/server/modules/resource/index.js +184 -213
  243. package/lib/server/modules/resource/types.js +33 -42
  244. package/lib/server/modules/schedule/index.js +123 -135
  245. package/lib/server/modules/schedule/types.js +21 -14
  246. package/lib/server/modules/schedule/utils.js +163 -334
  247. package/lib/server/types.js +16 -4
  248. package/lib/server/utils/index.js +23 -25
  249. package/lib/server/utils/product.js +139 -196
  250. package/lib/server/utils/schedule.js +41 -34
  251. package/lib/server/utils/small-ticket.js +456 -478
  252. package/lib/server/utils/time.js +49 -40
  253. package/lib/solution/BaseSales/index.js +1016 -850
  254. package/lib/solution/BaseSales/types.js +37 -41
  255. package/lib/solution/BaseSales/utils/cartPromotion.js +460 -611
  256. package/lib/solution/BaseSales/utils/parseSalesResponse.js +105 -85
  257. package/lib/solution/BaseSales/utils/quotationPrice.js +114 -56
  258. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +143 -102
  259. package/lib/solution/BaseSales/utils.js +140 -155
  260. package/lib/solution/BookingByStep/index.d.ts +1 -1
  261. package/lib/solution/BookingByStep/index.js +1340 -1530
  262. package/lib/solution/BookingByStep/types.js +99 -40
  263. package/lib/solution/BookingByStep/utils/capacity.js +160 -192
  264. package/lib/solution/BookingByStep/utils/products.js +52 -42
  265. package/lib/solution/BookingByStep/utils/resources.js +330 -527
  266. package/lib/solution/BookingByStep/utils/stock.js +44 -65
  267. package/lib/solution/BookingByStep/utils/timeslots.js +131 -129
  268. package/lib/solution/BookingTicket/index.d.ts +1 -1
  269. package/lib/solution/BookingTicket/index.js +459 -543
  270. package/lib/solution/BookingTicket/types.js +77 -99
  271. package/lib/solution/BookingTicket/utils/addProductDecision.js +184 -219
  272. package/lib/solution/BookingTicket/utils/addTimeAvailability.js +89 -58
  273. package/lib/solution/BookingTicket/utils/bookingStatus.js +78 -107
  274. package/lib/solution/BookingTicket/utils/cartView.js +94 -110
  275. package/lib/solution/BookingTicket/utils/exampleData.js +0 -185
  276. package/lib/solution/BookingTicket/utils/orderCustomer.js +41 -18
  277. package/lib/solution/BookingTicket/utils/resolveBestAddTimePlan.js +86 -219
  278. package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +93 -144
  279. package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +91 -79
  280. package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.js +41 -54
  281. package/lib/solution/BookingTicket/utils/scan/handleScan.js +81 -84
  282. package/lib/solution/BookingTicket/utils/scan/index.js +104 -98
  283. package/lib/solution/BookingTicket/utils/scan/scanCache.js +43 -90
  284. package/lib/solution/BookingTicket/utils/scan/scanProductValues.js +64 -52
  285. package/lib/solution/BookingTicket/utils/sessionCatalogStale.js +58 -56
  286. package/lib/solution/BuyTickets/index.js +70 -67
  287. package/lib/solution/BuyTickets/types.js +38 -22
  288. package/lib/solution/Checkout/index.js +1158 -1451
  289. package/lib/solution/Checkout/types.js +61 -91
  290. package/lib/solution/Checkout/utils/index.js +156 -228
  291. package/lib/solution/PlaceOrder/index.js +0 -55
  292. package/lib/solution/RegisterAndLogin/config.js +460 -493
  293. package/lib/solution/RegisterAndLogin/index.js +630 -633
  294. package/lib/solution/RegisterAndLogin/types.js +76 -189
  295. package/lib/solution/RegisterAndLogin/utils.js +125 -183
  296. package/lib/solution/Sales/index.js +320 -317
  297. package/lib/solution/Sales/types.js +33 -27
  298. package/lib/solution/ScanOrder/index.js +862 -831
  299. package/lib/solution/ScanOrder/types.js +34 -33
  300. package/lib/solution/ScanOrder/utils.js +371 -406
  301. package/lib/solution/ShopDiscount/index.js +233 -235
  302. package/lib/solution/ShopDiscount/types.d.ts +4 -5
  303. package/lib/solution/ShopDiscount/types.js +37 -15
  304. package/lib/solution/ShopDiscount/utils.d.ts +0 -9
  305. package/lib/solution/ShopDiscount/utils.js +172 -309
  306. package/lib/solution/UnifiedBookingSales/index.js +405 -379
  307. package/lib/solution/UnifiedBookingSales/types.js +31 -12
  308. package/lib/solution/VenueBooking/index.d.ts +3 -31
  309. package/lib/solution/VenueBooking/index.js +916 -967
  310. package/lib/solution/VenueBooking/types.d.ts +1 -3
  311. package/lib/solution/VenueBooking/types.js +39 -20
  312. package/lib/solution/VenueBooking/utils/dateSummary.d.ts +2 -2
  313. package/lib/solution/VenueBooking/utils/dateSummary.js +62 -25
  314. package/lib/solution/VenueBooking/utils/resource.js +54 -31
  315. package/lib/solution/VenueBooking/utils/slotMerge.js +107 -94
  316. package/lib/solution/VenueBooking/utils/timeSlot.d.ts +0 -2
  317. package/lib/solution/VenueBooking/utils/timeSlot.js +133 -138
  318. package/lib/solution/VenueBooking/utils.js +67 -130
  319. package/lib/solution/index.js +41 -124
  320. package/lib/store/createStore.js +29 -32
  321. package/lib/types/index.d.ts +1 -1
  322. package/lib/types/index.js +16 -4
  323. package/lib/utils/task.js +36 -36
  324. package/lib/utils/watch.js +47 -81
  325. package/package.json +2 -4
  326. package/dist/solution/VenueBooking/utils/smartPricing.d.ts +0 -70
  327. package/dist/solution/VenueBooking/utils/smartPricing.js +0 -233
  328. package/lib/solution/VenueBooking/utils/smartPricing.d.ts +0 -70
  329. package/lib/solution/VenueBooking/utils/smartPricing.js +0 -192
@@ -1,220 +1,169 @@
1
- "use strict";
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);
2
18
 
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
19
+ // src/solution/BookingTicket/utils/scan/applyGlobalScan.ts
20
+ var applyGlobalScan_exports = {};
21
+ __export(applyGlobalScan_exports, {
22
+ applyGlobalScan: () => applyGlobalScan
5
23
  });
6
- exports.applyGlobalScan = applyGlobalScan;
7
- var _addProductDecision = require("../addProductDecision");
8
- var _cartView = require("../cartView");
9
- var _scanProductValues = require("./scanProductValues");
10
- /** applyGlobalScan 所需的 BookingTicket 运行时能力 */
11
-
12
- /**
13
- * 处理单条扫码商品的加车决策(含弹窗链)。
14
- */
24
+ module.exports = __toCommonJS(applyGlobalScan_exports);
25
+ var import_addProductDecision = require("../addProductDecision");
26
+ var import_cartView = require("../cartView");
27
+ var import_scanProductValues = require("./scanProductValues");
15
28
  async function processScannedProductItem(host, item, code, bridge) {
16
29
  const ctx = host.buildAddProductCtx();
17
- if ((0, _scanProductValues.isScanProductBundle)(item) || (0, _scanProductValues.isScanProductOption)(item)) {
30
+ if ((0, import_scanProductValues.isScanProductBundle)(item) || (0, import_scanProductValues.isScanProductOption)(item)) {
18
31
  return runRequiresDetailFlow(host, item, ctx, bridge);
19
32
  }
20
- if ((0, _scanProductValues.countScanVariantMatches)(item, code) >= 2) {
33
+ if ((0, import_scanProductValues.countScanVariantMatches)(item, code) >= 2) {
21
34
  return runRequiresDetailFlow(host, item, ctx, bridge);
22
35
  }
23
- const values = (0, _scanProductValues.genScanProductValues)(item, code);
24
- const itemWithSelection = {
25
- ...item,
26
- cartDetailValue: values
27
- };
36
+ const values = (0, import_scanProductValues.genScanProductValues)(item, code);
37
+ const itemWithSelection = { ...item, cartDetailValue: values };
28
38
  const decision = host.decideAddProduct(itemWithSelection, ctx);
29
39
  return runAddProductDecision(host, item, decision, ctx, bridge);
30
40
  }
31
41
  async function runRequiresDetailFlow(host, item, ctx, bridge) {
32
- if (!bridge?.openProductDetail) {
33
- return 'pending';
42
+ if (!(bridge == null ? void 0 : bridge.openProductDetail)) {
43
+ return "pending";
34
44
  }
35
- const payload = (0, _addProductDecision.buildRequiresDetailPayload)(item, ctx);
45
+ const payload = (0, import_addProductDecision.buildRequiresDetailPayload)(item, ctx);
36
46
  const detailResult = await bridge.openProductDetail(payload);
37
47
  if (!detailResult) {
38
- return 'cancelled';
48
+ return "cancelled";
39
49
  }
40
50
  if (!bridge.confirmDetail) {
41
- return 'pending';
51
+ return "pending";
42
52
  }
43
53
  await bridge.confirmDetail({
44
54
  item: payload.productData ?? payload.item ?? item,
45
55
  detailResult
46
56
  });
47
- return 'added';
57
+ return "added";
48
58
  }
49
59
  async function runAddProductDecision(host, catalogItem, decision, ctx, bridge) {
50
- if (decision.action === 'reloadCatalog') {
51
- return 'cancelled';
60
+ if (decision.action === "reloadCatalog") {
61
+ return "cancelled";
52
62
  }
53
- if (decision.action === 'add') {
63
+ if (decision.action === "add") {
54
64
  const transformed = host.transformDetailToProductAndBooking({
55
65
  item: catalogItem,
56
66
  cacheItem: decision.cacheItem,
57
67
  options: ctx
58
68
  });
59
69
  await host.addProductToOrder(transformed.product, transformed.booking);
60
- return 'added';
70
+ return "added";
61
71
  }
62
- if (decision.action === 'requiresDetail') {
72
+ if (decision.action === "requiresDetail") {
63
73
  return runRequiresDetailFlow(host, catalogItem, ctx, bridge);
64
74
  }
65
- if (decision.action === 'requiresBookingEdit') {
66
- if (!bridge?.openBookingEdit) {
67
- return 'pending';
75
+ if (decision.action === "requiresBookingEdit") {
76
+ if (!(bridge == null ? void 0 : bridge.openBookingEdit)) {
77
+ return "pending";
68
78
  }
69
79
  const edited = await bridge.openBookingEdit(decision.payload);
70
80
  if (!edited) {
71
- return 'cancelled';
81
+ return "cancelled";
72
82
  }
73
83
  if (!bridge.confirmBookingEdit) {
74
- return 'pending';
84
+ return "pending";
75
85
  }
76
- await bridge.confirmBookingEdit({
77
- cacheItem: edited
78
- });
79
- return 'added';
86
+ await bridge.confirmBookingEdit({ cacheItem: edited });
87
+ return "added";
80
88
  }
81
- return 'pending';
89
+ return "pending";
82
90
  }
83
-
84
- /**
85
- * 应用全局扫码格式化结果:设客户 / 加车 / 开单 / 弹窗链。
86
- *
87
- * @example
88
- * ```ts
89
- * const result = await applyGlobalScan(bookingTicket, formatted, bridge);
90
- * ```
91
- */
92
91
  async function applyGlobalScan(host, formatted, bridge) {
93
- const {
94
- searchType,
95
- data,
96
- scanCode
97
- } = formatted;
98
- if (searchType === 'wallet') {
92
+ var _a, _b, _c, _d, _e, _f, _g;
93
+ const { searchType, data, scanCode } = formatted;
94
+ if (searchType === "wallet") {
99
95
  if (!data) {
100
- bridge?.onNotify?.('fail', 'pisell2.text.scan-global-failed');
101
- return {
102
- status: 'failed',
103
- reason: 'invalid_data'
104
- };
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" };
105
98
  }
106
99
  host.setOrderCustomer(data);
107
- bridge?.onNotify?.('success', 'pisell2.text.add-client-success');
108
- return {
109
- status: 'success',
110
- kind: 'customer'
111
- };
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" };
112
102
  }
113
- if (searchType === 'walletPass') {
103
+ if (searchType === "walletPass") {
114
104
  if (!data) {
115
- bridge?.onNotify?.('fail', 'pisell2.text.scan-global-failed');
116
- return {
117
- status: 'failed',
118
- reason: 'invalid_data'
119
- };
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" };
120
107
  }
121
108
  const snapshot = host.getOrderCustomerSnapshot();
122
- const scannedCustomerIsWalkIn = (0, _cartView.isWalkInCustomer)(data);
123
- if ((0, _cartView.isWalkInCustomer)(snapshot) || scannedCustomerIsWalkIn) {
124
- // 当前购物车或 walletPass 绑定客户为 walk-in 时不绑客户,避免覆盖已有下单客户。
125
- if (!bridge?.applyPromotionCode) {
126
- return {
127
- status: 'failed',
128
- reason: 'no_bridge'
129
- };
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" };
130
113
  }
131
114
  const result = await bridge.applyPromotionCode(scanCode);
132
- if (result?.isAvailable) {
133
- return {
134
- status: 'success',
135
- kind: 'promotion'
136
- };
115
+ if (result == null ? void 0 : result.isAvailable) {
116
+ return { status: "success", kind: "promotion" };
137
117
  }
138
- return {
139
- status: 'failed',
140
- reason: 'invalid_data'
141
- };
118
+ return { status: "failed", reason: "invalid_data" };
142
119
  }
143
120
  host.setOrderCustomer(data);
144
- bridge?.onNotify?.('success', 'pisell2.text.add-client-success');
145
- return {
146
- status: 'success',
147
- kind: 'customer'
148
- };
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" };
149
123
  }
150
- if (searchType === 'product' || searchType === 'local_product') {
151
- const list = data?.list;
124
+ if (searchType === "product" || searchType === "local_product") {
125
+ const list = data == null ? void 0 : data.list;
152
126
  if (!Array.isArray(list) || list.length === 0) {
153
- bridge?.onNotify?.('fail', 'pisell2.text.scan-global-failed');
154
- return {
155
- status: 'failed',
156
- reason: 'invalid_data'
157
- };
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" };
158
129
  }
159
130
  let addedCount = 0;
160
131
  for (const item of list) {
161
132
  const outcome = await processScannedProductItem(host, item, scanCode, bridge);
162
- if (outcome === 'added') {
133
+ if (outcome === "added") {
163
134
  addedCount += 1;
164
135
  }
165
- if (outcome === 'cancelled') {
166
- return {
167
- status: 'cancelled'
168
- };
136
+ if (outcome === "cancelled") {
137
+ return { status: "cancelled" };
169
138
  }
170
- if (outcome === 'pending') {
171
- return {
172
- status: 'pending',
173
- kind: 'requiresDetail'
174
- };
139
+ if (outcome === "pending") {
140
+ return { status: "pending", kind: "requiresDetail" };
175
141
  }
176
142
  }
177
143
  if (addedCount > 0) {
178
- bridge?.onNotify?.('success');
179
- return {
180
- status: 'success',
181
- kind: 'products',
182
- meta: {
183
- count: addedCount
184
- }
185
- };
144
+ (_f = bridge == null ? void 0 : bridge.onNotify) == null ? void 0 : _f.call(bridge, "success");
145
+ return { status: "success", kind: "products", meta: { count: addedCount } };
186
146
  }
187
- return {
188
- status: 'failed',
189
- reason: 'no_bridge'
190
- };
147
+ return { status: "failed", reason: "no_bridge" };
191
148
  }
192
- if (searchType === 'order') {
193
- const orderId = data?.order_id ?? data?.id;
149
+ if (searchType === "order") {
150
+ const orderId = (data == null ? void 0 : data.order_id) ?? (data == null ? void 0 : data.id);
194
151
  if (!orderId) {
195
- bridge?.onNotify?.('fail', 'pisell2.text.scan-global-failed');
196
- return {
197
- status: 'failed',
198
- reason: 'invalid_data'
199
- };
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" };
200
154
  }
201
- if (!bridge?.openOrder) {
202
- return {
203
- status: 'pending',
204
- kind: 'openOrder'
205
- };
155
+ if (!(bridge == null ? void 0 : bridge.openOrder)) {
156
+ return { status: "pending", kind: "openOrder" };
206
157
  }
207
158
  bridge.openOrder({
208
159
  order_id: Number(orderId),
209
- business_code: data?.business_code ?? host.getBusinessCode()
160
+ business_code: (data == null ? void 0 : data.business_code) ?? host.getBusinessCode()
210
161
  });
211
- return {
212
- status: 'pending',
213
- kind: 'openOrder'
214
- };
162
+ return { status: "pending", kind: "openOrder" };
215
163
  }
216
- return {
217
- status: 'failed',
218
- reason: 'invalid_data'
219
- };
220
- }
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
+ });
@@ -1,77 +1,85 @@
1
- "use strict";
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);
2
18
 
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
19
+ // src/solution/BookingTicket/utils/scan/cloudSearch.ts
20
+ var cloudSearch_exports = {};
21
+ __export(cloudSearch_exports, {
22
+ searchOrder: () => searchOrder,
23
+ searchProduct: () => searchProduct,
24
+ searchWallet: () => searchWallet,
25
+ searchWalletPass: () => searchWalletPass
5
26
  });
6
- exports.searchWalletPass = exports.searchWallet = exports.searchProduct = exports.searchOrder = void 0;
7
- /**
8
- * 搜索通用识别码
9
- */
10
- const searchWalletPass = async (request, code) => {
27
+ module.exports = __toCommonJS(cloudSearch_exports);
28
+ var searchWalletPass = async (request, code) => {
11
29
  const params = {
12
30
  code,
13
31
  translate_flag: 1,
14
32
  // 翻译识别码名称 0:不翻译 1:翻译
15
33
  relation_product: 1,
16
34
  // 组装关联商品: 0不处理 1处理
17
- with: ['customer'],
18
- tags: ['point_card',
19
- // 积分卡
20
- 'gift_card',
21
- // 充值卡
22
- 'product_voucher',
23
- // 代金券
24
- 'product_discount_card',
25
- // 折扣卡
26
- 'good_pass',
27
- // 商品券
28
- 'session_ticket',
29
- // 场次票
30
- 'appointment_ticket' // 预约类门票
35
+ with: ["customer"],
36
+ tags: [
37
+ "point_card",
38
+ // 积分卡
39
+ "gift_card",
40
+ // 充值卡
41
+ "product_voucher",
42
+ // 代金券
43
+ "product_discount_card",
44
+ // 折扣卡
45
+ "good_pass",
46
+ // 商品券
47
+ "session_ticket",
48
+ // 场次票
49
+ "appointment_ticket"
50
+ // 预约类门票
31
51
  ]
32
52
  };
33
53
  try {
34
- const res = await request?.get('/machinecode/batch-search', params);
35
- if (res?.code == 200 && !!res?.data) {
36
- return {
37
- searchType: 'walletPass',
38
- response: res
39
- };
54
+ const res = await (request == null ? void 0 : request.get(
55
+ "/machinecode/batch-search",
56
+ params
57
+ ));
58
+ if ((res == null ? void 0 : res.code) == 200 && !!(res == null ? void 0 : res.data)) {
59
+ return { searchType: "walletPass", response: res };
40
60
  }
41
- throw new Error('没有找到对应的识别码');
61
+ throw new Error("没有找到对应的识别码");
42
62
  } catch (error) {
43
63
  throw error;
44
64
  }
45
65
  };
46
-
47
- /**
48
- * 搜索钱包
49
- */
50
- exports.searchWalletPass = searchWalletPass;
51
- const searchWallet = async (request, code) => {
52
- const params = {
53
- code,
54
- with_customer: 1
55
- };
66
+ var searchWallet = async (request, code) => {
67
+ const params = { code, with_customer: 1 };
56
68
  try {
57
- const res = await request?.post('/wallet/detail/search', params);
58
- if (res?.code == 200 && !!res?.data) {
59
- return {
60
- searchType: 'wallet',
61
- response: res
62
- };
69
+ const res = await (request == null ? void 0 : request.post(
70
+ "/wallet/detail/search",
71
+ params
72
+ ));
73
+ if ((res == null ? void 0 : res.code) == 200 && !!(res == null ? void 0 : res.data)) {
74
+ return { searchType: "wallet", response: res };
63
75
  }
64
- throw new Error('没有找到对应的识别码');
76
+ throw new Error("没有找到对应的识别码");
65
77
  } catch (error) {
66
78
  throw error;
67
79
  }
68
80
  };
69
-
70
- /**
71
- * 搜索商品
72
- */
73
- exports.searchWallet = searchWallet;
74
- const searchProduct = async (request, code) => {
81
+ var searchProduct = async (request, code) => {
82
+ var _a, _b;
75
83
  const params = {
76
84
  exact_search: code,
77
85
  open_bundle: 0,
@@ -80,43 +88,47 @@ const searchProduct = async (request, code) => {
80
88
  // 报价单
81
89
  skip: 1,
82
90
  num: 20,
83
- status: 'published',
84
- with: ['variantGroup.variantItem', 'optionGroup.optionItem'],
85
- with_count: ['bundleGroup', 'optionGroup'],
86
- exclude_extension_type: ['product_party', 'product_event', 'product_series_event', 'product_package_ticket', 'ticket', 'event_item']
91
+ status: "published",
92
+ with: ["variantGroup.variantItem", "optionGroup.optionItem"],
93
+ with_count: ["bundleGroup", "optionGroup"],
94
+ exclude_extension_type: [
95
+ "product_party",
96
+ "product_event",
97
+ "product_series_event",
98
+ "product_package_ticket",
99
+ "ticket",
100
+ "event_item"
101
+ ]
87
102
  };
88
103
  try {
89
- const res = await request?.post('/product/query', params);
90
- if (res?.code == 200 && res?.data?.list?.length > 0) {
91
- return {
92
- searchType: 'product',
93
- response: res
94
- };
104
+ const res = await (request == null ? void 0 : request.post("/product/query", params));
105
+ if ((res == null ? void 0 : res.code) == 200 && ((_b = (_a = res == null ? void 0 : res.data) == null ? void 0 : _a.list) == null ? void 0 : _b.length) > 0) {
106
+ return { searchType: "product", response: res };
95
107
  }
96
- throw new Error('没有找到对应的识别码');
108
+ throw new Error("没有找到对应的识别码");
97
109
  } catch (error) {
98
110
  throw error;
99
111
  }
100
112
  };
101
- exports.searchProduct = searchProduct;
102
- const searchOrder = async (request, code) => {
113
+ var searchOrder = async (request, code) => {
103
114
  try {
104
- // 注意 下面这段由于 pisellos: server/index 的特性,可能转发到本地去数据库查询
105
- const res = await request?.get(`/order/sales/${code}`, {
106
- lookup_mode: 'multi'
107
- }, {
108
- customToast: () => {},
109
- osServer: true
110
- });
111
- if (res?.code == 200 && !!res?.data) {
112
- return {
113
- searchType: 'order',
114
- response: res
115
- };
115
+ const res = await (request == null ? void 0 : request.get(`/order/sales/${code}`, {
116
+ lookup_mode: "multi"
117
+ }, { customToast: () => {
118
+ }, osServer: true }));
119
+ console.log("searchOrder>>>>>>>", res);
120
+ if ((res == null ? void 0 : res.code) == 200 && !!(res == null ? void 0 : res.data)) {
121
+ return { searchType: "order", response: res };
116
122
  }
117
- throw new Error('没有找到对应的识别码');
123
+ throw new Error("没有找到对应的识别码");
118
124
  } catch (error) {
119
125
  throw error;
120
126
  }
121
127
  };
122
- exports.searchOrder = searchOrder;
128
+ // Annotate the CommonJS export names for ESM import in node:
129
+ 0 && (module.exports = {
130
+ searchOrder,
131
+ searchProduct,
132
+ searchWallet,
133
+ searchWalletPass
134
+ });
@@ -1,64 +1,51 @@
1
- "use strict";
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);
2
18
 
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
19
+ // src/solution/BookingTicket/utils/scan/formatGlobalScan.ts
20
+ var formatGlobalScan_exports = {};
21
+ __export(formatGlobalScan_exports, {
22
+ formatGlobalScanResult: () => formatGlobalScanResult
5
23
  });
6
- exports.formatGlobalScanResult = formatGlobalScanResult;
7
- /**
8
- * 全局扫码搜索结果格式化(对齐 ticketBooking `formatScanGlobal`)。
9
- */
10
-
11
- /**
12
- * 将 handleGlobalScan 返回的原始结构格式化为 UI/OS 统一结构。
13
- *
14
- * @example
15
- * ```ts
16
- * const formatted = formatGlobalScanResult(
17
- * { searchType: 'wallet', response: { code: 200, data: { customer: {...} } } },
18
- * 'WL123',
19
- * );
20
- * // => { searchType: 'wallet', data: customerObj, scanCode: 'WL123' }
21
- * ```
22
- */
24
+ module.exports = __toCommonJS(formatGlobalScan_exports);
23
25
  function formatGlobalScanResult(raw, scanCode) {
24
- if (!raw?.searchType) return null;
25
- const {
26
- searchType
27
- } = raw;
28
- const {
29
- data: resultData,
30
- code
31
- } = raw.response || {};
32
- if (code !== 200 && searchType !== 'local_product') {
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") {
33
32
  return null;
34
33
  }
35
- if (searchType === 'wallet') {
36
- return {
37
- searchType,
38
- data: resultData?.customer,
39
- scanCode
40
- };
34
+ if (searchType === "wallet") {
35
+ return { searchType, data: resultData == null ? void 0 : resultData.customer, scanCode };
41
36
  }
42
- if (searchType === 'walletPass') {
43
- return {
44
- searchType,
45
- data: resultData?.[0]?.customer,
46
- scanCode
47
- };
37
+ if (searchType === "walletPass") {
38
+ return { searchType, data: (_a = resultData == null ? void 0 : resultData[0]) == null ? void 0 : _a.customer, scanCode };
48
39
  }
49
- if (searchType === 'product' || searchType === 'local_product') {
50
- return {
51
- searchType,
52
- data: resultData,
53
- scanCode
54
- };
40
+ if (searchType === "product" || searchType === "local_product") {
41
+ return { searchType, data: resultData, scanCode };
55
42
  }
56
- if (searchType === 'order') {
57
- return {
58
- searchType,
59
- data: resultData,
60
- scanCode
61
- };
43
+ if (searchType === "order") {
44
+ return { searchType, data: resultData, scanCode };
62
45
  }
63
46
  return null;
64
- }
47
+ }
48
+ // Annotate the CommonJS export names for ESM import in node:
49
+ 0 && (module.exports = {
50
+ formatGlobalScanResult
51
+ });