@pisell/pisellos 2.2.273 → 2.2.275

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 (74) hide show
  1. package/dist/model/strategy/adapter/promotion/index.js +9 -0
  2. package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +12 -10
  3. package/dist/modules/Order/index.d.ts +7 -6
  4. package/dist/modules/Order/index.js +217 -115
  5. package/dist/modules/Order/types.d.ts +23 -3
  6. package/dist/modules/Order/types.js +11 -0
  7. package/dist/modules/Payment/index.js +1 -1
  8. package/dist/modules/Payment/types.d.ts +81 -4
  9. package/dist/modules/Payment/types.js +18 -3
  10. package/dist/modules/Payment/walletpass.d.ts +38 -1
  11. package/dist/modules/Payment/walletpass.js +917 -114
  12. package/dist/modules/Rules/index.d.ts +2 -0
  13. package/dist/modules/Rules/index.js +78 -64
  14. package/dist/modules/SalesSummary/utils.js +7 -1
  15. package/dist/server/index.d.ts +4 -0
  16. package/dist/server/index.js +27 -18
  17. package/dist/server/modules/index.d.ts +1 -1
  18. package/dist/server/modules/order/index.d.ts +16 -0
  19. package/dist/server/modules/order/index.js +964 -776
  20. package/dist/server/modules/order/types.d.ts +14 -0
  21. package/dist/server/modules/order/types.js +6 -0
  22. package/dist/solution/BaseSales/index.d.ts +80 -15
  23. package/dist/solution/BaseSales/index.js +1498 -444
  24. package/dist/solution/BaseSales/types.d.ts +55 -1
  25. package/dist/solution/BaseSales/types.js +2 -1
  26. package/dist/solution/BaseSales/utils/cartPromotion.js +8 -3
  27. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +6 -3
  28. package/dist/solution/BookingByStep/index.d.ts +1 -1
  29. package/dist/solution/BookingTicket/index.d.ts +1 -1
  30. package/dist/solution/BookingTicket/index.js +12 -3
  31. package/dist/solution/BookingTicket/types.d.ts +4 -0
  32. package/dist/solution/BookingTicket/utils/cartView.js +44 -32
  33. package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +8 -0
  34. package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +173 -83
  35. package/dist/solution/Sales/index.d.ts +1 -0
  36. package/dist/solution/Sales/index.js +16 -2
  37. package/dist/solution/VenueBooking/index.d.ts +1 -0
  38. package/lib/model/strategy/adapter/promotion/index.js +0 -51
  39. package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +3 -1
  40. package/lib/modules/Order/index.d.ts +7 -6
  41. package/lib/modules/Order/index.js +127 -20
  42. package/lib/modules/Order/types.d.ts +23 -3
  43. package/lib/modules/Payment/index.js +1 -1
  44. package/lib/modules/Payment/types.d.ts +81 -4
  45. package/lib/modules/Payment/types.js +4 -3
  46. package/lib/modules/Payment/walletpass.d.ts +38 -1
  47. package/lib/modules/Payment/walletpass.js +730 -21
  48. package/lib/modules/Rules/index.d.ts +2 -0
  49. package/lib/modules/Rules/index.js +24 -14
  50. package/lib/modules/SalesSummary/utils.js +5 -1
  51. package/lib/server/index.d.ts +4 -0
  52. package/lib/server/index.js +14 -6
  53. package/lib/server/modules/index.d.ts +1 -1
  54. package/lib/server/modules/order/index.d.ts +16 -0
  55. package/lib/server/modules/order/index.js +140 -4
  56. package/lib/server/modules/order/types.d.ts +14 -0
  57. package/lib/server/modules/order/types.js +1 -0
  58. package/lib/solution/BaseSales/index.d.ts +80 -15
  59. package/lib/solution/BaseSales/index.js +712 -48
  60. package/lib/solution/BaseSales/types.d.ts +55 -1
  61. package/lib/solution/BaseSales/types.js +2 -1
  62. package/lib/solution/BaseSales/utils/cartPromotion.js +8 -2
  63. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +3 -2
  64. package/lib/solution/BookingByStep/index.d.ts +1 -1
  65. package/lib/solution/BookingTicket/index.d.ts +1 -1
  66. package/lib/solution/BookingTicket/index.js +4 -1
  67. package/lib/solution/BookingTicket/types.d.ts +4 -0
  68. package/lib/solution/BookingTicket/utils/cartView.js +43 -30
  69. package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +8 -0
  70. package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +37 -5
  71. package/lib/solution/Sales/index.d.ts +1 -0
  72. package/lib/solution/Sales/index.js +15 -3
  73. package/lib/solution/VenueBooking/index.d.ts +1 -0
  74. package/package.json +1 -1
@@ -58,6 +58,7 @@ import { getOrderPaymentIdentityKeys, isIdentifiedPendingOrderPayment, isPending
58
58
  /** 平面图 GET 查询订阅者(列表 / id 详情 / code 详情) */
59
59
 
60
60
  var PRODUCT_TITLE_SNAPSHOT_KEYS = ['en', 'ja', 'pt', 'auto', 'zh-CN', 'zh-HK', 'kitchen', 'original'];
61
+ var AUTO_PRINT_STORAGE_KEY = 'auto_print';
61
62
 
62
63
  /**
63
64
  * Server 类
@@ -5716,7 +5717,7 @@ var Server = /*#__PURE__*/function () {
5716
5717
  key: "handleOrderCheckoutSubmit",
5717
5718
  value: function () {
5718
5719
  var _handleOrderCheckoutSubmit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee58(params) {
5719
- var backendPath, data, title, normalizedData, checkoutData, pendingResult, _this$core$context2, pendingOrder, platform, isAndroid;
5720
+ var backendPath, data, title, normalizedData, checkoutData, pendingResult, pendingOrder;
5720
5721
  return _regeneratorRuntime().wrap(function _callee58$(_context58) {
5721
5722
  while (1) switch (_context58.prev = _context58.next) {
5722
5723
  case 0:
@@ -5755,35 +5756,33 @@ var Server = /*#__PURE__*/function () {
5755
5756
  case 12:
5756
5757
  pendingResult = _context58.sent;
5757
5758
  if (!((pendingResult === null || pendingResult === void 0 ? void 0 : pendingResult.status) === true)) {
5758
- _context58.next = 22;
5759
+ _context58.next = 20;
5759
5760
  break;
5760
5761
  }
5761
5762
  pendingOrder = pendingResult.data;
5762
- platform = (_this$core$context2 = this.core.context) === null || _this$core$context2 === void 0 ? void 0 : _this$core$context2.getPlatform();
5763
- isAndroid = platform === 'android';
5764
- if (!(pendingOrder && this.shouldBuildSmallTicketData(checkoutData) && this.isSalesOrderFullyPaid(pendingOrder) && (
5765
- // TODO 这里先加个兼容,如果是安卓,则需要 type=virtual 才走打印,如果是苹果则无限制
5766
- isAndroid ? checkoutData.type === 'virtual' : true))) {
5767
- _context58.next = 20;
5763
+ if (!(pendingOrder && this.shouldBuildSmallTicketData(checkoutData) && this.isSalesOrderFullyPaid(pendingOrder) && this.shouldAutoPrintCheckoutReceipt())) {
5764
+ _context58.next = 18;
5768
5765
  break;
5769
5766
  }
5770
- _context58.next = 20;
5767
+ _context58.next = 18;
5771
5768
  return this.dispatchLocalReceiptPrint({
5772
5769
  checkoutData: checkoutData,
5773
5770
  order: pendingOrder,
5774
5771
  response: pendingResult,
5775
- requireFullyPaid: true
5772
+ requireFullyPaid: true,
5773
+ // 自动小票固定使用 print_all 的收据类型 0,不随订单 type 改成券/手环类型 99。
5774
+ isManualPrint: true
5776
5775
  });
5777
- case 20:
5778
- _context58.next = 22;
5776
+ case 18:
5777
+ _context58.next = 20;
5779
5778
  return this.dispatchCheckoutSyncTask({
5780
5779
  backendPath: backendPath,
5781
5780
  data: checkoutData,
5782
5781
  title: title
5783
5782
  });
5784
- case 22:
5783
+ case 20:
5785
5784
  if (pendingResult.data.order_id) {
5786
- _context58.next = 24;
5785
+ _context58.next = 22;
5787
5786
  break;
5788
5787
  }
5789
5788
  return _context58.abrupt("return", _objectSpread(_objectSpread({}, pendingResult), {}, {
@@ -5791,9 +5790,9 @@ var Server = /*#__PURE__*/function () {
5791
5790
  order_id: pendingResult.data.external_sale_number
5792
5791
  })
5793
5792
  }));
5794
- case 24:
5793
+ case 22:
5795
5794
  return _context58.abrupt("return", pendingResult);
5796
- case 25:
5795
+ case 23:
5797
5796
  case "end":
5798
5797
  return _context58.stop();
5799
5798
  }
@@ -6111,6 +6110,16 @@ var Server = /*#__PURE__*/function () {
6111
6110
  }
6112
6111
  return buildPendingSyncCheckoutOrder;
6113
6112
  }()
6113
+ /**
6114
+ * Android 结账自动小票由当前设备设置控制;其它平台保持原有行为。
6115
+ */
6116
+ }, {
6117
+ key: "shouldAutoPrintCheckoutReceipt",
6118
+ value: function shouldAutoPrintCheckoutReceipt() {
6119
+ var _this$core$context2, _this$core$context2$g, _this$app17, _this$app17$getStorag;
6120
+ 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;
6121
+ return ((_this$app17 = this.app) === null || _this$app17 === void 0 || (_this$app17 = _this$app17.storage) === null || _this$app17 === void 0 || (_this$app17$getStorag = _this$app17.getStorage) === null || _this$app17$getStorag === void 0 ? void 0 : _this$app17$getStorag.call(_this$app17, AUTO_PRINT_STORAGE_KEY)) === 'true';
6122
+ }
6114
6123
  }, {
6115
6124
  key: "shouldBuildSmallTicketData",
6116
6125
  value: function shouldBuildSmallTicketData(order) {
@@ -6751,7 +6760,7 @@ var Server = /*#__PURE__*/function () {
6751
6760
  key: "handleUpdateLocalOrdersBatch",
6752
6761
  value: (function () {
6753
6762
  var _handleUpdateLocalOrdersBatch = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee69(orderIds) {
6754
- var _this$app17;
6763
+ var _this$app18;
6755
6764
  var existedBefore, _iterator14, _step14, id, fetched, message, fetchedMap, _iterator15, _step15, order, oid, freshOrders, succeedIds, failed, _iterator16, _step16, _id, fresh, _message2, overwritten, inserted;
6756
6765
  return _regeneratorRuntime().wrap(function _callee69$(_context69) {
6757
6766
  while (1) switch (_context69.prev = _context69.next) {
@@ -6772,7 +6781,7 @@ var Server = /*#__PURE__*/function () {
6772
6781
  data: null
6773
6782
  });
6774
6783
  case 4:
6775
- if ((_this$app17 = this.app) !== null && _this$app17 !== void 0 && _this$app17.request) {
6784
+ if ((_this$app18 = this.app) !== null && _this$app18 !== void 0 && _this$app18.request) {
6776
6785
  _context69.next = 7;
6777
6786
  break;
6778
6787
  }
@@ -14,7 +14,7 @@ export { QuotationHooks } from './quotation/types';
14
14
  export { ScheduleModuleEx } from './schedule';
15
15
  export type { ScheduleState, ScheduleItem } from './schedule/types';
16
16
  export { OrderModule } from './order';
17
- export type { OrderState, OrderData, OrderId, OrderSummary, OrderBookingItem, OrderProductLineItem, OrderPaymentItem, OrderSurchargeItem, OrderProductDiscountItem, OrderWithoutBookings, BookingData, OrderFilters, BookingFilters, OrderFilterResult, OrderFilterRejectDetail, OrderFilterRejectedEntry, BookingFilterResult, OrderModulePagedResult, } from './order/types';
17
+ export type { OrderState, OrderData, OrderId, OrderSummary, OrderBookingItem, OrderProductLineItem, OrderPaymentItem, OrderSurchargeItem, OrderProductDiscountItem, OrderWithoutBookings, BookingData, OrderFilters, BookingFilters, OrderFilterResult, OrderFilterRejectDetail, OrderFilterRejectedEntry, BookingFilterResult, OrderModulePagedResult, RemoteProductMembershipChangedPayload, RemoteProductMembershipChangeSource, } from './order/types';
18
18
  export { OrderHooks } from './order/types';
19
19
  export { PaymentServerModule } from './payment';
20
20
  export type { PaymentMethod, PaymentMethodsChangedEventData, PaymentServerState } from './payment/types';
@@ -30,6 +30,10 @@ export declare class OrderModule extends BaseModule implements Module {
30
30
  * await this.emitOrdersChanged([freshOrder], 'pubsub.bodyUpsert')
31
31
  */
32
32
  private emitOrdersChanged;
33
+ /**
34
+ * 广播远端商品成员增删。监听器异常必须与订单落库和原有订单广播隔离。
35
+ */
36
+ private emitRemoteProductMembershipChanges;
33
37
  initialize(core: PisellCore, options?: ModuleOptions): Promise<void>;
34
38
  /**
35
39
  * 记录信息日志
@@ -231,6 +235,18 @@ export declare class OrderModule extends BaseModule implements Module {
231
235
  */
232
236
  private lookupOrderIndexByIdentityKeys;
233
237
  private isRemoteEchoMergeSource;
238
+ private getProductMembershipKey;
239
+ private doProductsHaveStableMembershipIdentity;
240
+ /**
241
+ * 冲突提示关注逻辑商品行,而不是服务端 checkout 过程中可能被重建的 detail 记录。
242
+ * 通用集合合并仍以 order_detail_id 为事实主键;这里只允许相同稳定 UID 跨 detail id 对齐,
243
+ * 避免本机 checkout 回声被误判成“一删一增”。
244
+ */
245
+ private isSameProductMembershipItem;
246
+ /**
247
+ * 对比合并前后的商品成员集合。商品字段修改与数组重排不会产生 diff。
248
+ */
249
+ private getRemoteProductMembershipChange;
234
250
  /**
235
251
  * 将订单的全部身份键登记到索引并指向其在列表中的下标。
236
252
  * 合并后订单新增的身份字段(如挂单同步后拿到 order_id)也会被登记。