@pisell/pisellos 3.0.96 → 3.0.97

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.
@@ -1,9 +0,0 @@
1
- // 导出评估器
2
- export { PromotionEvaluator } from "./evaluator";
3
-
4
- // 导出适配器
5
- export { PromotionAdapter } from "./adapter";
6
- export { default } from "./adapter";
7
-
8
- // 导出策略配置示例常量
9
- export { X_ITEMS_FOR_Y_PRICE_STRATEGY, BUY_X_GET_Y_FREE_STRATEGY } from "./examples";
@@ -49,5 +49,5 @@ export declare class Product extends BaseModule implements Module {
49
49
  getCategories(): ProductCategory[];
50
50
  setOtherParams(key: string, value: any): void;
51
51
  getOtherParams(): any;
52
- getProductType(): "duration" | "session" | "normal";
52
+ getProductType(): "normal" | "duration" | "session";
53
53
  }
@@ -325,7 +325,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
325
325
  date: string;
326
326
  status: string;
327
327
  week: string;
328
- weekNum: 0 | 1 | 2 | 3 | 4 | 5 | 6;
328
+ weekNum: 0 | 2 | 1 | 5 | 3 | 4 | 6;
329
329
  }[]>;
330
330
  submitTimeSlot(timeSlots: TimeSliceItem): void;
331
331
  private getScheduleDataByIds;
@@ -261,10 +261,12 @@ var isInRepeatingSchedule = function isInRepeatingSchedule(targetDate, targetDat
261
261
 
262
262
  // 每日重复逻辑
263
263
  var isInDailyRepeat = function isInDailyRepeat(targetDate, startDate, endDate, repeatRule) {
264
- var daysDiff = targetDate.diff(startDate, 'day');
265
- if (daysDiff < 0) {
264
+ // dayjs#diff 会截断不足一天的负差值;必须先比较完整时刻,避免开始日前的
265
+ // 当天时段被误判为第 0 天。
266
+ if (targetDate.isBefore(startDate)) {
266
267
  return false;
267
268
  }
269
+ var daysDiff = targetDate.diff(startDate, 'day');
268
270
 
269
271
  // 检查频率
270
272
  if (daysDiff % repeatRule.frequency !== 0) {
@@ -283,6 +285,10 @@ var isInDailyRepeat = function isInDailyRepeat(targetDate, startDate, endDate, r
283
285
 
284
286
  // 每周重复逻辑
285
287
  var isInWeeklyRepeat = function isInWeeklyRepeat(targetDate, startDate, endDate, repeatRule) {
288
+ // 同上:不足一周的负差值会被截断为 0,开始时刻前不能命中重复规则。
289
+ if (targetDate.isBefore(startDate)) {
290
+ return false;
291
+ }
286
292
  var targetDayOfWeek = targetDate.day(); // 0=周日, 1=周一, ..., 6=周六
287
293
 
288
294
  // 检查是否在指定的星期几内
@@ -292,9 +298,6 @@ var isInWeeklyRepeat = function isInWeeklyRepeat(targetDate, startDate, endDate,
292
298
 
293
299
  // 计算周差
294
300
  var weeksDiff = targetDate.diff(startDate, 'week');
295
- if (weeksDiff < 0) {
296
- return false;
297
- }
298
301
 
299
302
  // 检查频率
300
303
  if (weeksDiff % repeatRule.frequency !== 0) {
@@ -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
- });
@@ -49,5 +49,5 @@ export declare class Product extends BaseModule implements Module {
49
49
  getCategories(): ProductCategory[];
50
50
  setOtherParams(key: string, value: any): void;
51
51
  getOtherParams(): any;
52
- getProductType(): "duration" | "session" | "normal";
52
+ getProductType(): "normal" | "duration" | "session";
53
53
  }
@@ -325,7 +325,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
325
325
  date: string;
326
326
  status: string;
327
327
  week: string;
328
- weekNum: 0 | 1 | 2 | 3 | 4 | 5 | 6;
328
+ weekNum: 0 | 2 | 1 | 5 | 3 | 4 | 6;
329
329
  }[]>;
330
330
  submitTimeSlot(timeSlots: TimeSliceItem): void;
331
331
  private getScheduleDataByIds;
@@ -183,10 +183,10 @@ var isInRepeatingSchedule = (targetDate, targetDateString, targetTimeString, sch
183
183
  }
184
184
  };
185
185
  var isInDailyRepeat = (targetDate, startDate, endDate, repeatRule) => {
186
- const daysDiff = targetDate.diff(startDate, "day");
187
- if (daysDiff < 0) {
186
+ if (targetDate.isBefore(startDate)) {
188
187
  return false;
189
188
  }
189
+ const daysDiff = targetDate.diff(startDate, "day");
190
190
  if (daysDiff % repeatRule.frequency !== 0) {
191
191
  return false;
192
192
  }
@@ -196,14 +196,14 @@ var isInDailyRepeat = (targetDate, startDate, endDate, repeatRule) => {
196
196
  return targetTimeOfDay >= startTimeOfDay && targetTimeOfDay <= endTimeOfDay;
197
197
  };
198
198
  var isInWeeklyRepeat = (targetDate, startDate, endDate, repeatRule) => {
199
+ if (targetDate.isBefore(startDate)) {
200
+ return false;
201
+ }
199
202
  const targetDayOfWeek = targetDate.day();
200
203
  if (!repeatRule.frequency_date.includes(targetDayOfWeek)) {
201
204
  return false;
202
205
  }
203
206
  const weeksDiff = targetDate.diff(startDate, "week");
204
- if (weeksDiff < 0) {
205
- return false;
206
- }
207
207
  if (weeksDiff % repeatRule.frequency !== 0) {
208
208
  return false;
209
209
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "3.0.96",
4
+ "version": "3.0.97",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",