@pisell/pisellos 2.1.146 → 2.1.148

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.
@@ -310,7 +310,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
310
310
  date: string;
311
311
  status: string;
312
312
  week: string;
313
- weekNum: 0 | 5 | 1 | 4 | 2 | 3 | 6;
313
+ weekNum: 0 | 2 | 1 | 5 | 4 | 3 | 6;
314
314
  }[]>;
315
315
  submitTimeSlot(timeSlots: TimeSliceItem): void;
316
316
  private getScheduleDataByIds;
@@ -329,7 +329,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
329
329
  count: number;
330
330
  left: number;
331
331
  summaryCount: number;
332
- status: "sold_out" | "lots_of_space" | "filling_up_fast";
332
+ status: "lots_of_space" | "filling_up_fast" | "sold_out";
333
333
  }[];
334
334
  /**
335
335
  * 找到多个资源的公共可用时间段
@@ -1349,7 +1349,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
1349
1349
  var resourceState = this.store.resource;
1350
1350
  var resourceSelectType = resourceState === null || resourceState === void 0 ? void 0 : resourceState.resourceSelectType;
1351
1351
 
1352
- // single 预约独占整张桌台,capacity form_record.capacity;其他情况(multiple / capacity / undefined)占 1 个容量位
1352
+ // collect_pax 时的资源占用兜底:single 独占整张桌台,其余模式占 1 个容量位。
1353
1353
  var resolveResourceCapacity = function resolveResourceCapacity() {
1354
1354
  if (resourceSelectType === 'single') {
1355
1355
  var _resourceState$table_;
@@ -1361,10 +1361,13 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
1361
1361
  return 1;
1362
1362
  };
1363
1363
  return function (payload, _ref3) {
1364
- var _tempOrder$resource_i, _ref4, _pickOriginal, _resourceState$table_2, _resourceState$relati, _tempOrder$metadata, _pickFirstCustomCapac;
1364
+ var _tempOrder$resource_i, _tempOrder$metadata, _ref4, _pickOriginal, _resourceState$table_2, _resourceState$relati, _pickFirstCustomCapac;
1365
1365
  var bookingUuid = _ref3.bookingUuid,
1366
1366
  tempOrder = _ref3.tempOrder;
1367
1367
  var resourceId = (_tempOrder$resource_i = tempOrder.resource_id) !== null && _tempOrder$resource_i !== void 0 ? _tempOrder$resource_i : resourceState === null || resourceState === void 0 ? void 0 : resourceState.relationId;
1368
+ var rawCollectPax = (_tempOrder$metadata = tempOrder.metadata) === null || _tempOrder$metadata === void 0 ? void 0 : _tempOrder$metadata.collect_pax;
1369
+ var hasCollectPaxForCapacity = rawCollectPax !== null && rawCollectPax !== undefined && rawCollectPax !== '';
1370
+ var resourceCapacityValue = hasCollectPaxForCapacity ? normalizeSubmitCollectPaxValue(rawCollectPax) : resolveResourceCapacity();
1368
1371
  var pickOriginal = function pickOriginal(value) {
1369
1372
  if (value && _typeof(value) === 'object' && !Array.isArray(value)) {
1370
1373
  var original = value.original;
@@ -1380,20 +1383,19 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
1380
1383
  main_field: mainField,
1381
1384
  form_id: resourceState.tableFormId,
1382
1385
  relation_id: (_resourceState$relati = resourceState.relationId) !== null && _resourceState$relati !== void 0 ? _resourceState$relati : resourceId,
1383
- capacity: resolveResourceCapacity(),
1386
+ capacity: resourceCapacityValue,
1384
1387
  metadata: _this5.buildScanOrderResourceMetadata({
1385
1388
  resourceState: resourceState,
1386
1389
  resourceName: mainField
1387
1390
  })
1388
1391
  } : undefined;
1389
1392
  var ruleProductUid = ruleProduct ? createUuidV4() : undefined;
1390
- // 默认 resolveResourceCapacity(single 为桌台容量,其余多为 1);有 collect_pax value 优先用人数
1391
- var rawCollectPax = (_tempOrder$metadata = tempOrder.metadata) === null || _tempOrder$metadata === void 0 ? void 0 : _tempOrder$metadata.collect_pax;
1392
- var hasCollectPaxForCapacity = rawCollectPax !== null && rawCollectPax !== undefined && rawCollectPax !== '';
1393
- var bookingCapacityValue = hasCollectPaxForCapacity ? normalizeSubmitCollectPaxValue(rawCollectPax) : resolveResourceCapacity();
1393
+ // collect_pax booking/resource capacity number 都代表本次 pax;否则使用资源占用兜底值。
1394
+ var bookingCapacityValue = resourceCapacityValue;
1394
1395
  var bookingCapacityDimensionId = (_pickFirstCustomCapac = pickFirstCustomCapacityDimensionId(_this5.enabledReservationRuleProducts)) !== null && _pickFirstCustomCapac !== void 0 ? _pickFirstCustomCapac : 0;
1395
1396
  var nextBookings = (payload.bookings || []).map(function (booking, idx) {
1396
1397
  return _objectSpread(_objectSpread(_objectSpread({}, booking), {}, {
1398
+ number: bookingCapacityValue,
1397
1399
  appointment_status: 'started',
1398
1400
  metadata: _objectSpread(_objectSpread(_objectSpread({}, booking.metadata || {}), resourceSelectType ? {
1399
1401
  resource_select_type: resourceSelectType
@@ -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
- });
@@ -310,7 +310,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
310
310
  date: string;
311
311
  status: string;
312
312
  week: string;
313
- weekNum: 0 | 5 | 1 | 4 | 2 | 3 | 6;
313
+ weekNum: 0 | 2 | 1 | 5 | 4 | 3 | 6;
314
314
  }[]>;
315
315
  submitTimeSlot(timeSlots: TimeSliceItem): void;
316
316
  private getScheduleDataByIds;
@@ -329,7 +329,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
329
329
  count: number;
330
330
  left: number;
331
331
  summaryCount: number;
332
- status: "sold_out" | "lots_of_space" | "filling_up_fast";
332
+ status: "lots_of_space" | "filling_up_fast" | "sold_out";
333
333
  }[];
334
334
  /**
335
335
  * 找到多个资源的公共可用时间段
@@ -838,6 +838,9 @@ var _ScanOrderImpl = class extends import_BaseModule.BaseModule {
838
838
  return (payload, { bookingUuid, tempOrder }) => {
839
839
  var _a, _b;
840
840
  const resourceId = tempOrder.resource_id ?? (resourceState == null ? void 0 : resourceState.relationId);
841
+ const rawCollectPax = (_a = tempOrder.metadata) == null ? void 0 : _a.collect_pax;
842
+ const hasCollectPaxForCapacity = rawCollectPax !== null && rawCollectPax !== void 0 && rawCollectPax !== "";
843
+ const resourceCapacityValue = hasCollectPaxForCapacity ? (0, import_utils2.normalizeSubmitCollectPaxValue)(rawCollectPax) : resolveResourceCapacity();
841
844
  const pickOriginal = (value) => {
842
845
  if (value && typeof value === "object" && !Array.isArray(value)) {
843
846
  const original = value.original;
@@ -845,7 +848,7 @@ var _ScanOrderImpl = class extends import_BaseModule.BaseModule {
845
848
  }
846
849
  return void 0;
847
850
  };
848
- const mainField = pickOriginal(tempOrder.table_number) ?? pickOriginal((_a = resourceState == null ? void 0 : resourceState.table_form_record) == null ? void 0 : _a.name) ?? "";
851
+ const mainField = pickOriginal(tempOrder.table_number) ?? pickOriginal((_b = resourceState == null ? void 0 : resourceState.table_form_record) == null ? void 0 : _b.name) ?? "";
849
852
  const resourceEntry = resourceState && resourceId ? {
850
853
  relation_type: "form",
851
854
  like_status: "common",
@@ -853,19 +856,18 @@ var _ScanOrderImpl = class extends import_BaseModule.BaseModule {
853
856
  main_field: mainField,
854
857
  form_id: resourceState.tableFormId,
855
858
  relation_id: resourceState.relationId ?? resourceId,
856
- capacity: resolveResourceCapacity(),
859
+ capacity: resourceCapacityValue,
857
860
  metadata: this.buildScanOrderResourceMetadata({
858
861
  resourceState,
859
862
  resourceName: mainField
860
863
  })
861
864
  } : void 0;
862
865
  const ruleProductUid = ruleProduct ? (0, import_utils2.createUuidV4)() : void 0;
863
- const rawCollectPax = (_b = tempOrder.metadata) == null ? void 0 : _b.collect_pax;
864
- const hasCollectPaxForCapacity = rawCollectPax !== null && rawCollectPax !== void 0 && rawCollectPax !== "";
865
- const bookingCapacityValue = hasCollectPaxForCapacity ? (0, import_utils2.normalizeSubmitCollectPaxValue)(rawCollectPax) : resolveResourceCapacity();
866
+ const bookingCapacityValue = resourceCapacityValue;
866
867
  const bookingCapacityDimensionId = (0, import_utils.pickFirstCustomCapacityDimensionId)(this.enabledReservationRuleProducts) ?? 0;
867
868
  const nextBookings = (payload.bookings || []).map((booking, idx) => ({
868
869
  ...booking,
870
+ number: bookingCapacityValue,
869
871
  appointment_status: "started",
870
872
  metadata: {
871
873
  ...booking.metadata || {},
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "2.1.146",
4
+ "version": "2.1.148",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",