@pisell/pisellos 2.1.121 → 2.1.122

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.
@@ -76,6 +76,10 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
76
76
  removeProductFromOrder(identity: ScanOrderOrderProductIdentity): Promise<ScanOrderOrderProduct[]>;
77
77
  submitTempOrder<T = any>(params?: {
78
78
  cacheId?: string;
79
+ platform?: string;
80
+ businessCode?: string;
81
+ channel?: string;
82
+ type?: string;
79
83
  }): Promise<T>;
80
84
  createOrder(params: CommitOrderParams['query']): {
81
85
  type: "virtual" | "appointment_booking";
@@ -741,7 +741,11 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
741
741
  effectiveCacheId = (_params$cacheId = params === null || params === void 0 ? void 0 : params.cacheId) !== null && _params$cacheId !== void 0 ? _params$cacheId : this.cacheId;
742
742
  payload = buildSubmitPayload({
743
743
  tempOrder: tempOrder,
744
- cacheId: effectiveCacheId
744
+ cacheId: effectiveCacheId,
745
+ platform: params === null || params === void 0 ? void 0 : params.platform,
746
+ businessCode: params === null || params === void 0 ? void 0 : params.businessCode,
747
+ channel: params === null || params === void 0 ? void 0 : params.channel,
748
+ type: params === null || params === void 0 ? void 0 : params.type
745
749
  });
746
750
  if (!tempOrder.order_id) {
747
751
  _context10.next = 12;
@@ -212,6 +212,10 @@ export interface OrderModuleAPI {
212
212
  persistTempOrder: () => void;
213
213
  submitTempOrder: <T = any>(params?: {
214
214
  cacheId?: string;
215
+ platform?: string;
216
+ businessCode?: string;
217
+ channel?: string;
218
+ type?: string;
215
219
  }) => Promise<T>;
216
220
  loadDiscountConfig: (params: {
217
221
  customerId: number;
@@ -36,6 +36,10 @@ export declare function buildSubmitPayload(params: {
36
36
  tempOrder: ScanOrderTempOrder;
37
37
  cacheId?: string;
38
38
  now?: Date;
39
+ platform?: string;
40
+ businessCode?: string;
41
+ channel?: string;
42
+ type?: string;
39
43
  }): ScanOrderSubmitPayload;
40
44
  export declare function formatV1Product(products: ScanOrderSubmitProduct[]): {
41
45
  bundle: any[];
@@ -219,11 +219,15 @@ export function createDefaultTempOrder(params) {
219
219
  };
220
220
  }
221
221
  export function buildSubmitPayload(params) {
222
- var _tempOrder$is_price_i, _tempOrder$is_deposit;
222
+ var _ref, _ref2, _ref3, _tempOrder$is_price_i, _tempOrder$is_deposit;
223
223
  var tempOrder = params.tempOrder,
224
224
  cacheId = params.cacheId,
225
225
  _params$now = params.now,
226
- now = _params$now === void 0 ? new Date() : _params$now;
226
+ now = _params$now === void 0 ? new Date() : _params$now,
227
+ platform = params.platform,
228
+ businessCode = params.businessCode,
229
+ channel = params.channel,
230
+ type = params.type;
227
231
  var scheduleDate = tempOrder.schedule_date || tempOrder.created_at || formatDateTime(now);
228
232
  var summary = tempOrder.summary || createEmptySummary();
229
233
  var relationId = tempOrder.relation_id;
@@ -260,12 +264,12 @@ export function buildSubmitPayload(params) {
260
264
  _surcharges = tempOrder.surcharges,
261
265
  tempOrderRest = _objectWithoutProperties(tempOrder, _excluded2);
262
266
  return _objectSpread(_objectSpread({}, tempOrderRest), {}, {
263
- platform: normalizeSubmitPlatform(tempOrder.platform),
267
+ platform: normalizeSubmitPlatform(platform !== null && platform !== void 0 ? platform : tempOrder.platform),
264
268
  request_unique_idempotency_token: cacheId,
265
- type: tempOrder.type || 'table-order',
266
- business_code: tempOrder.business_code || 'table-order',
269
+ type: (_ref = type !== null && type !== void 0 ? type : tempOrder.type) !== null && _ref !== void 0 ? _ref : 'table-order',
270
+ business_code: (_ref2 = businessCode !== null && businessCode !== void 0 ? businessCode : tempOrder.business_code) !== null && _ref2 !== void 0 ? _ref2 : 'table-order',
267
271
  sales_channel: tempOrder.sales_channel || 'my_pisel',
268
- order_sales_channel: tempOrder.order_sales_channel || 'online_store',
272
+ order_sales_channel: (_ref3 = channel !== null && channel !== void 0 ? channel : tempOrder.order_sales_channel) !== null && _ref3 !== void 0 ? _ref3 : 'online_store',
269
273
  status: tempOrder.status || 'normal',
270
274
  payment_status: tempOrder.payment_status || 'payment_processing',
271
275
  // shipping_status: tempOrder.shipping_status || 'unfulfilled',
@@ -85,7 +85,7 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
85
85
  key: "loadProducts",
86
86
  value: function () {
87
87
  var _loadProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(_ref) {
88
- var _this$otherParams;
88
+ var _this$otherParams, _this$otherParams2;
89
89
  var _ref$category_ids, category_ids, _ref$product_ids, product_ids, _ref$collection, collection, _ref$menu_list_ids, menu_list_ids, paramsCustomerId, _ref$with_count, with_count, schedule_datetime, schedule_date, cacheId, with_schedule, userPlugin, customer_id, _userPlugin$get, productsData, sortedList;
90
90
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
91
91
  while (1) switch (_context3.prev = _context3.next) {
@@ -129,7 +129,7 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
129
129
  with_count: with_count,
130
130
  // client_schedule_ids: schedule_ids,
131
131
  schedule_date: schedule_date,
132
- application_code: (_this$otherParams = this.otherParams) === null || _this$otherParams === void 0 ? void 0 : _this$otherParams.channel,
132
+ application_code: ((_this$otherParams = this.otherParams) === null || _this$otherParams === void 0 ? void 0 : _this$otherParams.channel) === 'online_store' ? 'online-store' : (_this$otherParams2 = this.otherParams) === null || _this$otherParams2 === void 0 ? void 0 : _this$otherParams2.channel,
133
133
  with_schedule: with_schedule,
134
134
  schedule_datetime: schedule_datetime,
135
135
  is_eject: 1
@@ -632,7 +632,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
632
632
  key: "submitScanOrder",
633
633
  value: function () {
634
634
  var _submitScanOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
635
- var _tempOrder$products, result, tempOrder;
635
+ var _this$otherParams4, _this$otherParams5, _this$otherParams6, _this$otherParams7, _tempOrder$products, result, tempOrder;
636
636
  return _regeneratorRuntime().wrap(function _callee9$(_context9) {
637
637
  while (1) switch (_context9.prev = _context9.next) {
638
638
  case 0:
@@ -649,7 +649,11 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
649
649
  case 6:
650
650
  _context9.next = 8;
651
651
  return this.store.order.submitTempOrder({
652
- cacheId: this.cacheId
652
+ cacheId: this.cacheId,
653
+ platform: (_this$otherParams4 = this.otherParams) === null || _this$otherParams4 === void 0 ? void 0 : _this$otherParams4.platform,
654
+ businessCode: (_this$otherParams5 = this.otherParams) === null || _this$otherParams5 === void 0 ? void 0 : _this$otherParams5.businessCode,
655
+ channel: (_this$otherParams6 = this.otherParams) === null || _this$otherParams6 === void 0 ? void 0 : _this$otherParams6.channel,
656
+ type: (_this$otherParams7 = this.otherParams) === null || _this$otherParams7 === void 0 ? void 0 : _this$otherParams7.type
653
657
  });
654
658
  case 8:
655
659
  result = _context9.sent;
@@ -1519,7 +1523,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
1519
1523
  }, {
1520
1524
  key: "normalizeResourceState",
1521
1525
  value: function normalizeResourceState(config, hasOrderId) {
1522
- var _this$otherParams4;
1526
+ var _this$otherParams8;
1523
1527
  var orderNumberPrefix = Array.isArray(config === null || config === void 0 ? void 0 : config.order_number_prefix) ? (config === null || config === void 0 ? void 0 : config.order_number_prefix) || [] : [];
1524
1528
  var tableMaxNumber = Number((config === null || config === void 0 ? void 0 : config.table_max_number) || 1);
1525
1529
  var orderCount = toNonNegativeNumber(config === null || config === void 0 ? void 0 : config.order_count);
@@ -1528,7 +1532,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
1528
1532
  var relationId = toPositiveString(config === null || config === void 0 ? void 0 : config.relation_id);
1529
1533
  var tableFormId = toPositiveString(config === null || config === void 0 ? void 0 : config.table_form_id);
1530
1534
  // 是否允许加餐
1531
- var allowSnack = ((_this$otherParams4 = this.otherParams) === null || _this$otherParams4 === void 0 || (_this$otherParams4 = _this$otherParams4.dineInConfig) === null || _this$otherParams4 === void 0 ? void 0 : _this$otherParams4['workflow.allow_add_items']) || false;
1535
+ var allowSnack = ((_this$otherParams8 = this.otherParams) === null || _this$otherParams8 === void 0 || (_this$otherParams8 = _this$otherParams8.dineInConfig) === null || _this$otherParams8 === void 0 ? void 0 : _this$otherParams8['workflow.allow_add_items']) || false;
1532
1536
  // 开启同桌验证 - 本期没有这个配置,默认关掉
1533
1537
  var deskmateValid = false;
1534
1538
  var isExclusive = tableMaxNumber > 0 ? tableMaxNumber <= 1 : false;
@@ -1647,7 +1651,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
1647
1651
  key: "checkResourceAvailable",
1648
1652
  value: function () {
1649
1653
  var _checkResourceAvailable = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(resourceId, hasOrderId) {
1650
- var _this$otherParams5, _this$otherParams5$ge, _config$table_form_re, _config$table_form_re2, _this$otherParams6, _this$store$order4, openData, dineInConfig, shopClosedInfo, config, resourceState, availabilityInfo, tempOrder;
1654
+ var _this$otherParams9, _this$otherParams9$ge, _config$table_form_re, _config$table_form_re2, _this$otherParams10, _this$store$order4, openData, dineInConfig, shopClosedInfo, config, resourceState, availabilityInfo, tempOrder;
1651
1655
  return _regeneratorRuntime().wrap(function _callee27$(_context27) {
1652
1656
  while (1) switch (_context27.prev = _context27.next) {
1653
1657
  case 0:
@@ -1656,7 +1660,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
1656
1660
  });
1657
1661
  _context27.prev = 1;
1658
1662
  _context27.next = 4;
1659
- return (_this$otherParams5 = this.otherParams) === null || _this$otherParams5 === void 0 || (_this$otherParams5$ge = _this$otherParams5.getOpenData) === null || _this$otherParams5$ge === void 0 ? void 0 : _this$otherParams5$ge.call(_this$otherParams5, {
1663
+ return (_this$otherParams9 = this.otherParams) === null || _this$otherParams9 === void 0 || (_this$otherParams9$ge = _this$otherParams9.getOpenData) === null || _this$otherParams9$ge === void 0 ? void 0 : _this$otherParams9$ge.call(_this$otherParams9, {
1660
1664
  scope: 'board',
1661
1665
  target: 'dine_in+scan_to_order',
1662
1666
  section_code: ['basic', 'fulfillment', 'reservation', 'sale', 'menu', 'availability', 'workflow']
@@ -1710,7 +1714,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
1710
1714
  partyroom_booking: config === null || config === void 0 || (_config$table_form_re2 = config.table_form_record) === null || _config$table_form_re2 === void 0 ? void 0 : _config$table_form_re2.partyroom_booking
1711
1715
  };
1712
1716
  tempOrder = this.ensureTempOrder();
1713
- tempOrder.relation_id = resourceId || ((_this$otherParams6 = this.otherParams) === null || _this$otherParams6 === void 0 ? void 0 : _this$otherParams6.relation_id);
1717
+ tempOrder.relation_id = resourceId || ((_this$otherParams10 = this.otherParams) === null || _this$otherParams10 === void 0 ? void 0 : _this$otherParams10.relation_id);
1714
1718
  tempOrder.table_form_id = resourceState.tableFormId;
1715
1719
  tempOrder.resource_id = resourceId;
1716
1720
  (_this$store$order4 = this.store.order) === null || _this$store$order4 === void 0 || _this$store$order4.persistTempOrder();
@@ -1802,14 +1806,14 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
1802
1806
  key: "getProductList",
1803
1807
  value: function () {
1804
1808
  var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29() {
1805
- var _this$otherParams7;
1809
+ var _this$otherParams11;
1806
1810
  var menu_list_ids, _this$store$products, res, formattedRes;
1807
1811
  return _regeneratorRuntime().wrap(function _callee29$(_context29) {
1808
1812
  while (1) switch (_context29.prev = _context29.next) {
1809
1813
  case 0:
1810
1814
  this.logMethodStart('getProductList');
1811
1815
  // 可以直接通过配置里的 menu 读取
1812
- menu_list_ids = ((_this$otherParams7 = this.otherParams) === null || _this$otherParams7 === void 0 || (_this$otherParams7 = _this$otherParams7.dineInConfig) === null || _this$otherParams7 === void 0 ? void 0 : _this$otherParams7['menu.associated_menus'].map(function (n) {
1816
+ menu_list_ids = ((_this$otherParams11 = this.otherParams) === null || _this$otherParams11 === void 0 || (_this$otherParams11 = _this$otherParams11.dineInConfig) === null || _this$otherParams11 === void 0 ? void 0 : _this$otherParams11['menu.associated_menus'].map(function (n) {
1813
1817
  return Number(n.value);
1814
1818
  })) || [];
1815
1819
  _context29.prev = 2;
@@ -159,5 +159,15 @@ export declare class VenueBookingImpl extends BaseModule implements Module {
159
159
  private refreshCartValidationPassed;
160
160
  setItemRuleRuntimeConfig(config?: VenueBookingItemRuleRuntimeConfig): Promise<void>;
161
161
  getOtherParams(): Record<string, any>;
162
+ private static readonly UI_STATE_KEY_PREFIX;
163
+ private getUIStateBucketKey;
164
+ private readUIStateBucket;
165
+ private writeUIStateBucket;
166
+ setUIState(key: string, value: any): void;
167
+ getUIState<T = any>(key: string): T | undefined;
168
+ deleteUIState(key: string): void;
162
169
  checkOpenDataAvailability(): Promise<OpenDataAvailabilityResult>;
170
+ setOtherParams(params: Record<string, any>, { cover }?: {
171
+ cover?: boolean;
172
+ }): Promise<void>;
163
173
  }
@@ -598,24 +598,23 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
598
598
  case 58:
599
599
  this.injectScheduleResolverToQuotation();
600
600
  case 59:
601
- this.loadQuotations();
602
- _context6.next = 62;
601
+ _context6.next = 61;
603
602
  return this.refreshItemRuleQuantityLimits();
604
- case 62:
603
+ case 61:
605
604
  this.store.status = 'ready';
606
605
  console.log('[VenueBooking] 初始化完成');
607
- _context6.next = 66;
606
+ _context6.next = 65;
608
607
  return this.core.effects.emit(VenueBookingHooks.onInited, {
609
608
  status: this.store.status
610
609
  });
611
- case 66:
610
+ case 65:
612
611
  this.logMethodSuccess('initialize', {
613
612
  status: this.store.status
614
613
  });
615
- _context6.next = 76;
614
+ _context6.next = 75;
616
615
  break;
617
- case 69:
618
- _context6.prev = 69;
616
+ case 68:
617
+ _context6.prev = 68;
619
618
  _context6.t0 = _context6["catch"](49);
620
619
  this.store.status = 'error';
621
620
  this.store.error = _context6.t0 instanceof Error ? _context6.t0.message : '初始化失败';
@@ -624,11 +623,11 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
624
623
  status: this.store.status
625
624
  });
626
625
  throw _context6.t0;
627
- case 76:
626
+ case 75:
628
627
  case "end":
629
628
  return _context6.stop();
630
629
  }
631
- }, _callee6, this, [[49, 69]]);
630
+ }, _callee6, this, [[49, 68]]);
632
631
  }));
633
632
  function initialize(_x5) {
634
633
  return _initialize.apply(this, arguments);
@@ -1964,7 +1963,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
1964
1963
  key: "submitOrder",
1965
1964
  value: function () {
1966
1965
  var _submitOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24() {
1967
- var _tempOrder$products2, result, tempOrder;
1966
+ var _this$otherParams7, _this$otherParams8, _this$otherParams9, _this$otherParams10, _tempOrder$products2, result, tempOrder;
1968
1967
  return _regeneratorRuntime().wrap(function _callee24$(_context24) {
1969
1968
  while (1) switch (_context24.prev = _context24.next) {
1970
1969
  case 0:
@@ -1981,7 +1980,11 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
1981
1980
  case 6:
1982
1981
  _context24.next = 8;
1983
1982
  return this.store.order.submitTempOrder({
1984
- cacheId: this.cacheId
1983
+ cacheId: this.cacheId,
1984
+ platform: (_this$otherParams7 = this.otherParams) === null || _this$otherParams7 === void 0 ? void 0 : _this$otherParams7.platform,
1985
+ businessCode: (_this$otherParams8 = this.otherParams) === null || _this$otherParams8 === void 0 ? void 0 : _this$otherParams8.businessCode,
1986
+ channel: (_this$otherParams9 = this.otherParams) === null || _this$otherParams9 === void 0 ? void 0 : _this$otherParams9.channel,
1987
+ type: (_this$otherParams10 = this.otherParams) === null || _this$otherParams10 === void 0 ? void 0 : _this$otherParams10.type
1985
1988
  });
1986
1989
  case 8:
1987
1990
  result = _context24.sent;
@@ -2896,6 +2899,65 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2896
2899
  return this.otherParams;
2897
2900
  }
2898
2901
 
2902
+ // ─── UI 状态缓存(按 cacheId 分桶,sessionStorage) ───
2903
+ //
2904
+ // 用于物料层持久化 UI 层面的轻量状态(如当前步骤、登录回跳意图等)。
2905
+ // 桶键:pisell.venueBooking.uiState:<cacheId>;内部以 JSON object 形式存储多个字段。
2906
+ // 无 cacheId 时所有方法自动降级为 no-op,上层不用判空。
2907
+ }, {
2908
+ key: "getUIStateBucketKey",
2909
+ value: function getUIStateBucketKey() {
2910
+ if (!this.cacheId) return null;
2911
+ return "".concat(VenueBookingImpl.UI_STATE_KEY_PREFIX).concat(this.cacheId);
2912
+ }
2913
+ }, {
2914
+ key: "readUIStateBucket",
2915
+ value: function readUIStateBucket() {
2916
+ var _this$window;
2917
+ var key = this.getUIStateBucketKey();
2918
+ if (!key || !((_this$window = this.window) !== null && _this$window !== void 0 && _this$window.sessionStorage)) return {};
2919
+ try {
2920
+ var raw = this.window.sessionStorage.getItem(key) || '{}';
2921
+ var parsed = JSON.parse(raw);
2922
+ return parsed && _typeof(parsed) === 'object' ? parsed : {};
2923
+ } catch (_unused2) {
2924
+ return {};
2925
+ }
2926
+ }
2927
+ }, {
2928
+ key: "writeUIStateBucket",
2929
+ value: function writeUIStateBucket(bucket) {
2930
+ var _this$window2;
2931
+ var key = this.getUIStateBucketKey();
2932
+ if (!key || !((_this$window2 = this.window) !== null && _this$window2 !== void 0 && _this$window2.sessionStorage)) return;
2933
+ this.window.sessionStorage.setItem(key, JSON.stringify(bucket));
2934
+ }
2935
+ }, {
2936
+ key: "setUIState",
2937
+ value: function setUIState(key, value) {
2938
+ if (!this.getUIStateBucketKey()) return;
2939
+ var bucket = this.readUIStateBucket();
2940
+ bucket[key] = value;
2941
+ this.writeUIStateBucket(bucket);
2942
+ }
2943
+ }, {
2944
+ key: "getUIState",
2945
+ value: function getUIState(key) {
2946
+ if (!this.getUIStateBucketKey()) return undefined;
2947
+ var bucket = this.readUIStateBucket();
2948
+ return bucket[key];
2949
+ }
2950
+ }, {
2951
+ key: "deleteUIState",
2952
+ value: function deleteUIState(key) {
2953
+ if (!this.getUIStateBucketKey()) return;
2954
+ var bucket = this.readUIStateBucket();
2955
+ if (key in bucket) {
2956
+ delete bucket[key];
2957
+ this.writeUIStateBucket(bucket);
2958
+ }
2959
+ }
2960
+
2899
2961
  // ─── OpenData 可用性 ───
2900
2962
  }, {
2901
2963
  key: "checkOpenDataAvailability",
@@ -2925,7 +2987,36 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2925
2987
  }
2926
2988
  return checkOpenDataAvailability;
2927
2989
  }()
2990
+ }, {
2991
+ key: "setOtherParams",
2992
+ value: function () {
2993
+ var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43(params) {
2994
+ var _ref7,
2995
+ _ref7$cover,
2996
+ cover,
2997
+ _args43 = arguments;
2998
+ return _regeneratorRuntime().wrap(function _callee43$(_context43) {
2999
+ while (1) switch (_context43.prev = _context43.next) {
3000
+ case 0:
3001
+ _ref7 = _args43.length > 1 && _args43[1] !== undefined ? _args43[1] : {}, _ref7$cover = _ref7.cover, cover = _ref7$cover === void 0 ? false : _ref7$cover;
3002
+ if (cover) {
3003
+ this.otherParams = params;
3004
+ } else {
3005
+ this.otherParams = _objectSpread(_objectSpread({}, this.otherParams), params);
3006
+ }
3007
+ case 2:
3008
+ case "end":
3009
+ return _context43.stop();
3010
+ }
3011
+ }, _callee43, this);
3012
+ }));
3013
+ function setOtherParams(_x19) {
3014
+ return _setOtherParams.apply(this, arguments);
3015
+ }
3016
+ return setOtherParams;
3017
+ }()
2928
3018
  }]);
2929
3019
  return VenueBookingImpl;
2930
3020
  }(BaseModule);
2931
- _defineProperty(VenueBookingImpl, "OPEN_DATA_CACHE_TTL", 5 * 60 * 1000);
3021
+ _defineProperty(VenueBookingImpl, "OPEN_DATA_CACHE_TTL", 5 * 60 * 1000);
3022
+ _defineProperty(VenueBookingImpl, "UI_STATE_KEY_PREFIX", 'pisell.venueBooking.uiState:');
@@ -1,49 +0,0 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
- // If the importer is in node compatibility mode or this is not an ESM
21
- // file that has been converted to a CommonJS file using a Babel-
22
- // compatible transform (i.e. "__esModule" has not been set), then set
23
- // "default" to the CommonJS "module.exports" for node compatibility.
24
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
- mod
26
- ));
27
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
-
29
- // src/model/strategy/adapter/promotion/index.ts
30
- var promotion_exports = {};
31
- __export(promotion_exports, {
32
- BUY_X_GET_Y_FREE_STRATEGY: () => import_examples.BUY_X_GET_Y_FREE_STRATEGY,
33
- PromotionAdapter: () => import_adapter.PromotionAdapter,
34
- PromotionEvaluator: () => import_evaluator.PromotionEvaluator,
35
- X_ITEMS_FOR_Y_PRICE_STRATEGY: () => import_examples.X_ITEMS_FOR_Y_PRICE_STRATEGY,
36
- default: () => import_adapter2.default
37
- });
38
- module.exports = __toCommonJS(promotion_exports);
39
- var import_evaluator = require("./evaluator");
40
- var import_adapter = require("./adapter");
41
- var import_adapter2 = __toESM(require("./adapter"));
42
- var import_examples = require("./examples");
43
- // Annotate the CommonJS export names for ESM import in node:
44
- 0 && (module.exports = {
45
- BUY_X_GET_Y_FREE_STRATEGY,
46
- PromotionAdapter,
47
- PromotionEvaluator,
48
- X_ITEMS_FOR_Y_PRICE_STRATEGY
49
- });
@@ -76,6 +76,10 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
76
76
  removeProductFromOrder(identity: ScanOrderOrderProductIdentity): Promise<ScanOrderOrderProduct[]>;
77
77
  submitTempOrder<T = any>(params?: {
78
78
  cacheId?: string;
79
+ platform?: string;
80
+ businessCode?: string;
81
+ channel?: string;
82
+ type?: string;
79
83
  }): Promise<T>;
80
84
  createOrder(params: CommitOrderParams['query']): {
81
85
  type: "virtual" | "appointment_booking";
@@ -487,7 +487,11 @@ var OrderModule = class extends import_BaseModule.BaseModule {
487
487
  const effectiveCacheId = (params == null ? void 0 : params.cacheId) ?? this.cacheId;
488
488
  const payload = (0, import_utils.buildSubmitPayload)({
489
489
  tempOrder,
490
- cacheId: effectiveCacheId
490
+ cacheId: effectiveCacheId,
491
+ platform: params == null ? void 0 : params.platform,
492
+ businessCode: params == null ? void 0 : params.businessCode,
493
+ channel: params == null ? void 0 : params.channel,
494
+ type: params == null ? void 0 : params.type
491
495
  });
492
496
  let result;
493
497
  if (tempOrder.order_id) {
@@ -212,6 +212,10 @@ export interface OrderModuleAPI {
212
212
  persistTempOrder: () => void;
213
213
  submitTempOrder: <T = any>(params?: {
214
214
  cacheId?: string;
215
+ platform?: string;
216
+ businessCode?: string;
217
+ channel?: string;
218
+ type?: string;
215
219
  }) => Promise<T>;
216
220
  loadDiscountConfig: (params: {
217
221
  customerId: number;
@@ -36,6 +36,10 @@ export declare function buildSubmitPayload(params: {
36
36
  tempOrder: ScanOrderTempOrder;
37
37
  cacheId?: string;
38
38
  now?: Date;
39
+ platform?: string;
40
+ businessCode?: string;
41
+ channel?: string;
42
+ type?: string;
39
43
  }): ScanOrderSubmitPayload;
40
44
  export declare function formatV1Product(products: ScanOrderSubmitProduct[]): {
41
45
  bundle: any[];
@@ -221,7 +221,15 @@ function createDefaultTempOrder(params) {
221
221
  };
222
222
  }
223
223
  function buildSubmitPayload(params) {
224
- const { tempOrder, cacheId, now = /* @__PURE__ */ new Date() } = params;
224
+ const {
225
+ tempOrder,
226
+ cacheId,
227
+ now = /* @__PURE__ */ new Date(),
228
+ platform,
229
+ businessCode,
230
+ channel,
231
+ type
232
+ } = params;
225
233
  const scheduleDate = tempOrder.schedule_date || tempOrder.created_at || formatDateTime(now);
226
234
  const summary = tempOrder.summary || (0, import_utils.createEmptySummary)();
227
235
  const relationId = tempOrder.relation_id;
@@ -256,12 +264,12 @@ function buildSubmitPayload(params) {
256
264
  const { created_at: _createdAt, summary: _summary, surcharges: _surcharges, ...tempOrderRest } = tempOrder;
257
265
  return {
258
266
  ...tempOrderRest,
259
- platform: normalizeSubmitPlatform(tempOrder.platform),
267
+ platform: normalizeSubmitPlatform(platform ?? tempOrder.platform),
260
268
  request_unique_idempotency_token: cacheId,
261
- type: tempOrder.type || "table-order",
262
- business_code: tempOrder.business_code || "table-order",
269
+ type: type ?? tempOrder.type ?? "table-order",
270
+ business_code: businessCode ?? tempOrder.business_code ?? "table-order",
263
271
  sales_channel: tempOrder.sales_channel || "my_pisel",
264
- order_sales_channel: tempOrder.order_sales_channel || "online_store",
272
+ order_sales_channel: channel ?? tempOrder.order_sales_channel ?? "online_store",
265
273
  status: tempOrder.status || "normal",
266
274
  payment_status: tempOrder.payment_status || "payment_processing",
267
275
  // shipping_status: tempOrder.shipping_status || 'unfulfilled',
@@ -61,7 +61,7 @@ var ProductList = class extends import_BaseModule.BaseModule {
61
61
  cacheId,
62
62
  with_schedule
63
63
  }) {
64
- var _a, _b;
64
+ var _a, _b, _c;
65
65
  let userPlugin = this.core.getPlugin("user");
66
66
  let customer_id = void 0;
67
67
  try {
@@ -95,7 +95,7 @@ var ProductList = class extends import_BaseModule.BaseModule {
95
95
  with_count,
96
96
  // client_schedule_ids: schedule_ids,
97
97
  schedule_date,
98
- application_code: (_b = this.otherParams) == null ? void 0 : _b.channel,
98
+ application_code: ((_b = this.otherParams) == null ? void 0 : _b.channel) === "online_store" ? "online-store" : (_c = this.otherParams) == null ? void 0 : _c.channel,
99
99
  with_schedule,
100
100
  schedule_datetime,
101
101
  is_eject: 1
@@ -410,7 +410,7 @@ var ScanOrderImpl = class extends import_BaseModule.BaseModule {
410
410
  }
411
411
  }
412
412
  async submitScanOrder() {
413
- var _a;
413
+ var _a, _b, _c, _d, _e;
414
414
  this.logMethodStart("submitScanOrder");
415
415
  try {
416
416
  await this.validateBeforeSubmitByItemRule();
@@ -418,11 +418,15 @@ var ScanOrderImpl = class extends import_BaseModule.BaseModule {
418
418
  throw new Error("scanOrder解决方案需要 order 模块支持");
419
419
  }
420
420
  const result = await this.store.order.submitTempOrder({
421
- cacheId: this.cacheId
421
+ cacheId: this.cacheId,
422
+ platform: (_a = this.otherParams) == null ? void 0 : _a.platform,
423
+ businessCode: (_b = this.otherParams) == null ? void 0 : _b.businessCode,
424
+ channel: (_c = this.otherParams) == null ? void 0 : _c.channel,
425
+ type: (_d = this.otherParams) == null ? void 0 : _d.type
422
426
  });
423
427
  const tempOrder = this.store.order.getTempOrder();
424
428
  this.logMethodSuccess("submitScanOrder", {
425
- productCount: ((_a = tempOrder == null ? void 0 : tempOrder.products) == null ? void 0 : _a.length) || 0
429
+ productCount: ((_e = tempOrder == null ? void 0 : tempOrder.products) == null ? void 0 : _e.length) || 0
426
430
  });
427
431
  return result;
428
432
  } catch (error) {
@@ -159,5 +159,15 @@ export declare class VenueBookingImpl extends BaseModule implements Module {
159
159
  private refreshCartValidationPassed;
160
160
  setItemRuleRuntimeConfig(config?: VenueBookingItemRuleRuntimeConfig): Promise<void>;
161
161
  getOtherParams(): Record<string, any>;
162
+ private static readonly UI_STATE_KEY_PREFIX;
163
+ private getUIStateBucketKey;
164
+ private readUIStateBucket;
165
+ private writeUIStateBucket;
166
+ setUIState(key: string, value: any): void;
167
+ getUIState<T = any>(key: string): T | undefined;
168
+ deleteUIState(key: string): void;
162
169
  checkOpenDataAvailability(): Promise<OpenDataAvailabilityResult>;
170
+ setOtherParams(params: Record<string, any>, { cover }?: {
171
+ cover?: boolean;
172
+ }): Promise<void>;
163
173
  }
@@ -426,7 +426,6 @@ var _VenueBookingImpl = class extends import_BaseModule.BaseModule {
426
426
  await this.store.schedule.loadAllSchedule();
427
427
  this.injectScheduleResolverToQuotation();
428
428
  }
429
- this.loadQuotations();
430
429
  await this.refreshItemRuleQuantityLimits();
431
430
  this.store.status = "ready";
432
431
  console.log("[VenueBooking] 初始化完成");
@@ -1158,7 +1157,7 @@ var _VenueBookingImpl = class extends import_BaseModule.BaseModule {
1158
1157
  }
1159
1158
  }
1160
1159
  async submitOrder() {
1161
- var _a;
1160
+ var _a, _b, _c, _d, _e;
1162
1161
  this.logMethodStart("submitOrder");
1163
1162
  try {
1164
1163
  await this.validateBeforeSubmitByItemRule();
@@ -1166,11 +1165,15 @@ var _VenueBookingImpl = class extends import_BaseModule.BaseModule {
1166
1165
  throw new Error("venueBooking解决方案需要 order 模块支持");
1167
1166
  }
1168
1167
  const result = await this.store.order.submitTempOrder({
1169
- cacheId: this.cacheId
1168
+ cacheId: this.cacheId,
1169
+ platform: (_a = this.otherParams) == null ? void 0 : _a.platform,
1170
+ businessCode: (_b = this.otherParams) == null ? void 0 : _b.businessCode,
1171
+ channel: (_c = this.otherParams) == null ? void 0 : _c.channel,
1172
+ type: (_d = this.otherParams) == null ? void 0 : _d.type
1170
1173
  });
1171
1174
  const tempOrder = this.store.order.getTempOrder();
1172
1175
  this.logMethodSuccess("submitOrder", {
1173
- productCount: ((_a = tempOrder == null ? void 0 : tempOrder.products) == null ? void 0 : _a.length) || 0
1176
+ productCount: ((_e = tempOrder == null ? void 0 : tempOrder.products) == null ? void 0 : _e.length) || 0
1174
1177
  });
1175
1178
  return result;
1176
1179
  } catch (error) {
@@ -1561,6 +1564,53 @@ var _VenueBookingImpl = class extends import_BaseModule.BaseModule {
1561
1564
  getOtherParams() {
1562
1565
  return this.otherParams;
1563
1566
  }
1567
+ getUIStateBucketKey() {
1568
+ if (!this.cacheId)
1569
+ return null;
1570
+ return `${_VenueBookingImpl.UI_STATE_KEY_PREFIX}${this.cacheId}`;
1571
+ }
1572
+ readUIStateBucket() {
1573
+ var _a;
1574
+ const key = this.getUIStateBucketKey();
1575
+ if (!key || !((_a = this.window) == null ? void 0 : _a.sessionStorage))
1576
+ return {};
1577
+ try {
1578
+ const raw = this.window.sessionStorage.getItem(key) || "{}";
1579
+ const parsed = JSON.parse(raw);
1580
+ return parsed && typeof parsed === "object" ? parsed : {};
1581
+ } catch {
1582
+ return {};
1583
+ }
1584
+ }
1585
+ writeUIStateBucket(bucket) {
1586
+ var _a;
1587
+ const key = this.getUIStateBucketKey();
1588
+ if (!key || !((_a = this.window) == null ? void 0 : _a.sessionStorage))
1589
+ return;
1590
+ this.window.sessionStorage.setItem(key, JSON.stringify(bucket));
1591
+ }
1592
+ setUIState(key, value) {
1593
+ if (!this.getUIStateBucketKey())
1594
+ return;
1595
+ const bucket = this.readUIStateBucket();
1596
+ bucket[key] = value;
1597
+ this.writeUIStateBucket(bucket);
1598
+ }
1599
+ getUIState(key) {
1600
+ if (!this.getUIStateBucketKey())
1601
+ return void 0;
1602
+ const bucket = this.readUIStateBucket();
1603
+ return bucket[key];
1604
+ }
1605
+ deleteUIState(key) {
1606
+ if (!this.getUIStateBucketKey())
1607
+ return;
1608
+ const bucket = this.readUIStateBucket();
1609
+ if (key in bucket) {
1610
+ delete bucket[key];
1611
+ this.writeUIStateBucket(bucket);
1612
+ }
1613
+ }
1564
1614
  // ─── OpenData 可用性 ───
1565
1615
  async checkOpenDataAvailability() {
1566
1616
  if (!this.store.openData)
@@ -1568,9 +1618,22 @@ var _VenueBookingImpl = class extends import_BaseModule.BaseModule {
1568
1618
  await this.loadOpenDataConfig();
1569
1619
  return this.store.openData.checkAvailability(this.store.schedule);
1570
1620
  }
1621
+ async setOtherParams(params, { cover = false } = {}) {
1622
+ if (cover) {
1623
+ this.otherParams = params;
1624
+ } else {
1625
+ this.otherParams = { ...this.otherParams, ...params };
1626
+ }
1627
+ }
1571
1628
  };
1572
1629
  var VenueBookingImpl = _VenueBookingImpl;
1573
1630
  VenueBookingImpl.OPEN_DATA_CACHE_TTL = 5 * 60 * 1e3;
1631
+ // ─── UI 状态缓存(按 cacheId 分桶,sessionStorage) ───
1632
+ //
1633
+ // 用于物料层持久化 UI 层面的轻量状态(如当前步骤、登录回跳意图等)。
1634
+ // 桶键:pisell.venueBooking.uiState:<cacheId>;内部以 JSON object 形式存储多个字段。
1635
+ // 无 cacheId 时所有方法自动降级为 no-op,上层不用判空。
1636
+ VenueBookingImpl.UI_STATE_KEY_PREFIX = "pisell.venueBooking.uiState:";
1574
1637
  // Annotate the CommonJS export names for ESM import in node:
1575
1638
  0 && (module.exports = {
1576
1639
  VenueBookingImpl,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "2.1.121",
4
+ "version": "2.1.122",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",