@pisell/pisellos 2.3.106 → 2.3.108
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/Discount/index.js +4 -1
- package/dist/modules/Discount/types.d.ts +10 -0
- package/dist/modules/OpenData/index.d.ts +15 -2
- package/dist/modules/OpenData/index.js +307 -19
- package/dist/modules/OpenData/types.d.ts +55 -0
- package/dist/modules/OpenData/types.js +7 -1
- package/dist/modules/OpenData/utils.d.ts +21 -1
- package/dist/modules/OpenData/utils.js +138 -0
- package/dist/modules/Order/index.d.ts +4 -2
- package/dist/modules/Order/index.js +69 -16
- package/dist/modules/Order/types.d.ts +13 -0
- package/dist/modules/Order/utils.d.ts +4 -1
- package/dist/modules/Order/utils.js +57 -3
- package/dist/plugins/request.d.ts +2 -1
- package/dist/plugins/request.js +4 -2
- package/dist/server/index.d.ts +14 -0
- package/dist/server/index.js +1732 -1285
- package/dist/server/modules/order/types.d.ts +50 -0
- package/dist/server/modules/order/types.js +2 -0
- package/dist/server/utils/small-ticket.d.ts +4 -1
- package/dist/server/utils/small-ticket.js +461 -96
- package/dist/solution/BaseSales/index.d.ts +7 -1
- package/dist/solution/BaseSales/index.js +128 -45
- package/dist/solution/BaseSales/utils/parseSalesResponse.d.ts +2 -0
- package/dist/solution/BaseSales/utils/parseSalesResponse.js +1 -1
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.d.ts +8 -3
- package/dist/solution/BookingTicket/index.js +558 -443
- package/dist/solution/Sales/index.d.ts +16 -1
- package/dist/solution/Sales/index.js +338 -63
- package/dist/solution/Sales/types.d.ts +10 -0
- package/dist/solution/UnifiedBookingSales/index.d.ts +5 -4
- package/dist/solution/UnifiedBookingSales/index.js +526 -447
- package/dist/solution/UnifiedBookingSales/types.d.ts +7 -1
- package/lib/modules/Discount/index.js +4 -1
- package/lib/modules/Discount/types.d.ts +10 -0
- package/lib/modules/OpenData/index.d.ts +15 -2
- package/lib/modules/OpenData/index.js +230 -3
- package/lib/modules/OpenData/types.d.ts +55 -0
- package/lib/modules/OpenData/types.js +9 -1
- package/lib/modules/OpenData/utils.d.ts +21 -1
- package/lib/modules/OpenData/utils.js +126 -0
- package/lib/modules/Order/index.d.ts +4 -2
- package/lib/modules/Order/index.js +52 -1
- package/lib/modules/Order/types.d.ts +13 -0
- package/lib/modules/Order/utils.d.ts +4 -1
- package/lib/modules/Order/utils.js +58 -1
- package/lib/plugins/request.d.ts +2 -1
- package/lib/plugins/request.js +3 -2
- package/lib/server/index.d.ts +14 -0
- package/lib/server/index.js +453 -105
- package/lib/server/modules/order/types.d.ts +50 -0
- package/lib/server/modules/order/types.js +1 -0
- package/lib/server/utils/small-ticket.d.ts +4 -1
- package/lib/server/utils/small-ticket.js +427 -72
- package/lib/solution/BaseSales/index.d.ts +7 -1
- package/lib/solution/BaseSales/index.js +90 -7
- package/lib/solution/BaseSales/utils/parseSalesResponse.d.ts +2 -0
- package/lib/solution/BaseSales/utils/parseSalesResponse.js +1 -1
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.d.ts +8 -3
- package/lib/solution/BookingTicket/index.js +60 -15
- package/lib/solution/Sales/index.d.ts +16 -1
- package/lib/solution/Sales/index.js +168 -1
- package/lib/solution/Sales/types.d.ts +10 -0
- package/lib/solution/UnifiedBookingSales/index.d.ts +5 -4
- package/lib/solution/UnifiedBookingSales/index.js +44 -15
- package/lib/solution/UnifiedBookingSales/types.d.ts +7 -1
- package/package.json +1 -1
|
@@ -50,6 +50,12 @@ export interface GetResourceBookingItemParams {
|
|
|
50
50
|
bookingList: BookingData[];
|
|
51
51
|
deviceTime?: string;
|
|
52
52
|
}
|
|
53
|
+
export interface SalesPrintLocalOrderReceiptOptions {
|
|
54
|
+
/** 当前销售业务类型,用于隔离 Documents Invoice 配置。 */
|
|
55
|
+
businessCode: string;
|
|
56
|
+
/** 当前销售入口;缺失或为 system 时按 pos 处理。 */
|
|
57
|
+
channel?: string;
|
|
58
|
+
}
|
|
53
59
|
/**
|
|
54
60
|
* Sales 解决方案状态
|
|
55
61
|
*
|
|
@@ -82,6 +88,10 @@ export interface SalesModuleAPI {
|
|
|
82
88
|
cancelOrder: (orderIds: Array<number | string>) => Promise<any>;
|
|
83
89
|
/** 变更预约状态 */
|
|
84
90
|
changeBookingStatus: (params: ChangeBookingStatusParams) => Promise<any>;
|
|
91
|
+
/** 按本地订单标识打印小票;本地未命中时由 OS Server 负责远端兜底。 */
|
|
92
|
+
printLocalOrderReceipt: <T = any>(lookup: string | number, options: SalesPrintLocalOrderReceiptOptions) => Promise<T>;
|
|
93
|
+
/** 清除 Legacy Sales 独立维护的 Documents OpenData 缓存。 */
|
|
94
|
+
clearOpenDataCache: () => void;
|
|
85
95
|
/** 获取资源维度的预约占用列表 */
|
|
86
96
|
getResourceBookingList: (currentTime: string, bookingList: BookingData[], deviceTime?: string) => Promise<SalesResourceBookingItem[]>;
|
|
87
97
|
/** 获取单个资源维度的预约占用、已完成、未支付列表 */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Module, ModuleOptions, PisellCore } from '../../types';
|
|
2
2
|
import type { ProductData } from '../../modules';
|
|
3
|
-
import type
|
|
3
|
+
import { type InvoiceLayoutConfig, type InvoiceTemplateSettings, type OpenDataConfig } from '../../modules/OpenData';
|
|
4
4
|
import type { LoadScheduleAvailableDateParams, ScheduleItem } from '../../modules/Schedule/types';
|
|
5
5
|
import type { ProductListLoadProductsParams, ProductListStoreQueryParams } from '../../modules/ProductList';
|
|
6
6
|
import type { AvailabilityDateRange, AvailabilityOccupancy, AvailabilityProduct, AvailabilityResource, GetProductTimeRangesRequest } from '../../modules/ResourcePlanner';
|
|
@@ -60,9 +60,6 @@ export declare class UnifiedBookingSalesImpl extends BookingTicket {
|
|
|
60
60
|
protected defaultVersion: string;
|
|
61
61
|
protected store: UnifiedBookingSalesState;
|
|
62
62
|
private unifiedProductCatalog;
|
|
63
|
-
private openDataTarget;
|
|
64
|
-
private loadOpenDataInFlight;
|
|
65
|
-
private loadOpenDataInFlightTarget;
|
|
66
63
|
private availabilityRuntimeOffsetMinutes;
|
|
67
64
|
private availabilityScheduleCatalog;
|
|
68
65
|
private availabilityProjectionSequence;
|
|
@@ -159,6 +156,10 @@ export declare class UnifiedBookingSalesImpl extends BookingTicket {
|
|
|
159
156
|
* 只返回优先级最高 Action 中当前商品 Target 的 dataSource,不跨商品或 Action 合并。
|
|
160
157
|
*/
|
|
161
158
|
resolveProductAllergyRequirement(params: UnifiedBookingSalesResolveProductAllergyRequirementParams): Promise<AllergyRequirement | null>;
|
|
159
|
+
clearOpenDataCache(): void;
|
|
160
|
+
getInvoiceLayoutConfig(): Promise<InvoiceLayoutConfig>;
|
|
161
|
+
getInvoiceTemplateSettings(): Promise<InvoiceTemplateSettings>;
|
|
162
|
+
protected isInvoiceOpenDataCacheCurrent(): boolean;
|
|
162
163
|
/**
|
|
163
164
|
* Load a resource policy without depending on the legacy appointmentBooking solution.
|
|
164
165
|
*/
|
|
@@ -33,6 +33,7 @@ var _dayjs = _interopRequireDefault(require("dayjs"));
|
|
|
33
33
|
var _lodashEs = require("lodash-es");
|
|
34
34
|
var _modules = require("../../modules");
|
|
35
35
|
var _utils = require("../../modules/BookingContext/utils");
|
|
36
|
+
var _OpenData = require("../../modules/OpenData");
|
|
36
37
|
var _getDateIsInSchedule = require("../../modules/Schedule/getDateIsInSchedule");
|
|
37
38
|
var _ResourcePlanner = require("../../modules/ResourcePlanner");
|
|
38
39
|
var _types = require("./types");
|
|
@@ -53,7 +54,7 @@ var _localClock = require("../../modules/ResourcePlanner/localClock");
|
|
|
53
54
|
var _platform = require("../../utils/platform");
|
|
54
55
|
var _itemRule = require("../../model/strategy/adapter/itemRule");
|
|
55
56
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
56
|
-
const OPEN_DATA_SECTION_CODES = ['sale', 'reservation', 'fulfillment', 'menu', 'workflow', 'basic', 'checkout', 'availability'];
|
|
57
|
+
const OPEN_DATA_SECTION_CODES = ['sale', 'reservation', 'fulfillment', 'menu', 'workflow', 'documents', 'basic', 'checkout', 'availability'];
|
|
57
58
|
const OPEN_DATA_CACHE_TTL = 5 * 60 * 1000;
|
|
58
59
|
function normalizePositiveInteger(value) {
|
|
59
60
|
const normalized = Number(value);
|
|
@@ -1199,9 +1200,6 @@ class UnifiedBookingSalesImpl extends _BookingTicket.BookingTicket {
|
|
|
1199
1200
|
defaultVersion = '1.0.0';
|
|
1200
1201
|
store = {};
|
|
1201
1202
|
unifiedProductCatalog = [];
|
|
1202
|
-
openDataTarget = null;
|
|
1203
|
-
loadOpenDataInFlight = null;
|
|
1204
|
-
loadOpenDataInFlightTarget = null;
|
|
1205
1203
|
availabilityRuntimeOffsetMinutes = null;
|
|
1206
1204
|
availabilityScheduleCatalog = null;
|
|
1207
1205
|
availabilityProjectionSequence = 0;
|
|
@@ -1705,6 +1703,9 @@ class UnifiedBookingSalesImpl extends _BookingTicket.BookingTicket {
|
|
|
1705
1703
|
const cachedData = this.store.openData.getOpenData();
|
|
1706
1704
|
const lastFetchedAt = this.store.openData.getLastFetchedAt();
|
|
1707
1705
|
if (!params.force && this.openDataTarget === target && cachedData && lastFetchedAt && Date.now() - lastFetchedAt < OPEN_DATA_CACHE_TTL) {
|
|
1706
|
+
if (typeof this.store.openData.ensureInvoiceTemplateSettings === 'function') {
|
|
1707
|
+
await this.store.openData.ensureInvoiceTemplateSettings(target);
|
|
1708
|
+
}
|
|
1708
1709
|
return cachedData;
|
|
1709
1710
|
}
|
|
1710
1711
|
if (this.loadOpenDataInFlight) {
|
|
@@ -1715,30 +1716,32 @@ class UnifiedBookingSalesImpl extends _BookingTicket.BookingTicket {
|
|
|
1715
1716
|
return this.loadOpenData(params);
|
|
1716
1717
|
}
|
|
1717
1718
|
this.loadOpenDataInFlightTarget = target;
|
|
1718
|
-
|
|
1719
|
+
const request = this.store.openData.fetchOpenData({
|
|
1719
1720
|
scope: 'board',
|
|
1720
1721
|
target,
|
|
1721
1722
|
section_code: [...OPEN_DATA_SECTION_CODES]
|
|
1722
1723
|
});
|
|
1724
|
+
this.loadOpenDataInFlight = request;
|
|
1723
1725
|
try {
|
|
1724
|
-
const openData = await
|
|
1725
|
-
this.
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1726
|
+
const openData = await request;
|
|
1727
|
+
if (this.loadOpenDataInFlight === request) {
|
|
1728
|
+
this.openDataTarget = target;
|
|
1729
|
+
this.otherParams.openData = openData;
|
|
1730
|
+
this.otherParams.businessCode = businessCode;
|
|
1731
|
+
this.otherParams.channel = channel;
|
|
1732
|
+
}
|
|
1729
1733
|
return openData;
|
|
1730
1734
|
} finally {
|
|
1731
|
-
this.loadOpenDataInFlight
|
|
1732
|
-
|
|
1735
|
+
if (this.loadOpenDataInFlight === request) {
|
|
1736
|
+
this.loadOpenDataInFlight = null;
|
|
1737
|
+
this.loadOpenDataInFlightTarget = null;
|
|
1738
|
+
}
|
|
1733
1739
|
}
|
|
1734
1740
|
}
|
|
1735
1741
|
async getOpenData() {
|
|
1736
1742
|
const businessCode = String(this.otherParams?.businessCode || '').trim();
|
|
1737
1743
|
const channel = String(this.otherParams?.channel || '').trim();
|
|
1738
1744
|
if (!businessCode || !channel) return null;
|
|
1739
|
-
const target = `${businessCode}+${channel}`;
|
|
1740
|
-
const cachedData = this.store.openData?.getOpenData() || null;
|
|
1741
|
-
if (cachedData && this.openDataTarget === target) return cachedData;
|
|
1742
1745
|
return this.loadOpenData({
|
|
1743
1746
|
businessCode,
|
|
1744
1747
|
channel
|
|
@@ -1836,6 +1839,32 @@ class UnifiedBookingSalesImpl extends _BookingTicket.BookingTicket {
|
|
|
1836
1839
|
custom: runtimeConfig.custom
|
|
1837
1840
|
});
|
|
1838
1841
|
}
|
|
1842
|
+
clearOpenDataCache() {
|
|
1843
|
+
this.openDataTarget = null;
|
|
1844
|
+
this.loadOpenDataInFlight = null;
|
|
1845
|
+
this.loadOpenDataInFlightTarget = null;
|
|
1846
|
+
super.clearOpenDataCache();
|
|
1847
|
+
}
|
|
1848
|
+
async getInvoiceLayoutConfig() {
|
|
1849
|
+
const openData = await this.getOpenData();
|
|
1850
|
+
if (!openData || !this.store.openData) {
|
|
1851
|
+
return (0, _OpenData.getDefaultInvoiceLayoutConfig)();
|
|
1852
|
+
}
|
|
1853
|
+
return this.store.openData.getInvoiceLayoutConfig();
|
|
1854
|
+
}
|
|
1855
|
+
async getInvoiceTemplateSettings() {
|
|
1856
|
+
const openData = await this.getOpenData();
|
|
1857
|
+
if (!openData || !this.store.openData) {
|
|
1858
|
+
return (0, _OpenData.getDefaultInvoiceTemplateSettings)();
|
|
1859
|
+
}
|
|
1860
|
+
return this.store.openData.getInvoiceTemplateSettings();
|
|
1861
|
+
}
|
|
1862
|
+
isInvoiceOpenDataCacheCurrent() {
|
|
1863
|
+
const businessCode = String(this.otherParams?.businessCode || '').trim();
|
|
1864
|
+
const channel = String(this.otherParams?.channel || '').trim();
|
|
1865
|
+
if (!businessCode || !channel) return false;
|
|
1866
|
+
return this.openDataTarget === `${businessCode}+${channel}`;
|
|
1867
|
+
}
|
|
1839
1868
|
|
|
1840
1869
|
/**
|
|
1841
1870
|
* Load a resource policy without depending on the legacy appointmentBooking solution.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { OpenDataConfig } from '../../modules/OpenData';
|
|
1
|
+
import type { InvoiceLayoutConfig, InvoiceTemplateSettings, OpenDataConfig } from '../../modules/OpenData';
|
|
2
2
|
import type { ProductListLoadProductsParams, ProductListStoreQueryParams } from '../../modules/ProductList';
|
|
3
3
|
import type { ProductData } from '../../modules/Product/types';
|
|
4
4
|
import type { LoadScheduleAvailableDateParams } from '../../modules/Schedule/types';
|
|
@@ -217,7 +217,13 @@ export interface UnifiedBookingSalesDiscountResult {
|
|
|
217
217
|
}
|
|
218
218
|
export interface UnifiedBookingSalesApi {
|
|
219
219
|
loadOpenData: (params: UnifiedBookingSalesLoadOpenDataParams) => Promise<OpenDataConfig>;
|
|
220
|
+
/** Returns the latest OpenData payload cached by this solution instance. */
|
|
220
221
|
getOpenData: () => Promise<OpenDataConfig | null>;
|
|
222
|
+
/** Returns the normalized Documents Invoice layout for the active target. */
|
|
223
|
+
getInvoiceLayoutConfig: () => Promise<InvoiceLayoutConfig>;
|
|
224
|
+
/** Returns the Native Invoice template settings for the active target. */
|
|
225
|
+
getInvoiceTemplateSettings: () => Promise<InvoiceTemplateSettings>;
|
|
226
|
+
/** Date-first calendar availability backed by ScheduleModule. */
|
|
221
227
|
loadScheduleAvailableDate: (params: LoadScheduleAvailableDateParams) => Promise<unknown>;
|
|
222
228
|
loadProductsByScheduleDate: (params: UnifiedBookingSalesLoadProductsByScheduleDateParams) => Promise<unknown[]>;
|
|
223
229
|
queryProducts: (params?: ProductListStoreQueryParams) => Promise<ProductData[]>;
|