@pisell/pisellos 0.10.74 → 0.10.76

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 (201) hide show
  1. package/dist/modules/Product/index.d.ts +1 -1
  2. package/dist/server/index.js +14 -9
  3. package/dist/shared/receipt/small-ticket.d.ts +3 -0
  4. package/dist/shared/receipt/small-ticket.js +23 -2
  5. package/dist/solution/BookingByStep/index.d.ts +2 -2
  6. package/dist/solution/BookingTicket/index.d.ts +13 -1
  7. package/dist/solution/OrderInvoicePreview/index.js +13 -8
  8. package/dist/solution/UnifiedBookingSales/catalogQueryBatch.d.ts +21 -0
  9. package/dist/solution/UnifiedBookingSales/catalogQueryBatch.js +202 -0
  10. package/dist/solution/UnifiedBookingSales/index.d.ts +8 -1
  11. package/dist/solution/UnifiedBookingSales/index.js +680 -557
  12. package/dist/solution/UnifiedBookingSales/types.d.ts +9 -0
  13. package/dist/solution/UnifiedBookingSales/types.js +2 -0
  14. package/lib/modules/Product/index.d.ts +1 -1
  15. package/lib/server/index.js +5 -0
  16. package/lib/shared/receipt/small-ticket.d.ts +3 -0
  17. package/lib/shared/receipt/small-ticket.js +21 -0
  18. package/lib/solution/BookingByStep/index.d.ts +2 -2
  19. package/lib/solution/BookingTicket/index.d.ts +13 -1
  20. package/lib/solution/OrderInvoicePreview/index.js +6 -1
  21. package/lib/solution/UnifiedBookingSales/catalogQueryBatch.d.ts +21 -0
  22. package/lib/solution/UnifiedBookingSales/catalogQueryBatch.js +109 -0
  23. package/lib/solution/UnifiedBookingSales/index.d.ts +8 -1
  24. package/lib/solution/UnifiedBookingSales/index.js +96 -1
  25. package/lib/solution/UnifiedBookingSales/types.d.ts +9 -0
  26. package/lib/solution/UnifiedBookingSales/types.js +1 -0
  27. package/package.json +1 -1
  28. package/dist/apis/picoding.d.ts +0 -0
  29. package/dist/effects/index.d.ts +0 -19
  30. package/dist/model/strategy/adapter/dataVariant/adapter.d.ts +0 -50
  31. package/dist/model/strategy/adapter/dataVariant/evaluator.d.ts +0 -105
  32. package/dist/model/strategy/adapter/dataVariant/examples.d.ts +0 -39
  33. package/dist/model/strategy/adapter/dataVariant/index.d.ts +0 -4
  34. package/dist/model/strategy/adapter/dataVariant/type.d.ts +0 -173
  35. package/dist/model/strategy/adapter/promotion/adapter.d.ts +0 -70
  36. package/dist/model/strategy/adapter/promotion/examples.d.ts +0 -224
  37. package/dist/model/strategy/adapter/promotion/type.d.ts +0 -535
  38. package/dist/model/strategy/adapter/type.d.ts +0 -28
  39. package/dist/model/strategy/adapter/walletPass/index.d.ts +0 -32
  40. package/dist/model/strategy/adapter/walletPass/locales.d.ts +0 -1
  41. package/dist/model/strategy/adapter/walletPass/type.d.ts +0 -192
  42. package/dist/model/strategy/adapter/walletPass/utils.d.ts +0 -50
  43. package/dist/model/strategy/engine.d.ts +0 -119
  44. package/dist/model/strategy/type.d.ts +0 -245
  45. package/dist/modules/Account/types.d.ts +0 -56
  46. package/dist/modules/BookingContext/types.d.ts +0 -104
  47. package/dist/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +0 -76
  48. package/dist/modules/BookingContext/utils/flexible.d.ts +0 -28
  49. package/dist/modules/BookingContext/utils/formatResourceList.d.ts +0 -8
  50. package/dist/modules/BookingContext/utils/noResource.d.ts +0 -13
  51. package/dist/modules/BookingContext/utils/orderLineDisplay.d.ts +0 -1
  52. package/dist/modules/BookingContext/utils/resourceErrors.d.ts +0 -41
  53. package/dist/modules/BookingContext/utils/resourceSelection.d.ts +0 -7
  54. package/dist/modules/BookingContext/utils/serviceTimes.d.ts +0 -55
  55. package/dist/modules/BookingContext/utils/timeSlices.d.ts +0 -42
  56. package/dist/modules/Customer/constants.d.ts +0 -7
  57. package/dist/modules/Date/types.d.ts +0 -84
  58. package/dist/modules/Date/utils.d.ts +0 -36
  59. package/dist/modules/FulfillmentTiming/index.d.ts +0 -11
  60. package/dist/modules/FulfillmentTiming/types.d.ts +0 -67
  61. package/dist/modules/Order/payment-utils.d.ts +0 -26
  62. package/dist/modules/Order/pickupTiming.d.ts +0 -46
  63. package/dist/modules/Order/utils/manualProductDiscount.d.ts +0 -106
  64. package/dist/modules/Order/utils/orderCollectionIdentity.d.ts +0 -68
  65. package/dist/modules/Order/utils/weighedProduct.d.ts +0 -12
  66. package/dist/modules/Payment/cashRecommendationAlgorithm.d.ts +0 -21
  67. package/dist/modules/Payment/mx51.d.ts +0 -0
  68. package/dist/modules/Payment/types.d.ts +0 -943
  69. package/dist/modules/Payment/utils.d.ts +0 -19
  70. package/dist/modules/Quotation/types.d.ts +0 -61
  71. package/dist/modules/Resource/types.d.ts +0 -50
  72. package/dist/modules/Resource/utils.d.ts +0 -23
  73. package/dist/modules/ResourcePlanner/localClock.d.ts +0 -33
  74. package/dist/modules/SalesSummary/types.d.ts +0 -69
  75. package/dist/modules/ScanOrderLogger/providers/feishu.d.ts +0 -2
  76. package/dist/modules/ScanOrderLogger/providers/grafana.d.ts +0 -2
  77. package/dist/modules/ScanOrderLogger/types.d.ts +0 -53
  78. package/dist/modules/Schedule/getDateIsInSchedule.d.ts +0 -32
  79. package/dist/modules/Schedule/type.d.ts +0 -157
  80. package/dist/modules/Schedule/types.d.ts +0 -201
  81. package/dist/modules/Schedule/utils.d.ts +0 -67
  82. package/dist/modules/Step/tyeps.d.ts +0 -20
  83. package/dist/modules/SurchargeList/types.d.ts +0 -15
  84. package/dist/plugins/app.d.ts +0 -10
  85. package/dist/plugins/shopStore.d.ts +0 -4
  86. package/dist/plugins/user.d.ts +0 -7
  87. package/dist/server/modules/floor-plan/types.d.ts +0 -43
  88. package/dist/server/modules/menu/types.d.ts +0 -68
  89. package/dist/server/modules/payment/types.d.ts +0 -9
  90. package/dist/server/modules/quotation/types.d.ts +0 -50
  91. package/dist/server/modules/resource/types.d.ts +0 -121
  92. package/dist/server/modules/schedule/types.d.ts +0 -1
  93. package/dist/server/modules/schedule/utils.d.ts +0 -32
  94. package/dist/server/types.d.ts +0 -66
  95. package/dist/server/utils/index.d.ts +0 -5
  96. package/dist/server/utils/schedule.d.ts +0 -14
  97. package/dist/server/utils/time.d.ts +0 -18
  98. package/dist/solution/BookingTicket/utils/bookingStatus.d.ts +0 -77
  99. package/dist/solution/BookingTicket/utils/exampleData.d.ts +0 -123
  100. package/dist/solution/BookingTicket/utils/resolveBestAddTimePlan.d.ts +0 -185
  101. package/dist/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +0 -38
  102. package/dist/solution/BookingTicket/utils/scan/scanCache.d.ts +0 -78
  103. package/dist/solution/BookingTicket/utils/scan/scanProductValues.d.ts +0 -21
  104. package/dist/solution/BookingTicket/utils/weighingProductSku.d.ts +0 -5
  105. package/dist/solution/PlaceOrder/index.d.ts +0 -0
  106. package/dist/solution/RegisterAndLogin/config.d.ts +0 -93
  107. package/dist/solution/RegisterAndLogin/types.d.ts +0 -445
  108. package/dist/solution/RegisterAndLogin/utils.d.ts +0 -103
  109. package/dist/store/createStore.d.ts +0 -3
  110. package/dist/types/index.d.ts +0 -132
  111. package/dist/utils/os-private-payload.d.ts +0 -5
  112. package/dist/utils/payment-number.d.ts +0 -9
  113. package/dist/utils/task.d.ts +0 -40
  114. package/dist/utils/watch.d.ts +0 -102
  115. package/lib/apis/picoding.d.ts +0 -0
  116. package/lib/effects/index.d.ts +0 -19
  117. package/lib/model/strategy/adapter/dataVariant/adapter.d.ts +0 -50
  118. package/lib/model/strategy/adapter/dataVariant/evaluator.d.ts +0 -105
  119. package/lib/model/strategy/adapter/dataVariant/examples.d.ts +0 -39
  120. package/lib/model/strategy/adapter/dataVariant/index.d.ts +0 -4
  121. package/lib/model/strategy/adapter/dataVariant/type.d.ts +0 -173
  122. package/lib/model/strategy/adapter/promotion/adapter.d.ts +0 -70
  123. package/lib/model/strategy/adapter/promotion/examples.d.ts +0 -224
  124. package/lib/model/strategy/adapter/promotion/type.d.ts +0 -535
  125. package/lib/model/strategy/adapter/type.d.ts +0 -28
  126. package/lib/model/strategy/adapter/walletPass/index.d.ts +0 -32
  127. package/lib/model/strategy/adapter/walletPass/locales.d.ts +0 -1
  128. package/lib/model/strategy/adapter/walletPass/type.d.ts +0 -192
  129. package/lib/model/strategy/adapter/walletPass/utils.d.ts +0 -50
  130. package/lib/model/strategy/engine.d.ts +0 -119
  131. package/lib/model/strategy/type.d.ts +0 -245
  132. package/lib/modules/Account/types.d.ts +0 -56
  133. package/lib/modules/BookingContext/types.d.ts +0 -104
  134. package/lib/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +0 -76
  135. package/lib/modules/BookingContext/utils/flexible.d.ts +0 -28
  136. package/lib/modules/BookingContext/utils/formatResourceList.d.ts +0 -8
  137. package/lib/modules/BookingContext/utils/noResource.d.ts +0 -13
  138. package/lib/modules/BookingContext/utils/orderLineDisplay.d.ts +0 -1
  139. package/lib/modules/BookingContext/utils/resourceErrors.d.ts +0 -41
  140. package/lib/modules/BookingContext/utils/resourceSelection.d.ts +0 -7
  141. package/lib/modules/BookingContext/utils/serviceTimes.d.ts +0 -55
  142. package/lib/modules/BookingContext/utils/timeSlices.d.ts +0 -42
  143. package/lib/modules/Customer/constants.d.ts +0 -7
  144. package/lib/modules/Date/types.d.ts +0 -84
  145. package/lib/modules/Date/utils.d.ts +0 -36
  146. package/lib/modules/FulfillmentTiming/index.d.ts +0 -11
  147. package/lib/modules/FulfillmentTiming/types.d.ts +0 -67
  148. package/lib/modules/Order/payment-utils.d.ts +0 -26
  149. package/lib/modules/Order/pickupTiming.d.ts +0 -46
  150. package/lib/modules/Order/utils/manualProductDiscount.d.ts +0 -106
  151. package/lib/modules/Order/utils/orderCollectionIdentity.d.ts +0 -68
  152. package/lib/modules/Order/utils/weighedProduct.d.ts +0 -12
  153. package/lib/modules/Payment/cashRecommendationAlgorithm.d.ts +0 -21
  154. package/lib/modules/Payment/mx51.d.ts +0 -0
  155. package/lib/modules/Payment/types.d.ts +0 -943
  156. package/lib/modules/Payment/utils.d.ts +0 -19
  157. package/lib/modules/Quotation/types.d.ts +0 -61
  158. package/lib/modules/Resource/types.d.ts +0 -50
  159. package/lib/modules/Resource/utils.d.ts +0 -23
  160. package/lib/modules/ResourcePlanner/localClock.d.ts +0 -33
  161. package/lib/modules/SalesSummary/types.d.ts +0 -69
  162. package/lib/modules/ScanOrderLogger/providers/feishu.d.ts +0 -2
  163. package/lib/modules/ScanOrderLogger/providers/grafana.d.ts +0 -2
  164. package/lib/modules/ScanOrderLogger/types.d.ts +0 -53
  165. package/lib/modules/Schedule/getDateIsInSchedule.d.ts +0 -32
  166. package/lib/modules/Schedule/type.d.ts +0 -157
  167. package/lib/modules/Schedule/types.d.ts +0 -201
  168. package/lib/modules/Schedule/utils.d.ts +0 -67
  169. package/lib/modules/Step/tyeps.d.ts +0 -20
  170. package/lib/modules/SurchargeList/types.d.ts +0 -15
  171. package/lib/plugins/app.d.ts +0 -10
  172. package/lib/plugins/shopStore.d.ts +0 -4
  173. package/lib/plugins/user.d.ts +0 -7
  174. package/lib/server/modules/floor-plan/types.d.ts +0 -43
  175. package/lib/server/modules/menu/types.d.ts +0 -68
  176. package/lib/server/modules/payment/types.d.ts +0 -9
  177. package/lib/server/modules/quotation/types.d.ts +0 -50
  178. package/lib/server/modules/resource/types.d.ts +0 -121
  179. package/lib/server/modules/schedule/types.d.ts +0 -1
  180. package/lib/server/modules/schedule/utils.d.ts +0 -32
  181. package/lib/server/types.d.ts +0 -66
  182. package/lib/server/utils/index.d.ts +0 -5
  183. package/lib/server/utils/schedule.d.ts +0 -14
  184. package/lib/server/utils/time.d.ts +0 -18
  185. package/lib/solution/BookingTicket/utils/bookingStatus.d.ts +0 -77
  186. package/lib/solution/BookingTicket/utils/exampleData.d.ts +0 -123
  187. package/lib/solution/BookingTicket/utils/resolveBestAddTimePlan.d.ts +0 -185
  188. package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +0 -38
  189. package/lib/solution/BookingTicket/utils/scan/scanCache.d.ts +0 -78
  190. package/lib/solution/BookingTicket/utils/scan/scanProductValues.d.ts +0 -21
  191. package/lib/solution/BookingTicket/utils/weighingProductSku.d.ts +0 -5
  192. package/lib/solution/PlaceOrder/index.d.ts +0 -0
  193. package/lib/solution/RegisterAndLogin/config.d.ts +0 -93
  194. package/lib/solution/RegisterAndLogin/types.d.ts +0 -445
  195. package/lib/solution/RegisterAndLogin/utils.d.ts +0 -103
  196. package/lib/store/createStore.d.ts +0 -3
  197. package/lib/types/index.d.ts +0 -132
  198. package/lib/utils/os-private-payload.d.ts +0 -5
  199. package/lib/utils/payment-number.d.ts +0 -9
  200. package/lib/utils/task.d.ts +0 -40
  201. package/lib/utils/watch.d.ts +0 -102
@@ -49,5 +49,5 @@ export declare class Product extends BaseModule implements Module {
49
49
  getCategories(): ProductCategory[];
50
50
  setOtherParams(key: string, value: any): void;
51
51
  getOtherParams(): any;
52
- getProductType(): "duration" | "session" | "normal";
52
+ getProductType(): "normal" | "duration" | "session";
53
53
  }
@@ -5502,9 +5502,14 @@ var Server = /*#__PURE__*/function () {
5502
5502
  }, {
5503
5503
  key: "getSmallTicketShopInfo",
5504
5504
  value: function getSmallTicketShopInfo() {
5505
- var _shopInfo$is_price_in;
5505
+ var _this$app15, _this$app15$getStore, _this$app15$getStore$, _this$app15$getStore$2, _this$app16, _this$app16$getStore, _this$app16$getStore$, _this$app16$getStore$2, _shopInfo$is_price_in;
5506
5506
  var shopInfo = this.getAppData('shop_info') || {};
5507
+ // WebPOS getData does not expose core/default_domain; read the business
5508
+ // shop model directly when the expanded shop_info has not loaded it yet.
5509
+ var shopCore = ((_this$app15 = this.app) === null || _this$app15 === void 0 || (_this$app15 = _this$app15.models) === null || _this$app15 === void 0 || (_this$app15$getStore = _this$app15.getStore) === null || _this$app15$getStore === void 0 || (_this$app15$getStore$ = (_this$app15$getStore$2 = _this$app15$getStore.call(_this$app15)).getDataByModel) === null || _this$app15$getStore$ === void 0 ? void 0 : _this$app15$getStore$.call(_this$app15$getStore$2, 'core', 'core')) || ((_this$app16 = this.app) === null || _this$app16 === void 0 || (_this$app16 = _this$app16.data) === null || _this$app16 === void 0 || (_this$app16 = _this$app16.store) === null || _this$app16 === void 0 || (_this$app16$getStore = _this$app16.getStore) === null || _this$app16$getStore === void 0 || (_this$app16$getStore$ = (_this$app16$getStore$2 = _this$app16$getStore.call(_this$app16)).getDataByModel) === null || _this$app16$getStore$ === void 0 ? void 0 : _this$app16$getStore$.call(_this$app16$getStore$2, 'core', 'core')) || {};
5507
5510
  return _objectSpread(_objectSpread({}, shopInfo), {}, {
5511
+ default_domain: shopInfo.default_domain || shopCore.default_domain,
5512
+ private_domain_protocol: shopInfo.private_domain_protocol || shopCore.private_domain_protocol,
5508
5513
  currency_symbol: shopInfo.currency_symbol || this.getAppData('shop_symbol') || this.getAppData('currency_symbol'),
5509
5514
  currency_code: shopInfo.currency_code || this.getAppData('shop_currency_code') || this.getAppData('currency_code'),
5510
5515
  tax_title: shopInfo.tax_title || this.getAppData('tax_title'),
@@ -6514,13 +6519,13 @@ var Server = /*#__PURE__*/function () {
6514
6519
  key: "handleSyncCheckoutSubmit",
6515
6520
  value: function () {
6516
6521
  var _handleSyncCheckoutSubmit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee63(params) {
6517
- var _this$app15;
6522
+ var _this$app17;
6518
6523
  var backendPath, data, title, invoiceLayoutConfig, invoiceTemplateSettings, syncResult, _normalized$data, normalized, response, syncedOrder, backendError, _normalized$data2, _normalized, message;
6519
6524
  return _regeneratorRuntime().wrap(function _callee63$(_context63) {
6520
6525
  while (1) switch (_context63.prev = _context63.next) {
6521
6526
  case 0:
6522
6527
  backendPath = params.backendPath, data = params.data, title = params.title, invoiceLayoutConfig = params.invoiceLayoutConfig, invoiceTemplateSettings = params.invoiceTemplateSettings;
6523
- if ((_this$app15 = this.app) !== null && _this$app15 !== void 0 && (_this$app15 = _this$app15.request) !== null && _this$app15 !== void 0 && _this$app15.post) {
6528
+ if ((_this$app17 = this.app) !== null && _this$app17 !== void 0 && (_this$app17 = _this$app17.request) !== null && _this$app17 !== void 0 && _this$app17.post) {
6524
6529
  _context63.next = 4;
6525
6530
  break;
6526
6531
  }
@@ -6878,9 +6883,9 @@ var Server = /*#__PURE__*/function () {
6878
6883
  }, {
6879
6884
  key: "shouldAutoPrintCheckoutReceipt",
6880
6885
  value: function shouldAutoPrintCheckoutReceipt() {
6881
- var _this$core$context2, _this$core$context2$g, _this$app16, _this$app16$getStorag;
6886
+ var _this$core$context2, _this$core$context2$g, _this$app18, _this$app18$getStorag;
6882
6887
  if (((_this$core$context2 = this.core.context) === null || _this$core$context2 === void 0 || (_this$core$context2$g = _this$core$context2.getPlatform) === null || _this$core$context2$g === void 0 ? void 0 : _this$core$context2$g.call(_this$core$context2)) !== 'android') return true;
6883
- return ((_this$app16 = this.app) === null || _this$app16 === void 0 || (_this$app16 = _this$app16.storage) === null || _this$app16 === void 0 || (_this$app16$getStorag = _this$app16.getStorage) === null || _this$app16$getStorag === void 0 ? void 0 : _this$app16$getStorag.call(_this$app16, AUTO_PRINT_STORAGE_KEY)) !== 'false';
6888
+ return ((_this$app18 = this.app) === null || _this$app18 === void 0 || (_this$app18 = _this$app18.storage) === null || _this$app18 === void 0 || (_this$app18$getStorag = _this$app18.getStorage) === null || _this$app18$getStorag === void 0 ? void 0 : _this$app18$getStorag.call(_this$app18, AUTO_PRINT_STORAGE_KEY)) !== 'false';
6884
6889
  }
6885
6890
  }, {
6886
6891
  key: "shouldBuildSmallTicketData",
@@ -7504,7 +7509,7 @@ var Server = /*#__PURE__*/function () {
7504
7509
  key: "fetchAndPersistSalesOrderByLookup",
7505
7510
  value: function () {
7506
7511
  var _fetchAndPersistSalesOrderByLookup = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee73(lookup, data, title) {
7507
- var _this$order5, _this$order6, _this$app17;
7512
+ var _this$order5, _this$order6, _this$app19;
7508
7513
  var backendPath, response, _response$code3, responseStatusCode, code, message, fresh, savedOrder, _errorRecord$response, backendError, errorRecord, _responseStatusCode, _ref78, _backendError$code2, backendStatusCode, _code, _message2, _message3;
7509
7514
  return _regeneratorRuntime().wrap(function _callee73$(_context73) {
7510
7515
  while (1) switch (_context73.prev = _context73.next) {
@@ -7520,7 +7525,7 @@ var Server = /*#__PURE__*/function () {
7520
7525
  order: null
7521
7526
  });
7522
7527
  case 3:
7523
- if ((_this$app17 = this.app) !== null && _this$app17 !== void 0 && (_this$app17 = _this$app17.request) !== null && _this$app17 !== void 0 && _this$app17.get) {
7528
+ if ((_this$app19 = this.app) !== null && _this$app19 !== void 0 && (_this$app19 = _this$app19.request) !== null && _this$app19 !== void 0 && _this$app19.get) {
7524
7529
  _context73.next = 6;
7525
7530
  break;
7526
7531
  }
@@ -7720,7 +7725,7 @@ var Server = /*#__PURE__*/function () {
7720
7725
  key: "handleUpdateLocalOrdersBatch",
7721
7726
  value: (function () {
7722
7727
  var _handleUpdateLocalOrdersBatch = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee74(orderIds) {
7723
- var _this$app18;
7728
+ var _this$app20;
7724
7729
  var existedBefore, _iterator13, _step13, id, fetched, message, fetchedMap, _iterator14, _step14, order, oid, freshOrders, succeedIds, failed, _iterator15, _step15, _id, fresh, _message4, overwritten, inserted;
7725
7730
  return _regeneratorRuntime().wrap(function _callee74$(_context74) {
7726
7731
  while (1) switch (_context74.prev = _context74.next) {
@@ -7741,7 +7746,7 @@ var Server = /*#__PURE__*/function () {
7741
7746
  data: null
7742
7747
  });
7743
7748
  case 4:
7744
- if ((_this$app18 = this.app) !== null && _this$app18 !== void 0 && _this$app18.request) {
7749
+ if ((_this$app20 = this.app) !== null && _this$app20 !== void 0 && _this$app20.request) {
7745
7750
  _context74.next = 7;
7746
7751
  break;
7747
7752
  }
@@ -15,6 +15,9 @@ export interface SmallTicketShopInfo {
15
15
  currency_code?: string;
16
16
  primary_locale?: string;
17
17
  timezone?: string;
18
+ /** Customer-facing shop domain, supplied by the host shop context. */
19
+ default_domain?: string;
20
+ private_domain_protocol?: string;
18
21
  [key: string]: any;
19
22
  }
20
23
  export interface BuildSmallTicketDataParams {
@@ -403,10 +403,14 @@ function buildBaseData(params) {
403
403
  currencySymbol = params.currencySymbol,
404
404
  financials = params.financials;
405
405
  var orderNumber = stringify(order.buzzer || order.shop_full_order_number);
406
- return _objectSpread({
406
+ var rewardClaim = buildRewardClaimUrl(shopInfo, order.shop_order_number);
407
+ return _objectSpread(_objectSpread({
407
408
  shop_name: stringify(shopInfo.name || order.shop_name),
408
409
  note: stringify(order.note),
409
- shop_order_number: stringify(order.shop_order_number),
410
+ shop_order_number: stringify(order.shop_order_number)
411
+ }, rewardClaim ? {
412
+ reward_claim: rewardClaim
413
+ } : {}), {}, {
410
414
  order_number: orderNumber,
411
415
  shop_tax_number: stringify(shopInfo.tax_number || order.shop_tax_number),
412
416
  shop_phone: stringify(shopInfo.phone || order.shop_phone),
@@ -424,6 +428,23 @@ function buildBaseData(params) {
424
428
  updated_at: formatDateTime(order.updated_at, locale)
425
429
  } : {});
426
430
  }
431
+ function buildRewardClaimUrl(shopInfo, shopOrderNumber) {
432
+ var domain = typeof shopInfo.default_domain === 'string' ? shopInfo.default_domain.trim() : '';
433
+ var orderNumber = typeof shopOrderNumber === 'string' ? shopOrderNumber.trim() : typeof shopOrderNumber === 'number' && Number.isFinite(shopOrderNumber) ? String(shopOrderNumber) : '';
434
+ if (!domain || !orderNumber) return undefined;
435
+ try {
436
+ var protocol = shopInfo.private_domain_protocol === 'http' ? 'http' : 'https';
437
+ var base = new URL(/^[a-z][a-z\d+.-]*:\/\//i.test(domain) ? domain : "".concat(protocol, "://").concat(domain));
438
+ if (!['http:', 'https:'].includes(base.protocol) || base.username || base.password) {
439
+ return undefined;
440
+ }
441
+ var url = new URL('/claim-purchase-rewards', base);
442
+ url.searchParams.set('shop_order_number', orderNumber);
443
+ return url.toString();
444
+ } catch (_unused) {
445
+ return undefined;
446
+ }
447
+ }
427
448
  function buildProducts(order, locale, productMap) {
428
449
  var products = Array.isArray(order.products) ? order.products : [];
429
450
  var allergyByProductUid = buildProductAllergyMap(order, locale);
@@ -326,7 +326,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
326
326
  date: string;
327
327
  status: string;
328
328
  week: string;
329
- weekNum: 0 | 2 | 1 | 3 | 4 | 5 | 6;
329
+ weekNum: 0 | 2 | 1 | 6 | 4 | 5 | 3;
330
330
  }[]>;
331
331
  submitTimeSlot(timeSlots: TimeSliceItem): void;
332
332
  private getScheduleDataByIds;
@@ -373,7 +373,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
373
373
  };
374
374
  setOtherData(key: string, value: any): void;
375
375
  getOtherData(key: string): any;
376
- getProductTypeById(id: number): Promise<"duration" | "session" | "normal">;
376
+ getProductTypeById(id: number): Promise<"normal" | "duration" | "session">;
377
377
  /**
378
378
  * 提供给 UI 的方法,减轻 UI 层的计算压力,UI 层只需要传递 cartItemId 和 resourceCode 即返回对应的 renderList
379
379
  *
@@ -479,7 +479,19 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
479
479
  * 加车两阶段主决策(规格弹窗 / 资源编辑 / 直接加车)。
480
480
  * 与 ticketBooking `handleSelectProduct` + `handleBooking4Service` 等价。
481
481
  */
482
- decideAddProduct(item: any, options?: Partial<AddProductDecideContext>): import("./utils/addProductDecision").AddProductDecision;
482
+ decideAddProduct(item: any, options?: Partial<AddProductDecideContext>): {
483
+ action: "reloadCatalog";
484
+ } | {
485
+ action: "add";
486
+ cacheItem: any;
487
+ } | {
488
+ action: "requiresDetail";
489
+ payload: AddProductRequiresDetailPayload;
490
+ } | {
491
+ action: "requiresBookingEdit";
492
+ cacheItem: any;
493
+ payload: import("./utils/addProductDecision").AddProductRequiresBookingEditPayload;
494
+ };
483
495
  /** 规格弹窗 callback 后的第二段决策。 */
484
496
  decideAfterDetail(cacheItem: any, options?: Partial<AddProductDecideContext>): import("./utils/addProductDecision").AddProductDecision;
485
497
  /**
@@ -187,8 +187,8 @@ export var OrderInvoicePreviewImpl = /*#__PURE__*/function (_BaseModule) {
187
187
  error: null
188
188
  });
189
189
  var task = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
190
- var _this3$core$getPlugin, _this3$core$getPlugin2, _coreData$core, _this3$languageSelect;
191
- var _yield$Promise$all, _yield$Promise$all2, snapshot, context, template, source, getData, coreData, shop, languageOptions, remembered, selected, locale, result;
190
+ var _appPlugin$getData, _appPlugin$getApp, _hostApp$models, _hostApp$models$getSt, _hostApp$models$getSt2, _hostApp$models$getSt3, _hostApp$data, _hostApp$data$getStor, _hostApp$data$getStor2, _hostApp$data$getStor3, _coreData$core, _this3$languageSelect;
191
+ var _yield$Promise$all, _yield$Promise$all2, snapshot, context, template, source, appPlugin, getData, coreData, hostApp, shopCore, shop, languageOptions, remembered, selected, locale, result;
192
192
  return _regeneratorRuntime().wrap(function _callee$(_context) {
193
193
  while (1) switch (_context.prev = _context.next) {
194
194
  case 0:
@@ -201,23 +201,28 @@ export var OrderInvoicePreviewImpl = /*#__PURE__*/function (_BaseModule) {
201
201
  context = _yield$Promise$all2[1];
202
202
  template = _yield$Promise$all2[2];
203
203
  source = withPaymentMethodNames(snapshot, context.methods);
204
- getData = (_this3$core$getPlugin = _this3.core.getPlugin('app')) === null || _this3$core$getPlugin === void 0 || (_this3$core$getPlugin2 = _this3$core$getPlugin.getData) === null || _this3$core$getPlugin2 === void 0 ? void 0 : _this3$core$getPlugin2.call(_this3$core$getPlugin);
204
+ appPlugin = _this3.core.getPlugin('app');
205
+ getData = appPlugin === null || appPlugin === void 0 || (_appPlugin$getData = appPlugin.getData) === null || _appPlugin$getData === void 0 ? void 0 : _appPlugin$getData.call(appPlugin);
205
206
  if (!((getData === null || getData === void 0 ? void 0 : getData('shop_id')) != null && String(getData('shop_id')) !== String(input.shopId))) {
206
- _context.next = 11;
207
+ _context.next = 12;
207
208
  break;
208
209
  }
209
210
  throw new Error('Invoice shop changed');
210
- case 11:
211
+ case 12:
211
212
  coreData = getData === null || getData === void 0 ? void 0 : getData('core');
213
+ hostApp = appPlugin === null || appPlugin === void 0 || (_appPlugin$getApp = appPlugin.getApp) === null || _appPlugin$getApp === void 0 ? void 0 : _appPlugin$getApp.call(appPlugin);
214
+ shopCore = (hostApp === null || hostApp === void 0 || (_hostApp$models = hostApp.models) === null || _hostApp$models === void 0 || (_hostApp$models$getSt = _hostApp$models.getStore) === null || _hostApp$models$getSt === void 0 || (_hostApp$models$getSt2 = (_hostApp$models$getSt3 = _hostApp$models$getSt.call(_hostApp$models)).getDataByModel) === null || _hostApp$models$getSt2 === void 0 ? void 0 : _hostApp$models$getSt2.call(_hostApp$models$getSt3, 'core', 'core')) || (hostApp === null || hostApp === void 0 || (_hostApp$data = hostApp.data) === null || _hostApp$data === void 0 || (_hostApp$data = _hostApp$data.store) === null || _hostApp$data === void 0 || (_hostApp$data$getStor = _hostApp$data.getStore) === null || _hostApp$data$getStor === void 0 || (_hostApp$data$getStor2 = (_hostApp$data$getStor3 = _hostApp$data$getStor.call(_hostApp$data)).getDataByModel) === null || _hostApp$data$getStor2 === void 0 ? void 0 : _hostApp$data$getStor2.call(_hostApp$data$getStor3, 'core', 'core')) || (coreData === null || coreData === void 0 ? void 0 : coreData.core) || coreData || {};
212
215
  shop = _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, (coreData === null || coreData === void 0 || (_coreData$core = coreData.core) === null || _coreData$core === void 0 ? void 0 : _coreData$core.shop) || (coreData === null || coreData === void 0 ? void 0 : coreData.shop) || {}), (getData === null || getData === void 0 ? void 0 : getData('shop_info')) || {}), input.shop), context.shop), getData !== null && getData !== void 0 && getData('tax_country_code') ? {
213
216
  tax_country_code: getData('tax_country_code')
214
217
  } : {});
218
+ shop.default_domain || (shop.default_domain = shopCore.default_domain);
219
+ shop.private_domain_protocol || (shop.private_domain_protocol = shopCore.private_domain_protocol);
215
220
  if (!(generation !== _this3.generation || _this3.disposed)) {
216
- _context.next = 15;
221
+ _context.next = 20;
217
222
  break;
218
223
  }
219
224
  throw new Error('Invoice request superseded');
220
- case 15:
225
+ case 20:
221
226
  languageOptions = resolveCustomerInvoiceLanguages(template.language, input.locale);
222
227
  remembered = (_this3$languageSelect = _this3.languageSelection) === null || _this3$languageSelect === void 0 ? void 0 : _this3$languageSelect.code;
223
228
  selected = languageOptions.find(function (option) {
@@ -254,7 +259,7 @@ export var OrderInvoicePreviewImpl = /*#__PURE__*/function (_BaseModule) {
254
259
  error: null
255
260
  });
256
261
  return _context.abrupt("return", result);
257
- case 22:
262
+ case 27:
258
263
  case "end":
259
264
  return _context.stop();
260
265
  }
@@ -0,0 +1,21 @@
1
+ import type { ProductListLoadProductsParams } from '../../modules/ProductList';
2
+ import type { ProductData } from '../../modules/Product/types';
3
+ import type { UnifiedBookingSalesCatalogQueryBatch } from './types';
4
+ type DetailParams = ProductListLoadProductsParams & {
5
+ product_id: number;
6
+ };
7
+ export interface CatalogQueryRuntime {
8
+ references: unknown[];
9
+ values: unknown;
10
+ /** Late-loaded pricing/schedule data may refresh within the same owner. */
11
+ refreshValues?: unknown;
12
+ }
13
+ /** Internal adapter: membership loaders are never accepted from public callers. */
14
+ export declare function createCatalogQueryBatchAdapter(options: {
15
+ runtime(): CatalogQueryRuntime;
16
+ normalize(params: ProductListLoadProductsParams, now: number): ProductListLoadProductsParams;
17
+ key(params: ProductListLoadProductsParams): string;
18
+ snapshot(params: ProductListLoadProductsParams): Promise<ProductData[]>;
19
+ detail(params: DetailParams, snapshot: UnifiedBookingSalesCatalogQueryBatch['queryCatalogSnapshot']): Promise<ProductData | undefined>;
20
+ }): UnifiedBookingSalesCatalogQueryBatch;
21
+ export {};
@@ -0,0 +1,202 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ var _excluded = ["product_ids"],
3
+ _excluded2 = ["product_id", "product_ids"];
4
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
5
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
6
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
7
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
8
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
9
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
10
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
11
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
12
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
13
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
14
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
15
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
16
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
17
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
18
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
19
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
20
+ import { cloneDeep, isEqual } from 'lodash-es';
21
+ var BATCH_MAX_AGE_MS = 60 * 1000;
22
+ // Enough for a 42-day calendar with several product details per day, but bounded.
23
+ var BATCH_MAX_ENTRIES = 512;
24
+
25
+ /** Internal adapter: membership loaders are never accepted from public callers. */
26
+ export function createCatalogQueryBatchAdapter(options) {
27
+ var disposed = false;
28
+ var epoch;
29
+ var sameOwner = function sameOwner(left, right) {
30
+ return left.references.length === right.references.length && left.references.every(function (ref, index) {
31
+ return ref === right.references[index];
32
+ }) && isEqual(left.values, right.values);
33
+ };
34
+ var fail = function fail(code) {
35
+ return Object.assign(new Error(code === 'CATALOG_QUERY_BATCH_DISPOSED' ? 'The catalog query batch is closed. Create a new batch before querying.' : 'The catalog context changed while loading. Please retry.'), {
36
+ code: code
37
+ });
38
+ };
39
+ var current = function current() {
40
+ if (disposed) throw fail('CATALOG_QUERY_BATCH_DISPOSED');
41
+ var now = Date.now();
42
+ var runtime = options.runtime();
43
+ if (!epoch || now < epoch.startedAt || now - epoch.startedAt >= BATCH_MAX_AGE_MS || !sameOwner(runtime, epoch.runtime) || !isEqual(runtime.refreshValues, epoch.runtime.refreshValues)) {
44
+ var _epoch;
45
+ (_epoch = epoch) === null || _epoch === void 0 || _epoch.entries.clear();
46
+ epoch = {
47
+ runtime: {
48
+ references: _toConsumableArray(runtime.references),
49
+ values: cloneDeep(runtime.values),
50
+ refreshValues: cloneDeep(runtime.refreshValues)
51
+ },
52
+ startedAt: now,
53
+ entries: new Map()
54
+ };
55
+ }
56
+ return epoch;
57
+ };
58
+ var assertEpoch = function assertEpoch(owner) {
59
+ var next = current();
60
+ if (next !== owner) throw Object.assign(fail('CATALOG_QUERY_BATCH_STALE'), {
61
+ retryable: sameOwner(owner.runtime, next.runtime)
62
+ });
63
+ };
64
+ var run = /*#__PURE__*/function () {
65
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(load) {
66
+ var attempt, failure;
67
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
68
+ while (1) switch (_context.prev = _context.next) {
69
+ case 0:
70
+ attempt = 0;
71
+ case 1:
72
+ _context.prev = 1;
73
+ _context.next = 4;
74
+ return load(current());
75
+ case 4:
76
+ return _context.abrupt("return", _context.sent);
77
+ case 7:
78
+ _context.prev = 7;
79
+ _context.t0 = _context["catch"](1);
80
+ failure = _context.t0; // Drop the old result and reread under the new configuration. Never replay
81
+ // a network error, disposed batch or a request belonging to a different user/store.
82
+ if (!(attempt >= 2 || (failure === null || failure === void 0 ? void 0 : failure.code) !== 'CATALOG_QUERY_BATCH_STALE' || !failure.retryable)) {
83
+ _context.next = 12;
84
+ break;
85
+ }
86
+ throw _context.t0;
87
+ case 12:
88
+ attempt++;
89
+ _context.next = 1;
90
+ break;
91
+ case 15:
92
+ case "end":
93
+ return _context.stop();
94
+ }
95
+ }, _callee, null, [[1, 7]]);
96
+ }));
97
+ return function run(_x) {
98
+ return _ref.apply(this, arguments);
99
+ };
100
+ }();
101
+ var read = /*#__PURE__*/function () {
102
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(owner, key, load) {
103
+ var promise, result;
104
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
105
+ while (1) switch (_context2.prev = _context2.next) {
106
+ case 0:
107
+ assertEpoch(owner);
108
+ promise = owner.entries.get(key);
109
+ if (promise) {
110
+ owner.entries.delete(key);
111
+ owner.entries.set(key, promise);
112
+ } else {
113
+ promise = Promise.resolve().then(function () {
114
+ assertEpoch(owner);
115
+ return load();
116
+ }).then(function (value) {
117
+ return cloneDeep(value);
118
+ });
119
+ owner.entries.set(key, promise);
120
+ while (owner.entries.size > BATCH_MAX_ENTRIES) owner.entries.delete(owner.entries.keys().next().value);
121
+ }
122
+ _context2.prev = 3;
123
+ _context2.next = 6;
124
+ return promise;
125
+ case 6:
126
+ result = _context2.sent;
127
+ assertEpoch(owner);
128
+ return _context2.abrupt("return", cloneDeep(result));
129
+ case 11:
130
+ _context2.prev = 11;
131
+ _context2.t0 = _context2["catch"](3);
132
+ if (owner.entries.get(key) === promise) owner.entries.delete(key);
133
+ throw _context2.t0;
134
+ case 15:
135
+ case "end":
136
+ return _context2.stop();
137
+ }
138
+ }, _callee2, null, [[3, 11]]);
139
+ }));
140
+ return function read(_x2, _x3, _x4) {
141
+ return _ref2.apply(this, arguments);
142
+ };
143
+ }();
144
+ var snapshotFor = /*#__PURE__*/function () {
145
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(owner, input) {
146
+ var _options$normalize, product_ids, scope, products;
147
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
148
+ while (1) switch (_context3.prev = _context3.next) {
149
+ case 0:
150
+ assertEpoch(owner);
151
+ _options$normalize = options.normalize(cloneDeep(input), owner.startedAt), product_ids = _options$normalize.product_ids, scope = _objectWithoutProperties(_options$normalize, _excluded); // The membership scope is always the whole menu; ID filtering is only a detached view.
152
+ _context3.next = 4;
153
+ return read(owner, "list:".concat(options.key(scope)), function () {
154
+ return options.snapshot(scope);
155
+ });
156
+ case 4:
157
+ products = _context3.sent;
158
+ return _context3.abrupt("return", product_ids !== null && product_ids !== void 0 && product_ids.length ? products.filter(function (product) {
159
+ return product_ids.some(function (id) {
160
+ return Number(id) === Number(product.id);
161
+ });
162
+ }) : products);
163
+ case 6:
164
+ case "end":
165
+ return _context3.stop();
166
+ }
167
+ }, _callee3);
168
+ }));
169
+ return function snapshotFor(_x5, _x6) {
170
+ return _ref3.apply(this, arguments);
171
+ };
172
+ }();
173
+ return {
174
+ queryCatalogSnapshot: function queryCatalogSnapshot(params) {
175
+ return run(function (owner) {
176
+ return snapshotFor(owner, params);
177
+ });
178
+ },
179
+ queryCatalogProductDetail: function queryCatalogProductDetail(input) {
180
+ return run(function (owner) {
181
+ var _cloneDeep = cloneDeep(input),
182
+ product_id = _cloneDeep.product_id,
183
+ _ignored = _cloneDeep.product_ids,
184
+ scope = _objectWithoutProperties(_cloneDeep, _excluded2);
185
+ var params = _objectSpread(_objectSpread({}, options.normalize(scope, owner.startedAt)), {}, {
186
+ product_id: product_id
187
+ });
188
+ return read(owner, "detail:".concat(options.key(params)), function () {
189
+ return options.detail(params, function (query) {
190
+ return snapshotFor(owner, query);
191
+ });
192
+ });
193
+ });
194
+ },
195
+ dispose: function dispose() {
196
+ var _epoch2;
197
+ disposed = true;
198
+ (_epoch2 = epoch) === null || _epoch2 === void 0 || _epoch2.entries.clear();
199
+ epoch = undefined;
200
+ }
201
+ };
202
+ }
@@ -6,7 +6,7 @@ import { type InvoiceLayoutConfig, type InvoiceTemplateSettings, type OpenDataCo
6
6
  import type { LoadScheduleAvailableDateParams, ScheduleItem } from '../../modules/Schedule/types';
7
7
  import type { ProductListLoadProductsParams, ProductListStoreQueryParams } from '../../modules/ProductList';
8
8
  import type { AvailabilityDateRange, AvailabilityOccupancy, AvailabilityProduct, AvailabilityResource, GetProductTimeRangesRequest } from '../../modules/ResourcePlanner';
9
- import type { AvailabilityContextRef, ContextualAvailabilityQuery, ContextualAvailabilityQueryResult, ContextualCommitAvailabilitySelectionParams, ContextualProductTimeRangeGroup, UnifiedBookingSalesAddRetailProductParams, UnifiedBookingSalesApplyPlannerDiscountsParams, UnifiedBookingSalesCommitAvailabilitySelectionResult, UnifiedBookingSalesDiscountResult, UnifiedBookingSalesLoadProductsByScheduleDateParams, UnifiedBookingSalesLoadOpenDataParams, UnifiedBookingSalesPrepareAvailabilityProjectionParams, UnifiedBookingSalesPolicyResponse, UnifiedBookingSalesQueryBookingResourceDetailsParams, UnifiedBookingSalesResourceDetail, UnifiedBookingSalesResolveProductAllergyRequirementParams, UnifiedBookingSalesStageRetailProductsParams, UnifiedBookingSalesState } from './types';
9
+ import type { AvailabilityContextRef, ContextualAvailabilityQuery, ContextualAvailabilityQueryResult, ContextualCommitAvailabilitySelectionParams, ContextualProductTimeRangeGroup, UnifiedBookingSalesAddRetailProductParams, UnifiedBookingSalesCatalogQueryBatch, UnifiedBookingSalesApplyPlannerDiscountsParams, UnifiedBookingSalesCommitAvailabilitySelectionResult, UnifiedBookingSalesDiscountResult, UnifiedBookingSalesLoadProductsByScheduleDateParams, UnifiedBookingSalesLoadOpenDataParams, UnifiedBookingSalesPrepareAvailabilityProjectionParams, UnifiedBookingSalesPolicyResponse, UnifiedBookingSalesQueryBookingResourceDetailsParams, UnifiedBookingSalesResourceDetail, UnifiedBookingSalesResolveProductAllergyRequirementParams, UnifiedBookingSalesStageRetailProductsParams, UnifiedBookingSalesState } from './types';
10
10
  import type { BusinessAvailability } from '../../modules/BusinessAvailability';
11
11
  import { BookingTicket } from '../BookingTicket';
12
12
  import type { AllergyRequirement } from '../../model/strategy/adapter/itemRule';
@@ -225,6 +225,13 @@ export declare class UnifiedBookingSalesImpl extends BookingTicket {
225
225
  queryCatalogProductDetail(params: ProductListLoadProductsParams & {
226
226
  product_id: number;
227
227
  }): Promise<ProductData | undefined>;
228
+ /**
229
+ * Opt-in calendar/card preview batching. Results expire after sixty seconds or a
230
+ * runtime change; the next read starts a fresh clock/cache. Selection and submit
231
+ * must keep using the ordinary fresh query methods. Call dispose on owner cleanup.
232
+ */
233
+ createCatalogQueryBatch(): UnifiedBookingSalesCatalogQueryBatch;
234
+ private loadCatalogProductDetail;
228
235
  private loadCatalogProducts;
229
236
  queryProducts(params?: ProductListStoreQueryParams): Promise<ProductData[]>;
230
237
  /** Date-first entry point. It delegates protocol details and cache ownership to ScheduleModule. */