@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.
@@ -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: "virtual" | "appointment_booking";
560
+ type: "appointment_booking" | "virtual";
561
561
  platform: string;
562
562
  sales_channel: string;
563
563
  order_sales_channel: string;
@@ -294,12 +294,14 @@ function evaluateCandidateTimeGate(params) {
294
294
  };
295
295
  }
296
296
  if (policy.type === 'before_start') {
297
- // Flexible-duration candidates and POS fixed-duration anchors start at
298
- // minute precision. Keep that current minute selectable instead of treating
299
- // the freshly generated candidate as already started because the query
300
- // clock still contains seconds.
297
+ // POS fixed-duration candidates use the context's stable opening-minute
298
+ // anchor. Keep that anchored range selectable while it is still active;
299
+ // otherwise a minute refresh turns it into 0 capacity and incorrectly
300
+ // advances a create flow to the next slot. The earlier `past` gate still
301
+ // rejects the anchor once its booking range has ended.
302
+ var isActivePosDurationAnchor = evaluationContext.useExactDurationCandidateMinute && product.kind === 'duration' && !product.isFlexibleDuration && evaluationContext.durationCandidateAnchorAtMs === candidateRange.start;
301
303
  var usesMinutePrecision = product.isFlexibleDuration || evaluationContext.useExactDurationCandidateMinute && product.kind === 'duration';
302
- var hasNotReachedStart = usesMinutePrecision ? floorToMinute(now) <= candidateRange.start : now < candidateRange.start;
304
+ var hasNotReachedStart = isActivePosDurationAnchor || (usesMinutePrecision ? floorToMinute(now) <= candidateRange.start : now < candidateRange.start);
303
305
  if (hasNotReachedStart) return null;
304
306
  return {
305
307
  status: 'unavailable',
@@ -1437,6 +1439,7 @@ function buildAvailabilityCellIndex(projection) {
1437
1439
  function buildEvaluationContext(params) {
1438
1440
  var _params$resourceIds2;
1439
1441
  var evaluatedAt = toDateTime(params.evaluatedAt || params.projection.meta.now, params.projection.meta.timezone);
1442
+ var durationCandidateAnchorAt = toDateTime(params.projection.meta.durationCandidateAnchorAt, params.projection.meta.timezone);
1440
1443
  var selectionsByGroupKey = new Map();
1441
1444
  (params.requirementSelections || []).forEach(function (selection) {
1442
1445
  var _selection$formId;
@@ -1449,6 +1452,7 @@ function buildEvaluationContext(params) {
1449
1452
  resourceIdSet: (_params$resourceIds2 = params.resourceIds) !== null && _params$resourceIds2 !== void 0 && _params$resourceIds2.length ? new Set(params.resourceIds.map(String)) : null,
1450
1453
  selectionsByGroupKey: selectionsByGroupKey,
1451
1454
  useExactDurationCandidateMinute: params.useExactDurationCandidateMinute === true,
1455
+ durationCandidateAnchorAtMs: Number.isFinite(durationCandidateAnchorAt) ? floorToMinute(durationCandidateAnchorAt) : null,
1452
1456
  allowExcludedScheduleDateOverride: params.allowExcludedScheduleDateOverride === true
1453
1457
  };
1454
1458
  }
@@ -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 minute remains selectable during before-start cutoff evaluation.
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,触发订单变更与同步完成事件