@pisell/pisellos 2.3.215 → 2.3.216

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.
@@ -308,6 +308,9 @@ class ProductList extends _BaseModule.BaseModule {
308
308
  } : {}),
309
309
  front_end_cache_id: params.cacheId
310
310
  }, {
311
+ // Core dispatches Kiosk to its local product query; PC/H5 without that
312
+ // route keep using HTTP. open_quotation: 0 preserves the raw venue pool.
313
+ osServer: true,
311
314
  useCache: false,
312
315
  customToast: () => {}
313
316
  });
@@ -317,7 +320,7 @@ class ProductList extends _BaseModule.BaseModule {
317
320
  code: 'VENUE_CATALOG_LOAD_FAILED'
318
321
  });
319
322
  }
320
- const total = data.total ?? data.total_count ?? data.total_num;
323
+ const total = data.total ?? data.total_count ?? data.total_num ?? data.count;
321
324
  if (total != null && Number.isFinite(Number(total)) && Number(total) > data.list.length || total == null && data.list.length >= 500) {
322
325
  throw Object.assign(new Error('The venue product pool is incomplete. A single complete catalog response is required.'), {
323
326
  code: 'VENUE_CATALOG_INCOMPLETE'
@@ -289,6 +289,7 @@ declare class Server {
289
289
  * 存储订阅者信息,便于数据变更时推送最新结果
290
290
  */
291
291
  private handleProductQuery;
292
+ private queryRawKioskProductPool;
292
293
  /**
293
294
  * ProductList callers such as standalone retail pages do not always have a selected schedule.
294
295
  * In that case query against the current local time so menu availability can still be evaluated.
@@ -1727,6 +1727,11 @@ class Server {
1727
1727
  data,
1728
1728
  config
1729
1729
  }) => {
1730
+ // Venue previews seed one complete raw Kiosk pool. Quoting or applying the
1731
+ // current schedule here would remove members needed by other preview dates.
1732
+ if (data?.open_quotation === 0 && data?.application_code === 'kiosk') {
1733
+ return this.queryRawKioskProductPool(data);
1734
+ }
1730
1735
  const {
1731
1736
  menu_list_ids,
1732
1737
  customer_id,
@@ -1795,6 +1800,40 @@ class Server {
1795
1800
  }
1796
1801
  return result;
1797
1802
  };
1803
+ async queryRawKioskProductPool(data) {
1804
+ const preload = this.startupModulePreloadInFlight;
1805
+ if (preload) await preload;
1806
+ if (!this.products?.getProducts) {
1807
+ throw new Error('The local product catalog is not ready.');
1808
+ }
1809
+ const products = await this.products.getProducts();
1810
+ if (!Array.isArray(products)) {
1811
+ throw new Error('The local product catalog is unavailable.');
1812
+ }
1813
+ const filterSet = value => Array.isArray(value) && value.length ? new Set(value.filter(item => typeof item === 'string' || typeof item === 'number').map(item => String(item).trim()).filter(Boolean)) : undefined;
1814
+ const ids = filterSet(data.ids);
1815
+ const collections = filterSet(typeof data.collection === 'number' ? [data.collection] : data.collection);
1816
+ const categories = filterSet(data.category_ids);
1817
+ const extensionTypes = filterSet(data.extension_type);
1818
+ const list = products.filter(product => {
1819
+ if ((product.status || 'published') !== 'published' || 'deleted_at' in product && product.deleted_at) return false;
1820
+ if (!Array.isArray(product.channel_application) || !product.channel_application.includes('kiosk')) return false;
1821
+ if (ids && !ids.has(String(product.id))) return false;
1822
+ if (collections && !product.collection?.some(collection => collections.has(String(collection.id)))) return false;
1823
+ if (categories && !product.categories?.some(category => categories.has(String(category.id)) || categories.has(String(category.pivot?.product_category_id)))) return false;
1824
+ return !extensionTypes || extensionTypes.has(String(product.extension_type));
1825
+ });
1826
+ return {
1827
+ code: 200,
1828
+ status: true,
1829
+ message: '',
1830
+ data: {
1831
+ list,
1832
+ count: list.length,
1833
+ schedule_time_points: []
1834
+ }
1835
+ };
1836
+ }
1798
1837
 
1799
1838
  /**
1800
1839
  * ProductList callers such as standalone retail pages do not always have a selected schedule.
@@ -342,7 +342,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
342
342
  date: string;
343
343
  status: string;
344
344
  week: string;
345
- weekNum: 0 | 2 | 1 | 6 | 4 | 5 | 3;
345
+ weekNum: 0 | 2 | 1 | 3 | 4 | 5 | 6;
346
346
  }[]>;
347
347
  submitTimeSlot(timeSlots: TimeSliceItem): void;
348
348
  private getScheduleDataByIds;
@@ -110,6 +110,9 @@ export declare class UnifiedBookingSalesImpl extends BookingTicket {
110
110
  protected getSubModuleHooks(moduleName: string): any;
111
111
  private createAvailabilityFacadeError;
112
112
  private getAvailabilityScopeDescriptor;
113
+ /** Kiosk keeps its device/channel semantics; only explicit Venue templates opt in. */
114
+ private isVenueKioskPlatform;
115
+ private supportsVenueSelectionSnapshot;
113
116
  private usesDurationTimeGrid;
114
117
  private getCurrentAvailabilityBusinessDate;
115
118
  private getAvailabilityBusinessDateRange;
@@ -1402,9 +1402,20 @@ class UnifiedBookingSalesImpl extends _BookingTicket.BookingTicket {
1402
1402
  businessCode: String(otherParams.businessCode ?? otherParams.business_code ?? ''),
1403
1403
  channel: String(otherParams.channel ?? ''),
1404
1404
  platform: String(otherParams.platform ?? ''),
1405
- businessTimezone: String(otherParams.businessTimezone ?? '')
1405
+ businessTimezone: String(otherParams.businessTimezone ?? ''),
1406
+ ...(this.isVenueKioskPlatform(otherParams) ? {
1407
+ venueBookingMode: otherParams.venueBookingMode
1408
+ } : {})
1406
1409
  };
1407
1410
  }
1411
+
1412
+ /** Kiosk keeps its device/channel semantics; only explicit Venue templates opt in. */
1413
+ isVenueKioskPlatform(otherParams = this.otherParams || {}) {
1414
+ return (0, _platform.normalizeRuntimePlatform)(otherParams.platform) === 'kiosk' && (otherParams.venueBookingMode === 'tickets' || otherParams.venueBookingMode === 'party');
1415
+ }
1416
+ supportsVenueSelectionSnapshot() {
1417
+ return (0, _platform.isCustomerUserPlatform)(this.otherParams?.platform) || this.isVenueKioskPlatform();
1418
+ }
1408
1419
  usesDurationTimeGrid(projection) {
1409
1420
  const platform = String(this.otherParams?.platform ?? '').trim().toLowerCase();
1410
1421
  return (platform === 'pos' || platform === 'kiosk') && (!projection || projection.products.some(product => product.kind === 'duration'));
@@ -1741,7 +1752,7 @@ class UnifiedBookingSalesImpl extends _BookingTicket.BookingTicket {
1741
1752
  if (explicitlySetsOpenData) {
1742
1753
  this.openDataTarget = this.otherParams?.openData && nextScope.businessCode && nextScope.channel ? `${nextScope.businessCode}+${nextScope.channel}` : null;
1743
1754
  }
1744
- const shouldResetAvailabilityState = previousScope.cacheId !== nextScope.cacheId || previousScope.businessCode !== nextScope.businessCode || previousScope.channel !== nextScope.channel || previousScope.platform !== nextScope.platform || previousScope.businessTimezone !== nextScope.businessTimezone;
1755
+ const shouldResetAvailabilityState = previousScope.cacheId !== nextScope.cacheId || previousScope.businessCode !== nextScope.businessCode || previousScope.channel !== nextScope.channel || previousScope.platform !== nextScope.platform || previousScope.businessTimezone !== nextScope.businessTimezone || previousScope.venueBookingMode !== nextScope.venueBookingMode;
1745
1756
  if (shouldResetAvailabilityState) {
1746
1757
  await this.resetAvailabilityProjectionState('set_other_params_reset');
1747
1758
  }
@@ -2766,7 +2777,7 @@ class UnifiedBookingSalesImpl extends _BookingTicket.BookingTicket {
2766
2777
 
2767
2778
  /** One complete raw product query per explicitly configured pool for this page lifetime. */
2768
2779
  createVenueCatalogSession(params) {
2769
- if (!(0, _platform.isCustomerUserPlatform)(this.otherParams?.platform)) {
2780
+ if (!this.supportsVenueSelectionSnapshot()) {
2770
2781
  throw (0, _venueCatalogSession.venueCatalogError)('VENUE_CATALOG_PLATFORM_UNSUPPORTED', 'Venue catalog sessions require a customer platform.');
2771
2782
  }
2772
2783
  const ids = params.menu_list_ids;
@@ -2778,6 +2789,7 @@ class UnifiedBookingSalesImpl extends _BookingTicket.BookingTicket {
2778
2789
  const generation = this.runtimeInitializationGeneration;
2779
2790
  const core = this.core;
2780
2791
  const request = this.request;
2792
+ const venueKioskMode = this.isVenueKioskPlatform() ? this.otherParams.venueBookingMode : undefined;
2781
2793
  const entry = {
2782
2794
  scope,
2783
2795
  generation,
@@ -2798,7 +2810,7 @@ class UnifiedBookingSalesImpl extends _BookingTicket.BookingTicket {
2798
2810
  if (!this.venueCatalogSessions.has(entry)) {
2799
2811
  throw (0, _venueCatalogSession.venueCatalogError)('VENUE_CATALOG_DISPOSED', 'The venue catalog session is closed.');
2800
2812
  }
2801
- if (this.runtimeOpenDataDestroyed || this.core !== core || this.request !== request || generation !== this.runtimeInitializationGeneration || scope !== this.getRuntimeOpenDataScope()) {
2813
+ if (this.runtimeOpenDataDestroyed || this.core !== core || this.request !== request || generation !== this.runtimeInitializationGeneration || scope !== this.getRuntimeOpenDataScope() || !this.supportsVenueSelectionSnapshot() || venueKioskMode !== (this.isVenueKioskPlatform() ? this.otherParams.venueBookingMode : undefined)) {
2802
2814
  throw (0, _venueCatalogSession.venueCatalogError)('VENUE_CATALOG_STALE', 'The venue store context changed. Reopen the booking page.');
2803
2815
  }
2804
2816
  };
@@ -2835,7 +2847,7 @@ class UnifiedBookingSalesImpl extends _BookingTicket.BookingTicket {
2835
2847
  const queryPayload = {
2836
2848
  schedule_date: datetime.slice(0, 10),
2837
2849
  schedule_datetime: datetime,
2838
- customer_id: input.customer_id ?? this.getTempOrder()?.customer_id ?? user?.get?.()?.id,
2850
+ customer_id: input.customer_id ?? this.getTempOrder()?.customer_id ?? (this.isVenueKioskPlatform() ? undefined : user?.get?.()?.id),
2839
2851
  strategy_context: {
2840
2852
  ...this.getPriceQueryStrategyContext(),
2841
2853
  ...(input.strategy_context || {})
@@ -4612,7 +4624,7 @@ class UnifiedBookingSalesImpl extends _BookingTicket.BookingTicket {
4612
4624
 
4613
4625
  /** Thin facade: auto-refresh on cart drift, then delegate to the pure projection query. */
4614
4626
  async queryBookingAvailability(contextId, request) {
4615
- const customerSelectionSnapshot = request.target === 'resource' && request.customerSelectionSnapshot === true && (0, _platform.isCustomerUserPlatform)(this.otherParams?.platform);
4627
+ const customerSelectionSnapshot = request.target === 'resource' && request.customerSelectionSnapshot === true && this.supportsVenueSelectionSnapshot();
4616
4628
  const {
4617
4629
  context,
4618
4630
  projectionEntry,
@@ -4776,7 +4788,7 @@ class UnifiedBookingSalesImpl extends _BookingTicket.BookingTicket {
4776
4788
  if (isRememberedSelection && (String(this.otherParams?.platform ?? '').trim().toLowerCase() !== 'pos' || params.mode !== 'add')) {
4777
4789
  throw new _ResourcePlanner.AvailabilityError('INVALID_TARGET_FILTER', '记忆时间自动提交仅支持 POS 新增 duration 商品');
4778
4790
  }
4779
- const customerSelectionSnapshot = params.customerSelectionSnapshot === true && (0, _platform.isCustomerUserPlatform)(this.otherParams?.platform);
4791
+ const customerSelectionSnapshot = params.customerSelectionSnapshot === true && this.supportsVenueSelectionSnapshot();
4780
4792
  const strictAvailability = this.availabilityContextRegistry.get(normalizedContextId)?.prepareParams.strictAvailability === true;
4781
4793
  const hasCommitGuard = customerSelectionSnapshot || strictAvailability || isRememberedSelection || isPartyReplacement || Boolean(params.availabilityCommitGuard);
4782
4794
  params.availabilityCommitGuard?.();
@@ -59,6 +59,8 @@ export declare enum UnifiedBookingSalesHooks {
59
59
  }
60
60
  export interface UnifiedBookingSalesOtherParams extends Record<string, any> {
61
61
  enableSessionStoragePersist?: boolean;
62
+ /** Explicitly opts the real Kiosk host into the Tickets/Party self-service contracts. */
63
+ venueBookingMode?: 'tickets' | 'party';
62
64
  }
63
65
  export type UnifiedBookingSalesAllergyRequirement = AllergyRequirement;
64
66
  export interface UnifiedBookingSalesResolveProductAllergyRequirementParams {
@@ -151,7 +153,7 @@ export type ContextualAvailabilityQuery = (Omit<Extract<AvailabilityQuery, {
151
153
  target: 'resource';
152
154
  }>, 'selectedRanges'> & {
153
155
  selectedRanges: ContextualProductTimeRange[];
154
- /** PC/H5 only: retain the already-selected time while choosing resources in this snapshot. */
156
+ /** PC/H5 and explicitly enabled Venue Kiosk templates retain the already-selected time. */
155
157
  customerSelectionSnapshot?: boolean;
156
158
  })) & {
157
159
  /** Automatic remembered selection must not inherit POS manual exceptions. */
@@ -223,7 +225,7 @@ export interface UnifiedBookingSalesAddRetailProductParams {
223
225
  }
224
226
  export interface ContextualCommitAvailabilitySelectionParams {
225
227
  mode: 'add' | 'edit' | 'replace';
226
- /** PC/H5 only: write the completed UI selection without re-querying availability; checkout is authoritative. */
228
+ /** PC/H5 and enabled Venue Kiosk templates write the selected snapshot; checkout is authoritative. */
227
229
  customerSelectionSnapshot?: boolean;
228
230
  /** Only POS duration add supports automatic remembered-time commits. */
229
231
  selectionIntent?: 'remembered' | 'manual';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "2.3.215",
4
+ "version": "2.3.216",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",