@pisell/pisellos 2.3.43 → 2.3.44

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 (33) hide show
  1. package/dist/model/strategy/adapter/promotion/index.js +9 -0
  2. package/dist/modules/Order/index.d.ts +2 -1
  3. package/dist/modules/Order/index.js +73 -28
  4. package/dist/modules/Order/types.d.ts +2 -0
  5. package/dist/modules/Payment/walletpass.d.ts +10 -3
  6. package/dist/modules/Payment/walletpass.js +425 -282
  7. package/dist/modules/Rules/index.d.ts +2 -0
  8. package/dist/modules/Rules/index.js +61 -57
  9. package/dist/solution/BaseSales/index.js +6 -3
  10. package/dist/solution/BaseSales/types.d.ts +3 -1
  11. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +6 -3
  12. package/dist/solution/BookingTicket/index.d.ts +1 -1
  13. package/dist/solution/BookingTicket/index.js +6 -3
  14. package/dist/solution/BookingTicket/types.d.ts +1 -0
  15. package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +3 -3
  16. package/dist/solution/VenueBooking/index.d.ts +1 -0
  17. package/lib/model/strategy/adapter/promotion/index.js +51 -0
  18. package/lib/modules/Order/index.d.ts +2 -1
  19. package/lib/modules/Order/index.js +46 -7
  20. package/lib/modules/Order/types.d.ts +2 -0
  21. package/lib/modules/Payment/walletpass.d.ts +10 -3
  22. package/lib/modules/Payment/walletpass.js +218 -56
  23. package/lib/modules/Rules/index.d.ts +2 -0
  24. package/lib/modules/Rules/index.js +8 -3
  25. package/lib/solution/BaseSales/index.js +1 -0
  26. package/lib/solution/BaseSales/types.d.ts +3 -1
  27. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +3 -2
  28. package/lib/solution/BookingTicket/index.d.ts +1 -1
  29. package/lib/solution/BookingTicket/index.js +1 -0
  30. package/lib/solution/BookingTicket/types.d.ts +1 -0
  31. package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +2 -2
  32. package/lib/solution/VenueBooking/index.d.ts +1 -0
  33. package/package.json +1 -1
@@ -132,14 +132,15 @@ function transformBaseProductToOrderProduct(params) {
132
132
  ...callbackOrigin || {}
133
133
  };
134
134
  const matchedVariant = findVariantById(callbackOrigin, productVariantId) ?? findVariantById(sourceProduct, productVariantId) ?? findVariantById(origin, productVariantId);
135
+ const hasPriceOverride = payload.price_override !== void 0 && payload.price_override !== null && payload.price_override !== "";
136
+ const catalogSourcePrice = (matchedVariant == null ? void 0 : matchedVariant.price) ?? (matchedVariant == null ? void 0 : matchedVariant.base_price) ?? (origin == null ? void 0 : origin.price) ?? (origin == null ? void 0 : origin.base_price) ?? (sourceProduct == null ? void 0 : sourceProduct.price) ?? (sourceProduct == null ? void 0 : sourceProduct.selling_price) ?? (sourceProduct == null ? void 0 : sourceProduct.base_price);
135
137
  const sourceProductPrice = toPriceString(
136
- payload.price ?? payload.selling_price ?? (matchedVariant == null ? void 0 : matchedVariant.price) ?? (matchedVariant == null ? void 0 : matchedVariant.base_price) ?? (origin == null ? void 0 : origin.price) ?? (origin == null ? void 0 : origin.base_price) ?? (sourceProduct == null ? void 0 : sourceProduct.price) ?? (sourceProduct == null ? void 0 : sourceProduct.selling_price) ?? (sourceProduct == null ? void 0 : sourceProduct.base_price),
138
+ hasPriceOverride ? catalogSourcePrice ?? payload.price ?? payload.selling_price : payload.price ?? payload.selling_price ?? catalogSourcePrice,
137
139
  "0.00"
138
140
  );
139
141
  const explicitLineTotal = payload.line_total ?? payload.total ?? ((_c = payload._extend) == null ? void 0 : _c.total);
140
142
  const hasExplicitLineTotal = Number.isFinite(Number(explicitLineTotal));
141
143
  const lineCompositeTotal = toPriceString(explicitLineTotal, sourceProductPrice);
142
- const hasPriceOverride = payload.price_override !== void 0 && payload.price_override !== null && payload.price_override !== "";
143
144
  const productOptionItem = (0, import_utils.normalizeProductSkuOptions)(
144
145
  normalizeOptionItems(
145
146
  ((_d = payload.product_sku) == null ? void 0 : _d.option) ?? payload.option ?? payload.options ?? payload.product_option_item
@@ -326,7 +326,7 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
326
326
  * 获取当前的客户搜索条件
327
327
  * @returns 当前搜索条件
328
328
  */
329
- getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "skip" | "num">;
329
+ getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "num" | "skip">;
330
330
  /**
331
331
  * 获取客户列表状态(包含滚动加载相关状态)
332
332
  * @returns 客户状态
@@ -368,6 +368,7 @@ var BookingTicketImpl = class extends import_BaseSales.BaseSalesImpl {
368
368
  }
369
369
  return {
370
370
  isAvailable: raw.isAvailable,
371
+ ...raw.isAccepted !== void 0 ? { isAccepted: raw.isAccepted } : {},
371
372
  type: raw.type,
372
373
  unavailableReason: raw.unavailableReason,
373
374
  scannedDiscountList: raw.scannedDiscountList
@@ -229,6 +229,7 @@ export interface GlobalScanHostBridge {
229
229
  */
230
230
  applyPromotionCode?: (code: string, customerId?: number) => Promise<{
231
231
  isAvailable?: boolean;
232
+ isAccepted?: boolean;
232
233
  type?: string;
233
234
  unavailableReason?: string;
234
235
  }>;
@@ -131,7 +131,7 @@ async function applyGlobalScan(host, formatted, bridge) {
131
131
  return { status: "failed", reason: "no_bridge" };
132
132
  }
133
133
  const result = await bridge.applyPromotionCode(scanCode);
134
- if (result == null ? void 0 : result.isAvailable) {
134
+ if ((result == null ? void 0 : result.isAccepted) ?? (result == null ? void 0 : result.isAvailable)) {
135
135
  return { status: "success", kind: "promotion" };
136
136
  }
137
137
  return { status: "failed", reason: "invalid_data" };
@@ -146,7 +146,7 @@ async function applyGlobalScan(host, formatted, bridge) {
146
146
  scanCode,
147
147
  Number((data == null ? void 0 : data.id) ?? (data == null ? void 0 : data.customer_id)) || void 0
148
148
  );
149
- if (promotionResult == null ? void 0 : promotionResult.isAvailable) {
149
+ if ((promotionResult == null ? void 0 : promotionResult.isAccepted) ?? (promotionResult == null ? void 0 : promotionResult.isAvailable)) {
150
150
  return { status: "success", kind: "promotion" };
151
151
  }
152
152
  }
@@ -167,6 +167,7 @@ export declare class VenueBookingImpl extends BaseSalesImpl implements Module {
167
167
  private recalculateOrderPricesFromQuotation;
168
168
  scanCode(code: string, customerId?: number): Promise<{
169
169
  isAvailable: boolean;
170
+ isAccepted?: boolean | undefined;
170
171
  discountList: import("../../modules/Discount").Discount[];
171
172
  type: "server" | "clientCalc";
172
173
  unavailableReason?: import("../../modules/Rules/types").UnavailableReason | undefined;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "2.3.43",
4
+ "version": "2.3.44",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",