@pisell/pisellos 2.3.124 → 2.3.126

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 (93) hide show
  1. package/dist/model/strategy/adapter/promotion/index.js +9 -0
  2. package/dist/model/strategy/adapter/walletPass/evaluator.d.ts +0 -2
  3. package/dist/model/strategy/adapter/walletPass/evaluator.js +2 -4
  4. package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +19 -58
  5. package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +12 -24
  6. package/dist/modules/Customer/index.js +3 -6
  7. package/dist/modules/Customer/types.d.ts +0 -2
  8. package/dist/modules/Discount/index.d.ts +2 -2
  9. package/dist/modules/Discount/index.js +151 -37
  10. package/dist/modules/Discount/types.d.ts +5 -36
  11. package/dist/modules/Order/index.d.ts +12 -7
  12. package/dist/modules/Order/index.js +307 -432
  13. package/dist/modules/Order/types.d.ts +5 -0
  14. package/dist/modules/Order/utils/orderCollectionIdentity.js +12 -16
  15. package/dist/modules/Order/utils.d.ts +11 -1
  16. package/dist/modules/Order/utils.js +127 -122
  17. package/dist/modules/Payment/types.d.ts +1 -21
  18. package/dist/modules/Payment/types.js +0 -2
  19. package/dist/modules/Payment/walletpass.d.ts +1 -1
  20. package/dist/modules/Payment/walletpass.js +47 -80
  21. package/dist/modules/Rules/index.d.ts +2 -2
  22. package/dist/modules/Rules/index.js +186 -480
  23. package/dist/modules/Rules/types.d.ts +0 -4
  24. package/dist/server/modules/order/types.d.ts +0 -2
  25. package/dist/solution/BaseSales/index.d.ts +0 -1
  26. package/dist/solution/BaseSales/index.js +59 -51
  27. package/dist/solution/BaseSales/types.d.ts +2 -2
  28. package/dist/solution/BaseSales/utils/cartPromotion.js +126 -141
  29. package/dist/solution/BookingByStep/index.d.ts +1 -1
  30. package/dist/solution/BookingTicket/index.d.ts +2 -1
  31. package/dist/solution/BookingTicket/index.js +63 -60
  32. package/dist/solution/BookingTicket/types.d.ts +1 -5
  33. package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +0 -2
  34. package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +147 -338
  35. package/dist/solution/BookingTicket/utils/scan/cloudSearch.js +4 -8
  36. package/dist/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +0 -6
  37. package/dist/solution/BookingTicket/utils/scan/formatGlobalScan.js +6 -19
  38. package/dist/solution/ShopDiscount/index.d.ts +0 -2
  39. package/dist/solution/ShopDiscount/index.js +42 -99
  40. package/dist/solution/ShopDiscount/utils.d.ts +2 -4
  41. package/dist/solution/ShopDiscount/utils.js +23 -43
  42. package/dist/solution/UnifiedBookingSales/index.js +2 -2
  43. package/lib/model/strategy/adapter/promotion/index.js +1 -46
  44. package/lib/model/strategy/adapter/walletPass/evaluator.d.ts +0 -2
  45. package/lib/model/strategy/adapter/walletPass/evaluator.js +0 -2
  46. package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +6 -35
  47. package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +6 -13
  48. package/lib/modules/Customer/index.js +1 -5
  49. package/lib/modules/Customer/types.d.ts +0 -2
  50. package/lib/modules/Discount/index.d.ts +2 -2
  51. package/lib/modules/Discount/index.js +129 -23
  52. package/lib/modules/Discount/types.d.ts +5 -36
  53. package/lib/modules/Order/index.d.ts +12 -7
  54. package/lib/modules/Order/index.js +107 -215
  55. package/lib/modules/Order/types.d.ts +5 -0
  56. package/lib/modules/Order/utils/orderCollectionIdentity.js +11 -14
  57. package/lib/modules/Order/utils.d.ts +11 -1
  58. package/lib/modules/Order/utils.js +45 -39
  59. package/lib/modules/Payment/types.d.ts +1 -21
  60. package/lib/modules/Payment/types.js +0 -1
  61. package/lib/modules/Payment/walletpass.d.ts +1 -1
  62. package/lib/modules/Payment/walletpass.js +9 -29
  63. package/lib/modules/Rules/index.d.ts +2 -2
  64. package/lib/modules/Rules/index.js +110 -357
  65. package/lib/modules/Rules/types.d.ts +0 -4
  66. package/lib/server/modules/order/types.d.ts +0 -2
  67. package/lib/solution/BaseSales/index.d.ts +0 -1
  68. package/lib/solution/BaseSales/index.js +12 -5
  69. package/lib/solution/BaseSales/types.d.ts +2 -2
  70. package/lib/solution/BaseSales/utils/cartPromotion.js +4 -12
  71. package/lib/solution/BookingByStep/index.d.ts +1 -1
  72. package/lib/solution/BookingTicket/index.d.ts +2 -1
  73. package/lib/solution/BookingTicket/index.js +33 -36
  74. package/lib/solution/BookingTicket/types.d.ts +1 -5
  75. package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +0 -2
  76. package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +42 -174
  77. package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +4 -8
  78. package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +0 -6
  79. package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.js +3 -11
  80. package/lib/solution/ShopDiscount/index.d.ts +0 -2
  81. package/lib/solution/ShopDiscount/index.js +9 -55
  82. package/lib/solution/ShopDiscount/utils.d.ts +2 -4
  83. package/lib/solution/ShopDiscount/utils.js +25 -42
  84. package/lib/solution/UnifiedBookingSales/index.js +2 -2
  85. package/package.json +1 -1
  86. package/dist/modules/Discount/availability.d.ts +0 -7
  87. package/dist/modules/Discount/availability.js +0 -49
  88. package/dist/modules/Discount/entitlementPass.d.ts +0 -34
  89. package/dist/modules/Discount/entitlementPass.js +0 -147
  90. package/lib/modules/Discount/availability.d.ts +0 -7
  91. package/lib/modules/Discount/availability.js +0 -43
  92. package/lib/modules/Discount/entitlementPass.d.ts +0 -34
  93. package/lib/modules/Discount/entitlementPass.js +0 -141
@@ -44,10 +44,7 @@ interface ApplicableProductDetails {
44
44
  original_amount: string;
45
45
  num: number;
46
46
  metadata?: {
47
- encoded?: string;
48
47
  product_discount_difference?: number;
49
- /** 月卡扣除本单新增使用后的剩余次数;不限次数时为 null。 */
50
- balance?: number | null;
51
48
  };
52
49
  discount?: {
53
50
  fixed_amount?: number;
@@ -66,13 +63,6 @@ interface UsageCreditsValue {
66
63
  max_per_week: number;
67
64
  max_per_month: number;
68
65
  }
69
- export type IncludedUses = {
70
- type: 'limited';
71
- value: number;
72
- } | {
73
- type: 'unlimited';
74
- value: null;
75
- };
76
66
  export type DiscountFilterRejectKey = 'total_credits' | 'per_user_limit' | 'max_per_day' | 'max_per_week' | 'max_per_month';
77
67
  export interface DiscountWithReason {
78
68
  discountList: Discount[];
@@ -117,37 +107,30 @@ interface ExtensionData {
117
107
  }
118
108
  export interface Discount {
119
109
  id: number;
120
- shop_id?: number;
121
110
  product_name: string;
122
111
  encoded: string;
123
112
  code: string;
124
113
  tag: string;
125
- expire_time?: string | null;
126
- expire_date?: string | null;
127
- end_time?: string | null;
114
+ expire_time?: string;
128
115
  product_id: number;
129
116
  relation_type: string;
130
117
  par_value: string;
131
118
  used_par_value: string;
132
119
  limit_status: string;
133
120
  limited_relation_product_data: Limitedrelationproductdata;
134
- balance?: string | number | null;
135
- available_num?: number;
136
- available_products_info?: any[];
121
+ balance: string;
137
122
  format_title: Formattitle;
138
123
  metadata?: {
139
- encoded?: string;
140
124
  discount_card_type?: 'fixed_amount' | 'percent';
141
125
  custom_product_bundle_map_id?: string;
142
126
  validity_type?: "custom_schedule_validity" | "fixed_validity";
143
- included_uses?: IncludedUses;
144
- discount_calculation_mode?: 'item_level' | 'order_level';
145
- holder?: {
127
+ discount_calculation_mode: 'item_level' | 'order_level';
128
+ holder: {
146
129
  type: "customer" | "custom";
147
130
  };
148
131
  };
149
132
  product: Product;
150
- type?: "product" | 'good_pass' | 'entitlement_pass' | 'discount_card' | 'product_discount_card';
133
+ type: "product" | 'good_pass';
151
134
  resource_id?: number;
152
135
  savedAmount?: number;
153
136
  isEditMode?: boolean;
@@ -180,17 +163,9 @@ export interface Discount {
180
163
  applicableProductIds?: number[];
181
164
  applicableProductDetails: ApplicableProductDetails[];
182
165
  appliedProductDetails: ApplicableProductDetails[];
183
- /** Entitlement Pass 编辑订单时已经提交的使用明细。 */
184
- committedAppliedProductDetails?: ApplicableProductDetails[];
185
166
  isDisabledForProductUsed?: boolean;
186
167
  amount?: number;
187
168
  customer_id?: number | string | null;
188
- holder?: {
189
- holder_type?: 'customer' | 'form' | string;
190
- holder_id?: number | string | Array<number | string>;
191
- created_at?: string | null;
192
- [key: string]: any;
193
- };
194
169
  extension_data?: ExtensionData[];
195
170
  total_order_behavior_count?: number;
196
171
  today_order_behavior_count?: number;
@@ -205,12 +180,6 @@ export interface Discount {
205
180
  start_time?: string;
206
181
  discount_rule_uncheck_flag?: boolean;
207
182
  usageLimitFailKey?: string | null;
208
- /** 本次规则计算的不可用原因;可用性恢复后清除。 */
209
- reason?: string;
210
- reasonCode?: string;
211
- unified_messages?: {
212
- title?: string | Record<string, string>;
213
- };
214
183
  unified_available_status?: number | undefined | null;
215
184
  }
216
185
  export interface DiscountState {
@@ -3,7 +3,7 @@ import { BaseModule } from '../BaseModule';
3
3
  import { OrderModuleAPI, CommitOrderParams, UpdateOrderBookingParams, UpdateOrderProductParams, UpdateOrderProductQuantityParams, CancelOrderParams, ChangeBookingStatusParams, CheckoutOrderParams } from './types';
4
4
  import { CartItem } from '../Cart/types';
5
5
  import { type SubmitPayloadEnhancer } from './utils';
6
- import type { OrderAmountSnapshot, AddProductBookingInput, AddProductToOrderOptions, OrderIdentitySnapshot, OrderPaymentSource, OrderSnapshot, OrderSyncState, SyncPaymentsToOrderParams, SyncPaymentsToOrderResult, SubmitSalesOrderParams, OrderProduct, OrderProductIdentity, OrderSummary, OrderTempOrder, OrderPaymentData, OrderPaymentUpdateOptions, OrderPaymentUpdateResult, SendCustomerPayLinkParams, UpdateTempOrderCustomerInput, OrderCustomerPatch, OrderCustomerView, ReplaceTempOrderOptions, OrderPromotionEvaluator, OrderGiftSelectResolver, OrderUnfulfilledPromotion, OrderLastGiftActions, RemoveProductsFromOrderOptions, SalesNote, SalesNotesMutationSnapshot, SetSalesNoteInput, PickupReferenceMode, ShopServiceData, ShopServiceType } from './types';
6
+ import type { OrderAmountSnapshot, AddProductBookingInput, AddProductToOrderOptions, OrderIdentitySnapshot, OrderPaymentSource, OrderSnapshot, OrderSyncState, SyncPaymentsToOrderParams, SyncPaymentsToOrderResult, SubmitSalesOrderParams, OrderProduct, OrderProductIdentity, OrderSummary, OrderTempOrder, OrderPaymentData, OrderPaymentUpdateOptions, OrderPaymentUpdateResult, SendCustomerPayLinkParams, UpdateTempOrderCustomerInput, OrderCustomerPatch, OrderCustomerView, ReplaceTempOrderOptions, OrderPromotionEvaluator, OrderGiftSelectResolver, OrderUnfulfilledPromotion, OrderLastGiftActions, RemoveProductsFromOrderOptions, SalesNote, SalesNotesMutationSnapshot, SetSalesNoteInput, PickupReferenceMode, PointCardSnapshotMergeContext, PointCardSnapshotItem, ShopServiceData, ShopServiceType } from './types';
7
7
  import type { ICustomer } from '../AccountList/types';
8
8
  import type { Discount } from '../Discount/types';
9
9
  import { UnavailableReason } from '../Rules/types';
@@ -22,6 +22,8 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
22
22
  private sessionStorageRestoreRecord;
23
23
  /** 只允许当前订单最新的 prepare/config 请求回写客户资产态。 */
24
24
  private customerWalletPrepareConfigEpoch;
25
+ /** Payment 可能早于 prepare/config 返回;先按实例 ID 暂存卡号等待 Snapshot。 */
26
+ private pointCardSnapshotCodeCandidates;
25
27
  private salesSummaryModuleName;
26
28
  private rulesHooksOverride?;
27
29
  private moduleHooksOverride?;
@@ -108,7 +110,6 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
108
110
  }>;
109
111
  applyDiscount(options?: {
110
112
  reapplyBookingDiscountProductUids?: string[];
111
- preferredEntitlementPassIds?: number[];
112
113
  }): void;
113
114
  /**
114
115
  * 注入促销评估器。
@@ -188,7 +189,16 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
188
189
  private clearTempOrderCustomerWalletSnapshots;
189
190
  private clearCustomerWalletState;
190
191
  private clearCustomerWalletRuntimeState;
192
+ private rememberPointCardSnapshotCodeCandidates;
193
+ private getRememberedPointCardSnapshotCodeCandidates;
194
+ private getPointCardSnapshotOrderIdentityKey;
195
+ private isPointCardSnapshotMergeContextCurrent;
191
196
  private writeCustomerWalletSnapshotsFromPrepareConfig;
197
+ /**
198
+ * 将 Payment WalletPass 返回的实例 code 回填到当前订单 Snapshot。
199
+ * 这里只按资产 ID 补空值,不新增卡、不覆盖 prepare/config 冻结的余额。
200
+ */
201
+ mergePointCardSnapshotCodes(walletPassList: unknown, context?: PointCardSnapshotMergeContext): PointCardSnapshotItem[];
192
202
  private createExternalSaleNumber;
193
203
  private ensureExternalSaleNumber;
194
204
  private ensureRequestUniqueIdempotencyToken;
@@ -478,12 +488,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
478
488
  }>, options?: {
479
489
  skipEditDiscountConfigRefresh?: boolean;
480
490
  }): Promise<OrderProduct[]>;
481
- private getFullCoveragePassDiscounts;
482
- private hasEntitlementPassDiscount;
483
491
  private hasGoodPassDiscount;
484
- private isPersistedProductLine;
485
- private isRuntimeEntitlementAppend;
486
- private hasSameEntitlementMergePriceConfig;
487
492
  private getBundleRuntimeIdentity;
488
493
  private preservePersistedBundlePriceFields;
489
494
  private applyOrderProductUpdateToTempOrder;