@pisell/pisellos 2.2.190 → 2.2.192

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 (67) hide show
  1. package/dist/model/strategy/adapter/promotion/index.js +0 -9
  2. package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +2 -1
  3. package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +2 -7
  4. package/dist/modules/Cart/utils/cartProduct.js +13 -2
  5. package/dist/modules/Order/index.d.ts +1 -3
  6. package/dist/modules/Order/index.js +69 -95
  7. package/dist/modules/Order/types.d.ts +9 -6
  8. package/dist/modules/Order/utils.d.ts +9 -2
  9. package/dist/modules/Order/utils.js +36 -13
  10. package/dist/modules/SalesSummary/types.d.ts +3 -1
  11. package/dist/modules/SalesSummary/utils.js +7 -3
  12. package/dist/server/modules/order/index.d.ts +60 -7
  13. package/dist/server/modules/order/index.js +670 -178
  14. package/dist/server/modules/order/types.d.ts +0 -2
  15. package/dist/server/modules/products/index.d.ts +33 -6
  16. package/dist/server/modules/products/index.js +528 -231
  17. package/dist/solution/BaseSales/index.js +13 -7
  18. package/dist/solution/BaseSales/types.d.ts +8 -5
  19. package/dist/solution/BaseSales/types.js +2 -3
  20. package/dist/solution/BaseSales/utils/cartPromotion.js +7 -7
  21. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +1 -0
  22. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +16 -13
  23. package/dist/solution/BaseSales/utils.d.ts +1 -1
  24. package/dist/solution/BaseSales/utils.js +22 -19
  25. package/dist/solution/BookingByStep/index.d.ts +1 -1
  26. package/dist/solution/BookingTicket/index.d.ts +1 -1
  27. package/dist/solution/ScanOrder/index.js +7 -5
  28. package/dist/solution/ScanOrder/types.d.ts +8 -5
  29. package/dist/solution/ScanOrder/types.js +2 -3
  30. package/dist/solution/ScanOrder/utils.d.ts +1 -1
  31. package/dist/solution/ScanOrder/utils.js +26 -23
  32. package/dist/solution/VenueBooking/index.js +5 -3
  33. package/dist/solution/VenueBooking/sales-section-4-annotated.json +0 -2
  34. package/lib/model/strategy/adapter/promotion/index.js +0 -49
  35. package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +2 -1
  36. package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +2 -1
  37. package/lib/modules/Cart/utils/cartProduct.js +9 -2
  38. package/lib/modules/Order/index.d.ts +1 -3
  39. package/lib/modules/Order/index.js +45 -58
  40. package/lib/modules/Order/types.d.ts +9 -6
  41. package/lib/modules/Order/utils.d.ts +9 -2
  42. package/lib/modules/Order/utils.js +41 -10
  43. package/lib/modules/SalesSummary/types.d.ts +3 -1
  44. package/lib/modules/SalesSummary/utils.js +5 -3
  45. package/lib/server/modules/order/index.d.ts +60 -7
  46. package/lib/server/modules/order/index.js +350 -40
  47. package/lib/server/modules/order/types.d.ts +0 -2
  48. package/lib/server/modules/products/index.d.ts +33 -6
  49. package/lib/server/modules/products/index.js +159 -30
  50. package/lib/solution/BaseSales/index.js +14 -5
  51. package/lib/solution/BaseSales/types.d.ts +8 -5
  52. package/lib/solution/BaseSales/utils/cartPromotion.js +6 -6
  53. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +1 -0
  54. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +21 -14
  55. package/lib/solution/BaseSales/utils.d.ts +1 -1
  56. package/lib/solution/BaseSales/utils.js +11 -7
  57. package/lib/solution/BookingByStep/index.d.ts +1 -1
  58. package/lib/solution/BookingTicket/index.d.ts +1 -1
  59. package/lib/solution/ScanOrder/index.js +4 -4
  60. package/lib/solution/ScanOrder/types.d.ts +8 -5
  61. package/lib/solution/ScanOrder/utils.d.ts +1 -1
  62. package/lib/solution/ScanOrder/utils.js +12 -8
  63. package/lib/solution/VenueBooking/index.js +2 -2
  64. package/lib/solution/VenueBooking/sales-section-4-annotated.json +0 -2
  65. package/package.json +1 -1
  66. package/dist/solution/Checkout/appointmentDemo.json +0 -1
  67. package/lib/solution/Checkout/appointmentDemo.json +0 -1
@@ -94,8 +94,6 @@ export interface OrderProductLineItem {
94
94
  num: number;
95
95
  /** 多规格 ID。来源:Detail.product_variant_id */
96
96
  product_variant_id?: number;
97
- /** 选项配置 */
98
- product_option_item?: unknown[];
99
97
  /**
100
98
  * 销售单价(交易快照,仅输出)。
101
99
  * 来源:Detail.selling_price
@@ -27,6 +27,12 @@ export declare class ProductsModule extends BaseModule implements Module {
27
27
  private productDataSource;
28
28
  private pendingSyncMessages;
29
29
  private syncTimer?;
30
+ /** 最近一次 SSE 全量拉取完成时间 */
31
+ private lastServerFullFetchAtMs;
32
+ /** 最近一次 preload 完成时间(含 IndexDB 命中) */
33
+ private lastPreloadCompletedAtMs;
34
+ /** IndexDB 写入串行队列,避免快照与 patch 并发交错 */
35
+ private productIndexDBSaveQueue;
30
36
  constructor(name?: string, version?: string);
31
37
  initialize(core: PisellCore, options: any): Promise<void>;
32
38
  /**
@@ -209,10 +215,28 @@ export declare class ProductsModule extends BaseModule implements Module {
209
215
  */
210
216
  private loadProductsFromIndexDB;
211
217
  /**
212
- * 保存商品数据到 IndexDB(平铺存储)
213
- * @private
218
+ * 串行执行商品 IndexDB 写入,避免快照替换与增量 patch 并发交错。
219
+ *
220
+ * @example
221
+ * await this.runInProductIndexDBSaveQueue(async () => {
222
+ * await this.dbManager.bulkUpdate(INDEXDB_STORE_NAME, products)
223
+ * })
224
+ */
225
+ private runInProductIndexDBSaveQueue;
226
+ /**
227
+ * 全量快照写入 IndexDB:clear + bulkUpdate,仅用于 SSE/HTTP 全量拉取。
228
+ *
229
+ * @example
230
+ * await this.replaceProductsSnapshotInIndexDB(list, 'loadProductsByServer')
214
231
  */
215
- private saveProductsToIndexDB;
232
+ private replaceProductsSnapshotInIndexDB;
233
+ /**
234
+ * 增量 upsert 商品到 IndexDB,不清空表;用于 pubsub 批次合并后的变更商品。
235
+ *
236
+ * @example
237
+ * await this.patchProductsInIndexDB(changedProducts, 'pubsub.processProductSyncMessages', mergeActions)
238
+ */
239
+ private patchProductsInIndexDB;
216
240
  /**
217
241
  * 同步更新商品 Map 缓存
218
242
  * 将 list 中的商品同步到 map,以 id 为 key
@@ -262,14 +286,17 @@ export declare class ProductsModule extends BaseModule implements Module {
262
286
  /**
263
287
  * 将 body 完整数据直接覆盖到本地 store(不调用报价单接口)
264
288
  * 已存在的 → 直接替换;不存在的 → 追加
265
- * 同时更新 Map 缓存、IndexDB,触发 onProductsChanged
266
- * 价格缓存由 processProductSyncMessages 末尾统一清除
289
+ *
290
+ * @example
291
+ * await this.applyBodyUpdatesToStore(bodyUpdates, { skipIndexDB: true })
267
292
  */
268
293
  private applyBodyUpdatesToStore;
269
294
  /**
270
295
  * 将增量拉取的商品合并到 store
271
296
  * 已存在的 → 替换;新的 → 追加
272
- * 同时更新 store.map、IndexDB,触发 onProductsChanged
297
+ *
298
+ * @example
299
+ * await this.mergeProductsToStore(freshProducts, { skipIndexDB: true })
273
300
  */
274
301
  private mergeProductsToStore;
275
302
  /**