@pisell/pisellos 2.2.259 → 2.2.260

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.
Files changed (103) hide show
  1. package/dist/model/strategy/adapter/dataVariant/adapter.d.ts +49 -0
  2. package/dist/model/strategy/adapter/dataVariant/adapter.js +152 -0
  3. package/dist/model/strategy/adapter/dataVariant/evaluator.d.ts +87 -0
  4. package/dist/model/strategy/adapter/dataVariant/evaluator.js +755 -0
  5. package/dist/model/strategy/adapter/dataVariant/examples.d.ts +39 -0
  6. package/dist/model/strategy/adapter/dataVariant/examples.js +282 -0
  7. package/dist/model/strategy/adapter/dataVariant/index.d.ts +4 -0
  8. package/dist/model/strategy/adapter/dataVariant/index.js +4 -0
  9. package/dist/model/strategy/adapter/dataVariant/type.d.ts +146 -0
  10. package/dist/model/strategy/adapter/dataVariant/type.js +54 -0
  11. package/dist/model/strategy/adapter/index.d.ts +4 -0
  12. package/dist/model/strategy/adapter/index.js +5 -1
  13. package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +13 -17
  14. package/dist/modules/Order/index.d.ts +1 -32
  15. package/dist/modules/Order/index.js +288 -615
  16. package/dist/modules/Order/types.d.ts +2 -20
  17. package/dist/modules/Order/utils.d.ts +0 -4
  18. package/dist/modules/Order/utils.js +28 -114
  19. package/dist/modules/Product/index.d.ts +1 -1
  20. package/dist/modules/Product/types.d.ts +22 -0
  21. package/dist/modules/ProductList/index.d.ts +1 -1
  22. package/dist/modules/ProductList/index.js +4 -2
  23. package/dist/modules/ProductList/types.d.ts +2 -0
  24. package/dist/modules/Rules/index.d.ts +3 -3
  25. package/dist/modules/Rules/index.js +3 -8
  26. package/dist/modules/Rules/types.d.ts +1 -2
  27. package/dist/modules/SalesSummary/index.d.ts +3 -7
  28. package/dist/modules/SalesSummary/index.js +39 -67
  29. package/dist/modules/SalesSummary/types.d.ts +0 -1
  30. package/dist/modules/SalesSummary/utils.js +1 -2
  31. package/dist/modules/SurchargeList/index.d.ts +4 -6
  32. package/dist/modules/SurchargeList/index.js +39 -62
  33. package/dist/modules/SurchargeList/types.d.ts +2 -6
  34. package/dist/server/index.d.ts +50 -3
  35. package/dist/server/index.js +1040 -1075
  36. package/dist/server/modules/order/index.d.ts +3 -22
  37. package/dist/server/modules/order/index.js +316 -398
  38. package/dist/server/modules/products/index.d.ts +26 -7
  39. package/dist/server/modules/products/index.js +166 -76
  40. package/dist/server/modules/products/types.d.ts +14 -0
  41. package/dist/solution/BaseSales/index.d.ts +2 -22
  42. package/dist/solution/BaseSales/index.js +701 -995
  43. package/dist/solution/BaseSales/types.d.ts +0 -1
  44. package/dist/solution/BaseSales/types.js +1 -2
  45. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +3 -6
  46. package/dist/solution/BookingByStep/index.d.ts +1 -1
  47. package/dist/solution/BookingTicket/index.d.ts +0 -8
  48. package/dist/solution/BookingTicket/index.js +6 -153
  49. package/dist/solution/BookingTicket/types.d.ts +2 -0
  50. package/lib/model/strategy/adapter/dataVariant/adapter.d.ts +49 -0
  51. package/lib/model/strategy/adapter/dataVariant/adapter.js +139 -0
  52. package/lib/model/strategy/adapter/dataVariant/evaluator.d.ts +87 -0
  53. package/lib/model/strategy/adapter/dataVariant/evaluator.js +564 -0
  54. package/lib/model/strategy/adapter/dataVariant/examples.d.ts +39 -0
  55. package/lib/model/strategy/adapter/dataVariant/examples.js +295 -0
  56. package/lib/model/strategy/adapter/dataVariant/index.d.ts +4 -0
  57. package/lib/model/strategy/adapter/dataVariant/index.js +38 -0
  58. package/lib/model/strategy/adapter/dataVariant/type.d.ts +146 -0
  59. package/lib/model/strategy/adapter/dataVariant/type.js +31 -0
  60. package/lib/model/strategy/adapter/index.d.ts +4 -0
  61. package/lib/model/strategy/adapter/index.js +13 -2
  62. package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +1 -11
  63. package/lib/modules/Order/index.d.ts +1 -32
  64. package/lib/modules/Order/index.js +64 -402
  65. package/lib/modules/Order/types.d.ts +2 -20
  66. package/lib/modules/Order/utils.d.ts +0 -4
  67. package/lib/modules/Order/utils.js +2 -84
  68. package/lib/modules/Product/index.d.ts +1 -1
  69. package/lib/modules/Product/types.d.ts +22 -0
  70. package/lib/modules/ProductList/index.d.ts +1 -1
  71. package/lib/modules/ProductList/index.js +4 -2
  72. package/lib/modules/ProductList/types.d.ts +2 -0
  73. package/lib/modules/Rules/index.d.ts +3 -3
  74. package/lib/modules/Rules/index.js +3 -4
  75. package/lib/modules/Rules/types.d.ts +1 -2
  76. package/lib/modules/SalesSummary/index.d.ts +3 -7
  77. package/lib/modules/SalesSummary/index.js +11 -28
  78. package/lib/modules/SalesSummary/types.d.ts +0 -1
  79. package/lib/modules/SalesSummary/utils.js +0 -2
  80. package/lib/modules/SurchargeList/index.d.ts +4 -6
  81. package/lib/modules/SurchargeList/index.js +21 -41
  82. package/lib/modules/SurchargeList/types.d.ts +2 -6
  83. package/lib/server/index.d.ts +50 -3
  84. package/lib/server/index.js +215 -244
  85. package/lib/server/modules/order/index.d.ts +3 -22
  86. package/lib/server/modules/order/index.js +53 -103
  87. package/lib/server/modules/products/index.d.ts +26 -7
  88. package/lib/server/modules/products/index.js +113 -35
  89. package/lib/server/modules/products/types.d.ts +14 -0
  90. package/lib/solution/BaseSales/index.d.ts +2 -22
  91. package/lib/solution/BaseSales/index.js +60 -246
  92. package/lib/solution/BaseSales/types.d.ts +0 -1
  93. package/lib/solution/BaseSales/types.js +1 -2
  94. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +6 -6
  95. package/lib/solution/BookingByStep/index.d.ts +1 -1
  96. package/lib/solution/BookingTicket/index.d.ts +0 -8
  97. package/lib/solution/BookingTicket/index.js +0 -101
  98. package/lib/solution/BookingTicket/types.d.ts +2 -0
  99. package/package.json +1 -1
  100. package/dist/modules/Order/utils/bundleDiscountHydration.d.ts +0 -5
  101. package/dist/modules/Order/utils/bundleDiscountHydration.js +0 -144
  102. package/lib/modules/Order/utils/bundleDiscountHydration.d.ts +0 -5
  103. package/lib/modules/Order/utils/bundleDiscountHydration.js +0 -139
@@ -25,17 +25,15 @@ __export(SurchargeList_exports, {
25
25
  module.exports = __toCommonJS(SurchargeList_exports);
26
26
  var import_BaseModule = require("../BaseModule");
27
27
  __reExport(SurchargeList_exports, require("./types"), module.exports);
28
- var DEFAULT_SURCHARGE_CHANNEL = "online-store";
29
28
  var SurchargeListModule = class extends import_BaseModule.BaseModule {
30
29
  constructor(name, version) {
31
30
  super(name, version);
32
31
  this.defaultName = "surchargeList";
33
32
  this.defaultVersion = "1.0.0";
34
- this.loadingPromises = /* @__PURE__ */ new Map();
35
- this.requestVersion = 0;
33
+ this.loadingPromise = null;
36
34
  }
37
35
  async initialize(core, options) {
38
- var _a, _b, _c, _d, _e;
36
+ var _a, _b, _c;
39
37
  this.core = core;
40
38
  this.store = options.store;
41
39
  this.request = this.core.getPlugin("request");
@@ -43,62 +41,44 @@ var SurchargeListModule = class extends import_BaseModule.BaseModule {
43
41
  (_a = options.initialState) == null ? void 0 : _a.surchargeList
44
42
  );
45
43
  this.store.surchargeList = hasInitialSurchargeList ? (_b = options.initialState) == null ? void 0 : _b.surchargeList : [];
46
- this.store.channel = ((_c = options.initialState) == null ? void 0 : _c.channel) || ((_d = options.otherParams) == null ? void 0 : _d.channel) || DEFAULT_SURCHARGE_CHANNEL;
47
- this.store.isLoaded = Boolean((_e = options.initialState) == null ? void 0 : _e.isLoaded) || hasInitialSurchargeList;
44
+ this.store.isLoaded = Boolean((_c = options.initialState) == null ? void 0 : _c.isLoaded) || hasInitialSurchargeList;
48
45
  if (!this.request) {
49
46
  throw new Error("SurchargeListModule 需要 request 插件支持");
50
47
  }
51
48
  }
52
- resolveChannel(query) {
53
- return (query == null ? void 0 : query.channel) || DEFAULT_SURCHARGE_CHANNEL;
54
- }
55
- async getSurchargeList(query) {
56
- const channel = this.resolveChannel(query);
57
- if (this.store.isLoaded && this.store.channel === channel) {
49
+ async getSurchargeList() {
50
+ if (this.store.isLoaded)
58
51
  return this.store.surchargeList;
59
- }
60
- const loadingPromise = this.loadingPromises.get(channel);
61
- if (loadingPromise)
62
- return loadingPromise;
63
- const nextPromise = this.loadSurchargeList(channel);
64
- this.loadingPromises.set(channel, nextPromise);
65
- return nextPromise;
52
+ if (this.loadingPromise)
53
+ return this.loadingPromise;
54
+ this.loadingPromise = this.loadSurchargeList();
55
+ return this.loadingPromise;
66
56
  }
67
- async refreshSurchargeList(query) {
68
- const channel = this.resolveChannel(query);
69
- const nextPromise = this.loadSurchargeList(channel);
70
- this.loadingPromises.set(channel, nextPromise);
71
- return nextPromise;
57
+ async refreshSurchargeList() {
58
+ this.loadingPromise = this.loadSurchargeList();
59
+ return this.loadingPromise;
72
60
  }
73
- async loadSurchargeList(channel) {
74
- const currentRequestVersion = ++this.requestVersion;
61
+ async loadSurchargeList() {
75
62
  try {
76
63
  const surchargeList = await this.request.get(
77
64
  "/order/custom-surcharge/available/v2",
78
65
  {
79
- channel,
66
+ channel: "online-store",
80
67
  is_assemble_product_data: 1,
81
68
  is_assemble_schedule_data: 1,
82
69
  with: ["relationSchedule"]
83
70
  }
84
71
  );
85
- const nextSurchargeList = (surchargeList == null ? void 0 : surchargeList.data) || [];
86
- if (currentRequestVersion === this.requestVersion) {
87
- this.store.surchargeList = nextSurchargeList;
88
- this.store.channel = channel;
89
- this.store.isLoaded = true;
90
- }
91
- return nextSurchargeList;
72
+ this.store.surchargeList = (surchargeList == null ? void 0 : surchargeList.data) || [];
73
+ this.store.isLoaded = true;
74
+ return this.store.surchargeList;
92
75
  } catch (error) {
93
76
  console.warn("[SurchargeListModule] 加载附加费配置失败", error);
94
- if (currentRequestVersion === this.requestVersion) {
95
- this.store.surchargeList = [];
96
- this.store.channel = channel;
97
- this.store.isLoaded = true;
98
- }
99
- return [];
77
+ this.store.surchargeList = [];
78
+ this.store.isLoaded = true;
79
+ return this.store.surchargeList;
100
80
  } finally {
101
- this.loadingPromises.delete(channel);
81
+ this.loadingPromise = null;
102
82
  }
103
83
  }
104
84
  };
@@ -4,12 +4,8 @@ export interface SurchargeListItem {
4
4
  export interface SurchargeListState {
5
5
  surchargeList: SurchargeListItem[];
6
6
  isLoaded: boolean;
7
- channel?: string;
8
- }
9
- export interface SurchargeListQuery {
10
- channel?: string;
11
7
  }
12
8
  export interface SurchargeListModuleAPI {
13
- getSurchargeList(query?: SurchargeListQuery): Promise<SurchargeListItem[]>;
14
- refreshSurchargeList(query?: SurchargeListQuery): Promise<SurchargeListItem[]>;
9
+ getSurchargeList(): Promise<SurchargeListItem[]>;
10
+ refreshSurchargeList(): Promise<SurchargeListItem[]>;
15
11
  }
@@ -47,6 +47,8 @@ declare class Server {
47
47
  private prefixRouterGet;
48
48
  router: Router;
49
49
  private productQuerySubscribers;
50
+ /** subscriberId → 智能定价变价时间点定时器句柄(与 subscriber 分离存储,便于 clear) */
51
+ private productQueryScheduleTimers;
50
52
  private orderQuerySubscribers;
51
53
  private bookingQuerySubscribers;
52
54
  private bookingRemoteQuerySubscribers;
@@ -210,6 +212,48 @@ declare class Server {
210
212
  * 根据 subscriberId 移除商品查询订阅者
211
213
  */
212
214
  removeProductQuerySubscriber(subscriberId?: string): void;
215
+ /**
216
+ * 构建商品 query 响应 data 段,附带智能定价 schedule_time_points 元数据。
217
+ */
218
+ private buildProductQueryResultPayload;
219
+ /**
220
+ * 是否启用商品 query 订阅的 schedule 时间点定时重算。
221
+ * strategy_context.enable_schedule_reload === false 时关闭。
222
+ */
223
+ private shouldScheduleProductQueryReload;
224
+ /**
225
+ * 清除指定 subscriber 的全部 schedule 定时器,防止重复 query 或 unsubscribe 后泄漏。
226
+ */
227
+ private clearSubscriberScheduleTimers;
228
+ /**
229
+ * 从 productQueryScheduleTimers 移除已触发的 timer 引用。
230
+ */
231
+ private removeScheduleTimerRef;
232
+ /**
233
+ * 计算 schedule 变价时间点到当前时刻的延迟(ms)。已过期返回 -1。
234
+ */
235
+ private computeScheduleTimePointDelayMs;
236
+ /**
237
+ * 定时重算前刷新 subscriber schedule 上下文:使用执行瞬间时间,禁止沿用首次 query 的 schedule_datetime。
238
+ */
239
+ private refreshSubscriberScheduleAtExecution;
240
+ /**
241
+ * 为 subscriber 注册智能定价 scheduleTimePoints 定时重算。
242
+ * 必须先 clearSubscriberScheduleTimers,再调用本方法。
243
+ */
244
+ private scheduleSubscriberTimePointReloads;
245
+ /**
246
+ * schedule 变价时间点定时器触发:刷新 schedule_datetime 后重算并 callback。
247
+ */
248
+ private onScheduleTimePointTimerFire;
249
+ /**
250
+ * 对单个商品 query 订阅者重算并推送(定时路径;不新建 schedule timer)。
251
+ */
252
+ private recomputeAndNotifySubscriber;
253
+ /**
254
+ * query 完成后为 subscriber 同步 schedule 定时器(先 clear 再 schedule)。
255
+ */
256
+ private syncProductQueryScheduleTimers;
213
257
  /**
214
258
  * 处理商品查询请求
215
259
  * 存储订阅者信息,便于数据变更时推送最新结果
@@ -431,9 +475,6 @@ declare class Server {
431
475
  private shouldLookupLocalPrintOrder;
432
476
  private getLocalPrintOrderLookup;
433
477
  private handleLocalPrintOrder;
434
- private handleMachinecodeBatchMeta;
435
- private resolveMachinecodeBatchMetadataLookup;
436
- private syncMachinecodeRedeemStatusToLocalOrder;
437
478
  private handleOrderCheckoutSubmit;
438
479
  private handleSyncCheckoutSubmit;
439
480
  private handlePendingSyncCheckoutOrder;
@@ -565,6 +606,12 @@ declare class Server {
565
606
  * @param options.changedIds 变更的商品 IDs,用于增量更新价格缓存
566
607
  */
567
608
  private computeProductQueryResult;
609
+ /**
610
+ * 构建商品格式化上下文。
611
+ *
612
+ * 智能定价条件使用全量 menuList/scheduleList;Product Query 顶层参数只保留筛选商品集合所需字段。
613
+ */
614
+ private buildProductFormatterContext;
568
615
  /**
569
616
  * 数据变更后,遍历所有订阅者重新计算查询结果并通过 callback 推送
570
617
  * 由 ProductsModule 的 onProductsSyncCompleted 事件触发