@pisell/pisellos 0.10.47 → 0.10.49

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 (528) hide show
  1. package/dist/apis/picoding.d.ts +0 -1
  2. package/dist/core/index.d.ts +0 -1
  3. package/dist/core/index.js +6 -10
  4. package/dist/effects/index.d.ts +0 -1
  5. package/dist/index.d.ts +0 -1
  6. package/dist/model/index.d.ts +0 -1
  7. package/dist/model/strategy/adapter/dataVariant/adapter.d.ts +0 -1
  8. package/dist/model/strategy/adapter/dataVariant/evaluator.d.ts +0 -1
  9. package/dist/model/strategy/adapter/dataVariant/examples.d.ts +0 -1
  10. package/dist/model/strategy/adapter/dataVariant/index.d.ts +0 -1
  11. package/dist/model/strategy/adapter/dataVariant/type.d.ts +0 -1
  12. package/dist/model/strategy/adapter/index.d.ts +0 -1
  13. package/dist/model/strategy/adapter/itemRule/adapter.d.ts +0 -1
  14. package/dist/model/strategy/adapter/itemRule/evaluator.d.ts +0 -1
  15. package/dist/model/strategy/adapter/itemRule/examples.d.ts +0 -1
  16. package/dist/model/strategy/adapter/itemRule/index.d.ts +0 -1
  17. package/dist/model/strategy/adapter/itemRule/type.d.ts +0 -1
  18. package/dist/model/strategy/adapter/promotion/adapter.d.ts +0 -1
  19. package/dist/model/strategy/adapter/promotion/evaluator.d.ts +0 -1
  20. package/dist/model/strategy/adapter/promotion/examples.d.ts +0 -1
  21. package/dist/model/strategy/adapter/promotion/index.d.ts +0 -1
  22. package/dist/model/strategy/adapter/promotion/type.d.ts +0 -1
  23. package/dist/model/strategy/adapter/type.d.ts +0 -1
  24. package/dist/model/strategy/adapter/walletPass/evaluator.d.ts +0 -1
  25. package/dist/model/strategy/adapter/walletPass/example.d.ts +0 -1
  26. package/dist/model/strategy/adapter/walletPass/example.js +3 -26
  27. package/dist/model/strategy/adapter/walletPass/index.d.ts +0 -1
  28. package/dist/model/strategy/adapter/walletPass/locales.d.ts +0 -1
  29. package/dist/model/strategy/adapter/walletPass/type.d.ts +0 -1
  30. package/dist/model/strategy/adapter/walletPass/utils.d.ts +0 -1
  31. package/dist/model/strategy/engine.d.ts +0 -1
  32. package/dist/model/strategy/index.d.ts +0 -1
  33. package/dist/model/strategy/strategy-example.d.ts +0 -1
  34. package/dist/model/strategy/strategy-example.js +5 -19
  35. package/dist/model/strategy/type.d.ts +0 -1
  36. package/dist/modules/Account/index.d.ts +0 -1
  37. package/dist/modules/Account/types.d.ts +0 -1
  38. package/dist/modules/AccountList/index.d.ts +0 -1
  39. package/dist/modules/AccountList/types.d.ts +0 -1
  40. package/dist/modules/AccountList/utils.d.ts +0 -1
  41. package/dist/modules/BaseModule.d.ts +0 -1
  42. package/dist/modules/BookingContext/index.d.ts +0 -1
  43. package/dist/modules/BookingContext/types.d.ts +0 -1
  44. package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +0 -1
  45. package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +0 -1
  46. package/dist/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +0 -1
  47. package/dist/modules/BookingContext/utils/flexible.d.ts +0 -1
  48. package/dist/modules/BookingContext/utils/formatResourceList.d.ts +0 -1
  49. package/dist/modules/BookingContext/utils/index.d.ts +0 -1
  50. package/dist/modules/BookingContext/utils/noResource.d.ts +0 -1
  51. package/dist/modules/BookingContext/utils/orderLineDisplay.d.ts +0 -1
  52. package/dist/modules/BookingContext/utils/productExtend.d.ts +0 -1
  53. package/dist/modules/BookingContext/utils/resourceErrors.d.ts +0 -1
  54. package/dist/modules/BookingContext/utils/resourceSelection.d.ts +0 -1
  55. package/dist/modules/BookingContext/utils/resources.d.ts +0 -1
  56. package/dist/modules/BookingContext/utils/serviceTimes.d.ts +0 -1
  57. package/dist/modules/BookingContext/utils/timeSlices.d.ts +0 -1
  58. package/dist/modules/Cart/index.d.ts +0 -1
  59. package/dist/modules/Cart/index.js +0 -3
  60. package/dist/modules/Cart/types.d.ts +0 -1
  61. package/dist/modules/Cart/utils/cartAccount.d.ts +0 -1
  62. package/dist/modules/Cart/utils/cartDate.d.ts +0 -1
  63. package/dist/modules/Cart/utils/cartDiscount.d.ts +0 -1
  64. package/dist/modules/Cart/utils/cartNote.d.ts +0 -1
  65. package/dist/modules/Cart/utils/cartProduct.d.ts +0 -1
  66. package/dist/modules/Cart/utils/cartProduct.js +0 -1
  67. package/dist/modules/Cart/utils/cartRelationForms.d.ts +0 -1
  68. package/dist/modules/Cart/utils/cartResource.d.ts +0 -1
  69. package/dist/modules/Cart/utils/changePrice.d.ts +0 -1
  70. package/dist/modules/Cart/utils/index.d.ts +0 -1
  71. package/dist/modules/Customer/constants.d.ts +0 -1
  72. package/dist/modules/Customer/index.d.ts +0 -1
  73. package/dist/modules/Customer/types.d.ts +0 -1
  74. package/dist/modules/Date/index.d.ts +0 -1
  75. package/dist/modules/Date/index.js +1 -5
  76. package/dist/modules/Date/types.d.ts +0 -1
  77. package/dist/modules/Date/utils.d.ts +0 -1
  78. package/dist/modules/Discount/availability.d.ts +0 -1
  79. package/dist/modules/Discount/entitlementPass.d.ts +0 -1
  80. package/dist/modules/Discount/index.d.ts +0 -1
  81. package/dist/modules/Discount/index.js +2 -4
  82. package/dist/modules/Discount/types.d.ts +2 -1
  83. package/dist/modules/Guests/index.d.ts +0 -1
  84. package/dist/modules/Guests/types.d.ts +0 -1
  85. package/dist/modules/Holder/index.d.ts +0 -1
  86. package/dist/modules/Holder/types.d.ts +0 -1
  87. package/dist/modules/Holder/utils.d.ts +0 -1
  88. package/dist/modules/OpenData/index.d.ts +0 -1
  89. package/dist/modules/OpenData/index.js +0 -2
  90. package/dist/modules/OpenData/types.d.ts +0 -1
  91. package/dist/modules/OpenData/utils.d.ts +0 -1
  92. package/dist/modules/Order/index.d.ts +0 -1
  93. package/dist/modules/Order/index.js +14 -41
  94. package/dist/modules/Order/payment-utils.d.ts +0 -1
  95. package/dist/modules/Order/salesNotes.d.ts +0 -1
  96. package/dist/modules/Order/types.d.ts +0 -1
  97. package/dist/modules/Order/utils/bundleDiscountHydration.d.ts +0 -1
  98. package/dist/modules/Order/utils/discountProductLineIdentity.d.ts +0 -1
  99. package/dist/modules/Order/utils/manualProductDiscount.d.ts +0 -1
  100. package/dist/modules/Order/utils/orderCollectionIdentity.d.ts +0 -1
  101. package/dist/modules/Order/utils/virtualSettlement.d.ts +0 -1
  102. package/dist/modules/Order/utils.d.ts +0 -1
  103. package/dist/modules/Payment/cash.d.ts +0 -1
  104. package/dist/modules/Payment/cashRecommendationAlgorithm.d.ts +0 -1
  105. package/dist/modules/Payment/eftpos.d.ts +0 -1
  106. package/dist/modules/Payment/index.d.ts +0 -1
  107. package/dist/modules/Payment/index.js +97 -162
  108. package/dist/modules/Payment/mx51.d.ts +0 -1
  109. package/dist/modules/Payment/types.d.ts +0 -1
  110. package/dist/modules/Payment/utils.d.ts +0 -1
  111. package/dist/modules/Payment/walletpass.d.ts +0 -1
  112. package/dist/modules/Product/index.d.ts +0 -1
  113. package/dist/modules/Product/types.d.ts +0 -1
  114. package/dist/modules/Product/utils.d.ts +0 -1
  115. package/dist/modules/ProductList/clientDataVariants.d.ts +0 -1
  116. package/dist/modules/ProductList/index.d.ts +0 -1
  117. package/dist/modules/ProductList/types.d.ts +0 -1
  118. package/dist/modules/Quotation/index.d.ts +0 -1
  119. package/dist/modules/Quotation/types.d.ts +0 -1
  120. package/dist/modules/Resource/index.d.ts +0 -1
  121. package/dist/modules/Resource/types.d.ts +0 -1
  122. package/dist/modules/Resource/utils.d.ts +0 -1
  123. package/dist/modules/ResourcePlanner/index.d.ts +0 -1
  124. package/dist/modules/ResourcePlanner/localClock.d.ts +0 -1
  125. package/dist/modules/ResourcePlanner/planner.d.ts +0 -1
  126. package/dist/modules/ResourcePlanner/types.d.ts +0 -1
  127. package/dist/modules/Rules/index.d.ts +0 -1
  128. package/dist/modules/Rules/index.js +60 -7
  129. package/dist/modules/Rules/types.d.ts +0 -1
  130. package/dist/modules/SalesSummary/index.d.ts +0 -1
  131. package/dist/modules/SalesSummary/types.d.ts +0 -1
  132. package/dist/modules/SalesSummary/utils.d.ts +0 -1
  133. package/dist/modules/ScanOrderLogger/index.d.ts +0 -1
  134. package/dist/modules/ScanOrderLogger/providers/feishu.d.ts +0 -1
  135. package/dist/modules/ScanOrderLogger/providers/grafana.d.ts +0 -1
  136. package/dist/modules/ScanOrderLogger/types.d.ts +0 -1
  137. package/dist/modules/Schedule/getDateIsInSchedule.d.ts +0 -1
  138. package/dist/modules/Schedule/index.d.ts +0 -1
  139. package/dist/modules/Schedule/index.js +0 -1
  140. package/dist/modules/Schedule/type.d.ts +0 -1
  141. package/dist/modules/Schedule/types.d.ts +0 -1
  142. package/dist/modules/Schedule/utils.d.ts +0 -1
  143. package/dist/modules/Schedule/utils.js +0 -1
  144. package/dist/modules/Step/index.d.ts +0 -1
  145. package/dist/modules/Step/index.js +0 -1
  146. package/dist/modules/Step/tyeps.d.ts +0 -1
  147. package/dist/modules/Summary/index.d.ts +0 -1
  148. package/dist/modules/Summary/types.d.ts +0 -1
  149. package/dist/modules/Summary/utils.d.ts +0 -1
  150. package/dist/modules/SurchargeList/index.d.ts +0 -1
  151. package/dist/modules/SurchargeList/types.d.ts +0 -1
  152. package/dist/modules/index.d.ts +0 -1
  153. package/dist/plugins/app.d.ts +0 -1
  154. package/dist/plugins/index.d.ts +0 -1
  155. package/dist/plugins/request.d.ts +0 -1
  156. package/dist/plugins/request.js +1 -4
  157. package/dist/plugins/shopStore.d.ts +0 -1
  158. package/dist/plugins/user.d.ts +0 -1
  159. package/dist/plugins/window.d.ts +0 -1
  160. package/dist/plugins/window.js +2 -6
  161. package/dist/server/index.d.ts +0 -1
  162. package/dist/server/index.js +97 -129
  163. package/dist/server/modules/floor-plan/index.d.ts +0 -1
  164. package/dist/server/modules/floor-plan/types.d.ts +0 -1
  165. package/dist/server/modules/index.d.ts +0 -1
  166. package/dist/server/modules/menu/index.d.ts +0 -1
  167. package/dist/server/modules/menu/index.js +32 -41
  168. package/dist/server/modules/menu/types.d.ts +0 -1
  169. package/dist/server/modules/order/index.d.ts +0 -1
  170. package/dist/server/modules/order/index.js +2 -4
  171. package/dist/server/modules/order/types.d.ts +2 -1
  172. package/dist/server/modules/order/utils/filterBookings.d.ts +0 -1
  173. package/dist/server/modules/order/utils/filterOrders.d.ts +0 -1
  174. package/dist/server/modules/payment/index.d.ts +0 -1
  175. package/dist/server/modules/payment/types.d.ts +0 -1
  176. package/dist/server/modules/products/index.d.ts +0 -1
  177. package/dist/server/modules/products/index.js +24 -42
  178. package/dist/server/modules/products/types.d.ts +0 -1
  179. package/dist/server/modules/quotation/index.d.ts +0 -1
  180. package/dist/server/modules/quotation/index.js +29 -38
  181. package/dist/server/modules/quotation/types.d.ts +0 -1
  182. package/dist/server/modules/resource/index.d.ts +0 -1
  183. package/dist/server/modules/resource/index.js +3 -4
  184. package/dist/server/modules/resource/types.d.ts +0 -1
  185. package/dist/server/modules/schedule/index.d.ts +0 -1
  186. package/dist/server/modules/schedule/index.js +27 -35
  187. package/dist/server/modules/schedule/types.d.ts +0 -1
  188. package/dist/server/modules/schedule/utils.d.ts +0 -1
  189. package/dist/server/types.d.ts +0 -1
  190. package/dist/server/utils/index.d.ts +0 -1
  191. package/dist/server/utils/product.d.ts +0 -1
  192. package/dist/server/utils/product.js +0 -1
  193. package/dist/server/utils/schedule.d.ts +0 -1
  194. package/dist/server/utils/small-ticket.d.ts +0 -1
  195. package/dist/server/utils/small-ticket.js +447 -64
  196. package/dist/server/utils/time.d.ts +0 -1
  197. package/dist/solution/BaseSales/index.d.ts +0 -1
  198. package/dist/solution/BaseSales/index.js +50 -53
  199. package/dist/solution/BaseSales/types.d.ts +0 -1
  200. package/dist/solution/BaseSales/utils/cartPromotion.d.ts +0 -1
  201. package/dist/solution/BaseSales/utils/parseSalesResponse.d.ts +0 -1
  202. package/dist/solution/BaseSales/utils/quotationPrice.d.ts +0 -1
  203. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +0 -1
  204. package/dist/solution/BaseSales/utils.d.ts +0 -1
  205. package/dist/solution/BookingByStep/index.d.ts +0 -1
  206. package/dist/solution/BookingByStep/index.js +7 -59
  207. package/dist/solution/BookingByStep/types.d.ts +0 -1
  208. package/dist/solution/BookingByStep/utils/capacity.d.ts +0 -1
  209. package/dist/solution/BookingByStep/utils/capacity.js +1 -11
  210. package/dist/solution/BookingByStep/utils/products.d.ts +0 -1
  211. package/dist/solution/BookingByStep/utils/resources.d.ts +0 -1
  212. package/dist/solution/BookingByStep/utils/resources.js +1 -3
  213. package/dist/solution/BookingByStep/utils/stock.d.ts +0 -1
  214. package/dist/solution/BookingByStep/utils/timeslots.d.ts +0 -1
  215. package/dist/solution/BookingByStep/utils/timeslots.js +2 -43
  216. package/dist/solution/BookingTicket/index.d.ts +0 -1
  217. package/dist/solution/BookingTicket/index.js +0 -2
  218. package/dist/solution/BookingTicket/types.d.ts +0 -1
  219. package/dist/solution/BookingTicket/utils/addProductDecision.d.ts +0 -1
  220. package/dist/solution/BookingTicket/utils/addTimeAvailability.d.ts +0 -1
  221. package/dist/solution/BookingTicket/utils/bookingStatus.d.ts +0 -1
  222. package/dist/solution/BookingTicket/utils/cartView.d.ts +0 -1
  223. package/dist/solution/BookingTicket/utils/exampleData.d.ts +0 -1
  224. package/dist/solution/BookingTicket/utils/orderCustomer.d.ts +0 -1
  225. package/dist/solution/BookingTicket/utils/resolveBestAddTimePlan.d.ts +0 -1
  226. package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +0 -1
  227. package/dist/solution/BookingTicket/utils/scan/cloudSearch.d.ts +0 -1
  228. package/dist/solution/BookingTicket/utils/scan/cloudSearch.js +6 -7
  229. package/dist/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +0 -1
  230. package/dist/solution/BookingTicket/utils/scan/handleScan.d.ts +0 -1
  231. package/dist/solution/BookingTicket/utils/scan/handleScan.js +25 -31
  232. package/dist/solution/BookingTicket/utils/scan/index.d.ts +0 -1
  233. package/dist/solution/BookingTicket/utils/scan/index.js +6 -10
  234. package/dist/solution/BookingTicket/utils/scan/scanCache.d.ts +0 -1
  235. package/dist/solution/BookingTicket/utils/scan/scanProductValues.d.ts +0 -1
  236. package/dist/solution/BookingTicket/utils/sessionCatalogStale.d.ts +0 -1
  237. package/dist/solution/BookingTicket/utils/weighingProductSku.d.ts +0 -1
  238. package/dist/solution/BuyTickets/index.d.ts +0 -1
  239. package/dist/solution/BuyTickets/index.js +9 -12
  240. package/dist/solution/BuyTickets/types.d.ts +0 -1
  241. package/dist/solution/Checkout/index.d.ts +0 -1
  242. package/dist/solution/Checkout/index.js +177 -252
  243. package/dist/solution/Checkout/types.d.ts +0 -1
  244. package/dist/solution/Checkout/utils/index.d.ts +0 -1
  245. package/dist/solution/Checkout/utils/index.js +4 -16
  246. package/dist/solution/PlaceOrder/index.d.ts +0 -1
  247. package/dist/solution/RegisterAndLogin/config.d.ts +0 -1
  248. package/dist/solution/RegisterAndLogin/index.d.ts +0 -1
  249. package/dist/solution/RegisterAndLogin/index.js +30 -76
  250. package/dist/solution/RegisterAndLogin/types.d.ts +0 -1
  251. package/dist/solution/RegisterAndLogin/utils.d.ts +0 -1
  252. package/dist/solution/Sales/index.d.ts +0 -1
  253. package/dist/solution/Sales/types.d.ts +0 -1
  254. package/dist/solution/ScanOrder/index.d.ts +0 -1
  255. package/dist/solution/ScanOrder/index.js +50 -60
  256. package/dist/solution/ScanOrder/types.d.ts +0 -1
  257. package/dist/solution/ScanOrder/utils.d.ts +0 -1
  258. package/dist/solution/ShopDiscount/index.d.ts +0 -1
  259. package/dist/solution/ShopDiscount/index.js +2 -7
  260. package/dist/solution/ShopDiscount/types.d.ts +0 -1
  261. package/dist/solution/ShopDiscount/utils.d.ts +0 -1
  262. package/dist/solution/UnifiedBookingSales/index.d.ts +0 -1
  263. package/dist/solution/UnifiedBookingSales/remoteOccupancyCache.d.ts +0 -1
  264. package/dist/solution/UnifiedBookingSales/types.d.ts +0 -1
  265. package/dist/solution/VenueBooking/index.d.ts +0 -1
  266. package/dist/solution/VenueBooking/index.js +45 -55
  267. package/dist/solution/VenueBooking/types.d.ts +0 -1
  268. package/dist/solution/VenueBooking/utils/dateSummary.d.ts +0 -1
  269. package/dist/solution/VenueBooking/utils/resource.d.ts +0 -1
  270. package/dist/solution/VenueBooking/utils/slotMerge.d.ts +0 -1
  271. package/dist/solution/VenueBooking/utils/timeSlot.d.ts +0 -1
  272. package/dist/solution/VenueBooking/utils.d.ts +0 -1
  273. package/dist/solution/index.d.ts +0 -1
  274. package/dist/store/createStore.d.ts +0 -1
  275. package/dist/types/index.d.ts +0 -1
  276. package/dist/utils/os-private-payload.d.ts +0 -1
  277. package/dist/utils/payment-number.d.ts +0 -1
  278. package/dist/utils/platform.d.ts +0 -1
  279. package/dist/utils/task.d.ts +0 -1
  280. package/dist/utils/task.js +15 -18
  281. package/dist/utils/watch.d.ts +0 -1
  282. package/dist/utils/watch.js +0 -1
  283. package/lib/core/index.js +1 -5
  284. package/lib/model/strategy/strategy-example.js +5 -19
  285. package/lib/modules/Discount/types.d.ts +2 -0
  286. package/lib/modules/Rules/index.js +58 -2
  287. package/lib/server/modules/order/types.d.ts +2 -0
  288. package/lib/server/utils/small-ticket.js +335 -51
  289. package/package.json +1 -1
  290. package/dist/apis/picoding.d.ts.map +0 -1
  291. package/dist/core/index.d.ts.map +0 -1
  292. package/dist/effects/index.d.ts.map +0 -1
  293. package/dist/index.d.ts.map +0 -1
  294. package/dist/model/index.d.ts.map +0 -1
  295. package/dist/model/strategy/adapter/dataVariant/adapter.d.ts.map +0 -1
  296. package/dist/model/strategy/adapter/dataVariant/evaluator.d.ts.map +0 -1
  297. package/dist/model/strategy/adapter/dataVariant/examples.d.ts.map +0 -1
  298. package/dist/model/strategy/adapter/dataVariant/index.d.ts.map +0 -1
  299. package/dist/model/strategy/adapter/dataVariant/type.d.ts.map +0 -1
  300. package/dist/model/strategy/adapter/index.d.ts.map +0 -1
  301. package/dist/model/strategy/adapter/itemRule/adapter.d.ts.map +0 -1
  302. package/dist/model/strategy/adapter/itemRule/evaluator.d.ts.map +0 -1
  303. package/dist/model/strategy/adapter/itemRule/examples.d.ts.map +0 -1
  304. package/dist/model/strategy/adapter/itemRule/index.d.ts.map +0 -1
  305. package/dist/model/strategy/adapter/itemRule/type.d.ts.map +0 -1
  306. package/dist/model/strategy/adapter/promotion/adapter.d.ts.map +0 -1
  307. package/dist/model/strategy/adapter/promotion/evaluator.d.ts.map +0 -1
  308. package/dist/model/strategy/adapter/promotion/examples.d.ts.map +0 -1
  309. package/dist/model/strategy/adapter/promotion/index.d.ts.map +0 -1
  310. package/dist/model/strategy/adapter/promotion/type.d.ts.map +0 -1
  311. package/dist/model/strategy/adapter/type.d.ts.map +0 -1
  312. package/dist/model/strategy/adapter/walletPass/evaluator.d.ts.map +0 -1
  313. package/dist/model/strategy/adapter/walletPass/example.d.ts.map +0 -1
  314. package/dist/model/strategy/adapter/walletPass/index.d.ts.map +0 -1
  315. package/dist/model/strategy/adapter/walletPass/locales.d.ts.map +0 -1
  316. package/dist/model/strategy/adapter/walletPass/type.d.ts.map +0 -1
  317. package/dist/model/strategy/adapter/walletPass/utils.d.ts.map +0 -1
  318. package/dist/model/strategy/engine.d.ts.map +0 -1
  319. package/dist/model/strategy/index.d.ts.map +0 -1
  320. package/dist/model/strategy/strategy-example.d.ts.map +0 -1
  321. package/dist/model/strategy/type.d.ts.map +0 -1
  322. package/dist/modules/Account/index.d.ts.map +0 -1
  323. package/dist/modules/Account/types.d.ts.map +0 -1
  324. package/dist/modules/AccountList/index.d.ts.map +0 -1
  325. package/dist/modules/AccountList/types.d.ts.map +0 -1
  326. package/dist/modules/AccountList/utils.d.ts.map +0 -1
  327. package/dist/modules/BaseModule.d.ts.map +0 -1
  328. package/dist/modules/BookingContext/index.d.ts.map +0 -1
  329. package/dist/modules/BookingContext/types.d.ts.map +0 -1
  330. package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts.map +0 -1
  331. package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts.map +0 -1
  332. package/dist/modules/BookingContext/utils/cacheItemToBookingInput.d.ts.map +0 -1
  333. package/dist/modules/BookingContext/utils/flexible.d.ts.map +0 -1
  334. package/dist/modules/BookingContext/utils/formatResourceList.d.ts.map +0 -1
  335. package/dist/modules/BookingContext/utils/index.d.ts.map +0 -1
  336. package/dist/modules/BookingContext/utils/noResource.d.ts.map +0 -1
  337. package/dist/modules/BookingContext/utils/orderLineDisplay.d.ts.map +0 -1
  338. package/dist/modules/BookingContext/utils/productExtend.d.ts.map +0 -1
  339. package/dist/modules/BookingContext/utils/resourceErrors.d.ts.map +0 -1
  340. package/dist/modules/BookingContext/utils/resourceSelection.d.ts.map +0 -1
  341. package/dist/modules/BookingContext/utils/resources.d.ts.map +0 -1
  342. package/dist/modules/BookingContext/utils/serviceTimes.d.ts.map +0 -1
  343. package/dist/modules/BookingContext/utils/timeSlices.d.ts.map +0 -1
  344. package/dist/modules/Cart/index.d.ts.map +0 -1
  345. package/dist/modules/Cart/types.d.ts.map +0 -1
  346. package/dist/modules/Cart/utils/cartAccount.d.ts.map +0 -1
  347. package/dist/modules/Cart/utils/cartDate.d.ts.map +0 -1
  348. package/dist/modules/Cart/utils/cartDiscount.d.ts.map +0 -1
  349. package/dist/modules/Cart/utils/cartNote.d.ts.map +0 -1
  350. package/dist/modules/Cart/utils/cartProduct.d.ts.map +0 -1
  351. package/dist/modules/Cart/utils/cartRelationForms.d.ts.map +0 -1
  352. package/dist/modules/Cart/utils/cartResource.d.ts.map +0 -1
  353. package/dist/modules/Cart/utils/changePrice.d.ts.map +0 -1
  354. package/dist/modules/Cart/utils/index.d.ts.map +0 -1
  355. package/dist/modules/Customer/constants.d.ts.map +0 -1
  356. package/dist/modules/Customer/index.d.ts.map +0 -1
  357. package/dist/modules/Customer/types.d.ts.map +0 -1
  358. package/dist/modules/Date/index.d.ts.map +0 -1
  359. package/dist/modules/Date/types.d.ts.map +0 -1
  360. package/dist/modules/Date/utils.d.ts.map +0 -1
  361. package/dist/modules/Discount/availability.d.ts.map +0 -1
  362. package/dist/modules/Discount/entitlementPass.d.ts.map +0 -1
  363. package/dist/modules/Discount/index.d.ts.map +0 -1
  364. package/dist/modules/Discount/types.d.ts.map +0 -1
  365. package/dist/modules/Guests/index.d.ts.map +0 -1
  366. package/dist/modules/Guests/types.d.ts.map +0 -1
  367. package/dist/modules/Holder/index.d.ts.map +0 -1
  368. package/dist/modules/Holder/types.d.ts.map +0 -1
  369. package/dist/modules/Holder/utils.d.ts.map +0 -1
  370. package/dist/modules/OpenData/index.d.ts.map +0 -1
  371. package/dist/modules/OpenData/types.d.ts.map +0 -1
  372. package/dist/modules/OpenData/utils.d.ts.map +0 -1
  373. package/dist/modules/Order/index.d.ts.map +0 -1
  374. package/dist/modules/Order/payment-utils.d.ts.map +0 -1
  375. package/dist/modules/Order/salesNotes.d.ts.map +0 -1
  376. package/dist/modules/Order/types.d.ts.map +0 -1
  377. package/dist/modules/Order/utils/bundleDiscountHydration.d.ts.map +0 -1
  378. package/dist/modules/Order/utils/discountProductLineIdentity.d.ts.map +0 -1
  379. package/dist/modules/Order/utils/manualProductDiscount.d.ts.map +0 -1
  380. package/dist/modules/Order/utils/orderCollectionIdentity.d.ts.map +0 -1
  381. package/dist/modules/Order/utils/virtualSettlement.d.ts.map +0 -1
  382. package/dist/modules/Order/utils.d.ts.map +0 -1
  383. package/dist/modules/Payment/cash.d.ts.map +0 -1
  384. package/dist/modules/Payment/cashRecommendationAlgorithm.d.ts.map +0 -1
  385. package/dist/modules/Payment/eftpos.d.ts.map +0 -1
  386. package/dist/modules/Payment/index.d.ts.map +0 -1
  387. package/dist/modules/Payment/mx51.d.ts.map +0 -1
  388. package/dist/modules/Payment/types.d.ts.map +0 -1
  389. package/dist/modules/Payment/utils.d.ts.map +0 -1
  390. package/dist/modules/Payment/walletpass.d.ts.map +0 -1
  391. package/dist/modules/Product/index.d.ts.map +0 -1
  392. package/dist/modules/Product/types.d.ts.map +0 -1
  393. package/dist/modules/Product/utils.d.ts.map +0 -1
  394. package/dist/modules/ProductList/clientDataVariants.d.ts.map +0 -1
  395. package/dist/modules/ProductList/index.d.ts.map +0 -1
  396. package/dist/modules/ProductList/types.d.ts.map +0 -1
  397. package/dist/modules/Quotation/index.d.ts.map +0 -1
  398. package/dist/modules/Quotation/types.d.ts.map +0 -1
  399. package/dist/modules/Resource/index.d.ts.map +0 -1
  400. package/dist/modules/Resource/types.d.ts.map +0 -1
  401. package/dist/modules/Resource/utils.d.ts.map +0 -1
  402. package/dist/modules/ResourcePlanner/index.d.ts.map +0 -1
  403. package/dist/modules/ResourcePlanner/localClock.d.ts.map +0 -1
  404. package/dist/modules/ResourcePlanner/planner.d.ts.map +0 -1
  405. package/dist/modules/ResourcePlanner/types.d.ts.map +0 -1
  406. package/dist/modules/Rules/index.d.ts.map +0 -1
  407. package/dist/modules/Rules/types.d.ts.map +0 -1
  408. package/dist/modules/SalesSummary/index.d.ts.map +0 -1
  409. package/dist/modules/SalesSummary/types.d.ts.map +0 -1
  410. package/dist/modules/SalesSummary/utils.d.ts.map +0 -1
  411. package/dist/modules/ScanOrderLogger/index.d.ts.map +0 -1
  412. package/dist/modules/ScanOrderLogger/providers/feishu.d.ts.map +0 -1
  413. package/dist/modules/ScanOrderLogger/providers/grafana.d.ts.map +0 -1
  414. package/dist/modules/ScanOrderLogger/types.d.ts.map +0 -1
  415. package/dist/modules/Schedule/getDateIsInSchedule.d.ts.map +0 -1
  416. package/dist/modules/Schedule/index.d.ts.map +0 -1
  417. package/dist/modules/Schedule/type.d.ts.map +0 -1
  418. package/dist/modules/Schedule/types.d.ts.map +0 -1
  419. package/dist/modules/Schedule/utils.d.ts.map +0 -1
  420. package/dist/modules/Step/index.d.ts.map +0 -1
  421. package/dist/modules/Step/tyeps.d.ts.map +0 -1
  422. package/dist/modules/Summary/index.d.ts.map +0 -1
  423. package/dist/modules/Summary/types.d.ts.map +0 -1
  424. package/dist/modules/Summary/utils.d.ts.map +0 -1
  425. package/dist/modules/SurchargeList/index.d.ts.map +0 -1
  426. package/dist/modules/SurchargeList/types.d.ts.map +0 -1
  427. package/dist/modules/index.d.ts.map +0 -1
  428. package/dist/plugins/app.d.ts.map +0 -1
  429. package/dist/plugins/index.d.ts.map +0 -1
  430. package/dist/plugins/request.d.ts.map +0 -1
  431. package/dist/plugins/shopStore.d.ts.map +0 -1
  432. package/dist/plugins/user.d.ts.map +0 -1
  433. package/dist/plugins/window.d.ts.map +0 -1
  434. package/dist/server/index.d.ts.map +0 -1
  435. package/dist/server/modules/floor-plan/index.d.ts.map +0 -1
  436. package/dist/server/modules/floor-plan/types.d.ts.map +0 -1
  437. package/dist/server/modules/index.d.ts.map +0 -1
  438. package/dist/server/modules/menu/index.d.ts.map +0 -1
  439. package/dist/server/modules/menu/types.d.ts.map +0 -1
  440. package/dist/server/modules/order/index.d.ts.map +0 -1
  441. package/dist/server/modules/order/types.d.ts.map +0 -1
  442. package/dist/server/modules/order/utils/filterBookings.d.ts.map +0 -1
  443. package/dist/server/modules/order/utils/filterOrders.d.ts.map +0 -1
  444. package/dist/server/modules/payment/index.d.ts.map +0 -1
  445. package/dist/server/modules/payment/types.d.ts.map +0 -1
  446. package/dist/server/modules/products/index.d.ts.map +0 -1
  447. package/dist/server/modules/products/types.d.ts.map +0 -1
  448. package/dist/server/modules/quotation/index.d.ts.map +0 -1
  449. package/dist/server/modules/quotation/types.d.ts.map +0 -1
  450. package/dist/server/modules/resource/index.d.ts.map +0 -1
  451. package/dist/server/modules/resource/types.d.ts.map +0 -1
  452. package/dist/server/modules/schedule/index.d.ts.map +0 -1
  453. package/dist/server/modules/schedule/types.d.ts.map +0 -1
  454. package/dist/server/modules/schedule/utils.d.ts.map +0 -1
  455. package/dist/server/types.d.ts.map +0 -1
  456. package/dist/server/utils/index.d.ts.map +0 -1
  457. package/dist/server/utils/product.d.ts.map +0 -1
  458. package/dist/server/utils/schedule.d.ts.map +0 -1
  459. package/dist/server/utils/small-ticket.d.ts.map +0 -1
  460. package/dist/server/utils/time.d.ts.map +0 -1
  461. package/dist/solution/BaseSales/index.d.ts.map +0 -1
  462. package/dist/solution/BaseSales/types.d.ts.map +0 -1
  463. package/dist/solution/BaseSales/utils/cartPromotion.d.ts.map +0 -1
  464. package/dist/solution/BaseSales/utils/parseSalesResponse.d.ts.map +0 -1
  465. package/dist/solution/BaseSales/utils/quotationPrice.d.ts.map +0 -1
  466. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts.map +0 -1
  467. package/dist/solution/BaseSales/utils.d.ts.map +0 -1
  468. package/dist/solution/BookingByStep/index.d.ts.map +0 -1
  469. package/dist/solution/BookingByStep/types.d.ts.map +0 -1
  470. package/dist/solution/BookingByStep/utils/capacity.d.ts.map +0 -1
  471. package/dist/solution/BookingByStep/utils/products.d.ts.map +0 -1
  472. package/dist/solution/BookingByStep/utils/resources.d.ts.map +0 -1
  473. package/dist/solution/BookingByStep/utils/stock.d.ts.map +0 -1
  474. package/dist/solution/BookingByStep/utils/timeslots.d.ts.map +0 -1
  475. package/dist/solution/BookingTicket/index.d.ts.map +0 -1
  476. package/dist/solution/BookingTicket/types.d.ts.map +0 -1
  477. package/dist/solution/BookingTicket/utils/addProductDecision.d.ts.map +0 -1
  478. package/dist/solution/BookingTicket/utils/addTimeAvailability.d.ts.map +0 -1
  479. package/dist/solution/BookingTicket/utils/bookingStatus.d.ts.map +0 -1
  480. package/dist/solution/BookingTicket/utils/cartView.d.ts.map +0 -1
  481. package/dist/solution/BookingTicket/utils/exampleData.d.ts.map +0 -1
  482. package/dist/solution/BookingTicket/utils/orderCustomer.d.ts.map +0 -1
  483. package/dist/solution/BookingTicket/utils/resolveBestAddTimePlan.d.ts.map +0 -1
  484. package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts.map +0 -1
  485. package/dist/solution/BookingTicket/utils/scan/cloudSearch.d.ts.map +0 -1
  486. package/dist/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts.map +0 -1
  487. package/dist/solution/BookingTicket/utils/scan/handleScan.d.ts.map +0 -1
  488. package/dist/solution/BookingTicket/utils/scan/index.d.ts.map +0 -1
  489. package/dist/solution/BookingTicket/utils/scan/scanCache.d.ts.map +0 -1
  490. package/dist/solution/BookingTicket/utils/scan/scanProductValues.d.ts.map +0 -1
  491. package/dist/solution/BookingTicket/utils/sessionCatalogStale.d.ts.map +0 -1
  492. package/dist/solution/BookingTicket/utils/weighingProductSku.d.ts.map +0 -1
  493. package/dist/solution/BuyTickets/index.d.ts.map +0 -1
  494. package/dist/solution/BuyTickets/types.d.ts.map +0 -1
  495. package/dist/solution/Checkout/index.d.ts.map +0 -1
  496. package/dist/solution/Checkout/types.d.ts.map +0 -1
  497. package/dist/solution/Checkout/utils/index.d.ts.map +0 -1
  498. package/dist/solution/PlaceOrder/index.d.ts.map +0 -1
  499. package/dist/solution/RegisterAndLogin/config.d.ts.map +0 -1
  500. package/dist/solution/RegisterAndLogin/index.d.ts.map +0 -1
  501. package/dist/solution/RegisterAndLogin/types.d.ts.map +0 -1
  502. package/dist/solution/RegisterAndLogin/utils.d.ts.map +0 -1
  503. package/dist/solution/Sales/index.d.ts.map +0 -1
  504. package/dist/solution/Sales/types.d.ts.map +0 -1
  505. package/dist/solution/ScanOrder/index.d.ts.map +0 -1
  506. package/dist/solution/ScanOrder/types.d.ts.map +0 -1
  507. package/dist/solution/ScanOrder/utils.d.ts.map +0 -1
  508. package/dist/solution/ShopDiscount/index.d.ts.map +0 -1
  509. package/dist/solution/ShopDiscount/types.d.ts.map +0 -1
  510. package/dist/solution/ShopDiscount/utils.d.ts.map +0 -1
  511. package/dist/solution/UnifiedBookingSales/index.d.ts.map +0 -1
  512. package/dist/solution/UnifiedBookingSales/remoteOccupancyCache.d.ts.map +0 -1
  513. package/dist/solution/UnifiedBookingSales/types.d.ts.map +0 -1
  514. package/dist/solution/VenueBooking/index.d.ts.map +0 -1
  515. package/dist/solution/VenueBooking/types.d.ts.map +0 -1
  516. package/dist/solution/VenueBooking/utils/dateSummary.d.ts.map +0 -1
  517. package/dist/solution/VenueBooking/utils/resource.d.ts.map +0 -1
  518. package/dist/solution/VenueBooking/utils/slotMerge.d.ts.map +0 -1
  519. package/dist/solution/VenueBooking/utils/timeSlot.d.ts.map +0 -1
  520. package/dist/solution/VenueBooking/utils.d.ts.map +0 -1
  521. package/dist/solution/index.d.ts.map +0 -1
  522. package/dist/store/createStore.d.ts.map +0 -1
  523. package/dist/types/index.d.ts.map +0 -1
  524. package/dist/utils/os-private-payload.d.ts.map +0 -1
  525. package/dist/utils/payment-number.d.ts.map +0 -1
  526. package/dist/utils/platform.d.ts.map +0 -1
  527. package/dist/utils/task.d.ts.map +0 -1
  528. package/dist/utils/watch.d.ts.map +0 -1
@@ -21,15 +21,31 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
21
21
  import dayjs from 'dayjs';
22
22
  import Decimal from 'decimal.js';
23
23
  var DEFAULT_LOCALES = ['en', 'zh_CN'];
24
+ var SERVICE_TYPE_LABEL_KEYS = {
25
+ takeaway: 'takeAway',
26
+ pick_up: 'pickUp',
27
+ table_service: 'tableService',
28
+ delivery: 'delivery',
29
+ room_service: 'roomService',
30
+ dine_in: 'dineIn',
31
+ delivery_by_uber: 'deliveryByUber',
32
+ delivery_by_panda: 'deliveryByPanda',
33
+ delivery_by_merchant: 'deliveryByMerchant'
34
+ };
24
35
  var LABELS = {
25
36
  en: {
26
37
  contactName: 'Contact name',
27
38
  contactMobile: 'Contact Mobile',
28
39
  email: 'email',
29
- dineIn: 'Dine-in',
30
- takeAway: 'Take away',
40
+ dineIn: 'Dine in',
41
+ takeAway: 'Takeaway',
31
42
  delivery: 'Delivery',
32
- pickUp: 'Pick-up',
43
+ pickUp: 'Pickup',
44
+ tableService: 'Table Service',
45
+ roomService: 'Room Service',
46
+ deliveryByUber: 'Uber Eats Delivery',
47
+ deliveryByPanda: 'HungryPanda Delivery',
48
+ deliveryByMerchant: 'Merchant Delivery',
33
49
  shopService: 'Dine-in',
34
50
  pickUpTime: 'Pick-up time',
35
51
  asap: 'ASAP',
@@ -45,6 +61,7 @@ var LABELS = {
45
61
  remainingAmount: 'Remaining amount',
46
62
  redeemPoints: 'Redeem points',
47
63
  remainingPoints: 'Points balance',
64
+ entitlementRemaining: 'Remaining',
48
65
  table: 'Table',
49
66
  bookingId: 'Booking ID',
50
67
  bookingDateTime: 'Date & time',
@@ -68,7 +85,12 @@ var LABELS = {
68
85
  dineIn: '堂食',
69
86
  takeAway: '外带',
70
87
  delivery: '配送',
71
- pickUp: '自提',
88
+ pickUp: '自取',
89
+ tableService: '送餐到桌',
90
+ roomService: '客房服务',
91
+ deliveryByUber: 'Uber 配送',
92
+ deliveryByPanda: '熊猫外卖配送',
93
+ deliveryByMerchant: '商家配送',
72
94
  shopService: '堂食',
73
95
  pickUpTime: '取餐时间',
74
96
  asap: '尽快',
@@ -84,6 +106,7 @@ var LABELS = {
84
106
  remainingAmount: '剩余金额',
85
107
  redeemPoints: '本次使用积分',
86
108
  remainingPoints: '积分余额',
109
+ entitlementRemaining: '剩余次数',
87
110
  table: '桌台',
88
111
  bookingId: '预约编号',
89
112
  bookingDateTime: '日期和时间',
@@ -108,6 +131,11 @@ var LABELS = {
108
131
  takeAway: '外帶',
109
132
  delivery: '配送',
110
133
  pickUp: '自取',
134
+ tableService: '送餐到桌',
135
+ roomService: '客房服務',
136
+ deliveryByUber: 'Uber 配送',
137
+ deliveryByPanda: '熊貓外賣配送',
138
+ deliveryByMerchant: '商家配送',
111
139
  shopService: '堂食',
112
140
  pickUpTime: '取餐時間',
113
141
  asap: '盡快',
@@ -123,6 +151,7 @@ var LABELS = {
123
151
  remainingAmount: '剩餘金額',
124
152
  redeemPoints: '本次使用積分',
125
153
  remainingPoints: '積分餘額',
154
+ entitlementRemaining: '剩餘次數',
126
155
  table: '桌台',
127
156
  bookingId: '預約編號',
128
157
  bookingDateTime: '日期和時間',
@@ -147,6 +176,11 @@ var LABELS = {
147
176
  takeAway: 'テイクアウト',
148
177
  delivery: '配達',
149
178
  pickUp: '受け取り',
179
+ tableService: 'テーブルサービス',
180
+ roomService: 'ルームサービス',
181
+ deliveryByUber: 'Uber Eats 配達',
182
+ deliveryByPanda: 'HungryPanda 配達',
183
+ deliveryByMerchant: '店舗による配達',
150
184
  shopService: '店内飲食',
151
185
  pickUpTime: '受取時間',
152
186
  asap: 'できるだけ早く',
@@ -160,6 +194,7 @@ var LABELS = {
160
194
  remainingAmount: '残高',
161
195
  redeemPoints: '利用ポイント',
162
196
  remainingPoints: 'ポイント残高',
197
+ entitlementRemaining: '残り回数',
163
198
  table: 'テーブル',
164
199
  bookingId: '予約ID',
165
200
  bookingDateTime: '日時',
@@ -185,6 +220,11 @@ var LABELS = {
185
220
  takeAway: 'Para levar',
186
221
  delivery: 'Entrega',
187
222
  pickUp: 'Recolha',
223
+ tableService: 'Serviço à mesa',
224
+ roomService: 'Serviço de quarto',
225
+ deliveryByUber: 'Entrega pela Uber Eats',
226
+ deliveryByPanda: 'Entrega pela HungryPanda',
227
+ deliveryByMerchant: 'Entrega pelo comerciante',
188
228
  shopService: 'Consumo no local',
189
229
  pickUpTime: 'Hora de recolha',
190
230
  asap: 'Assim que possível',
@@ -198,6 +238,7 @@ var LABELS = {
198
238
  remainingAmount: 'Saldo restante',
199
239
  redeemPoints: 'Pontos utilizados',
200
240
  remainingPoints: 'Saldo de pontos',
241
+ entitlementRemaining: 'Utilizações restantes',
201
242
  table: 'Mesa',
202
243
  bookingId: 'ID da reserva',
203
244
  bookingDateTime: 'Data e hora',
@@ -1198,9 +1239,8 @@ function normalizeCustomerDisplayValue(value) {
1198
1239
  }
1199
1240
  function buildDelivery(order, locale) {
1200
1241
  var _order$metadata2, _order$metadata3, _order$metadata4, _order$metadata5, _order$metadata6, _order$metadata7, _order$metadata8, _order$metadata9, _order$metadata10, _order$metadata11, _order$metadata12;
1201
- var deliveryType = stringify(order.delivery_type).trim();
1202
- var serviceType = deliveryType || stringify(firstPresentValue((_order$metadata2 = order.metadata) === null || _order$metadata2 === void 0 ? void 0 : _order$metadata2.service_type, order.service_type)).trim();
1203
- var serviceTypeLabelKey = resolveServiceTypeLabelKey(serviceType, order);
1242
+ var serviceType = stringify((_order$metadata2 = order.metadata) === null || _order$metadata2 === void 0 || (_order$metadata2 = _order$metadata2.shop_service_data) === null || _order$metadata2 === void 0 ? void 0 : _order$metadata2.service_type).trim();
1243
+ var serviceTypeLabelKey = resolveServiceTypeLabelKey(serviceType);
1204
1244
  if (!serviceTypeLabelKey) return [];
1205
1245
  var items = [{
1206
1246
  item: '',
@@ -1505,43 +1545,320 @@ function buildWallets(params) {
1505
1545
  virtualCurrencyUnit: virtualCurrencySnapshot ? getVirtualCurrencySnapshotUnit(virtualCurrencySnapshot, params.locale) : undefined
1506
1546
  });
1507
1547
  });
1508
- var displayedWalletPassIds = collectDisplayedWalletPassIds(displayedWalletPayments);
1509
- return [].concat(_toConsumableArray(paymentWallets), _toConsumableArray(buildVoucherAssets(params)), _toConsumableArray(buildPointCardSnapshotAssets({
1548
+ var displayedWalletAssetIdentities = collectDisplayedWalletAssetIdentities(displayedWalletPayments);
1549
+ var voucherWallets = buildVoucherAssets(_objectSpread(_objectSpread({}, params), {}, {
1550
+ displayedWalletAssetIdentities: displayedWalletAssetIdentities
1551
+ }));
1552
+ var productDiscountWallets = buildProductDiscountAssets(_objectSpread(_objectSpread({}, params), {}, {
1553
+ displayedWalletAssetIdentities: displayedWalletAssetIdentities
1554
+ }));
1555
+ return [].concat(_toConsumableArray(paymentWallets), voucherWallets, productDiscountWallets, _toConsumableArray(buildPointCardSnapshotAssets({
1510
1556
  order: params.order,
1511
1557
  locale: params.locale,
1512
- displayedWalletPassIds: displayedWalletPassIds
1558
+ displayedWalletAssetIdentities: displayedWalletAssetIdentities
1513
1559
  })), _toConsumableArray(buildVirtualCurrencySnapshotAssets({
1514
1560
  snapshots: virtualCurrencySnapshots.items,
1515
1561
  order: params.order,
1516
1562
  locale: params.locale,
1517
- displayedWalletPassIds: displayedWalletPassIds
1563
+ displayedWalletAssetIdentities: displayedWalletAssetIdentities
1518
1564
  })));
1519
1565
  }
1520
- function collectDisplayedWalletPassIds(payments) {
1521
- var ids = new Set();
1566
+ function collectDisplayedWalletAssetIdentities(payments) {
1567
+ var identities = [];
1522
1568
  payments.forEach(function (payment) {
1523
1569
  var fundRecord = getFundRecord(payment);
1524
- [payment.voucher_id, fundRecord === null || fundRecord === void 0 ? void 0 : fundRecord.voucher_id].forEach(function (value) {
1525
- var id = normalizeWalletPassId(value);
1526
- if (id) ids.add(id);
1570
+ var ids = Array.from(new Set([fundRecord === null || fundRecord === void 0 ? void 0 : fundRecord.voucher_id, payment.voucher_id].map(function (value) {
1571
+ return normalizeWalletPassId(value);
1572
+ }).filter(function (value) {
1573
+ return !!value;
1574
+ })));
1575
+ var codes = normalizeWalletAssetCodes(fundRecord === null || fundRecord === void 0 ? void 0 : fundRecord.code, fundRecord === null || fundRecord === void 0 ? void 0 : fundRecord.encoded);
1576
+ if (!ids.length) {
1577
+ registerWalletAssetIdentity(identities, {
1578
+ id: null,
1579
+ codes: codes
1580
+ });
1581
+ return;
1582
+ }
1583
+ ids.forEach(function (id) {
1584
+ registerWalletAssetIdentity(identities, {
1585
+ id: id,
1586
+ codes: codes
1587
+ });
1527
1588
  });
1528
1589
  });
1529
- return ids;
1590
+ return identities;
1591
+ }
1592
+ var PRODUCT_WALLET_DISCOUNT_TYPES = new Set(['good_pass', 'discount_card', 'product_discount_card', 'entitlement_pass']);
1593
+ function buildProductDiscountAssets(params) {
1594
+ var fallbackAssetTime = firstPresentValue(params.order.updated_at, params.order.created_at);
1595
+ return collectProductWalletDiscountAssets(params.order).flatMap(function (asset) {
1596
+ var _getProductWalletDisc;
1597
+ if (!claimWalletAssetIdentity(params.displayedWalletAssetIdentities, {
1598
+ id: asset.id,
1599
+ codes: asset.codes
1600
+ })) return [];
1601
+ var name = getProductWalletDiscountName(asset, params.locale);
1602
+ var assetTime = (_getProductWalletDisc = getProductWalletDiscountTime(asset)) !== null && _getProductWalletDisc !== void 0 ? _getProductWalletDisc : fallbackAssetTime;
1603
+ var timeRow = isPresentId(assetTime) ? {
1604
+ item: formatDateTime(assetTime, params.locale),
1605
+ value: ''
1606
+ } : null;
1607
+ if (asset.type === 'entitlement_pass') {
1608
+ var remaining = getProductEntitlementBalance(asset);
1609
+ return [[{
1610
+ item: name,
1611
+ value: ''
1612
+ }].concat(_toConsumableArray(remaining ? [{
1613
+ item: label(params.locale, 'entitlementRemaining'),
1614
+ value: formatEntitlementUses(remaining, params.locale)
1615
+ }] : []), _toConsumableArray(timeRow ? [timeRow] : []))];
1616
+ }
1617
+ var percent = getProductWalletDiscountPercent(asset);
1618
+ if (percent) {
1619
+ return [[{
1620
+ item: appendPercentToVoucherName(name, percent),
1621
+ value: formatVoucherDiscount(percent, params.locale)
1622
+ }].concat(_toConsumableArray(timeRow ? [timeRow] : []))];
1623
+ }
1624
+ var balance = getProductWalletMoneyBalance(asset);
1625
+ return [[{
1626
+ item: name,
1627
+ value: ''
1628
+ }].concat(_toConsumableArray(balance ? [{
1629
+ item: label(params.locale, 'balance'),
1630
+ value: formatMoney(balance, params.currencySymbol)
1631
+ }] : []), _toConsumableArray(timeRow ? [timeRow] : []))];
1632
+ });
1633
+ }
1634
+ function collectProductWalletDiscountAssets(order) {
1635
+ var assets = [];
1636
+ var assetsById = new Map();
1637
+ normalizeArray(order.products).forEach(function (rawProduct) {
1638
+ if (!rawProduct || _typeof(rawProduct) !== 'object') return;
1639
+ visitProductWalletDiscounts(restoreReceiptDiscountHierarchy(rawProduct), assets, assetsById);
1640
+ });
1641
+ return assets;
1642
+ }
1643
+ function visitProductWalletDiscounts(product, assets, assetsById) {
1644
+ normalizeArray(product.discount_list).forEach(function (record) {
1645
+ if (!record || _typeof(record) !== 'object' || Array.isArray(record)) return;
1646
+ var type = getProductWalletDiscountType(record);
1647
+ if (!type) return;
1648
+ var id = getProductWalletDiscountAssetId(record);
1649
+ if (!id) return;
1650
+ var codes = getProductWalletDiscountCodes(record);
1651
+ var existing = assetsById.get(id);
1652
+ if (existing) {
1653
+ existing.records.push(record);
1654
+ existing.codes = Array.from(new Set([].concat(_toConsumableArray(existing.codes), codes)));
1655
+ return;
1656
+ }
1657
+ var asset = {
1658
+ id: id,
1659
+ type: type,
1660
+ codes: codes,
1661
+ records: [record]
1662
+ };
1663
+ assetsById.set(id, asset);
1664
+ assets.push(asset);
1665
+ });
1666
+ for (var _i6 = 0, _arr2 = ['combinations', 'product_bundle', 'bundle']; _i6 < _arr2.length; _i6++) {
1667
+ var childKey = _arr2[_i6];
1668
+ normalizeArray(product[childKey]).forEach(function (child) {
1669
+ if (!child || _typeof(child) !== 'object' || Array.isArray(child)) return;
1670
+ visitProductWalletDiscounts(child, assets, assetsById);
1671
+ });
1672
+ }
1673
+ }
1674
+ function getProductWalletDiscountType(record) {
1675
+ for (var _i7 = 0, _arr3 = [record.tag, record.type, (_record$discount = record.discount) === null || _record$discount === void 0 ? void 0 : _record$discount.tag, (_record$discount2 = record.discount) === null || _record$discount2 === void 0 ? void 0 : _record$discount2.type]; _i7 < _arr3.length; _i7++) {
1676
+ var _record$discount, _record$discount2;
1677
+ var value = _arr3[_i7];
1678
+ var type = stringify(value).trim().toLowerCase();
1679
+ if (PRODUCT_WALLET_DISCOUNT_TYPES.has(type)) return type;
1680
+ }
1681
+ return null;
1682
+ }
1683
+ function getProductWalletDiscountAssetId(record) {
1684
+ for (var _i8 = 0, _arr4 = [(_record$discount3 = record.discount) === null || _record$discount3 === void 0 ? void 0 : _record$discount3.resource_id, record.resource_id, record.id, record.discount_id]; _i8 < _arr4.length; _i8++) {
1685
+ var _record$discount3;
1686
+ var value = _arr4[_i8];
1687
+ var id = normalizeWalletPassId(value);
1688
+ if (id && id !== '0') return id;
1689
+ }
1690
+ return null;
1691
+ }
1692
+ function getProductWalletDiscountCodes(record) {
1693
+ var _record$discount4, _record$discount5;
1694
+ return normalizeWalletAssetCodes(record.code, record.encoded, (_record$discount4 = record.discount) === null || _record$discount4 === void 0 ? void 0 : _record$discount4.code, (_record$discount5 = record.discount) === null || _record$discount5 === void 0 ? void 0 : _record$discount5.encoded);
1695
+ }
1696
+ function getProductWalletDiscountName(asset, locale) {
1697
+ var _iterator4 = _createForOfIteratorHelper(asset.records),
1698
+ _step4;
1699
+ try {
1700
+ for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
1701
+ var record = _step4.value;
1702
+ for (var _i9 = 0, _arr5 = [(_record$discount6 = record.discount) === null || _record$discount6 === void 0 ? void 0 : _record$discount6.title, (_record$discount7 = record.discount) === null || _record$discount7 === void 0 ? void 0 : _record$discount7.name, (_record$discount8 = record.discount) === null || _record$discount8 === void 0 ? void 0 : _record$discount8.message, record.product_name, record.format_title, record.title, record.name, record.message]; _i9 < _arr5.length; _i9++) {
1703
+ var _record$discount6, _record$discount7, _record$discount8;
1704
+ var value = _arr5[_i9];
1705
+ var name = getLocalizedValue(value, locale).trim();
1706
+ if (name) return name;
1707
+ }
1708
+ }
1709
+ } catch (err) {
1710
+ _iterator4.e(err);
1711
+ } finally {
1712
+ _iterator4.f();
1713
+ }
1714
+ return asset.codes[0] || label(locale, 'giftCard');
1715
+ }
1716
+ function getProductWalletDiscountTime(asset) {
1717
+ for (var _i10 = 0, _arr6 = ['updated_at', 'created_at', 'collection_time']; _i10 < _arr6.length; _i10++) {
1718
+ var field = _arr6[_i10];
1719
+ var _iterator5 = _createForOfIteratorHelper(asset.records),
1720
+ _step5;
1721
+ try {
1722
+ for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
1723
+ var _record$discount9;
1724
+ var record = _step5.value;
1725
+ var value = firstPresentValue(record[field], (_record$discount9 = record.discount) === null || _record$discount9 === void 0 ? void 0 : _record$discount9[field]);
1726
+ if (isPresentId(value)) return value;
1727
+ }
1728
+ } catch (err) {
1729
+ _iterator5.e(err);
1730
+ } finally {
1731
+ _iterator5.f();
1732
+ }
1733
+ }
1734
+ return undefined;
1735
+ }
1736
+ function getProductEntitlementBalance(asset) {
1737
+ var _iterator6 = _createForOfIteratorHelper(asset.records),
1738
+ _step6;
1739
+ try {
1740
+ for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
1741
+ var _record$metadata, _record$discount10, _record$discount11;
1742
+ var record = _step6.value;
1743
+ var balance = getEntitlementBalance((_record$metadata = record.metadata) === null || _record$metadata === void 0 ? void 0 : _record$metadata.balance, record.balance, (_record$discount10 = record.discount) === null || _record$discount10 === void 0 || (_record$discount10 = _record$discount10.metadata) === null || _record$discount10 === void 0 ? void 0 : _record$discount10.balance, (_record$discount11 = record.discount) === null || _record$discount11 === void 0 ? void 0 : _record$discount11.balance);
1744
+ if (balance) return balance;
1745
+ }
1746
+ } catch (err) {
1747
+ _iterator6.e(err);
1748
+ } finally {
1749
+ _iterator6.f();
1750
+ }
1751
+ return null;
1752
+ }
1753
+ function getEntitlementBalance() {
1754
+ for (var _len3 = arguments.length, values = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
1755
+ values[_key3] = arguments[_key3];
1756
+ }
1757
+ for (var _i11 = 0, _values2 = values; _i11 < _values2.length; _i11++) {
1758
+ var value = _values2[_i11];
1759
+ if (!isNumericAmount(value)) continue;
1760
+ var balance = new Decimal(value);
1761
+ if (balance.isFinite() && balance.isInteger() && balance.gte(0)) {
1762
+ return balance;
1763
+ }
1764
+ }
1765
+ return null;
1766
+ }
1767
+ function formatEntitlementUses(value, locale) {
1768
+ var count = value.toFixed(0);
1769
+ switch (normalizeLocaleKey(locale)) {
1770
+ case 'zh_CN':
1771
+ case 'zh_HK':
1772
+ return "".concat(count, "\u6B21");
1773
+ case 'ja':
1774
+ return "".concat(count, "\u56DE");
1775
+ case 'pt':
1776
+ return "".concat(count, " ").concat(value.eq(1) ? 'utilização' : 'utilizações');
1777
+ default:
1778
+ return "".concat(count, " ").concat(value.eq(1) ? 'use' : 'uses');
1779
+ }
1780
+ }
1781
+ function getProductWalletDiscountPercent(asset) {
1782
+ if (asset.type !== 'discount_card' && asset.type !== 'product_discount_card') return null;
1783
+ var _iterator7 = _createForOfIteratorHelper(asset.records),
1784
+ _step7;
1785
+ try {
1786
+ for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
1787
+ var _record$metadata2, _record$discount12, _record$discount13, _record$discount14;
1788
+ var record = _step7.value;
1789
+ var discountType = stringify(firstPresentValue(record.discount_card_type, (_record$metadata2 = record.metadata) === null || _record$metadata2 === void 0 ? void 0 : _record$metadata2.discount_card_type, (_record$discount12 = record.discount) === null || _record$discount12 === void 0 ? void 0 : _record$discount12.discount_card_type, (_record$discount13 = record.discount) === null || _record$discount13 === void 0 || (_record$discount13 = _record$discount13.metadata) === null || _record$discount13 === void 0 ? void 0 : _record$discount13.discount_card_type)).trim().toLowerCase();
1790
+ if (discountType && discountType !== 'percent' && discountType !== 'percentage') continue;
1791
+ var candidates = [record.percent, (_record$discount14 = record.discount) === null || _record$discount14 === void 0 ? void 0 : _record$discount14.percent];
1792
+ if (discountType === 'percent' || discountType === 'percentage') {
1793
+ var _record$discount15;
1794
+ candidates.push(record.par_value, (_record$discount15 = record.discount) === null || _record$discount15 === void 0 ? void 0 : _record$discount15.par_value);
1795
+ }
1796
+ for (var _i12 = 0, _candidates = candidates; _i12 < _candidates.length; _i12++) {
1797
+ var value = _candidates[_i12];
1798
+ if (!isNumericAmount(value)) continue;
1799
+ var percent = new Decimal(value);
1800
+ if (percent.isFinite() && percent.gt(0) && percent.lte(100)) {
1801
+ return percent;
1802
+ }
1803
+ }
1804
+ }
1805
+ } catch (err) {
1806
+ _iterator7.e(err);
1807
+ } finally {
1808
+ _iterator7.f();
1809
+ }
1810
+ return null;
1811
+ }
1812
+ function getProductWalletMoneyBalance(asset) {
1813
+ var _iterator8 = _createForOfIteratorHelper(asset.records),
1814
+ _step8;
1815
+ try {
1816
+ for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
1817
+ var record = _step8.value;
1818
+ for (var _i13 = 0, _arr7 = [(_record$metadata3 = record.metadata) === null || _record$metadata3 === void 0 ? void 0 : _record$metadata3.balance, record.balance, (_record$discount16 = record.discount) === null || _record$discount16 === void 0 || (_record$discount16 = _record$discount16.metadata) === null || _record$discount16 === void 0 ? void 0 : _record$discount16.balance, (_record$discount17 = record.discount) === null || _record$discount17 === void 0 ? void 0 : _record$discount17.balance]; _i13 < _arr7.length; _i13++) {
1819
+ var _record$metadata3, _record$discount16, _record$discount17;
1820
+ var value = _arr7[_i13];
1821
+ if (!isNumericAmount(value)) continue;
1822
+ return Decimal.max(new Decimal(value), 0);
1823
+ }
1824
+ }
1825
+ } catch (err) {
1826
+ _iterator8.e(err);
1827
+ } finally {
1828
+ _iterator8.f();
1829
+ }
1830
+ var _iterator9 = _createForOfIteratorHelper(asset.records),
1831
+ _step9;
1832
+ try {
1833
+ for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
1834
+ var _record$discount18, _record$discount19;
1835
+ var _record = _step9.value;
1836
+ var parValue = firstPresentValue(_record.par_value, (_record$discount18 = _record.discount) === null || _record$discount18 === void 0 ? void 0 : _record$discount18.par_value);
1837
+ var usedParValue = firstPresentValue(_record.used_par_value, (_record$discount19 = _record.discount) === null || _record$discount19 === void 0 ? void 0 : _record$discount19.used_par_value);
1838
+ if (!isNumericAmount(parValue) || !isNumericAmount(usedParValue)) continue;
1839
+ return Decimal.max(new Decimal(parValue).minus(new Decimal(usedParValue)), 0);
1840
+ }
1841
+ } catch (err) {
1842
+ _iterator9.e(err);
1843
+ } finally {
1844
+ _iterator9.f();
1845
+ }
1846
+ return null;
1530
1847
  }
1531
1848
  function buildPointCardSnapshotAssets(params) {
1532
1849
  var _params$order$order_m;
1533
1850
  var snapshots = (_params$order$order_m = params.order.order_meta_list) === null || _params$order$order_m === void 0 ? void 0 : _params$order$order_m.point_cards_snapshot;
1534
1851
  if (!Array.isArray(snapshots)) return [];
1535
1852
  var snapshotTime = firstPresentValue(params.order.updated_at, params.order.created_at);
1536
- var seenSnapshotIds = new Set();
1537
1853
  return snapshots.flatMap(function (snapshot) {
1538
1854
  if (!snapshot || _typeof(snapshot) !== 'object' || Array.isArray(snapshot)) return [];
1539
1855
  var pointCard = snapshot;
1540
1856
  if (stringify(pointCard.tag).trim().toLowerCase() !== 'point_card') return [];
1541
- var id = normalizeWalletPassId(pointCard.id);
1542
- if (!id || seenSnapshotIds.has(id)) return [];
1543
- seenSnapshotIds.add(id);
1544
- if (params.displayedWalletPassIds.has(id)) return [];
1857
+ var assetId = normalizeWalletPassId(pointCard.id);
1858
+ if (!assetId || !claimWalletAssetIdentity(params.displayedWalletAssetIdentities, {
1859
+ id: assetId,
1860
+ codes: []
1861
+ })) return [];
1545
1862
  var rows = [{
1546
1863
  item: stringify(pointCard.product_name).trim() || label(params.locale, 'pointCard'),
1547
1864
  value: ''
@@ -1587,8 +1904,8 @@ function collectVirtualCurrencySnapshots(order) {
1587
1904
  }
1588
1905
  function findVirtualCurrencySnapshotForPayment(payment, snapshotsById) {
1589
1906
  var fundRecord = getFundRecord(payment);
1590
- for (var _i6 = 0, _arr2 = [fundRecord === null || fundRecord === void 0 ? void 0 : fundRecord.voucher_id, payment.voucher_id]; _i6 < _arr2.length; _i6++) {
1591
- var value = _arr2[_i6];
1907
+ for (var _i14 = 0, _arr8 = [fundRecord === null || fundRecord === void 0 ? void 0 : fundRecord.voucher_id, payment.voucher_id]; _i14 < _arr8.length; _i14++) {
1908
+ var value = _arr8[_i14];
1592
1909
  var id = normalizeWalletPassId(value);
1593
1910
  if (!id) continue;
1594
1911
  var snapshot = snapshotsById.get(id);
@@ -1599,8 +1916,11 @@ function findVirtualCurrencySnapshotForPayment(payment, snapshotsById) {
1599
1916
  function buildVirtualCurrencySnapshotAssets(params) {
1600
1917
  var snapshotTime = firstPresentValue(params.order.updated_at, params.order.created_at);
1601
1918
  return params.snapshots.flatMap(function (virtualCurrency) {
1602
- var id = normalizeWalletPassId(virtualCurrency.id);
1603
- if (!id || params.displayedWalletPassIds.has(id)) return [];
1919
+ var assetId = normalizeWalletPassId(virtualCurrency.id);
1920
+ if (!assetId || !claimWalletAssetIdentity(params.displayedWalletAssetIdentities, {
1921
+ id: assetId,
1922
+ codes: []
1923
+ })) return [];
1604
1924
  var rows = [{
1605
1925
  item: stringify(virtualCurrency.product_name).trim(),
1606
1926
  value: ''
@@ -1635,8 +1955,8 @@ function getNonEmptyLocalizedValue(value, locale) {
1635
1955
  if (_typeof(value) !== 'object' || Array.isArray(value)) return stringify(value).trim();
1636
1956
  var dashedLocale = locale.replace('_', '-');
1637
1957
  var underscoredLocale = locale.replace('-', '_');
1638
- for (var _i7 = 0, _arr3 = [value[locale], value[dashedLocale], value[underscoredLocale], value.original, value.auto, value.default, value.en]; _i7 < _arr3.length; _i7++) {
1639
- var candidate = _arr3[_i7];
1958
+ for (var _i15 = 0, _arr9 = [value[locale], value[dashedLocale], value[underscoredLocale], value.original, value.auto, value.default, value.en]; _i15 < _arr9.length; _i15++) {
1959
+ var candidate = _arr9[_i15];
1640
1960
  var text = stringify(candidate).trim();
1641
1961
  if (text) return text;
1642
1962
  }
@@ -1652,6 +1972,66 @@ function normalizeWalletPassId(value) {
1652
1972
  if (typeof value !== 'string') return null;
1653
1973
  return value.trim() || null;
1654
1974
  }
1975
+ function firstNormalizedWalletAssetId() {
1976
+ for (var _len4 = arguments.length, values = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
1977
+ values[_key4] = arguments[_key4];
1978
+ }
1979
+ for (var _i16 = 0, _values3 = values; _i16 < _values3.length; _i16++) {
1980
+ var value = _values3[_i16];
1981
+ var id = normalizeWalletPassId(value);
1982
+ if (id) return id;
1983
+ }
1984
+ return null;
1985
+ }
1986
+ function normalizeWalletAssetCodes() {
1987
+ for (var _len5 = arguments.length, values = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
1988
+ values[_key5] = arguments[_key5];
1989
+ }
1990
+ return Array.from(new Set(values.map(function (value) {
1991
+ return normalizeWalletPassId(value);
1992
+ }).filter(function (value) {
1993
+ return !!value;
1994
+ })));
1995
+ }
1996
+ function registerWalletAssetIdentity(identities, candidate) {
1997
+ if (!candidate.id && !candidate.codes.length) return;
1998
+ var existing = identities.find(function (identity) {
1999
+ return isSameWalletAssetIdentity(identity, candidate);
2000
+ });
2001
+ if (existing) {
2002
+ mergeWalletAssetIdentity(existing, candidate);
2003
+ return;
2004
+ }
2005
+ identities.push({
2006
+ id: candidate.id,
2007
+ codes: _toConsumableArray(candidate.codes)
2008
+ });
2009
+ }
2010
+ function claimWalletAssetIdentity(identities, candidate) {
2011
+ if (!candidate.id && !candidate.codes.length) return true;
2012
+ var existing = identities.find(function (identity) {
2013
+ return isSameWalletAssetIdentity(identity, candidate);
2014
+ });
2015
+ if (existing) {
2016
+ mergeWalletAssetIdentity(existing, candidate);
2017
+ return false;
2018
+ }
2019
+ identities.push({
2020
+ id: candidate.id,
2021
+ codes: _toConsumableArray(candidate.codes)
2022
+ });
2023
+ return true;
2024
+ }
2025
+ function isSameWalletAssetIdentity(left, right) {
2026
+ if (left.id && right.id) return left.id === right.id;
2027
+ return left.codes.some(function (code) {
2028
+ return right.codes.includes(code);
2029
+ });
2030
+ }
2031
+ function mergeWalletAssetIdentity(target, source) {
2032
+ if (!target.id && source.id) target.id = source.id;
2033
+ target.codes = Array.from(new Set([].concat(_toConsumableArray(target.codes), _toConsumableArray(source.codes))));
2034
+ }
1655
2035
  function getPointCardSnapshotRemainingPoints(snapshot) {
1656
2036
  if (!isNumericAmount(snapshot.par_value) || !isNumericAmount(snapshot.used_par_value)) {
1657
2037
  return null;
@@ -1659,19 +2039,27 @@ function getPointCardSnapshotRemainingPoints(snapshot) {
1659
2039
  return Decimal.max(new Decimal(snapshot.par_value).minus(new Decimal(snapshot.used_par_value)), 0);
1660
2040
  }
1661
2041
  function buildVoucherAssets(params) {
1662
- var seenVoucherKeys = new Set();
1663
2042
  var fallbackAssetTime = firstPresentValue(params.order.updated_at, params.order.created_at);
1664
- return normalizeArray(params.order.vouchers).flatMap(function (voucher, index) {
2043
+ return normalizeArray(params.order.vouchers).flatMap(function (voucher) {
1665
2044
  if (!voucher || _typeof(voucher) !== 'object' || Array.isArray(voucher)) return [];
1666
- var voucherKey = getVoucherAssetKey(voucher, index);
1667
- if (seenVoucherKeys.has(voucherKey)) return [];
1668
- seenVoucherKeys.add(voucherKey);
2045
+ if (!claimWalletAssetIdentity(params.displayedWalletAssetIdentities, getVoucherAssetIdentity(voucher))) return [];
1669
2046
  var name = getVoucherAssetName(voucher, params.locale);
1670
2047
  var assetTime = firstPresentValue(voucher.updated_at, voucher.created_at, voucher.collection_time, fallbackAssetTime);
1671
2048
  var timeRow = isPresentId(assetTime) ? {
1672
2049
  item: formatDateTime(assetTime, params.locale),
1673
2050
  value: ''
1674
2051
  } : null;
2052
+ if (isEntitlementVoucher(voucher)) {
2053
+ var _voucher$metadata;
2054
+ var remaining = getEntitlementBalance((_voucher$metadata = voucher.metadata) === null || _voucher$metadata === void 0 ? void 0 : _voucher$metadata.balance, voucher.balance);
2055
+ return [[{
2056
+ item: name,
2057
+ value: ''
2058
+ }].concat(_toConsumableArray(remaining ? [{
2059
+ item: label(params.locale, 'entitlementRemaining'),
2060
+ value: formatEntitlementUses(remaining, params.locale)
2061
+ }] : []), _toConsumableArray(timeRow ? [timeRow] : []))];
2062
+ }
1675
2063
  if (isTicketVoucher(voucher)) {
1676
2064
  var validity = getVoucherValidity(voucher, params.locale);
1677
2065
  return [[{
@@ -1700,19 +2088,24 @@ function buildVoucherAssets(params) {
1700
2088
  });
1701
2089
  }
1702
2090
  var TICKET_VOUCHER_TAGS = new Set(['ticket', 'product_package_ticket', 'appointment_ticket', 'session_ticket']);
2091
+ function isEntitlementVoucher(voucher) {
2092
+ return [voucher.tag, voucher.type].some(function (value) {
2093
+ return stringify(value).trim().toLowerCase() === 'entitlement_pass';
2094
+ });
2095
+ }
1703
2096
  function isTicketVoucher(voucher) {
1704
2097
  return TICKET_VOUCHER_TAGS.has(stringify(voucher.tag).trim().toLowerCase());
1705
2098
  }
1706
2099
  function getVoucherValidity(voucher, locale) {
1707
- var _voucher$metadata, _voucher$metadata2, _voucher$metadata3, _voucher$metadata4, _voucher$metadata5, _voucher$metadata6, _voucher$metadata7, _voucher$metadata8, _voucher$metadata9, _voucher$metadata10, _voucher$start_time, _voucher$metadata11, _voucher$end_time, _voucher$metadata12;
1708
- var availableTime = firstPresentValue(voucher.available_time, voucher.avaliable_time, (_voucher$metadata = voucher.metadata) === null || _voucher$metadata === void 0 ? void 0 : _voucher$metadata.available_time, (_voucher$metadata2 = voucher.metadata) === null || _voucher$metadata2 === void 0 ? void 0 : _voucher$metadata2.avaliable_time);
2100
+ var _voucher$metadata2, _voucher$metadata3, _voucher$metadata4, _voucher$metadata5, _voucher$metadata6, _voucher$metadata7, _voucher$metadata8, _voucher$metadata9, _voucher$metadata10, _voucher$metadata11, _voucher$start_time, _voucher$metadata12, _voucher$end_time, _voucher$metadata13;
2101
+ var availableTime = firstPresentValue(voucher.available_time, voucher.avaliable_time, (_voucher$metadata2 = voucher.metadata) === null || _voucher$metadata2 === void 0 ? void 0 : _voucher$metadata2.available_time, (_voucher$metadata3 = voucher.metadata) === null || _voucher$metadata3 === void 0 ? void 0 : _voucher$metadata3.avaliable_time);
1709
2102
  var availableTimeText = formatVoucherAvailableTime(availableTime, locale);
1710
2103
  if (availableTimeText) return availableTimeText;
1711
- var startDate = firstPresentValue(voucher.valid_from, voucher.start_at, voucher.start_date_time, voucher.start_date, (_voucher$metadata3 = voucher.metadata) === null || _voucher$metadata3 === void 0 ? void 0 : _voucher$metadata3.valid_from, (_voucher$metadata4 = voucher.metadata) === null || _voucher$metadata4 === void 0 ? void 0 : _voucher$metadata4.start_at, (_voucher$metadata5 = voucher.metadata) === null || _voucher$metadata5 === void 0 ? void 0 : _voucher$metadata5.start_date);
1712
- var endDate = firstPresentValue(voucher.valid_to, voucher.end_at, voucher.end_date_time, voucher.expire_date, voucher.end_date, voucher.expire_time, (_voucher$metadata6 = voucher.metadata) === null || _voucher$metadata6 === void 0 ? void 0 : _voucher$metadata6.valid_to, (_voucher$metadata7 = voucher.metadata) === null || _voucher$metadata7 === void 0 ? void 0 : _voucher$metadata7.end_at, (_voucher$metadata8 = voucher.metadata) === null || _voucher$metadata8 === void 0 ? void 0 : _voucher$metadata8.expire_date, (_voucher$metadata9 = voucher.metadata) === null || _voucher$metadata9 === void 0 ? void 0 : _voucher$metadata9.end_date, (_voucher$metadata10 = voucher.metadata) === null || _voucher$metadata10 === void 0 ? void 0 : _voucher$metadata10.expire_time);
2104
+ var startDate = firstPresentValue(voucher.valid_from, voucher.start_at, voucher.start_date_time, voucher.start_date, (_voucher$metadata4 = voucher.metadata) === null || _voucher$metadata4 === void 0 ? void 0 : _voucher$metadata4.valid_from, (_voucher$metadata5 = voucher.metadata) === null || _voucher$metadata5 === void 0 ? void 0 : _voucher$metadata5.start_at, (_voucher$metadata6 = voucher.metadata) === null || _voucher$metadata6 === void 0 ? void 0 : _voucher$metadata6.start_date);
2105
+ var endDate = firstPresentValue(voucher.valid_to, voucher.end_at, voucher.end_date_time, voucher.expire_date, voucher.end_date, voucher.expire_time, (_voucher$metadata7 = voucher.metadata) === null || _voucher$metadata7 === void 0 ? void 0 : _voucher$metadata7.valid_to, (_voucher$metadata8 = voucher.metadata) === null || _voucher$metadata8 === void 0 ? void 0 : _voucher$metadata8.end_at, (_voucher$metadata9 = voucher.metadata) === null || _voucher$metadata9 === void 0 ? void 0 : _voucher$metadata9.expire_date, (_voucher$metadata10 = voucher.metadata) === null || _voucher$metadata10 === void 0 ? void 0 : _voucher$metadata10.end_date, (_voucher$metadata11 = voucher.metadata) === null || _voucher$metadata11 === void 0 ? void 0 : _voucher$metadata11.expire_time);
1713
2106
  return formatVoucherValidityRange(startDate, endDate, locale, {
1714
- startTime: (_voucher$start_time = voucher.start_time) !== null && _voucher$start_time !== void 0 ? _voucher$start_time : (_voucher$metadata11 = voucher.metadata) === null || _voucher$metadata11 === void 0 ? void 0 : _voucher$metadata11.start_time,
1715
- endTime: (_voucher$end_time = voucher.end_time) !== null && _voucher$end_time !== void 0 ? _voucher$end_time : (_voucher$metadata12 = voucher.metadata) === null || _voucher$metadata12 === void 0 ? void 0 : _voucher$metadata12.end_time
2107
+ startTime: (_voucher$start_time = voucher.start_time) !== null && _voucher$start_time !== void 0 ? _voucher$start_time : (_voucher$metadata12 = voucher.metadata) === null || _voucher$metadata12 === void 0 ? void 0 : _voucher$metadata12.start_time,
2108
+ endTime: (_voucher$end_time = voucher.end_time) !== null && _voucher$end_time !== void 0 ? _voucher$end_time : (_voucher$metadata13 = voucher.metadata) === null || _voucher$metadata13 === void 0 ? void 0 : _voucher$metadata13.end_time
1716
2109
  });
1717
2110
  }
1718
2111
  function formatVoucherAvailableTime(value, locale) {
@@ -1778,16 +2171,18 @@ function formatVoucherValidityDate(value, locale) {
1778
2171
  text: time ? "".concat(time, " ").concat(date) : date
1779
2172
  };
1780
2173
  }
1781
- function getVoucherAssetKey(voucher, index) {
1782
- var identity = firstPresentValue(voucher.voucher_id, voucher.id, voucher.code, voucher.encoded);
1783
- return identity === undefined ? "voucher-index:".concat(index) : "voucher:".concat(String(identity));
2174
+ function getVoucherAssetIdentity(voucher) {
2175
+ return {
2176
+ id: firstNormalizedWalletAssetId(voucher.voucher_id, voucher.id),
2177
+ codes: normalizeWalletAssetCodes(voucher.code, voucher.encoded)
2178
+ };
1784
2179
  }
1785
2180
  function getVoucherAssetName(voucher, locale) {
1786
2181
  return getLocalizedValue(voucher.product_name || voucher.name || voucher.title, locale) || stringify(voucher.encoded || voucher.code || label(locale, 'giftCard'));
1787
2182
  }
1788
2183
  function getVoucherDiscountPercent(voucher) {
1789
- var _voucher$metadata13;
1790
- var discountType = stringify(((_voucher$metadata13 = voucher.metadata) === null || _voucher$metadata13 === void 0 ? void 0 : _voucher$metadata13.discount_card_type) || voucher.discount_card_type).toLowerCase();
2184
+ var _voucher$metadata14;
2185
+ var discountType = stringify(((_voucher$metadata14 = voucher.metadata) === null || _voucher$metadata14 === void 0 ? void 0 : _voucher$metadata14.discount_card_type) || voucher.discount_card_type).toLowerCase();
1791
2186
  if (discountType !== 'percent' && discountType !== 'percentage') return null;
1792
2187
  var percent = new Decimal(toMoneyNumber(voucher.par_value));
1793
2188
  if (!percent.isFinite() || percent.lte(0) || percent.gt(100)) return null;
@@ -1807,6 +2202,12 @@ function formatVoucherDiscount(percent, locale) {
1807
2202
  return normalizedLocale === 'en' ? "Discount ".concat(trimDecimal(percent), "% OFF") : "".concat(trimDecimal(percent), "% OFF");
1808
2203
  }
1809
2204
  function getVoucherBalance(voucher) {
2205
+ for (var _i17 = 0, _arr10 = [(_voucher$metadata15 = voucher.metadata) === null || _voucher$metadata15 === void 0 ? void 0 : _voucher$metadata15.balance, voucher.balance]; _i17 < _arr10.length; _i17++) {
2206
+ var _voucher$metadata15;
2207
+ var value = _arr10[_i17];
2208
+ if (!isNumericAmount(value)) continue;
2209
+ return Decimal.max(new Decimal(value), 0);
2210
+ }
1810
2211
  var parValue = new Decimal(toMoneyNumber(voucher.par_value));
1811
2212
  var usedParValue = new Decimal(toMoneyNumber(voucher.used_par_value));
1812
2213
  return Decimal.max(parValue.minus(usedParValue), 0);
@@ -2018,26 +2419,8 @@ function getLocalizedValue(value, locale) {
2018
2419
  var underscoredLocale = locale.replace('-', '_');
2019
2420
  return stringify((_ref60 = (_ref61 = (_ref62 = (_ref63 = (_ref64 = (_ref65 = (_value$locale2 = value[locale]) !== null && _value$locale2 !== void 0 ? _value$locale2 : value[dashedLocale]) !== null && _ref65 !== void 0 ? _ref65 : value[underscoredLocale]) !== null && _ref64 !== void 0 ? _ref64 : value.original) !== null && _ref63 !== void 0 ? _ref63 : value.auto) !== null && _ref62 !== void 0 ? _ref62 : value.default) !== null && _ref61 !== void 0 ? _ref61 : value.en) !== null && _ref60 !== void 0 ? _ref60 : '');
2020
2421
  }
2021
- function resolveServiceTypeLabelKey(serviceType, order) {
2022
- var normalized = serviceType.trim().toLowerCase().replace(/[\s-]+/g, '_');
2023
- if (['', 'nil', 'none', 'unknown'].includes(normalized)) return null;
2024
- if (['pickup', 'pick_up', 'self_pickup'].includes(normalized)) return 'pickUp';
2025
- if (['delivery', 'shipping', 'local_delivery'].includes(normalized)) return 'delivery';
2026
- if (['takeaway', 'take_away'].includes(normalized)) return 'takeAway';
2027
- if (['dine_in', 'dinein'].includes(normalized)) return 'dineIn';
2028
- if (['shop_service', 'shop_server'].includes(normalized)) {
2029
- return resolveShopServiceLabelKey(order);
2030
- }
2031
- return null;
2032
- }
2033
- function resolveShopServiceLabelKey(order) {
2034
- var _order$metadata15, _order$shop_service_t;
2035
- var rawShopServiceType = firstPresentValue((_order$metadata15 = order.metadata) === null || _order$metadata15 === void 0 || (_order$metadata15 = _order$metadata15.shop_service_type) === null || _order$metadata15 === void 0 ? void 0 : _order$metadata15.server_type, (_order$shop_service_t = order.shop_service_type) === null || _order$shop_service_t === void 0 ? void 0 : _order$shop_service_t.server_type, typeof order.shop_service_type === 'string' ? order.shop_service_type : undefined);
2036
- if (!isPresentId(rawShopServiceType)) return 'dineIn';
2037
- var normalized = stringify(rawShopServiceType).trim().toLowerCase().replace(/[\s-]+/g, '_');
2038
- if (['takeaway', 'take_away'].includes(normalized)) return 'takeAway';
2039
- if (['dine_in', 'dinein'].includes(normalized)) return 'dineIn';
2040
- return null;
2422
+ function resolveServiceTypeLabelKey(serviceType) {
2423
+ return SERVICE_TYPE_LABEL_KEYS[serviceType] || null;
2041
2424
  }
2042
2425
  function normalizeBooleanFlag(value) {
2043
2426
  if (value === true || value === 1 || stringify(value).trim() === '1') return 1;