@pisell/pisellos 2.1.118 → 2.1.120

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 (232) hide show
  1. package/dist/apis/picoding.d.ts +0 -0
  2. package/dist/apis/picoding.js +1 -0
  3. package/dist/index.d.ts +0 -1
  4. package/dist/index.js +0 -1
  5. package/dist/model/strategy/adapter/index.d.ts +4 -0
  6. package/dist/model/strategy/adapter/index.js +4 -1
  7. package/dist/model/strategy/adapter/itemRule/adapter.d.ts +59 -0
  8. package/dist/model/strategy/adapter/itemRule/adapter.js +439 -0
  9. package/dist/model/strategy/adapter/itemRule/evaluator.d.ts +43 -0
  10. package/dist/model/strategy/adapter/itemRule/evaluator.js +169 -0
  11. package/dist/model/strategy/adapter/itemRule/examples.d.ts +64 -0
  12. package/dist/model/strategy/adapter/itemRule/examples.js +315 -0
  13. package/dist/model/strategy/adapter/itemRule/index.d.ts +5 -0
  14. package/dist/model/strategy/adapter/itemRule/index.js +5 -0
  15. package/dist/model/strategy/adapter/itemRule/type.d.ts +206 -0
  16. package/dist/model/strategy/adapter/itemRule/type.js +101 -0
  17. package/dist/model/strategy/adapter/promotion/adapter.d.ts +66 -0
  18. package/dist/model/strategy/adapter/promotion/adapter.js +271 -0
  19. package/dist/model/strategy/adapter/promotion/evaluator.d.ts +213 -0
  20. package/dist/model/strategy/adapter/promotion/evaluator.js +1206 -0
  21. package/dist/model/strategy/adapter/promotion/examples.d.ts +138 -0
  22. package/dist/model/strategy/adapter/promotion/examples.js +166 -0
  23. package/dist/model/strategy/adapter/promotion/index.d.ts +4 -0
  24. package/dist/model/strategy/adapter/promotion/index.js +0 -0
  25. package/dist/model/strategy/adapter/promotion/type.d.ts +447 -0
  26. package/dist/model/strategy/adapter/promotion/type.js +209 -0
  27. package/dist/model/strategy/adapter/walletPass/evaluator.js +4 -1
  28. package/dist/model/strategy/engine.d.ts +106 -0
  29. package/dist/model/strategy/engine.js +611 -0
  30. package/dist/model/strategy/index.d.ts +2 -93
  31. package/dist/model/strategy/index.js +6 -549
  32. package/dist/modules/Cart/types.d.ts +0 -2
  33. package/dist/modules/Cart/utils/cartProduct.js +25 -56
  34. package/dist/modules/Discount/types.d.ts +0 -18
  35. package/dist/modules/OpenData/index.d.ts +23 -0
  36. package/dist/modules/OpenData/index.js +167 -0
  37. package/dist/modules/OpenData/types.d.ts +73 -0
  38. package/dist/modules/OpenData/types.js +1 -0
  39. package/dist/modules/OpenData/utils.d.ts +2 -0
  40. package/dist/modules/OpenData/utils.js +75 -0
  41. package/dist/modules/Order/index.d.ts +58 -1
  42. package/dist/modules/Order/index.js +780 -29
  43. package/dist/modules/Order/types.d.ts +144 -12
  44. package/dist/modules/Order/utils.d.ts +25 -0
  45. package/dist/modules/Order/utils.js +225 -1
  46. package/dist/modules/Payment/index.d.ts +1 -2
  47. package/dist/modules/Payment/index.js +7 -10
  48. package/dist/modules/Payment/utils.js +0 -3
  49. package/dist/modules/Payment/walletpass.d.ts +0 -23
  50. package/dist/modules/Payment/walletpass.js +95 -191
  51. package/dist/modules/Product/utils.js +2 -2
  52. package/dist/modules/ProductList/index.d.ts +1 -1
  53. package/dist/modules/ProductList/index.js +2 -1
  54. package/dist/modules/Quotation/index.d.ts +48 -0
  55. package/dist/modules/Quotation/index.js +245 -0
  56. package/dist/modules/Quotation/types.d.ts +42 -0
  57. package/dist/modules/Quotation/types.js +1 -0
  58. package/dist/modules/Rules/index.d.ts +5 -9
  59. package/dist/modules/Rules/index.js +164 -673
  60. package/dist/modules/Rules/types.d.ts +0 -2
  61. package/dist/modules/SalesSummary/index.d.ts +63 -0
  62. package/dist/modules/SalesSummary/index.js +174 -0
  63. package/dist/modules/SalesSummary/types.d.ts +59 -0
  64. package/dist/modules/SalesSummary/types.js +1 -0
  65. package/dist/modules/SalesSummary/utils.d.ts +30 -0
  66. package/dist/modules/SalesSummary/utils.js +513 -0
  67. package/dist/modules/ScanOrderLogger/index.d.ts +21 -0
  68. package/dist/modules/ScanOrderLogger/index.js +161 -0
  69. package/dist/modules/ScanOrderLogger/providers/feishu.d.ts +2 -0
  70. package/dist/modules/ScanOrderLogger/providers/feishu.js +95 -0
  71. package/dist/modules/ScanOrderLogger/providers/grafana.d.ts +2 -0
  72. package/dist/modules/ScanOrderLogger/providers/grafana.js +50 -0
  73. package/dist/modules/ScanOrderLogger/types.d.ts +46 -0
  74. package/dist/modules/ScanOrderLogger/types.js +1 -0
  75. package/dist/modules/Schedule/getDateIsInSchedule.js +11 -18
  76. package/dist/modules/Summary/types.d.ts +0 -2
  77. package/dist/modules/Summary/utils.d.ts +3 -9
  78. package/dist/modules/Summary/utils.js +4 -25
  79. package/dist/modules/index.d.ts +4 -0
  80. package/dist/modules/index.js +5 -1
  81. package/dist/plugins/window.d.ts +0 -2
  82. package/dist/solution/BookingByStep/index.d.ts +1 -2
  83. package/dist/solution/BookingByStep/index.js +44 -42
  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/timeslots.d.ts +3 -1
  87. package/dist/solution/BookingByStep/utils/timeslots.js +19 -12
  88. package/dist/solution/Checkout/index.js +0 -2
  89. package/dist/solution/ScanOrder/index.d.ts +90 -0
  90. package/dist/solution/ScanOrder/index.js +1853 -0
  91. package/dist/solution/ScanOrder/types.d.ts +210 -0
  92. package/dist/solution/ScanOrder/types.js +16 -0
  93. package/dist/solution/ScanOrder/utils.d.ts +93 -0
  94. package/dist/solution/ScanOrder/utils.js +397 -0
  95. package/dist/solution/ShopDiscount/index.d.ts +0 -1
  96. package/dist/solution/ShopDiscount/index.js +7 -23
  97. package/dist/solution/ShopDiscount/types.d.ts +0 -1
  98. package/dist/solution/ShopDiscount/types.js +1 -2
  99. package/dist/solution/ShopDiscount/utils.js +12 -26
  100. package/dist/solution/VenueBooking/index.d.ts +158 -0
  101. package/dist/solution/VenueBooking/index.js +2873 -0
  102. package/dist/solution/VenueBooking/sales-section-4-annotated.json +343 -0
  103. package/dist/solution/VenueBooking/types.d.ts +130 -0
  104. package/dist/solution/VenueBooking/types.js +21 -0
  105. package/dist/solution/VenueBooking/utils/dateSummary.d.ts +10 -0
  106. package/dist/solution/VenueBooking/utils/dateSummary.js +102 -0
  107. package/dist/solution/VenueBooking/utils/resource.d.ts +4 -0
  108. package/dist/solution/VenueBooking/utils/resource.js +94 -0
  109. package/dist/solution/VenueBooking/utils/slotMerge.d.ts +29 -0
  110. package/dist/solution/VenueBooking/utils/slotMerge.js +204 -0
  111. package/dist/solution/VenueBooking/utils/timeSlot.d.ts +32 -0
  112. package/dist/solution/VenueBooking/utils/timeSlot.js +256 -0
  113. package/dist/solution/VenueBooking/utils.d.ts +1 -0
  114. package/dist/solution/VenueBooking/utils.js +1 -0
  115. package/dist/solution/index.d.ts +2 -0
  116. package/dist/solution/index.js +3 -1
  117. package/lib/apis/picoding.d.ts +0 -0
  118. package/lib/apis/picoding.js +0 -0
  119. package/lib/index.d.ts +0 -1
  120. package/lib/index.js +1 -3
  121. package/lib/model/strategy/adapter/index.d.ts +4 -0
  122. package/lib/model/strategy/adapter/index.js +12 -0
  123. package/lib/model/strategy/adapter/itemRule/adapter.d.ts +59 -0
  124. package/lib/model/strategy/adapter/itemRule/adapter.js +338 -0
  125. package/lib/model/strategy/adapter/itemRule/evaluator.d.ts +43 -0
  126. package/lib/model/strategy/adapter/itemRule/evaluator.js +124 -0
  127. package/lib/model/strategy/adapter/itemRule/examples.d.ts +64 -0
  128. package/lib/model/strategy/adapter/itemRule/examples.js +269 -0
  129. package/lib/model/strategy/adapter/itemRule/index.d.ts +5 -0
  130. package/lib/model/strategy/adapter/itemRule/index.js +58 -0
  131. package/lib/model/strategy/adapter/itemRule/type.d.ts +206 -0
  132. package/lib/model/strategy/adapter/itemRule/type.js +46 -0
  133. package/lib/model/strategy/adapter/promotion/adapter.d.ts +66 -0
  134. package/lib/model/strategy/adapter/promotion/adapter.js +217 -0
  135. package/lib/model/strategy/adapter/promotion/evaluator.d.ts +213 -0
  136. package/lib/model/strategy/adapter/promotion/evaluator.js +844 -0
  137. package/lib/model/strategy/adapter/promotion/examples.d.ts +138 -0
  138. package/lib/model/strategy/adapter/promotion/examples.js +192 -0
  139. package/lib/model/strategy/adapter/promotion/index.d.ts +4 -0
  140. package/lib/model/strategy/adapter/promotion/index.js +0 -0
  141. package/lib/model/strategy/adapter/promotion/type.d.ts +447 -0
  142. package/lib/model/strategy/adapter/promotion/type.js +51 -0
  143. package/lib/model/strategy/adapter/walletPass/evaluator.js +2 -1
  144. package/lib/model/strategy/engine.d.ts +106 -0
  145. package/lib/model/strategy/engine.js +450 -0
  146. package/lib/model/strategy/index.d.ts +2 -93
  147. package/lib/model/strategy/index.js +6 -381
  148. package/lib/modules/Cart/types.d.ts +0 -2
  149. package/lib/modules/Cart/utils/cartProduct.js +12 -39
  150. package/lib/modules/Discount/types.d.ts +0 -18
  151. package/lib/modules/OpenData/index.d.ts +23 -0
  152. package/lib/modules/OpenData/index.js +116 -0
  153. package/lib/modules/OpenData/types.d.ts +73 -0
  154. package/lib/modules/OpenData/types.js +17 -0
  155. package/lib/modules/OpenData/utils.d.ts +2 -0
  156. package/lib/modules/OpenData/utils.js +111 -0
  157. package/lib/modules/Order/index.d.ts +58 -1
  158. package/lib/modules/Order/index.js +423 -1
  159. package/lib/modules/Order/types.d.ts +144 -12
  160. package/lib/modules/Order/utils.d.ts +25 -0
  161. package/lib/modules/Order/utils.js +229 -0
  162. package/lib/modules/Payment/index.d.ts +1 -2
  163. package/lib/modules/Payment/index.js +0 -1
  164. package/lib/modules/Payment/utils.js +0 -3
  165. package/lib/modules/Payment/walletpass.d.ts +0 -23
  166. package/lib/modules/Payment/walletpass.js +17 -94
  167. package/lib/modules/Product/utils.js +2 -2
  168. package/lib/modules/ProductList/index.d.ts +1 -1
  169. package/lib/modules/ProductList/index.js +2 -1
  170. package/lib/modules/Quotation/index.d.ts +48 -0
  171. package/lib/modules/Quotation/index.js +149 -0
  172. package/lib/modules/Quotation/types.d.ts +42 -0
  173. package/lib/modules/Quotation/types.js +17 -0
  174. package/lib/modules/Rules/index.d.ts +5 -9
  175. package/lib/modules/Rules/index.js +286 -778
  176. package/lib/modules/Rules/types.d.ts +0 -2
  177. package/lib/modules/SalesSummary/index.d.ts +63 -0
  178. package/lib/modules/SalesSummary/index.js +105 -0
  179. package/lib/modules/SalesSummary/types.d.ts +59 -0
  180. package/lib/modules/SalesSummary/types.js +17 -0
  181. package/lib/modules/SalesSummary/utils.d.ts +30 -0
  182. package/lib/modules/SalesSummary/utils.js +452 -0
  183. package/lib/modules/ScanOrderLogger/index.d.ts +21 -0
  184. package/lib/modules/ScanOrderLogger/index.js +135 -0
  185. package/lib/modules/ScanOrderLogger/providers/feishu.d.ts +2 -0
  186. package/lib/modules/ScanOrderLogger/providers/feishu.js +82 -0
  187. package/lib/modules/ScanOrderLogger/providers/grafana.d.ts +2 -0
  188. package/lib/modules/ScanOrderLogger/providers/grafana.js +52 -0
  189. package/lib/modules/ScanOrderLogger/types.d.ts +46 -0
  190. package/lib/modules/ScanOrderLogger/types.js +17 -0
  191. package/lib/modules/Schedule/getDateIsInSchedule.js +9 -11
  192. package/lib/modules/Summary/types.d.ts +0 -2
  193. package/lib/modules/Summary/utils.d.ts +3 -9
  194. package/lib/modules/Summary/utils.js +4 -19
  195. package/lib/modules/index.d.ts +4 -0
  196. package/lib/modules/index.js +9 -1
  197. package/lib/plugins/window.d.ts +0 -2
  198. package/lib/solution/BookingByStep/index.d.ts +1 -2
  199. package/lib/solution/BookingByStep/index.js +4 -2
  200. package/lib/solution/BookingByStep/types.d.ts +3 -1
  201. package/lib/solution/BookingByStep/types.js +10 -0
  202. package/lib/solution/BookingByStep/utils/timeslots.d.ts +3 -1
  203. package/lib/solution/BookingByStep/utils/timeslots.js +19 -11
  204. package/lib/solution/Checkout/index.js +0 -2
  205. package/lib/solution/ScanOrder/index.d.ts +90 -0
  206. package/lib/solution/ScanOrder/index.js +1071 -0
  207. package/lib/solution/ScanOrder/types.d.ts +210 -0
  208. package/lib/solution/ScanOrder/types.js +36 -0
  209. package/lib/solution/ScanOrder/utils.d.ts +93 -0
  210. package/lib/solution/ScanOrder/utils.js +359 -0
  211. package/lib/solution/ShopDiscount/index.d.ts +0 -1
  212. package/lib/solution/ShopDiscount/index.js +8 -22
  213. package/lib/solution/ShopDiscount/types.d.ts +0 -1
  214. package/lib/solution/ShopDiscount/utils.js +6 -10
  215. package/lib/solution/VenueBooking/index.d.ts +158 -0
  216. package/lib/solution/VenueBooking/index.js +1545 -0
  217. package/lib/solution/VenueBooking/sales-section-4-annotated.json +343 -0
  218. package/lib/solution/VenueBooking/types.d.ts +130 -0
  219. package/lib/solution/VenueBooking/types.js +44 -0
  220. package/lib/solution/VenueBooking/utils/dateSummary.d.ts +10 -0
  221. package/lib/solution/VenueBooking/utils/dateSummary.js +101 -0
  222. package/lib/solution/VenueBooking/utils/resource.d.ts +4 -0
  223. package/lib/solution/VenueBooking/utils/resource.js +80 -0
  224. package/lib/solution/VenueBooking/utils/slotMerge.d.ts +29 -0
  225. package/lib/solution/VenueBooking/utils/slotMerge.js +209 -0
  226. package/lib/solution/VenueBooking/utils/timeSlot.d.ts +32 -0
  227. package/lib/solution/VenueBooking/utils/timeSlot.js +200 -0
  228. package/lib/solution/VenueBooking/utils.d.ts +1 -0
  229. package/lib/solution/VenueBooking/utils.js +69 -0
  230. package/lib/solution/index.d.ts +2 -0
  231. package/lib/solution/index.js +5 -1
  232. package/package.json +1 -1
@@ -0,0 +1,138 @@
1
+ /**
2
+ * X件Y元策略配置示例
3
+ *
4
+ * 业务规则:
5
+ * - 每X件商品固定价格Y元(可累计)
6
+ * - 支持跨商品组合(A+B可以凑成一组)
7
+ * - 买5件 = 2组优惠 + 1件原价
8
+ *
9
+ * 商品匹配规则:
10
+ * - product_variant_id = 0 表示匹配任意变体
11
+ * - product_variant_id != 0 表示精确匹配该变体
12
+ */
13
+ export declare const X_ITEMS_FOR_Y_PRICE_STRATEGY: {
14
+ metadata: {
15
+ id: string;
16
+ name: {
17
+ en: string;
18
+ 'zh-CN': string;
19
+ 'zh-HK': string;
20
+ };
21
+ type: string;
22
+ custom: {
23
+ display: {
24
+ product_card: {
25
+ text: {
26
+ en: string;
27
+ 'zh-CN': string;
28
+ 'zh-HK': string;
29
+ };
30
+ type: string;
31
+ };
32
+ };
33
+ };
34
+ };
35
+ conditions: {
36
+ operator: string;
37
+ rules: ({
38
+ type: string;
39
+ field: string;
40
+ value: string;
41
+ operator: string;
42
+ } | {
43
+ type: string;
44
+ field: string;
45
+ value: {
46
+ product_id: number;
47
+ product_variant_id: number;
48
+ }[];
49
+ operator: string;
50
+ })[];
51
+ actionIds: string[];
52
+ };
53
+ actions: {
54
+ id: string;
55
+ type: string;
56
+ value: {
57
+ x: number;
58
+ price: number;
59
+ };
60
+ valueType: string;
61
+ target: string;
62
+ priority: number;
63
+ config: {
64
+ allowCrossProduct: boolean;
65
+ cumulative: boolean;
66
+ };
67
+ }[];
68
+ };
69
+ /**
70
+ * 买X送Y策略配置示例
71
+ *
72
+ * 业务规则:
73
+ * - 买X件送Y件(可累计:买2送2、买3送3...)
74
+ * - 赠品由用户从列表中选择
75
+ *
76
+ * 商品匹配规则:
77
+ * - product_variant_id = 0 表示匹配任意变体
78
+ * - product_variant_id != 0 表示精确匹配该变体
79
+ */
80
+ export declare const BUY_X_GET_Y_FREE_STRATEGY: {
81
+ metadata: {
82
+ id: string;
83
+ name: {
84
+ en: string;
85
+ 'zh-CN': string;
86
+ 'zh-HK': string;
87
+ };
88
+ type: string;
89
+ custom: {
90
+ display: {
91
+ product_card: {
92
+ text: {
93
+ en: string;
94
+ 'zh-CN': string;
95
+ 'zh-HK': string;
96
+ };
97
+ type: string;
98
+ };
99
+ };
100
+ };
101
+ };
102
+ conditions: {
103
+ operator: string;
104
+ rules: ({
105
+ type: string;
106
+ field: string;
107
+ value: string;
108
+ operator: string;
109
+ } | {
110
+ type: string;
111
+ field: string;
112
+ value: {
113
+ product_id: number;
114
+ product_variant_id: number;
115
+ }[];
116
+ operator: string;
117
+ })[];
118
+ actionIds: string[];
119
+ };
120
+ actions: {
121
+ id: string;
122
+ type: string;
123
+ value: {
124
+ buyQuantity: number;
125
+ freeQuantity: number;
126
+ };
127
+ valueType: string;
128
+ target: string;
129
+ priority: number;
130
+ config: {
131
+ cumulative: boolean;
132
+ giftProducts: {
133
+ product_id: number;
134
+ product_variant_id: number;
135
+ }[];
136
+ };
137
+ }[];
138
+ };
@@ -0,0 +1,192 @@
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/model/strategy/adapter/promotion/examples.ts
20
+ var examples_exports = {};
21
+ __export(examples_exports, {
22
+ BUY_X_GET_Y_FREE_STRATEGY: () => BUY_X_GET_Y_FREE_STRATEGY,
23
+ X_ITEMS_FOR_Y_PRICE_STRATEGY: () => X_ITEMS_FOR_Y_PRICE_STRATEGY
24
+ });
25
+ module.exports = __toCommonJS(examples_exports);
26
+ var X_ITEMS_FOR_Y_PRICE_STRATEGY = {
27
+ metadata: {
28
+ id: "STRATEGY_001",
29
+ name: {
30
+ en: "2 items for $10",
31
+ "zh-CN": "2杯10元",
32
+ "zh-HK": "2杯10元"
33
+ },
34
+ type: "promotion",
35
+ custom: {
36
+ display: {
37
+ product_card: {
38
+ text: {
39
+ en: "2 for $10",
40
+ "zh-CN": "2杯10元",
41
+ "zh-HK": "2杯10元"
42
+ },
43
+ type: "tag"
44
+ }
45
+ }
46
+ }
47
+ },
48
+ conditions: {
49
+ operator: "and",
50
+ rules: [
51
+ {
52
+ type: "operator",
53
+ field: "currentDateTime",
54
+ value: "2023-01-01 00:00:00",
55
+ operator: ">="
56
+ },
57
+ {
58
+ type: "operator",
59
+ field: "currentDateTime",
60
+ value: "2027-01-01 00:00:00",
61
+ operator: "<="
62
+ },
63
+ {
64
+ type: "operator",
65
+ field: "productIdAndVariantId",
66
+ value: [
67
+ {
68
+ product_id: 60736,
69
+ product_variant_id: 0
70
+ // 0 = 匹配任意变体
71
+ },
72
+ {
73
+ product_id: 60737,
74
+ product_variant_id: 0
75
+ // 0 = 匹配任意变体
76
+ }
77
+ ],
78
+ operator: "product_match"
79
+ }
80
+ ],
81
+ actionIds: ["1"]
82
+ },
83
+ actions: [
84
+ {
85
+ id: "1",
86
+ type: "X_ITEMS_FOR_Y_PRICE",
87
+ value: {
88
+ x: 2,
89
+ // 每X件
90
+ price: 10
91
+ // 固定价格Y元
92
+ },
93
+ valueType: "object",
94
+ target: "product",
95
+ priority: 1,
96
+ config: {
97
+ allowCrossProduct: true,
98
+ // 允许跨商品组合(A+B可以凑成一组)
99
+ cumulative: true
100
+ // 可累计(买5件 = 2组优惠 + 1件原价)
101
+ }
102
+ }
103
+ ]
104
+ };
105
+ var BUY_X_GET_Y_FREE_STRATEGY = {
106
+ metadata: {
107
+ id: "STRATEGY_002",
108
+ name: {
109
+ en: "Buy 1 Get 1 Free",
110
+ "zh-CN": "买1送1",
111
+ "zh-HK": "買1送1"
112
+ },
113
+ type: "promotion",
114
+ custom: {
115
+ display: {
116
+ product_card: {
117
+ text: {
118
+ en: "Buy 1 Get 1",
119
+ "zh-CN": "买1送1",
120
+ "zh-HK": "買1送1"
121
+ },
122
+ type: "tag"
123
+ }
124
+ }
125
+ }
126
+ },
127
+ conditions: {
128
+ operator: "and",
129
+ rules: [
130
+ {
131
+ type: "operator",
132
+ field: "currentDateTime",
133
+ value: "2023-01-01 00:00:00",
134
+ operator: ">="
135
+ },
136
+ {
137
+ type: "operator",
138
+ field: "currentDateTime",
139
+ value: "2027-01-01 00:00:00",
140
+ operator: "<="
141
+ },
142
+ {
143
+ type: "operator",
144
+ field: "productIdAndVariantId",
145
+ value: [
146
+ {
147
+ product_id: 60736,
148
+ product_variant_id: 0
149
+ // 0 = 匹配任意变体
150
+ },
151
+ {
152
+ product_id: 60737,
153
+ product_variant_id: 0
154
+ // 0 = 匹配任意变体
155
+ }
156
+ ],
157
+ operator: "product_match"
158
+ }
159
+ ],
160
+ actionIds: ["1"]
161
+ },
162
+ actions: [
163
+ {
164
+ id: "1",
165
+ type: "BUY_X_GET_Y_FREE",
166
+ value: {
167
+ buyQuantity: 1,
168
+ // 买X件
169
+ freeQuantity: 1
170
+ // 送Y件
171
+ },
172
+ valueType: "object",
173
+ target: "product",
174
+ priority: 1,
175
+ config: {
176
+ // 可累计(买2送2、买3送3...)
177
+ cumulative: true,
178
+ // 可选的赠品列表
179
+ giftProducts: [
180
+ { product_id: 60757, product_variant_id: 0 },
181
+ { product_id: 38782, product_variant_id: 0 },
182
+ { product_id: 60749, product_variant_id: 27267 }
183
+ ]
184
+ }
185
+ }
186
+ ]
187
+ };
188
+ // Annotate the CommonJS export names for ESM import in node:
189
+ 0 && (module.exports = {
190
+ BUY_X_GET_Y_FREE_STRATEGY,
191
+ X_ITEMS_FOR_Y_PRICE_STRATEGY
192
+ });
@@ -0,0 +1,4 @@
1
+ export { PromotionEvaluator } from './evaluator';
2
+ export { PromotionAdapter } from './adapter';
3
+ export { default } from './adapter';
4
+ export { X_ITEMS_FOR_Y_PRICE_STRATEGY, BUY_X_GET_Y_FREE_STRATEGY, } from './examples';
File without changes