@pisell/pisellos 0.10.74 → 0.10.76

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 (201) hide show
  1. package/dist/modules/Product/index.d.ts +1 -1
  2. package/dist/server/index.js +14 -9
  3. package/dist/shared/receipt/small-ticket.d.ts +3 -0
  4. package/dist/shared/receipt/small-ticket.js +23 -2
  5. package/dist/solution/BookingByStep/index.d.ts +2 -2
  6. package/dist/solution/BookingTicket/index.d.ts +13 -1
  7. package/dist/solution/OrderInvoicePreview/index.js +13 -8
  8. package/dist/solution/UnifiedBookingSales/catalogQueryBatch.d.ts +21 -0
  9. package/dist/solution/UnifiedBookingSales/catalogQueryBatch.js +202 -0
  10. package/dist/solution/UnifiedBookingSales/index.d.ts +8 -1
  11. package/dist/solution/UnifiedBookingSales/index.js +680 -557
  12. package/dist/solution/UnifiedBookingSales/types.d.ts +9 -0
  13. package/dist/solution/UnifiedBookingSales/types.js +2 -0
  14. package/lib/modules/Product/index.d.ts +1 -1
  15. package/lib/server/index.js +5 -0
  16. package/lib/shared/receipt/small-ticket.d.ts +3 -0
  17. package/lib/shared/receipt/small-ticket.js +21 -0
  18. package/lib/solution/BookingByStep/index.d.ts +2 -2
  19. package/lib/solution/BookingTicket/index.d.ts +13 -1
  20. package/lib/solution/OrderInvoicePreview/index.js +6 -1
  21. package/lib/solution/UnifiedBookingSales/catalogQueryBatch.d.ts +21 -0
  22. package/lib/solution/UnifiedBookingSales/catalogQueryBatch.js +109 -0
  23. package/lib/solution/UnifiedBookingSales/index.d.ts +8 -1
  24. package/lib/solution/UnifiedBookingSales/index.js +96 -1
  25. package/lib/solution/UnifiedBookingSales/types.d.ts +9 -0
  26. package/lib/solution/UnifiedBookingSales/types.js +1 -0
  27. package/package.json +1 -1
  28. package/dist/apis/picoding.d.ts +0 -0
  29. package/dist/effects/index.d.ts +0 -19
  30. package/dist/model/strategy/adapter/dataVariant/adapter.d.ts +0 -50
  31. package/dist/model/strategy/adapter/dataVariant/evaluator.d.ts +0 -105
  32. package/dist/model/strategy/adapter/dataVariant/examples.d.ts +0 -39
  33. package/dist/model/strategy/adapter/dataVariant/index.d.ts +0 -4
  34. package/dist/model/strategy/adapter/dataVariant/type.d.ts +0 -173
  35. package/dist/model/strategy/adapter/promotion/adapter.d.ts +0 -70
  36. package/dist/model/strategy/adapter/promotion/examples.d.ts +0 -224
  37. package/dist/model/strategy/adapter/promotion/type.d.ts +0 -535
  38. package/dist/model/strategy/adapter/type.d.ts +0 -28
  39. package/dist/model/strategy/adapter/walletPass/index.d.ts +0 -32
  40. package/dist/model/strategy/adapter/walletPass/locales.d.ts +0 -1
  41. package/dist/model/strategy/adapter/walletPass/type.d.ts +0 -192
  42. package/dist/model/strategy/adapter/walletPass/utils.d.ts +0 -50
  43. package/dist/model/strategy/engine.d.ts +0 -119
  44. package/dist/model/strategy/type.d.ts +0 -245
  45. package/dist/modules/Account/types.d.ts +0 -56
  46. package/dist/modules/BookingContext/types.d.ts +0 -104
  47. package/dist/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +0 -76
  48. package/dist/modules/BookingContext/utils/flexible.d.ts +0 -28
  49. package/dist/modules/BookingContext/utils/formatResourceList.d.ts +0 -8
  50. package/dist/modules/BookingContext/utils/noResource.d.ts +0 -13
  51. package/dist/modules/BookingContext/utils/orderLineDisplay.d.ts +0 -1
  52. package/dist/modules/BookingContext/utils/resourceErrors.d.ts +0 -41
  53. package/dist/modules/BookingContext/utils/resourceSelection.d.ts +0 -7
  54. package/dist/modules/BookingContext/utils/serviceTimes.d.ts +0 -55
  55. package/dist/modules/BookingContext/utils/timeSlices.d.ts +0 -42
  56. package/dist/modules/Customer/constants.d.ts +0 -7
  57. package/dist/modules/Date/types.d.ts +0 -84
  58. package/dist/modules/Date/utils.d.ts +0 -36
  59. package/dist/modules/FulfillmentTiming/index.d.ts +0 -11
  60. package/dist/modules/FulfillmentTiming/types.d.ts +0 -67
  61. package/dist/modules/Order/payment-utils.d.ts +0 -26
  62. package/dist/modules/Order/pickupTiming.d.ts +0 -46
  63. package/dist/modules/Order/utils/manualProductDiscount.d.ts +0 -106
  64. package/dist/modules/Order/utils/orderCollectionIdentity.d.ts +0 -68
  65. package/dist/modules/Order/utils/weighedProduct.d.ts +0 -12
  66. package/dist/modules/Payment/cashRecommendationAlgorithm.d.ts +0 -21
  67. package/dist/modules/Payment/mx51.d.ts +0 -0
  68. package/dist/modules/Payment/types.d.ts +0 -943
  69. package/dist/modules/Payment/utils.d.ts +0 -19
  70. package/dist/modules/Quotation/types.d.ts +0 -61
  71. package/dist/modules/Resource/types.d.ts +0 -50
  72. package/dist/modules/Resource/utils.d.ts +0 -23
  73. package/dist/modules/ResourcePlanner/localClock.d.ts +0 -33
  74. package/dist/modules/SalesSummary/types.d.ts +0 -69
  75. package/dist/modules/ScanOrderLogger/providers/feishu.d.ts +0 -2
  76. package/dist/modules/ScanOrderLogger/providers/grafana.d.ts +0 -2
  77. package/dist/modules/ScanOrderLogger/types.d.ts +0 -53
  78. package/dist/modules/Schedule/getDateIsInSchedule.d.ts +0 -32
  79. package/dist/modules/Schedule/type.d.ts +0 -157
  80. package/dist/modules/Schedule/types.d.ts +0 -201
  81. package/dist/modules/Schedule/utils.d.ts +0 -67
  82. package/dist/modules/Step/tyeps.d.ts +0 -20
  83. package/dist/modules/SurchargeList/types.d.ts +0 -15
  84. package/dist/plugins/app.d.ts +0 -10
  85. package/dist/plugins/shopStore.d.ts +0 -4
  86. package/dist/plugins/user.d.ts +0 -7
  87. package/dist/server/modules/floor-plan/types.d.ts +0 -43
  88. package/dist/server/modules/menu/types.d.ts +0 -68
  89. package/dist/server/modules/payment/types.d.ts +0 -9
  90. package/dist/server/modules/quotation/types.d.ts +0 -50
  91. package/dist/server/modules/resource/types.d.ts +0 -121
  92. package/dist/server/modules/schedule/types.d.ts +0 -1
  93. package/dist/server/modules/schedule/utils.d.ts +0 -32
  94. package/dist/server/types.d.ts +0 -66
  95. package/dist/server/utils/index.d.ts +0 -5
  96. package/dist/server/utils/schedule.d.ts +0 -14
  97. package/dist/server/utils/time.d.ts +0 -18
  98. package/dist/solution/BookingTicket/utils/bookingStatus.d.ts +0 -77
  99. package/dist/solution/BookingTicket/utils/exampleData.d.ts +0 -123
  100. package/dist/solution/BookingTicket/utils/resolveBestAddTimePlan.d.ts +0 -185
  101. package/dist/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +0 -38
  102. package/dist/solution/BookingTicket/utils/scan/scanCache.d.ts +0 -78
  103. package/dist/solution/BookingTicket/utils/scan/scanProductValues.d.ts +0 -21
  104. package/dist/solution/BookingTicket/utils/weighingProductSku.d.ts +0 -5
  105. package/dist/solution/PlaceOrder/index.d.ts +0 -0
  106. package/dist/solution/RegisterAndLogin/config.d.ts +0 -93
  107. package/dist/solution/RegisterAndLogin/types.d.ts +0 -445
  108. package/dist/solution/RegisterAndLogin/utils.d.ts +0 -103
  109. package/dist/store/createStore.d.ts +0 -3
  110. package/dist/types/index.d.ts +0 -132
  111. package/dist/utils/os-private-payload.d.ts +0 -5
  112. package/dist/utils/payment-number.d.ts +0 -9
  113. package/dist/utils/task.d.ts +0 -40
  114. package/dist/utils/watch.d.ts +0 -102
  115. package/lib/apis/picoding.d.ts +0 -0
  116. package/lib/effects/index.d.ts +0 -19
  117. package/lib/model/strategy/adapter/dataVariant/adapter.d.ts +0 -50
  118. package/lib/model/strategy/adapter/dataVariant/evaluator.d.ts +0 -105
  119. package/lib/model/strategy/adapter/dataVariant/examples.d.ts +0 -39
  120. package/lib/model/strategy/adapter/dataVariant/index.d.ts +0 -4
  121. package/lib/model/strategy/adapter/dataVariant/type.d.ts +0 -173
  122. package/lib/model/strategy/adapter/promotion/adapter.d.ts +0 -70
  123. package/lib/model/strategy/adapter/promotion/examples.d.ts +0 -224
  124. package/lib/model/strategy/adapter/promotion/type.d.ts +0 -535
  125. package/lib/model/strategy/adapter/type.d.ts +0 -28
  126. package/lib/model/strategy/adapter/walletPass/index.d.ts +0 -32
  127. package/lib/model/strategy/adapter/walletPass/locales.d.ts +0 -1
  128. package/lib/model/strategy/adapter/walletPass/type.d.ts +0 -192
  129. package/lib/model/strategy/adapter/walletPass/utils.d.ts +0 -50
  130. package/lib/model/strategy/engine.d.ts +0 -119
  131. package/lib/model/strategy/type.d.ts +0 -245
  132. package/lib/modules/Account/types.d.ts +0 -56
  133. package/lib/modules/BookingContext/types.d.ts +0 -104
  134. package/lib/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +0 -76
  135. package/lib/modules/BookingContext/utils/flexible.d.ts +0 -28
  136. package/lib/modules/BookingContext/utils/formatResourceList.d.ts +0 -8
  137. package/lib/modules/BookingContext/utils/noResource.d.ts +0 -13
  138. package/lib/modules/BookingContext/utils/orderLineDisplay.d.ts +0 -1
  139. package/lib/modules/BookingContext/utils/resourceErrors.d.ts +0 -41
  140. package/lib/modules/BookingContext/utils/resourceSelection.d.ts +0 -7
  141. package/lib/modules/BookingContext/utils/serviceTimes.d.ts +0 -55
  142. package/lib/modules/BookingContext/utils/timeSlices.d.ts +0 -42
  143. package/lib/modules/Customer/constants.d.ts +0 -7
  144. package/lib/modules/Date/types.d.ts +0 -84
  145. package/lib/modules/Date/utils.d.ts +0 -36
  146. package/lib/modules/FulfillmentTiming/index.d.ts +0 -11
  147. package/lib/modules/FulfillmentTiming/types.d.ts +0 -67
  148. package/lib/modules/Order/payment-utils.d.ts +0 -26
  149. package/lib/modules/Order/pickupTiming.d.ts +0 -46
  150. package/lib/modules/Order/utils/manualProductDiscount.d.ts +0 -106
  151. package/lib/modules/Order/utils/orderCollectionIdentity.d.ts +0 -68
  152. package/lib/modules/Order/utils/weighedProduct.d.ts +0 -12
  153. package/lib/modules/Payment/cashRecommendationAlgorithm.d.ts +0 -21
  154. package/lib/modules/Payment/mx51.d.ts +0 -0
  155. package/lib/modules/Payment/types.d.ts +0 -943
  156. package/lib/modules/Payment/utils.d.ts +0 -19
  157. package/lib/modules/Quotation/types.d.ts +0 -61
  158. package/lib/modules/Resource/types.d.ts +0 -50
  159. package/lib/modules/Resource/utils.d.ts +0 -23
  160. package/lib/modules/ResourcePlanner/localClock.d.ts +0 -33
  161. package/lib/modules/SalesSummary/types.d.ts +0 -69
  162. package/lib/modules/ScanOrderLogger/providers/feishu.d.ts +0 -2
  163. package/lib/modules/ScanOrderLogger/providers/grafana.d.ts +0 -2
  164. package/lib/modules/ScanOrderLogger/types.d.ts +0 -53
  165. package/lib/modules/Schedule/getDateIsInSchedule.d.ts +0 -32
  166. package/lib/modules/Schedule/type.d.ts +0 -157
  167. package/lib/modules/Schedule/types.d.ts +0 -201
  168. package/lib/modules/Schedule/utils.d.ts +0 -67
  169. package/lib/modules/Step/tyeps.d.ts +0 -20
  170. package/lib/modules/SurchargeList/types.d.ts +0 -15
  171. package/lib/plugins/app.d.ts +0 -10
  172. package/lib/plugins/shopStore.d.ts +0 -4
  173. package/lib/plugins/user.d.ts +0 -7
  174. package/lib/server/modules/floor-plan/types.d.ts +0 -43
  175. package/lib/server/modules/menu/types.d.ts +0 -68
  176. package/lib/server/modules/payment/types.d.ts +0 -9
  177. package/lib/server/modules/quotation/types.d.ts +0 -50
  178. package/lib/server/modules/resource/types.d.ts +0 -121
  179. package/lib/server/modules/schedule/types.d.ts +0 -1
  180. package/lib/server/modules/schedule/utils.d.ts +0 -32
  181. package/lib/server/types.d.ts +0 -66
  182. package/lib/server/utils/index.d.ts +0 -5
  183. package/lib/server/utils/schedule.d.ts +0 -14
  184. package/lib/server/utils/time.d.ts +0 -18
  185. package/lib/solution/BookingTicket/utils/bookingStatus.d.ts +0 -77
  186. package/lib/solution/BookingTicket/utils/exampleData.d.ts +0 -123
  187. package/lib/solution/BookingTicket/utils/resolveBestAddTimePlan.d.ts +0 -185
  188. package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +0 -38
  189. package/lib/solution/BookingTicket/utils/scan/scanCache.d.ts +0 -78
  190. package/lib/solution/BookingTicket/utils/scan/scanProductValues.d.ts +0 -21
  191. package/lib/solution/BookingTicket/utils/weighingProductSku.d.ts +0 -5
  192. package/lib/solution/PlaceOrder/index.d.ts +0 -0
  193. package/lib/solution/RegisterAndLogin/config.d.ts +0 -93
  194. package/lib/solution/RegisterAndLogin/types.d.ts +0 -445
  195. package/lib/solution/RegisterAndLogin/utils.d.ts +0 -103
  196. package/lib/store/createStore.d.ts +0 -3
  197. package/lib/types/index.d.ts +0 -132
  198. package/lib/utils/os-private-payload.d.ts +0 -5
  199. package/lib/utils/payment-number.d.ts +0 -9
  200. package/lib/utils/task.d.ts +0 -40
  201. package/lib/utils/watch.d.ts +0 -102
@@ -1,132 +0,0 @@
1
- /**
2
- * pisell OS 核心类型定义
3
- */
4
- export interface Plugin {
5
- name: string;
6
- version: string;
7
- initialize: () => Promise<void> | void;
8
- destroy?: () => Promise<void> | void;
9
- getLocalStorage?: (key: string) => string | null;
10
- }
11
- export interface PluginOptions {
12
- dependencies?: string[];
13
- }
14
- export interface Module {
15
- name: string;
16
- version: string;
17
- initialize: (core: PisellCore, options: ModuleOptions) => Promise<void> | void;
18
- /**
19
- * 父级解决方案运行时更新 otherParams 后,显式通知子模块刷新自己的运行态参数。
20
- *
21
- * @example
22
- * await module.updateOtherParams?.({ channel: 'pos' }, { changedParams: { channel: 'pos' } });
23
- */
24
- updateOtherParams?: (params: Record<string, any>, meta?: {
25
- changedParams?: Record<string, any>;
26
- cover?: boolean;
27
- }) => Promise<void> | void;
28
- destroy?: () => Promise<void> | void;
29
- exports?: Record<string, any>;
30
- isSolution?: boolean;
31
- [key: string]: any;
32
- }
33
- export interface ModuleOptions {
34
- dependencies?: string[];
35
- plugins?: string[];
36
- hooks?: any;
37
- store?: Record<string, any>;
38
- initialState?: Record<string, any>;
39
- otherParams?: Record<string, any>;
40
- }
41
- export type EventHandler = (data?: any) => void;
42
- export interface PisellCore {
43
- registerPlugin: (plugin: Plugin, options?: PluginOptions) => void;
44
- getPlugin: <T extends Plugin>(name: string) => T | null;
45
- hasPlugin: (name: string) => boolean;
46
- registerModule: (module: Module, options?: ModuleOptions) => void;
47
- unregisterModule: (module: Module, options?: ModuleOptions) => void;
48
- getModule: <T extends Module>(name: string) => T | null;
49
- getModuleExports: <T = any>(name: string) => T | null;
50
- hasModule: (name: string) => boolean;
51
- getModuleNames: () => string[];
52
- effects: {
53
- on: (event: string, callback: (payload: any) => void) => () => void;
54
- once: (event: string, callback: (payload: any) => void) => () => void;
55
- only: (event: string, callback: (payload: any) => void) => () => void;
56
- off: (event: string, callback: (payload: any) => void) => void;
57
- emit: (event: string, payload: any, value?: any) => Promise<{
58
- status: boolean;
59
- data: any;
60
- }>;
61
- offByModuleDestroy: (module: string) => void;
62
- };
63
- context: BusinessContext;
64
- validateContext: (config: ModuleContextConfig) => boolean;
65
- serverOptions?: ServerOptions;
66
- server?: any;
67
- setContext: (ctx: Partial<BusinessContext>) => void;
68
- }
69
- /**
70
- * 业务上下文接口
71
- */
72
- export interface BusinessContext {
73
- userId?: string;
74
- companyId?: string;
75
- locale?: string;
76
- [key: string]: any;
77
- }
78
- /**
79
- * 上下文验证规则
80
- */
81
- export interface ContextValidationRule {
82
- name: string;
83
- required: boolean;
84
- validate?: (value: any) => boolean;
85
- message?: string;
86
- }
87
- /**
88
- * 模块上下文配置
89
- */
90
- export interface ModuleContextConfig {
91
- name: string;
92
- validations: ContextValidationRule[];
93
- }
94
- /**
95
- * Server 模块配置
96
- */
97
- export interface ServerModuleConfig {
98
- /** 模块名称 */
99
- name: string;
100
- /** 是否自动预加载数据 */
101
- preload?: boolean;
102
- /** 模块配置参数 */
103
- config?: Record<string, any>;
104
- }
105
- /**
106
- * Server 配置选项
107
- */
108
- export interface ServerOptions {
109
- All_DATA_SOURCES: Record<string, any>;
110
- /** 要启用的模块列表 */
111
- modules?: string[] | ServerModuleConfig[];
112
- /** 是否自动初始化数据 */
113
- autoInitData?: boolean;
114
- }
115
- export interface PisellOSOptions {
116
- debug?: boolean;
117
- plugins?: Array<{
118
- plugin: Plugin;
119
- options?: PluginOptions;
120
- }>;
121
- modules?: Array<{
122
- module: Module;
123
- options?: ModuleOptions;
124
- }>;
125
- context?: BusinessContext;
126
- /** Server 配置 */
127
- server?: ServerOptions;
128
- }
129
- export interface InitializeServerOptions {
130
- onModuleLoad?: (module: string) => void;
131
- onModuleLoadComplete?: (module: string) => void;
132
- }
@@ -1,5 +0,0 @@
1
- /**
2
- * Remove top-level fields reserved for communication with the PisellOS proxy.
3
- * Nested business payloads are intentionally left untouched.
4
- */
5
- export declare function stripOsPrivatePayloadFields<T>(data: T): T;
@@ -1,9 +0,0 @@
1
- export type PaymentNumberAppDataGetter = (key: string) => unknown;
2
- /**
3
- * Resolve the synchronous fallback without caching runtime device data.
4
- */
5
- export declare function resolvePaymentNumberDevicePrefixFromDeviceId(getAppData: PaymentNumberAppDataGetter): string;
6
- /**
7
- * Resolve the latest device segment when a new payment number is generated.
8
- */
9
- export declare function resolvePaymentNumberDevicePrefix(getAppData: PaymentNumberAppDataGetter): Promise<string>;
@@ -1,40 +0,0 @@
1
- type Action = (...args: any[]) => Promise<any>;
2
- type Task = {
3
- uuid: string;
4
- type: string;
5
- actionParams?: Record<string, any>;
6
- };
7
- declare class Tasks {
8
- private actions;
9
- private taskQueue;
10
- isRunning: boolean;
11
- constructor(actions?: Map<string, Action>);
12
- /**
13
- * 清空所有任务
14
- */
15
- clear(): void;
16
- /**
17
- * 清空任务执行队列
18
- */
19
- clearTaskQueue(): void;
20
- /**
21
- * 添加action
22
- * @param name action名称
23
- * @param action action函数
24
- */
25
- addAction(name: string, action: Action): void;
26
- /**
27
- * 添加任务
28
- * @param task 任务
29
- */
30
- addTask(task: Task): void;
31
- /**
32
- * 执行任务
33
- */
34
- run(): Promise<void>;
35
- /**
36
- * 判定当前的任务是否依然存在
37
- */
38
- isTaskExist(uuid: string): boolean;
39
- }
40
- export default Tasks;
@@ -1,102 +0,0 @@
1
- /**
2
- * 监听模块
3
- *
4
- */
5
- export type WatchEventCallback = (...args: any[]) => void;
6
- export type WatchEventItem = {
7
- key: string;
8
- callback: WatchEventCallback;
9
- };
10
- export interface WatchEventSubscription {
11
- unsubscribe: () => void;
12
- }
13
- declare class Watch {
14
- private events;
15
- private enableListMap;
16
- /**
17
- * 订阅事件
18
- * @param event 事件名称
19
- * @param callback 回调函数
20
- * @returns 订阅对象,可用于取消订阅
21
- */
22
- subscribe(watchKey: string, event: WatchEventItem): WatchEventSubscription;
23
- /**
24
- * 启用事件
25
- * @param watchKey 监听的key
26
- * @param event 事件名称
27
- */
28
- enableEvent(watchKey: string, eventKey: string): void;
29
- /**
30
- * 禁用某个事件
31
- * @param watchKey 监听的key
32
- * @param eventKey 事件名称
33
- */
34
- disableEvent(watchKey: string, eventKey: string): void;
35
- /**
36
- * 冻结某个监听下的所有事件
37
- * @param watchKey 监听的key
38
- */
39
- disabledAllEventByWatchKey(watchKey: string): void;
40
- /**
41
- * 启用某个监听下的所有事件
42
- * @param watchKey 监听的key
43
- */
44
- enableAllEventByWatchKey(watchKey: string): void;
45
- /**
46
- * 取消订阅事件
47
- * @param event 事件名称
48
- * @param callback 回调函数
49
- * @returns 是否成功取消订阅
50
- */
51
- unsubscribe(watchKey: string, event: WatchEventItem): void;
52
- /**
53
- * 发布事件
54
- * @param event 事件名称
55
- * @param args 事件参数
56
- */
57
- publish(watchKey: string, ...args: any[]): void;
58
- /**
59
- * 根据事件名称发布事件
60
- * @param watchKey 监听的key
61
- * @param eventKey 事件名称
62
- * @param args 事件参数
63
- */
64
- publishByEventKey(watchKey: string, eventKey: string, ...args: any[]): void;
65
- /**
66
- * 获取最后一个启用的事件
67
- * @param watchKey 监听的key
68
- * @returns 最后一个启用的事件
69
- */
70
- getLastEnableEventKey(watchKey: string): WatchEventItem['key'] | undefined;
71
- /**
72
- * 移除某个事件的所有订阅
73
- * @param event 事件名称
74
- * @returns 是否成功移除
75
- */
76
- clearEvent(watchKey: string): void;
77
- /**
78
- * 移除所有事件订阅
79
- */
80
- clearAllEvents(): void;
81
- /**
82
- * 获取事件的订阅数量
83
- * @param event 事件名称
84
- * @returns 订阅数量
85
- */
86
- getSubscriberCount(event: string): number;
87
- /**
88
- * 检查事件是否有订阅者
89
- * @param event 事件名称
90
- * @returns 是否有订阅者
91
- */
92
- hasSubscribers(event: string): boolean;
93
- /**
94
- * 一次性订阅事件,事件触发后自动取消订阅
95
- * @param event 事件名称
96
- * @param callback 回调函数
97
- * @returns 订阅对象,可用于取消订阅
98
- */
99
- once(watchKey: string, event: WatchEventItem): WatchEventSubscription;
100
- }
101
- declare const watch: Watch;
102
- export default watch;
File without changes
@@ -1,19 +0,0 @@
1
- type EffectCallback = (payload: any) => void | Promise<void | {
2
- status: boolean;
3
- message?: string;
4
- }>;
5
- type UnsubscribeFunction = () => void;
6
- declare class EffectsManager {
7
- private listeners;
8
- on(event: string, callback: EffectCallback): UnsubscribeFunction;
9
- only(event: string, callback: EffectCallback): UnsubscribeFunction;
10
- off(event: string, callback: EffectCallback): void;
11
- offByModuleDestroy(module: string): void;
12
- once(event: string, callback: EffectCallback): UnsubscribeFunction;
13
- emit(event: string, payload: any): Promise<{
14
- status: boolean;
15
- data: any;
16
- }>;
17
- clear(): void;
18
- }
19
- export { EffectsManager, UnsubscribeFunction };
@@ -1,50 +0,0 @@
1
- import type { EvaluationResult, RuntimeContext } from '../../type';
2
- import type { BusinessAdapter } from '../type';
3
- import type { DataVariantBusinessData, DataVariantProduct } from './type';
4
- /**
5
- * Data Variant 适配器。
6
- *
7
- * 负责把智能定价运行态数据转换为 StrategyEngine 能识别的 attributes。
8
- */
9
- export declare class DataVariantAdapter implements BusinessAdapter {
10
- name: string;
11
- version: string;
12
- /**
13
- * 准备批量全局上下文。
14
- *
15
- * 这里只放不依赖单个商品的字段,用于预计算 schedule/channel/orderType 等条件。
16
- */
17
- prepareContext(businessData: DataVariantBusinessData): RuntimeContext;
18
- /**
19
- * 准备全局预计算上下文。
20
- */
21
- prepareGlobalContext(businessData: DataVariantBusinessData): RuntimeContext;
22
- /**
23
- * 准备单商品上下文。
24
- *
25
- * 商品级条件只在当前商品 data_variants 引用到对应规则后才评估。
26
- */
27
- prepareProductContext(businessData: DataVariantBusinessData, product: DataVariantProduct): RuntimeContext;
28
- transformResult(result: EvaluationResult): EvaluationResult;
29
- formatConfig(result: EvaluationResult, businessData?: DataVariantBusinessData): {
30
- result: EvaluationResult;
31
- businessData?: DataVariantBusinessData;
32
- };
33
- /**
34
- * 构建 menu_match 使用的轻量商品对象。
35
- *
36
- * collection_ids 来自商品 collection 字段,避免 operator 读取复杂商品对象。
37
- */
38
- buildProductValue(product: DataVariantProduct): {
39
- id: number;
40
- product_variant_id: number;
41
- collection_ids: number[];
42
- };
43
- private toNumber;
44
- /**
45
- * 归一化客户 id:无效值返回 undefined,有效值统一为 number。
46
- */
47
- private normalizeCustomerId;
48
- private normalizeNumberArray;
49
- }
50
- export default DataVariantAdapter;
@@ -1,105 +0,0 @@
1
- import type { ConditionRule, StrategyConfig } from '../../type';
2
- import type { ConditionScope, DataVariantBusinessData, DataVariantMenu, DataVariantRuleMetadata, MenuScope, ResolvedDataVariantResult } from './type';
3
- /**
4
- * Data Variant 评估器。
5
- *
6
- * OS Server 商品路由开启时由 ProductsModule 调用;路由关闭时由 ProductList 在远端响应后调用。
7
- */
8
- export declare class DataVariantEvaluator {
9
- private adapter;
10
- private strategyConfigs;
11
- constructor();
12
- /**
13
- * 设置策略配置列表,仅保留 metadata.type === 'data_variant' 的策略。
14
- */
15
- setStrategyConfigs(configs: StrategyConfig[]): void;
16
- getStrategyConfigs(): StrategyConfig<DataVariantRuleMetadata>[];
17
- /**
18
- * 批量解析商品 Data Variant。
19
- *
20
- * 优先使用商品 metadata.data_variant_ids;缺少权威命中结果时才执行本地策略判断。
21
- */
22
- resolveProducts(businessData: DataVariantBusinessData): ResolvedDataVariantResult;
23
- /**
24
- * 根据 operator/field 判断条件是否依赖当前商品。
25
- */
26
- getConditionScope(rule: ConditionRule): ConditionScope;
27
- /**
28
- * 将餐牌 partyroom_package 预构建为 Map/Set 索引。
29
- */
30
- buildMenuScopeMap(menuList: DataVariantMenu[]): Map<number, MenuScope>;
31
- /**
32
- * 从当前策略中所有 schedule_match.value 绑定的 schedule_id 提取时间点。
33
- *
34
- * 这里不依赖餐牌,只读取策略配置和调用方传入的 scheduleList。
35
- */
36
- buildScheduleTimePoints(strategyConfigs: StrategyConfig<DataVariantRuleMetadata>[], scheduleList: NonNullable<DataVariantBusinessData['scheduleList']>): string[];
37
- /**
38
- * 判断商品(含套餐子商品)是否仍需要本地执行策略条件。
39
- * metadata.data_variant_ids 只要是数组,即使为空,也表示接口已经给出权威命中结果。
40
- */
41
- private requiresLocalStrategyEvaluation;
42
- /**
43
- * 将接口返回的高 -> 低优先级 Variant ID 转成数值优先级。
44
- * 返回 null 表示接口没有提供该字段;空 Map 表示已计算但没有任何命中。
45
- */
46
- private getAuthoritativeVariantPriorities;
47
- private normalizeDataVariantId;
48
- private buildGlobalEffectiveRuleMap;
49
- private resolveProduct;
50
- /**
51
- * 多货币 Data Variant 只生成候选列表,不参与商品字段覆盖。
52
- * rule_id=0 是无条件默认价;同币种命中的条件价优先于默认价。
53
- */
54
- private resolveSettlementOptions;
55
- /**
56
- * 解析套餐子商品上的 Data Variant 覆盖。
57
- *
58
- * bundle_item 以 bundle_product_id / bundle_variant_id 作为商品身份参与 product_match 等条件判断。
59
- */
60
- private resolveProductBundleItems;
61
- /**
62
- * 将 bundle_item 转为 DataVariantProduct 并评估 data_variants。
63
- */
64
- private resolveBundleItem;
65
- /**
66
- * bundle_item 的商品身份映射:bundle_product_id + bundle_variant_id。
67
- */
68
- private toBundleItemDataVariantProduct;
69
- /**
70
- * 仅回写命中的字段,避免污染 bundle_item 的结构字段。
71
- */
72
- private mergeBundleItemResolvedData;
73
- private evaluateProductRules;
74
- /**
75
- * 拆分策略条件。
76
- *
77
- * 当前 MVP 支持顶层 and 原子条件拆分;复杂条件保守地放到商品级完整判断。
78
- */
79
- private splitStrategyConfig;
80
- private createEngine;
81
- private evaluateScheduleMatch;
82
- private evaluateMenuMatch;
83
- private evaluateArrayIntersects;
84
- private collectScheduleIdsFromStrategies;
85
- private extractTimePointsFromSchedules;
86
- private addDateTimePoint;
87
- private addRawTimePoint;
88
- private extractTimeFromDateTime;
89
- private normalizeTime;
90
- private timeToMinutes;
91
- private isProductInMenuScope;
92
- private mergeMatchedVariants;
93
- private getProductDataVariants;
94
- private normalizeStrategyConfigs;
95
- private isStrategyActive;
96
- private getStrategyPriority;
97
- private createAlwaysTrueConditions;
98
- private flattenConditionRules;
99
- private isConditionGroup;
100
- private normalizeNumberArray;
101
- private normalizeComparableArray;
102
- private buildProductKey;
103
- private toNumber;
104
- }
105
- export default DataVariantEvaluator;
@@ -1,39 +0,0 @@
1
- import type { StrategyConfig } from '../../type';
2
- import type { ScheduleItem } from '../../../../modules/Schedule/types';
3
- import type { DataVariantItem, DataVariantMenu, DataVariantProduct, DataVariantRuleMetadata } from './type';
4
- /**
5
- * 构造示例用 data_variant 记录,字段结构与后端 /product/query 返回一致。
6
- */
7
- export declare function createExampleDataVariant(ruleId: number | string, data: Record<string, any>, overrides?: Partial<Omit<DataVariantItem, 'data_variant_rule_id' | 'data'>>): DataVariantItem;
8
- /**
9
- * 晚场餐牌价:命中日程 + 餐牌商品范围后覆盖 price / stock。
10
- */
11
- export declare const EVENING_MENU_PRICE_STRATEGY: StrategyConfig<DataVariantRuleMetadata>;
12
- /**
13
- * VIP 商品价:演示 product_match 与更高优先级字段覆盖。
14
- */
15
- export declare const VIP_PRODUCT_PRICE_STRATEGY: StrategyConfig<DataVariantRuleMetadata>;
16
- /**
17
- * 客户/渠道/业务范围价:演示 customer_id、channel、business_code 的 in 条件。
18
- */
19
- export declare const CUSTOMER_SCOPE_PRICE_STRATEGY: StrategyConfig<DataVariantRuleMetadata>;
20
- /**
21
- * 示例日程:2026-06-26 17:00 ~ 20:00 生效。
22
- */
23
- export declare const DATA_VARIANT_EXAMPLE_SCHEDULES: ScheduleItem[];
24
- /**
25
- * 示例餐牌:product_collection = 128 的商品均属于餐牌。
26
- */
27
- export declare const DATA_VARIANT_EXAMPLE_MENUS: DataVariantMenu[];
28
- /**
29
- * 示例商品:同时带两条 Data Variant 覆盖数据。
30
- */
31
- export declare const DATA_VARIANT_EXAMPLE_PRODUCTS: DataVariantProduct[];
32
- /**
33
- * Data Variant 评估器示例调用。
34
- */
35
- export declare function runDataVariantDemo(): import("./type").ResolvedDataVariantResult;
36
- /**
37
- * 客户/渠道/业务范围条件示例调用。
38
- */
39
- export declare function runCustomerScopeDataVariantDemo(): import("./type").ResolvedDataVariantResult;
@@ -1,4 +0,0 @@
1
- export { DataVariantAdapter } from './adapter';
2
- export { DataVariantEvaluator } from './evaluator';
3
- export { runDataVariantDemo } from './examples';
4
- export * from './type';
@@ -1,173 +0,0 @@
1
- import type { ConditionRule, EvaluationResult, StrategyConfig } from '../../type';
2
- import type { ScheduleItem } from '../../../../modules/Schedule/types';
3
- /**
4
- * Data Variant 动作类型。
5
- *
6
- * 当前阶段动作只用于标识“该策略可应用 data variant 覆盖”,真实覆盖数据来自商品 data_variants。
7
- */
8
- export declare const DATA_VARIANT_ACTION_TYPES: {
9
- readonly APPLY: "DATA_VARIANT_APPLY";
10
- };
11
- export type DataVariantActionType = (typeof DATA_VARIANT_ACTION_TYPES)[keyof typeof DATA_VARIANT_ACTION_TYPES];
12
- /**
13
- * Data Variant 规则元数据。
14
- *
15
- * priority 数字越大优先级越高,合并时后覆盖低优先级字段。
16
- */
17
- export interface DataVariantRuleMetadata {
18
- module?: 'product' | string;
19
- priority?: number;
20
- status?: 'active' | 'inactive' | string;
21
- updated_at?: string;
22
- [key: string]: any;
23
- }
24
- /**
25
- * 商品上的单条 Data Variant 记录,结构与后端 data_variant 表对齐。
26
- */
27
- export interface DataVariantItem {
28
- /** 变体记录 id */
29
- id?: number;
30
- /** 店铺 id */
31
- shop_id?: number;
32
- /** 所属模块,商品场景固定为 product */
33
- module?: 'product' | string;
34
- /** 模块数据 id,商品场景对应 product.id */
35
- module_data_id?: number;
36
- /** 关联策略模型 metadata.id / data_variant_rule.id */
37
- data_variant_rule_id: number | string;
38
- /** 业务类型;多货币结算候选不会走普通字段覆盖 */
39
- business_type?: 'multi_currency_settlement' | string;
40
- /** 数据状态;多货币结算仅处理 enable 记录 */
41
- status?: 'enable' | 'disable' | string;
42
- /** 命中策略后需要覆盖到商品上的字段 */
43
- data: Record<string, any>;
44
- created_at?: string | null;
45
- updated_at?: string | null;
46
- deleted_at?: string | null;
47
- }
48
- /**
49
- * Data Variant 评估使用的轻量商品结构。
50
- */
51
- export interface DataVariantProduct {
52
- id?: number | string;
53
- product_id?: number | string;
54
- product_variant_id?: number | string;
55
- variant_id?: number | string;
56
- collection?: Array<{
57
- id?: number | string;
58
- [key: string]: any;
59
- }>;
60
- /**
61
- * 商品接口已经完成规则计算时返回的命中结果。
62
- * 数组按 Data Variant 优先级从高到低排列;空数组表示已计算但无命中。
63
- */
64
- metadata?: {
65
- data_variant_ids?: Array<number | string>;
66
- [key: string]: any;
67
- };
68
- /** 后端 /product/query with dataVariants 返回的智能定价变体列表 */
69
- data_variants?: DataVariantItem[];
70
- /** 当前上下文解析后的可选结算货币,不覆盖商品原始多货币配置 */
71
- available_settlement_options?: AvailableSettlementOption[];
72
- _dataVariant?: DataVariantAppliedInfo;
73
- [key: string]: any;
74
- }
75
- export interface AvailableSettlementOption extends Record<string, any> {
76
- settlement_type: 'legal_currency' | 'virtual_currency' | string;
77
- currency_product_id?: number;
78
- price: string;
79
- data_variant_id?: number;
80
- data_variant_rule_id: number | string;
81
- available: boolean;
82
- disabled_reason?: string;
83
- }
84
- /**
85
- * 餐牌商品配置项。
86
- */
87
- export interface DataVariantMenuProductItem {
88
- product_collection_id?: number | string;
89
- product_id?: number | string;
90
- product_variant_id?: number | string;
91
- }
92
- /**
93
- * 餐牌数据的最小结构。
94
- */
95
- export interface DataVariantMenu {
96
- form_record_id: number | string;
97
- status?: string;
98
- schedule?: Array<number | string>;
99
- partyroom_package?: {
100
- type?: 'product_all' | 'product_collection' | 'products' | string;
101
- products?: DataVariantMenuProductItem[];
102
- };
103
- [key: string]: any;
104
- }
105
- /**
106
- * 单个餐牌预构建后的商品范围索引。
107
- */
108
- export interface MenuScope {
109
- isAllProducts: boolean;
110
- collectionIds: Set<number>;
111
- productKeys: Set<string>;
112
- productAllVariantIds: Set<number>;
113
- }
114
- /**
115
- * 批量评估输入。
116
- */
117
- export interface DataVariantBusinessData {
118
- products: DataVariantProduct[];
119
- strategyConfigs?: StrategyConfig<DataVariantRuleMetadata>[];
120
- scheduleDateTime?: string;
121
- scheduleList?: ScheduleItem[];
122
- menuList?: DataVariantMenu[];
123
- channel?: string;
124
- orderType?: string;
125
- /** 当前业务编码,对应策略条件 field: business_code */
126
- businessCode?: string;
127
- customerId?: number | string;
128
- /** 当前客户可用 wallet/pass id 合并列表,对应策略条件 field: available_wallet_ids */
129
- availableWalletIds?: Array<number | string>;
130
- custom?: Record<string, any>;
131
- }
132
- /**
133
- * 全局预计算后的规则信息。
134
- */
135
- export interface EffectiveRuleInfo {
136
- ruleId: string;
137
- priority: number;
138
- strategyConfig: StrategyConfig<DataVariantRuleMetadata>;
139
- productRules: ConditionRule[];
140
- globalResult: EvaluationResult;
141
- }
142
- export type GlobalEffectiveRuleMap = Map<string, EffectiveRuleInfo>;
143
- /**
144
- * 单条商品命中的变体覆盖信息。
145
- */
146
- export interface MatchedDataVariant {
147
- ruleId: string;
148
- priority: number;
149
- data: Record<string, any>;
150
- variant: DataVariantItem;
151
- }
152
- /**
153
- * 商品上记录的 Data Variant 调试信息。
154
- */
155
- export interface DataVariantAppliedInfo {
156
- appliedRuleIds: string[];
157
- /** 本地策略实际应用的 Data Variant ID,按优先级从高到低排列。 */
158
- appliedVariantIds?: Array<number | string>;
159
- appliedFields: string[];
160
- original: DataVariantProduct;
161
- }
162
- /**
163
- * 批量解析结果。
164
- */
165
- export interface ResolvedDataVariantResult {
166
- products: DataVariantProduct[];
167
- globalEffectiveRuleMap: GlobalEffectiveRuleMap;
168
- menuScopeMap: Map<number, MenuScope>;
169
- /** 当前策略中 schedule_match 绑定的日程提取出的时间点,格式如 ["10:00", "13:00"] */
170
- scheduleTimePoints: string[];
171
- rawResults: EvaluationResult[];
172
- }
173
- export type ConditionScope = 'global' | 'product';