@pisell/pisellos 0.10.3 → 0.10.4
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/modules/BaseModule.d.ts +1 -0
- package/dist/modules/BaseModule.js +24 -28
- package/dist/modules/Order/index.d.ts +13 -2
- package/dist/modules/Order/index.js +142 -60
- package/dist/modules/Order/types.d.ts +8 -1
- package/dist/solution/BaseSales/index.d.ts +3 -1
- package/dist/solution/BaseSales/index.js +98 -81
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.d.ts +1 -13
- package/dist/solution/UnifiedBookingSales/index.d.ts +3 -0
- package/dist/solution/UnifiedBookingSales/index.js +377 -309
- package/dist/solution/UnifiedBookingSales/types.d.ts +7 -0
- package/lib/model/strategy/adapter/promotion/index.js +51 -0
- package/lib/modules/BaseModule.d.ts +1 -0
- package/lib/modules/BaseModule.js +24 -37
- package/lib/modules/Order/index.d.ts +13 -2
- package/lib/modules/Order/index.js +90 -19
- package/lib/modules/Order/types.d.ts +8 -1
- package/lib/solution/BaseSales/index.d.ts +3 -1
- package/lib/solution/BaseSales/index.js +29 -16
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.d.ts +1 -13
- package/lib/solution/UnifiedBookingSales/index.d.ts +3 -0
- package/lib/solution/UnifiedBookingSales/index.js +38 -0
- package/lib/solution/UnifiedBookingSales/types.d.ts +7 -0
- package/package.json +1 -1
|
@@ -447,6 +447,15 @@ var UnifiedBookingSalesImpl = class extends import_BookingTicket.BookingTicket {
|
|
|
447
447
|
this.loadOpenDataInFlight = null;
|
|
448
448
|
this.loadOpenDataInFlightTarget = null;
|
|
449
449
|
}
|
|
450
|
+
isSessionStoragePersistEnabled() {
|
|
451
|
+
var _a;
|
|
452
|
+
return Boolean(
|
|
453
|
+
this.cacheId && ((_a = this.otherParams) == null ? void 0 : _a.enableSessionStoragePersist) === true
|
|
454
|
+
);
|
|
455
|
+
}
|
|
456
|
+
shouldUseSessionStorageForSubModule(moduleName) {
|
|
457
|
+
return this.isSessionStoragePersistEnabled() && moduleName === "order";
|
|
458
|
+
}
|
|
450
459
|
/**
|
|
451
460
|
* Kiosk 不能把已收款订单留在本地等待重试:默认直接等待云端 checkout。
|
|
452
461
|
* 兼容仍需要 WebPOS 待同步模式的入口可显式传 checkoutSyncTaskEnabled: true。
|
|
@@ -472,6 +481,35 @@ var UnifiedBookingSalesImpl = class extends import_BookingTicket.BookingTicket {
|
|
|
472
481
|
}
|
|
473
482
|
return super.createSubModule(moduleName);
|
|
474
483
|
}
|
|
484
|
+
async addNewOrder() {
|
|
485
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
486
|
+
const sessionRecord = this.isSessionStoragePersistEnabled() ? (_b = (_a = this.store.order) == null ? void 0 : _a.consumeSessionStorageRestore) == null ? void 0 : _b.call(_a) : null;
|
|
487
|
+
if (!sessionRecord)
|
|
488
|
+
return super.addNewOrder();
|
|
489
|
+
await this.loadSalesDetail({
|
|
490
|
+
preloadedSalesDetail: sessionRecord,
|
|
491
|
+
hydrateSource: "sessionStorage"
|
|
492
|
+
});
|
|
493
|
+
const tempOrder = await super.addNewOrder();
|
|
494
|
+
(_c = this.store.order) == null ? void 0 : _c.persistTempOrder();
|
|
495
|
+
const customerId = Number(
|
|
496
|
+
tempOrder.customer_id || ((_d = tempOrder.customer) == null ? void 0 : _d.id) || ((_f = (_e = tempOrder._extend) == null ? void 0 : _e.customerSnapshot) == null ? void 0 : _f.id) || ((_h = (_g = tempOrder._extend) == null ? void 0 : _g.customerSnapshot) == null ? void 0 : _h.customer_id) || 0
|
|
497
|
+
);
|
|
498
|
+
if (customerId > 1) {
|
|
499
|
+
try {
|
|
500
|
+
await this.loadDiscountConfig({
|
|
501
|
+
customerId,
|
|
502
|
+
action: tempOrder.order_id ? "edit" : "create"
|
|
503
|
+
});
|
|
504
|
+
} catch (error) {
|
|
505
|
+
console.warn(
|
|
506
|
+
"[UnifiedBookingSales] Failed to refresh discounts after session restore",
|
|
507
|
+
error
|
|
508
|
+
);
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
return ((_i = this.store.order) == null ? void 0 : _i.getTempOrder()) || tempOrder;
|
|
512
|
+
}
|
|
475
513
|
/**
|
|
476
514
|
* Loads OpenData without borrowing BookingTicket. Cache ownership is tied to the exact
|
|
477
515
|
* business/channel target so a reused solution instance cannot leak another entry's menus.
|
|
@@ -11,6 +11,13 @@ export declare enum UnifiedBookingSalesHooks {
|
|
|
11
11
|
export interface UnifiedBookingSalesState extends BookingTicketState {
|
|
12
12
|
resourcePlanner: ResourcePlannerModule;
|
|
13
13
|
}
|
|
14
|
+
export interface UnifiedBookingSalesOtherParams extends Record<string, any> {
|
|
15
|
+
/**
|
|
16
|
+
* Persist the active order workspace in sessionStorage, partitioned by cacheId.
|
|
17
|
+
* Disabled by default and ignored when cacheId is missing.
|
|
18
|
+
*/
|
|
19
|
+
enableSessionStoragePersist?: boolean;
|
|
20
|
+
}
|
|
14
21
|
/** Explicit OpenData target used by page-level UnifiedBookingSales skins. */
|
|
15
22
|
export interface UnifiedBookingSalesLoadOpenDataParams {
|
|
16
23
|
businessCode: string;
|