@pisell/pisellos 2.3.203 → 2.3.205

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.
@@ -175,11 +175,8 @@ function resolveCutOffPolicyIssue(policy) {
175
175
  return null;
176
176
  }
177
177
  function addLeadWindow(base, unit, unitType, _timezoneName) {
178
- if (unitType === 'days') {
179
- var leadDate = addLocalCalendarDays(base, unit);
180
- // Positive day lead times start at midnight; zero days keeps the current-time boundary.
181
- return Math.trunc(unit) > 0 ? localDateToScalarStart(formatLocalDate(leadDate)) : leadDate;
182
- }
178
+ // Calendar-day lead times retain the current local hour, minute and second.
179
+ if (unitType === 'days') return addLocalCalendarDays(base, unit);
183
180
  if (unitType === 'hours') return addLocalHours(base, unit);
184
181
  return addLocalMinutes(base, unit);
185
182
  }
@@ -366,7 +366,7 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
366
366
  * 获取当前的客户搜索条件
367
367
  * @returns 当前搜索条件
368
368
  */
369
- getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "num" | "skip">;
369
+ getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "skip" | "num">;
370
370
  /**
371
371
  * 获取客户列表状态(包含滚动加载相关状态)
372
372
  * @returns 客户状态
@@ -629,35 +629,40 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
629
629
  key: "configureIdGeneratorFromOpenData",
630
630
  value: function () {
631
631
  var _configureIdGeneratorFromOpenData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
632
- var _openDataConfig, _openDataConfig2, _openDataConfig3, _openDataConfig4, _openDataConfig5, _openDataConfig6;
632
+ var _this$otherParams5, _openDataConfig, _openDataConfig2, _openDataConfig3, _openDataConfig4, _openDataConfig5, _openDataConfig6;
633
633
  var idGenerator, openDataConfig, receiptSequenceLength, receiptSequenceStart, prefix, shopOrderPrefix, resetReceiptSequenceDaily, operatingDayBoundary, deviceId, businessCode, _openDataConfig7, _openDataConfig8, _openDataConfig9;
634
634
  return _regeneratorRuntime().wrap(function _callee10$(_context10) {
635
635
  while (1) switch (_context10.prev = _context10.next) {
636
636
  case 0:
637
+ if (!isCustomerUserPlatform((_this$otherParams5 = this.otherParams) === null || _this$otherParams5 === void 0 ? void 0 : _this$otherParams5.platform)) {
638
+ _context10.next = 2;
639
+ break;
640
+ }
641
+ return _context10.abrupt("return");
642
+ case 2:
637
643
  // 业务码切换或配置失败时不能复用上一次初始化的短号。
638
644
  this.setPaymentNumberDevicePrefix(null);
639
- idGenerator = this.getIdGeneratorPlugin();
640
- if (idGenerator !== null && idGenerator !== void 0 && idGenerator.configure) {
641
- _context10.next = 5;
645
+ idGenerator = this.getIdGeneratorPlugin(); // Optional host capability. Do not warn or cache absence: POS may register it later.
646
+ if (!(typeof (idGenerator === null || idGenerator === void 0 ? void 0 : idGenerator.configure) !== 'function')) {
647
+ _context10.next = 6;
642
648
  break;
643
649
  }
644
- console.warn('[BookingTicket] idGenerator 插件不可用,跳过配置');
645
650
  return _context10.abrupt("return");
646
- case 5:
651
+ case 6:
647
652
  openDataConfig = null;
648
- _context10.prev = 6;
649
- _context10.next = 9;
653
+ _context10.prev = 7;
654
+ _context10.next = 10;
650
655
  return this.loadOpenDataConfig();
651
- case 9:
656
+ case 10:
652
657
  openDataConfig = _context10.sent;
653
- _context10.next = 16;
658
+ _context10.next = 17;
654
659
  break;
655
- case 12:
656
- _context10.prev = 12;
657
- _context10.t0 = _context10["catch"](6);
660
+ case 13:
661
+ _context10.prev = 13;
662
+ _context10.t0 = _context10["catch"](7);
658
663
  console.warn('[BookingTicket] OpenData 配置加载失败,跳过 idGenerator 配置', _context10.t0);
659
664
  return _context10.abrupt("return");
660
- case 16:
665
+ case 17:
661
666
  // if (!openDataConfig) return;
662
667
  receiptSequenceLength = this.normalizePositiveInteger((_openDataConfig = openDataConfig) === null || _openDataConfig === void 0 ? void 0 : _openDataConfig['sale.short_number_digits'], 5);
663
668
  receiptSequenceStart = this.normalizePositiveInteger((_openDataConfig2 = openDataConfig) === null || _openDataConfig2 === void 0 ? void 0 : _openDataConfig2['sale.short_number_start_number'], 1);
@@ -668,21 +673,21 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
668
673
  "type": "start_time",
669
674
  "time": "00:00"
670
675
  };
671
- _context10.next = 24;
676
+ _context10.next = 25;
672
677
  return this.getShortNumberOrDeviceId();
673
- case 24:
678
+ case 25:
674
679
  deviceId = _context10.sent;
675
680
  this.setPaymentNumberDevicePrefix(deviceId);
676
681
  businessCode = this.getBookingTicketBusinessCode();
677
682
  if (businessCode) {
678
- _context10.next = 30;
683
+ _context10.next = 31;
679
684
  break;
680
685
  }
681
686
  console.warn('[BookingTicket] businessCode 缺失,跳过 idGenerator 配置');
682
687
  return _context10.abrupt("return");
683
- case 30:
684
- _context10.prev = 30;
685
- _context10.next = 33;
688
+ case 31:
689
+ _context10.prev = 31;
690
+ _context10.next = 34;
686
691
  return idGenerator.configure({
687
692
  biz: businessCode,
688
693
  config: {
@@ -698,18 +703,18 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
698
703
  shopOrderPrefix: shopOrderPrefix
699
704
  }
700
705
  });
701
- case 33:
702
- _context10.next = 38;
706
+ case 34:
707
+ _context10.next = 39;
703
708
  break;
704
- case 35:
705
- _context10.prev = 35;
706
- _context10.t1 = _context10["catch"](30);
709
+ case 36:
710
+ _context10.prev = 36;
711
+ _context10.t1 = _context10["catch"](31);
707
712
  console.warn('[BookingTicket] idGenerator 配置失败', _context10.t1);
708
- case 38:
713
+ case 39:
709
714
  case "end":
710
715
  return _context10.stop();
711
716
  }
712
- }, _callee10, this, [[6, 12], [30, 35]]);
717
+ }, _callee10, this, [[7, 13], [31, 36]]);
713
718
  }));
714
719
  function configureIdGeneratorFromOpenData() {
715
720
  return _configureIdGeneratorFromOpenData.apply(this, arguments);
@@ -1887,8 +1892,8 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1887
1892
  }, {
1888
1893
  key: "getCustomerContactScope",
1889
1894
  value: function getCustomerContactScope() {
1890
- var _this$otherParams5, _this$otherParams6, _this$otherParams7;
1891
- return JSON.stringify([this.getPickupTimingScope(), (_this$otherParams5 = this.otherParams) === null || _this$otherParams5 === void 0 ? void 0 : _this$otherParams5.channel, (_this$otherParams6 = this.otherParams) === null || _this$otherParams6 === void 0 ? void 0 : _this$otherParams6.shop_id, (_this$otherParams7 = this.otherParams) === null || _this$otherParams7 === void 0 ? void 0 : _this$otherParams7.tenantId]);
1895
+ var _this$otherParams6, _this$otherParams7, _this$otherParams8;
1896
+ return JSON.stringify([this.getPickupTimingScope(), (_this$otherParams6 = this.otherParams) === null || _this$otherParams6 === void 0 ? void 0 : _this$otherParams6.channel, (_this$otherParams7 = this.otherParams) === null || _this$otherParams7 === void 0 ? void 0 : _this$otherParams7.shop_id, (_this$otherParams8 = this.otherParams) === null || _this$otherParams8 === void 0 ? void 0 : _this$otherParams8.tenantId]);
1892
1897
  }
1893
1898
  }, {
1894
1899
  key: "getCustomerContactOrderKey",
@@ -1955,7 +1960,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1955
1960
  key: "prefillOrderCustomerContactInfo",
1956
1961
  value: function prefillOrderCustomerContactInfo(customer, customerChanged) {
1957
1962
  var _order$_extend2,
1958
- _this$otherParams8,
1963
+ _this$otherParams9,
1959
1964
  _this4 = this;
1960
1965
  var order = this.getTempOrder();
1961
1966
  var customerId = Number(order === null || order === void 0 ? void 0 : order.customer_id);
@@ -1971,7 +1976,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1971
1976
  }
1972
1977
  // A relation explicitly returned as null is authoritative. Only a missing relation needs fetching.
1973
1978
  if (customer.contacts_info !== undefined) return;
1974
- var userPlatform = isCustomerUserPlatform((_this$otherParams8 = this.otherParams) === null || _this$otherParams8 === void 0 ? void 0 : _this$otherParams8.platform);
1979
+ var userPlatform = isCustomerUserPlatform((_this$otherParams9 = this.otherParams) === null || _this$otherParams9 === void 0 ? void 0 : _this$otherParams9.platform);
1975
1980
  var getAuthenticatedCustomerId = function getAuthenticatedCustomerId() {
1976
1981
  var _this4$core, _this4$core$getPlugin, _this4$core$getPlugin2;
1977
1982
  return Number((_this4$core = _this4.core) === null || _this4$core === void 0 || (_this4$core$getPlugin = _this4$core.getPlugin) === null || _this4$core$getPlugin === void 0 || (_this4$core$getPlugin = _this4$core$getPlugin.call(_this4$core, 'user')) === null || _this4$core$getPlugin === void 0 || (_this4$core$getPlugin2 = _this4$core$getPlugin.get) === null || _this4$core$getPlugin2 === void 0 || (_this4$core$getPlugin2 = _this4$core$getPlugin2.call(_this4$core$getPlugin)) === null || _this4$core$getPlugin2 === void 0 ? void 0 : _this4$core$getPlugin2.id);
@@ -2741,7 +2746,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2741
2746
  _extra$presetStartTim,
2742
2747
  _this$getOrderSession,
2743
2748
  _this8 = this,
2744
- _this$otherParams9;
2749
+ _this$otherParams10;
2745
2750
  var state = this.store.bookingContext.getState();
2746
2751
  var date = (_extra$date = extra === null || extra === void 0 ? void 0 : extra.date) !== null && _extra$date !== void 0 ? _extra$date : state.date;
2747
2752
  return _objectSpread(_objectSpread({
@@ -2755,7 +2760,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2755
2760
  isOrderSessionCurrent: function isOrderSessionCurrent(sessionId) {
2756
2761
  return _this8.isOrderSessionCurrent(sessionId);
2757
2762
  },
2758
- platform: String(((_this$otherParams9 = this.otherParams) === null || _this$otherParams9 === void 0 ? void 0 : _this$otherParams9.platform) || '').trim().toLowerCase()
2763
+ platform: String(((_this$otherParams10 = this.otherParams) === null || _this$otherParams10 === void 0 ? void 0 : _this$otherParams10.platform) || '').trim().toLowerCase()
2759
2764
  });
2760
2765
  }
2761
2766
 
@@ -2858,7 +2863,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2858
2863
  _extra$presetStartTim2,
2859
2864
  _this$getOrderSession2,
2860
2865
  _this9 = this,
2861
- _this$otherParams10;
2866
+ _this$otherParams11;
2862
2867
  var bookingContextState = this.store.bookingContext.getState();
2863
2868
  var date = (_extra$date2 = extra === null || extra === void 0 ? void 0 : extra.date) !== null && _extra$date2 !== void 0 ? _extra$date2 : bookingContextState.date;
2864
2869
  var orderCustomerId = (_ref14 = (_this$getOrderCustome4 = (_this$getOrderCustome5 = this.getOrderCustomerSnapshot()) === null || _this$getOrderCustome5 === void 0 ? void 0 : _this$getOrderCustome5.id) !== null && _this$getOrderCustome4 !== void 0 ? _this$getOrderCustome4 : (_this$store$order$get5 = this.store.order.getTempOrder()) === null || _this$store$order$get5 === void 0 ? void 0 : _this$store$order$get5.customer_id) !== null && _ref14 !== void 0 ? _ref14 : undefined;
@@ -2875,7 +2880,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2875
2880
  isOrderSessionCurrent: function isOrderSessionCurrent(sessionId) {
2876
2881
  return _this9.isOrderSessionCurrent(sessionId);
2877
2882
  },
2878
- platform: String(((_this$otherParams10 = this.otherParams) === null || _this$otherParams10 === void 0 ? void 0 : _this$otherParams10.platform) || '').trim().toLowerCase()
2883
+ platform: String(((_this$otherParams11 = this.otherParams) === null || _this$otherParams11 === void 0 ? void 0 : _this$otherParams11.platform) || '').trim().toLowerCase()
2879
2884
  });
2880
2885
  }
2881
2886
 
@@ -1 +1,46 @@
1
- "use strict";
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "BUY_X_GET_Y_FREE_STRATEGY", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _examples.BUY_X_GET_Y_FREE_STRATEGY;
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "ITEM_REWARD_STRATEGY", {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _examples.ITEM_REWARD_STRATEGY;
16
+ }
17
+ });
18
+ Object.defineProperty(exports, "PromotionAdapter", {
19
+ enumerable: true,
20
+ get: function () {
21
+ return _adapter.PromotionAdapter;
22
+ }
23
+ });
24
+ Object.defineProperty(exports, "PromotionEvaluator", {
25
+ enumerable: true,
26
+ get: function () {
27
+ return _evaluator.PromotionEvaluator;
28
+ }
29
+ });
30
+ Object.defineProperty(exports, "X_ITEMS_FOR_Y_PRICE_STRATEGY", {
31
+ enumerable: true,
32
+ get: function () {
33
+ return _examples.X_ITEMS_FOR_Y_PRICE_STRATEGY;
34
+ }
35
+ });
36
+ Object.defineProperty(exports, "default", {
37
+ enumerable: true,
38
+ get: function () {
39
+ return _adapter.default;
40
+ }
41
+ });
42
+ var _evaluator = require("./evaluator");
43
+ var _adapter = _interopRequireWildcard(require("./adapter"));
44
+ var _examples = require("./examples");
45
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
46
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
@@ -163,11 +163,8 @@ function resolveCutOffPolicyIssue(policy) {
163
163
  return null;
164
164
  }
165
165
  function addLeadWindow(base, unit, unitType, _timezoneName) {
166
- if (unitType === 'days') {
167
- const leadDate = (0, _localClock.addLocalCalendarDays)(base, unit);
168
- // Positive day lead times start at midnight; zero days keeps the current-time boundary.
169
- return Math.trunc(unit) > 0 ? (0, _localClock.localDateToScalarStart)((0, _localClock.formatLocalDate)(leadDate)) : leadDate;
170
- }
166
+ // Calendar-day lead times retain the current local hour, minute and second.
167
+ if (unitType === 'days') return (0, _localClock.addLocalCalendarDays)(base, unit);
171
168
  if (unitType === 'hours') return (0, _localClock.addLocalHours)(base, unit);
172
169
  return (0, _localClock.addLocalMinutes)(base, unit);
173
170
  }
@@ -366,7 +366,7 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
366
366
  * 获取当前的客户搜索条件
367
367
  * @returns 当前搜索条件
368
368
  */
369
- getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "num" | "skip">;
369
+ getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "skip" | "num">;
370
370
  /**
371
371
  * 获取客户列表状态(包含滚动加载相关状态)
372
372
  * @returns 客户状态
@@ -347,13 +347,14 @@ class BookingTicketImpl extends _BaseSales.BaseSalesImpl {
347
347
  return String(this.getAppData('device_id') || 0).slice(-2);
348
348
  }
349
349
  async configureIdGeneratorFromOpenData() {
350
+ // Customer storefronts use server-issued order numbers, never local sequences.
351
+ if ((0, _platform.isCustomerUserPlatform)(this.otherParams?.platform)) return;
352
+
350
353
  // 业务码切换或配置失败时不能复用上一次初始化的短号。
351
354
  this.setPaymentNumberDevicePrefix(null);
352
355
  const idGenerator = this.getIdGeneratorPlugin();
353
- if (!idGenerator?.configure) {
354
- console.warn('[BookingTicket] idGenerator 插件不可用,跳过配置');
355
- return;
356
- }
356
+ // Optional host capability. Do not warn or cache absence: POS may register it later.
357
+ if (typeof idGenerator?.configure !== 'function') return;
357
358
  let openDataConfig = null;
358
359
  try {
359
360
  openDataConfig = await this.loadOpenDataConfig();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "2.3.203",
4
+ "version": "2.3.205",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",