@pisell/pisellos 2.3.128 → 2.3.130
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/index.d.ts +2 -0
- package/dist/index.js +3 -1
- package/dist/model/strategy/adapter/promotion/index.js +0 -9
- package/dist/model/strategy/adapter/walletPass/evaluator.d.ts +2 -0
- package/dist/model/strategy/adapter/walletPass/evaluator.js +4 -2
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +58 -19
- package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +24 -12
- package/dist/modules/Customer/index.js +6 -3
- package/dist/modules/Customer/types.d.ts +2 -0
- package/dist/modules/Discount/availability.d.ts +7 -0
- package/dist/modules/Discount/availability.js +49 -0
- package/dist/modules/Discount/entitlementPass.d.ts +34 -0
- package/dist/modules/Discount/entitlementPass.js +147 -0
- package/dist/modules/Discount/index.d.ts +2 -2
- package/dist/modules/Discount/index.js +37 -151
- package/dist/modules/Discount/types.d.ts +36 -5
- package/dist/modules/FulfillmentTiming/index.d.ts +11 -0
- package/dist/modules/FulfillmentTiming/index.js +407 -0
- package/dist/modules/FulfillmentTiming/types.d.ts +67 -0
- package/dist/modules/FulfillmentTiming/types.js +1 -0
- package/dist/modules/OpenData/types.d.ts +6 -0
- package/dist/modules/Order/index.d.ts +12 -0
- package/dist/modules/Order/index.js +498 -247
- package/dist/modules/Order/pickupTiming.d.ts +46 -0
- package/dist/modules/Order/pickupTiming.js +53 -0
- package/dist/modules/Order/types.d.ts +5 -1
- package/dist/modules/Order/utils/orderCollectionIdentity.js +16 -12
- package/dist/modules/Order/utils.d.ts +1 -1
- package/dist/modules/Order/utils.js +117 -66
- package/dist/modules/Payment/index.js +9 -10
- package/dist/modules/Payment/types.d.ts +21 -1
- package/dist/modules/Payment/types.js +2 -0
- package/dist/modules/Payment/walletpass.d.ts +1 -1
- package/dist/modules/Payment/walletpass.js +80 -47
- package/dist/modules/Rules/index.d.ts +2 -2
- package/dist/modules/Rules/index.js +480 -186
- package/dist/modules/Rules/types.d.ts +4 -0
- package/dist/modules/Schedule/index.d.ts +8 -0
- package/dist/modules/Schedule/index.js +141 -39
- package/dist/modules/index.d.ts +1 -0
- package/dist/modules/index.js +1 -0
- package/dist/plugins/request.d.ts +7 -0
- package/dist/server/modules/order/types.d.ts +2 -0
- package/dist/server/utils/small-ticket.d.ts +1 -85
- package/dist/server/utils/small-ticket.js +2 -2542
- package/dist/shared/payment/loadPaymentMethods.d.ts +9 -0
- package/dist/shared/payment/loadPaymentMethods.js +66 -0
- package/dist/shared/receipt/loadCustomerInvoiceLayout.d.ts +22 -0
- package/dist/shared/receipt/loadCustomerInvoiceLayout.js +142 -0
- package/dist/shared/receipt/small-ticket.d.ts +85 -0
- package/dist/shared/receipt/small-ticket.js +2576 -0
- package/dist/shared/sales/loadSalesOrderSnapshot.d.ts +9 -0
- package/dist/shared/sales/loadSalesOrderSnapshot.js +21 -0
- package/dist/solution/BaseSales/index.d.ts +25 -0
- package/dist/solution/BaseSales/index.js +1226 -1040
- package/dist/solution/BaseSales/pickupTiming.d.ts +43 -0
- package/dist/solution/BaseSales/pickupTiming.js +589 -0
- package/dist/solution/BaseSales/types.d.ts +2 -2
- package/dist/solution/BaseSales/utils/cartPromotion.js +141 -126
- package/dist/solution/BaseSales/utils/parseSalesResponse.js +3 -0
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.d.ts +4 -5
- package/dist/solution/BookingTicket/index.js +60 -63
- package/dist/solution/BookingTicket/types.d.ts +5 -1
- package/dist/solution/BookingTicket/utils/cartView.js +3 -1
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +2 -0
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +338 -147
- package/dist/solution/BookingTicket/utils/scan/cloudSearch.js +8 -4
- package/dist/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +6 -0
- package/dist/solution/BookingTicket/utils/scan/formatGlobalScan.js +19 -6
- package/dist/solution/OrderInvoicePreview/index.d.ts +56 -0
- package/dist/solution/OrderInvoicePreview/index.js +269 -0
- package/dist/solution/ShopDiscount/index.d.ts +2 -0
- package/dist/solution/ShopDiscount/index.js +99 -42
- package/dist/solution/ShopDiscount/utils.d.ts +4 -2
- package/dist/solution/ShopDiscount/utils.js +43 -23
- package/dist/solution/UnifiedBookingSales/index.d.ts +13 -4
- package/dist/solution/UnifiedBookingSales/index.js +874 -709
- package/dist/solution/index.d.ts +1 -0
- package/dist/solution/index.js +2 -1
- package/lib/index.d.ts +2 -0
- package/lib/index.js +21 -1
- package/lib/model/strategy/adapter/walletPass/evaluator.d.ts +2 -0
- package/lib/model/strategy/adapter/walletPass/evaluator.js +2 -0
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +35 -6
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +13 -6
- package/lib/modules/Customer/index.js +5 -1
- package/lib/modules/Customer/types.d.ts +2 -0
- package/lib/modules/Discount/availability.d.ts +7 -0
- package/lib/modules/Discount/availability.js +43 -0
- package/lib/modules/Discount/entitlementPass.d.ts +34 -0
- package/lib/modules/Discount/entitlementPass.js +141 -0
- package/lib/modules/Discount/index.d.ts +2 -2
- package/lib/modules/Discount/index.js +23 -129
- package/lib/modules/Discount/types.d.ts +36 -5
- package/lib/modules/FulfillmentTiming/index.d.ts +11 -0
- package/lib/modules/FulfillmentTiming/index.js +359 -0
- package/lib/modules/FulfillmentTiming/types.d.ts +67 -0
- package/lib/modules/FulfillmentTiming/types.js +5 -0
- package/lib/modules/OpenData/types.d.ts +6 -0
- package/lib/modules/Order/index.d.ts +12 -0
- package/lib/modules/Order/index.js +252 -48
- package/lib/modules/Order/pickupTiming.d.ts +46 -0
- package/lib/modules/Order/pickupTiming.js +61 -0
- package/lib/modules/Order/types.d.ts +5 -1
- package/lib/modules/Order/utils/orderCollectionIdentity.js +14 -11
- package/lib/modules/Order/utils.d.ts +1 -1
- package/lib/modules/Order/utils.js +51 -7
- package/lib/modules/Payment/index.js +3 -4
- package/lib/modules/Payment/types.d.ts +21 -1
- package/lib/modules/Payment/types.js +1 -0
- package/lib/modules/Payment/walletpass.d.ts +1 -1
- package/lib/modules/Payment/walletpass.js +29 -9
- package/lib/modules/Rules/index.d.ts +2 -2
- package/lib/modules/Rules/index.js +357 -110
- package/lib/modules/Rules/types.d.ts +4 -0
- package/lib/modules/Schedule/index.d.ts +8 -0
- package/lib/modules/Schedule/index.js +68 -12
- package/lib/modules/index.d.ts +1 -0
- package/lib/modules/index.js +11 -0
- package/lib/plugins/request.d.ts +7 -0
- package/lib/server/modules/order/types.d.ts +2 -0
- package/lib/server/utils/small-ticket.d.ts +1 -85
- package/lib/server/utils/small-ticket.js +9 -2305
- package/lib/shared/payment/loadPaymentMethods.d.ts +9 -0
- package/lib/shared/payment/loadPaymentMethods.js +40 -0
- package/lib/shared/receipt/loadCustomerInvoiceLayout.d.ts +22 -0
- package/lib/shared/receipt/loadCustomerInvoiceLayout.js +86 -0
- package/lib/shared/receipt/small-ticket.d.ts +85 -0
- package/lib/shared/receipt/small-ticket.js +2342 -0
- package/lib/shared/sales/loadSalesOrderSnapshot.d.ts +9 -0
- package/lib/shared/sales/loadSalesOrderSnapshot.js +22 -0
- package/lib/solution/BaseSales/index.d.ts +25 -0
- package/lib/solution/BaseSales/index.js +102 -3
- package/lib/solution/BaseSales/pickupTiming.d.ts +43 -0
- package/lib/solution/BaseSales/pickupTiming.js +269 -0
- package/lib/solution/BaseSales/types.d.ts +2 -2
- package/lib/solution/BaseSales/utils/cartPromotion.js +12 -4
- package/lib/solution/BaseSales/utils/parseSalesResponse.js +3 -0
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.d.ts +4 -5
- package/lib/solution/BookingTicket/index.js +36 -33
- package/lib/solution/BookingTicket/types.d.ts +5 -1
- package/lib/solution/BookingTicket/utils/cartView.js +3 -1
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +2 -0
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +174 -42
- package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +8 -4
- package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +6 -0
- package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.js +11 -3
- package/lib/solution/OrderInvoicePreview/index.d.ts +56 -0
- package/lib/solution/OrderInvoicePreview/index.js +192 -0
- package/lib/solution/ShopDiscount/index.d.ts +2 -0
- package/lib/solution/ShopDiscount/index.js +55 -9
- package/lib/solution/ShopDiscount/utils.d.ts +4 -2
- package/lib/solution/ShopDiscount/utils.js +42 -25
- package/lib/solution/UnifiedBookingSales/index.d.ts +13 -4
- package/lib/solution/UnifiedBookingSales/index.js +132 -48
- package/lib/solution/index.d.ts +1 -0
- package/lib/solution/index.js +11 -0
- package/package.json +1 -1
|
@@ -55,7 +55,6 @@ var _platform = require("../../utils/platform");
|
|
|
55
55
|
var _itemRule = require("../../model/strategy/adapter/itemRule");
|
|
56
56
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
57
57
|
const OPEN_DATA_SECTION_CODES = ['sale', 'reservation', 'fulfillment', 'menu', 'workflow', 'documents', 'basic', 'checkout', 'availability'];
|
|
58
|
-
const OPEN_DATA_CACHE_TTL = 5 * 60 * 1000;
|
|
59
58
|
function normalizePositiveInteger(value) {
|
|
60
59
|
const normalized = Number(value);
|
|
61
60
|
if (!Number.isInteger(normalized) || normalized <= 0) return undefined;
|
|
@@ -159,7 +158,7 @@ function buildPlannerDiscountResult(params) {
|
|
|
159
158
|
const productDiscounts = [...(Array.isArray(product.discount_list) ? product.discount_list : []), ...(Array.isArray(product.product_bundle) ? product.product_bundle.flatMap(bundle => bundle?.discount_list || []) : [])];
|
|
160
159
|
productDiscounts.forEach(discount => {
|
|
161
160
|
const type = discount.tag || discount.type;
|
|
162
|
-
if (!['good_pass', 'discount_card', 'product_discount_card'].includes(type)) return;
|
|
161
|
+
if (!['entitlement_pass', 'good_pass', 'discount_card', 'product_discount_card'].includes(type)) return;
|
|
163
162
|
const discountId = resolvePlannerDiscountId(discount);
|
|
164
163
|
applications.push({
|
|
165
164
|
discountId,
|
|
@@ -201,7 +200,7 @@ function isLocalOrderId(orderId) {
|
|
|
201
200
|
}
|
|
202
201
|
function isCustomerBoundDiscount(discount) {
|
|
203
202
|
const type = discount?.type ?? discount?.tag;
|
|
204
|
-
return type === 'good_pass' || type === 'discount_card' || type === 'product_discount_card';
|
|
203
|
+
return type === 'entitlement_pass' || type === 'good_pass' || type === 'discount_card' || type === 'product_discount_card';
|
|
205
204
|
}
|
|
206
205
|
function filterCustomerBoundDiscounts(discountList) {
|
|
207
206
|
if (!Array.isArray(discountList)) return [];
|
|
@@ -1199,6 +1198,13 @@ class UnifiedBookingSalesImpl extends _BookingTicket.BookingTicket {
|
|
|
1199
1198
|
defaultName = 'unifiedBookingSales';
|
|
1200
1199
|
defaultVersion = '1.0.0';
|
|
1201
1200
|
store = {};
|
|
1201
|
+
pickupTimingEnabled = true;
|
|
1202
|
+
runtimeOpenDataScope = null;
|
|
1203
|
+
runtimeOpenDataSnapshot = null;
|
|
1204
|
+
runtimeOpenDataModule = null;
|
|
1205
|
+
runtimeOpenDataCore;
|
|
1206
|
+
runtimeOpenDataGeneration = 0;
|
|
1207
|
+
runtimeOpenDataDestroyed = false;
|
|
1202
1208
|
unifiedProductCatalog = [];
|
|
1203
1209
|
availabilityRuntimeOffsetMinutes = null;
|
|
1204
1210
|
availabilityScheduleCatalog = null;
|
|
@@ -1218,16 +1224,16 @@ class UnifiedBookingSalesImpl extends _BookingTicket.BookingTicket {
|
|
|
1218
1224
|
allergyItemRuleConfigs = [];
|
|
1219
1225
|
allergyItemRuleConfigsPromise = null;
|
|
1220
1226
|
async initialize(core, options = {}) {
|
|
1227
|
+
this.resetRuntimeOpenData();
|
|
1228
|
+
this.runtimeOpenDataDestroyed = false;
|
|
1229
|
+
const openDataGeneration = this.runtimeOpenDataGeneration;
|
|
1221
1230
|
this.availabilityScheduleCatalog = null;
|
|
1222
|
-
this.openDataTarget = null;
|
|
1223
1231
|
this.availabilityRuntimeOffsetMinutes = (0, _localClock.captureRuntimeOffsetMinutes)();
|
|
1224
1232
|
this.clearAvailabilityRemoteResourceState();
|
|
1225
1233
|
this.resetAllergyItemRuleState();
|
|
1226
1234
|
await super.initialize(core, options);
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
if (this.otherParams?.openData && openDataBusinessCode && openDataChannel) {
|
|
1230
|
-
this.openDataTarget = `${openDataBusinessCode}+${openDataChannel}`;
|
|
1235
|
+
if (this.runtimeOpenDataDestroyed || openDataGeneration !== this.runtimeOpenDataGeneration) {
|
|
1236
|
+
throw new Error('Store settings changed. Please try again.');
|
|
1231
1237
|
}
|
|
1232
1238
|
this.captureAvailabilityScheduleCatalog();
|
|
1233
1239
|
}
|
|
@@ -1305,7 +1311,7 @@ class UnifiedBookingSalesImpl extends _BookingTicket.BookingTicket {
|
|
|
1305
1311
|
const businessCode = String(this.otherParams?.businessCode ?? this.otherParams?.business_code ?? '').trim();
|
|
1306
1312
|
const channel = String(this.otherParams?.channel ?? '').trim();
|
|
1307
1313
|
const currentTarget = businessCode && channel ? `${businessCode}+${channel}` : null;
|
|
1308
|
-
let openData = !currentTarget || this.openDataTarget === currentTarget ? this.otherParams?.openData : null;
|
|
1314
|
+
let openData = (!currentTarget || this.openDataTarget === currentTarget) && (this.runtimeOpenDataScope === null || this.runtimeOpenDataScope === this.getRuntimeOpenDataScope()) ? this.otherParams?.openData : null;
|
|
1309
1315
|
if (!openData && this.store.openData) {
|
|
1310
1316
|
try {
|
|
1311
1317
|
openData = await this.getOpenData();
|
|
@@ -1369,6 +1375,13 @@ class UnifiedBookingSalesImpl extends _BookingTicket.BookingTicket {
|
|
|
1369
1375
|
const previousScope = this.getAvailabilityScopeDescriptor(this.otherParams || {});
|
|
1370
1376
|
const previousItemRuleConfig = this.otherParams?.itemRule;
|
|
1371
1377
|
const explicitlySetsOpenData = Object.prototype.hasOwnProperty.call(params, 'openData');
|
|
1378
|
+
const nextParams = cover ? params : {
|
|
1379
|
+
...this.otherParams,
|
|
1380
|
+
...params
|
|
1381
|
+
};
|
|
1382
|
+
if (explicitlySetsOpenData || this.getRuntimeOpenDataScope() !== this.getRuntimeOpenDataScope(nextParams)) {
|
|
1383
|
+
this.clearOpenDataCache();
|
|
1384
|
+
}
|
|
1372
1385
|
await super.setOtherParams(params, {
|
|
1373
1386
|
cover
|
|
1374
1387
|
});
|
|
@@ -1385,6 +1398,8 @@ class UnifiedBookingSalesImpl extends _BookingTicket.BookingTicket {
|
|
|
1385
1398
|
}
|
|
1386
1399
|
}
|
|
1387
1400
|
async destroy() {
|
|
1401
|
+
this.runtimeOpenDataDestroyed = true;
|
|
1402
|
+
this.clearOpenDataCache();
|
|
1388
1403
|
this.availabilityScheduleCatalog = null;
|
|
1389
1404
|
this.availabilityRuntimeOffsetMinutes = null;
|
|
1390
1405
|
await this.resetAvailabilityProjectionState('destroy');
|
|
@@ -1685,52 +1700,117 @@ class UnifiedBookingSalesImpl extends _BookingTicket.BookingTicket {
|
|
|
1685
1700
|
action: this.resolveDiscountAction(this.resolveDiscountOrderIdentity(tempOrder))
|
|
1686
1701
|
});
|
|
1687
1702
|
}
|
|
1703
|
+
getRuntimeOpenDataScope(otherParams = this.otherParams) {
|
|
1704
|
+
return JSON.stringify({
|
|
1705
|
+
shop: this.getPickupTimingContextData('shop_id'),
|
|
1706
|
+
appShop: this.appPlugin ? this.getAppData('shop_id') : undefined,
|
|
1707
|
+
tenant: this.appPlugin ? this.getAppData('tenant_id') : undefined,
|
|
1708
|
+
businessCode: String(otherParams?.businessCode ?? otherParams?.business_code ?? '').trim(),
|
|
1709
|
+
channel: String(otherParams?.channel || super.getSubmitOrderSalesChannel()).trim(),
|
|
1710
|
+
platform: (0, _platform.normalizeRuntimePlatform)(otherParams?.platform),
|
|
1711
|
+
timezone: this.getPickupTimingContextData('timezone'),
|
|
1712
|
+
businessTimezone: otherParams?.businessTimezone,
|
|
1713
|
+
cacheId: otherParams === this.otherParams ? this.cacheId : otherParams?.cacheId
|
|
1714
|
+
});
|
|
1715
|
+
}
|
|
1716
|
+
resetRuntimeOpenData() {
|
|
1717
|
+
this.runtimeOpenDataGeneration += 1;
|
|
1718
|
+
this.runtimeOpenDataScope = null;
|
|
1719
|
+
this.runtimeOpenDataSnapshot = null;
|
|
1720
|
+
this.runtimeOpenDataModule = null;
|
|
1721
|
+
this.runtimeOpenDataCore = undefined;
|
|
1722
|
+
this.openDataTarget = null;
|
|
1723
|
+
this.loadOpenDataInFlight = null;
|
|
1724
|
+
this.loadOpenDataInFlightTarget = null;
|
|
1725
|
+
this.otherParams = {
|
|
1726
|
+
...this.otherParams,
|
|
1727
|
+
openData: null
|
|
1728
|
+
};
|
|
1729
|
+
this.store.openData?.clearCache?.();
|
|
1730
|
+
}
|
|
1731
|
+
async prepareInvoiceTemplateAtSolutionReady(injectedOpenData) {
|
|
1732
|
+
const businessCode = this.getBookingTicketBusinessCode();
|
|
1733
|
+
if (!businessCode || !this.store.openData) return;
|
|
1734
|
+
if (injectedOpenData) {
|
|
1735
|
+
this.otherParams.openData = injectedOpenData;
|
|
1736
|
+
this.openDataTarget = `${businessCode}+${this.getSubmitOrderSalesChannel()}`;
|
|
1737
|
+
}
|
|
1738
|
+
try {
|
|
1739
|
+
await this.loadOpenDataConfig();
|
|
1740
|
+
} catch (error) {
|
|
1741
|
+
console.warn('[UnifiedBookingSales] Invoice 模板预加载失败,使用默认配置', error);
|
|
1742
|
+
}
|
|
1743
|
+
}
|
|
1744
|
+
async loadOpenDataConfig() {
|
|
1745
|
+
const businessCode = this.getBookingTicketBusinessCode();
|
|
1746
|
+
if (!businessCode) return null;
|
|
1747
|
+
return this.loadOpenData({
|
|
1748
|
+
businessCode,
|
|
1749
|
+
channel: this.getSubmitOrderSalesChannel()
|
|
1750
|
+
});
|
|
1751
|
+
}
|
|
1688
1752
|
|
|
1689
|
-
/**
|
|
1690
|
-
* Loads OpenData without borrowing BookingTicket. Cache ownership is tied to the exact
|
|
1691
|
-
* business/channel target so a reused solution instance cannot leak another entry's menus.
|
|
1692
|
-
*/
|
|
1753
|
+
/** A successful configuration belongs to this business runtime until an explicit refresh. */
|
|
1693
1754
|
async loadOpenData(params) {
|
|
1694
|
-
|
|
1755
|
+
const module = this.store.openData;
|
|
1756
|
+
if (!module) {
|
|
1695
1757
|
throw new Error('[UnifiedBookingSales] openData 模块未初始化');
|
|
1696
1758
|
}
|
|
1759
|
+
if (this.runtimeOpenDataDestroyed) {
|
|
1760
|
+
throw new Error('Store settings changed. Please try again.');
|
|
1761
|
+
}
|
|
1697
1762
|
const businessCode = String(params.businessCode || '').trim();
|
|
1698
1763
|
const channel = String(params.channel || '').trim();
|
|
1699
1764
|
if (!businessCode || !channel) {
|
|
1700
1765
|
throw new Error('[UnifiedBookingSales] OpenData 需要 businessCode 与 channel');
|
|
1701
1766
|
}
|
|
1702
1767
|
const target = `${businessCode}+${channel}`;
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1768
|
+
this.otherParams.businessCode = businessCode;
|
|
1769
|
+
this.otherParams.channel = channel;
|
|
1770
|
+
const scope = this.getRuntimeOpenDataScope();
|
|
1771
|
+
if (params.force) {
|
|
1772
|
+
this.clearOpenDataCache();
|
|
1773
|
+
}
|
|
1774
|
+
if (this.runtimeOpenDataScope !== scope || this.runtimeOpenDataModule !== module || this.runtimeOpenDataCore !== this.core) {
|
|
1775
|
+
// Only the first, explicitly injected target may seed a new runtime snapshot.
|
|
1776
|
+
const injectedOpenData = this.runtimeOpenDataScope === null && (!this.openDataTarget || this.openDataTarget === target) && isRecord(this.otherParams.openData) ? this.otherParams.openData : null;
|
|
1777
|
+
if (this.runtimeOpenDataScope !== null) {
|
|
1778
|
+
// The caller's Pickup Timing scope already changes with this runtime scope.
|
|
1779
|
+
this.resetRuntimeOpenData();
|
|
1708
1780
|
}
|
|
1709
|
-
|
|
1781
|
+
this.runtimeOpenDataScope = scope;
|
|
1782
|
+
this.runtimeOpenDataModule = module;
|
|
1783
|
+
this.runtimeOpenDataCore = this.core;
|
|
1784
|
+
this.runtimeOpenDataSnapshot = injectedOpenData;
|
|
1710
1785
|
}
|
|
1711
1786
|
if (this.loadOpenDataInFlight) {
|
|
1712
|
-
|
|
1713
|
-
|
|
1787
|
+
return this.loadOpenDataInFlight;
|
|
1788
|
+
}
|
|
1789
|
+
const generation = this.runtimeOpenDataGeneration;
|
|
1790
|
+
const core = this.core;
|
|
1791
|
+
const request = (async () => {
|
|
1792
|
+
let openData = this.runtimeOpenDataSnapshot;
|
|
1793
|
+
if (openData) {
|
|
1794
|
+
await module.ensureInvoiceTemplateSettings?.(target, openData);
|
|
1795
|
+
} else {
|
|
1796
|
+
openData = await module.fetchOpenData({
|
|
1797
|
+
scope: 'board',
|
|
1798
|
+
target,
|
|
1799
|
+
section_code: [...OPEN_DATA_SECTION_CODES]
|
|
1800
|
+
});
|
|
1714
1801
|
}
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1802
|
+
if (this.runtimeOpenDataDestroyed || generation !== this.runtimeOpenDataGeneration || scope !== this.getRuntimeOpenDataScope() || module !== this.store.openData || core !== this.core) {
|
|
1803
|
+
throw new Error('Store settings changed. Please try again.');
|
|
1804
|
+
}
|
|
1805
|
+
this.runtimeOpenDataSnapshot = openData;
|
|
1806
|
+
this.openDataTarget = target;
|
|
1807
|
+
this.otherParams.openData = openData;
|
|
1808
|
+
return openData;
|
|
1809
|
+
})();
|
|
1718
1810
|
this.loadOpenDataInFlightTarget = target;
|
|
1719
|
-
const request = this.store.openData.fetchOpenData({
|
|
1720
|
-
scope: 'board',
|
|
1721
|
-
target,
|
|
1722
|
-
section_code: [...OPEN_DATA_SECTION_CODES]
|
|
1723
|
-
});
|
|
1724
1811
|
this.loadOpenDataInFlight = request;
|
|
1725
1812
|
try {
|
|
1726
|
-
|
|
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
|
-
}
|
|
1733
|
-
return openData;
|
|
1813
|
+
return await request;
|
|
1734
1814
|
} finally {
|
|
1735
1815
|
if (this.loadOpenDataInFlight === request) {
|
|
1736
1816
|
this.loadOpenDataInFlight = null;
|
|
@@ -1739,13 +1819,19 @@ class UnifiedBookingSalesImpl extends _BookingTicket.BookingTicket {
|
|
|
1739
1819
|
}
|
|
1740
1820
|
}
|
|
1741
1821
|
async getOpenData() {
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1822
|
+
return this.loadOpenDataConfig();
|
|
1823
|
+
}
|
|
1824
|
+
async loadPickupTimingOpenData(_force) {
|
|
1825
|
+
const scope = this.getPickupTimingScope();
|
|
1826
|
+
const businessCode = String(this.otherParams?.businessCode ?? this.otherParams?.business_code ?? '').trim();
|
|
1827
|
+
const config = await this.loadOpenData({
|
|
1746
1828
|
businessCode,
|
|
1747
|
-
channel
|
|
1829
|
+
channel: this.getSubmitOrderSalesChannel()
|
|
1748
1830
|
});
|
|
1831
|
+
if (scope !== this.getPickupTimingScope()) {
|
|
1832
|
+
throw new Error('Store settings changed. Please try again.');
|
|
1833
|
+
}
|
|
1834
|
+
return config;
|
|
1749
1835
|
}
|
|
1750
1836
|
resetAllergyItemRuleState() {
|
|
1751
1837
|
this.allergyItemRuleConfigs = [];
|
|
@@ -1840,10 +1926,8 @@ class UnifiedBookingSalesImpl extends _BookingTicket.BookingTicket {
|
|
|
1840
1926
|
});
|
|
1841
1927
|
}
|
|
1842
1928
|
clearOpenDataCache() {
|
|
1843
|
-
this.
|
|
1844
|
-
this.
|
|
1845
|
-
this.loadOpenDataInFlightTarget = null;
|
|
1846
|
-
super.clearOpenDataCache();
|
|
1929
|
+
this.resetRuntimeOpenData();
|
|
1930
|
+
this.resetPickupTimingCache();
|
|
1847
1931
|
}
|
|
1848
1932
|
async getInvoiceLayoutConfig() {
|
|
1849
1933
|
const openData = await this.getOpenData();
|
|
@@ -1863,7 +1947,7 @@ class UnifiedBookingSalesImpl extends _BookingTicket.BookingTicket {
|
|
|
1863
1947
|
const businessCode = String(this.otherParams?.businessCode || '').trim();
|
|
1864
1948
|
const channel = String(this.otherParams?.channel || '').trim();
|
|
1865
1949
|
if (!businessCode || !channel) return false;
|
|
1866
|
-
return this.openDataTarget === `${businessCode}+${channel}
|
|
1950
|
+
return this.openDataTarget === `${businessCode}+${channel}` && this.runtimeOpenDataScope === this.getRuntimeOpenDataScope();
|
|
1867
1951
|
}
|
|
1868
1952
|
|
|
1869
1953
|
/**
|
package/lib/solution/index.d.ts
CHANGED
package/lib/solution/index.js
CHANGED
|
@@ -123,4 +123,15 @@ Object.keys(_UnifiedBookingSales).forEach(function (key) {
|
|
|
123
123
|
return _UnifiedBookingSales[key];
|
|
124
124
|
}
|
|
125
125
|
});
|
|
126
|
+
});
|
|
127
|
+
var _OrderInvoicePreview = require("./OrderInvoicePreview");
|
|
128
|
+
Object.keys(_OrderInvoicePreview).forEach(function (key) {
|
|
129
|
+
if (key === "default" || key === "__esModule") return;
|
|
130
|
+
if (key in exports && exports[key] === _OrderInvoicePreview[key]) return;
|
|
131
|
+
Object.defineProperty(exports, key, {
|
|
132
|
+
enumerable: true,
|
|
133
|
+
get: function () {
|
|
134
|
+
return _OrderInvoicePreview[key];
|
|
135
|
+
}
|
|
136
|
+
});
|
|
126
137
|
});
|