@pisell/pisellos 2.3.164 → 2.3.166

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 (77) hide show
  1. package/dist/model/strategy/adapter/promotion/evaluator.js +89 -104
  2. package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +3 -1
  3. package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +28 -4
  4. package/dist/modules/Holder/utils.d.ts +2 -0
  5. package/dist/modules/Holder/utils.js +32 -2
  6. package/dist/modules/OpenData/contactInfo.d.ts +20 -0
  7. package/dist/modules/OpenData/contactInfo.js +70 -0
  8. package/dist/modules/OpenData/index.d.ts +1 -0
  9. package/dist/modules/OpenData/index.js +1 -0
  10. package/dist/modules/OpenData/types.d.ts +9 -0
  11. package/dist/modules/Order/holderRelations.d.ts +14 -0
  12. package/dist/modules/Order/holderRelations.js +154 -0
  13. package/dist/modules/Order/index.d.ts +1 -1
  14. package/dist/modules/Order/index.js +89 -44
  15. package/dist/modules/Order/types.d.ts +19 -1
  16. package/dist/modules/Order/types.js +2 -0
  17. package/dist/modules/Order/utils/discountProductLineIdentity.d.ts +1 -1
  18. package/dist/modules/Order/utils/discountProductLineIdentity.js +142 -7
  19. package/dist/modules/Order/utils/orderCollectionIdentity.js +24 -10
  20. package/dist/modules/Order/utils.d.ts +1 -1
  21. package/dist/modules/Order/utils.js +35 -9
  22. package/dist/modules/Rules/index.js +62 -61
  23. package/dist/server/index.js +18 -12
  24. package/dist/server/modules/order/index.d.ts +4 -0
  25. package/dist/server/modules/order/index.js +255 -190
  26. package/dist/server/modules/order/types.d.ts +3 -0
  27. package/dist/server/modules/products/index.js +3 -2
  28. package/dist/shared/receipt/small-ticket.js +17 -6
  29. package/dist/shared/sales/loadSalesOrderSnapshot.js +1 -1
  30. package/dist/solution/BaseSales/index.d.ts +4 -0
  31. package/dist/solution/BaseSales/index.js +1116 -935
  32. package/dist/solution/BaseSales/types.d.ts +2 -1
  33. package/dist/solution/BaseSales/utils/parseSalesResponse.d.ts +3 -1
  34. package/dist/solution/BaseSales/utils/parseSalesResponse.js +7 -3
  35. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +14 -4
  36. package/dist/solution/BookingTicket/index.d.ts +15 -1
  37. package/dist/solution/BookingTicket/index.js +784 -501
  38. package/dist/solution/UnifiedBookingSales/index.js +1 -1
  39. package/lib/model/strategy/adapter/promotion/evaluator.js +9 -14
  40. package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +3 -1
  41. package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +17 -1
  42. package/lib/modules/Holder/utils.d.ts +2 -0
  43. package/lib/modules/Holder/utils.js +27 -1
  44. package/lib/modules/OpenData/contactInfo.d.ts +20 -0
  45. package/lib/modules/OpenData/contactInfo.js +56 -0
  46. package/lib/modules/OpenData/index.d.ts +1 -0
  47. package/lib/modules/OpenData/index.js +12 -0
  48. package/lib/modules/OpenData/types.d.ts +9 -0
  49. package/lib/modules/Order/holderRelations.d.ts +14 -0
  50. package/lib/modules/Order/holderRelations.js +98 -0
  51. package/lib/modules/Order/index.d.ts +1 -1
  52. package/lib/modules/Order/index.js +44 -12
  53. package/lib/modules/Order/types.d.ts +19 -1
  54. package/lib/modules/Order/types.js +1 -0
  55. package/lib/modules/Order/utils/discountProductLineIdentity.d.ts +1 -1
  56. package/lib/modules/Order/utils/discountProductLineIdentity.js +51 -2
  57. package/lib/modules/Order/utils/orderCollectionIdentity.js +5 -0
  58. package/lib/modules/Order/utils.d.ts +1 -1
  59. package/lib/modules/Order/utils.js +27 -6
  60. package/lib/modules/Rules/index.js +2 -1
  61. package/lib/server/index.js +6 -0
  62. package/lib/server/modules/order/index.d.ts +4 -0
  63. package/lib/server/modules/order/index.js +46 -4
  64. package/lib/server/modules/order/types.d.ts +3 -0
  65. package/lib/server/modules/products/index.js +2 -1
  66. package/lib/shared/receipt/small-ticket.js +15 -7
  67. package/lib/shared/sales/loadSalesOrderSnapshot.js +1 -1
  68. package/lib/solution/BaseSales/index.d.ts +4 -0
  69. package/lib/solution/BaseSales/index.js +68 -2
  70. package/lib/solution/BaseSales/types.d.ts +2 -1
  71. package/lib/solution/BaseSales/utils/parseSalesResponse.d.ts +3 -1
  72. package/lib/solution/BaseSales/utils/parseSalesResponse.js +4 -0
  73. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +16 -8
  74. package/lib/solution/BookingTicket/index.d.ts +15 -1
  75. package/lib/solution/BookingTicket/index.js +132 -3
  76. package/lib/solution/UnifiedBookingSales/index.js +1 -1
  77. package/package.json +1 -1
@@ -4,7 +4,7 @@ import type { ScanOrderLogInput as BaseSalesLogInput, ScanOrderLoggerProviderCon
4
4
  import type { QuantityCheckResult, QuantityLimitResult } from '../../model/strategy/adapter/itemRule';
5
5
  import type { QuotationCustomerScopeInfo } from '../../modules/Quotation/types';
6
6
  import type { PaymentMethod } from '../../modules/Payment/types';
7
- import type { OrderPaymentSource } from '../../modules/Order/types';
7
+ import type { OrderHolderRelation, OrderPaymentSource } from '../../modules/Order/types';
8
8
  import type { SubmitPayloadEnhancer } from '../../modules/Order/utils';
9
9
  /**
10
10
  * BaseSales 流程 hook 后缀。
@@ -277,6 +277,7 @@ export interface BaseSalesTempOrder {
277
277
  contacts: any[];
278
278
  contacts_info: Record<string, any> | null;
279
279
  holder: Record<string, any> | null;
280
+ holder_relations?: OrderHolderRelation[];
280
281
  metadata: Record<string, any>;
281
282
  _extend?: {
282
283
  productsByUid?: Record<string, Record<string, any>>;
@@ -14,7 +14,7 @@
14
14
  * - 不在此处发明等价关系;UI 侧(ticketBooking)若需要别的字段,由 view-model 适配层做转换
15
15
  */
16
16
  import type { BaseSalesOrderProduct } from '../types';
17
- import type { OrderMetaList } from '../../../modules/Order/types';
17
+ import type { OrderHolderRelation, OrderMetaList } from '../../../modules/Order/types';
18
18
  export interface ISalesDetailHeader {
19
19
  order_id: number | string | null;
20
20
  order_number?: string;
@@ -121,6 +121,8 @@ export interface ISalesDetail {
121
121
  header: ISalesDetailHeader;
122
122
  /** 商品行快照(保留 tempOrder / 后端详情原字段) */
123
123
  products: BaseSalesOrderProduct[];
124
+ /** 非预约商品 Holder 关系,保留关系及 metadata 的扩展字段。 */
125
+ holder_relations?: OrderHolderRelation[];
124
126
  /** 全部 bookings,按服务端原始顺序输出(含 root + child) */
125
127
  bookings: ISalesBooking[];
126
128
  /** root booking(parent_id === 0),多个时取首个,无则为 null */
@@ -25,6 +25,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
25
25
 
26
26
  import { normalizeOrderCollections } from "../../../modules/Order/utils/orderCollectionIdentity";
27
27
  import { isFulfillmentTimingBooking } from "../../../modules/Order/pickupTiming";
28
+ import { cloneDeep } from 'lodash-es';
28
29
  /** OrderData 中除大数组外的"顶层 header 字段"白名单,按需扩展。 */
29
30
  var HEADER_KEYS = ['order_id', 'order_number', 'shop_order_number', 'shop_full_order_number', 'type', 'business_code', 'platform', 'sales_channel', 'order_sales_channel', 'vouchers', 'status', 'payment_status', 'shipping_status', 'customer_id', 'customer_name', 'country_calling_code', 'phone', 'email', 'is_price_include_tax', 'tax_title', 'tax_country_code', 'currency_code', 'currency_symbol', 'currency_format', 'is_deposit', 'deposit_amount', 'shop_discount', 'surcharge_fee', 'note', 'schedule_date', 'created_at', 'updated_at', 'order_meta_list', 'metadata', 'total_amount', 'shop_id', 'create_date', 'holder', 'relation_forms', 'contacts', 'contacts_info'];
30
31
  function pickHeader(raw) {
@@ -144,9 +145,12 @@ export function parseSalesResponse(input) {
144
145
  return _objectSpread({}, d || {});
145
146
  }) : [];
146
147
  var summary = raw !== null && raw !== void 0 && raw.summary && _typeof(raw.summary) === 'object' ? _objectSpread({}, raw.summary) : {};
147
- return {
148
+ return _objectSpread(_objectSpread({
148
149
  header: pickHeader(raw),
149
- products: products,
150
+ products: products
151
+ }, Array.isArray(raw === null || raw === void 0 ? void 0 : raw.holder_relations) ? {
152
+ holder_relations: cloneDeep(raw.holder_relations)
153
+ } : {}), {}, {
150
154
  bookings: bookings,
151
155
  rootBooking: rootBooking,
152
156
  bookingsByProductUid: bookingsByProductUid,
@@ -156,5 +160,5 @@ export function parseSalesResponse(input) {
156
160
  customer: pickCustomer(raw),
157
161
  summary: summary,
158
162
  raw: raw
159
- };
163
+ });
160
164
  }
@@ -12,6 +12,8 @@ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symb
12
12
  function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
13
13
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
14
14
  import { resolveWeighedSourcePrice, withOriginalBundleOptionPrices } from "../../../modules/Order/utils/weighedProduct";
15
+ import { resolveProductHolderConfig } from "../../../modules/Holder/utils";
16
+ import { isBookingProduct } from "../../../modules/BookingContext/utils/serviceTimes";
15
17
  import { composeLinePrice, getBundleSellingMagnitude, normalizeProductSkuOptions, sumOptionUnitPrice } from "../../../modules/Order/utils";
16
18
  import { buildManualProductDiscountItem, mergeManualProductDiscountIntoList, resolveManualDiscountOriginTotal, resolveManualDiscountReasonFromSources, shouldBuildManualProductDiscount } from "../../../modules/Order/utils/manualProductDiscount";
17
19
  function toNumber(value) {
@@ -168,7 +170,7 @@ function findVariantById(origin, variantId) {
168
170
  * 注意:这里不生成 identity,缺省时由 OrderModule 自动补齐。
169
171
  */
170
172
  export function transformBaseProductToOrderProduct(params) {
171
- var _ref12, _ref13, _ref14, _payload$product_id, _ref15, _ref16, _payload$product_vari, _payload$_origin, _payload$_origin2, _payload$metadata, _sourceProduct$metada, _callbackOrigin$metad, _origin$metadata, _payload$metadata2, _payload$_extend, _sourceProduct$metada2, _sourceProduct$_exten, _callbackOrigin$metad2, _callbackOrigin$_exte, _payload$_dataVariant, _sourceProduct$_dataV, _callbackOrigin$_data, _origin$_dataVariant, _ref17, _findVariantById, _origin$production_co, _ref18, _ref19, _ref20, _ref21, _ref22, _matchedVariant$price, _payload$product_sku, _payload$_extend$weig, _payload$_extend2, _origin$_extend, _ref23, _ref24, _payload$price, _ref25, _payload$line_total, _payload$_extend3, _ref26, _ref27, _payload$product_sku$, _payload$product_sku2, _payload$bundle, _payload$quantity, _payload$_extend4, _extend, _extend2, _ref28, _ref29, _origin$base_price, _ref30, _ref31, _payload$line_total2, _payload$_extend5, _payload$_extend6, _extend3, _payload$_extend7, _payload$_extend8, _ref32, _ref33, _payload$tax_fee, _ref34, _ref35, _payload$is_charge_ta;
173
+ var _ref12, _ref13, _ref14, _payload$product_id, _ref15, _ref16, _payload$product_vari, _payload$_origin, _payload$_origin2, _payload$metadata, _sourceProduct$metada, _callbackOrigin$metad, _origin$metadata, _payload$metadata2, _payload$_extend, _sourceProduct$metada2, _sourceProduct$_exten, _callbackOrigin$metad2, _callbackOrigin$_exte, _payload$_dataVariant, _sourceProduct$_dataV, _callbackOrigin$_data, _origin$_dataVariant, _ref17, _findVariantById, _origin$production_co, _ref18, _ref19, _ref20, _ref21, _ref22, _matchedVariant$price, _payload$product_sku, _payload$_extend$weig, _payload$_extend2, _origin$_extend, _ref23, _ref24, _payload$price, _ref25, _payload$line_total, _payload$_extend3, _ref26, _ref27, _payload$product_sku$, _payload$product_sku2, _payload$bundle, _payload$quantity, _payload$_extend4, _extend, _extend2, _ref28, _ref29, _origin$base_price, _ref30, _ref31, _payload$line_total2, _payload$_extend5, _payload$_extend6, _extend3, _payload$_extend7, _payload$_extend8, _find, _resolveProductHolder, _ref32, _ref33, _payload$tax_fee, _ref34, _ref35, _payload$is_charge_ta;
172
174
  var payload = params.payload,
173
175
  _params$fallbackProdu = params.fallbackProductId,
174
176
  fallbackProductId = _params$fallbackProdu === void 0 ? null : _params$fallbackProdu;
@@ -242,6 +244,9 @@ export function transformBaseProductToOrderProduct(params) {
242
244
  });
243
245
  var derivedMainSelling = hasExplicitLineTotal ? Number(lineCompositeTotal) - Number(bundleOnlyComposite) : Number(mainProductOriginalPrice);
244
246
  var mainProductSellingPrice = toPriceString(Number.isFinite(derivedMainSelling) && derivedMainSelling >= 0 ? derivedMainSelling : Number(mainProductOriginalPrice));
247
+ var holderRelations = (_find = [payload._extend, callbackOrigin === null || callbackOrigin === void 0 ? void 0 : callbackOrigin._extend, sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct._extend].find(function (source) {
248
+ return Array.isArray(source === null || source === void 0 ? void 0 : source.holder_relations);
249
+ })) === null || _find === void 0 ? void 0 : _find.holder_relations;
245
250
  var metadata = _objectSpread(_objectSpread(_objectSpread(_objectSpread({
246
251
  unique: payload.unique,
247
252
  session: payload.session,
@@ -256,7 +261,7 @@ export function transformBaseProductToOrderProduct(params) {
256
261
  main_product_selling_price: mainProductSellingPrice,
257
262
  main_product_original_price: mainProductOriginalPrice,
258
263
  price_schema_version: 2,
259
- holder_config: sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.holder_config
264
+ holder_config: (_resolveProductHolder = resolveProductHolderConfig(sourceProduct)) !== null && _resolveProductHolder !== void 0 ? _resolveProductHolder : undefined
260
265
  }, dataVariantIds !== undefined ? {
261
266
  data_variant_ids: dataVariantIds
262
267
  } : {}), selectedSettlementSnapshot ? {
@@ -275,7 +280,7 @@ export function transformBaseProductToOrderProduct(params) {
275
280
  var productTitle = _objectSpread(_objectSpread({}, productTitleI18n), {}, {
276
281
  original: productTitleI18n.original || (sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.original_title) || (sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.title) || ''
277
282
  });
278
- return _objectSpread(_objectSpread({
283
+ return _objectSpread(_objectSpread(_objectSpread({
279
284
  product_id: productId,
280
285
  product_variant_id: productVariantId,
281
286
  production_code: productionCode,
@@ -294,7 +299,12 @@ export function transformBaseProductToOrderProduct(params) {
294
299
  original_price: lineOriginalPrice,
295
300
  tax_fee: toPriceString((_ref32 = (_ref33 = (_payload$tax_fee = payload.tax_fee) !== null && _payload$tax_fee !== void 0 ? _payload$tax_fee : matchedVariant === null || matchedVariant === void 0 ? void 0 : matchedVariant.tax_fee) !== null && _ref33 !== void 0 ? _ref33 : origin === null || origin === void 0 ? void 0 : origin.tax_fee) !== null && _ref32 !== void 0 ? _ref32 : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.tax_fee, '0.00'),
296
301
  is_charge_tax: toNumber((_ref34 = (_ref35 = (_payload$is_charge_ta = payload.is_charge_tax) !== null && _payload$is_charge_ta !== void 0 ? _payload$is_charge_ta : matchedVariant === null || matchedVariant === void 0 ? void 0 : matchedVariant.is_charge_tax) !== null && _ref35 !== void 0 ? _ref35 : origin === null || origin === void 0 ? void 0 : origin.is_charge_tax) !== null && _ref34 !== void 0 ? _ref34 : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.is_charge_tax, 0),
297
- metadata: metadata,
302
+ metadata: metadata
303
+ }, holderRelations !== undefined && !isBookingProduct(origin) && !isBookingProduct(payload) ? {
304
+ _extend: {
305
+ holder_relations: holderRelations
306
+ }
307
+ } : {}), {}, {
298
308
  note: payload.note != null ? String(payload.note) : '',
299
309
  product_title: productTitle,
300
310
  product_cover: firstNonBlank(matchedVariant === null || matchedVariant === void 0 ? void 0 : matchedVariant.cover, sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.cover),
@@ -32,6 +32,7 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
32
32
  private orderCustomerDiscountRefreshCustomerId;
33
33
  private orderCustomerDiscountRefreshTarget;
34
34
  private orderCustomerPromotionRefreshInFlight;
35
+ private orderCustomerContactRequest;
35
36
  private readonly customerResolveRequests;
36
37
  protected loadOpenDataInFlight: Promise<OpenDataConfig> | null;
37
38
  protected loadOpenDataInFlightTarget: string | null;
@@ -62,6 +63,7 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
62
63
  private getIdGeneratorPlugin;
63
64
  protected loadOpenDataConfig(): Promise<OpenDataConfig | null>;
64
65
  getOpenData(): Promise<OpenDataConfig | null>;
66
+ protected loadContactInfoOpenData(): Promise<OpenDataConfig | null>;
65
67
  protected loadFulfillmentItemRuleOpenData(): Promise<OpenDataConfig | null>;
66
68
  getInvoiceLayoutConfig(): Promise<InvoiceLayoutConfig>;
67
69
  getInvoiceTemplateSettings(): Promise<InvoiceTemplateSettings>;
@@ -281,6 +283,16 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
281
283
  setOrderCustomer(customer: ICustomer | null, options?: {
282
284
  source?: OrderCustomerChangePayload['source'];
283
285
  }): void;
286
+ private resetOrderCustomerContactInfo;
287
+ /** Explicit edits, including clearing the contact, must win over a pending default. */
288
+ updateTempOrderContactsInfo(contact: Record<string, any> | null): Record<string, any> | null;
289
+ private getCustomerContactScope;
290
+ private getCustomerContactOrderKey;
291
+ replaceTempOrder(...args: Parameters<BaseSalesImpl['replaceTempOrder']>): Promise<import("../../modules/Order/types").OrderTempOrder>;
292
+ private applyDefaultOrderCustomerContactInfo;
293
+ private prefillOrderCustomerContactInfo;
294
+ protected waitForOrderCustomerContactInfo(): Promise<void>;
295
+ validateContactInfo(): Promise<void>;
284
296
  /**
285
297
  * 读取 tempOrder 上的下单客户协议字段;customer_id 缺失时返回 null。
286
298
  */
@@ -292,7 +304,9 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
292
304
  /**
293
305
  * 清空下单客户(协议字段 + snapshot)。
294
306
  */
295
- clearOrderCustomer(): void;
307
+ clearOrderCustomer(options?: {
308
+ preserveContactInfo?: boolean;
309
+ }): void;
296
310
  /**
297
311
  * 重置 tempOrder,并同步清空下单客户运行态。
298
312
  *