@pisell/pisellos 0.10.57 → 0.10.58
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.
- package/dist/model/strategy/adapter/promotion/index.js +9 -0
- package/dist/modules/Order/index.d.ts +1 -1
- package/dist/modules/Order/utils.d.ts +5 -3
- package/dist/modules/Order/utils.js +32 -11
- package/dist/modules/ProductList/index.d.ts +3 -1
- package/dist/modules/ProductList/index.js +187 -92
- package/dist/modules/ProductList/types.d.ts +8 -0
- package/dist/modules/ProductList/types.js +2 -0
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/UnifiedBookingSales/index.d.ts +7 -1
- package/dist/solution/UnifiedBookingSales/index.js +548 -388
- package/lib/modules/Order/index.d.ts +1 -1
- package/lib/modules/Order/utils.d.ts +5 -3
- package/lib/modules/Order/utils.js +29 -10
- package/lib/modules/ProductList/index.d.ts +3 -1
- package/lib/modules/ProductList/index.js +31 -5
- package/lib/modules/ProductList/types.d.ts +8 -0
- package/lib/modules/ProductList/types.js +1 -0
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/UnifiedBookingSales/index.d.ts +7 -1
- package/lib/solution/UnifiedBookingSales/index.js +80 -1
- package/package.json +1 -1
|
@@ -102,18 +102,102 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
|
|
|
102
102
|
this.otherParams = params || {};
|
|
103
103
|
}
|
|
104
104
|
}, {
|
|
105
|
-
key: "
|
|
105
|
+
key: "enrichProducts",
|
|
106
106
|
value: function () {
|
|
107
|
-
var
|
|
107
|
+
var _enrichProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(products, context) {
|
|
108
|
+
var _context$signal, _context$signal2;
|
|
109
|
+
var enrich, result;
|
|
108
110
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
109
111
|
while (1) switch (_context2.prev = _context2.next) {
|
|
110
112
|
case 0:
|
|
113
|
+
enrich = this.otherParams.enrichProducts;
|
|
114
|
+
if (enrich) {
|
|
115
|
+
_context2.next = 3;
|
|
116
|
+
break;
|
|
117
|
+
}
|
|
118
|
+
return _context2.abrupt("return", products);
|
|
119
|
+
case 3:
|
|
120
|
+
if (!((_context$signal = context.signal) !== null && _context$signal !== void 0 && _context$signal.aborted)) {
|
|
121
|
+
_context2.next = 5;
|
|
122
|
+
break;
|
|
123
|
+
}
|
|
124
|
+
throw new Error('Product enrichment cancelled');
|
|
125
|
+
case 5:
|
|
126
|
+
_context2.next = 7;
|
|
127
|
+
return enrich(cloneDeep(products), _objectSpread({
|
|
128
|
+
businessCode: this.otherParams.businessCode,
|
|
129
|
+
channel: this.otherParams.channel
|
|
130
|
+
}, context));
|
|
131
|
+
case 7:
|
|
132
|
+
result = _context2.sent;
|
|
133
|
+
if (!((_context$signal2 = context.signal) !== null && _context$signal2 !== void 0 && _context$signal2.aborted)) {
|
|
134
|
+
_context2.next = 10;
|
|
135
|
+
break;
|
|
136
|
+
}
|
|
137
|
+
throw new Error('Product enrichment cancelled');
|
|
138
|
+
case 10:
|
|
139
|
+
if (Array.isArray(result)) {
|
|
140
|
+
_context2.next = 12;
|
|
141
|
+
break;
|
|
142
|
+
}
|
|
143
|
+
throw new Error('Product enrichment must return an array');
|
|
144
|
+
case 12:
|
|
145
|
+
return _context2.abrupt("return", result);
|
|
146
|
+
case 13:
|
|
111
147
|
case "end":
|
|
112
148
|
return _context2.stop();
|
|
113
149
|
}
|
|
114
|
-
}, _callee2);
|
|
150
|
+
}, _callee2, this);
|
|
151
|
+
}));
|
|
152
|
+
function enrichProducts(_x3, _x4) {
|
|
153
|
+
return _enrichProducts.apply(this, arguments);
|
|
154
|
+
}
|
|
155
|
+
return enrichProducts;
|
|
156
|
+
}()
|
|
157
|
+
}, {
|
|
158
|
+
key: "enrichCatalog",
|
|
159
|
+
value: function () {
|
|
160
|
+
var _enrichCatalog = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(products, reason) {
|
|
161
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
162
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
163
|
+
case 0:
|
|
164
|
+
_context3.prev = 0;
|
|
165
|
+
_context3.next = 3;
|
|
166
|
+
return this.enrichProducts(products, {
|
|
167
|
+
reason: reason
|
|
168
|
+
});
|
|
169
|
+
case 3:
|
|
170
|
+
return _context3.abrupt("return", _context3.sent);
|
|
171
|
+
case 6:
|
|
172
|
+
_context3.prev = 6;
|
|
173
|
+
_context3.t0 = _context3["catch"](0);
|
|
174
|
+
// An unavailable supplementary source is not zero stock or an empty catalog.
|
|
175
|
+
console.warn('[ProductList] Supplementary product data could not be refreshed');
|
|
176
|
+
return _context3.abrupt("return", products);
|
|
177
|
+
case 10:
|
|
178
|
+
case "end":
|
|
179
|
+
return _context3.stop();
|
|
180
|
+
}
|
|
181
|
+
}, _callee3, this, [[0, 6]]);
|
|
115
182
|
}));
|
|
116
|
-
function
|
|
183
|
+
function enrichCatalog(_x5, _x6) {
|
|
184
|
+
return _enrichCatalog.apply(this, arguments);
|
|
185
|
+
}
|
|
186
|
+
return enrichCatalog;
|
|
187
|
+
}()
|
|
188
|
+
}, {
|
|
189
|
+
key: "storeChange",
|
|
190
|
+
value: function () {
|
|
191
|
+
var _storeChange = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(path, value) {
|
|
192
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
193
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
194
|
+
case 0:
|
|
195
|
+
case "end":
|
|
196
|
+
return _context4.stop();
|
|
197
|
+
}
|
|
198
|
+
}, _callee4);
|
|
199
|
+
}));
|
|
200
|
+
function storeChange(_x7, _x8) {
|
|
117
201
|
return _storeChange.apply(this, arguments);
|
|
118
202
|
}
|
|
119
203
|
return storeChange;
|
|
@@ -127,14 +211,14 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
|
|
|
127
211
|
}, {
|
|
128
212
|
key: "getAddTimeProducts",
|
|
129
213
|
value: (function () {
|
|
130
|
-
var _getAddTimeProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
214
|
+
var _getAddTimeProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
131
215
|
var params,
|
|
132
|
-
|
|
133
|
-
return _regeneratorRuntime().wrap(function
|
|
134
|
-
while (1) switch (
|
|
216
|
+
_args5 = arguments;
|
|
217
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
218
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
135
219
|
case 0:
|
|
136
|
-
params =
|
|
137
|
-
return
|
|
220
|
+
params = _args5.length > 0 && _args5[0] !== undefined ? _args5[0] : {};
|
|
221
|
+
return _context5.abrupt("return", this.loadProducts(_objectSpread(_objectSpread({
|
|
138
222
|
schedule_date: dayjs().format('YYYY-MM-DD'),
|
|
139
223
|
status: 'published'
|
|
140
224
|
}, params), {}, {
|
|
@@ -142,9 +226,9 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
|
|
|
142
226
|
})));
|
|
143
227
|
case 2:
|
|
144
228
|
case "end":
|
|
145
|
-
return
|
|
229
|
+
return _context5.stop();
|
|
146
230
|
}
|
|
147
|
-
},
|
|
231
|
+
}, _callee5, this);
|
|
148
232
|
}));
|
|
149
233
|
function getAddTimeProducts() {
|
|
150
234
|
return _getAddTimeProducts.apply(this, arguments);
|
|
@@ -154,7 +238,7 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
|
|
|
154
238
|
}, {
|
|
155
239
|
key: "loadProducts",
|
|
156
240
|
value: function () {
|
|
157
|
-
var _loadProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
241
|
+
var _loadProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
|
|
158
242
|
var _this$otherParams,
|
|
159
243
|
_this$otherParams$bus,
|
|
160
244
|
_this$otherParams2,
|
|
@@ -196,13 +280,14 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
|
|
|
196
280
|
subscriptionCallback,
|
|
197
281
|
productsData,
|
|
198
282
|
resolvedList,
|
|
283
|
+
enrichedList,
|
|
199
284
|
sortedList,
|
|
200
|
-
|
|
201
|
-
return _regeneratorRuntime().wrap(function
|
|
202
|
-
while (1) switch (
|
|
285
|
+
_args7 = arguments;
|
|
286
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
287
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
203
288
|
case 0:
|
|
204
|
-
_ref =
|
|
205
|
-
options =
|
|
289
|
+
_ref = _args7.length > 0 && _args7[0] !== undefined ? _args7[0] : {}, _ref$category_ids = _ref.category_ids, category_ids = _ref$category_ids === void 0 ? [] : _ref$category_ids, _ref$product_ids = _ref.product_ids, product_ids = _ref$product_ids === void 0 ? [] : _ref$product_ids, _ref$collection = _ref.collection, collection = _ref$collection === void 0 ? [] : _ref$collection, _ref$menu_list_ids = _ref.menu_list_ids, menu_list_ids = _ref$menu_list_ids === void 0 ? [] : _ref$menu_list_ids, paramsCustomerId = _ref.customer_id, _ref$with_count = _ref.with_count, with_count = _ref$with_count === void 0 ? [] : _ref$with_count, schedule_datetime = _ref.schedule_datetime, schedule_date = _ref.schedule_date, cacheId = _ref.cacheId, with_schedule = _ref.with_schedule, extension_type = _ref.extension_type, _ref$status = _ref.status, status = _ref$status === void 0 ? 'published' : _ref$status, strategy_context = _ref.strategy_context;
|
|
290
|
+
options = _args7.length > 1 ? _args7[1] : undefined;
|
|
206
291
|
// // 如果 schedule_ids 为空,则需要尝试从 schedule 模块里获取
|
|
207
292
|
// if (!schedule_ids?.length) {
|
|
208
293
|
// const schedule_ids_data = this.store.schedule
|
|
@@ -274,19 +359,19 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
|
|
|
274
359
|
handledByOsServer = isProductQueryHandledByOsServer(this.core, this.request);
|
|
275
360
|
originalCallback = typeof (options === null || options === void 0 ? void 0 : options.callback) === 'function' ? options.callback : undefined;
|
|
276
361
|
subscriptionCallback = originalCallback ? ( /*#__PURE__*/function () {
|
|
277
|
-
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
362
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(result) {
|
|
278
363
|
var _result$data;
|
|
279
|
-
var callbackList, resolvedCallbackList;
|
|
280
|
-
return _regeneratorRuntime().wrap(function
|
|
281
|
-
while (1) switch (
|
|
364
|
+
var callbackList, resolvedCallbackList, enrichedCallbackList;
|
|
365
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
366
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
282
367
|
case 0:
|
|
283
368
|
callbackList = result === null || result === void 0 || (_result$data = result.data) === null || _result$data === void 0 ? void 0 : _result$data.list;
|
|
284
369
|
if (Array.isArray(callbackList)) {
|
|
285
|
-
|
|
370
|
+
_context6.next = 4;
|
|
286
371
|
break;
|
|
287
372
|
}
|
|
288
373
|
originalCallback(result);
|
|
289
|
-
return
|
|
374
|
+
return _context6.abrupt("return");
|
|
290
375
|
case 4:
|
|
291
376
|
if (!handledByOsServer) {
|
|
292
377
|
// Subscription payloads may contain only changed products, so keep
|
|
@@ -300,25 +385,29 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
|
|
|
300
385
|
queryPayload: queryPayload,
|
|
301
386
|
handledByOsServer: handledByOsServer
|
|
302
387
|
});
|
|
303
|
-
|
|
304
|
-
return _this2.
|
|
388
|
+
_context6.next = 8;
|
|
389
|
+
return _this2.enrichCatalog(resolvedCallbackList, 'catalog-update');
|
|
305
390
|
case 8:
|
|
306
|
-
|
|
391
|
+
enrichedCallbackList = _context6.sent;
|
|
392
|
+
_context6.next = 11;
|
|
393
|
+
return _this2.addProduct(enrichedCallbackList);
|
|
394
|
+
case 11:
|
|
395
|
+
originalCallback(enrichedCallbackList === callbackList ? result : _objectSpread(_objectSpread({}, result), {}, {
|
|
307
396
|
data: _objectSpread(_objectSpread({}, result.data), {}, {
|
|
308
|
-
list:
|
|
397
|
+
list: enrichedCallbackList
|
|
309
398
|
})
|
|
310
399
|
}));
|
|
311
|
-
case
|
|
400
|
+
case 12:
|
|
312
401
|
case "end":
|
|
313
|
-
return
|
|
402
|
+
return _context6.stop();
|
|
314
403
|
}
|
|
315
|
-
},
|
|
404
|
+
}, _callee6);
|
|
316
405
|
}));
|
|
317
|
-
return function (
|
|
406
|
+
return function (_x9) {
|
|
318
407
|
return _ref2.apply(this, arguments);
|
|
319
408
|
};
|
|
320
409
|
}()) : undefined;
|
|
321
|
-
|
|
410
|
+
_context7.next = 16;
|
|
322
411
|
return this.request.post("/product/query", queryPayload, {
|
|
323
412
|
osServer: true,
|
|
324
413
|
callback: subscriptionCallback,
|
|
@@ -326,7 +415,7 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
|
|
|
326
415
|
customToast: function customToast() {}
|
|
327
416
|
});
|
|
328
417
|
case 16:
|
|
329
|
-
productsData =
|
|
418
|
+
productsData = _context7.sent;
|
|
330
419
|
if (!handledByOsServer && Array.isArray(productsData.data.list)) {
|
|
331
420
|
this.replaceRawProductQueryResult(productsData.data.list, product_ids);
|
|
332
421
|
}
|
|
@@ -337,7 +426,11 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
|
|
|
337
426
|
queryPayload: queryPayload,
|
|
338
427
|
handledByOsServer: handledByOsServer
|
|
339
428
|
});
|
|
340
|
-
|
|
429
|
+
_context7.next = 21;
|
|
430
|
+
return this.enrichCatalog(resolvedList, 'catalog');
|
|
431
|
+
case 21:
|
|
432
|
+
enrichedList = _context7.sent;
|
|
433
|
+
sortedList = enrichedList.slice().sort(function (a, b) {
|
|
341
434
|
return Number(b.sort) - Number(a.sort);
|
|
342
435
|
}); // if (sortedList.length) {
|
|
343
436
|
// sortedList.forEach((n: any) => {
|
|
@@ -346,13 +439,15 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
|
|
|
346
439
|
// }
|
|
347
440
|
// })
|
|
348
441
|
// }
|
|
349
|
-
|
|
350
|
-
return
|
|
351
|
-
case
|
|
442
|
+
_context7.next = 25;
|
|
443
|
+
return this.addProduct(sortedList);
|
|
444
|
+
case 25:
|
|
445
|
+
return _context7.abrupt("return", sortedList);
|
|
446
|
+
case 26:
|
|
352
447
|
case "end":
|
|
353
|
-
return
|
|
448
|
+
return _context7.stop();
|
|
354
449
|
}
|
|
355
|
-
},
|
|
450
|
+
}, _callee7, this);
|
|
356
451
|
}));
|
|
357
452
|
function loadProducts() {
|
|
358
453
|
return _loadProducts.apply(this, arguments);
|
|
@@ -362,13 +457,13 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
|
|
|
362
457
|
}, {
|
|
363
458
|
key: "loadProductsPrice",
|
|
364
459
|
value: function () {
|
|
365
|
-
var _loadProductsPrice = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
460
|
+
var _loadProductsPrice = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(_ref3) {
|
|
366
461
|
var _ref3$ids, ids, customer_id, schedule_date, channel, productsData;
|
|
367
|
-
return _regeneratorRuntime().wrap(function
|
|
368
|
-
while (1) switch (
|
|
462
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
463
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
369
464
|
case 0:
|
|
370
465
|
_ref3$ids = _ref3.ids, ids = _ref3$ids === void 0 ? [] : _ref3$ids, customer_id = _ref3.customer_id, schedule_date = _ref3.schedule_date, channel = _ref3.channel;
|
|
371
|
-
|
|
466
|
+
_context8.next = 3;
|
|
372
467
|
return this.request.post("/product/query/price", {
|
|
373
468
|
ids: ids,
|
|
374
469
|
customer_id: customer_id,
|
|
@@ -378,15 +473,15 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
|
|
|
378
473
|
useCache: true
|
|
379
474
|
});
|
|
380
475
|
case 3:
|
|
381
|
-
productsData =
|
|
382
|
-
return
|
|
476
|
+
productsData = _context8.sent;
|
|
477
|
+
return _context8.abrupt("return", productsData.data);
|
|
383
478
|
case 5:
|
|
384
479
|
case "end":
|
|
385
|
-
return
|
|
480
|
+
return _context8.stop();
|
|
386
481
|
}
|
|
387
|
-
},
|
|
482
|
+
}, _callee8, this);
|
|
388
483
|
}));
|
|
389
|
-
function loadProductsPrice(
|
|
484
|
+
function loadProductsPrice(_x10) {
|
|
390
485
|
return _loadProductsPrice.apply(this, arguments);
|
|
391
486
|
}
|
|
392
487
|
return loadProductsPrice;
|
|
@@ -448,19 +543,19 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
|
|
|
448
543
|
}, {
|
|
449
544
|
key: "getProducts",
|
|
450
545
|
value: function () {
|
|
451
|
-
var _getProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
452
|
-
return _regeneratorRuntime().wrap(function
|
|
453
|
-
while (1) switch (
|
|
546
|
+
var _getProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
|
|
547
|
+
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
548
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
454
549
|
case 0:
|
|
455
|
-
|
|
550
|
+
_context9.next = 2;
|
|
456
551
|
return this.core.effects.emit("".concat(this.name, ":onGetProducts"), this.store.list);
|
|
457
552
|
case 2:
|
|
458
|
-
return
|
|
553
|
+
return _context9.abrupt("return", cloneDeep(this.store.list));
|
|
459
554
|
case 3:
|
|
460
555
|
case "end":
|
|
461
|
-
return
|
|
556
|
+
return _context9.stop();
|
|
462
557
|
}
|
|
463
|
-
},
|
|
558
|
+
}, _callee9, this);
|
|
464
559
|
}));
|
|
465
560
|
function getProducts() {
|
|
466
561
|
return _getProducts.apply(this, arguments);
|
|
@@ -470,25 +565,25 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
|
|
|
470
565
|
}, {
|
|
471
566
|
key: "getProduct",
|
|
472
567
|
value: function () {
|
|
473
|
-
var _getProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
568
|
+
var _getProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(id) {
|
|
474
569
|
var product;
|
|
475
|
-
return _regeneratorRuntime().wrap(function
|
|
476
|
-
while (1) switch (
|
|
570
|
+
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
571
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
477
572
|
case 0:
|
|
478
|
-
|
|
573
|
+
_context10.next = 2;
|
|
479
574
|
return this.core.effects.emit("".concat(this.name, ":onGetProduct"), this.store.list);
|
|
480
575
|
case 2:
|
|
481
576
|
product = this.store.list.find(function (product) {
|
|
482
577
|
return product.id === id;
|
|
483
578
|
});
|
|
484
|
-
return
|
|
579
|
+
return _context10.abrupt("return", product ? cloneDeep(product) : undefined);
|
|
485
580
|
case 4:
|
|
486
581
|
case "end":
|
|
487
|
-
return
|
|
582
|
+
return _context10.stop();
|
|
488
583
|
}
|
|
489
|
-
},
|
|
584
|
+
}, _callee10, this);
|
|
490
585
|
}));
|
|
491
|
-
function getProduct(
|
|
586
|
+
function getProduct(_x11) {
|
|
492
587
|
return _getProduct.apply(this, arguments);
|
|
493
588
|
}
|
|
494
589
|
return getProduct;
|
|
@@ -496,7 +591,7 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
|
|
|
496
591
|
}, {
|
|
497
592
|
key: "queryProducts",
|
|
498
593
|
value: function () {
|
|
499
|
-
var _queryProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
594
|
+
var _queryProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
|
|
500
595
|
var params,
|
|
501
596
|
includeIds,
|
|
502
597
|
excludeIds,
|
|
@@ -507,11 +602,11 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
|
|
|
507
602
|
channelApplications,
|
|
508
603
|
codeOrBarcode,
|
|
509
604
|
products,
|
|
510
|
-
|
|
511
|
-
return _regeneratorRuntime().wrap(function
|
|
512
|
-
while (1) switch (
|
|
605
|
+
_args11 = arguments;
|
|
606
|
+
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
607
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
513
608
|
case 0:
|
|
514
|
-
params =
|
|
609
|
+
params = _args11.length > 0 && _args11[0] !== undefined ? _args11[0] : {};
|
|
515
610
|
includeIds = normalizeQuerySet(params.includeIds);
|
|
516
611
|
excludeIds = normalizeQuerySet(params.excludeIds);
|
|
517
612
|
categoryIds = normalizeQuerySet(params.categoryIds);
|
|
@@ -550,12 +645,12 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
|
|
|
550
645
|
}
|
|
551
646
|
return true;
|
|
552
647
|
});
|
|
553
|
-
return
|
|
648
|
+
return _context11.abrupt("return", cloneDeep(products));
|
|
554
649
|
case 11:
|
|
555
650
|
case "end":
|
|
556
|
-
return
|
|
651
|
+
return _context11.stop();
|
|
557
652
|
}
|
|
558
|
-
},
|
|
653
|
+
}, _callee11, this);
|
|
559
654
|
}));
|
|
560
655
|
function queryProducts() {
|
|
561
656
|
return _queryProducts.apply(this, arguments);
|
|
@@ -565,23 +660,23 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
|
|
|
565
660
|
}, {
|
|
566
661
|
key: "getProductByIds",
|
|
567
662
|
value: function () {
|
|
568
|
-
var _getProductByIds = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
569
|
-
return _regeneratorRuntime().wrap(function
|
|
570
|
-
while (1) switch (
|
|
663
|
+
var _getProductByIds = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(ids) {
|
|
664
|
+
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
665
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
571
666
|
case 0:
|
|
572
|
-
|
|
667
|
+
_context12.next = 2;
|
|
573
668
|
return this.core.effects.emit("".concat(this.name, ":onGetProductByIds"), this.store.list);
|
|
574
669
|
case 2:
|
|
575
|
-
return
|
|
670
|
+
return _context12.abrupt("return", this.queryProducts({
|
|
576
671
|
includeIds: ids
|
|
577
672
|
}));
|
|
578
673
|
case 3:
|
|
579
674
|
case "end":
|
|
580
|
-
return
|
|
675
|
+
return _context12.stop();
|
|
581
676
|
}
|
|
582
|
-
},
|
|
677
|
+
}, _callee12, this);
|
|
583
678
|
}));
|
|
584
|
-
function getProductByIds(
|
|
679
|
+
function getProductByIds(_x12) {
|
|
585
680
|
return _getProductByIds.apply(this, arguments);
|
|
586
681
|
}
|
|
587
682
|
return getProductByIds;
|
|
@@ -589,10 +684,10 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
|
|
|
589
684
|
}, {
|
|
590
685
|
key: "addProduct",
|
|
591
686
|
value: function () {
|
|
592
|
-
var _addProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
687
|
+
var _addProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(products) {
|
|
593
688
|
var _this6 = this;
|
|
594
|
-
return _regeneratorRuntime().wrap(function
|
|
595
|
-
while (1) switch (
|
|
689
|
+
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
690
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
596
691
|
case 0:
|
|
597
692
|
// list 需要根据 id 去重
|
|
598
693
|
if (!this.store.list) {
|
|
@@ -615,11 +710,11 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
|
|
|
615
710
|
this.core.effects.emit("".concat(this.name, ":changed"), this.store.list);
|
|
616
711
|
case 4:
|
|
617
712
|
case "end":
|
|
618
|
-
return
|
|
713
|
+
return _context13.stop();
|
|
619
714
|
}
|
|
620
|
-
},
|
|
715
|
+
}, _callee13, this);
|
|
621
716
|
}));
|
|
622
|
-
function addProduct(
|
|
717
|
+
function addProduct(_x13) {
|
|
623
718
|
return _addProduct.apply(this, arguments);
|
|
624
719
|
}
|
|
625
720
|
return addProduct;
|
|
@@ -627,18 +722,18 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
|
|
|
627
722
|
}, {
|
|
628
723
|
key: "selectProducts",
|
|
629
724
|
value: function () {
|
|
630
|
-
var _selectProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
631
|
-
return _regeneratorRuntime().wrap(function
|
|
632
|
-
while (1) switch (
|
|
725
|
+
var _selectProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(products) {
|
|
726
|
+
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
|
727
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
633
728
|
case 0:
|
|
634
729
|
this.store.selectProducts = products;
|
|
635
730
|
case 1:
|
|
636
731
|
case "end":
|
|
637
|
-
return
|
|
732
|
+
return _context14.stop();
|
|
638
733
|
}
|
|
639
|
-
},
|
|
734
|
+
}, _callee14, this);
|
|
640
735
|
}));
|
|
641
|
-
function selectProducts(
|
|
736
|
+
function selectProducts(_x14) {
|
|
642
737
|
return _selectProducts.apply(this, arguments);
|
|
643
738
|
}
|
|
644
739
|
return selectProducts;
|
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
import { ProductData } from '../Product/types';
|
|
2
|
+
/** Runtime-only enrichment; never serialized into a product query. */
|
|
3
|
+
export interface ProductEnrichmentContext {
|
|
4
|
+
reason: 'catalog' | 'catalog-update' | 'detail-open';
|
|
5
|
+
businessCode?: string;
|
|
6
|
+
channel?: string;
|
|
7
|
+
signal?: AbortSignal;
|
|
8
|
+
}
|
|
9
|
+
export type ProductEnricher = (products: ProductData[], context: ProductEnrichmentContext) => Promise<ProductData[]>;
|
|
2
10
|
export interface ProductListLoadProductsParams {
|
|
3
11
|
category_ids?: number[];
|
|
4
12
|
product_ids?: number[];
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
/** Runtime-only enrichment; never serialized into a product query. */
|
|
2
|
+
|
|
1
3
|
export var ProductListHooks = /*#__PURE__*/function (ProductListHooks) {
|
|
2
4
|
ProductListHooks["onGetProducts"] = "productList:onGetProducts";
|
|
3
5
|
ProductListHooks["onGetProduct"] = "productList:onGetProduct";
|
|
@@ -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 |
|
|
329
|
+
weekNum: 0 | 2 | 1 | 6 | 4 | 5 | 3;
|
|
330
330
|
}[]>;
|
|
331
331
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
332
332
|
private getScheduleDataByIds;
|
|
@@ -2,7 +2,7 @@ import type { Module, ModuleOptions, PisellCore } from '../../types';
|
|
|
2
2
|
import type { ProductData } from '../../modules';
|
|
3
3
|
import { type InvoiceLayoutConfig, type InvoiceTemplateSettings, type OpenDataConfig } from '../../modules/OpenData';
|
|
4
4
|
import type { LoadScheduleAvailableDateParams, ScheduleItem } from '../../modules/Schedule/types';
|
|
5
|
-
import type { ProductListLoadProductsParams, ProductListStoreQueryParams } from '../../modules/ProductList';
|
|
5
|
+
import type { ProductListLoadProductsParams, ProductListStoreQueryParams, ProductEnrichmentContext } from '../../modules/ProductList';
|
|
6
6
|
import type { AvailabilityDateRange, AvailabilityOccupancy, AvailabilityProduct, AvailabilityResource, GetProductTimeRangesRequest } from '../../modules/ResourcePlanner';
|
|
7
7
|
import type { AvailabilityContextRef, ContextualAvailabilityQuery, ContextualAvailabilityQueryResult, ContextualCommitAvailabilitySelectionParams, ContextualProductTimeRangeGroup, UnifiedBookingSalesAddRetailProductParams, UnifiedBookingSalesApplyPlannerDiscountsParams, UnifiedBookingSalesCommitAvailabilitySelectionResult, UnifiedBookingSalesDiscountResult, UnifiedBookingSalesLoadProductsByScheduleDateParams, UnifiedBookingSalesLoadOpenDataParams, UnifiedBookingSalesPrepareAvailabilityProjectionParams, UnifiedBookingSalesPolicyResponse, UnifiedBookingSalesResolveProductAllergyRequirementParams, UnifiedBookingSalesStageRetailProductsParams, UnifiedBookingSalesState } from './types';
|
|
8
8
|
import type { BusinessAvailability } from '../../modules/BusinessAvailability';
|
|
@@ -205,6 +205,12 @@ export declare class UnifiedBookingSalesImpl extends BookingTicket {
|
|
|
205
205
|
getProductCatalog(): {
|
|
206
206
|
products: ProductData[];
|
|
207
207
|
};
|
|
208
|
+
/** Detail reads share the catalog adapter, including when basic detail is cached. */
|
|
209
|
+
enrichProducts(products: ProductData[], context: ProductEnrichmentContext): Promise<ProductData[]>;
|
|
210
|
+
/** Apply only enrichment changes, never the cart's selection/price snapshot. */
|
|
211
|
+
applyProductEnrichment(before: ProductData, after: ProductData, context?: {
|
|
212
|
+
signal?: AbortSignal;
|
|
213
|
+
}): Promise<void>;
|
|
208
214
|
/**
|
|
209
215
|
* Read-only compatibility view for salesSdk skins. It reconnects a booking to its product but
|
|
210
216
|
* must not be used to mutate tempOrder; all writes go through BaseSales / planner APIs.
|