@pisell/pisellos 2.3.66 → 2.3.68
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/BaseModule.d.ts +1 -0
- package/dist/modules/BaseModule.js +24 -28
- package/dist/modules/Order/index.d.ts +22 -2
- package/dist/modules/Order/index.js +313 -142
- package/dist/modules/Order/types.d.ts +13 -1
- package/dist/modules/Order/utils/orderCollectionIdentity.d.ts +15 -0
- package/dist/modules/Order/utils/orderCollectionIdentity.js +75 -0
- package/dist/modules/Order/utils.js +0 -1
- package/dist/modules/Payment/index.d.ts +4 -0
- package/dist/modules/Payment/index.js +14 -4
- package/dist/modules/Payment/walletpass.js +21 -7
- package/dist/modules/Rules/index.js +46 -31
- package/dist/solution/BaseSales/index.d.ts +3 -1
- package/dist/solution/BaseSales/index.js +99 -82
- package/dist/solution/BaseSales/utils.js +31 -20
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.d.ts +4 -2
- package/dist/solution/BookingTicket/index.js +89 -65
- package/dist/solution/ScanOrder/utils.js +31 -20
- package/dist/solution/UnifiedBookingSales/index.d.ts +25 -0
- package/dist/solution/UnifiedBookingSales/index.js +640 -321
- package/dist/solution/UnifiedBookingSales/types.d.ts +7 -0
- package/lib/model/strategy/adapter/promotion/index.js +0 -51
- package/lib/modules/BaseModule.d.ts +1 -0
- package/lib/modules/BaseModule.js +24 -37
- package/lib/modules/Order/index.d.ts +22 -2
- package/lib/modules/Order/index.js +212 -54
- package/lib/modules/Order/types.d.ts +13 -1
- package/lib/modules/Order/utils/orderCollectionIdentity.d.ts +15 -0
- package/lib/modules/Order/utils/orderCollectionIdentity.js +70 -0
- package/lib/modules/Order/utils.js +0 -1
- package/lib/modules/Payment/index.d.ts +4 -0
- package/lib/modules/Payment/index.js +7 -0
- package/lib/modules/Payment/walletpass.js +12 -0
- package/lib/modules/Rules/index.js +17 -1
- package/lib/solution/BaseSales/index.d.ts +3 -1
- package/lib/solution/BaseSales/index.js +29 -16
- package/lib/solution/BaseSales/utils.js +29 -18
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.d.ts +4 -2
- package/lib/solution/BookingTicket/index.js +35 -12
- package/lib/solution/ScanOrder/utils.js +29 -18
- package/lib/solution/UnifiedBookingSales/index.d.ts +25 -0
- package/lib/solution/UnifiedBookingSales/index.js +188 -0
- package/lib/solution/UnifiedBookingSales/types.d.ts +7 -0
- package/package.json +1 -1
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
// 导出评估器
|
|
2
|
-
export { PromotionEvaluator } from "./evaluator";
|
|
3
|
-
|
|
4
|
-
// 导出适配器
|
|
5
|
-
export { PromotionAdapter } from "./adapter";
|
|
6
|
-
export { default } from "./adapter";
|
|
7
|
-
|
|
8
|
-
// 导出策略配置示例常量
|
|
9
|
-
export { X_ITEMS_FOR_Y_PRICE_STRATEGY, BUY_X_GET_Y_FREE_STRATEGY, ITEM_REWARD_STRATEGY } from "./examples";
|
|
@@ -8,6 +8,7 @@ export declare class BaseModule {
|
|
|
8
8
|
protected core: PisellCore;
|
|
9
9
|
constructor(name?: string, version?: string);
|
|
10
10
|
destroy(): void;
|
|
11
|
+
private isRecord;
|
|
11
12
|
checkSaveCache({ cacheId, fatherModule, store, cacheKey, }: {
|
|
12
13
|
cacheId: string | undefined;
|
|
13
14
|
fatherModule: string | undefined;
|
|
@@ -23,45 +23,41 @@ export var BaseModule = /*#__PURE__*/function () {
|
|
|
23
23
|
this.core.effects.offByModuleDestroy(this.name);
|
|
24
24
|
this.core.unregisterModule(this);
|
|
25
25
|
}
|
|
26
|
+
}, {
|
|
27
|
+
key: "isRecord",
|
|
28
|
+
value: function isRecord(value) {
|
|
29
|
+
return !!value && _typeof(value) === 'object' && !Array.isArray(value);
|
|
30
|
+
}
|
|
26
31
|
|
|
27
32
|
// 提供统一的缓存 module 里的数据的方法
|
|
28
33
|
}, {
|
|
29
34
|
key: "checkSaveCache",
|
|
30
35
|
value: function checkSaveCache(_ref) {
|
|
31
|
-
var _this = this;
|
|
32
36
|
var cacheId = _ref.cacheId,
|
|
33
37
|
fatherModule = _ref.fatherModule,
|
|
34
38
|
store = _ref.store,
|
|
35
39
|
cacheKey = _ref.cacheKey;
|
|
36
|
-
|
|
37
|
-
|
|
40
|
+
if (!cacheId) return;
|
|
41
|
+
try {
|
|
42
|
+
var window = this.core.getPlugin('window');
|
|
43
|
+
var sessionStorage = window === null || window === void 0 ? void 0 : window.sessionStorage;
|
|
44
|
+
if (!sessionStorage) return;
|
|
45
|
+
var storageKey = fatherModule || cacheId;
|
|
46
|
+
var rawCacheData = sessionStorage.getItem(storageKey);
|
|
47
|
+
var parsedCacheData = rawCacheData ? JSON.parse(rawCacheData) : {};
|
|
48
|
+
if (!this.isRecord(parsedCacheData)) return;
|
|
49
|
+
var cacheBucket = fatherModule ? this.isRecord(parsedCacheData[cacheId]) ? parsedCacheData[cacheId] : {} : parsedCacheData;
|
|
50
|
+
var moduleBucket = this.isRecord(cacheBucket[this.name]) ? cacheBucket[this.name] : {};
|
|
51
|
+
cacheKey.forEach(function (key) {
|
|
52
|
+
moduleBucket[key] = store === null || store === void 0 ? void 0 : store[key];
|
|
53
|
+
});
|
|
54
|
+
cacheBucket[this.name] = moduleBucket;
|
|
38
55
|
if (fatherModule) {
|
|
39
|
-
|
|
40
|
-
var currentCacheDataObj = JSON.parse(currentCacheData || '{}');
|
|
41
|
-
if (!currentCacheData || !currentCacheDataObj[cacheId]) {
|
|
42
|
-
currentCacheDataObj = _defineProperty({}, cacheId, _defineProperty({}, this.name, {}));
|
|
43
|
-
}
|
|
44
|
-
if (!currentCacheDataObj[cacheId][this.name]) {
|
|
45
|
-
currentCacheDataObj[cacheId][this.name] = {};
|
|
46
|
-
}
|
|
47
|
-
cacheKey.forEach(function (key) {
|
|
48
|
-
currentCacheDataObj[cacheId][_this.name][key] = store === null || store === void 0 ? void 0 : store[key];
|
|
49
|
-
});
|
|
50
|
-
window.sessionStorage.setItem(fatherModule, JSON.stringify(currentCacheDataObj));
|
|
51
|
-
} else {
|
|
52
|
-
var _currentCacheData = window.sessionStorage.getItem(cacheId);
|
|
53
|
-
var _currentCacheDataObj2 = JSON.parse(_currentCacheData || '{}');
|
|
54
|
-
if (!_currentCacheDataObj2) {
|
|
55
|
-
_currentCacheDataObj2 = {};
|
|
56
|
-
}
|
|
57
|
-
if (!_currentCacheDataObj2[this.name]) {
|
|
58
|
-
_currentCacheDataObj2[this.name] = {};
|
|
59
|
-
}
|
|
60
|
-
cacheKey.forEach(function (key) {
|
|
61
|
-
_currentCacheDataObj2[_this.name][key] = store[key];
|
|
62
|
-
});
|
|
63
|
-
window.sessionStorage.setItem(cacheId, JSON.stringify(_currentCacheDataObj2));
|
|
56
|
+
parsedCacheData[cacheId] = cacheBucket;
|
|
64
57
|
}
|
|
58
|
+
sessionStorage.setItem(storageKey, JSON.stringify(parsedCacheData));
|
|
59
|
+
} catch (_unused) {
|
|
60
|
+
// sessionStorage persistence is best-effort and must not block checkout.
|
|
65
61
|
}
|
|
66
62
|
}
|
|
67
63
|
}, {
|
|
@@ -16,6 +16,10 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
16
16
|
private window;
|
|
17
17
|
private appPlugin;
|
|
18
18
|
private cacheId;
|
|
19
|
+
private fatherModule;
|
|
20
|
+
private openCache;
|
|
21
|
+
private sessionStoragePersistEnabled;
|
|
22
|
+
private sessionStorageRestoreRecord;
|
|
19
23
|
private salesSummaryModuleName;
|
|
20
24
|
private rulesHooksOverride?;
|
|
21
25
|
private moduleHooksOverride?;
|
|
@@ -46,6 +50,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
46
50
|
static populateSavedAmounts(productList: Array<Record<string, any>>, discountList: Array<Record<string, any>>): void;
|
|
47
51
|
private applyProductDiscountPrices;
|
|
48
52
|
constructor(name?: string, version?: string);
|
|
53
|
+
private syncSessionStorageOptions;
|
|
49
54
|
initialize(core: PisellCore, options: ModuleOptions): Promise<void>;
|
|
50
55
|
destroy(): Promise<void>;
|
|
51
56
|
/**
|
|
@@ -137,7 +142,8 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
137
142
|
}): void;
|
|
138
143
|
/**
|
|
139
144
|
* 控制 IndexedDB 草稿(saveDraft)是否写入。
|
|
140
|
-
*
|
|
145
|
+
* 此开关仅影响 saveDraft;可选 sessionStorage 会话恢复由
|
|
146
|
+
* enableSessionStoragePersist 独立控制。
|
|
141
147
|
*
|
|
142
148
|
* @example
|
|
143
149
|
* order.setEnableTempOrderPersist(false); // BigSale 弹窗:跳过 ~1s 的 dbUpdate
|
|
@@ -145,8 +151,19 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
145
151
|
setEnableTempOrderPersist(enabled: boolean): void;
|
|
146
152
|
/** 是否允许 saveDraft 写入 IndexedDB 草稿。 */
|
|
147
153
|
isTempOrderPersistEnabled(): boolean;
|
|
148
|
-
/**
|
|
154
|
+
/**
|
|
155
|
+
* 在 UnifiedBookingSales 显式开启会话恢复时,将完整 tempOrder 写入
|
|
156
|
+
* sessionStorage 的 cacheId 分桶。写入失败由 BaseModule 静默降级。
|
|
157
|
+
*/
|
|
149
158
|
persistTempOrder(): void;
|
|
159
|
+
/**
|
|
160
|
+
* 终止当前模块实例的 sessionStorage 订单恢复会话。
|
|
161
|
+
*
|
|
162
|
+
* 支付跳转等终态场景需要同时删除当前 cacheId 的 tempOrder 快照,并关闭
|
|
163
|
+
* 本实例后续异步任务的再次写入;新模块实例初始化时会按 otherParams 重新启用。
|
|
164
|
+
*/
|
|
165
|
+
clearSessionStoragePersistedTempOrder(): void;
|
|
166
|
+
consumeSessionStorageRestore(): Record<string, any> | null;
|
|
150
167
|
notifyTempOrderChanged(): void;
|
|
151
168
|
private createDefaultTempOrderInstance;
|
|
152
169
|
private createExternalSaleNumber;
|
|
@@ -178,6 +195,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
178
195
|
orderExpectedAmount: string;
|
|
179
196
|
};
|
|
180
197
|
private calculateDepositPaidAmount;
|
|
198
|
+
private hasPaidNormalPayment;
|
|
181
199
|
private resolveNextOrderPaymentType;
|
|
182
200
|
private getPaymentNumberAppData;
|
|
183
201
|
private getPaymentNumberDevicePrefixSync;
|
|
@@ -227,6 +245,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
227
245
|
private sanitizeOrderProductForTempOrder;
|
|
228
246
|
private sanitizeTempOrderProducts;
|
|
229
247
|
private ensureExtend;
|
|
248
|
+
private repairDuplicateProductLineIdentities;
|
|
230
249
|
private captureProductRuntime;
|
|
231
250
|
private createLinkedProductAndBooking;
|
|
232
251
|
/**
|
|
@@ -543,6 +562,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
543
562
|
*/
|
|
544
563
|
hydrateTempOrderFromRecord(record: Record<string, any>, options?: {
|
|
545
564
|
recalcOnHydrate?: boolean;
|
|
565
|
+
source?: 'salesDetail' | 'sessionStorage';
|
|
546
566
|
}): Promise<OrderTempOrder>;
|
|
547
567
|
/**
|
|
548
568
|
* 兼容后端详情将 holder 放在 metadata.holder 的历史形态,统一补到运行时展示路径。
|