@pisell/pisellos 2.2.284 → 2.2.286

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.
@@ -1,9 +0,0 @@
1
- // 导出评估器
2
- export { PromotionEvaluator } from "./evaluator";
3
-
4
- // 导出适配器
5
- export { PromotionAdapter } from "./adapter";
6
- export { default } from "./adapter";
7
-
8
- // 导出策略配置示例常量
9
- export { X_ITEMS_FOR_Y_PRICE_STRATEGY, BUY_X_GET_Y_FREE_STRATEGY, ITEM_REWARD_STRATEGY } from "./examples";
@@ -5468,7 +5468,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
5468
5468
  var _syncPaymentsToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34(params) {
5469
5469
  var _this32 = this,
5470
5470
  _params$confirmPendin;
5471
- var tempOrder, needsPaymentNumber, devicePrefix, mappedPayments, shouldConfirmPendingVoucherPayments, effectivePayments, completion, orderPaidPaymentTotal, paymentStatus, paymentSyncIdempotencyToken, submitParams, submitResult;
5471
+ var tempOrder, needsPaymentNumber, devicePrefix, mappedPayments, shouldConfirmPendingVoucherPayments, effectivePayments, completion, orderPaidPaymentTotal, paymentStatus, paymentSyncIdempotencyToken, enhancePayload, submitParams, submitResult;
5472
5472
  return _regeneratorRuntime().wrap(function _callee34$(_context37) {
5473
5473
  while (1) switch (_context37.prev = _context37.next) {
5474
5474
  case 0:
@@ -5521,6 +5521,12 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
5521
5521
  case 25:
5522
5522
  this.store.syncState = 'submitting';
5523
5523
  paymentSyncIdempotencyToken = this.buildPaymentSyncIdempotencyToken(tempOrder, effectivePayments);
5524
+ enhancePayload = function enhancePayload(payload, ctx) {
5525
+ var enhancedPayload = params.enhancePayload ? params.enhancePayload(payload, ctx) : payload;
5526
+ return _objectSpread(_objectSpread({}, enhancedPayload), {}, {
5527
+ request_unique_idempotency_token: paymentSyncIdempotencyToken
5528
+ });
5529
+ };
5524
5530
  submitParams = {
5525
5531
  payments: effectivePayments,
5526
5532
  paymentStatus: paymentStatus,
@@ -5528,34 +5534,29 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
5528
5534
  businessCode: params.businessCode,
5529
5535
  channel: params.channel,
5530
5536
  confirmPendingVoucherPayments: true,
5531
- enhancePayload: function enhancePayload(payload) {
5532
- var nextPayload = _objectSpread(_objectSpread({}, payload), {}, {
5533
- request_unique_idempotency_token: paymentSyncIdempotencyToken
5534
- });
5535
- return nextPayload;
5536
- }
5537
+ enhancePayload: enhancePayload
5537
5538
  };
5538
5539
  if (!(params.checkoutSyncTaskEnabled === false)) {
5539
- _context37.next = 34;
5540
+ _context37.next = 35;
5540
5541
  break;
5541
5542
  }
5542
- _context37.next = 31;
5543
+ _context37.next = 32;
5543
5544
  return this.submitTempOrderAsync(submitParams);
5544
- case 31:
5545
+ case 32:
5545
5546
  _context37.t1 = _context37.sent;
5546
- _context37.next = 37;
5547
+ _context37.next = 38;
5547
5548
  break;
5548
- case 34:
5549
- _context37.next = 36;
5549
+ case 35:
5550
+ _context37.next = 37;
5550
5551
  return this.submitTempOrder(submitParams);
5551
- case 36:
5552
- _context37.t1 = _context37.sent;
5553
5552
  case 37:
5553
+ _context37.t1 = _context37.sent;
5554
+ case 38:
5554
5555
  submitResult = _context37.t1;
5555
5556
  return _context37.abrupt("return", _objectSpread(_objectSpread({}, completion), {}, {
5556
5557
  submitResult: submitResult
5557
5558
  }));
5558
- case 39:
5559
+ case 40:
5559
5560
  case "end":
5560
5561
  return _context37.stop();
5561
5562
  }
@@ -157,11 +157,13 @@ export interface OrderCustomerPatch {
157
157
  * 下单客户变更事件 payload。
158
158
  * - `patch`:tempOrder 上的协议字段视图(会随订单提交)
159
159
  * - `snapshot`:UI 富字段快照(仅本地,不随订单提交)
160
+ * - `source`:缺省表示真实业务变更;`detailHydrate` 仅表示打开详情时快照已就绪
160
161
  * 清空时整个 payload 为 null。
161
162
  */
162
163
  export interface OrderCustomerChangePayload {
163
164
  patch: OrderCustomerView;
164
165
  snapshot: ICustomer | null;
166
+ source?: 'detailHydrate';
165
167
  }
166
168
  export interface OrderScanCodeResult {
167
169
  isAvailable: boolean;
@@ -606,6 +608,7 @@ export interface SyncPaymentsToOrderParams {
606
608
  businessCode?: string;
607
609
  channel?: string;
608
610
  confirmPendingVoucherPayments?: boolean;
611
+ enhancePayload?: SubmitPayloadEnhancer;
609
612
  }
610
613
  export interface SyncPaymentsToOrderResult<T = any> {
611
614
  isFullyPaid: boolean;
@@ -60,6 +60,7 @@ export var OrderHooks = /*#__PURE__*/function (OrderHooks) {
60
60
  * 下单客户变更事件 payload。
61
61
  * - `patch`:tempOrder 上的协议字段视图(会随订单提交)
62
62
  * - `snapshot`:UI 富字段快照(仅本地,不随订单提交)
63
+ * - `source`:缺省表示真实业务变更;`detailHydrate` 仅表示打开详情时快照已就绪
63
64
  * 清空时整个 payload 为 null。
64
65
  */
65
66
 
@@ -131,8 +131,9 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
131
131
  }, {
132
132
  key: "loadProducts",
133
133
  value: function () {
134
- var _loadProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
135
- var _this$otherParams;
134
+ var _loadProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
135
+ var _this$otherParams,
136
+ _this2 = this;
136
137
  var _ref,
137
138
  _ref$category_ids,
138
139
  category_ids,
@@ -161,14 +162,16 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
161
162
  rawApplicationCode,
162
163
  mappedApplicationCode,
163
164
  queryPayload,
165
+ originalCallback,
166
+ subscriptionCallback,
164
167
  productsData,
165
168
  sortedList,
166
- _args4 = arguments;
167
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
168
- while (1) switch (_context4.prev = _context4.next) {
169
+ _args5 = arguments;
170
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
171
+ while (1) switch (_context5.prev = _context5.next) {
169
172
  case 0:
170
- _ref = _args4.length > 0 && _args4[0] !== undefined ? _args4[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;
171
- options = _args4.length > 1 ? _args4[1] : undefined;
173
+ _ref = _args5.length > 0 && _args5[0] !== undefined ? _args5[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;
174
+ options = _args5.length > 1 ? _args5[1] : undefined;
172
175
  // // 如果 schedule_ids 为空,则需要尝试从 schedule 模块里获取
173
176
  // if (!schedule_ids?.length) {
174
177
  // const schedule_ids_data = this.store.schedule
@@ -228,15 +231,38 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
228
231
  extension_type: extension_type,
229
232
  strategy_context: strategy_context
230
233
  });
231
- _context4.next = 11;
234
+ originalCallback = options === null || options === void 0 ? void 0 : options.callback;
235
+ subscriptionCallback = originalCallback ? ( /*#__PURE__*/function () {
236
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(result) {
237
+ var _result$data;
238
+ var products;
239
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
240
+ while (1) switch (_context4.prev = _context4.next) {
241
+ case 0:
242
+ products = Array.isArray(result === null || result === void 0 || (_result$data = result.data) === null || _result$data === void 0 ? void 0 : _result$data.list) ? result.data.list : [];
243
+ _context4.next = 3;
244
+ return _this2.addProduct(products);
245
+ case 3:
246
+ originalCallback(result);
247
+ case 4:
248
+ case "end":
249
+ return _context4.stop();
250
+ }
251
+ }, _callee4);
252
+ }));
253
+ return function (_x5) {
254
+ return _ref2.apply(this, arguments);
255
+ };
256
+ }()) : undefined;
257
+ _context5.next = 13;
232
258
  return this.request.post("/product/query", queryPayload, {
233
259
  osServer: true,
234
- callback: options === null || options === void 0 ? void 0 : options.callback,
260
+ callback: subscriptionCallback,
235
261
  subscriberId: options === null || options === void 0 ? void 0 : options.subscriberId,
236
262
  customToast: function customToast() {}
237
263
  });
238
- case 11:
239
- productsData = _context4.sent;
264
+ case 13:
265
+ productsData = _context5.sent;
240
266
  sortedList = (productsData.data.list || []).slice().sort(function (a, b) {
241
267
  return Number(b.sort) - Number(a.sort);
242
268
  }); // if (sortedList.length) {
@@ -247,12 +273,12 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
247
273
  // })
248
274
  // }
249
275
  this.addProduct(sortedList);
250
- return _context4.abrupt("return", sortedList);
251
- case 15:
276
+ return _context5.abrupt("return", sortedList);
277
+ case 17:
252
278
  case "end":
253
- return _context4.stop();
279
+ return _context5.stop();
254
280
  }
255
- }, _callee4, this);
281
+ }, _callee5, this);
256
282
  }));
257
283
  function loadProducts() {
258
284
  return _loadProducts.apply(this, arguments);
@@ -262,13 +288,13 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
262
288
  }, {
263
289
  key: "loadProductsPrice",
264
290
  value: function () {
265
- var _loadProductsPrice = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(_ref2) {
266
- var _ref2$ids, ids, customer_id, schedule_date, channel, productsData;
267
- return _regeneratorRuntime().wrap(function _callee5$(_context5) {
268
- while (1) switch (_context5.prev = _context5.next) {
291
+ var _loadProductsPrice = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(_ref3) {
292
+ var _ref3$ids, ids, customer_id, schedule_date, channel, productsData;
293
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
294
+ while (1) switch (_context6.prev = _context6.next) {
269
295
  case 0:
270
- _ref2$ids = _ref2.ids, ids = _ref2$ids === void 0 ? [] : _ref2$ids, customer_id = _ref2.customer_id, schedule_date = _ref2.schedule_date, channel = _ref2.channel;
271
- _context5.next = 3;
296
+ _ref3$ids = _ref3.ids, ids = _ref3$ids === void 0 ? [] : _ref3$ids, customer_id = _ref3.customer_id, schedule_date = _ref3.schedule_date, channel = _ref3.channel;
297
+ _context6.next = 3;
272
298
  return this.request.post("/product/query/price", {
273
299
  ids: ids,
274
300
  customer_id: customer_id,
@@ -278,15 +304,15 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
278
304
  useCache: true
279
305
  });
280
306
  case 3:
281
- productsData = _context5.sent;
282
- return _context5.abrupt("return", productsData.data);
307
+ productsData = _context6.sent;
308
+ return _context6.abrupt("return", productsData.data);
283
309
  case 5:
284
310
  case "end":
285
- return _context5.stop();
311
+ return _context6.stop();
286
312
  }
287
- }, _callee5, this);
313
+ }, _callee6, this);
288
314
  }));
289
- function loadProductsPrice(_x5) {
315
+ function loadProductsPrice(_x6) {
290
316
  return _loadProductsPrice.apply(this, arguments);
291
317
  }
292
318
  return loadProductsPrice;
@@ -294,19 +320,19 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
294
320
  }, {
295
321
  key: "getProducts",
296
322
  value: function () {
297
- var _getProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
298
- return _regeneratorRuntime().wrap(function _callee6$(_context6) {
299
- while (1) switch (_context6.prev = _context6.next) {
323
+ var _getProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
324
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
325
+ while (1) switch (_context7.prev = _context7.next) {
300
326
  case 0:
301
- _context6.next = 2;
327
+ _context7.next = 2;
302
328
  return this.core.effects.emit("".concat(this.name, ":onGetProducts"), this.store.list);
303
329
  case 2:
304
- return _context6.abrupt("return", cloneDeep(this.store.list));
330
+ return _context7.abrupt("return", cloneDeep(this.store.list));
305
331
  case 3:
306
332
  case "end":
307
- return _context6.stop();
333
+ return _context7.stop();
308
334
  }
309
- }, _callee6, this);
335
+ }, _callee7, this);
310
336
  }));
311
337
  function getProducts() {
312
338
  return _getProducts.apply(this, arguments);
@@ -316,25 +342,25 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
316
342
  }, {
317
343
  key: "getProduct",
318
344
  value: function () {
319
- var _getProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(id) {
345
+ var _getProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(id) {
320
346
  var product;
321
- return _regeneratorRuntime().wrap(function _callee7$(_context7) {
322
- while (1) switch (_context7.prev = _context7.next) {
347
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
348
+ while (1) switch (_context8.prev = _context8.next) {
323
349
  case 0:
324
- _context7.next = 2;
350
+ _context8.next = 2;
325
351
  return this.core.effects.emit("".concat(this.name, ":onGetProduct"), this.store.list);
326
352
  case 2:
327
353
  product = this.store.list.find(function (product) {
328
354
  return product.id === id;
329
355
  });
330
- return _context7.abrupt("return", product ? cloneDeep(product) : undefined);
356
+ return _context8.abrupt("return", product ? cloneDeep(product) : undefined);
331
357
  case 4:
332
358
  case "end":
333
- return _context7.stop();
359
+ return _context8.stop();
334
360
  }
335
- }, _callee7, this);
361
+ }, _callee8, this);
336
362
  }));
337
- function getProduct(_x6) {
363
+ function getProduct(_x7) {
338
364
  return _getProduct.apply(this, arguments);
339
365
  }
340
366
  return getProduct;
@@ -342,25 +368,25 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
342
368
  }, {
343
369
  key: "getProductByIds",
344
370
  value: function () {
345
- var _getProductByIds = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(ids) {
371
+ var _getProductByIds = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(ids) {
346
372
  var products;
347
- return _regeneratorRuntime().wrap(function _callee8$(_context8) {
348
- while (1) switch (_context8.prev = _context8.next) {
373
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
374
+ while (1) switch (_context9.prev = _context9.next) {
349
375
  case 0:
350
- _context8.next = 2;
376
+ _context9.next = 2;
351
377
  return this.core.effects.emit("".concat(this.name, ":onGetProductByIds"), this.store.list);
352
378
  case 2:
353
379
  products = this.store.list.filter(function (product) {
354
380
  return ids.includes(product.id);
355
381
  });
356
- return _context8.abrupt("return", products);
382
+ return _context9.abrupt("return", products);
357
383
  case 4:
358
384
  case "end":
359
- return _context8.stop();
385
+ return _context9.stop();
360
386
  }
361
- }, _callee8, this);
387
+ }, _callee9, this);
362
388
  }));
363
- function getProductByIds(_x7) {
389
+ function getProductByIds(_x8) {
364
390
  return _getProductByIds.apply(this, arguments);
365
391
  }
366
392
  return getProductByIds;
@@ -368,23 +394,23 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
368
394
  }, {
369
395
  key: "addProduct",
370
396
  value: function () {
371
- var _addProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(products) {
372
- var _this2 = this;
373
- return _regeneratorRuntime().wrap(function _callee9$(_context9) {
374
- while (1) switch (_context9.prev = _context9.next) {
397
+ var _addProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(products) {
398
+ var _this3 = this;
399
+ return _regeneratorRuntime().wrap(function _callee10$(_context10) {
400
+ while (1) switch (_context10.prev = _context10.next) {
375
401
  case 0:
376
402
  // list 需要根据 id 去重
377
403
  if (!this.store.list) {
378
404
  this.store.list = [];
379
405
  }
380
406
  products.forEach(function (n) {
381
- var index = _this2.store.list.findIndex(function (m) {
407
+ var index = _this3.store.list.findIndex(function (m) {
382
408
  return m.id === n.id;
383
409
  });
384
410
  if (index === -1) {
385
- _this2.store.list.push(n);
411
+ _this3.store.list.push(n);
386
412
  } else {
387
- _this2.store.list[index] = n;
413
+ _this3.store.list[index] = n;
388
414
  }
389
415
  });
390
416
  // 根据 sort 值做降序排序(数字越大越靠前)
@@ -394,11 +420,11 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
394
420
  this.core.effects.emit("".concat(this.name, ":changed"), this.store.list);
395
421
  case 4:
396
422
  case "end":
397
- return _context9.stop();
423
+ return _context10.stop();
398
424
  }
399
- }, _callee9, this);
425
+ }, _callee10, this);
400
426
  }));
401
- function addProduct(_x8) {
427
+ function addProduct(_x9) {
402
428
  return _addProduct.apply(this, arguments);
403
429
  }
404
430
  return addProduct;
@@ -406,18 +432,18 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
406
432
  }, {
407
433
  key: "selectProducts",
408
434
  value: function () {
409
- var _selectProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(products) {
410
- return _regeneratorRuntime().wrap(function _callee10$(_context10) {
411
- while (1) switch (_context10.prev = _context10.next) {
435
+ var _selectProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(products) {
436
+ return _regeneratorRuntime().wrap(function _callee11$(_context11) {
437
+ while (1) switch (_context11.prev = _context11.next) {
412
438
  case 0:
413
439
  this.store.selectProducts = products;
414
440
  case 1:
415
441
  case "end":
416
- return _context10.stop();
442
+ return _context11.stop();
417
443
  }
418
- }, _callee10, this);
444
+ }, _callee11, this);
419
445
  }));
420
- function selectProducts(_x9) {
446
+ function selectProducts(_x10) {
421
447
  return _selectProducts.apply(this, arguments);
422
448
  }
423
449
  return selectProducts;
@@ -72,7 +72,7 @@ export declare const calculateOriginSubtotal: (items: CartItem[]) => string;
72
72
  * @return {*}
73
73
  * @Author: xiangfeng.xue
74
74
  */
75
- export declare const calculateTaxFee: (shopInfo: any, items: CartItem[]) => "0.00" | Decimal;
75
+ export declare const calculateTaxFee: (shopInfo: any, items: CartItem[]) => Decimal | "0.00";
76
76
  /**
77
77
  * @title: 计算定金
78
78
  * @param items - 购物车商品数组
@@ -505,6 +505,10 @@ declare class Server {
505
505
  private buildCheckoutTaskIdempotencyKey;
506
506
  private isBlankCheckoutValue;
507
507
  private isLocalCheckoutOrderId;
508
+ private applyCheckoutFulfillmentBuzzer;
509
+ private buildCheckoutResourceIdentifierBuzzer;
510
+ private getCheckoutResourceIdentifier;
511
+ private stringifyCheckoutResourceIdentifier;
508
512
  private normalizeCheckoutSubmitData;
509
513
  private ensureCheckoutOrderNumbers;
510
514
  private dispatchCheckoutSyncTask;