@pisell/pisellos 2.3.190 → 2.3.192

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 (63) hide show
  1. package/dist/model/strategy/adapter/promotion/index.js +0 -9
  2. package/dist/modules/BookingContext/index.d.ts +2 -2
  3. package/dist/modules/BookingContext/index.js +55 -25
  4. package/dist/modules/BookingContext/types.d.ts +2 -0
  5. package/dist/modules/Order/index.d.ts +13 -5
  6. package/dist/modules/Order/index.js +1053 -554
  7. package/dist/modules/Order/types.d.ts +20 -1
  8. package/dist/modules/Order/types.js +4 -0
  9. package/dist/modules/Product/index.d.ts +1 -1
  10. package/dist/modules/ProductList/clientDataVariants.js +6 -2
  11. package/dist/modules/ProductList/index.d.ts +2 -0
  12. package/dist/modules/ProductList/index.js +125 -39
  13. package/dist/modules/ResourcePlanner/planner.js +5 -0
  14. package/dist/server/index.d.ts +3 -0
  15. package/dist/server/index.js +1105 -976
  16. package/dist/shared/receipt/small-ticket.js +33 -5
  17. package/dist/solution/BaseSales/index.d.ts +14 -3
  18. package/dist/solution/BaseSales/index.js +285 -195
  19. package/dist/solution/BookingByStep/index.d.ts +2 -2
  20. package/dist/solution/UnifiedBookingSales/catalogQueryBatch.d.ts +21 -0
  21. package/dist/solution/UnifiedBookingSales/catalogQueryBatch.js +202 -0
  22. package/dist/solution/UnifiedBookingSales/index.d.ts +49 -1
  23. package/dist/solution/UnifiedBookingSales/index.js +2276 -902
  24. package/dist/solution/UnifiedBookingSales/remoteOccupancyCache.d.ts +2 -0
  25. package/dist/solution/UnifiedBookingSales/remoteOccupancyCache.js +4 -0
  26. package/dist/solution/UnifiedBookingSales/sessionResourceCache.d.ts +27 -0
  27. package/dist/solution/UnifiedBookingSales/sessionResourceCache.js +271 -0
  28. package/dist/solution/UnifiedBookingSales/types.d.ts +64 -1
  29. package/dist/solution/UnifiedBookingSales/types.js +7 -1
  30. package/dist/solution/UnifiedBookingSales/venueCatalogSession.d.ts +32 -0
  31. package/dist/solution/UnifiedBookingSales/venueCatalogSession.js +277 -0
  32. package/lib/model/strategy/adapter/promotion/index.js +46 -1
  33. package/lib/modules/BookingContext/index.d.ts +2 -2
  34. package/lib/modules/BookingContext/index.js +42 -10
  35. package/lib/modules/BookingContext/types.d.ts +2 -0
  36. package/lib/modules/Order/index.d.ts +13 -5
  37. package/lib/modules/Order/index.js +208 -7
  38. package/lib/modules/Order/types.d.ts +20 -1
  39. package/lib/modules/Order/types.js +2 -0
  40. package/lib/modules/Product/index.d.ts +1 -1
  41. package/lib/modules/ProductList/clientDataVariants.js +6 -2
  42. package/lib/modules/ProductList/index.d.ts +2 -0
  43. package/lib/modules/ProductList/index.js +56 -0
  44. package/lib/modules/ResourcePlanner/planner.js +4 -0
  45. package/lib/server/index.d.ts +3 -0
  46. package/lib/server/index.js +86 -5
  47. package/lib/shared/receipt/small-ticket.js +30 -5
  48. package/lib/solution/BaseSales/index.d.ts +14 -3
  49. package/lib/solution/BaseSales/index.js +67 -2
  50. package/lib/solution/BookingByStep/index.d.ts +2 -2
  51. package/lib/solution/UnifiedBookingSales/catalogQueryBatch.d.ts +21 -0
  52. package/lib/solution/UnifiedBookingSales/catalogQueryBatch.js +109 -0
  53. package/lib/solution/UnifiedBookingSales/index.d.ts +49 -1
  54. package/lib/solution/UnifiedBookingSales/index.js +872 -55
  55. package/lib/solution/UnifiedBookingSales/remoteOccupancyCache.d.ts +2 -0
  56. package/lib/solution/UnifiedBookingSales/remoteOccupancyCache.js +2 -0
  57. package/lib/solution/UnifiedBookingSales/sessionResourceCache.d.ts +27 -0
  58. package/lib/solution/UnifiedBookingSales/sessionResourceCache.js +199 -0
  59. package/lib/solution/UnifiedBookingSales/types.d.ts +64 -1
  60. package/lib/solution/UnifiedBookingSales/types.js +4 -1
  61. package/lib/solution/UnifiedBookingSales/venueCatalogSession.d.ts +32 -0
  62. package/lib/solution/UnifiedBookingSales/venueCatalogSession.js +151 -0
  63. package/package.json +1 -1
@@ -103,6 +103,7 @@ var LABELS = {
103
103
  cashReceived: 'Cash received',
104
104
  changeDue: 'Change due',
105
105
  eftpos: 'Eftpos',
106
+ creditCard: 'Credit card',
106
107
  wallet: 'Wallet',
107
108
  giftCard: 'Gift card',
108
109
  pointCard: 'Point card',
@@ -149,6 +150,7 @@ var LABELS = {
149
150
  cashReceived: '收取现金',
150
151
  changeDue: '找零',
151
152
  eftpos: '刷卡支付',
153
+ creditCard: '信用卡',
152
154
  wallet: '钱包支付',
153
155
  giftCard: '礼品卡',
154
156
  pointCard: '积分卡',
@@ -195,6 +197,7 @@ var LABELS = {
195
197
  cashReceived: '收取現金',
196
198
  changeDue: '找零',
197
199
  eftpos: '刷卡支付',
200
+ creditCard: '信用卡',
198
201
  wallet: '錢包支付',
199
202
  giftCard: '禮品卡',
200
203
  pointCard: '積分卡',
@@ -239,6 +242,7 @@ var LABELS = {
239
242
  asap: 'できるだけ早く',
240
243
  cash: '現金',
241
244
  eftpos: 'カード',
245
+ creditCard: 'クレジットカード',
242
246
  wallet: 'ウォレット',
243
247
  giftCard: 'ギフトカード',
244
248
  pointCard: 'ポイントカード',
@@ -284,6 +288,7 @@ var LABELS = {
284
288
  asap: 'Assim que possível',
285
289
  cash: 'Dinheiro',
286
290
  eftpos: 'Cartão',
291
+ creditCard: 'Cartão de crédito',
287
292
  wallet: 'Carteira',
288
293
  giftCard: 'Cartão-presente',
289
294
  pointCard: 'Cartão de pontos',
@@ -2639,12 +2644,33 @@ function appendMaskedCardCode(name, code) {
2639
2644
  function trimDecimal(value) {
2640
2645
  return value.toDecimalPlaces(2).toFixed(2).replace(/\.?0+$/, '');
2641
2646
  }
2647
+ function getLocalizedPaymentName(value, locale) {
2648
+ if (typeof value === 'string') return value.trim();
2649
+ if (!value || _typeof(value) !== 'object' || Array.isArray(value)) return '';
2650
+ var candidates = [value[locale], value[locale.replace('_', '-')], value[locale.replace('-', '_')], value.original, value.auto, value.default, value.en];
2651
+ for (var _i24 = 0, _candidates2 = candidates; _i24 < _candidates2.length; _i24++) {
2652
+ var candidate = _candidates2[_i24];
2653
+ if (typeof candidate === 'string' && candidate.trim()) return candidate.trim();
2654
+ }
2655
+ return '';
2656
+ }
2657
+ function getExplicitPaymentName(payment, locale) {
2658
+ var _payment$metadata4;
2659
+ // Cloud order snapshots retain the localized name in metadata after reload.
2660
+ var candidates = [payment.name, payment.title, payment.payment_method_name, payment.method_name, (_payment$metadata4 = payment.metadata) === null || _payment$metadata4 === void 0 ? void 0 : _payment$metadata4.custom_payment_name];
2661
+ for (var _i25 = 0, _candidates3 = candidates; _i25 < _candidates3.length; _i25++) {
2662
+ var candidate = _candidates3[_i25];
2663
+ var name = getLocalizedPaymentName(candidate, locale);
2664
+ if (name) return name;
2665
+ }
2666
+ return '';
2667
+ }
2642
2668
  function getFundRecordPaymentName(payment, locale) {
2643
2669
  var fundRecord = getFundRecord(payment);
2644
2670
  if (!fundRecord) return '';
2645
- var name = getLocalizedValue(fundRecord.wallet_pass_name, locale);
2671
+ var name = getLocalizedPaymentName(fundRecord.wallet_pass_name, locale);
2646
2672
  if (!name && !maskMachineCode(fundRecord.code)) return '';
2647
- var fallbackName = getLocalizedValue(payment.name || payment.title || payment.payment_method_name || payment.method_name || payment.code, locale);
2673
+ var fallbackName = getExplicitPaymentName(payment, locale) || getLocalizedPaymentName(payment.code, locale);
2648
2674
  return appendMaskedCardCode(name || fallbackName, fundRecord.code);
2649
2675
  }
2650
2676
  function appendMachineCodeToName(name, payment) {
@@ -2654,13 +2680,15 @@ function appendMachineCodeToName(name, payment) {
2654
2680
  function paymentMethodName(payment, locale) {
2655
2681
  var fundRecordName = getFundRecordPaymentName(payment, locale);
2656
2682
  if (fundRecordName) return fundRecordName;
2657
- var raw = payment.name || payment.title || payment.payment_method_name || payment.method_name;
2658
- if (raw) return appendMachineCodeToName(getLocalizedValue(raw, locale), payment);
2683
+ var name = getExplicitPaymentName(payment, locale);
2684
+ if (name) return appendMachineCodeToName(name, payment);
2659
2685
  var code = stringify(payment.code || payment.type || payment.payment_method || payment.method).toLowerCase();
2660
2686
  if (code.includes('cash')) return label(locale, 'cash');
2661
- if (code.includes('eftpos') || code.includes('card')) return label(locale, 'eftpos');
2687
+ if (code.includes('eftpos')) return label(locale, 'eftpos');
2662
2688
  if (code.includes('wallet')) return label(locale, 'wallet');
2663
2689
  if (code.includes('gift')) return label(locale, 'giftCard');
2690
+ if (code === 'credit_card' || code.startsWith('credit_card_')) return label(locale, 'creditCard');
2691
+ if (code.includes('card')) return label(locale, 'eftpos');
2664
2692
  return stringify(payment.code || payment.type || payment.payment_method || payment.method);
2665
2693
  }
2666
2694
  function getSummary(order) {
@@ -7,7 +7,7 @@ import { OrderModule } from '../../modules/Order';
7
7
  import { type PickupTimingBookingInput } from '../../modules/Order/pickupTiming';
8
8
  import type { PickupTimingAvailability, PickupTimingSelection, PickupTimingValidationResult } from '../../modules/FulfillmentTiming';
9
9
  import { type ContactInfoConfig } from '../../modules/OpenData/contactInfo';
10
- import type { AddProductBookingInput, AddProductToOrderOptions, LoadSalesDetailParams, OrderPaymentData, OrderPaymentUpdateOptions, OrderPaymentUpdateResult, OrderPaymentSource, SendCustomerPayLinkParams, SyncPaymentsToOrderParams, SyncPaymentsToOrderResult, UpdateTempOrderCustomerInput, UpdateOrderBookingParams, UpdateOrderProductParams, OrderTempOrder, OrderSummary, OrderPromotionEvaluator, OrderGiftSelectResolver, OrderUnfulfilledPromotion, OrderLastGiftActions, RemoveProductsFromOrderOptions, ReplaceTempOrderOptions, SalesNote, SalesNotesMutationSnapshot, SetSalesNoteInput, PickupReferenceMode, ShopServiceData, ShopServiceType } from '../../modules/Order/types';
10
+ import type { AddProductBookingInput, AddProductToOrderOptions, LoadSalesDetailParams, OrderPaymentData, OrderPaymentUpdateOptions, OrderPaymentUpdateResult, OrderPaymentSource, SendCustomerPayLinkParams, SyncPaymentsToOrderParams, SyncPaymentsToOrderResult, UpdateTempOrderCustomerInput, UpdateOrderBookingParams, UpdateOrderProductParams, UpdateOrderProductsOptions, OrderTempOrder, OrderSummary, OrderPromotionEvaluator, OrderGiftSelectResolver, OrderUnfulfilledPromotion, OrderLastGiftActions, RemoveProductsFromOrderOptions, ReplaceTempOrderOptions, SalesNote, SalesNotesMutationSnapshot, SetSalesNoteInput, PickupReferenceMode, ShopServiceData, ShopServiceType } from '../../modules/Order/types';
11
11
  import type { SubmitPayloadEnhancer } from '../../modules/Order/utils';
12
12
  import type { Discount, VirtualCurrencyAsset } from '../../modules/Discount/types';
13
13
  import { RequestPlugin, WindowPlugin } from '../../plugins';
@@ -135,7 +135,7 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
135
135
  * /product/query 的智能定价评估只读取 strategy_context;
136
136
  * application_code 仅作为接口兼容字段,不能替代 channel / business_code。
137
137
  */
138
- private getPriceQueryStrategyContext;
138
+ protected getPriceQueryStrategyContext(channel?: string): Record<string, any>;
139
139
  /**
140
140
  * 子类可在商品重报价前准备客户维度的策略上下文,例如等待 Wallet/优惠资产加载。
141
141
  */
@@ -162,6 +162,12 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
162
162
  private prepareRawProductForPriceQuery;
163
163
  private resolveLocalProductForPriceQuery;
164
164
  private loadProductsForPriceQuery;
165
+ /** Opt-in subclasses may supply page-owned raw pools; ordinary sales keep remote fallback. */
166
+ protected isVenueCatalogLocalPricingActive(): boolean;
167
+ protected getVenueCatalogLocalPriceSource(_productId: number, _selectedProduct?: Record<string, any>): {
168
+ product: Record<string, any>;
169
+ menuList: Record<string, any>[];
170
+ } | undefined;
165
171
  private resolveProductsForPriceQuery;
166
172
  private getAuthoritativeBundleItems;
167
173
  private findAuthoritativeBundleItem;
@@ -535,6 +541,11 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
535
541
  submitBeforeSend?: boolean;
536
542
  }): Promise<T>;
537
543
  transformBaseProductToOrderProduct(params: TransformBaseProductToOrderProductParams): import("./utils/transformBaseProductToOrderProduct").BaseProductOrderProductInput | null;
544
+ /** Explicit pool source avoids races between two simultaneous Venue pricing contexts. */
545
+ protected calculateVenueCatalogProductBookingPrice(params: BaseSalesCalculateProductBookingPriceParams, source: {
546
+ product: Record<string, any>;
547
+ menuList: Record<string, any>[];
548
+ }): Promise<BaseSalesProductBookingPriceResult>;
538
549
  calculateProductBookingPrice(params: BaseSalesCalculateProductBookingPriceParams): Promise<BaseSalesProductBookingPriceResult>;
539
550
  getQuotationCustomerScopeInfo(): BaseSalesQuotationCustomerScopeInfo;
540
551
  private hasSmartPricingStrategies;
@@ -548,7 +559,7 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
548
559
  validateProductVoucherSelection(): void;
549
560
  addProductToOrder(product: Partial<BaseSalesOrderProduct> & BaseSalesOrderProductIdentity, booking?: AddProductBookingInput, options?: AddProductToOrderOptions): Promise<import("../../modules/Order/types").OrderProduct[]>;
550
561
  updateOrderProduct(params: UpdateOrderProductParams): Promise<import("../../modules/Order/types").OrderProduct[]>;
551
- updateOrderProducts(paramsList: UpdateOrderProductParams[]): Promise<import("../../modules/Order/types").OrderProduct[]>;
562
+ updateOrderProducts(paramsList: UpdateOrderProductParams[], options?: UpdateOrderProductsOptions): Promise<import("../../modules/Order/types").OrderProduct[]>;
552
563
  updateOrderProductQuantity(params: BaseSalesUpdateOrderProductQuantityParams): Promise<import("../../modules/Order/types").OrderProduct[]>;
553
564
  updateOrderBooking(params: UpdateOrderBookingParams): any[];
554
565
  /**