@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.
Files changed (160) hide show
  1. package/dist/index.d.ts +2 -0
  2. package/dist/index.js +3 -1
  3. package/dist/model/strategy/adapter/promotion/index.js +0 -9
  4. package/dist/model/strategy/adapter/walletPass/evaluator.d.ts +2 -0
  5. package/dist/model/strategy/adapter/walletPass/evaluator.js +4 -2
  6. package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +58 -19
  7. package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +24 -12
  8. package/dist/modules/Customer/index.js +6 -3
  9. package/dist/modules/Customer/types.d.ts +2 -0
  10. package/dist/modules/Discount/availability.d.ts +7 -0
  11. package/dist/modules/Discount/availability.js +49 -0
  12. package/dist/modules/Discount/entitlementPass.d.ts +34 -0
  13. package/dist/modules/Discount/entitlementPass.js +147 -0
  14. package/dist/modules/Discount/index.d.ts +2 -2
  15. package/dist/modules/Discount/index.js +37 -151
  16. package/dist/modules/Discount/types.d.ts +36 -5
  17. package/dist/modules/FulfillmentTiming/index.d.ts +11 -0
  18. package/dist/modules/FulfillmentTiming/index.js +407 -0
  19. package/dist/modules/FulfillmentTiming/types.d.ts +67 -0
  20. package/dist/modules/FulfillmentTiming/types.js +1 -0
  21. package/dist/modules/OpenData/types.d.ts +6 -0
  22. package/dist/modules/Order/index.d.ts +12 -0
  23. package/dist/modules/Order/index.js +498 -247
  24. package/dist/modules/Order/pickupTiming.d.ts +46 -0
  25. package/dist/modules/Order/pickupTiming.js +53 -0
  26. package/dist/modules/Order/types.d.ts +5 -1
  27. package/dist/modules/Order/utils/orderCollectionIdentity.js +16 -12
  28. package/dist/modules/Order/utils.d.ts +1 -1
  29. package/dist/modules/Order/utils.js +117 -66
  30. package/dist/modules/Payment/index.js +9 -10
  31. package/dist/modules/Payment/types.d.ts +21 -1
  32. package/dist/modules/Payment/types.js +2 -0
  33. package/dist/modules/Payment/walletpass.d.ts +1 -1
  34. package/dist/modules/Payment/walletpass.js +80 -47
  35. package/dist/modules/Rules/index.d.ts +2 -2
  36. package/dist/modules/Rules/index.js +480 -186
  37. package/dist/modules/Rules/types.d.ts +4 -0
  38. package/dist/modules/Schedule/index.d.ts +8 -0
  39. package/dist/modules/Schedule/index.js +141 -39
  40. package/dist/modules/index.d.ts +1 -0
  41. package/dist/modules/index.js +1 -0
  42. package/dist/plugins/request.d.ts +7 -0
  43. package/dist/server/modules/order/types.d.ts +2 -0
  44. package/dist/server/utils/small-ticket.d.ts +1 -85
  45. package/dist/server/utils/small-ticket.js +2 -2542
  46. package/dist/shared/payment/loadPaymentMethods.d.ts +9 -0
  47. package/dist/shared/payment/loadPaymentMethods.js +66 -0
  48. package/dist/shared/receipt/loadCustomerInvoiceLayout.d.ts +22 -0
  49. package/dist/shared/receipt/loadCustomerInvoiceLayout.js +142 -0
  50. package/dist/shared/receipt/small-ticket.d.ts +85 -0
  51. package/dist/shared/receipt/small-ticket.js +2576 -0
  52. package/dist/shared/sales/loadSalesOrderSnapshot.d.ts +9 -0
  53. package/dist/shared/sales/loadSalesOrderSnapshot.js +21 -0
  54. package/dist/solution/BaseSales/index.d.ts +25 -0
  55. package/dist/solution/BaseSales/index.js +1226 -1040
  56. package/dist/solution/BaseSales/pickupTiming.d.ts +43 -0
  57. package/dist/solution/BaseSales/pickupTiming.js +589 -0
  58. package/dist/solution/BaseSales/types.d.ts +2 -2
  59. package/dist/solution/BaseSales/utils/cartPromotion.js +141 -126
  60. package/dist/solution/BaseSales/utils/parseSalesResponse.js +3 -0
  61. package/dist/solution/BookingByStep/index.d.ts +1 -1
  62. package/dist/solution/BookingTicket/index.d.ts +4 -5
  63. package/dist/solution/BookingTicket/index.js +60 -63
  64. package/dist/solution/BookingTicket/types.d.ts +5 -1
  65. package/dist/solution/BookingTicket/utils/cartView.js +3 -1
  66. package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +2 -0
  67. package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +338 -147
  68. package/dist/solution/BookingTicket/utils/scan/cloudSearch.js +8 -4
  69. package/dist/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +6 -0
  70. package/dist/solution/BookingTicket/utils/scan/formatGlobalScan.js +19 -6
  71. package/dist/solution/OrderInvoicePreview/index.d.ts +56 -0
  72. package/dist/solution/OrderInvoicePreview/index.js +269 -0
  73. package/dist/solution/ShopDiscount/index.d.ts +2 -0
  74. package/dist/solution/ShopDiscount/index.js +99 -42
  75. package/dist/solution/ShopDiscount/utils.d.ts +4 -2
  76. package/dist/solution/ShopDiscount/utils.js +43 -23
  77. package/dist/solution/UnifiedBookingSales/index.d.ts +13 -4
  78. package/dist/solution/UnifiedBookingSales/index.js +874 -709
  79. package/dist/solution/index.d.ts +1 -0
  80. package/dist/solution/index.js +2 -1
  81. package/lib/index.d.ts +2 -0
  82. package/lib/index.js +21 -1
  83. package/lib/model/strategy/adapter/walletPass/evaluator.d.ts +2 -0
  84. package/lib/model/strategy/adapter/walletPass/evaluator.js +2 -0
  85. package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +35 -6
  86. package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +13 -6
  87. package/lib/modules/Customer/index.js +5 -1
  88. package/lib/modules/Customer/types.d.ts +2 -0
  89. package/lib/modules/Discount/availability.d.ts +7 -0
  90. package/lib/modules/Discount/availability.js +43 -0
  91. package/lib/modules/Discount/entitlementPass.d.ts +34 -0
  92. package/lib/modules/Discount/entitlementPass.js +141 -0
  93. package/lib/modules/Discount/index.d.ts +2 -2
  94. package/lib/modules/Discount/index.js +23 -129
  95. package/lib/modules/Discount/types.d.ts +36 -5
  96. package/lib/modules/FulfillmentTiming/index.d.ts +11 -0
  97. package/lib/modules/FulfillmentTiming/index.js +359 -0
  98. package/lib/modules/FulfillmentTiming/types.d.ts +67 -0
  99. package/lib/modules/FulfillmentTiming/types.js +5 -0
  100. package/lib/modules/OpenData/types.d.ts +6 -0
  101. package/lib/modules/Order/index.d.ts +12 -0
  102. package/lib/modules/Order/index.js +252 -48
  103. package/lib/modules/Order/pickupTiming.d.ts +46 -0
  104. package/lib/modules/Order/pickupTiming.js +61 -0
  105. package/lib/modules/Order/types.d.ts +5 -1
  106. package/lib/modules/Order/utils/orderCollectionIdentity.js +14 -11
  107. package/lib/modules/Order/utils.d.ts +1 -1
  108. package/lib/modules/Order/utils.js +51 -7
  109. package/lib/modules/Payment/index.js +3 -4
  110. package/lib/modules/Payment/types.d.ts +21 -1
  111. package/lib/modules/Payment/types.js +1 -0
  112. package/lib/modules/Payment/walletpass.d.ts +1 -1
  113. package/lib/modules/Payment/walletpass.js +29 -9
  114. package/lib/modules/Rules/index.d.ts +2 -2
  115. package/lib/modules/Rules/index.js +357 -110
  116. package/lib/modules/Rules/types.d.ts +4 -0
  117. package/lib/modules/Schedule/index.d.ts +8 -0
  118. package/lib/modules/Schedule/index.js +68 -12
  119. package/lib/modules/index.d.ts +1 -0
  120. package/lib/modules/index.js +11 -0
  121. package/lib/plugins/request.d.ts +7 -0
  122. package/lib/server/modules/order/types.d.ts +2 -0
  123. package/lib/server/utils/small-ticket.d.ts +1 -85
  124. package/lib/server/utils/small-ticket.js +9 -2305
  125. package/lib/shared/payment/loadPaymentMethods.d.ts +9 -0
  126. package/lib/shared/payment/loadPaymentMethods.js +40 -0
  127. package/lib/shared/receipt/loadCustomerInvoiceLayout.d.ts +22 -0
  128. package/lib/shared/receipt/loadCustomerInvoiceLayout.js +86 -0
  129. package/lib/shared/receipt/small-ticket.d.ts +85 -0
  130. package/lib/shared/receipt/small-ticket.js +2342 -0
  131. package/lib/shared/sales/loadSalesOrderSnapshot.d.ts +9 -0
  132. package/lib/shared/sales/loadSalesOrderSnapshot.js +22 -0
  133. package/lib/solution/BaseSales/index.d.ts +25 -0
  134. package/lib/solution/BaseSales/index.js +102 -3
  135. package/lib/solution/BaseSales/pickupTiming.d.ts +43 -0
  136. package/lib/solution/BaseSales/pickupTiming.js +269 -0
  137. package/lib/solution/BaseSales/types.d.ts +2 -2
  138. package/lib/solution/BaseSales/utils/cartPromotion.js +12 -4
  139. package/lib/solution/BaseSales/utils/parseSalesResponse.js +3 -0
  140. package/lib/solution/BookingByStep/index.d.ts +1 -1
  141. package/lib/solution/BookingTicket/index.d.ts +4 -5
  142. package/lib/solution/BookingTicket/index.js +36 -33
  143. package/lib/solution/BookingTicket/types.d.ts +5 -1
  144. package/lib/solution/BookingTicket/utils/cartView.js +3 -1
  145. package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +2 -0
  146. package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +174 -42
  147. package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +8 -4
  148. package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +6 -0
  149. package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.js +11 -3
  150. package/lib/solution/OrderInvoicePreview/index.d.ts +56 -0
  151. package/lib/solution/OrderInvoicePreview/index.js +192 -0
  152. package/lib/solution/ShopDiscount/index.d.ts +2 -0
  153. package/lib/solution/ShopDiscount/index.js +55 -9
  154. package/lib/solution/ShopDiscount/utils.d.ts +4 -2
  155. package/lib/solution/ShopDiscount/utils.js +42 -25
  156. package/lib/solution/UnifiedBookingSales/index.d.ts +13 -4
  157. package/lib/solution/UnifiedBookingSales/index.js +132 -48
  158. package/lib/solution/index.d.ts +1 -0
  159. package/lib/solution/index.js +11 -0
  160. 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
- const openDataBusinessCode = String(this.otherParams?.businessCode ?? this.otherParams?.business_code ?? '').trim();
1228
- const openDataChannel = String(this.otherParams?.channel ?? '').trim();
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
- if (!this.store.openData) {
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
- const cachedData = this.store.openData.getOpenData();
1704
- const lastFetchedAt = this.store.openData.getLastFetchedAt();
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);
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
- return cachedData;
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
- if (this.loadOpenDataInFlightTarget === target) {
1713
- return await this.loadOpenDataInFlight;
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
- await this.loadOpenDataInFlight;
1716
- return this.loadOpenData(params);
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
- 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
- }
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
- const businessCode = String(this.otherParams?.businessCode || '').trim();
1743
- const channel = String(this.otherParams?.channel || '').trim();
1744
- if (!businessCode || !channel) return null;
1745
- return this.loadOpenData({
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.openDataTarget = null;
1844
- this.loadOpenDataInFlight = null;
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
  /**
@@ -9,3 +9,4 @@ export * from './ScanOrder';
9
9
  export * from './BaseSales';
10
10
  export * from './VenueBooking';
11
11
  export * from './UnifiedBookingSales';
12
+ export * from './OrderInvoicePreview';
@@ -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
  });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "2.3.128",
4
+ "version": "2.3.130",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",