@pisell/pisellos 0.10.75 → 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 (189) 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/lib/modules/Product/index.d.ts +1 -1
  9. package/lib/server/index.js +5 -0
  10. package/lib/shared/receipt/small-ticket.d.ts +3 -0
  11. package/lib/shared/receipt/small-ticket.js +21 -0
  12. package/lib/solution/BookingByStep/index.d.ts +2 -2
  13. package/lib/solution/BookingTicket/index.d.ts +13 -1
  14. package/lib/solution/OrderInvoicePreview/index.js +6 -1
  15. package/package.json +1 -1
  16. package/dist/apis/picoding.d.ts +0 -0
  17. package/dist/effects/index.d.ts +0 -19
  18. package/dist/model/strategy/adapter/dataVariant/adapter.d.ts +0 -50
  19. package/dist/model/strategy/adapter/dataVariant/evaluator.d.ts +0 -105
  20. package/dist/model/strategy/adapter/dataVariant/examples.d.ts +0 -39
  21. package/dist/model/strategy/adapter/dataVariant/index.d.ts +0 -4
  22. package/dist/model/strategy/adapter/dataVariant/type.d.ts +0 -173
  23. package/dist/model/strategy/adapter/promotion/adapter.d.ts +0 -70
  24. package/dist/model/strategy/adapter/promotion/examples.d.ts +0 -224
  25. package/dist/model/strategy/adapter/promotion/type.d.ts +0 -535
  26. package/dist/model/strategy/adapter/type.d.ts +0 -28
  27. package/dist/model/strategy/adapter/walletPass/index.d.ts +0 -32
  28. package/dist/model/strategy/adapter/walletPass/locales.d.ts +0 -1
  29. package/dist/model/strategy/adapter/walletPass/type.d.ts +0 -192
  30. package/dist/model/strategy/adapter/walletPass/utils.d.ts +0 -50
  31. package/dist/model/strategy/engine.d.ts +0 -119
  32. package/dist/model/strategy/type.d.ts +0 -245
  33. package/dist/modules/Account/types.d.ts +0 -56
  34. package/dist/modules/BookingContext/types.d.ts +0 -104
  35. package/dist/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +0 -76
  36. package/dist/modules/BookingContext/utils/flexible.d.ts +0 -28
  37. package/dist/modules/BookingContext/utils/formatResourceList.d.ts +0 -8
  38. package/dist/modules/BookingContext/utils/noResource.d.ts +0 -13
  39. package/dist/modules/BookingContext/utils/orderLineDisplay.d.ts +0 -1
  40. package/dist/modules/BookingContext/utils/resourceErrors.d.ts +0 -41
  41. package/dist/modules/BookingContext/utils/resourceSelection.d.ts +0 -7
  42. package/dist/modules/BookingContext/utils/serviceTimes.d.ts +0 -55
  43. package/dist/modules/BookingContext/utils/timeSlices.d.ts +0 -42
  44. package/dist/modules/Customer/constants.d.ts +0 -7
  45. package/dist/modules/Date/types.d.ts +0 -84
  46. package/dist/modules/Date/utils.d.ts +0 -36
  47. package/dist/modules/FulfillmentTiming/index.d.ts +0 -11
  48. package/dist/modules/FulfillmentTiming/types.d.ts +0 -67
  49. package/dist/modules/Order/payment-utils.d.ts +0 -26
  50. package/dist/modules/Order/pickupTiming.d.ts +0 -46
  51. package/dist/modules/Order/utils/manualProductDiscount.d.ts +0 -106
  52. package/dist/modules/Order/utils/orderCollectionIdentity.d.ts +0 -68
  53. package/dist/modules/Order/utils/weighedProduct.d.ts +0 -12
  54. package/dist/modules/Payment/cashRecommendationAlgorithm.d.ts +0 -21
  55. package/dist/modules/Payment/mx51.d.ts +0 -0
  56. package/dist/modules/Payment/types.d.ts +0 -943
  57. package/dist/modules/Payment/utils.d.ts +0 -19
  58. package/dist/modules/Quotation/types.d.ts +0 -61
  59. package/dist/modules/Resource/types.d.ts +0 -50
  60. package/dist/modules/Resource/utils.d.ts +0 -23
  61. package/dist/modules/ResourcePlanner/localClock.d.ts +0 -33
  62. package/dist/modules/SalesSummary/types.d.ts +0 -69
  63. package/dist/modules/ScanOrderLogger/providers/feishu.d.ts +0 -2
  64. package/dist/modules/ScanOrderLogger/providers/grafana.d.ts +0 -2
  65. package/dist/modules/ScanOrderLogger/types.d.ts +0 -53
  66. package/dist/modules/Schedule/getDateIsInSchedule.d.ts +0 -32
  67. package/dist/modules/Schedule/type.d.ts +0 -157
  68. package/dist/modules/Schedule/types.d.ts +0 -201
  69. package/dist/modules/Schedule/utils.d.ts +0 -67
  70. package/dist/modules/Step/tyeps.d.ts +0 -20
  71. package/dist/modules/SurchargeList/types.d.ts +0 -15
  72. package/dist/plugins/app.d.ts +0 -10
  73. package/dist/plugins/shopStore.d.ts +0 -4
  74. package/dist/plugins/user.d.ts +0 -7
  75. package/dist/server/modules/floor-plan/types.d.ts +0 -43
  76. package/dist/server/modules/menu/types.d.ts +0 -68
  77. package/dist/server/modules/payment/types.d.ts +0 -9
  78. package/dist/server/modules/quotation/types.d.ts +0 -50
  79. package/dist/server/modules/resource/types.d.ts +0 -121
  80. package/dist/server/modules/schedule/types.d.ts +0 -1
  81. package/dist/server/modules/schedule/utils.d.ts +0 -32
  82. package/dist/server/types.d.ts +0 -66
  83. package/dist/server/utils/index.d.ts +0 -5
  84. package/dist/server/utils/schedule.d.ts +0 -14
  85. package/dist/server/utils/time.d.ts +0 -18
  86. package/dist/solution/BookingTicket/utils/bookingStatus.d.ts +0 -77
  87. package/dist/solution/BookingTicket/utils/exampleData.d.ts +0 -123
  88. package/dist/solution/BookingTicket/utils/resolveBestAddTimePlan.d.ts +0 -185
  89. package/dist/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +0 -38
  90. package/dist/solution/BookingTicket/utils/scan/scanCache.d.ts +0 -78
  91. package/dist/solution/BookingTicket/utils/scan/scanProductValues.d.ts +0 -21
  92. package/dist/solution/BookingTicket/utils/weighingProductSku.d.ts +0 -5
  93. package/dist/solution/PlaceOrder/index.d.ts +0 -0
  94. package/dist/solution/RegisterAndLogin/config.d.ts +0 -93
  95. package/dist/solution/RegisterAndLogin/types.d.ts +0 -445
  96. package/dist/solution/RegisterAndLogin/utils.d.ts +0 -103
  97. package/dist/store/createStore.d.ts +0 -3
  98. package/dist/types/index.d.ts +0 -132
  99. package/dist/utils/os-private-payload.d.ts +0 -5
  100. package/dist/utils/payment-number.d.ts +0 -9
  101. package/dist/utils/task.d.ts +0 -40
  102. package/dist/utils/watch.d.ts +0 -102
  103. package/lib/apis/picoding.d.ts +0 -0
  104. package/lib/effects/index.d.ts +0 -19
  105. package/lib/model/strategy/adapter/dataVariant/adapter.d.ts +0 -50
  106. package/lib/model/strategy/adapter/dataVariant/evaluator.d.ts +0 -105
  107. package/lib/model/strategy/adapter/dataVariant/examples.d.ts +0 -39
  108. package/lib/model/strategy/adapter/dataVariant/index.d.ts +0 -4
  109. package/lib/model/strategy/adapter/dataVariant/type.d.ts +0 -173
  110. package/lib/model/strategy/adapter/promotion/adapter.d.ts +0 -70
  111. package/lib/model/strategy/adapter/promotion/examples.d.ts +0 -224
  112. package/lib/model/strategy/adapter/promotion/type.d.ts +0 -535
  113. package/lib/model/strategy/adapter/type.d.ts +0 -28
  114. package/lib/model/strategy/adapter/walletPass/index.d.ts +0 -32
  115. package/lib/model/strategy/adapter/walletPass/locales.d.ts +0 -1
  116. package/lib/model/strategy/adapter/walletPass/type.d.ts +0 -192
  117. package/lib/model/strategy/adapter/walletPass/utils.d.ts +0 -50
  118. package/lib/model/strategy/engine.d.ts +0 -119
  119. package/lib/model/strategy/type.d.ts +0 -245
  120. package/lib/modules/Account/types.d.ts +0 -56
  121. package/lib/modules/BookingContext/types.d.ts +0 -104
  122. package/lib/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +0 -76
  123. package/lib/modules/BookingContext/utils/flexible.d.ts +0 -28
  124. package/lib/modules/BookingContext/utils/formatResourceList.d.ts +0 -8
  125. package/lib/modules/BookingContext/utils/noResource.d.ts +0 -13
  126. package/lib/modules/BookingContext/utils/orderLineDisplay.d.ts +0 -1
  127. package/lib/modules/BookingContext/utils/resourceErrors.d.ts +0 -41
  128. package/lib/modules/BookingContext/utils/resourceSelection.d.ts +0 -7
  129. package/lib/modules/BookingContext/utils/serviceTimes.d.ts +0 -55
  130. package/lib/modules/BookingContext/utils/timeSlices.d.ts +0 -42
  131. package/lib/modules/Customer/constants.d.ts +0 -7
  132. package/lib/modules/Date/types.d.ts +0 -84
  133. package/lib/modules/Date/utils.d.ts +0 -36
  134. package/lib/modules/FulfillmentTiming/index.d.ts +0 -11
  135. package/lib/modules/FulfillmentTiming/types.d.ts +0 -67
  136. package/lib/modules/Order/payment-utils.d.ts +0 -26
  137. package/lib/modules/Order/pickupTiming.d.ts +0 -46
  138. package/lib/modules/Order/utils/manualProductDiscount.d.ts +0 -106
  139. package/lib/modules/Order/utils/orderCollectionIdentity.d.ts +0 -68
  140. package/lib/modules/Order/utils/weighedProduct.d.ts +0 -12
  141. package/lib/modules/Payment/cashRecommendationAlgorithm.d.ts +0 -21
  142. package/lib/modules/Payment/mx51.d.ts +0 -0
  143. package/lib/modules/Payment/types.d.ts +0 -943
  144. package/lib/modules/Payment/utils.d.ts +0 -19
  145. package/lib/modules/Quotation/types.d.ts +0 -61
  146. package/lib/modules/Resource/types.d.ts +0 -50
  147. package/lib/modules/Resource/utils.d.ts +0 -23
  148. package/lib/modules/ResourcePlanner/localClock.d.ts +0 -33
  149. package/lib/modules/SalesSummary/types.d.ts +0 -69
  150. package/lib/modules/ScanOrderLogger/providers/feishu.d.ts +0 -2
  151. package/lib/modules/ScanOrderLogger/providers/grafana.d.ts +0 -2
  152. package/lib/modules/ScanOrderLogger/types.d.ts +0 -53
  153. package/lib/modules/Schedule/getDateIsInSchedule.d.ts +0 -32
  154. package/lib/modules/Schedule/type.d.ts +0 -157
  155. package/lib/modules/Schedule/types.d.ts +0 -201
  156. package/lib/modules/Schedule/utils.d.ts +0 -67
  157. package/lib/modules/Step/tyeps.d.ts +0 -20
  158. package/lib/modules/SurchargeList/types.d.ts +0 -15
  159. package/lib/plugins/app.d.ts +0 -10
  160. package/lib/plugins/shopStore.d.ts +0 -4
  161. package/lib/plugins/user.d.ts +0 -7
  162. package/lib/server/modules/floor-plan/types.d.ts +0 -43
  163. package/lib/server/modules/menu/types.d.ts +0 -68
  164. package/lib/server/modules/payment/types.d.ts +0 -9
  165. package/lib/server/modules/quotation/types.d.ts +0 -50
  166. package/lib/server/modules/resource/types.d.ts +0 -121
  167. package/lib/server/modules/schedule/types.d.ts +0 -1
  168. package/lib/server/modules/schedule/utils.d.ts +0 -32
  169. package/lib/server/types.d.ts +0 -66
  170. package/lib/server/utils/index.d.ts +0 -5
  171. package/lib/server/utils/schedule.d.ts +0 -14
  172. package/lib/server/utils/time.d.ts +0 -18
  173. package/lib/solution/BookingTicket/utils/bookingStatus.d.ts +0 -77
  174. package/lib/solution/BookingTicket/utils/exampleData.d.ts +0 -123
  175. package/lib/solution/BookingTicket/utils/resolveBestAddTimePlan.d.ts +0 -185
  176. package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +0 -38
  177. package/lib/solution/BookingTicket/utils/scan/scanCache.d.ts +0 -78
  178. package/lib/solution/BookingTicket/utils/scan/scanProductValues.d.ts +0 -21
  179. package/lib/solution/BookingTicket/utils/weighingProductSku.d.ts +0 -5
  180. package/lib/solution/PlaceOrder/index.d.ts +0 -0
  181. package/lib/solution/RegisterAndLogin/config.d.ts +0 -93
  182. package/lib/solution/RegisterAndLogin/types.d.ts +0 -445
  183. package/lib/solution/RegisterAndLogin/utils.d.ts +0 -103
  184. package/lib/store/createStore.d.ts +0 -3
  185. package/lib/types/index.d.ts +0 -132
  186. package/lib/utils/os-private-payload.d.ts +0 -5
  187. package/lib/utils/payment-number.d.ts +0 -9
  188. package/lib/utils/task.d.ts +0 -40
  189. package/lib/utils/watch.d.ts +0 -102
@@ -1,104 +0,0 @@
1
- /**
2
- * BookingContext 子模块:承载「预约 UI 上下文」三件套。
3
- *
4
- * - bookingConfig:来自 staff `/core/board/management/config` 或 H5 `/core/board/config` 的整套预约配置(service_time / resource_tab /
5
- * appointment_subject / subject_require / stock_setting / basic / capacity 等)。
6
- * - resourcesOrigin / resourcesOriginMap:来自 `/schedule/resource/list` 的资源全集,含 times / event_list /
7
- * combined_resource 等运行态信息,是 getResourceByIds / getResourceTimeIsUsable 的输入。
8
- * - date:当前选择的日期(dayjs 或 ISO 字符串,迁移后内部统一存原始 ISO 字符串,UI 可自行解析)。
9
- *
10
- * 设计原则(与 BookingTicket 现状对齐):
11
- * - 默认由 `loadBookingConfig` / `loadResources` 拉取并写入 store;也支持消费方 `set*` 直接灌入(复用 ticketBooking 已拉到的数据)。
12
- * - 所有读 API 返回浅克隆(数组)或原引用(map / config),避免 UI 写穿。
13
- */
14
- /** `loadBookingConfig` 入参;H5 公共接口只消费 `item_type`。 */
15
- export interface LoadBookingConfigParams {
16
- item_type?: string;
17
- sub_type?: string;
18
- source_type?: string;
19
- [key: string]: any;
20
- }
21
- /** `loadResources` 入参,与 info2 `getResourceList` 一致。 */
22
- export interface LoadBookingResourcesParams {
23
- /** 查询日期,`YYYY-MM-DD`;缺省用 store 内已 set 的 date,再缺省为当天。 */
24
- date?: string;
25
- /** 用户端查询的资源 ID;PC/H5 资源接口需要显式范围才会返回对应实体。 */
26
- resourceIds?: Array<number | string>;
27
- /** 编辑态排除容量占用用的 booking id 列表。 */
28
- bookingIds?: number[];
29
- }
30
- /** `initBookingContext` 入参(BookingTicket 聚合入口)。 */
31
- export interface InitBookingContextParams {
32
- bookingConfigParams?: LoadBookingConfigParams;
33
- date?: BookingContextDateInput;
34
- /** 是否拉资源列表,默认 true。 */
35
- loadResources?: boolean;
36
- bookingIds?: number[];
37
- /** 为 true 时忽略内存命中,强制重新请求(默认 false)。 */
38
- forceRefresh?: boolean;
39
- }
40
- /**
41
- * 资源全集 map:key 为资源 id(数字),value 为资源原始对象,含 times / event_list 等运行态。
42
- * 这里只声明 Record 形态;具体字段保留 `any`,与 ticketBooking 现网传入的数据形状兼容。
43
- */
44
- export type BookingContextResource = Record<string, any>;
45
- export type BookingContextResourceMap = Record<string, BookingContextResource>;
46
- /**
47
- * 形参 booking_config(结构来自 staff management 或 H5 board config 接口的 `data`)。
48
- * OS 不强制 schema,保留 `Record<string, any>` 兼容现网;常用路径文档化在 SDK docs。
49
- */
50
- export type BookingContextConfig = Record<string, any>;
51
- /**
52
- * 日期入参:接受 dayjs 实例、ISO 字符串、Date 实例;内部统一 normalize 为 ISO 字符串保存。
53
- */
54
- export type BookingContextDateInput = string | Date | {
55
- format?: (fmt?: string) => string;
56
- } | null | undefined;
57
- /**
58
- * 内部 store 形态。`resourcesOriginMap` 由 `setResources` 派生,不允许外部直接 set。
59
- */
60
- export interface BookingContextState {
61
- bookingConfig: BookingContextConfig | null;
62
- resourcesOrigin: BookingContextResource[];
63
- resourcesOriginMap: BookingContextResourceMap;
64
- /**
65
- * 当前选择的日期,统一 ISO 字符串('YYYY-MM-DD HH:mm:ss' 或 'YYYY-MM-DD')。
66
- * UI 取出后可自行 dayjs 解析;OS 内的计算 helper 都接受 string,不做 dayjs 依赖。
67
- */
68
- date: string | null;
69
- }
70
- /**
71
- * BookingContextModule 对外 API(给 BookingTicket / SDK Provider 透传消费)。
72
- */
73
- export interface BookingContextModuleAPI {
74
- setBookingConfig(config: BookingContextConfig | null): void;
75
- getBookingConfig(): BookingContextConfig | null;
76
- setResources(resources: BookingContextResource[] | null | undefined): void;
77
- getResourcesOrigin(): BookingContextResource[];
78
- getResourcesOriginMap(): BookingContextResourceMap;
79
- setDate(date: BookingContextDateInput): void;
80
- getDate(): string | null;
81
- /** 当前 store 的浅克隆,调试 / 测试用。 */
82
- getState(): BookingContextState;
83
- /** 一键清空,destroy / 切租户场景用。 */
84
- clear(): void;
85
- /** 按运行平台拉取 board config 并写入 store。 */
86
- loadBookingConfig(params?: LoadBookingConfigParams): Promise<BookingContextConfig | null>;
87
- /** 拉取资源全集并写入 store(`/schedule/resource/list`)。 */
88
- loadResources(params?: LoadBookingResourcesParams): Promise<BookingContextResource[]>;
89
- /**
90
- * 依次 setDate → loadBookingConfig → loadResources。
91
- * SalesSdkProvider 挂载时默认调用 BookingTicket.initBookingContext。
92
- */
93
- initBookingContext(params?: InitBookingContextParams): Promise<BookingContextState>;
94
- /** store 是否已具备与入参等价的 config / resources(无需再请求)。 */
95
- isBookingContextReady(params?: InitBookingContextParams): boolean;
96
- }
97
- /**
98
- * BookingContextModule 事件名常量(采用 `${this.name}:` 前缀,与现有模块一致)。
99
- */
100
- export declare enum BookingContextEvent {
101
- OnBookingConfigChange = "onBookingConfigChange",
102
- OnResourcesChange = "onResourcesChange",
103
- OnDateChange = "onDateChange"
104
- }
@@ -1,76 +0,0 @@
1
- /**
2
- * 把 info2 `cacheItem` 转换为 OS `addProductToOrder(product, booking)` 所需的 booking 入参。
3
- *
4
- * 协议严格对齐 `pisell_os/src/modules/Order/TEMP_ORDER_FIELDS_SUMMARY.md` 的 Bookings 章节:
5
- * - 顶层只允许出现:schedule_event_id / appointment_status / start_date / start_time / end_date /
6
- * end_time / select_date / duration / sub_type / like_status / number / resources / relation_forms /
7
- * holder / metadata / is_all / schedule_id / relation_id / form_id / relation_type / product_uid
8
- * - bookings[] 不允许出现 `_extend`
9
- * - bookings[].metadata 走白名单:unique_identification_number / collect_pax / capacity / holder_id / resource_select_type
10
- * - bookings[].resources[] 只接受协议白名单:form_id / relation_type / relation_id / capacity / like_status / metadata / children
11
- *
12
- * `product_uid` / `metadata.unique_identification_number` 不在这里生成:
13
- * OS `addProductToOrder` 内的 `createLinkedProductAndBooking` 会在最终一步统一改写,
14
- * 保证商品行 uid 与 booking root 唯一值始终对齐。
15
- *
16
- * 复杂 multi-day 展开(createBookingItemsByGroup / concatBookings)首版**不支持**,
17
- * 由 UI 在 `cart.confirmDetail` 之外通过辅助 API 处理。
18
- */
19
- export interface CacheItemToBookingInputOptions {
20
- /** booking config,用于推导 metadata.resource_select_type(默认从 cacheItem.\_data.resources[0].select_type.type 推断)。 */
21
- bookingConfig?: any;
22
- }
23
- export interface BookingInput {
24
- schedule_event_id?: number | string;
25
- start_date?: string;
26
- start_time?: string;
27
- end_date?: string;
28
- end_time?: string;
29
- select_date?: string;
30
- duration?: number;
31
- sub_type?: 'days' | 'minutes' | string;
32
- is_all?: 0 | 1;
33
- number?: number;
34
- holder?: any;
35
- like_status?: string;
36
- relation_forms?: any[];
37
- resources?: BookingResourceInput[];
38
- metadata?: BookingMetadataInput;
39
- schedule_id?: number | string;
40
- relation_id?: number | string;
41
- form_id?: number | string;
42
- relation_type?: string;
43
- }
44
- export interface BookingResourceInput {
45
- form_id?: number | string;
46
- relation_type?: string;
47
- relation_id?: number | string;
48
- capacity?: number;
49
- like_status?: string;
50
- metadata?: Record<string, any>;
51
- children?: BookingResourceInput[];
52
- }
53
- /** custom / package 人数维度快照,与 info2 `_extend.capacity` / `metadata.capacity` 对齐。 */
54
- export interface BookingCapacityMetadataItem {
55
- id: string | number;
56
- value: number;
57
- name?: Record<string, any> | string;
58
- }
59
- export interface BookingMetadataInput {
60
- /** 由 OS createLinkedProductAndBooking 统一改写,这里不生成。 */
61
- unique_identification_number?: string;
62
- collect_pax?: number;
63
- /**
64
- * 资源容量快照:custom 多维度时为 `{ id, value, name? }[]`;
65
- * 仅总和场景可为 number(capacity_snapshot 兼容)。
66
- */
67
- capacity?: number | BookingCapacityMetadataItem[];
68
- /** 协议要求始终提交(即使为 null)。 */
69
- holder_id: any;
70
- holder?: any;
71
- resource_select_type?: 'single' | 'multiple' | string;
72
- }
73
- /**
74
- * 主入口。
75
- */
76
- export declare function cacheItemToBookingInput(cacheItem: any, options?: CacheItemToBookingInputOptions): BookingInput;
@@ -1,28 +0,0 @@
1
- /**
2
- * 灵活时长(flexible duration)协议工具。
3
- *
4
- * info2 用 `flexible_<minutes>` 字符串前缀标记"灵活时长",对外用同名 API 暴露 create / getValue / isFlexible / add。
5
- * OS 这边一比一搬运,无外部依赖。
6
- */
7
- export declare const flexibleObj: {
8
- create(num: number): string;
9
- getValue(str: string | number): number;
10
- isFlexible(str: string | number | undefined | null): boolean;
11
- add(current: number | string, duration: number): string | number;
12
- };
13
- /**
14
- * 取 duration 数值(兼容 number / { type, value } / 灵活时长字符串)。
15
- * 与 info2 `getDuration` 行为等价。
16
- */
17
- /**
18
- * 商品定义是否为「灵活时长」类型(仅看 product.duration 对象,不把 flexible_423 字符串当类型)。
19
- * 与 info2 `getDuration({ type: 'flexible' }) === 'flexible'` 判定对齐。
20
- */
21
- export declare function isProductFlexibleDuration(duration: number | string | {
22
- type: string;
23
- value: number;
24
- } | undefined | null): boolean;
25
- export declare function getDurationValue(duration: number | string | {
26
- type: string;
27
- value: number;
28
- } | undefined | null): number | 'flexible' | undefined;
@@ -1,8 +0,0 @@
1
- /**
2
- * 将 `/schedule/resource/list` 原始数组格式化为 `list + listMap`。
3
- * 逻辑与 info2 [`getFormatResourceListAndMap`] 对齐:追加无资源占位行、按 id 建 map。
4
- */
5
- export declare function formatResourceListAndMap(data: any[] | null | undefined, _bookingIds?: number[]): {
6
- list: any[];
7
- listMap: Record<string, any>;
8
- };
@@ -1,13 +0,0 @@
1
- /**
2
- * 「无资源」占位资源行的数据骨架。
3
- *
4
- * 与 info2 [`booking/mock.ts#getNoResource2`] 一比一对齐,区别仅在于:
5
- * - `main_field / room_name / labelText` 三个 i18n 文案字段在 OS 这边**置空**,
6
- * 调用方(UI)在 `id === 0` 时自行渲染本地化的「无资源 / No resource」。
7
- *
8
- * 用途:`getResourceByIds` 在拼装 `optional_resource` 列表时,会在末尾 concat 一行此占位,
9
- * 让用户能选择「不指定资源」。
10
- */
11
- export declare function getNoResource2(other?: {
12
- form_id?: number | string;
13
- } & Record<string, any>): any;
@@ -1 +0,0 @@
1
- export declare function buildProductOptionStringFromOrderLine(product: any): string;
@@ -1,41 +0,0 @@
1
- /**
2
- * 结构化的「资源不可用」原因(替代 info2 `getErrorList` 输出的 i18n 文案 + type 字段)。
3
- *
4
- * 与 info2 type 字段映射:
5
- * - `no_product` ↔ type='products'
6
- * - `time_out_of_range` ↔ type='time'
7
- * - `count_out_of_range` ↔ type='limit'
8
- * - `resource_unbound` ↔ type='unbound'
9
- *
10
- * OS 这边不耦合 i18n 文案,UI 拿到 reason + params 后自行渲染(参考 docs/SDK 中给出的 i18n key 对照表)。
11
- */
12
- export type ResourceUnavailableReason = 'no_product' | 'time_out_of_range' | 'count_out_of_range' | 'resource_unbound';
13
- export interface ResourceError {
14
- reason: ResourceUnavailableReason;
15
- params: {
16
- /** 资源名(time / limit 用)。 */
17
- labelText?: string;
18
- /** 起始时间(time / limit 用,格式 'hh:mm A')。 */
19
- startText?: string;
20
- /** 结束时间(time / limit 用,格式 'hh:mm A')。 */
21
- endText?: string;
22
- /**
23
- * 结束时间是否跨到第二天。UI 收到 true 时可在 endText 前加 'tomorrow' / '明天' 前缀。
24
- * 与 info2 旧实现「endText = locales.getText('pisell1.text.tomorrow') + endText」等价。
25
- */
26
- isCrossDay?: boolean;
27
- };
28
- }
29
- /**
30
- * 替代 info2 `utilsByBooking.ts#getErrorList`,输出结构化错误。
31
- *
32
- * 行为对齐:
33
- * 1. cacheItem 没有 id → `no_product`(与 info2 `!cacheItem?.id` 分支等价)。
34
- * 2. 资源 null / 无 _extend → 返回 []。
35
- * 3. resource.usable=false 时:
36
- * - 没有 _extend.usableTime → `time_out_of_range`
37
- * - 有 usableTime 但 `_extend.isCountRange=false` → `count_out_of_range`
38
- * 4. resource.unbound=true → 追加 `resource_unbound`。
39
- * 5. 不再耦合 `_data.resourceMaps[form_id].type === 'single'` 判断(与 info2 实际未使用此变量一致)。
40
- */
41
- export declare function getResourceErrors(resource: any, cacheItem: any): ResourceError[];
@@ -1,7 +0,0 @@
1
- /**
2
- * 预约商品资源是否「需要补齐 / 已选中」——供 getProductExtend 门禁与 getIsAutoClose 共用。
3
- */
4
- /** 商品是否挂了生效的资源表单(product_resource.resources status=1)。 */
5
- export declare function productNeedsResourceExtend(cacheItem: any): boolean;
6
- /** `_extend.resource` 是否至少有一类表单选中了具体资源。 */
7
- export declare function hasActualResourceSelection(cacheItem: any): boolean;
@@ -1,55 +0,0 @@
1
- import { Dayjs } from 'dayjs';
2
- import { getDurationValue } from './flexible';
3
- /**
4
- * 判断商品是否为跨日预约(duration.type === 'days')。与 info2 isMultiDayProduct 等价。
5
- */
6
- export declare function isMultiDayProduct(product: any): boolean;
7
- /**
8
- * 判断 cacheItem 是否为 session 商品(extension_type ∈ session_product / session_ticket)。
9
- */
10
- export declare function isSessionProduct(cacheItem: any): boolean;
11
- /** 从 catalog `cartDetailValue` 或 `_extend.other` 取 session 快照。 */
12
- export declare function getSessionFromItem(item: any): Record<string, any> | null;
13
- /**
14
- * 将 cartDetailValue.session 写入 _extend 的起止时间(与 info2 getServiceStartTimeAndEndTime 的 session 分支一致)。
15
- * 日历日优先用 ctx.date,时分取自 session.start_at / end_at 或 session.start_time / end_time。
16
- */
17
- export declare function applySessionTimesToExtend(item: any, extend: Record<string, any>, ctx?: {
18
- date?: string | Dayjs | null;
19
- }): Record<string, any>;
20
- /**
21
- * 是否应写入 booking(与 Product.utils isNormalProduct 对齐,并覆盖 session_ticket / cartDetailValue.session)。
22
- */
23
- export declare function isBookingProduct(item: any): boolean;
24
- /**
25
- * 处理 'now' 时间占位:'now' → 当前 HH:mm;其他原样返回。
26
- * 与 info2 `getServeStartTime` 等价。
27
- */
28
- export declare function getServeStartTime(startTime: string | undefined | null): string;
29
- /**
30
- * 计算商品的开始结束时间(统一为 dayjs 实例)。
31
- * 与 info2 `getServiceTimes` 行为等价:
32
- * - 跨日商品:startDate = start_date + start_time,endDate = _extend.end_date 原样
33
- * - session 商品:从 _extend.other.session 取 start_at / end_at
34
- * - 普通商品:startDate + duration(含 flexible 处理)
35
- */
36
- export declare function getServiceTimes(service: any): {
37
- startDate: Dayjs;
38
- endDate: Dayjs;
39
- };
40
- /**
41
- * 跨日预约相关:把 _extend.start_date / end_date 都对齐到 dayjs startOf('day')。
42
- * 与 info2 `formatDayDate` 等价。
43
- */
44
- export declare function formatDayDate(_extend: any): {
45
- start_date: Dayjs;
46
- end_date: Dayjs;
47
- };
48
- /**
49
- * 计算跨日预约时长:
50
- * - type='days' → end - start 的天数
51
- * - type='minutes' → end - start 的分钟数
52
- * 与 info2 `getDays` 等价。
53
- */
54
- export declare function getDays(cacheItem: any, type: 'minutes' | 'days'): number;
55
- export { getDurationValue };
@@ -1,42 +0,0 @@
1
- import dayjs from 'dayjs';
2
- import { getDurationValue } from './flexible';
3
- export interface TimeSlice {
4
- label: string;
5
- value: string;
6
- }
7
- export interface DurationSlice {
8
- label: string;
9
- value: number;
10
- }
11
- export interface TimeSlicesResult {
12
- timeSlices: TimeSlice[];
13
- durationSlicesBasedOnTime: DurationSlice[];
14
- }
15
- /**
16
- * 把一天切成等长时间槽,输出 timeSlices(开始时间标签)与 durationSlicesBasedOnTime(基于切片的时长选项)。
17
- *
18
- * 与 info2 `sliceDayIntoFiveMinutes` 行为等价;为了不依赖 `locales`,label 输出原始时间字符串('08:00 AM' / '90'),
19
- * UI 侧需要本地化展示时可基于 value 自行包装。
20
- *
21
- * @param config booking config `basic.service_time`,{ value: minutes }
22
- * @param isDay 是否跨日预约(true 时按 1~30 天切片)
23
- */
24
- export declare function sliceDayIntoFiveMinutes(config: {
25
- value?: number;
26
- } | undefined | null, isDay?: boolean): TimeSlicesResult;
27
- /**
28
- * 取「下一个 duration 选项」:优先用 defaultValue;否则在 array 中找匹配的;找不到取第一个。
29
- * 与 info2 `findNextDuration` 等价。
30
- */
31
- export declare function findNextDuration(current: {
32
- value?: number;
33
- } | undefined, array: DurationSlice[], defaultValue?: number): number | undefined;
34
- /** 取首选 time slice:若指定 date(HH:mm)则找第一个 >= date 的;否则第一个。 */
35
- export declare function findNextSlice(params: {
36
- timeSlices: TimeSlice[];
37
- index?: number;
38
- date?: string;
39
- }): string | undefined;
40
- /** 取 endDate;duration='flexible' 时取 endDate 与店铺营业时间的较小值,否则 startDate + duration 分钟。 */
41
- export declare function getEndDate(startDate: dayjs.Dayjs, duration: string | number, endDate: any, shopOpeningHours?: string): dayjs.Dayjs;
42
- export { getDurationValue };
@@ -1,7 +0,0 @@
1
- export declare const SORT_BY = "id";
2
- export declare const DEFAULT_PAGE_SIZE = 20;
3
- export declare const DEFAULT_CUSTOMER: {
4
- id: number;
5
- nickname: string;
6
- name: string;
7
- };
@@ -1,84 +0,0 @@
1
- export declare enum DateHooks {
2
- }
3
- /**
4
- * 日期模块状态
5
- */
6
- export interface DateState {
7
- /**
8
- * 可用时间列表
9
- */
10
- dateList: ITime[];
11
- /**
12
- * 日期范围
13
- */
14
- dateRange: ITime[];
15
- }
16
- /**
17
- * 时间
18
- */
19
- export interface ITime {
20
- date: string;
21
- week: string;
22
- weekNum: number;
23
- status: 'unavailable' | 'available' | 'lots_of_space' | 'filling_up_fast' | 'sold_out';
24
- summaryCount?: number;
25
- availableCount?: number;
26
- resource?: any[];
27
- color?: string[];
28
- }
29
- /**
30
- * 日期模块 API
31
- */
32
- export interface DateModuleAPI {
33
- /**
34
- * 获取资源可用时间列表
35
- */
36
- getResourceAvailableTimeList: (params: IGetAvailableTimeListParams) => Promise<ITime[]>;
37
- /**
38
- * 设置日期范围
39
- */
40
- setDateRange: (range: ITime[]) => void;
41
- /**
42
- * 获取资源日期
43
- */
44
- getResourceDates: (params: IGetAvailableTimeListParams) => Promise<ITime[]>;
45
- }
46
- export interface IGetAvailableTimeListParams {
47
- url?: string;
48
- /** 是否使用缓存 */
49
- useCache?: boolean;
50
- /** 查询参数 */
51
- query?: {
52
- /** 开始日期 */
53
- start_date: string;
54
- /** 结束日期 */
55
- end_date: string;
56
- /** 资源ID */
57
- resource_ids?: Array<number | string>;
58
- };
59
- /** 规则 */
60
- rules?: Array<{
61
- /**
62
- * 提前量
63
- */
64
- cut_off_time?: {
65
- future_day?: number;
66
- unit?: number;
67
- unit_type?: 'minutes' | 'hours' | 'days';
68
- };
69
- /**
70
- * 资源ID
71
- */
72
- resourceFormIds?: number[];
73
- /**
74
- * 日程ID
75
- */
76
- schedule?: {
77
- date: string;
78
- color?: string[];
79
- isExcluded: boolean;
80
- }[];
81
- }>;
82
- /** 类型:按月查 | 按日查 */
83
- type?: 'month' | 'day';
84
- }
@@ -1,36 +0,0 @@
1
- import { IGetAvailableTimeListParams, ITime } from './types';
2
- /**
3
- * 生成当前月份的所有日期
4
- * @param startDate 开始日期
5
- * @param endDate 结束日期
6
- * @param type 类型:按月查 | 按周查
7
- * @returns 日期列表
8
- */
9
- export declare const generateMonthDates: (startDate: string, endDate: string, type?: 'month' | 'day') => ITime[];
10
- /**
11
- * 禁用所有日期
12
- * @param dates 日期列表
13
- * @returns 日期列表
14
- */
15
- export declare const disableAllDates: (dates: ITime[]) => ITime[];
16
- /**
17
- * 禁用某一天之前的日期,如不传则默认今天
18
- * @param dates 日期列表
19
- * @param oneDay 日期
20
- * @returns 日期列表
21
- */
22
- export declare const disableDatesBeforeOneDay: (dates: ITime[], oneDay?: string) => ITime[];
23
- /**
24
- * 根据资源中的日期处理出每个日期下存在的可用资源,根据form_id进行分类
25
- * @param resources 资源列表
26
- * @param dates 日期列表
27
- * @returns 日期列表
28
- */
29
- export declare const handleAvailableDateByResource: (resources: any[], dates: ITime[]) => ITime[];
30
- /**
31
- * 根据规则判定哪些日期是可用的
32
- * @param dates 日期列表
33
- * @param rules 提前量规则
34
- * @returns 日期列表
35
- */
36
- export declare const handleAvailableDatesByRules: (dates: ITime[], rules: IGetAvailableTimeListParams['rules']) => ITime[];
@@ -1,11 +0,0 @@
1
- import type { PickupTimingAvailability, PickupTimingBookingTimes, PickupTimingClockInput, PickupTimingComputeInput, PickupTimingConfig, PickupTimingSelection, PickupTimingSlot, PickupTimingValidationResult } from './types';
2
- export * from './types';
3
- /** Consume effective OpenData values only; legacy switches never enable Pickup. */
4
- export declare function normalizePickupTimingConfig(openData: Record<string, unknown>): PickupTimingConfig;
5
- export declare function resolvePickupTimingDateTime(date: string, time: string, timezone: string, instant?: string): PickupTimingSlot | undefined;
6
- export declare function getAsapPickupTiming({ config, timezone, now }: PickupTimingClockInput): PickupTimingSlot;
7
- export declare function pickupTimingSlotToBookingTimes(slot: PickupTimingSlot): PickupTimingBookingTimes;
8
- export declare function computePickupTimingAvailability(input: PickupTimingComputeInput): PickupTimingAvailability;
9
- export declare function validatePickupTimingSelection(selection: PickupTimingSelection, input: PickupTimingComputeInput & {
10
- allowManualOverride?: boolean;
11
- }): PickupTimingValidationResult;
@@ -1,67 +0,0 @@
1
- import type { ScheduleItem } from '../Schedule/types';
2
- export type PickupTimingMode = 'asap_only' | 'scheduled_only' | 'asap_and_scheduled';
3
- export interface PickupTimingConfig {
4
- handoverModes: string[];
5
- timingMode: PickupTimingMode;
6
- scheduleIds: number[];
7
- /** Empty or absent means no additional store-hours restriction. */
8
- operatingHoursScheduleIds?: number[];
9
- slotIntervalMinutes: number;
10
- preparationTimeMinutes: number;
11
- advanceDays: number;
12
- fulfillmentRefMode?: string;
13
- manualInputType?: string;
14
- }
15
- export interface PickupTimingSelection {
16
- serviceType: string;
17
- mode: 'asap' | 'scheduled';
18
- date?: string;
19
- time?: string;
20
- /** The absolute instant disambiguates a repeated local minute during DST. */
21
- instant?: string;
22
- source?: 'schedule' | 'pos_manual' | 'asap';
23
- }
24
- export interface PickupTimingSlot {
25
- id: string;
26
- date: string;
27
- time: string;
28
- instant: string;
29
- }
30
- export interface PickupTimingAvailability {
31
- /** Config remains available when Schedule or store timezone cannot be loaded. */
32
- error?: string;
33
- config: PickupTimingConfig;
34
- timezone: string;
35
- now: string;
36
- today: string;
37
- maxDate: string;
38
- date: string;
39
- dates: Array<{
40
- date: string;
41
- status: 'available' | 'unavailable';
42
- }>;
43
- slots: PickupTimingSlot[];
44
- /** Earliest legal candidate across all permitted dates, for POS prefill. */
45
- firstSlot?: PickupTimingSlot;
46
- }
47
- export interface PickupTimingClockInput {
48
- config: PickupTimingConfig;
49
- timezone: string;
50
- now: Date | string | number;
51
- }
52
- export interface PickupTimingComputeInput extends PickupTimingClockInput {
53
- schedules: ScheduleItem[];
54
- date?: string;
55
- }
56
- export interface PickupTimingValidationResult {
57
- valid: boolean;
58
- code?: string;
59
- message?: string;
60
- slot?: PickupTimingSlot;
61
- }
62
- export interface PickupTimingBookingTimes {
63
- start_date: string;
64
- start_time: string;
65
- end_date: string;
66
- end_time: string;
67
- }
@@ -1,26 +0,0 @@
1
- export type OrderPaymentTransactionStatus = 'success' | 'fail';
2
- export interface OrderPaymentTransaction {
3
- number: string;
4
- status: OrderPaymentTransactionStatus;
5
- }
6
- export type OrderPaymentIdentityType = 'order_payment_id' | 'payment_number' | 'unique_payment_number';
7
- export interface OrderPaymentIdentityMatch<T> {
8
- index: number;
9
- payment: T;
10
- matchedBy: OrderPaymentIdentityType;
11
- }
12
- export declare function getOrderPaymentIdentityKeys(payment: unknown): string[];
13
- export declare function isPendingOrderPayment(payment: unknown): boolean;
14
- export declare function isIdentifiedPendingOrderPayment(payment: unknown): boolean;
15
- export declare function hasOrderPaymentIdentityOverlap(left: unknown, right: unknown): boolean;
16
- export declare function resolveOrderPaymentIdentity<T extends Record<string, any>>(payments: T[] | null | undefined, identity: string | number, mode?: 'payment_number' | 'compat'): OrderPaymentIdentityMatch<T> | null;
17
- export declare function ensureOrderPaymentNumber<T extends Record<string, any>>(payment: T, devicePrefix: string, createPaymentNumber: () => string): T & {
18
- payment_number: string;
19
- };
20
- export declare function mergeOrderPaymentTransactions(current: unknown, incoming: unknown): OrderPaymentTransaction[];
21
- export declare function mergeOrderPaymentRecord<T extends Record<string, any>>(payment: T, updates: Record<string, any>): T;
22
- export declare function mergeOrderPaymentSnapshot<T extends Record<string, any>>(current: T, incoming: T): T;
23
- export declare function mergeOrderPaymentListsByIdentity<T extends Record<string, any>>(existing: T[] | null | undefined, incoming: T[] | null | undefined, options?: {
24
- preserveUnmatchedExisting?: boolean;
25
- preserveUnmatchedExistingWhen?: (payment: T) => boolean;
26
- }): T[];