@pisell/pisellos 2.2.323 → 2.2.324

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 (195) hide show
  1. package/dist/index.d.ts +1 -0
  2. package/dist/index.js +1 -0
  3. package/dist/inventory/index.d.ts +92 -0
  4. package/dist/inventory/index.js +509 -0
  5. package/dist/modules/BookingContext/index.d.ts +2 -2
  6. package/dist/modules/BookingContext/index.js +55 -25
  7. package/dist/modules/BookingContext/types.d.ts +2 -0
  8. package/dist/modules/BookingContext/utils/calendarBooking.d.ts +15 -0
  9. package/dist/modules/BookingContext/utils/calendarBooking.js +207 -0
  10. package/dist/modules/BookingContext/utils/index.d.ts +1 -0
  11. package/dist/modules/BookingContext/utils/index.js +1 -0
  12. package/dist/modules/BookingContext/utils/productExtend.d.ts +20 -1
  13. package/dist/modules/BookingContext/utils/productExtend.js +122 -29
  14. package/dist/modules/Date/index.d.ts +1 -1
  15. package/dist/modules/Date/index.js +60 -14
  16. package/dist/modules/Date/types.d.ts +5 -0
  17. package/dist/modules/Discount/index.js +1 -0
  18. package/dist/modules/OpenData/index.d.ts +1 -0
  19. package/dist/modules/OpenData/index.js +1 -0
  20. package/dist/modules/OpenData/salesSettings.d.ts +32 -0
  21. package/dist/modules/OpenData/salesSettings.js +80 -0
  22. package/dist/modules/OpenData/types.d.ts +16 -0
  23. package/dist/modules/OpenData/utils.d.ts +1 -1
  24. package/dist/modules/OpenData/utils.js +3 -2
  25. package/dist/modules/Order/index.d.ts +54 -11
  26. package/dist/modules/Order/index.js +2699 -1411
  27. package/dist/modules/Order/types.d.ts +43 -5
  28. package/dist/modules/Order/types.js +4 -0
  29. package/dist/modules/Order/unpaidAmountGap.d.ts +6 -0
  30. package/dist/modules/Order/unpaidAmountGap.js +72 -0
  31. package/dist/modules/Order/utils/discountProductLineIdentity.js +2 -2
  32. package/dist/modules/Order/utils/productVoucherGroups.d.ts +15 -0
  33. package/dist/modules/Order/utils/productVoucherGroups.js +115 -0
  34. package/dist/modules/Order/utils.d.ts +3 -1
  35. package/dist/modules/Order/utils.js +6 -2
  36. package/dist/modules/ProductList/clientDataVariants.js +6 -2
  37. package/dist/modules/ProductList/index.d.ts +2 -0
  38. package/dist/modules/ProductList/index.js +161 -51
  39. package/dist/modules/ResourcePlanner/planner.js +58 -2
  40. package/dist/modules/ResourcePlanner/types.d.ts +13 -0
  41. package/dist/modules/Rules/index.d.ts +2 -0
  42. package/dist/modules/Rules/index.js +58 -39
  43. package/dist/modules/Schedule/index.d.ts +7 -1
  44. package/dist/modules/Schedule/index.js +155 -39
  45. package/dist/modules/Schedule/types.d.ts +2 -0
  46. package/dist/modules/bookingReadValidation.d.ts +6 -0
  47. package/dist/modules/bookingReadValidation.js +72 -0
  48. package/dist/plugins/request.d.ts +2 -0
  49. package/dist/server/index.d.ts +5 -0
  50. package/dist/server/index.js +1312 -1154
  51. package/dist/server/modules/order/index.js +2 -1
  52. package/dist/shared/receipt/customerInvoiceLanguages.d.ts +1 -1
  53. package/dist/shared/receipt/customerInvoiceLanguages.js +5 -3
  54. package/dist/shared/receipt/small-ticket.d.ts +4 -0
  55. package/dist/shared/receipt/small-ticket.js +70 -12
  56. package/dist/solution/BaseSales/index.d.ts +39 -5
  57. package/dist/solution/BaseSales/index.js +1828 -1462
  58. package/dist/solution/BaseSales/types.d.ts +1 -0
  59. package/dist/solution/BaseSales/types.js +1 -0
  60. package/dist/solution/BookingByStep/index.d.ts +17 -3
  61. package/dist/solution/BookingByStep/index.js +676 -361
  62. package/dist/solution/BookingByStep/utils/resources.d.ts +10 -0
  63. package/dist/solution/BookingByStep/utils/resources.js +117 -76
  64. package/dist/solution/BookingTicket/index.d.ts +15 -3
  65. package/dist/solution/BookingTicket/index.js +249 -135
  66. package/dist/solution/BookingTicket/types.d.ts +14 -2
  67. package/dist/solution/BookingTicket/utils/addProductDecision.d.ts +3 -1
  68. package/dist/solution/BookingTicket/utils/addProductDecision.js +39 -11
  69. package/dist/solution/BookingTicket/utils/resolveUniqueCartDetail.d.ts +8 -0
  70. package/dist/solution/BookingTicket/utils/resolveUniqueCartDetail.js +188 -0
  71. package/dist/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.d.ts +8 -0
  72. package/dist/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.js +88 -0
  73. package/dist/solution/BookingTicket/utils/scan/cloudSearch.js +1 -0
  74. package/dist/solution/BookingTicket/utils/scan/handleScan.js +2 -1
  75. package/dist/solution/OrderInvoicePreview/index.js +14 -8
  76. package/dist/solution/ScanOrder/index.d.ts +2 -0
  77. package/dist/solution/ScanOrder/index.js +166 -67
  78. package/dist/solution/ScanOrder/menuAvailability.d.ts +24 -0
  79. package/dist/solution/ScanOrder/menuAvailability.js +363 -0
  80. package/dist/solution/UnifiedBookingSales/catalogQueryBatch.d.ts +21 -0
  81. package/dist/solution/UnifiedBookingSales/catalogQueryBatch.js +202 -0
  82. package/dist/solution/UnifiedBookingSales/index.d.ts +96 -4
  83. package/dist/solution/UnifiedBookingSales/index.js +3374 -1177
  84. package/dist/solution/UnifiedBookingSales/remoteOccupancyCache.d.ts +2 -0
  85. package/dist/solution/UnifiedBookingSales/remoteOccupancyCache.js +4 -0
  86. package/dist/solution/UnifiedBookingSales/salesSettings.d.ts +16 -0
  87. package/dist/solution/UnifiedBookingSales/salesSettings.js +81 -0
  88. package/dist/solution/UnifiedBookingSales/sessionResourceCache.d.ts +27 -0
  89. package/dist/solution/UnifiedBookingSales/sessionResourceCache.js +271 -0
  90. package/dist/solution/UnifiedBookingSales/types.d.ts +71 -2
  91. package/dist/solution/UnifiedBookingSales/types.js +7 -1
  92. package/dist/solution/UnifiedBookingSales/venueCatalogSession.d.ts +32 -0
  93. package/dist/solution/UnifiedBookingSales/venueCatalogSession.js +283 -0
  94. package/dist/utils/platform.d.ts +2 -0
  95. package/dist/utils/platform.js +6 -0
  96. package/dist/utils/pos-receipt-auto-print.d.ts +4 -0
  97. package/dist/utils/pos-receipt-auto-print.js +14 -0
  98. package/lib/index.d.ts +1 -0
  99. package/lib/index.js +12 -0
  100. package/lib/inventory/index.d.ts +92 -0
  101. package/lib/inventory/index.js +287 -0
  102. package/lib/modules/BookingContext/index.d.ts +2 -2
  103. package/lib/modules/BookingContext/index.js +42 -10
  104. package/lib/modules/BookingContext/types.d.ts +2 -0
  105. package/lib/modules/BookingContext/utils/calendarBooking.d.ts +15 -0
  106. package/lib/modules/BookingContext/utils/calendarBooking.js +156 -0
  107. package/lib/modules/BookingContext/utils/index.d.ts +1 -0
  108. package/lib/modules/BookingContext/utils/index.js +11 -0
  109. package/lib/modules/BookingContext/utils/productExtend.d.ts +20 -1
  110. package/lib/modules/BookingContext/utils/productExtend.js +96 -7
  111. package/lib/modules/Date/index.d.ts +1 -1
  112. package/lib/modules/Date/index.js +28 -5
  113. package/lib/modules/Date/types.d.ts +5 -0
  114. package/lib/modules/Discount/index.js +1 -0
  115. package/lib/modules/OpenData/index.d.ts +1 -0
  116. package/lib/modules/OpenData/index.js +12 -0
  117. package/lib/modules/OpenData/salesSettings.d.ts +32 -0
  118. package/lib/modules/OpenData/salesSettings.js +70 -0
  119. package/lib/modules/OpenData/types.d.ts +16 -0
  120. package/lib/modules/OpenData/utils.d.ts +1 -1
  121. package/lib/modules/OpenData/utils.js +3 -2
  122. package/lib/modules/Order/index.d.ts +54 -11
  123. package/lib/modules/Order/index.js +659 -80
  124. package/lib/modules/Order/types.d.ts +43 -5
  125. package/lib/modules/Order/types.js +2 -0
  126. package/lib/modules/Order/unpaidAmountGap.d.ts +6 -0
  127. package/lib/modules/Order/unpaidAmountGap.js +60 -0
  128. package/lib/modules/Order/utils/discountProductLineIdentity.js +1 -1
  129. package/lib/modules/Order/utils/productVoucherGroups.d.ts +15 -0
  130. package/lib/modules/Order/utils/productVoucherGroups.js +64 -0
  131. package/lib/modules/Order/utils.d.ts +3 -1
  132. package/lib/modules/Order/utils.js +6 -2
  133. package/lib/modules/ProductList/clientDataVariants.js +6 -2
  134. package/lib/modules/ProductList/index.d.ts +2 -0
  135. package/lib/modules/ProductList/index.js +74 -0
  136. package/lib/modules/ResourcePlanner/planner.js +52 -1
  137. package/lib/modules/ResourcePlanner/types.d.ts +13 -0
  138. package/lib/modules/Rules/index.d.ts +2 -0
  139. package/lib/modules/Rules/index.js +25 -9
  140. package/lib/modules/Schedule/index.d.ts +7 -1
  141. package/lib/modules/Schedule/index.js +68 -4
  142. package/lib/modules/Schedule/types.d.ts +2 -0
  143. package/lib/modules/bookingReadValidation.d.ts +6 -0
  144. package/lib/modules/bookingReadValidation.js +56 -0
  145. package/lib/plugins/request.d.ts +2 -0
  146. package/lib/server/index.d.ts +5 -0
  147. package/lib/server/index.js +124 -16
  148. package/lib/server/modules/order/index.js +2 -1
  149. package/lib/shared/receipt/customerInvoiceLanguages.d.ts +1 -1
  150. package/lib/shared/receipt/customerInvoiceLanguages.js +5 -3
  151. package/lib/shared/receipt/small-ticket.d.ts +4 -0
  152. package/lib/shared/receipt/small-ticket.js +63 -8
  153. package/lib/solution/BaseSales/index.d.ts +39 -5
  154. package/lib/solution/BaseSales/index.js +212 -18
  155. package/lib/solution/BaseSales/types.d.ts +1 -0
  156. package/lib/solution/BaseSales/types.js +1 -0
  157. package/lib/solution/BookingByStep/index.d.ts +17 -3
  158. package/lib/solution/BookingByStep/index.js +222 -14
  159. package/lib/solution/BookingByStep/utils/resources.d.ts +10 -0
  160. package/lib/solution/BookingByStep/utils/resources.js +25 -15
  161. package/lib/solution/BookingTicket/index.d.ts +15 -3
  162. package/lib/solution/BookingTicket/index.js +47 -4
  163. package/lib/solution/BookingTicket/types.d.ts +14 -2
  164. package/lib/solution/BookingTicket/utils/addProductDecision.d.ts +3 -1
  165. package/lib/solution/BookingTicket/utils/addProductDecision.js +37 -6
  166. package/lib/solution/BookingTicket/utils/resolveUniqueCartDetail.d.ts +8 -0
  167. package/lib/solution/BookingTicket/utils/resolveUniqueCartDetail.js +136 -0
  168. package/lib/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.d.ts +8 -0
  169. package/lib/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.js +54 -0
  170. package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +1 -0
  171. package/lib/solution/BookingTicket/utils/scan/handleScan.js +2 -1
  172. package/lib/solution/OrderInvoicePreview/index.js +7 -1
  173. package/lib/solution/ScanOrder/index.d.ts +2 -0
  174. package/lib/solution/ScanOrder/index.js +72 -2
  175. package/lib/solution/ScanOrder/menuAvailability.d.ts +24 -0
  176. package/lib/solution/ScanOrder/menuAvailability.js +203 -0
  177. package/lib/solution/UnifiedBookingSales/catalogQueryBatch.d.ts +21 -0
  178. package/lib/solution/UnifiedBookingSales/catalogQueryBatch.js +109 -0
  179. package/lib/solution/UnifiedBookingSales/index.d.ts +96 -4
  180. package/lib/solution/UnifiedBookingSales/index.js +1316 -73
  181. package/lib/solution/UnifiedBookingSales/remoteOccupancyCache.d.ts +2 -0
  182. package/lib/solution/UnifiedBookingSales/remoteOccupancyCache.js +2 -0
  183. package/lib/solution/UnifiedBookingSales/salesSettings.d.ts +16 -0
  184. package/lib/solution/UnifiedBookingSales/salesSettings.js +72 -0
  185. package/lib/solution/UnifiedBookingSales/sessionResourceCache.d.ts +27 -0
  186. package/lib/solution/UnifiedBookingSales/sessionResourceCache.js +199 -0
  187. package/lib/solution/UnifiedBookingSales/types.d.ts +71 -2
  188. package/lib/solution/UnifiedBookingSales/types.js +4 -1
  189. package/lib/solution/UnifiedBookingSales/venueCatalogSession.d.ts +32 -0
  190. package/lib/solution/UnifiedBookingSales/venueCatalogSession.js +155 -0
  191. package/lib/utils/platform.d.ts +2 -0
  192. package/lib/utils/platform.js +7 -0
  193. package/lib/utils/pos-receipt-auto-print.d.ts +4 -0
  194. package/lib/utils/pos-receipt-auto-print.js +13 -0
  195. package/package.json +1 -1
@@ -30,6 +30,7 @@ import isSameOrAfter from 'dayjs/plugin/isSameOrAfter';
30
30
  import { generateMonthDates, disableAllDates, disableDatesBeforeOneDay } from "../Date/utils";
31
31
  import { calcScheduleDateRange } from "./utils";
32
32
  import { getDateIsInSchedule } from "./getDateIsInSchedule";
33
+ import { isBookingAvailabilityData, isBookingScheduleList } from "../bookingReadValidation";
33
34
  dayjs.extend(isSameOrBefore);
34
35
  dayjs.extend(isSameOrAfter);
35
36
  export var ScheduleModule = /*#__PURE__*/function (_BaseModule) {
@@ -51,31 +52,35 @@ export var ScheduleModule = /*#__PURE__*/function (_BaseModule) {
51
52
  _defineProperty(_assertThisInitialized(_this), "scheduleListRequestVersion", 0);
52
53
  _defineProperty(_assertThisInitialized(_this), "scheduleCatalogScope", '');
53
54
  _defineProperty(_assertThisInitialized(_this), "otherParams", {});
55
+ _defineProperty(_assertThisInitialized(_this), "catalogVersion", 0);
56
+ _defineProperty(_assertThisInitialized(_this), "destroyed", false);
57
+ _defineProperty(_assertThisInitialized(_this), "availabilityRequestVersion", 0);
54
58
  return _this;
55
59
  }
56
60
  _createClass(ScheduleModule, [{
57
61
  key: "initialize",
58
62
  value: function () {
59
63
  var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(core, options) {
60
- var _options$initialState;
64
+ var _options$initialState, _options$otherParams;
61
65
  var initialScheduleList, hasInitialScheduleList;
62
66
  return _regeneratorRuntime().wrap(function _callee$(_context) {
63
67
  while (1) switch (_context.prev = _context.next) {
64
68
  case 0:
65
69
  // The store proxies initialState, so capture its input before resets write through it.
66
70
  initialScheduleList = (_options$initialState = options.initialState) === null || _options$initialState === void 0 ? void 0 : _options$initialState.scheduleList;
67
- hasInitialScheduleList = Array.isArray(initialScheduleList);
71
+ hasInitialScheduleList = ((_options$otherParams = options.otherParams) === null || _options$otherParams === void 0 ? void 0 : _options$otherParams.scheduleCatalogCache) !== 'memory' && Array.isArray(initialScheduleList);
72
+ this.destroyed = false;
68
73
  this.resetScheduleCatalog();
69
74
  this.core = core;
70
75
 
71
76
  // 获取依赖的插件
72
77
  this.request = core.getPlugin('request');
73
78
  if (this.request) {
74
- _context.next = 7;
79
+ _context.next = 8;
75
80
  break;
76
81
  }
77
82
  throw new Error('ScheduleModule 需要 request 插件支持');
78
- case 7:
83
+ case 8:
79
84
  // if (options?.initialState) {
80
85
  // this.state = { ...this.state, ...options.initialState }
81
86
  // }
@@ -92,7 +97,7 @@ export var ScheduleModule = /*#__PURE__*/function (_BaseModule) {
92
97
  this.store.availabilityDateList = [];
93
98
  this.hasLoadedScheduleList = false;
94
99
  }
95
- case 10:
100
+ case 11:
96
101
  case "end":
97
102
  return _context.stop();
98
103
  }
@@ -138,6 +143,8 @@ export var ScheduleModule = /*#__PURE__*/function (_BaseModule) {
138
143
  }, {
139
144
  key: "resetScheduleCatalog",
140
145
  value: function resetScheduleCatalog() {
146
+ this.catalogVersion += 1;
147
+ this.availabilityRequestVersion += 1;
141
148
  this.scheduleListRequestVersion += 1;
142
149
  this.scheduleListPromise = null;
143
150
  this.hasLoadedScheduleList = false;
@@ -147,6 +154,7 @@ export var ScheduleModule = /*#__PURE__*/function (_BaseModule) {
147
154
  }, {
148
155
  key: "destroy",
149
156
  value: function destroy() {
157
+ this.destroyed = true;
150
158
  this.resetScheduleCatalog();
151
159
  _get(_getPrototypeOf(ScheduleModule.prototype), "destroy", this).call(this);
152
160
  }
@@ -212,37 +220,116 @@ export var ScheduleModule = /*#__PURE__*/function (_BaseModule) {
212
220
  return loadAllSchedule;
213
221
  }())
214
222
  }, {
215
- key: "loadScheduleCatalog",
216
- value: function () {
217
- var _loadScheduleCatalog = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(useCache, requestVersion) {
218
- var response, _response$data;
223
+ key: "getScheduleCatalogVersion",
224
+ value: function getScheduleCatalogVersion() {
225
+ this.syncScheduleCatalogScope();
226
+ return this.catalogVersion;
227
+ }
228
+
229
+ /** Resolve only after the current scope has a successful catalog. */
230
+ }, {
231
+ key: "ensureScheduleReady",
232
+ value: (function () {
233
+ var _ensureScheduleReady = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
234
+ var scope;
219
235
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
220
236
  while (1) switch (_context3.prev = _context3.next) {
221
237
  case 0:
222
- _context3.next = 2;
238
+ if (this.destroyed) {
239
+ _context3.next = 20;
240
+ break;
241
+ }
242
+ this.syncScheduleCatalogScope();
243
+ scope = this.scheduleCatalogScope;
244
+ _context3.prev = 3;
245
+ _context3.next = 6;
246
+ return this.loadAllSchedule();
247
+ case 6:
248
+ _context3.next = 15;
249
+ break;
250
+ case 8:
251
+ _context3.prev = 8;
252
+ _context3.t0 = _context3["catch"](3);
253
+ if (!this.destroyed) {
254
+ _context3.next = 12;
255
+ break;
256
+ }
257
+ throw Object.assign(new Error('Schedule catalog was closed'), {
258
+ name: 'AbortError'
259
+ });
260
+ case 12:
261
+ this.syncScheduleCatalogScope();
262
+ if (!(scope === this.scheduleCatalogScope)) {
263
+ _context3.next = 15;
264
+ break;
265
+ }
266
+ throw _context3.t0;
267
+ case 15:
268
+ this.syncScheduleCatalogScope();
269
+ if (!(!this.destroyed && this.hasLoadedScheduleList && !this.scheduleListPromise)) {
270
+ _context3.next = 18;
271
+ break;
272
+ }
273
+ return _context3.abrupt("return");
274
+ case 18:
275
+ _context3.next = 0;
276
+ break;
277
+ case 20:
278
+ throw Object.assign(new Error('Schedule catalog was closed'), {
279
+ name: 'AbortError'
280
+ });
281
+ case 21:
282
+ case "end":
283
+ return _context3.stop();
284
+ }
285
+ }, _callee3, this, [[3, 8]]);
286
+ }));
287
+ function ensureScheduleReady() {
288
+ return _ensureScheduleReady.apply(this, arguments);
289
+ }
290
+ return ensureScheduleReady;
291
+ }())
292
+ }, {
293
+ key: "loadScheduleCatalog",
294
+ value: function () {
295
+ var _loadScheduleCatalog = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(useCache, requestVersion) {
296
+ var _response$data;
297
+ var response, _response$data2;
298
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
299
+ while (1) switch (_context4.prev = _context4.next) {
300
+ case 0:
301
+ _context4.next = 2;
223
302
  return this.request.get("/schedule", {
224
303
  num: 999
225
- }, {
226
- useCache: useCache
227
- });
304
+ }, _objectSpread({
305
+ useCache: this.otherParams.scheduleCatalogCache === 'memory' ? false : useCache
306
+ }, this.otherParams.bookingRead ? {
307
+ bookingRead: true
308
+ } : {}));
228
309
  case 2:
229
- response = _context3.sent;
310
+ response = _context4.sent;
230
311
  if (!(response.code !== undefined && Number(response.code) !== 200 || response.status === false || typeof response.status === 'number' && response.status >= 400 || response.success === false)) {
231
- _context3.next = 5;
312
+ _context4.next = 5;
232
313
  break;
233
314
  }
234
315
  throw new Error(response.message || 'Schedule catalog request failed');
235
316
  case 5:
317
+ if (!((this.otherParams.bookingRead || this.otherParams.scheduleCatalogCache === 'memory') && !isBookingScheduleList(response === null || response === void 0 || (_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.list))) {
318
+ _context4.next = 7;
319
+ break;
320
+ }
321
+ throw new Error('Invalid schedule catalog response');
322
+ case 7:
236
323
  this.syncScheduleCatalogScope();
237
324
  // A refresh or a different runtime may have superseded this request.
238
325
  if (requestVersion === this.scheduleListRequestVersion) {
239
- this.setScheduleList(((_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.list) || []);
326
+ this.setScheduleList(((_response$data2 = response.data) === null || _response$data2 === void 0 ? void 0 : _response$data2.list) || []);
240
327
  }
241
- case 7:
328
+ case 9:
242
329
  case "end":
243
- return _context3.stop();
330
+ return _context4.stop();
244
331
  }
245
- }, _callee3, this);
332
+ }, _callee4, this);
246
333
  }));
247
334
  function loadScheduleCatalog(_x3, _x4) {
248
335
  return _loadScheduleCatalog.apply(this, arguments);
@@ -256,6 +343,7 @@ export var ScheduleModule = /*#__PURE__*/function (_BaseModule) {
256
343
  this.store.scheduleList = list;
257
344
  this.syncScheduleMap();
258
345
  this.hasLoadedScheduleList = true;
346
+ this.catalogVersion += 1;
259
347
  }
260
348
  }, {
261
349
  key: "syncScheduleMap",
@@ -279,13 +367,15 @@ export var ScheduleModule = /*#__PURE__*/function (_BaseModule) {
279
367
  }, {
280
368
  key: "loadScheduleAvailableDate",
281
369
  value: function () {
282
- var _loadScheduleAvailableDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(_ref) {
283
- var startDate, endDate, custom_page_id, channel, dates, res, responseData, dateList, otherProductIds;
284
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
285
- while (1) switch (_context4.prev = _context4.next) {
370
+ var _loadScheduleAvailableDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(_ref) {
371
+ var startDate, endDate, custom_page_id, channel, assertCurrent, requestVersion, scope, dates, res, response, responseData, dateList, otherProductIds;
372
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
373
+ while (1) switch (_context5.prev = _context5.next) {
286
374
  case 0:
287
- startDate = _ref.startDate, endDate = _ref.endDate, custom_page_id = _ref.custom_page_id, channel = _ref.channel;
288
- // 前端传递的 startDate,可能是今天之前的,如果 startDate 小于今天,需要把 startDate 置为今天
375
+ startDate = _ref.startDate, endDate = _ref.endDate, custom_page_id = _ref.custom_page_id, channel = _ref.channel, assertCurrent = _ref.assertCurrent;
376
+ this.syncScheduleCatalogScope();
377
+ requestVersion = ++this.availabilityRequestVersion;
378
+ scope = this.scheduleCatalogScope; // 前端传递的 startDate,可能是今天之前的,如果 startDate 小于今天,需要把 startDate 置为今天
289
379
  if (dayjs(startDate).isBefore(dayjs(), 'day')) {
290
380
  startDate = dayjs().format('YYYY-MM-DD');
291
381
  }
@@ -294,20 +384,46 @@ export var ScheduleModule = /*#__PURE__*/function (_BaseModule) {
294
384
  dates = disableAllDates(dates);
295
385
  // 如果 endDate 在今天之前,则不用查接口,直接返回 dates
296
386
  if (!dayjs(endDate).isBefore(dayjs(), 'day')) {
297
- _context4.next = 6;
387
+ _context5.next = 9;
298
388
  break;
299
389
  }
300
- return _context4.abrupt("return", dates);
301
- case 6:
302
- _context4.next = 8;
390
+ return _context5.abrupt("return", dates);
391
+ case 9:
392
+ _context5.next = 11;
303
393
  return this.request.get("/schedule/product/availability/v2", {
304
394
  start_date: startDate,
305
395
  end_date: endDate,
306
396
  custom_page_id: custom_page_id,
307
397
  channel: channel
398
+ }, this.otherParams.bookingRead ? {
399
+ bookingRead: true
400
+ } : undefined).catch(function (error) {
401
+ assertCurrent === null || assertCurrent === void 0 || assertCurrent();
402
+ throw error;
308
403
  });
309
- case 8:
310
- res = _context4.sent;
404
+ case 11:
405
+ res = _context5.sent;
406
+ assertCurrent === null || assertCurrent === void 0 || assertCurrent();
407
+ if (!this.otherParams.bookingRead) {
408
+ _context5.next = 20;
409
+ break;
410
+ }
411
+ response = res;
412
+ if (!(!response || response.code !== undefined && Number(response.code) !== 200 || response.status === false || response.success === false || typeof response.status === 'number' && response.status >= 400 || !isBookingAvailabilityData(response.data))) {
413
+ _context5.next = 17;
414
+ break;
415
+ }
416
+ throw new Error((response === null || response === void 0 ? void 0 : response.message) || 'Invalid schedule availability response');
417
+ case 17:
418
+ this.syncScheduleCatalogScope();
419
+ if (!(this.destroyed || scope !== this.scheduleCatalogScope || requestVersion !== this.availabilityRequestVersion)) {
420
+ _context5.next = 20;
421
+ break;
422
+ }
423
+ throw Object.assign(new Error('Schedule availability context changed'), {
424
+ name: 'AbortError'
425
+ });
426
+ case 20:
311
427
  responseData = res.data || {};
312
428
  dateList = Array.isArray(responseData.date_list) ? responseData.date_list : [];
313
429
  otherProductIds = Array.isArray(responseData.other_product_ids) ? responseData.other_product_ids : [];
@@ -315,11 +431,11 @@ export var ScheduleModule = /*#__PURE__*/function (_BaseModule) {
315
431
  this.setOtherProductsIds(otherProductIds);
316
432
  // 如果没有schedule或者结束日期在今天之前,则所有日期均不可用
317
433
  if (!(!dateList.length && !otherProductIds.length || dayjs(endDate).isBefore(dayjs(), 'day'))) {
318
- _context4.next = 16;
434
+ _context5.next = 27;
319
435
  break;
320
436
  }
321
- return _context4.abrupt("return", dates);
322
- case 16:
437
+ return _context5.abrupt("return", dates);
438
+ case 27:
323
439
  if (otherProductIds.length) {
324
440
  // 如果后端有返回 other_product_ids ,意味着有 duration 商品,则今天以及今天以后的日期均可用
325
441
  dates.forEach(function (n) {
@@ -336,12 +452,12 @@ export var ScheduleModule = /*#__PURE__*/function (_BaseModule) {
336
452
  });
337
453
  }
338
454
  dates = disableDatesBeforeOneDay(dates);
339
- return _context4.abrupt("return", dates);
340
- case 19:
455
+ return _context5.abrupt("return", dates);
456
+ case 30:
341
457
  case "end":
342
- return _context4.stop();
458
+ return _context5.stop();
343
459
  }
344
- }, _callee4, this);
460
+ }, _callee5, this);
345
461
  }));
346
462
  function loadScheduleAvailableDate(_x5) {
347
463
  return _loadScheduleAvailableDate.apply(this, arguments);
@@ -397,7 +513,7 @@ export var ScheduleModule = /*#__PURE__*/function (_BaseModule) {
397
513
  cacheId: this.cacheId,
398
514
  fatherModule: this.fatherModule,
399
515
  store: store,
400
- cacheKey: ['scheduleList', 'availabilityDateList', 'otherProductsIds']
516
+ cacheKey: this.otherParams.scheduleCatalogCache === 'memory' ? ['availabilityDateList', 'otherProductsIds'] : ['scheduleList', 'availabilityDateList', 'otherProductsIds']
401
517
  });
402
518
  }
403
519
  }
@@ -15,6 +15,8 @@ export type ScheduleAvailabilityDateItem = {
15
15
  * 加载日程可用日期参数接口
16
16
  */
17
17
  export interface LoadScheduleAvailableDateParams {
18
+ /** Caller lifecycle guard, checked before committing availability. */
19
+ assertCurrent?: () => void;
18
20
  /** 开始日期 */
19
21
  startDate: string;
20
22
  /** 结束日期 */
@@ -0,0 +1,6 @@
1
+ /** Validate only the catalog fields consumed by booking reads, not display metadata. */
2
+ export declare const isBookingScheduleList: (value: unknown) => boolean;
3
+ /** Empty resource/time/event arrays and zero capacity are valid successful results. */
4
+ export declare const isBookingResourceList: (value: unknown) => boolean;
5
+ /** The availability endpoint may return either or both lists. */
6
+ export declare const isBookingAvailabilityData: (value: unknown) => boolean;
@@ -0,0 +1,72 @@
1
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3
+ 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); }
4
+ 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; }
5
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
6
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
+ 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); }
8
+ import dayjs from 'dayjs';
9
+ var isRecord = function isRecord(value) {
10
+ return value !== null && _typeof(value) === 'object' && !Array.isArray(value);
11
+ };
12
+ var isNumericValue = function isNumericValue(value) {
13
+ return (typeof value === 'number' || typeof value === 'string' && value.trim() !== '') && Number.isFinite(Number(value));
14
+ };
15
+ var isDateValue = function isDateValue(value) {
16
+ if (typeof value !== 'string' || !value.trim() || !dayjs(value).isValid()) return false;
17
+ // dayjs accepts overflowing calendar components; do not turn them into another date.
18
+ var dateParts = /^(\d{4})-(\d{2})-(\d{2})(?:$|[ T])/.exec(value);
19
+ if (!dateParts) return true;
20
+ var _dateParts$map = dateParts.map(Number),
21
+ _dateParts$map2 = _slicedToArray(_dateParts$map, 4),
22
+ year = _dateParts$map2[1],
23
+ month = _dateParts$map2[2],
24
+ date = _dateParts$map2[3];
25
+ var calendarDate = new Date(0);
26
+ calendarDate.setUTCFullYear(year, month - 1, date);
27
+ return calendarDate.getUTCFullYear() === year && calendarDate.getUTCMonth() === month - 1 && calendarDate.getUTCDate() === date;
28
+ };
29
+ var isRecordArray = function isRecordArray(value) {
30
+ return Array.isArray(value) && value.every(isRecord);
31
+ };
32
+
33
+ /** Validate only the catalog fields consumed by booking reads, not display metadata. */
34
+ export var isBookingScheduleList = function isBookingScheduleList(value) {
35
+ return Array.isArray(value) && value.every(function (schedule) {
36
+ if (!isRecord(schedule) || !isNumericValue(schedule.id)) return false;
37
+ if (schedule.type === 'time-slots' && !isRecordArray(schedule.time_slot)) return false;
38
+ if (schedule.type === 'designation' && !isRecord(schedule.designation) && !isRecordArray(schedule.designation)) return false;
39
+ if ((schedule.repeat_type === 'daily' || schedule.repeat_type === 'weekly') && !isRecord(schedule.repeat_rule)) return false;
40
+ if (schedule.repeat_rule !== undefined && schedule.repeat_rule !== null) {
41
+ if (!isRecord(schedule.repeat_rule)) return false;
42
+ var rule = schedule.repeat_rule;
43
+ if (rule.end !== undefined && rule.end !== null && !isRecord(rule.end)) return false;
44
+ for (var _i = 0, _arr = ['excluded_date', 'included_date', 'frequency_date']; _i < _arr.length; _i++) {
45
+ var key = _arr[_i];
46
+ if (rule[key] !== undefined && rule[key] !== null && !Array.isArray(rule[key])) return false;
47
+ }
48
+ }
49
+ return true;
50
+ });
51
+ };
52
+
53
+ /** Empty resource/time/event arrays and zero capacity are valid successful results. */
54
+ export var isBookingResourceList = function isBookingResourceList(value) {
55
+ return Array.isArray(value) && value.every(function (resource) {
56
+ if (!isRecord(resource) || !isNumericValue(resource.id) || !isNumericValue(resource.form_id) || !Array.isArray(resource.times)) return false;
57
+ if (resource.capacity !== undefined && !isNumericValue(resource.capacity)) return false;
58
+ return resource.times.every(function (time) {
59
+ return isRecord(time) && isDateValue(time.start_at) && isDateValue(time.end_at) && (time.event_list === undefined || isRecordArray(time.event_list));
60
+ });
61
+ });
62
+ };
63
+
64
+ /** The availability endpoint may return either or both lists. */
65
+ export var isBookingAvailabilityData = function isBookingAvailabilityData(value) {
66
+ if (!isRecord(value) || value.date_list === undefined && value.other_product_ids === undefined) return false;
67
+ if (value.date_list !== undefined && (!Array.isArray(value.date_list) || !value.date_list.every(function (date) {
68
+ return isRecord(date) && isDateValue(date.date);
69
+ }))) return false;
70
+ if (value.other_product_ids !== undefined && (!Array.isArray(value.other_product_ids) || !value.other_product_ids.every(isNumericValue))) return false;
71
+ return true;
72
+ };
@@ -56,6 +56,8 @@ export interface CacheProps {
56
56
  * 请求配置
57
57
  */
58
58
  export interface RequestOptions {
59
+ /** Opt in to the host's bounded retry policy for booking availability GETs. */
60
+ bookingRead?: boolean;
59
61
  /** Customer-only, credential-free GET /open/document/{id} on picoding. */
60
62
  publicInvoiceDocument?: boolean;
61
63
  /** Route through the host's configured picoding environment. */
@@ -64,6 +64,7 @@ declare class Server {
64
64
  private salesSearchSubscribers;
65
65
  private deviceTaskActionsRegistered;
66
66
  private localPaymentUpdateQueues;
67
+ private paymentIdentityRefreshes;
67
68
  private floorPlanQuerySubscribers;
68
69
  private moduleRegistry;
69
70
  constructor(core: PisellCore);
@@ -133,6 +134,8 @@ declare class Server {
133
134
  private resolveKioskCheckoutOperatorId;
134
135
  private mergeCheckoutSyncPayments;
135
136
  private persistSyncedCheckoutOrder;
137
+ private hasPaidPaymentWithoutId;
138
+ private refreshMissingPaymentIds;
136
139
  /**
137
140
  * 将普通层 QuotationModule 的报价单计算能力桥接到 Server Products 模块。
138
141
  */
@@ -560,6 +563,8 @@ declare class Server {
560
563
  * Android 结账自动小票由当前设备设置控制;其它平台保持原有行为。
561
564
  */
562
565
  private shouldAutoPrintCheckoutReceipt;
566
+ /** Only receipt auto-printing uses this policy; vouchers retain their paid-order gate. */
567
+ private shouldAutoPrintReceiptForPaymentStatus;
563
568
  private shouldBuildSmallTicketData;
564
569
  private shouldPrintSyncedOrder;
565
570
  private hasPaymentStatus;