@pisell/pisellos 2.2.147 → 2.2.149

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 (247) hide show
  1. package/dist/apis/picoding.d.ts +0 -0
  2. package/dist/apis/picoding.js +1 -0
  3. package/dist/model/strategy/adapter/index.d.ts +2 -0
  4. package/dist/model/strategy/adapter/index.js +3 -1
  5. package/dist/model/strategy/adapter/itemRule/adapter.d.ts +67 -0
  6. package/dist/model/strategy/adapter/itemRule/adapter.js +483 -0
  7. package/dist/model/strategy/adapter/itemRule/evaluator.d.ts +43 -0
  8. package/dist/model/strategy/adapter/itemRule/evaluator.js +169 -0
  9. package/dist/model/strategy/adapter/itemRule/examples.d.ts +79 -0
  10. package/dist/model/strategy/adapter/itemRule/examples.js +382 -0
  11. package/dist/model/strategy/adapter/itemRule/index.d.ts +5 -0
  12. package/dist/model/strategy/adapter/itemRule/index.js +5 -0
  13. package/dist/model/strategy/adapter/itemRule/type.d.ts +225 -0
  14. package/dist/model/strategy/adapter/itemRule/type.js +101 -0
  15. package/dist/modules/Cart/types.d.ts +2 -0
  16. package/dist/modules/Cart/utils/cartProduct.js +22 -1
  17. package/dist/modules/Cart/utils/changePrice.js +6 -0
  18. package/dist/modules/Date/index.d.ts +1 -1
  19. package/dist/modules/Date/index.js +16 -8
  20. package/dist/modules/Date/types.d.ts +3 -1
  21. package/dist/modules/OpenData/index.d.ts +24 -0
  22. package/dist/modules/OpenData/index.js +173 -0
  23. package/dist/modules/OpenData/types.d.ts +73 -0
  24. package/dist/modules/OpenData/types.js +1 -0
  25. package/dist/modules/OpenData/utils.d.ts +2 -0
  26. package/dist/modules/OpenData/utils.js +75 -0
  27. package/dist/modules/Order/index.d.ts +171 -1
  28. package/dist/modules/Order/index.js +2052 -112
  29. package/dist/modules/Order/types.d.ts +441 -20
  30. package/dist/modules/Order/types.js +23 -0
  31. package/dist/modules/Order/utils.d.ts +120 -0
  32. package/dist/modules/Order/utils.js +653 -2
  33. package/dist/modules/Product/utils.js +2 -2
  34. package/dist/modules/ProductList/index.js +2 -1
  35. package/dist/modules/Quotation/index.d.ts +8 -1
  36. package/dist/modules/Quotation/index.js +40 -10
  37. package/dist/modules/Quotation/types.d.ts +5 -0
  38. package/dist/modules/Rules/index.d.ts +3 -1
  39. package/dist/modules/Rules/index.js +136 -50
  40. package/dist/modules/Rules/types.d.ts +6 -0
  41. package/dist/modules/Rules/types.js +8 -0
  42. package/dist/modules/SalesSummary/index.d.ts +70 -0
  43. package/dist/modules/SalesSummary/index.js +175 -0
  44. package/dist/modules/SalesSummary/types.d.ts +64 -0
  45. package/dist/modules/SalesSummary/types.js +1 -0
  46. package/dist/modules/SalesSummary/utils.d.ts +34 -0
  47. package/dist/modules/SalesSummary/utils.js +488 -0
  48. package/dist/modules/ScanOrderLogger/index.d.ts +21 -0
  49. package/dist/modules/ScanOrderLogger/index.js +161 -0
  50. package/dist/modules/ScanOrderLogger/providers/feishu.d.ts +2 -0
  51. package/dist/modules/ScanOrderLogger/providers/feishu.js +203 -0
  52. package/dist/modules/ScanOrderLogger/providers/grafana.d.ts +2 -0
  53. package/dist/modules/ScanOrderLogger/providers/grafana.js +50 -0
  54. package/dist/modules/ScanOrderLogger/types.d.ts +52 -0
  55. package/dist/modules/ScanOrderLogger/types.js +1 -0
  56. package/dist/modules/Schedule/getDateIsInSchedule.js +7 -7
  57. package/dist/modules/Schedule/index.d.ts +4 -13
  58. package/dist/modules/Schedule/index.js +6 -23
  59. package/dist/modules/Schedule/utils.d.ts +1 -1
  60. package/dist/modules/Summary/index.d.ts +3 -0
  61. package/dist/modules/Summary/index.js +134 -15
  62. package/dist/modules/Summary/types.d.ts +7 -0
  63. package/dist/modules/Summary/utils.d.ts +104 -1
  64. package/dist/modules/Summary/utils.js +1116 -13
  65. package/dist/modules/index.d.ts +4 -0
  66. package/dist/modules/index.js +5 -1
  67. package/dist/server/index.d.ts +41 -4
  68. package/dist/server/index.js +900 -405
  69. package/dist/server/modules/order/index.d.ts +10 -2
  70. package/dist/server/modules/order/index.js +251 -196
  71. package/dist/server/modules/products/index.d.ts +26 -0
  72. package/dist/server/modules/products/index.js +618 -338
  73. package/dist/server/modules/products/types.d.ts +5 -1
  74. package/dist/solution/BaseSales/index.d.ts +175 -0
  75. package/dist/solution/BaseSales/index.js +1293 -0
  76. package/dist/solution/BaseSales/types.d.ts +305 -0
  77. package/dist/solution/BaseSales/types.js +38 -0
  78. package/dist/solution/BaseSales/utils/parseSalesResponse.d.ts +143 -0
  79. package/dist/solution/BaseSales/utils/parseSalesResponse.js +159 -0
  80. package/dist/solution/BaseSales/utils.d.ts +40 -0
  81. package/dist/solution/BaseSales/utils.js +222 -0
  82. package/dist/solution/BookingByStep/index.d.ts +14 -0
  83. package/dist/solution/BookingByStep/index.js +699 -212
  84. package/dist/solution/BookingByStep/types.d.ts +3 -1
  85. package/dist/solution/BookingByStep/types.js +5 -1
  86. package/dist/solution/BookingByStep/utils/capacity.js +1 -1
  87. package/dist/solution/BookingByStep/utils/resources.js +6 -1
  88. package/dist/solution/BookingTicket/index.d.ts +113 -15
  89. package/dist/solution/BookingTicket/index.js +534 -196
  90. package/dist/solution/BookingTicket/types.d.ts +69 -6
  91. package/dist/solution/BookingTicket/types.js +40 -9
  92. package/dist/solution/BookingTicket/utils/bookingStatus.d.ts +37 -0
  93. package/dist/solution/BookingTicket/utils/bookingStatus.js +66 -0
  94. package/dist/solution/BookingTicket/utils/cartView.d.ts +26 -0
  95. package/dist/solution/BookingTicket/utils/cartView.js +84 -0
  96. package/dist/solution/Sales/index.d.ts +1 -0
  97. package/dist/solution/Sales/index.js +1 -0
  98. package/dist/solution/ScanOrder/index.d.ts +146 -0
  99. package/dist/solution/ScanOrder/index.js +3029 -0
  100. package/dist/solution/ScanOrder/types.d.ts +305 -0
  101. package/dist/solution/ScanOrder/types.js +35 -0
  102. package/dist/solution/ScanOrder/utils.d.ts +167 -0
  103. package/dist/solution/ScanOrder/utils.js +768 -0
  104. package/dist/solution/ShopDiscount/index.d.ts +2 -0
  105. package/dist/solution/ShopDiscount/index.js +9 -5
  106. package/dist/solution/ShopDiscount/types.d.ts +4 -0
  107. package/dist/solution/VenueBooking/index.d.ts +197 -0
  108. package/dist/solution/VenueBooking/index.js +3411 -0
  109. package/dist/solution/VenueBooking/sales-section-4-annotated.json +343 -0
  110. package/dist/solution/VenueBooking/types.d.ts +153 -0
  111. package/dist/solution/VenueBooking/types.js +21 -0
  112. package/dist/solution/VenueBooking/utils/dateSummary.d.ts +11 -0
  113. package/dist/solution/VenueBooking/utils/dateSummary.js +104 -0
  114. package/dist/solution/VenueBooking/utils/resource.d.ts +14 -0
  115. package/dist/solution/VenueBooking/utils/resource.js +130 -0
  116. package/dist/solution/VenueBooking/utils/slotMerge.d.ts +34 -0
  117. package/dist/solution/VenueBooking/utils/slotMerge.js +224 -0
  118. package/dist/solution/VenueBooking/utils/timeSlot.d.ts +32 -0
  119. package/dist/solution/VenueBooking/utils/timeSlot.js +453 -0
  120. package/dist/solution/VenueBooking/utils.d.ts +1 -0
  121. package/dist/solution/VenueBooking/utils.js +1 -0
  122. package/dist/solution/index.d.ts +3 -0
  123. package/dist/solution/index.js +4 -1
  124. package/lib/apis/picoding.d.ts +0 -0
  125. package/lib/apis/picoding.js +0 -0
  126. package/lib/model/strategy/adapter/index.d.ts +2 -0
  127. package/lib/model/strategy/adapter/index.js +6 -0
  128. package/lib/model/strategy/adapter/itemRule/adapter.d.ts +67 -0
  129. package/lib/model/strategy/adapter/itemRule/adapter.js +377 -0
  130. package/lib/model/strategy/adapter/itemRule/evaluator.d.ts +43 -0
  131. package/lib/model/strategy/adapter/itemRule/evaluator.js +124 -0
  132. package/lib/model/strategy/adapter/itemRule/examples.d.ts +79 -0
  133. package/lib/model/strategy/adapter/itemRule/examples.js +316 -0
  134. package/lib/model/strategy/adapter/itemRule/index.d.ts +5 -0
  135. package/lib/model/strategy/adapter/itemRule/index.js +60 -0
  136. package/lib/model/strategy/adapter/itemRule/type.d.ts +225 -0
  137. package/lib/model/strategy/adapter/itemRule/type.js +46 -0
  138. package/lib/model/strategy/adapter/promotion/index.js +49 -0
  139. package/lib/modules/Cart/types.d.ts +2 -0
  140. package/lib/modules/Cart/utils/cartProduct.js +17 -1
  141. package/lib/modules/Cart/utils/changePrice.js +5 -0
  142. package/lib/modules/Date/index.d.ts +1 -1
  143. package/lib/modules/Date/index.js +7 -1
  144. package/lib/modules/Date/types.d.ts +3 -1
  145. package/lib/modules/OpenData/index.d.ts +24 -0
  146. package/lib/modules/OpenData/index.js +119 -0
  147. package/lib/modules/OpenData/types.d.ts +73 -0
  148. package/lib/modules/OpenData/types.js +17 -0
  149. package/lib/modules/OpenData/utils.d.ts +2 -0
  150. package/lib/modules/OpenData/utils.js +111 -0
  151. package/lib/modules/Order/index.d.ts +171 -1
  152. package/lib/modules/Order/index.js +1396 -5
  153. package/lib/modules/Order/types.d.ts +441 -20
  154. package/lib/modules/Order/types.js +1 -0
  155. package/lib/modules/Order/utils.d.ts +120 -0
  156. package/lib/modules/Order/utils.js +562 -2
  157. package/lib/modules/Product/utils.js +2 -2
  158. package/lib/modules/ProductList/index.js +2 -1
  159. package/lib/modules/Quotation/index.d.ts +8 -1
  160. package/lib/modules/Quotation/index.js +33 -4
  161. package/lib/modules/Quotation/types.d.ts +5 -0
  162. package/lib/modules/Rules/index.d.ts +3 -1
  163. package/lib/modules/Rules/index.js +46 -6
  164. package/lib/modules/Rules/types.d.ts +6 -0
  165. package/lib/modules/Rules/types.js +11 -2
  166. package/lib/modules/SalesSummary/index.d.ts +70 -0
  167. package/lib/modules/SalesSummary/index.js +106 -0
  168. package/lib/modules/SalesSummary/types.d.ts +64 -0
  169. package/lib/modules/SalesSummary/types.js +17 -0
  170. package/lib/modules/SalesSummary/utils.d.ts +34 -0
  171. package/lib/modules/SalesSummary/utils.js +430 -0
  172. package/lib/modules/ScanOrderLogger/index.d.ts +21 -0
  173. package/lib/modules/ScanOrderLogger/index.js +135 -0
  174. package/lib/modules/ScanOrderLogger/providers/feishu.d.ts +2 -0
  175. package/lib/modules/ScanOrderLogger/providers/feishu.js +148 -0
  176. package/lib/modules/ScanOrderLogger/providers/grafana.d.ts +2 -0
  177. package/lib/modules/ScanOrderLogger/providers/grafana.js +52 -0
  178. package/lib/modules/ScanOrderLogger/types.d.ts +52 -0
  179. package/lib/modules/ScanOrderLogger/types.js +17 -0
  180. package/lib/modules/Schedule/getDateIsInSchedule.js +5 -5
  181. package/lib/modules/Schedule/index.d.ts +4 -13
  182. package/lib/modules/Schedule/index.js +4 -15
  183. package/lib/modules/Schedule/utils.d.ts +1 -1
  184. package/lib/modules/Summary/index.d.ts +3 -0
  185. package/lib/modules/Summary/index.js +61 -2
  186. package/lib/modules/Summary/types.d.ts +7 -0
  187. package/lib/modules/Summary/utils.d.ts +104 -1
  188. package/lib/modules/Summary/utils.js +659 -8
  189. package/lib/modules/index.d.ts +4 -0
  190. package/lib/modules/index.js +9 -1
  191. package/lib/server/index.d.ts +41 -4
  192. package/lib/server/index.js +272 -10
  193. package/lib/server/modules/order/index.d.ts +10 -2
  194. package/lib/server/modules/order/index.js +31 -4
  195. package/lib/server/modules/products/index.d.ts +26 -0
  196. package/lib/server/modules/products/index.js +174 -22
  197. package/lib/server/modules/products/types.d.ts +5 -1
  198. package/lib/solution/BaseSales/index.d.ts +175 -0
  199. package/lib/solution/BaseSales/index.js +655 -0
  200. package/lib/solution/BaseSales/types.d.ts +305 -0
  201. package/lib/solution/BaseSales/types.js +40 -0
  202. package/lib/solution/BaseSales/utils/parseSalesResponse.d.ts +143 -0
  203. package/lib/solution/BaseSales/utils/parseSalesResponse.js +160 -0
  204. package/lib/solution/BaseSales/utils.d.ts +40 -0
  205. package/lib/solution/BaseSales/utils.js +200 -0
  206. package/lib/solution/BookingByStep/index.d.ts +14 -0
  207. package/lib/solution/BookingByStep/index.js +469 -91
  208. package/lib/solution/BookingByStep/types.d.ts +3 -1
  209. package/lib/solution/BookingByStep/types.js +10 -0
  210. package/lib/solution/BookingByStep/utils/capacity.js +1 -1
  211. package/lib/solution/BookingByStep/utils/resources.js +5 -2
  212. package/lib/solution/BookingTicket/index.d.ts +113 -15
  213. package/lib/solution/BookingTicket/index.js +253 -61
  214. package/lib/solution/BookingTicket/types.d.ts +69 -6
  215. package/lib/solution/BookingTicket/types.js +16 -14
  216. package/lib/solution/BookingTicket/utils/bookingStatus.d.ts +37 -0
  217. package/lib/solution/BookingTicket/utils/bookingStatus.js +65 -0
  218. package/lib/solution/BookingTicket/utils/cartView.d.ts +26 -0
  219. package/lib/solution/BookingTicket/utils/cartView.js +103 -0
  220. package/lib/solution/Sales/index.d.ts +1 -0
  221. package/lib/solution/ScanOrder/index.d.ts +146 -0
  222. package/lib/solution/ScanOrder/index.js +1820 -0
  223. package/lib/solution/ScanOrder/types.d.ts +305 -0
  224. package/lib/solution/ScanOrder/types.js +36 -0
  225. package/lib/solution/ScanOrder/utils.d.ts +167 -0
  226. package/lib/solution/ScanOrder/utils.js +639 -0
  227. package/lib/solution/ShopDiscount/index.d.ts +2 -0
  228. package/lib/solution/ShopDiscount/index.js +9 -4
  229. package/lib/solution/ShopDiscount/types.d.ts +4 -0
  230. package/lib/solution/VenueBooking/index.d.ts +197 -0
  231. package/lib/solution/VenueBooking/index.js +1892 -0
  232. package/lib/solution/VenueBooking/sales-section-4-annotated.json +343 -0
  233. package/lib/solution/VenueBooking/types.d.ts +153 -0
  234. package/lib/solution/VenueBooking/types.js +44 -0
  235. package/lib/solution/VenueBooking/utils/dateSummary.d.ts +11 -0
  236. package/lib/solution/VenueBooking/utils/dateSummary.js +110 -0
  237. package/lib/solution/VenueBooking/utils/resource.d.ts +14 -0
  238. package/lib/solution/VenueBooking/utils/resource.js +91 -0
  239. package/lib/solution/VenueBooking/utils/slotMerge.d.ts +34 -0
  240. package/lib/solution/VenueBooking/utils/slotMerge.js +225 -0
  241. package/lib/solution/VenueBooking/utils/timeSlot.d.ts +32 -0
  242. package/lib/solution/VenueBooking/utils/timeSlot.js +339 -0
  243. package/lib/solution/VenueBooking/utils.d.ts +1 -0
  244. package/lib/solution/VenueBooking/utils.js +69 -0
  245. package/lib/solution/index.d.ts +3 -0
  246. package/lib/solution/index.js +7 -1
  247. package/package.json +1 -1
@@ -0,0 +1,305 @@
1
+ import { OrderModule, ProductList, SalesSummaryModule, ScanOrderLoggerModule as BaseSalesLoggerModule, ScheduleModule } from '../../modules';
2
+ import type { ScanOrderLogInput as BaseSalesLogInput, ScanOrderLoggerProviderConfig as BaseSalesLoggerProviderConfig, ScanOrderLoggerProviderType as BaseSalesLoggerProviderType } from '../../modules/ScanOrderLogger/types';
3
+ import type { QuantityCheckResult, QuantityLimitResult } from '../../model/strategy/adapter/itemRule';
4
+ /**
5
+ * BaseSales 流程 hook 后缀。
6
+ * 完整事件名应由当前模块名动态拼接,避免多个实例共享固定事件 key。
7
+ */
8
+ export declare const BaseSalesHookNames: {
9
+ readonly onInited: "onInited";
10
+ readonly onDestroy: "onDestroy";
11
+ readonly onRetryInit: "onRetryInit";
12
+ readonly onRefresh: "onRefresh";
13
+ readonly onCartValidationChanged: "onCartValidationChanged";
14
+ };
15
+ export type BaseSalesHookName = typeof BaseSalesHookNames[keyof typeof BaseSalesHookNames];
16
+ export declare function createBaseSalesHook(moduleName: string, hookName: BaseSalesHookName): string;
17
+ export type BaseSalesStatus = 'idle' | 'initializing' | 'ready' | 'error';
18
+ export type BaseSalesPaymentStatus = 'paid' | 'partially_paid' | 'unpaid' | 'payment_processing' | string;
19
+ export interface BaseSalesEntryContext {
20
+ biz: string;
21
+ mode: 'scan' | 'append';
22
+ resourceId?: string;
23
+ sourceOrderId?: string;
24
+ }
25
+ export interface BaseSalesConfig {
26
+ orderSource: 'local' | 'remote';
27
+ scanTimeout: number;
28
+ allowAppend: boolean;
29
+ maxAppendCount: number;
30
+ features: {
31
+ autoMerge: boolean;
32
+ verifyResource: boolean;
33
+ };
34
+ }
35
+ export interface BaseSalesOrderProductIdentity {
36
+ product_id: number | null;
37
+ product_variant_id: number;
38
+ /** @deprecated 行级唯一值统一使用 metadata.unique_identification_number */
39
+ identity_key?: string;
40
+ unique_identification_number?: string;
41
+ /** 参与合并/匹配;与 remove 通配语义见 isSkuOnlyDeleteIdentity */
42
+ product_option_item?: any[];
43
+ product_bundle?: any[];
44
+ }
45
+ export interface BaseSalesOrderProduct extends BaseSalesOrderProductIdentity {
46
+ order_detail_id: number | null;
47
+ num: number;
48
+ product_option_item: any[];
49
+ /**
50
+ * 券后 **行 composite 单价** = `metadata.main_product_selling_price`
51
+ * + Σ((bundle.bundle_selling_price ?? bundle.price) × (bundle.num ?? 1))
52
+ *
53
+ * 新语义 v2 下 `metadata.main_product_selling_price` 已经**含 option**、含主商品折扣,
54
+ * 因此本字段不再叠加 option。未应用券时等同 `original_price`。
55
+ * Rules 钩子、主商品计税、Summary 统一读 metadata,不以此字段反推。
56
+ */
57
+ selling_price: string;
58
+ /**
59
+ * 券前 **行 composite 单价** = `metadata.main_product_original_price`
60
+ * + Σ(bundle 原价 × num)
61
+ *
62
+ * 新语义 v2 下 `metadata.main_product_original_price` 已经**含 option**、不含折扣。
63
+ * 不承载后台划线价语义。
64
+ */
65
+ original_price: string;
66
+ tax_fee: string;
67
+ is_charge_tax: number;
68
+ discount_list: any[];
69
+ product_bundle: any[];
70
+ /** 关联 booking.metadata.unique_identification_number */
71
+ booking_uid?: string;
72
+ /**
73
+ * 行级扩展 metadata。价格相关的权威字段:
74
+ *
75
+ * - `source_product_price`:主商品/variant 基础价(已应用报价单),**不含 option、不含折扣**。
76
+ * 是派生 `main_product_*` 的唯一源。variant 分支优先读 `metadata.origin.variant[vid].price`。
77
+ * - `main_product_original_price` = `source_product_price + Σ(option.price × option.num)`,
78
+ * **含 option、不含折扣**。
79
+ * - `main_product_selling_price` = `main_product_original_price − 主商品券 per-unit amount`,
80
+ * **含 option、含主商品折扣**。Rules 钩子 / Summary / 计税均以此为主商品权威源。
81
+ * - `price_schema_version`(当前 = 2):schema 版本 sentinel,用于跨端协商价格口径、
82
+ * 区分 v1 旧缓存以便 `normalizeOrderProduct` 触发迁移。
83
+ */
84
+ metadata: Record<string, any>;
85
+ /** 商品行备注(如顾客对单品的特殊要求) */
86
+ note?: string;
87
+ /** @deprecated UI/SDK 运行态数据迁移到 tempOrder._extend */
88
+ _origin?: Record<string, any>;
89
+ }
90
+ /**
91
+ * 出站 payload 版本的商品行。
92
+ *
93
+ * 与 tempOrder 内部 `BaseSalesOrderProduct` 的字段差异:
94
+ * - `product_option_item[*]`:内部为 `{ product_option_item_id, option_group_id, num, price, ... }`,
95
+ * 出站由 `normalizeSubmitProduct` 重命名为 `{ option_group_item_id, option_group_id, num }`
96
+ * (后端 checkout 协议;丢弃 `price` 等运行时辅助字段)。
97
+ * - `product_bundle[*].option[*]`:同上重命名规则。
98
+ *
99
+ * 运行时(UI 显示、加购合并、指纹、持久化)全部消费内部字段名 `product_option_item_id`,
100
+ * 仅在 SDK 提交边界做一次出站映射,不影响 opaque identity 契约。
101
+ */
102
+ export interface BaseSalesSubmitProduct extends Omit<BaseSalesOrderProduct, '_origin' | 'identity_key'> {
103
+ /**
104
+ * 出站兼容字段:SDK 内部不再消费 payment_price,
105
+ * 仅在提交后端时由 selling_price 派生,保持原有后端契约。
106
+ * 新语义 v2 下 selling_price 是 composite(含 option、含 bundle、含主商品折扣),
107
+ * 因此 payment_price 同样是 composite。
108
+ */
109
+ payment_price: string;
110
+ }
111
+ export interface BaseSalesSummary {
112
+ product_quantity: number;
113
+ product_original_amount: string;
114
+ product_amount: string;
115
+ product_expect_amount: string;
116
+ product_tax_fee: string;
117
+ shipping_fee: string;
118
+ shipping_tax_fee: string;
119
+ tax_fee: string;
120
+ surcharge_fee: string;
121
+ discount_amount: string;
122
+ deposit_amount: string;
123
+ deposit?: {
124
+ total: string;
125
+ deposit_policy_ids: number[];
126
+ hasDeposit: boolean;
127
+ };
128
+ expect_amount: string;
129
+ total_amount: string;
130
+ amount_gap: string;
131
+ rounding_amount: string;
132
+ pay_service_charge_amount: string;
133
+ tax_title?: string;
134
+ tax_rate?: number;
135
+ }
136
+ /**
137
+ * BaseSales 临时订单(runtime-clean 版本)
138
+ * 只保留运行时字段,不包含任何 __comment 字段
139
+ */
140
+ export interface BaseSalesTempOrder {
141
+ order_id: number | null;
142
+ /** @deprecated 资源运行态迁移到 Solution store */
143
+ relation_id?: string;
144
+ /** @deprecated 资源运行态迁移到 Solution store */
145
+ table_form_id?: string;
146
+ /** @deprecated 资源运行态迁移到 Solution store */
147
+ resource_id?: string;
148
+ external_sale_number: string;
149
+ order_number: string;
150
+ shop_order_number: string;
151
+ shop_full_order_number: string;
152
+ type: string;
153
+ business_code: string;
154
+ platform: string;
155
+ sales_channel: string;
156
+ order_sales_channel: string;
157
+ status: string;
158
+ payment_status: string;
159
+ shipping_status: string;
160
+ customer_id: number | null;
161
+ customer_name: string;
162
+ country_calling_code: string;
163
+ phone: string;
164
+ email: string;
165
+ is_price_include_tax: number;
166
+ tax_title: string;
167
+ tax_country_code: string;
168
+ currency_code: string;
169
+ currency_symbol: string;
170
+ currency_format: string;
171
+ is_deposit: number;
172
+ deposit_amount: string;
173
+ shop_discount: string;
174
+ surcharge_fee: string;
175
+ note: string;
176
+ buzzer?: string;
177
+ delivery_type?: string;
178
+ table_number?: Record<string, any>;
179
+ schedule_date: string;
180
+ created_at: string;
181
+ request_unique_idempotency_token?: string;
182
+ products: BaseSalesOrderProduct[];
183
+ bookings: any[];
184
+ payments: any[];
185
+ surcharges: any[];
186
+ discount_list: any[];
187
+ relation_forms: any[];
188
+ contacts: any[];
189
+ contacts_info: Record<string, any> | null;
190
+ holder: Record<string, any> | null;
191
+ metadata: Record<string, any>;
192
+ _extend?: {
193
+ productsByUid?: Record<string, Record<string, any>>;
194
+ [key: string]: any;
195
+ };
196
+ }
197
+ export interface BaseSalesSubmitPayload extends Omit<BaseSalesTempOrder, 'platform' | 'products' | '_extend' | 'shop_full_order_number'> {
198
+ platform: string;
199
+ request_unique_idempotency_token?: string;
200
+ form_record_ids?: Array<{
201
+ form_id: number | string;
202
+ form_record_id: number | string;
203
+ }>;
204
+ products: BaseSalesSubmitProduct[];
205
+ }
206
+ export type BaseSalesAvailabilityMode = 'idle' | 'shop_closed' | 'submit_disabled' | 'resource_busy' | 'additional_order_with_code' | 'additional_order';
207
+ export interface BaseSalesTableFormRecord {
208
+ policy?: string | null;
209
+ partyroom_booking?: string | null;
210
+ capacity?: number | string | null;
211
+ [key: string]: any;
212
+ }
213
+ export interface BaseSalesAvailabilityInfo {
214
+ mode: BaseSalesAvailabilityMode;
215
+ order_id?: string;
216
+ relation_id?: string;
217
+ table_form_id?: string;
218
+ deskmate_valid?: boolean;
219
+ errorTips?: string;
220
+ /** 透传 `availability.closed_behavior`,便于 UI 识别拦截类型(如 show_menu_disabled) */
221
+ closed_behavior?: string;
222
+ /** `/order/resource/occupy-detail` 返回的 `form_record` 原样透出 */
223
+ table_form_record?: BaseSalesTableFormRecord | null;
224
+ policy?: string | null;
225
+ partyroom_booking?: string | null;
226
+ /** 预约规则关联商品存在 custom 容量时,由 checkResourceAvailable 置为 1 */
227
+ requestEntryPax?: number;
228
+ /** 首个 `capacity.type === 'custom'` 商品里 `custom[0]` 的 min(人数下限) */
229
+ requestPaxMin?: number;
230
+ /** 首个 `capacity.type === 'custom'` 商品里 `custom[0]` 的 max(人数上限) */
231
+ requestPaxMax?: number;
232
+ }
233
+ /** `resource_capacity[i].capacity_list[j]` */
234
+ export interface BaseSalesResourceCapacitySlot {
235
+ start_at?: string;
236
+ end_at?: string;
237
+ pax?: number | string;
238
+ }
239
+ export interface BaseSalesResourceCapacity {
240
+ capacity?: number | string;
241
+ capacity_list?: BaseSalesResourceCapacitySlot[];
242
+ }
243
+ /** `/order/resource/occupy-detail` 单条 `occupy_details[i]` */
244
+ export interface BaseSalesResourceOccupyDetail {
245
+ form_record_id?: number | string | null;
246
+ form_id?: number | string | null;
247
+ order_id?: number | string | null;
248
+ last_order_id?: number | string | null;
249
+ resource_capacity?: BaseSalesResourceCapacity[] | null;
250
+ form_record?: BaseSalesTableFormRecord | null;
251
+ [key: string]: any;
252
+ }
253
+ export interface BaseSalesResourceOccupyDetailApiResponse {
254
+ status?: boolean;
255
+ code?: number;
256
+ message?: string;
257
+ data?: {
258
+ occupy_details?: BaseSalesResourceOccupyDetail[] | null;
259
+ } | null;
260
+ }
261
+ export type BaseSalesResourceSelectType = 'single' | 'multiple' | 'capacity';
262
+ export interface BaseSalesResourceState extends BaseSalesAvailabilityInfo {
263
+ relationId?: string;
264
+ tableFormId?: string;
265
+ currentOrderId?: string;
266
+ lastOrderId?: string;
267
+ allowSnack: boolean;
268
+ deskmateValid: boolean;
269
+ isExclusive: boolean;
270
+ isFull: boolean;
271
+ /** 来自首个预约规则商品 product_resource.resources 中与 form_id 匹配的 resource type */
272
+ resourceSelectType?: BaseSalesResourceSelectType;
273
+ raw: BaseSalesResourceOccupyDetail | null;
274
+ }
275
+ export interface BaseSalesState {
276
+ entryContext: BaseSalesEntryContext | null;
277
+ status: BaseSalesStatus;
278
+ config: Record<string, any> | null;
279
+ resource: BaseSalesResourceState | null;
280
+ flow: Record<string, any>;
281
+ error: string | null;
282
+ products?: ProductList;
283
+ order?: OrderModule;
284
+ salesSummary?: SalesSummaryModule;
285
+ baseSalesLogger?: BaseSalesLoggerModule;
286
+ schedule?: ScheduleModule;
287
+ itemRuleQuantityLimits: QuantityLimitResult[];
288
+ cartValidation: {
289
+ passed: boolean | null;
290
+ failures: QuantityCheckResult[];
291
+ };
292
+ entryPaxNumber: number | null;
293
+ }
294
+ export interface BaseSalesLoggerRuntimeConfig {
295
+ provider?: BaseSalesLoggerProviderType;
296
+ providerConfig?: BaseSalesLoggerProviderConfig;
297
+ }
298
+ export interface BaseSalesAddLogParams extends BaseSalesLogInput {
299
+ }
300
+ /** BaseSales.scanPromotionCode 对外的轻量结果(不含 discountList,UI 在 resolve 后调 getDiscountList) */
301
+ export interface BaseSalesScanCodeResult {
302
+ isAvailable: boolean;
303
+ type?: 'server' | string;
304
+ unavailableReason?: 'time_limit' | string;
305
+ }
@@ -0,0 +1,40 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // src/solution/BaseSales/types.ts
20
+ var types_exports = {};
21
+ __export(types_exports, {
22
+ BaseSalesHookNames: () => BaseSalesHookNames,
23
+ createBaseSalesHook: () => createBaseSalesHook
24
+ });
25
+ module.exports = __toCommonJS(types_exports);
26
+ var BaseSalesHookNames = {
27
+ onInited: "onInited",
28
+ onDestroy: "onDestroy",
29
+ onRetryInit: "onRetryInit",
30
+ onRefresh: "onRefresh",
31
+ onCartValidationChanged: "onCartValidationChanged"
32
+ };
33
+ function createBaseSalesHook(moduleName, hookName) {
34
+ return `${moduleName}:${hookName}`;
35
+ }
36
+ // Annotate the CommonJS export names for ESM import in node:
37
+ 0 && (module.exports = {
38
+ BaseSalesHookNames,
39
+ createBaseSalesHook
40
+ });
@@ -0,0 +1,143 @@
1
+ /**
2
+ * 把 `/order/sales/{id}` 响应(OrderData)解析为 ISalesDetail。
3
+ *
4
+ * - 纯函数:不依赖任何运行时模块/插件,便于单测与 view-model 适配
5
+ * - products 保留 tempOrder / 后端详情原字段,仅做浅拷贝,避免丢失 product_sku 等协议字段
6
+ * - bookings 平铺保留服务端原顺序,同时输出 byProductUid 反查表与 rootBooking
7
+ * - header 收敛"非数组顶层字段",便于 ticketBooking view-model 直接消费
8
+ *
9
+ * 设计原则参考 `.cursor/rules/data-field-semantics.mdc`:
10
+ * - 字段命名以《统一 Sales 数据协议》为准(OrderData 类型)
11
+ * - root booking 以 `parent_id === 0` 判定,沿用 ticketBooking 现有约定
12
+ * (`packages/private-materials/src/components/ticketBooking/index.tsx`:
13
+ * `booking.parent_id === 0 ? 'list' : 'detail'`)
14
+ * - 不在此处发明等价关系;UI 侧(ticketBooking)若需要别的字段,由 view-model 适配层做转换
15
+ */
16
+ import type { BaseSalesOrderProduct } from '../types';
17
+ export interface ISalesDetailHeader {
18
+ order_id: number | string | null;
19
+ order_number?: string;
20
+ shop_order_number?: string;
21
+ shop_full_order_number?: string;
22
+ type?: string;
23
+ business_code?: string;
24
+ platform?: string;
25
+ sales_channel?: string;
26
+ order_sales_channel?: string;
27
+ status?: string;
28
+ payment_status?: string;
29
+ shipping_status?: string;
30
+ customer_id?: number | string | null;
31
+ customer_name?: string;
32
+ country_calling_code?: string;
33
+ phone?: string;
34
+ email?: string;
35
+ is_price_include_tax?: 0 | 1;
36
+ tax_title?: string;
37
+ tax_country_code?: string;
38
+ currency_code?: string;
39
+ currency_symbol?: string;
40
+ currency_format?: string;
41
+ is_deposit?: 0 | 1;
42
+ deposit_amount?: string;
43
+ shop_discount?: string;
44
+ surcharge_fee?: string;
45
+ note?: string;
46
+ schedule_date?: string;
47
+ created_at?: string;
48
+ updated_at?: string | number;
49
+ metadata?: Record<string, any> | null;
50
+ total_amount?: string | number;
51
+ [key: string]: any;
52
+ }
53
+ export interface ISalesDetailCustomer {
54
+ id: number | string | null;
55
+ name: string;
56
+ phone?: string;
57
+ email?: string;
58
+ country_calling_code?: string;
59
+ [key: string]: any;
60
+ }
61
+ export interface ISalesBooking {
62
+ schedule_event_id?: number | null;
63
+ booking_id?: string;
64
+ appointment_status?: string;
65
+ status?: string;
66
+ start_date?: string;
67
+ start_time?: string;
68
+ end_date?: string;
69
+ end_time?: string;
70
+ duration?: number;
71
+ sub_type?: string;
72
+ number?: number;
73
+ resources?: any[];
74
+ product?: any;
75
+ relation_products?: any[];
76
+ relation_type?: string;
77
+ relation_id?: number;
78
+ parent_id?: number | null;
79
+ item_type?: string;
80
+ product_uid?: string;
81
+ metadata?: Record<string, any> | null;
82
+ [key: string]: any;
83
+ }
84
+ export interface ISalesPayment {
85
+ order_payment_id?: number | null;
86
+ custom_payment_id?: number;
87
+ code?: string;
88
+ name?: string;
89
+ type?: string;
90
+ voucher_id?: number | null;
91
+ amount: string;
92
+ origin_amount?: string;
93
+ rounding_amount?: string;
94
+ status?: string;
95
+ payment_time?: string | null;
96
+ service_charge?: Record<string, any> | null;
97
+ metadata?: Record<string, any> | null;
98
+ [key: string]: any;
99
+ }
100
+ export interface ISalesSurcharge {
101
+ order_surcharge_id?: number | null;
102
+ surcharge_id?: number;
103
+ type?: string;
104
+ name?: Record<string, string>;
105
+ description?: Record<string, string>;
106
+ percentage?: string | null;
107
+ fixed?: string | null;
108
+ amount?: string;
109
+ [key: string]: any;
110
+ }
111
+ export interface ISalesDetail {
112
+ /** 顶部订单字段集合(不含 products / bookings / payments / surcharges 等大数组) */
113
+ header: ISalesDetailHeader;
114
+ /** 商品行快照(保留 tempOrder / 后端详情原字段) */
115
+ products: BaseSalesOrderProduct[];
116
+ /** 全部 bookings,按服务端原始顺序输出(含 root + child) */
117
+ bookings: ISalesBooking[];
118
+ /** root booking(parent_id === 0),多个时取首个,无则为 null */
119
+ rootBooking: ISalesBooking | null;
120
+ /** product_uid → bookings 反查表,便于商品行 ↔ booking 映射 */
121
+ bookingsByProductUid: Record<string, ISalesBooking[]>;
122
+ /** 支付列表 */
123
+ payments: ISalesPayment[];
124
+ /** 附加费 */
125
+ surcharges: ISalesSurcharge[];
126
+ /** 订单级折扣列表 */
127
+ discount_list: any[];
128
+ /** 客户信息(按 header 抽取,必要时透传 raw.customer) */
129
+ customer: ISalesDetailCustomer | null;
130
+ /** 服务端 summary(仅输出) */
131
+ summary: Record<string, any>;
132
+ /** 原始响应快照,方便 UI 兜底使用 */
133
+ raw: Record<string, any>;
134
+ }
135
+ /**
136
+ * 将 `/order/sales/{id}` 响应解析为 ISalesDetail。
137
+ *
138
+ * 注意:
139
+ * - 入参允许是 `{ data: OrderData }` 或直接 `OrderData`,自动识别。
140
+ * - products 保留原字段;字段补齐由 OrderModule hydrate 负责。
141
+ * - 不做远程请求;不修改入参;返回新对象。
142
+ */
143
+ export declare function parseSalesResponse(input: Record<string, any> | null | undefined): ISalesDetail;
@@ -0,0 +1,160 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // src/solution/BaseSales/utils/parseSalesResponse.ts
20
+ var parseSalesResponse_exports = {};
21
+ __export(parseSalesResponse_exports, {
22
+ parseSalesResponse: () => parseSalesResponse
23
+ });
24
+ module.exports = __toCommonJS(parseSalesResponse_exports);
25
+ var HEADER_KEYS = [
26
+ "order_id",
27
+ "order_number",
28
+ "shop_order_number",
29
+ "shop_full_order_number",
30
+ "type",
31
+ "business_code",
32
+ "platform",
33
+ "sales_channel",
34
+ "order_sales_channel",
35
+ "status",
36
+ "payment_status",
37
+ "shipping_status",
38
+ "customer_id",
39
+ "customer_name",
40
+ "country_calling_code",
41
+ "phone",
42
+ "email",
43
+ "is_price_include_tax",
44
+ "tax_title",
45
+ "tax_country_code",
46
+ "currency_code",
47
+ "currency_symbol",
48
+ "currency_format",
49
+ "is_deposit",
50
+ "deposit_amount",
51
+ "shop_discount",
52
+ "surcharge_fee",
53
+ "note",
54
+ "schedule_date",
55
+ "created_at",
56
+ "updated_at",
57
+ "metadata",
58
+ "total_amount",
59
+ "shop_id",
60
+ "create_date",
61
+ "holder",
62
+ "relation_forms",
63
+ "contacts",
64
+ "contacts_info"
65
+ ];
66
+ function pickHeader(raw) {
67
+ const header = { order_id: (raw == null ? void 0 : raw.order_id) ?? null };
68
+ if (!raw || typeof raw !== "object")
69
+ return header;
70
+ for (const key of HEADER_KEYS) {
71
+ if (raw[key] !== void 0)
72
+ header[key] = raw[key];
73
+ }
74
+ return header;
75
+ }
76
+ function pickCustomer(raw) {
77
+ if (!raw || typeof raw !== "object")
78
+ return null;
79
+ const explicit = raw.customer;
80
+ if (explicit && typeof explicit === "object") {
81
+ return {
82
+ id: explicit.id ?? raw.customer_id ?? null,
83
+ name: explicit.name ?? raw.customer_name ?? "",
84
+ phone: explicit.phone ?? raw.phone,
85
+ email: explicit.email ?? raw.email,
86
+ country_calling_code: explicit.country_calling_code ?? raw.country_calling_code,
87
+ ...explicit
88
+ };
89
+ }
90
+ if (raw.customer_id == null && !raw.customer_name)
91
+ return null;
92
+ return {
93
+ id: raw.customer_id ?? null,
94
+ name: raw.customer_name ?? "",
95
+ phone: raw.phone,
96
+ email: raw.email,
97
+ country_calling_code: raw.country_calling_code
98
+ };
99
+ }
100
+ function isRootBooking(booking) {
101
+ if (!booking || typeof booking !== "object")
102
+ return false;
103
+ const parentId = booking.parent_id;
104
+ if (parentId === 0 || parentId === null || parentId === void 0)
105
+ return true;
106
+ return false;
107
+ }
108
+ function indexBookingsByProductUid(bookings) {
109
+ var _a;
110
+ const result = {};
111
+ for (const b of bookings) {
112
+ const uid = b && (b.product_uid || ((_a = b.metadata) == null ? void 0 : _a.product_uid)) || "";
113
+ if (!uid)
114
+ continue;
115
+ const key = String(uid);
116
+ if (!result[key])
117
+ result[key] = [];
118
+ result[key].push(b);
119
+ }
120
+ return result;
121
+ }
122
+ function parseSalesResponse(input) {
123
+ const raw = input && typeof input === "object" && input.data && input.order_id == null ? input.data : input || {};
124
+ const productsRaw = Array.isArray(raw == null ? void 0 : raw.products) ? raw.products : [];
125
+ const products = productsRaw.map((p, index) => {
126
+ const row = { ...p || {} };
127
+ const metadata = row.metadata && typeof row.metadata === "object" ? { ...row.metadata } : {};
128
+ if (!metadata.unique_identification_number) {
129
+ metadata.unique_identification_number = `sales-product-${row.product_id ?? "unknown"}-${row.product_variant_id ?? 0}-${index}`;
130
+ }
131
+ delete metadata.price_schema_version;
132
+ delete row.identity_key;
133
+ return { ...row, metadata };
134
+ });
135
+ const bookingsRaw = Array.isArray(raw == null ? void 0 : raw.bookings) ? raw.bookings : [];
136
+ const bookings = bookingsRaw.map((b) => ({ ...b || {} }));
137
+ const rootBooking = bookings.find(isRootBooking) || null;
138
+ const bookingsByProductUid = indexBookingsByProductUid(bookings);
139
+ const payments = Array.isArray(raw == null ? void 0 : raw.payments) ? raw.payments.map((p) => ({ ...p || {} })) : [];
140
+ const surcharges = Array.isArray(raw == null ? void 0 : raw.surcharges) ? raw.surcharges.map((s) => ({ ...s || {} })) : [];
141
+ const discount_list = Array.isArray(raw == null ? void 0 : raw.discount_list) ? raw.discount_list.map((d) => ({ ...d || {} })) : [];
142
+ const summary = (raw == null ? void 0 : raw.summary) && typeof raw.summary === "object" ? { ...raw.summary } : {};
143
+ return {
144
+ header: pickHeader(raw),
145
+ products,
146
+ bookings,
147
+ rootBooking,
148
+ bookingsByProductUid,
149
+ payments,
150
+ surcharges,
151
+ discount_list,
152
+ customer: pickCustomer(raw),
153
+ summary,
154
+ raw
155
+ };
156
+ }
157
+ // Annotate the CommonJS export names for ESM import in node:
158
+ 0 && (module.exports = {
159
+ parseSalesResponse
160
+ });
@@ -0,0 +1,40 @@
1
+ import { BaseSalesOrderProduct, BaseSalesOrderProductIdentity, BaseSalesSummary } from './types';
2
+ /**
3
+ * 构建金额全为 0 的空 summary。
4
+ * 作为尚未计算金额时的兜底默认值,避免下游因 undefined 报错。
5
+ */
6
+ export declare function createEmptySummary(): BaseSalesSummary;
7
+ /**
8
+ * 将选项行 / 套餐行归一成稳定 JSON,用于「同 SKU 是否合并」判断。
9
+ * 数组元素先按主键排序再序列化,避免顺序差异导致误判为不同行。
10
+ */
11
+ export declare function buildProductLineFingerprint(productOptionItem?: unknown, productBundle?: unknown): string;
12
+ export declare function getSafeProductNum(num?: number): number;
13
+ /**
14
+ * removeProductFromOrder 仅传 SKU 时的通配 identity(对象上未声明选项键)。
15
+ * 与显式 `product_option_item: []` 区分:后者只匹配「无选项」行。
16
+ */
17
+ export declare function isSkuOnlyDeleteIdentity(x: BaseSalesOrderProductIdentity): boolean;
18
+ /**
19
+ * 对外部传入的商品对象做归一化(v2 composite 语义):
20
+ * - 补全可选字段默认值(未传则使用兜底值,避免后续计算时因 undefined 导致异常)
21
+ * - 对 num 调用 getSafeProductNum 做安全处理
22
+ * - 保留 _origin 供后续业务流程(如促销规则)使用
23
+ *
24
+ * 价格字段语义(metadata 权威源 + composite 派生):
25
+ * - `metadata.source_product_price`:主商品/variant 基础价(已应用报价单),**不含 option**、
26
+ * **不含折扣**。是推导 main_product_* 的起点。variant 分支优先读 `metadata.origin.variant[vid].price`。
27
+ * - `metadata.main_product_original_price`:`source + Σ(option.price × option.num)`,**含 option**、
28
+ * **不含折扣**。
29
+ * - `metadata.main_product_selling_price`:`main_product_original_price - 主商品券 per-unit amount`,
30
+ * **含 option**、**含折扣**。
31
+ * - 行级 `selling_price` = `main_product_selling_price + Σ(bundle_selling_price × num)`。
32
+ * - 行级 `original_price` = `main_product_original_price + Σ(bundle 原价 × num)`。
33
+ *
34
+ * 迁移与幂等:
35
+ * - `metadata.price_schema_version === 2` → 已新语义归一化,保留 main_product_* 原值(保留折扣)。
36
+ * - 其它情况(v1 / 缺字段 / 无 metadata)→ 按"main_product_selling_price 曾是 main-only"的旧约定
37
+ * 反推 legacyDiscount,再以新 source + options 基准重算。最终统一打上 `price_schema_version: 2`。
38
+ * - 因此多次 normalize 不会重复叠加 option/bundle。
39
+ */
40
+ export declare function normalizeOrderProduct(product: Partial<BaseSalesOrderProduct> & BaseSalesOrderProductIdentity): BaseSalesOrderProduct;