@pisell/pisellos 2.0.38 → 2.0.39

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.
@@ -1568,7 +1568,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
1568
1568
  } else {
1569
1569
  var _cartItem$_productOri4, _this9$shopStore$get;
1570
1570
  var hasFlexibleDuration = ((_cartItem$_productOri4 = cartItem._productOrigin) === null || _cartItem$_productOri4 === void 0 || (_cartItem$_productOri4 = _cartItem$_productOri4.duration) === null || _cartItem$_productOri4 === void 0 ? void 0 : _cartItem$_productOri4.type) === 'flexible';
1571
- var operating_day_boundary = (_this9$shopStore$get = _this9.shopStore.get('core')) === null || _this9$shopStore$get === void 0 || (_this9$shopStore$get = _this9$shopStore$get.core) === null || _this9$shopStore$get === void 0 || (_this9$shopStore$get = _this9$shopStore$get.operating_day_boundary) === null || _this9$shopStore$get === void 0 ? void 0 : _this9$shopStore$get.time;
1571
+ var operating_day_boundary = (_this9$shopStore$get = _this9.shopStore.get('core')) === null || _this9$shopStore$get === void 0 || (_this9$shopStore$get = _this9$shopStore$get.core) === null || _this9$shopStore$get === void 0 ? void 0 : _this9$shopStore$get.operating_day_boundary;
1572
1572
  productResources.forEach(function (item) {
1573
1573
  // 如果资源的 capacity 已经小于了当前需要的 capacity ,则需要把资源给过滤掉
1574
1574
  // 同时,在这一步尝试去拉一下时间片,基于商品的时长,看每个资源是否还有空余时间能对这个商品做服务,如果没有则过滤
@@ -2297,7 +2297,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
2297
2297
  var _item$_productOrigin17;
2298
2298
  return ((_item$_productOrigin17 = item._productOrigin) === null || _item$_productOrigin17 === void 0 || (_item$_productOrigin17 = _item$_productOrigin17.duration) === null || _item$_productOrigin17 === void 0 ? void 0 : _item$_productOrigin17.type) === 'flexible';
2299
2299
  });
2300
- var operating_day_boundary = (_this$shopStore$get = this.shopStore.get('core')) === null || _this$shopStore$get === void 0 || (_this$shopStore$get = _this$shopStore$get.core) === null || _this$shopStore$get === void 0 || (_this$shopStore$get = _this$shopStore$get.operating_day_boundary) === null || _this$shopStore$get === void 0 ? void 0 : _this$shopStore$get.time;
2300
+ var operating_day_boundary = (_this$shopStore$get = this.shopStore.get('core')) === null || _this$shopStore$get === void 0 || (_this$shopStore$get = _this$shopStore$get.core) === null || _this$shopStore$get === void 0 ? void 0 : _this$shopStore$get.operating_day_boundary;
2301
2301
  var timeSlots = getTimeSlicesByResources({
2302
2302
  resourceIds: resourceIds,
2303
2303
  resourcesMap: resourcesMap,
@@ -2337,7 +2337,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
2337
2337
  }, {});
2338
2338
 
2339
2339
  // 店铺营业结束时间
2340
- var operating_day_boundary = (_this$shopStore$get2 = this.shopStore.get('core')) === null || _this$shopStore$get2 === void 0 || (_this$shopStore$get2 = _this$shopStore$get2.core) === null || _this$shopStore$get2 === void 0 || (_this$shopStore$get2 = _this$shopStore$get2.operating_day_boundary) === null || _this$shopStore$get2 === void 0 ? void 0 : _this$shopStore$get2.time;
2340
+ var operating_day_boundary = (_this$shopStore$get2 = this.shopStore.get('core')) === null || _this$shopStore$get2 === void 0 || (_this$shopStore$get2 = _this$shopStore$get2.core) === null || _this$shopStore$get2 === void 0 ? void 0 : _this$shopStore$get2.operating_day_boundary;
2341
2341
 
2342
2342
  // 处理每个账号的商品
2343
2343
  Object.values(itemsByAccount).forEach(function (accountItems) {
@@ -2365,7 +2365,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
2365
2365
 
2366
2366
  // 将 operating_day_boundary 转换为与 resourcesEndTime.end_at 相同日期的完整日期时间
2367
2367
  var resourceDate = dayjs(resourcesEndTime.end_at).format('YYYY-MM-DD');
2368
- var operatingBoundaryDateTime = "".concat(resourceDate, " ").concat(operating_day_boundary);
2368
+ var operatingBoundaryDateTime = "".concat(resourceDate, " ").concat(operating_day_boundary.type === 'start_time' ? "23:59" : operating_day_boundary.time);
2369
2369
  var endTime = dayjs(resourcesEndTime.end_at).isBefore(dayjs(operatingBoundaryDateTime)) ? resourcesEndTime.end_at : operatingBoundaryDateTime;
2370
2370
  // 修复:如果 endTime 只是时间格式(如 "17:00"),需要加上日期
2371
2371
  var formattedEndTime;
@@ -97,7 +97,10 @@ export declare const getTimeSlicesByResource: ({ resource, duration, split, curr
97
97
  } | undefined;
98
98
  } | undefined;
99
99
  hasFlexibleDuration?: boolean | undefined;
100
- operating_day_boundary?: string | undefined;
100
+ operating_day_boundary?: {
101
+ type: string;
102
+ time: string;
103
+ } | undefined;
101
104
  }) => TimeSliceItem[];
102
105
  /**
103
106
  * @title: 获取时间切片列表的交集
@@ -154,7 +157,10 @@ export declare const getTimeSlicesByResources: ({ resourceIds, resourcesMap, dur
154
157
  } | undefined;
155
158
  } | undefined;
156
159
  hasFlexibleDuration?: boolean | undefined;
157
- operating_day_boundary?: string | undefined;
160
+ operating_day_boundary?: {
161
+ type: string;
162
+ time: string;
163
+ } | undefined;
158
164
  }) => any[];
159
165
  /**
160
166
  * @title: 获取其他人的已选资源
@@ -463,7 +463,8 @@ export var getTimeSlicesByResource = function getTimeSlicesByResource(_ref5) {
463
463
  }
464
464
  if (_status.usable) {
465
465
  // 如果有hasFlexibleDuration,且timeSlice.start_at 大于等于operating_day_boundary,则不添加时间切片
466
- if (hasFlexibleDuration && operating_day_boundary && timeSlice.start_time >= operating_day_boundary) {
466
+ var operatingBoundaryDateTime = (operating_day_boundary === null || operating_day_boundary === void 0 ? void 0 : operating_day_boundary.type) === 'start_time' ? "23:59" : operating_day_boundary === null || operating_day_boundary === void 0 ? void 0 : operating_day_boundary.time;
467
+ if (hasFlexibleDuration && operating_day_boundary && timeSlice.start_time >= (operatingBoundaryDateTime || "23:59")) {
467
468
  break;
468
469
  }
469
470
  // 添加时间切片 09:00 ~ 10:00 09:20 ~ 10:20 09:00 ~ 10:00 09:20 ~ 10:20 11:00 ~ 12:00 11:20 ~ 12:20
@@ -824,7 +824,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
824
824
  const cartItems = this.store.cart.getItems().filter((n) => !(0, import_utils4.isNormalProduct)(n._productOrigin));
825
825
  const arr = [];
826
826
  cartItems.forEach((cartItem) => {
827
- var _a, _b, _c, _d, _e, _f, _g, _h;
827
+ var _a, _b, _c, _d, _e, _f, _g;
828
828
  let selectedResources = [];
829
829
  const formatCapacity = (0, import_resources.formatDefaultCapacitys)({
830
830
  capacity: (_a = cartItem._productOrigin) == null ? void 0 : _a.capacity,
@@ -904,7 +904,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
904
904
  });
905
905
  } else {
906
906
  const hasFlexibleDuration = ((_e = (_d = cartItem._productOrigin) == null ? void 0 : _d.duration) == null ? void 0 : _e.type) === "flexible";
907
- const operating_day_boundary = (_h = (_g = (_f = this.shopStore.get("core")) == null ? void 0 : _f.core) == null ? void 0 : _g.operating_day_boundary) == null ? void 0 : _h.time;
907
+ const operating_day_boundary = (_g = (_f = this.shopStore.get("core")) == null ? void 0 : _f.core) == null ? void 0 : _g.operating_day_boundary;
908
908
  productResources.forEach((item) => {
909
909
  item.renderList = item.renderList.filter((n) => {
910
910
  var _a2, _b2, _c2;
@@ -1478,7 +1478,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
1478
1478
  }
1479
1479
  // 从购物车中获取已经分配好第一步资源的所有时间片
1480
1480
  getTimeSlotByAllResources(resources_code) {
1481
- var _a, _b, _c, _d, _e, _f, _g, _h, _i;
1481
+ var _a, _b, _c, _d, _e, _f, _g, _h;
1482
1482
  let dateRange = this.store.date.getDateRange();
1483
1483
  const resources = [];
1484
1484
  const cartItems = this.store.cart.getItems().filter((n) => !(0, import_utils4.isNormalProduct)(n._productOrigin));
@@ -1488,7 +1488,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
1488
1488
  let maxCutOffTime = void 0;
1489
1489
  let maxCutOffTimeValue = (0, import_dayjs.default)();
1490
1490
  cartItems.forEach((item) => {
1491
- var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2;
1491
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i;
1492
1492
  (_c2 = (_b2 = (_a2 = item._productOrigin) == null ? void 0 : _a2.product_resource) == null ? void 0 : _b2.resources) == null ? void 0 : _c2.forEach((n) => {
1493
1493
  if (n.code === resources_code) {
1494
1494
  resources.push(...n.renderList || []);
@@ -1501,7 +1501,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
1501
1501
  resourcesTypeId = (_g2 = (_f2 = (_e2 = (_d2 = item == null ? void 0 : item._productOrigin) == null ? void 0 : _d2.product_resource) == null ? void 0 : _e2.resources) == null ? void 0 : _f2.find(
1502
1502
  (n) => n.code === resources_code
1503
1503
  )) == null ? void 0 : _g2.id;
1504
- if (((_h2 = item._productOrigin) == null ? void 0 : _h2.cut_off_time) && ((_i2 = item._productOrigin) == null ? void 0 : _i2.cut_off_time.type) === "advance") {
1504
+ if (((_h2 = item._productOrigin) == null ? void 0 : _h2.cut_off_time) && ((_i = item._productOrigin) == null ? void 0 : _i.cut_off_time.type) === "advance") {
1505
1505
  const currentCutOffTime = (0, import_dayjs.default)().add(
1506
1506
  item._productOrigin.cut_off_time.unit,
1507
1507
  item._productOrigin.cut_off_time.unit_type
@@ -1570,7 +1570,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
1570
1570
  var _a2, _b2;
1571
1571
  return ((_b2 = (_a2 = item._productOrigin) == null ? void 0 : _a2.duration) == null ? void 0 : _b2.type) === "flexible";
1572
1572
  });
1573
- const operating_day_boundary = (_i = (_h = (_g = this.shopStore.get("core")) == null ? void 0 : _g.core) == null ? void 0 : _h.operating_day_boundary) == null ? void 0 : _i.time;
1573
+ const operating_day_boundary = (_h = (_g = this.shopStore.get("core")) == null ? void 0 : _g.core) == null ? void 0 : _h.operating_day_boundary;
1574
1574
  const timeSlots = (0, import_resources.getTimeSlicesByResources)({
1575
1575
  resourceIds,
1576
1576
  resourcesMap,
@@ -1586,7 +1586,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
1586
1586
  }
1587
1587
  // 提交时间切片,绑定到对应购物车的商品上,更新购物车---只有 duration 商品
1588
1588
  submitTimeSlot(timeSlots) {
1589
- var _a, _b, _c;
1589
+ var _a, _b;
1590
1590
  const cartItems = this.store.cart.getItems().filter((n) => !(0, import_utils4.isNormalProduct)(n._productOrigin));
1591
1591
  const allResources = this.store.date.getResourcesListByDate(timeSlots.start_at.format("YYYY-MM-DD"));
1592
1592
  const itemsByAccount = cartItems.reduce(
@@ -1600,26 +1600,26 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
1600
1600
  },
1601
1601
  {}
1602
1602
  );
1603
- const operating_day_boundary = (_c = (_b = (_a = this.shopStore.get("core")) == null ? void 0 : _a.core) == null ? void 0 : _b.operating_day_boundary) == null ? void 0 : _c.time;
1603
+ const operating_day_boundary = (_b = (_a = this.shopStore.get("core")) == null ? void 0 : _a.core) == null ? void 0 : _b.operating_day_boundary;
1604
1604
  Object.values(itemsByAccount).forEach((accountItems) => {
1605
1605
  let currentStartTime = timeSlots.start_at.format("YYYY-MM-DD HH:mm");
1606
1606
  accountItems.forEach((item, index) => {
1607
1607
  var _a2;
1608
1608
  const newResources = (0, import_lodash_es.cloneDeep)(item._origin.resources);
1609
1609
  newResources.forEach((resource) => {
1610
- var _a3, _b2, _c2, _d, _e;
1610
+ var _a3, _b2, _c, _d, _e;
1611
1611
  if (((_b2 = (_a3 = item._productOrigin) == null ? void 0 : _a3.duration) == null ? void 0 : _b2.type) === "flexible") {
1612
1612
  item.duration = {
1613
1613
  type: "minutes",
1614
1614
  value: 10
1615
1615
  };
1616
1616
  resource.startTime = timeSlots.start_at.format("YYYY-MM-DD HH:mm");
1617
- const targetResourceTimes = (_c2 = allResources == null ? void 0 : allResources.find((n) => n.id === resource.id)) == null ? void 0 : _c2.times;
1617
+ const targetResourceTimes = (_c = allResources == null ? void 0 : allResources.find((n) => n.id === resource.id)) == null ? void 0 : _c.times;
1618
1618
  const resourcesEndTime = targetResourceTimes.reduce((acc, curr) => {
1619
1619
  return (0, import_dayjs.default)(curr.end_at).isBefore((0, import_dayjs.default)(acc.end_at)) ? curr : acc;
1620
1620
  }, targetResourceTimes[0]);
1621
1621
  const resourceDate = (0, import_dayjs.default)(resourcesEndTime.end_at).format("YYYY-MM-DD");
1622
- const operatingBoundaryDateTime = `${resourceDate} ${operating_day_boundary}`;
1622
+ const operatingBoundaryDateTime = `${resourceDate} ${operating_day_boundary.type === "start_time" ? "23:59" : operating_day_boundary.time}`;
1623
1623
  const endTime = (0, import_dayjs.default)(resourcesEndTime.end_at).isBefore((0, import_dayjs.default)(operatingBoundaryDateTime)) ? resourcesEndTime.end_at : operatingBoundaryDateTime;
1624
1624
  let formattedEndTime;
1625
1625
  if (typeof endTime === "string" && endTime.includes(":") && !endTime.includes(" ") && !endTime.includes("T")) {
@@ -97,7 +97,10 @@ export declare const getTimeSlicesByResource: ({ resource, duration, split, curr
97
97
  } | undefined;
98
98
  } | undefined;
99
99
  hasFlexibleDuration?: boolean | undefined;
100
- operating_day_boundary?: string | undefined;
100
+ operating_day_boundary?: {
101
+ type: string;
102
+ time: string;
103
+ } | undefined;
101
104
  }) => TimeSliceItem[];
102
105
  /**
103
106
  * @title: 获取时间切片列表的交集
@@ -154,7 +157,10 @@ export declare const getTimeSlicesByResources: ({ resourceIds, resourcesMap, dur
154
157
  } | undefined;
155
158
  } | undefined;
156
159
  hasFlexibleDuration?: boolean | undefined;
157
- operating_day_boundary?: string | undefined;
160
+ operating_day_boundary?: {
161
+ type: string;
162
+ time: string;
163
+ } | undefined;
158
164
  }) => any[];
159
165
  /**
160
166
  * @title: 获取其他人的已选资源
@@ -366,7 +366,8 @@ var getTimeSlicesByResource = ({
366
366
  resourcesUseableMap[resource.id] = _status.usable;
367
367
  }
368
368
  if (_status.usable) {
369
- if (hasFlexibleDuration && operating_day_boundary && timeSlice.start_time >= operating_day_boundary) {
369
+ const operatingBoundaryDateTime = (operating_day_boundary == null ? void 0 : operating_day_boundary.type) === "start_time" ? "23:59" : operating_day_boundary == null ? void 0 : operating_day_boundary.time;
370
+ if (hasFlexibleDuration && operating_day_boundary && timeSlice.start_time >= (operatingBoundaryDateTime || "23:59")) {
370
371
  break;
371
372
  }
372
373
  timeSlices.push({
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "2.0.38",
4
+ "version": "2.0.39",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",