@pisell/pisellos 2.0.20 → 2.0.22

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.
@@ -79,13 +79,23 @@ export declare const formatResources: ({ booking, resources, }: {
79
79
  * @return {*}
80
80
  * @Author: zhiwei.Wang
81
81
  */
82
- export declare const getTimeSlicesByResource: ({ resource, duration, split, currentDate, capacity, resourcesUseableMap, }: {
82
+ export declare const getTimeSlicesByResource: ({ resource, duration, split, currentDate, capacity, resourcesUseableMap, cut_off_time }: {
83
83
  resource: ResourceItem;
84
84
  duration: number;
85
85
  split: number;
86
86
  currentDate: DateType | string;
87
87
  capacity?: number | undefined;
88
88
  resourcesUseableMap?: Record<string, boolean> | undefined;
89
+ cut_off_time?: {
90
+ future_day: number;
91
+ unit: number;
92
+ unit_type: string;
93
+ type: string;
94
+ ongoing?: {
95
+ type: string;
96
+ unit: number;
97
+ } | undefined;
98
+ } | undefined;
89
99
  }) => TimeSliceItem[];
90
100
  /**
91
101
  * @title: 获取时间切片列表的交集
@@ -123,7 +133,7 @@ export declare const mergeSubResourcesTimeSlices: (resources: ResourceItem[], re
123
133
  * @return {*}
124
134
  * @Author: zhiwei.Wang
125
135
  */
126
- export declare const getTimeSlicesByResources: ({ resourceIds, resourcesMap, duration, currentDate, split, capacity, resourcesUseableMap, }: {
136
+ export declare const getTimeSlicesByResources: ({ resourceIds, resourcesMap, duration, currentDate, split, capacity, resourcesUseableMap, cut_off_time }: {
127
137
  resourceIds: number[];
128
138
  resourcesMap: any;
129
139
  duration: number;
@@ -131,6 +141,16 @@ export declare const getTimeSlicesByResources: ({ resourceIds, resourcesMap, dur
131
141
  split: number;
132
142
  capacity?: number | undefined;
133
143
  resourcesUseableMap: Record<string, boolean>;
144
+ cut_off_time?: {
145
+ future_day: number;
146
+ unit: number;
147
+ unit_type: string;
148
+ type: string;
149
+ ongoing?: {
150
+ type: string;
151
+ unit: number;
152
+ } | undefined;
153
+ } | undefined;
134
154
  }) => any[];
135
155
  /**
136
156
  * @title: 获取其他人的已选资源
@@ -414,7 +414,8 @@ export var getTimeSlicesByResource = function getTimeSlicesByResource(_ref5) {
414
414
  currentDate = _ref5$currentDate === void 0 ? dayjs() : _ref5$currentDate,
415
415
  capacity = _ref5.capacity,
416
416
  _ref5$resourcesUseabl = _ref5.resourcesUseableMap,
417
- resourcesUseableMap = _ref5$resourcesUseabl === void 0 ? {} : _ref5$resourcesUseabl;
417
+ resourcesUseableMap = _ref5$resourcesUseabl === void 0 ? {} : _ref5$resourcesUseabl,
418
+ cut_off_time = _ref5.cut_off_time;
418
419
  var times = resource.times;
419
420
 
420
421
  // 存储所有时间切片
@@ -452,7 +453,8 @@ export var getTimeSlicesByResource = function getTimeSlicesByResource(_ref5) {
452
453
  time: time,
453
454
  resource: resource,
454
455
  currentCount: capacity || 1,
455
- resourcesUseableMap: resourcesUseableMap
456
+ resourcesUseableMap: resourcesUseableMap,
457
+ cut_off_time: cut_off_time
456
458
  });
457
459
  if ((resourcesUseableMap === null || resourcesUseableMap === void 0 ? void 0 : resourcesUseableMap[resource.id]) !== false) {
458
460
  resourcesUseableMap[resource.id] = _status.usable;
@@ -562,7 +564,8 @@ export var getTimeSlicesByResources = function getTimeSlicesByResources(_ref6) {
562
564
  currentDate = _ref6.currentDate,
563
565
  split = _ref6.split,
564
566
  capacity = _ref6.capacity,
565
- resourcesUseableMap = _ref6.resourcesUseableMap;
567
+ resourcesUseableMap = _ref6.resourcesUseableMap,
568
+ cut_off_time = _ref6.cut_off_time;
566
569
  // 获取资源列表
567
570
  var resources = getResourcesByIds(resourcesMap, resourceIds);
568
571
  mergeSubResourcesTimeSlices(resources, resourcesMap);
@@ -584,7 +587,8 @@ export var getTimeSlicesByResources = function getTimeSlicesByResources(_ref6) {
584
587
  split: split,
585
588
  currentDate: currentDate,
586
589
  capacity: capacity,
587
- resourcesUseableMap: resourcesUseableMap
590
+ resourcesUseableMap: resourcesUseableMap,
591
+ cut_off_time: cut_off_time
588
592
  }));
589
593
  }, []);
590
594
 
@@ -22,4 +22,5 @@ export declare class AccountModule extends BaseModule implements Module {
22
22
  setAccountInfo(account: Account): void;
23
23
  setActive(active: boolean): void;
24
24
  isActive(): boolean;
25
+ isLogin(): boolean;
25
26
  }
@@ -97,6 +97,10 @@ var AccountModule = class extends import_BaseModule.BaseModule {
97
97
  isActive() {
98
98
  return this.store.active;
99
99
  }
100
+ isLogin() {
101
+ var _a;
102
+ return ((_a = this.store.accountInfo) == null ? void 0 : _a.isLogin) || false;
103
+ }
100
104
  };
101
105
  // Annotate the CommonJS export names for ESM import in node:
102
106
  0 && (module.exports = {
@@ -27,6 +27,8 @@ export interface Account {
27
27
  type?: 'account' | 'holder';
28
28
  /** 账户信息原始数据 */
29
29
  _origin?: Record<string, any>;
30
+ /** 是否是登录账号 */
31
+ isLogin?: boolean;
30
32
  }
31
33
  /**
32
34
  * 账户模块状态
@@ -42,4 +42,5 @@ export declare class AccountListModule extends BaseModule implements Module {
42
42
  * @param params
43
43
  */
44
44
  fetchHolderAccounts(params: IFetchHolderAccountsParams): Promise<void>;
45
+ getLoginAccount(): AccountModule | undefined;
45
46
  }
@@ -312,6 +312,9 @@ var AccountListModule = class extends import_BaseModule.BaseModule {
312
312
  console.error(error);
313
313
  }
314
314
  }
315
+ getLoginAccount() {
316
+ return this.store.accounts.find((n) => n.isLogin());
317
+ }
315
318
  };
316
319
  // Annotate the CommonJS export names for ESM import in node:
317
320
  0 && (module.exports = {
@@ -18,6 +18,7 @@ export declare class Product extends BaseModule implements Module {
18
18
  protected otherParams: any;
19
19
  constructor(name?: string, version?: string);
20
20
  initialize(core: PisellCore, options: any): Promise<void>;
21
+ updateData(data: ProductData): void;
21
22
  /**
22
23
  * 获取商品数据
23
24
  */
@@ -38,6 +38,9 @@ var Product = class extends import_BaseModule.BaseModule {
38
38
  this.core = core;
39
39
  this.store = options.store || {};
40
40
  }
41
+ updateData(data) {
42
+ Object.assign(this.store, data);
43
+ }
41
44
  /**
42
45
  * 获取商品数据
43
46
  */
@@ -7,9 +7,16 @@ export declare class ProductList extends BaseModule implements Module {
7
7
  protected defaultName: string;
8
8
  protected defaultVersion: string;
9
9
  private store;
10
+ private request;
10
11
  constructor(name?: string, version?: string);
11
12
  initialize(core: PisellCore, options: any): Promise<void>;
12
13
  storeChange(path?: string, value?: any): Promise<void>;
14
+ loadProductsPrice({ ids, customer_id, schedule_date, channel, }: {
15
+ ids?: number[];
16
+ customer_id?: number;
17
+ schedule_date?: string;
18
+ channel?: string;
19
+ }): Promise<any>;
13
20
  getProducts(): Promise<ProductData[]>;
14
21
  getProduct(id: number): Promise<Product | undefined>;
15
22
  addProduct(products: ProductData[]): Promise<void>;
@@ -47,19 +47,41 @@ var ProductList = class extends import_BaseModule.BaseModule {
47
47
  this.store.productMap = /* @__PURE__ */ new Map();
48
48
  this.store.selectProducts = [];
49
49
  }
50
+ this.request = core.getPlugin("request");
50
51
  }
51
52
  async storeChange(path, value) {
52
53
  var _a;
53
54
  (_a = this.store.list) == null ? void 0 : _a.forEach((product) => {
54
- if (!this.store.productMap.has(`product-${product.id}`)) {
55
+ const productModule = this.store.productMap.get(`product-${product.id}`);
56
+ if (!productModule) {
55
57
  const newProductModule = new import_Product.Product(
56
58
  `product_${product.id.toString()}`
57
59
  );
58
60
  this.core.registerModule(newProductModule, { initialState: product });
59
61
  this.store.productMap.set(product.id.toString(), newProductModule);
62
+ } else {
63
+ productModule.updateData(product);
60
64
  }
61
65
  });
62
66
  }
67
+ async loadProductsPrice({
68
+ ids = [],
69
+ customer_id,
70
+ schedule_date,
71
+ channel
72
+ }) {
73
+ const productsData = await this.request.post(
74
+ `/product/query/price`,
75
+ {
76
+ ids,
77
+ customer_id,
78
+ schedule_date,
79
+ channel
80
+ },
81
+ { useCache: true }
82
+ );
83
+ return productsData.data;
84
+ }
63
85
  async getProducts() {
64
86
  await this.core.effects.emit(
65
87
  import_types.ProductListHooks.onGetProducts,
@@ -78,7 +100,18 @@ var ProductList = class extends import_BaseModule.BaseModule {
78
100
  return void 0;
79
101
  }
80
102
  async addProduct(products) {
81
- this.store.list = [...this.store.list, ...products];
103
+ if (!this.store.list) {
104
+ this.store.list = [];
105
+ }
106
+ products.forEach((n) => {
107
+ const index = this.store.list.findIndex((m) => m.id === n.id);
108
+ if (index === -1) {
109
+ this.store.list.push(n);
110
+ } else {
111
+ this.store.list[index] = n;
112
+ }
113
+ });
114
+ this.storeChange();
82
115
  }
83
116
  async selectProducts(products) {
84
117
  this.store.selectProducts = products;
@@ -0,0 +1,7 @@
1
+ import { Plugin } from '../types';
2
+ /**
3
+ * UserPlugin 接口定义
4
+ */
5
+ export interface UserPlugin extends Plugin {
6
+ get(): Record<string, any>;
7
+ }
@@ -0,0 +1,17 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __copyProps = (to, from, except, desc) => {
6
+ if (from && typeof from === "object" || typeof from === "function") {
7
+ for (let key of __getOwnPropNames(from))
8
+ if (!__hasOwnProp.call(to, key) && key !== except)
9
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
+ }
11
+ return to;
12
+ };
13
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
14
+
15
+ // src/plugins/user.ts
16
+ var user_exports = {};
17
+ module.exports = __toCommonJS(user_exports);
@@ -54,6 +54,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
54
54
  product_ids?: number[];
55
55
  category_ids?: number[];
56
56
  }): Promise<any>;
57
+ updateQuotationPriceAndCart(date: string): Promise<void>;
57
58
  loadAllSchedule(): Promise<void>;
58
59
  loadScheduleAvailableDate({ startDate, endDate, custom_page_id, channel, }: {
59
60
  startDate: string;
@@ -185,10 +186,11 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
185
186
  private getScheduleDataByIds;
186
187
  openProductDetail(productId: number): Promise<void>;
187
188
  closeProductDetail(): void;
188
- getTimeslotBySchedule({ date, scheduleIds, resources, }: {
189
+ getTimeslotBySchedule({ date, scheduleIds, resources, product }: {
189
190
  date: string;
190
191
  scheduleIds?: number[];
191
192
  resources?: ProductResourceItem[];
193
+ product?: ProductData;
192
194
  }): {
193
195
  start_time: string;
194
196
  end_time: string;
@@ -161,6 +161,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
161
161
  schedule_ids = [],
162
162
  schedule_date
163
163
  }) {
164
+ var _a;
164
165
  if (!(schedule_ids == null ? void 0 : schedule_ids.length)) {
165
166
  const schedule_ids_data = this.store.schedule.getScheduleListByIds(schedule_ids).map((n) => n.id);
166
167
  if (schedule_ids_data.length) {
@@ -169,11 +170,18 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
169
170
  schedule_ids = [0];
170
171
  }
171
172
  }
173
+ let userPlugin = this.core.getPlugin("user");
174
+ let customer_id = void 0;
175
+ try {
176
+ customer_id = (_a = userPlugin == null ? void 0 : userPlugin.get()) == null ? void 0 : _a.id;
177
+ } catch (error) {
178
+ console.error(error);
179
+ }
172
180
  const productsData = await this.request.post(
173
181
  `/product/query`,
174
182
  {
175
183
  open_quotation: 1,
176
- open_bundle: 1,
184
+ open_bundle: 0,
177
185
  extension_type: [
178
186
  "product_appointment",
179
187
  "appointment_ticket",
@@ -184,6 +192,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
184
192
  status: "published",
185
193
  num: 500,
186
194
  skip: 1,
195
+ customer_id,
187
196
  category_ids,
188
197
  ids: product_ids,
189
198
  collection,
@@ -214,6 +223,53 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
214
223
  schedule_date: date
215
224
  });
216
225
  }
226
+ async updateQuotationPriceAndCart(date) {
227
+ var _a;
228
+ const cartItems = this.store.cart.getItems();
229
+ if (cartItems.length) {
230
+ let userPlugin = this.core.getPlugin("user");
231
+ let customer_id = void 0;
232
+ try {
233
+ customer_id = (_a = userPlugin == null ? void 0 : userPlugin.get()) == null ? void 0 : _a.id;
234
+ } catch (error) {
235
+ console.error(error);
236
+ }
237
+ const res = await this.store.products.loadProductsPrice({
238
+ ids: cartItems.map((n) => n.id),
239
+ schedule_date: date,
240
+ customer_id
241
+ });
242
+ for (const item of cartItems) {
243
+ const targetProduct = res.find((n) => n.id === item.id);
244
+ const cartProduct = await this.store.products.getProduct(item.id);
245
+ const productInfo = cartProduct == null ? void 0 : cartProduct.getData();
246
+ let bundle = item._bundleOrigin;
247
+ productInfo.price = targetProduct == null ? void 0 : targetProduct.price;
248
+ productInfo.base_price = targetProduct == null ? void 0 : targetProduct.base_price;
249
+ bundle = bundle == null ? void 0 : bundle.map((n) => {
250
+ var _a2;
251
+ const targetBundle = (_a2 = targetProduct == null ? void 0 : targetProduct.bundle_group) == null ? void 0 : _a2.find((m) => m.id === n.group_id);
252
+ if (targetBundle) {
253
+ const targetBundleItem = targetBundle.bundle_item.find((m) => m.id === n.id);
254
+ if (targetBundleItem) {
255
+ return {
256
+ ...n,
257
+ price: targetBundleItem.price,
258
+ base_price: targetBundleItem.base_price
259
+ };
260
+ }
261
+ }
262
+ return n;
263
+ });
264
+ this.store.cart.updateItem({
265
+ _id: item._id,
266
+ product: productInfo,
267
+ bundle
268
+ });
269
+ }
270
+ ;
271
+ }
272
+ }
217
273
  // 加载当前店铺下所有 schedule
218
274
  async loadAllSchedule() {
219
275
  var _a;
@@ -334,11 +390,23 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
334
390
  * @param params
335
391
  */
336
392
  async fetchHolderAccountsAsync(params) {
393
+ var _a, _b, _c;
394
+ const cartItems = this.store.cart.getItems();
395
+ if (cartItems.length) {
396
+ let date = (_b = (_a = this.store.date.getDateRange()) == null ? void 0 : _a[0]) == null ? void 0 : _b.date;
397
+ if (!date) {
398
+ date = ((_c = cartItems == null ? void 0 : cartItems[0]) == null ? void 0 : _c.start_date) || "";
399
+ }
400
+ this.updateQuotationPriceAndCart(date);
401
+ }
337
402
  return this.store.accountList.fetchHolderAccounts(params);
338
403
  }
339
404
  // 设置日期范围,注入到日期模块中
340
405
  async setDateRange(dateRange) {
341
406
  this.store.date.setDateRange(dateRange);
407
+ if (dateRange.length && this.store.cart.getItems().length) {
408
+ this.updateQuotationPriceAndCart(dateRange[0].date);
409
+ }
342
410
  }
343
411
  clearDateRange() {
344
412
  this.store.date.clearDateRange();
@@ -414,9 +482,11 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
414
482
  }
415
483
  // 如果用户登录
416
484
  async setLoginAccount(accountId, accountInfo) {
485
+ var _a, _b, _c;
417
486
  const account = this.store.accountList.getAccount(accountId);
418
487
  if (account) {
419
488
  let stateAccountId = account.getId();
489
+ accountInfo.isLogin = true;
420
490
  account.setAccountInfo(accountInfo);
421
491
  const cartItems = this.store.cart.getItems();
422
492
  cartItems.forEach((item) => {
@@ -428,6 +498,13 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
428
498
  }
429
499
  });
430
500
  this.store.accountList.updateAccountListById(stateAccountId, accountInfo);
501
+ if (cartItems.length) {
502
+ let date = (_b = (_a = this.store.date.getDateRange()) == null ? void 0 : _a[0]) == null ? void 0 : _b.date;
503
+ if (!date) {
504
+ date = ((_c = cartItems == null ? void 0 : cartItems[0]) == null ? void 0 : _c.start_date) || "";
505
+ }
506
+ this.updateQuotationPriceAndCart(date);
507
+ }
431
508
  } else {
432
509
  throw new Error(`没有找到${accountId}账户`);
433
510
  }
@@ -1293,8 +1370,10 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
1293
1370
  const resourceIds = [];
1294
1371
  let resourcesTypeId = void 0;
1295
1372
  let isSingleResource = false;
1373
+ let maxCutOffTime = void 0;
1374
+ let maxCutOffTimeValue = (0, import_dayjs.default)();
1296
1375
  cartItems.forEach((item) => {
1297
- var _a2, _b2, _c2, _d2, _e2, _f2, _g;
1376
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g, _h, _i;
1298
1377
  (_c2 = (_b2 = (_a2 = item._productOrigin) == null ? void 0 : _a2.product_resource) == null ? void 0 : _b2.resources) == null ? void 0 : _c2.forEach((n) => {
1299
1378
  if (n.code === resources_code) {
1300
1379
  resources.push(...n.renderList || []);
@@ -1307,6 +1386,13 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
1307
1386
  resourcesTypeId = (_g = (_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(
1308
1387
  (n) => n.code === resources_code
1309
1388
  )) == null ? void 0 : _g.id;
1389
+ if (((_h = item._productOrigin) == null ? void 0 : _h.cut_off_time) && ((_i = item._productOrigin) == null ? void 0 : _i.cut_off_time.type) === "advance") {
1390
+ const currentCutOffTime = (0, import_dayjs.default)().add(item._productOrigin.cut_off_time.unit, item._productOrigin.cut_off_time.unit_type);
1391
+ if (currentCutOffTime.isAfter(maxCutOffTimeValue, "minute")) {
1392
+ maxCutOffTimeValue = currentCutOffTime;
1393
+ maxCutOffTime = item._productOrigin.cut_off_time;
1394
+ }
1395
+ }
1310
1396
  });
1311
1397
  if ((_b = (_a = dateRange == null ? void 0 : dateRange[0]) == null ? void 0 : _a.resource) == null ? void 0 : _b.length) {
1312
1398
  dateRange[0].resource.forEach((n) => {
@@ -1368,7 +1454,8 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
1368
1454
  duration,
1369
1455
  currentDate: dateRange[0].date,
1370
1456
  split: 10,
1371
- resourcesUseableMap
1457
+ resourcesUseableMap,
1458
+ cut_off_time: maxCutOffTime
1372
1459
  });
1373
1460
  return timeSlots;
1374
1461
  }
@@ -1457,11 +1544,12 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
1457
1544
  getTimeslotBySchedule({
1458
1545
  date,
1459
1546
  scheduleIds,
1460
- resources
1547
+ resources,
1548
+ product
1461
1549
  }) {
1462
1550
  var _a, _b, _c;
1463
1551
  const targetProduct = this.store.currentProduct;
1464
- const targetProductData = targetProduct == null ? void 0 : targetProduct.getData();
1552
+ const targetProductData = product || (targetProduct == null ? void 0 : targetProduct.getData());
1465
1553
  let targetSchedules = [];
1466
1554
  if (scheduleIds == null ? void 0 : scheduleIds.length) {
1467
1555
  targetSchedules = this.store.schedule.getScheduleListByIds(scheduleIds);
@@ -1510,7 +1598,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
1510
1598
  let currentResourcesCount = 0;
1511
1599
  const currentResourcesTimeSlotCanUsedArr = [];
1512
1600
  const mTimes = m.times.filter((n) => {
1513
- return !(0, import_dayjs.default)(n.start_at).isAfter((0, import_dayjs.default)(item.start)) && !(0, import_dayjs.default)(n.end_at).isBefore((0, import_dayjs.default)(item.end));
1601
+ return !(0, import_dayjs.default)(n.start_at).isAfter((0, import_dayjs.default)(item.start), "minute") && !(0, import_dayjs.default)(n.end_at).isBefore((0, import_dayjs.default)(item.end), "minute");
1514
1602
  });
1515
1603
  if (mTimes.length === 0) {
1516
1604
  return;
@@ -79,13 +79,23 @@ export declare const formatResources: ({ booking, resources, }: {
79
79
  * @return {*}
80
80
  * @Author: zhiwei.Wang
81
81
  */
82
- export declare const getTimeSlicesByResource: ({ resource, duration, split, currentDate, capacity, resourcesUseableMap, }: {
82
+ export declare const getTimeSlicesByResource: ({ resource, duration, split, currentDate, capacity, resourcesUseableMap, cut_off_time }: {
83
83
  resource: ResourceItem;
84
84
  duration: number;
85
85
  split: number;
86
86
  currentDate: DateType | string;
87
87
  capacity?: number | undefined;
88
88
  resourcesUseableMap?: Record<string, boolean> | undefined;
89
+ cut_off_time?: {
90
+ future_day: number;
91
+ unit: number;
92
+ unit_type: string;
93
+ type: string;
94
+ ongoing?: {
95
+ type: string;
96
+ unit: number;
97
+ } | undefined;
98
+ } | undefined;
89
99
  }) => TimeSliceItem[];
90
100
  /**
91
101
  * @title: 获取时间切片列表的交集
@@ -123,7 +133,7 @@ export declare const mergeSubResourcesTimeSlices: (resources: ResourceItem[], re
123
133
  * @return {*}
124
134
  * @Author: zhiwei.Wang
125
135
  */
126
- export declare const getTimeSlicesByResources: ({ resourceIds, resourcesMap, duration, currentDate, split, capacity, resourcesUseableMap, }: {
136
+ export declare const getTimeSlicesByResources: ({ resourceIds, resourcesMap, duration, currentDate, split, capacity, resourcesUseableMap, cut_off_time }: {
127
137
  resourceIds: number[];
128
138
  resourcesMap: any;
129
139
  duration: number;
@@ -131,6 +141,16 @@ export declare const getTimeSlicesByResources: ({ resourceIds, resourcesMap, dur
131
141
  split: number;
132
142
  capacity?: number | undefined;
133
143
  resourcesUseableMap: Record<string, boolean>;
144
+ cut_off_time?: {
145
+ future_day: number;
146
+ unit: number;
147
+ unit_type: string;
148
+ type: string;
149
+ ongoing?: {
150
+ type: string;
151
+ unit: number;
152
+ } | undefined;
153
+ } | undefined;
134
154
  }) => any[];
135
155
  /**
136
156
  * @title: 获取其他人的已选资源
@@ -328,7 +328,8 @@ var getTimeSlicesByResource = ({
328
328
  split = 10,
329
329
  currentDate = (0, import_dayjs.default)(),
330
330
  capacity,
331
- resourcesUseableMap = {}
331
+ resourcesUseableMap = {},
332
+ cut_off_time
332
333
  }) => {
333
334
  const { times } = resource;
334
335
  const timeSlices = [];
@@ -353,7 +354,8 @@ var getTimeSlicesByResource = ({
353
354
  time,
354
355
  resource,
355
356
  currentCount: capacity || 1,
356
- resourcesUseableMap
357
+ resourcesUseableMap,
358
+ cut_off_time
357
359
  });
358
360
  if ((resourcesUseableMap == null ? void 0 : resourcesUseableMap[resource.id]) !== false) {
359
361
  resourcesUseableMap[resource.id] = _status.usable;
@@ -415,7 +417,8 @@ var getTimeSlicesByResources = ({
415
417
  currentDate,
416
418
  split,
417
419
  capacity,
418
- resourcesUseableMap
420
+ resourcesUseableMap,
421
+ cut_off_time
419
422
  }) => {
420
423
  let resources = getResourcesByIds(resourcesMap, resourceIds);
421
424
  mergeSubResourcesTimeSlices(resources, resourcesMap);
@@ -438,7 +441,8 @@ var getTimeSlicesByResources = ({
438
441
  split,
439
442
  currentDate,
440
443
  capacity,
441
- resourcesUseableMap
444
+ resourcesUseableMap,
445
+ cut_off_time
442
446
  })
443
447
  );
444
448
  },
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "2.0.20",
4
+ "version": "2.0.22",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",