@pisell/pisellos 2.3.111 → 2.3.113

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.
@@ -26,7 +26,7 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
26
26
  import dayjs from 'dayjs';
27
27
  import { BaseModule } from "../BaseModule";
28
28
  import { RequestModeENUM } from "../../plugins/request";
29
- import { normalizeRuntimePlatform } from "../../utils/platform";
29
+ import { isCustomerUserPlatform } from "../../utils/platform";
30
30
  import { BookingContextEvent } from "./types";
31
31
  import { formatResourceListAndMap } from "./utils/formatResourceList";
32
32
  export * from "./types";
@@ -158,9 +158,9 @@ export function buildBookingConfigQueryKey() {
158
158
  }
159
159
  function resolveBookingConfigRequest(platform) {
160
160
  var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
161
- var isH5 = normalizeRuntimePlatform(platform) === 'h5';
162
- var endpoint = isH5 ? H5_BOOKING_CONFIG_ENDPOINT : BOOKING_CONFIG_ENDPOINT;
163
- var query = isH5 ? {
161
+ var isCustomerPlatform = isCustomerUserPlatform(platform);
162
+ var endpoint = isCustomerPlatform ? H5_BOOKING_CONFIG_ENDPOINT : BOOKING_CONFIG_ENDPOINT;
163
+ var query = isCustomerPlatform ? {
164
164
  item_type: params.item_type || DEFAULT_BOOKING_CONFIG_PARAMS.item_type
165
165
  } : _objectSpread(_objectSpread({}, DEFAULT_BOOKING_CONFIG_PARAMS), params);
166
166
  var keys = Object.keys(query).sort();
@@ -132,7 +132,8 @@ export var OpenDataModule = /*#__PURE__*/function (_BaseModule) {
132
132
  key: "shouldSkipInvoiceTemplateDocument",
133
133
  value: function shouldSkipInvoiceTemplateDocument() {
134
134
  var _this$otherParams;
135
- return String(((_this$otherParams = this.otherParams) === null || _this$otherParams === void 0 ? void 0 : _this$otherParams.platform) || '').trim().toLowerCase() === 'h5';
135
+ var platform = String(((_this$otherParams = this.otherParams) === null || _this$otherParams === void 0 ? void 0 : _this$otherParams.platform) || '').trim().toLowerCase();
136
+ return platform === 'pc' || platform === 'h5';
136
137
  }
137
138
  }, {
138
139
  key: "fetchOpenData",
@@ -557,7 +557,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
557
557
  generateIdempotencyToken(): string;
558
558
  syncPaymentsToOrder<T = any>(params: SyncPaymentsToOrderParams): Promise<SyncPaymentsToOrderResult<T>>;
559
559
  createOrder(params: CommitOrderParams['query']): {
560
- type: "virtual" | "appointment_booking";
560
+ type: "appointment_booking" | "virtual";
561
561
  platform: string;
562
562
  sales_channel: string;
563
563
  order_sales_channel: string;
@@ -1606,8 +1606,9 @@ function buildVoucherAssets(params) {
1606
1606
  }].concat(_toConsumableArray(timeRow ? [timeRow] : []))];
1607
1607
  });
1608
1608
  }
1609
+ var TICKET_VOUCHER_TAGS = new Set(['ticket', 'product_package_ticket', 'appointment_ticket', 'session_ticket']);
1609
1610
  function isTicketVoucher(voucher) {
1610
- return stringify(voucher.tag).trim().toLowerCase() === 'ticket';
1611
+ return TICKET_VOUCHER_TAGS.has(stringify(voucher.tag).trim().toLowerCase());
1611
1612
  }
1612
1613
  function getVoucherValidity(voucher, locale) {
1613
1614
  var _voucher$metadata, _voucher$metadata2, _voucher$metadata3, _voucher$metadata4, _voucher$metadata5, _voucher$metadata6, _voucher$metadata7, _voucher$metadata8, _voucher$metadata9, _voucher$metadata10, _voucher$start_time, _voucher$metadata11, _voucher$end_time, _voucher$metadata12;
@@ -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 | 6 | 4 | 5 | 3;
329
+ weekNum: 0 | 2 | 1 | 6 | 5 | 3 | 4;
330
330
  }[]>;
331
331
  submitTimeSlot(timeSlots: TimeSliceItem): void;
332
332
  private getScheduleDataByIds;
@@ -345,7 +345,7 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
345
345
  * 获取当前的客户搜索条件
346
346
  * @returns 当前搜索条件
347
347
  */
348
- getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "num" | "skip">;
348
+ getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "skip" | "num">;
349
349
  /**
350
350
  * 获取客户列表状态(包含滚动加载相关状态)
351
351
  * @returns 客户状态
@@ -127,8 +127,8 @@ export declare class UnifiedBookingSalesImpl extends BookingTicket {
127
127
  */
128
128
  clearSessionStorageOrderSnapshot(): void;
129
129
  /**
130
- * H5/Kiosk 不能把已收款订单留在本地等待重试,必须直接等待云端 checkout。
131
- * 其它平台保持 WebPOS/POS 的本地待同步任务;显式 true 仍可强制使用本地任务。
130
+ * PC/H5/Kiosk 结账默认直接等待云端 checkout;POS/WebPOS 仍保持本地待同步。
131
+ * 显式传 checkoutSyncTaskEnabled: true 时仍可回退到本地同步模式。
132
132
  */
133
133
  protected shouldUseCheckoutSyncTask(): boolean;
134
134
  /** UnifiedBookingSales 的真实结账默认请求收据数据,供云端确认后再本地打印。 */
@@ -1904,8 +1904,8 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
1904
1904
  }
1905
1905
 
1906
1906
  /**
1907
- * H5/Kiosk 不能把已收款订单留在本地等待重试,必须直接等待云端 checkout。
1908
- * 其它平台保持 WebPOS/POS 的本地待同步任务;显式 true 仍可强制使用本地任务。
1907
+ * PC/H5/Kiosk 结账默认直接等待云端 checkout;POS/WebPOS 仍保持本地待同步。
1908
+ * 显式传 checkoutSyncTaskEnabled: true 时仍可回退到本地同步模式。
1909
1909
  */
1910
1910
  }, {
1911
1911
  key: "shouldUseCheckoutSyncTask",
@@ -1914,7 +1914,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
1914
1914
  var configured = (_this$otherParams15 = this.otherParams) === null || _this$otherParams15 === void 0 ? void 0 : _this$otherParams15.checkoutSyncTaskEnabled;
1915
1915
  if (configured === true) return true;
1916
1916
  var platform = normalizeRuntimePlatform((_this$otherParams16 = this.otherParams) === null || _this$otherParams16 === void 0 ? void 0 : _this$otherParams16.platform);
1917
- return platform !== 'h5' && platform !== 'kiosk';
1917
+ return !isCustomerUserPlatform(platform) && platform !== 'kiosk';
1918
1918
  }
1919
1919
 
1920
1920
  /** UnifiedBookingSales 的真实结账默认请求收据数据,供云端确认后再本地打印。 */
@@ -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; }
@@ -171,9 +171,9 @@ function buildBookingConfigQueryKey(params = {}) {
171
171
  return JSON.stringify(sorted);
172
172
  }
173
173
  function resolveBookingConfigRequest(platform, params = {}) {
174
- const isH5 = (0, _platform.normalizeRuntimePlatform)(platform) === 'h5';
175
- const endpoint = isH5 ? H5_BOOKING_CONFIG_ENDPOINT : BOOKING_CONFIG_ENDPOINT;
176
- const query = isH5 ? {
174
+ const isCustomerPlatform = (0, _platform.isCustomerUserPlatform)(platform);
175
+ const endpoint = isCustomerPlatform ? H5_BOOKING_CONFIG_ENDPOINT : BOOKING_CONFIG_ENDPOINT;
176
+ const query = isCustomerPlatform ? {
177
177
  item_type: params.item_type || DEFAULT_BOOKING_CONFIG_PARAMS.item_type
178
178
  } : {
179
179
  ...DEFAULT_BOOKING_CONFIG_PARAMS,
@@ -153,7 +153,8 @@ class OpenDataModule extends _BaseModule.BaseModule {
153
153
  this.fatherModule = this.otherParams.fatherModule;
154
154
  }
155
155
  shouldSkipInvoiceTemplateDocument() {
156
- return String(this.otherParams?.platform || '').trim().toLowerCase() === 'h5';
156
+ const platform = String(this.otherParams?.platform || '').trim().toLowerCase();
157
+ return platform === 'pc' || platform === 'h5';
157
158
  }
158
159
  async fetchOpenData(params) {
159
160
  const fetchRevision = ++this.fetchRevision;
@@ -557,7 +557,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
557
557
  generateIdempotencyToken(): string;
558
558
  syncPaymentsToOrder<T = any>(params: SyncPaymentsToOrderParams): Promise<SyncPaymentsToOrderResult<T>>;
559
559
  createOrder(params: CommitOrderParams['query']): {
560
- type: "virtual" | "appointment_booking";
560
+ type: "appointment_booking" | "virtual";
561
561
  platform: string;
562
562
  sales_channel: string;
563
563
  order_sales_channel: string;
@@ -1490,8 +1490,9 @@ function buildVoucherAssets(params) {
1490
1490
  }, ...(timeRow ? [timeRow] : [])]];
1491
1491
  });
1492
1492
  }
1493
+ const TICKET_VOUCHER_TAGS = new Set(['ticket', 'product_package_ticket', 'appointment_ticket', 'session_ticket']);
1493
1494
  function isTicketVoucher(voucher) {
1494
- return stringify(voucher.tag).trim().toLowerCase() === 'ticket';
1495
+ return TICKET_VOUCHER_TAGS.has(stringify(voucher.tag).trim().toLowerCase());
1495
1496
  }
1496
1497
  function getVoucherValidity(voucher, locale) {
1497
1498
  const availableTime = firstPresentValue(voucher.available_time, voucher.avaliable_time, voucher.metadata?.available_time, voucher.metadata?.avaliable_time);
@@ -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 | 6 | 4 | 5 | 3;
329
+ weekNum: 0 | 2 | 1 | 6 | 5 | 3 | 4;
330
330
  }[]>;
331
331
  submitTimeSlot(timeSlots: TimeSliceItem): void;
332
332
  private getScheduleDataByIds;
@@ -345,7 +345,7 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
345
345
  * 获取当前的客户搜索条件
346
346
  * @returns 当前搜索条件
347
347
  */
348
- getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "num" | "skip">;
348
+ getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "skip" | "num">;
349
349
  /**
350
350
  * 获取客户列表状态(包含滚动加载相关状态)
351
351
  * @returns 客户状态
@@ -127,8 +127,8 @@ export declare class UnifiedBookingSalesImpl extends BookingTicket {
127
127
  */
128
128
  clearSessionStorageOrderSnapshot(): void;
129
129
  /**
130
- * H5/Kiosk 不能把已收款订单留在本地等待重试,必须直接等待云端 checkout。
131
- * 其它平台保持 WebPOS/POS 的本地待同步任务;显式 true 仍可强制使用本地任务。
130
+ * PC/H5/Kiosk 结账默认直接等待云端 checkout;POS/WebPOS 仍保持本地待同步。
131
+ * 显式传 checkoutSyncTaskEnabled: true 时仍可回退到本地同步模式。
132
132
  */
133
133
  protected shouldUseCheckoutSyncTask(): boolean;
134
134
  /** UnifiedBookingSales 的真实结账默认请求收据数据,供云端确认后再本地打印。 */
@@ -1581,14 +1581,14 @@ class UnifiedBookingSalesImpl extends _BookingTicket.BookingTicket {
1581
1581
  }
1582
1582
 
1583
1583
  /**
1584
- * H5/Kiosk 不能把已收款订单留在本地等待重试,必须直接等待云端 checkout。
1585
- * 其它平台保持 WebPOS/POS 的本地待同步任务;显式 true 仍可强制使用本地任务。
1584
+ * PC/H5/Kiosk 结账默认直接等待云端 checkout;POS/WebPOS 仍保持本地待同步。
1585
+ * 显式传 checkoutSyncTaskEnabled: true 时仍可回退到本地同步模式。
1586
1586
  */
1587
1587
  shouldUseCheckoutSyncTask() {
1588
1588
  const configured = this.otherParams?.checkoutSyncTaskEnabled;
1589
1589
  if (configured === true) return true;
1590
1590
  const platform = (0, _platform.normalizeRuntimePlatform)(this.otherParams?.platform);
1591
- return platform !== 'h5' && platform !== 'kiosk';
1591
+ return !(0, _platform.isCustomerUserPlatform)(platform) && platform !== 'kiosk';
1592
1592
  }
1593
1593
 
1594
1594
  /** UnifiedBookingSales 的真实结账默认请求收据数据,供云端确认后再本地打印。 */
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "2.3.111",
4
+ "version": "2.3.113",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",