@pisell/pisellos 2.2.304 → 2.2.306
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.
- package/dist/modules/Order/index.d.ts +1 -1
- package/dist/modules/ResourcePlanner/planner.js +9 -5
- package/dist/modules/ResourcePlanner/types.d.ts +2 -1
- package/dist/server/modules/order/index.d.ts +8 -0
- package/dist/server/modules/order/index.js +506 -453
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/lib/modules/Order/index.d.ts +1 -1
- package/lib/modules/ResourcePlanner/planner.js +9 -5
- package/lib/modules/ResourcePlanner/types.d.ts +2 -1
- package/lib/server/modules/order/index.d.ts +8 -0
- package/lib/server/modules/order/index.js +19 -0
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/package.json +1 -1
|
@@ -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 |
|
|
329
|
+
weekNum: 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
330
330
|
}[]>;
|
|
331
331
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
332
332
|
private getScheduleDataByIds;
|
|
@@ -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: "
|
|
560
|
+
type: "appointment_booking" | "virtual";
|
|
561
561
|
platform: string;
|
|
562
562
|
sales_channel: string;
|
|
563
563
|
order_sales_channel: string;
|
|
@@ -281,12 +281,14 @@ function evaluateCandidateTimeGate(params) {
|
|
|
281
281
|
};
|
|
282
282
|
}
|
|
283
283
|
if (policy.type === 'before_start') {
|
|
284
|
-
//
|
|
285
|
-
//
|
|
286
|
-
//
|
|
287
|
-
//
|
|
284
|
+
// POS fixed-duration candidates use the context's stable opening-minute
|
|
285
|
+
// anchor. Keep that anchored range selectable while it is still active;
|
|
286
|
+
// otherwise a minute refresh turns it into 0 capacity and incorrectly
|
|
287
|
+
// advances a create flow to the next slot. The earlier `past` gate still
|
|
288
|
+
// rejects the anchor once its booking range has ended.
|
|
289
|
+
const isActivePosDurationAnchor = evaluationContext.useExactDurationCandidateMinute && product.kind === 'duration' && !product.isFlexibleDuration && evaluationContext.durationCandidateAnchorAtMs === candidateRange.start;
|
|
288
290
|
const usesMinutePrecision = product.isFlexibleDuration || evaluationContext.useExactDurationCandidateMinute && product.kind === 'duration';
|
|
289
|
-
const hasNotReachedStart = usesMinutePrecision ? floorToMinute(now) <= candidateRange.start : now < candidateRange.start;
|
|
291
|
+
const hasNotReachedStart = isActivePosDurationAnchor || (usesMinutePrecision ? floorToMinute(now) <= candidateRange.start : now < candidateRange.start);
|
|
290
292
|
if (hasNotReachedStart) return null;
|
|
291
293
|
return {
|
|
292
294
|
status: 'unavailable',
|
|
@@ -1249,6 +1251,7 @@ function buildAvailabilityCellIndex(projection) {
|
|
|
1249
1251
|
}
|
|
1250
1252
|
function buildEvaluationContext(params) {
|
|
1251
1253
|
const evaluatedAt = toDateTime(params.evaluatedAt || params.projection.meta.now, params.projection.meta.timezone);
|
|
1254
|
+
const durationCandidateAnchorAt = toDateTime(params.projection.meta.durationCandidateAnchorAt, params.projection.meta.timezone);
|
|
1252
1255
|
const selectionsByGroupKey = new Map();
|
|
1253
1256
|
(params.requirementSelections || []).forEach(selection => {
|
|
1254
1257
|
const key = selection.requirementGroupId || String(selection.formId ?? '');
|
|
@@ -1260,6 +1263,7 @@ function buildEvaluationContext(params) {
|
|
|
1260
1263
|
resourceIdSet: params.resourceIds?.length ? new Set(params.resourceIds.map(String)) : null,
|
|
1261
1264
|
selectionsByGroupKey,
|
|
1262
1265
|
useExactDurationCandidateMinute: params.useExactDurationCandidateMinute === true,
|
|
1266
|
+
durationCandidateAnchorAtMs: Number.isFinite(durationCandidateAnchorAt) ? floorToMinute(durationCandidateAnchorAt) : null,
|
|
1263
1267
|
allowExcludedScheduleDateOverride: params.allowExcludedScheduleDateOverride === true
|
|
1264
1268
|
};
|
|
1265
1269
|
}
|
|
@@ -253,7 +253,8 @@ export interface GetProductTimeRangesRuntimeOptions {
|
|
|
253
253
|
/**
|
|
254
254
|
* Internal POS capability: fixed-duration candidates start from the stable
|
|
255
255
|
* context anchor's current minute instead of rounding up to ten minutes, and
|
|
256
|
-
* that
|
|
256
|
+
* that anchored range remains selectable while active during before-start
|
|
257
|
+
* cutoff evaluation.
|
|
257
258
|
* Other callers keep the legacy alignment and strict second-level cutoff.
|
|
258
259
|
*/
|
|
259
260
|
useExactDurationCandidateMinute?: boolean;
|
|
@@ -24,6 +24,7 @@ export declare class OrderModule extends BaseModule implements Module {
|
|
|
24
24
|
private lastRecentSqliteWriteCleanupAtMs;
|
|
25
25
|
/** 最近一次 SSE 全量拉取完成时间 */
|
|
26
26
|
private lastServerFullFetchAtMs;
|
|
27
|
+
private businessDayRefreshPromise;
|
|
27
28
|
constructor(name?: string, version?: string);
|
|
28
29
|
/**
|
|
29
30
|
* 广播订单变更事件,兼容全量列表订阅并额外携带本次变更订单。
|
|
@@ -130,6 +131,13 @@ export declare class OrderModule extends BaseModule implements Module {
|
|
|
130
131
|
loadOrdersByServer(options?: {
|
|
131
132
|
trigger?: string;
|
|
132
133
|
}): Promise<OrderData[]>;
|
|
134
|
+
/**
|
|
135
|
+
* 供展示屏按需补齐当前营业日的订单快照;成功标记复用全量拉取落库逻辑。
|
|
136
|
+
* 拉取或落库失败时不记录已刷新,下一次调用仍可重试。
|
|
137
|
+
*/
|
|
138
|
+
refreshOrdersForCurrentBusinessDay(options?: {
|
|
139
|
+
trigger?: string;
|
|
140
|
+
}): Promise<void>;
|
|
133
141
|
/**
|
|
134
142
|
* 静默全量刷新:后台重新拉取全量 SSE 订单数据并更新本地
|
|
135
143
|
* 拿到完整数据后一次性替换 store,触发订单变更与同步完成事件
|
|
@@ -61,6 +61,7 @@ class OrderModule extends _BaseModule.BaseModule {
|
|
|
61
61
|
lastRecentSqliteWriteCleanupAtMs = 0;
|
|
62
62
|
/** 最近一次 SSE 全量拉取完成时间 */
|
|
63
63
|
lastServerFullFetchAtMs = 0;
|
|
64
|
+
businessDayRefreshPromise = null;
|
|
64
65
|
constructor(name, version) {
|
|
65
66
|
super(name, version);
|
|
66
67
|
}
|
|
@@ -864,6 +865,24 @@ class OrderModule extends _BaseModule.BaseModule {
|
|
|
864
865
|
return memoryOrders;
|
|
865
866
|
}
|
|
866
867
|
|
|
868
|
+
/**
|
|
869
|
+
* 供展示屏按需补齐当前营业日的订单快照;成功标记复用全量拉取落库逻辑。
|
|
870
|
+
* 拉取或落库失败时不记录已刷新,下一次调用仍可重试。
|
|
871
|
+
*/
|
|
872
|
+
async refreshOrdersForCurrentBusinessDay(options = {}) {
|
|
873
|
+
if (this.businessDayRefreshPromise) return this.businessDayRefreshPromise;
|
|
874
|
+
if (!this.orderDataSource || !this.getCurrentShopId() || this.hasPulledOrdersToday()) return;
|
|
875
|
+
const refreshPromise = this.silentRefresh({
|
|
876
|
+
trigger: options.trigger || 'business_day_rollover'
|
|
877
|
+
}).then(() => undefined);
|
|
878
|
+
this.businessDayRefreshPromise = refreshPromise;
|
|
879
|
+
try {
|
|
880
|
+
await refreshPromise;
|
|
881
|
+
} finally {
|
|
882
|
+
this.businessDayRefreshPromise = null;
|
|
883
|
+
}
|
|
884
|
+
}
|
|
885
|
+
|
|
867
886
|
/**
|
|
868
887
|
* 静默全量刷新:后台重新拉取全量 SSE 订单数据并更新本地
|
|
869
888
|
* 拿到完整数据后一次性替换 store,触发订单变更与同步完成事件
|
|
@@ -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 |
|
|
329
|
+
weekNum: 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
330
330
|
}[]>;
|
|
331
331
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
332
332
|
private getScheduleDataByIds;
|