@pisell/pisellos 2.2.190 → 2.2.191
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/model/strategy/adapter/promotion/index.js +0 -9
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +2 -1
- package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +2 -7
- package/dist/modules/Cart/utils/cartProduct.js +13 -2
- package/dist/modules/Order/index.d.ts +1 -3
- package/dist/modules/Order/index.js +69 -95
- package/dist/modules/Order/types.d.ts +9 -6
- package/dist/modules/Order/utils.d.ts +9 -2
- package/dist/modules/Order/utils.js +36 -13
- package/dist/modules/SalesSummary/types.d.ts +3 -1
- package/dist/modules/SalesSummary/utils.js +7 -3
- package/dist/server/modules/order/index.d.ts +126 -6
- package/dist/server/modules/order/index.js +1204 -285
- package/dist/server/modules/order/types.d.ts +0 -2
- package/dist/server/modules/products/index.d.ts +90 -6
- package/dist/server/modules/products/index.js +1017 -361
- package/dist/solution/BaseSales/index.js +13 -7
- package/dist/solution/BaseSales/types.d.ts +8 -5
- package/dist/solution/BaseSales/types.js +2 -3
- package/dist/solution/BaseSales/utils/cartPromotion.js +7 -7
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +1 -0
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +16 -13
- package/dist/solution/BaseSales/utils.d.ts +1 -1
- package/dist/solution/BaseSales/utils.js +22 -19
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.d.ts +1 -1
- package/dist/solution/ScanOrder/index.js +7 -5
- package/dist/solution/ScanOrder/types.d.ts +8 -5
- package/dist/solution/ScanOrder/types.js +2 -3
- package/dist/solution/ScanOrder/utils.d.ts +1 -1
- package/dist/solution/ScanOrder/utils.js +26 -23
- package/dist/solution/VenueBooking/index.js +5 -3
- package/dist/solution/VenueBooking/sales-section-4-annotated.json +0 -2
- package/lib/model/strategy/adapter/promotion/index.js +0 -49
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +2 -1
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +2 -1
- package/lib/modules/Cart/utils/cartProduct.js +9 -2
- package/lib/modules/Order/index.d.ts +1 -3
- package/lib/modules/Order/index.js +45 -58
- package/lib/modules/Order/types.d.ts +9 -6
- package/lib/modules/Order/utils.d.ts +9 -2
- package/lib/modules/Order/utils.js +41 -10
- package/lib/modules/SalesSummary/types.d.ts +3 -1
- package/lib/modules/SalesSummary/utils.js +5 -3
- package/lib/server/modules/order/index.d.ts +126 -6
- package/lib/server/modules/order/index.js +722 -42
- package/lib/server/modules/order/types.d.ts +0 -2
- package/lib/server/modules/products/index.d.ts +90 -6
- package/lib/server/modules/products/index.js +492 -30
- package/lib/solution/BaseSales/index.js +14 -5
- package/lib/solution/BaseSales/types.d.ts +8 -5
- package/lib/solution/BaseSales/utils/cartPromotion.js +6 -6
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +1 -0
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +21 -14
- package/lib/solution/BaseSales/utils.d.ts +1 -1
- package/lib/solution/BaseSales/utils.js +11 -7
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.d.ts +1 -1
- package/lib/solution/ScanOrder/index.js +4 -4
- package/lib/solution/ScanOrder/types.d.ts +8 -5
- package/lib/solution/ScanOrder/utils.d.ts +1 -1
- package/lib/solution/ScanOrder/utils.js +12 -8
- package/lib/solution/VenueBooking/index.js +2 -2
- package/lib/solution/VenueBooking/sales-section-4-annotated.json +0 -2
- package/package.json +1 -1
- package/dist/solution/Checkout/appointmentDemo.json +0 -1
- package/lib/solution/Checkout/appointmentDemo.json +0 -1
|
@@ -3,6 +3,36 @@ import { BaseModule } from '../../../modules/BaseModule';
|
|
|
3
3
|
import { ProductData } from '../../../modules/Product/types';
|
|
4
4
|
import type { RouteDefinition } from '../../types';
|
|
5
5
|
import { ProductIdScope, ProductFormatter, ProductFormatterContext } from './types';
|
|
6
|
+
/** 商品模块流程调试日志条目 */
|
|
7
|
+
interface ProductFlowLogEntry {
|
|
8
|
+
ts: string;
|
|
9
|
+
step: string;
|
|
10
|
+
metadata?: Record<string, unknown>;
|
|
11
|
+
}
|
|
12
|
+
/** 单个商品 IndexDB 写入记录 */
|
|
13
|
+
interface ProductWriteStatEntry {
|
|
14
|
+
ts: string;
|
|
15
|
+
writeSeq: number;
|
|
16
|
+
source: string;
|
|
17
|
+
writeMethod: string;
|
|
18
|
+
productId: number;
|
|
19
|
+
mergeAction?: 'insert' | 'update' | 'snapshot' | 'delete';
|
|
20
|
+
}
|
|
21
|
+
declare global {
|
|
22
|
+
interface Window {
|
|
23
|
+
__productModuleFlowLogs?: ProductFlowLogEntry[];
|
|
24
|
+
__productModuleWriteStats?: Record<string, ProductWriteStatEntry[]>;
|
|
25
|
+
clearProductModuleFlowLogs?: () => void;
|
|
26
|
+
exportProductModuleFlowLogs?: () => string;
|
|
27
|
+
exportProductModuleWriteStats?: () => string;
|
|
28
|
+
summarizeProductModuleWrites?: (topN?: number) => Array<{
|
|
29
|
+
productId: number;
|
|
30
|
+
writeCount: number;
|
|
31
|
+
sources: string[];
|
|
32
|
+
lastWriteAt: string;
|
|
33
|
+
}>;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
6
36
|
/**
|
|
7
37
|
* Products 模块 - 用于获取和管理完整的商品详细数据
|
|
8
38
|
* 相比 ProductList 模块,Products 会获取所有详细信息并缓存
|
|
@@ -27,6 +57,14 @@ export declare class ProductsModule extends BaseModule implements Module {
|
|
|
27
57
|
private productDataSource;
|
|
28
58
|
private pendingSyncMessages;
|
|
29
59
|
private syncTimer?;
|
|
60
|
+
/** IndexDB 写入序号,便于日志关联 */
|
|
61
|
+
private productFlowWriteSeq;
|
|
62
|
+
/** 最近一次 SSE 全量拉取完成时间 */
|
|
63
|
+
private lastServerFullFetchAtMs;
|
|
64
|
+
/** 最近一次 preload 完成时间(含 IndexDB 命中) */
|
|
65
|
+
private lastPreloadCompletedAtMs;
|
|
66
|
+
/** IndexDB 写入串行队列,避免快照与 patch 并发交错 */
|
|
67
|
+
private productIndexDBSaveQueue;
|
|
30
68
|
constructor(name?: string, version?: string);
|
|
31
69
|
initialize(core: PisellCore, options: any): Promise<void>;
|
|
32
70
|
/**
|
|
@@ -47,6 +85,30 @@ export declare class ProductsModule extends BaseModule implements Module {
|
|
|
47
85
|
* @param metadata 日志元数据
|
|
48
86
|
*/
|
|
49
87
|
private logError;
|
|
88
|
+
/**
|
|
89
|
+
* 初始化 window 上的商品流程调试日志。
|
|
90
|
+
*
|
|
91
|
+
* @example
|
|
92
|
+
* window.clearProductModuleFlowLogs()
|
|
93
|
+
* copy(window.exportProductModuleFlowLogs?.() || '[]')
|
|
94
|
+
*/
|
|
95
|
+
private initProductFlowLogs;
|
|
96
|
+
/**
|
|
97
|
+
* 写入 window 商品流程调试日志。
|
|
98
|
+
*
|
|
99
|
+
* @example
|
|
100
|
+
* this.pushProductFlowLog('mergeProductsToStore.start', { count: 3 })
|
|
101
|
+
*/
|
|
102
|
+
private pushProductFlowLog;
|
|
103
|
+
/** 当前内存 store 快照,供流程日志使用 */
|
|
104
|
+
private getProductStoreSnapshot;
|
|
105
|
+
/**
|
|
106
|
+
* 记录 IndexDB 写入统计(按 productId 聚合)。
|
|
107
|
+
*
|
|
108
|
+
* @example
|
|
109
|
+
* this.trackProductWrite('pubsub.mergeProductsToStore', 'clear+bulkUpdate', products, { 1: 'update' })
|
|
110
|
+
*/
|
|
111
|
+
private trackProductWrite;
|
|
50
112
|
/**
|
|
51
113
|
* 加载商品价格(原始方法,不带缓存)
|
|
52
114
|
* @private
|
|
@@ -209,10 +271,28 @@ export declare class ProductsModule extends BaseModule implements Module {
|
|
|
209
271
|
*/
|
|
210
272
|
private loadProductsFromIndexDB;
|
|
211
273
|
/**
|
|
212
|
-
*
|
|
213
|
-
*
|
|
274
|
+
* 串行执行商品 IndexDB 写入,避免快照替换与增量 patch 并发交错。
|
|
275
|
+
*
|
|
276
|
+
* @example
|
|
277
|
+
* await this.runInProductIndexDBSaveQueue(async () => {
|
|
278
|
+
* await this.dbManager.bulkUpdate(INDEXDB_STORE_NAME, products)
|
|
279
|
+
* })
|
|
280
|
+
*/
|
|
281
|
+
private runInProductIndexDBSaveQueue;
|
|
282
|
+
/**
|
|
283
|
+
* 全量快照写入 IndexDB:clear + bulkUpdate,仅用于 SSE/HTTP 全量拉取。
|
|
284
|
+
*
|
|
285
|
+
* @example
|
|
286
|
+
* await this.replaceProductsSnapshotInIndexDB(list, 'loadProductsByServer')
|
|
214
287
|
*/
|
|
215
|
-
private
|
|
288
|
+
private replaceProductsSnapshotInIndexDB;
|
|
289
|
+
/**
|
|
290
|
+
* 增量 upsert 商品到 IndexDB,不清空表;用于 pubsub 批次合并后的变更商品。
|
|
291
|
+
*
|
|
292
|
+
* @example
|
|
293
|
+
* await this.patchProductsInIndexDB(changedProducts, 'pubsub.processProductSyncMessages', mergeActions)
|
|
294
|
+
*/
|
|
295
|
+
private patchProductsInIndexDB;
|
|
216
296
|
/**
|
|
217
297
|
* 同步更新商品 Map 缓存
|
|
218
298
|
* 将 list 中的商品同步到 map,以 id 为 key
|
|
@@ -262,14 +342,17 @@ export declare class ProductsModule extends BaseModule implements Module {
|
|
|
262
342
|
/**
|
|
263
343
|
* 将 body 完整数据直接覆盖到本地 store(不调用报价单接口)
|
|
264
344
|
* 已存在的 → 直接替换;不存在的 → 追加
|
|
265
|
-
*
|
|
266
|
-
*
|
|
345
|
+
*
|
|
346
|
+
* @example
|
|
347
|
+
* await this.applyBodyUpdatesToStore(bodyUpdates, { skipIndexDB: true })
|
|
267
348
|
*/
|
|
268
349
|
private applyBodyUpdatesToStore;
|
|
269
350
|
/**
|
|
270
351
|
* 将增量拉取的商品合并到 store
|
|
271
352
|
* 已存在的 → 替换;新的 → 追加
|
|
272
|
-
*
|
|
353
|
+
*
|
|
354
|
+
* @example
|
|
355
|
+
* await this.mergeProductsToStore(freshProducts, { skipIndexDB: true })
|
|
273
356
|
*/
|
|
274
357
|
private mergeProductsToStore;
|
|
275
358
|
/**
|
|
@@ -288,3 +371,4 @@ export declare class ProductsModule extends BaseModule implements Module {
|
|
|
288
371
|
*/
|
|
289
372
|
getRoutes(): RouteDefinition[];
|
|
290
373
|
}
|
|
374
|
+
export {};
|