@pisell/pisellos 0.10.76 → 0.10.78

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 (212) hide show
  1. package/dist/apis/picoding.d.ts +0 -0
  2. package/dist/effects/index.d.ts +19 -0
  3. package/dist/model/strategy/adapter/dataVariant/adapter.d.ts +50 -0
  4. package/dist/model/strategy/adapter/dataVariant/evaluator.d.ts +105 -0
  5. package/dist/model/strategy/adapter/dataVariant/examples.d.ts +39 -0
  6. package/dist/model/strategy/adapter/dataVariant/index.d.ts +4 -0
  7. package/dist/model/strategy/adapter/dataVariant/type.d.ts +173 -0
  8. package/dist/model/strategy/adapter/promotion/adapter.d.ts +70 -0
  9. package/dist/model/strategy/adapter/promotion/examples.d.ts +224 -0
  10. package/dist/model/strategy/adapter/promotion/index.js +0 -9
  11. package/dist/model/strategy/adapter/promotion/type.d.ts +535 -0
  12. package/dist/model/strategy/adapter/type.d.ts +28 -0
  13. package/dist/model/strategy/adapter/walletPass/index.d.ts +32 -0
  14. package/dist/model/strategy/adapter/walletPass/locales.d.ts +1 -0
  15. package/dist/model/strategy/adapter/walletPass/type.d.ts +192 -0
  16. package/dist/model/strategy/adapter/walletPass/utils.d.ts +50 -0
  17. package/dist/model/strategy/engine.d.ts +119 -0
  18. package/dist/model/strategy/type.d.ts +245 -0
  19. package/dist/modules/Account/types.d.ts +56 -0
  20. package/dist/modules/BookingContext/types.d.ts +104 -0
  21. package/dist/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +76 -0
  22. package/dist/modules/BookingContext/utils/flexible.d.ts +28 -0
  23. package/dist/modules/BookingContext/utils/formatResourceList.d.ts +8 -0
  24. package/dist/modules/BookingContext/utils/noResource.d.ts +13 -0
  25. package/dist/modules/BookingContext/utils/orderLineDisplay.d.ts +1 -0
  26. package/dist/modules/BookingContext/utils/resourceErrors.d.ts +41 -0
  27. package/dist/modules/BookingContext/utils/resourceSelection.d.ts +7 -0
  28. package/dist/modules/BookingContext/utils/serviceTimes.d.ts +55 -0
  29. package/dist/modules/BookingContext/utils/timeSlices.d.ts +42 -0
  30. package/dist/modules/Customer/constants.d.ts +7 -0
  31. package/dist/modules/Date/types.d.ts +84 -0
  32. package/dist/modules/Date/utils.d.ts +36 -0
  33. package/dist/modules/FulfillmentTiming/index.d.ts +11 -0
  34. package/dist/modules/FulfillmentTiming/types.d.ts +67 -0
  35. package/dist/modules/Order/payment-utils.d.ts +26 -0
  36. package/dist/modules/Order/pickupTiming.d.ts +46 -0
  37. package/dist/modules/Order/utils/manualProductDiscount.d.ts +106 -0
  38. package/dist/modules/Order/utils/orderCollectionIdentity.d.ts +68 -0
  39. package/dist/modules/Order/utils/weighedProduct.d.ts +12 -0
  40. package/dist/modules/Payment/cashRecommendationAlgorithm.d.ts +21 -0
  41. package/dist/modules/Payment/mx51.d.ts +0 -0
  42. package/dist/modules/Payment/types.d.ts +943 -0
  43. package/dist/modules/Payment/utils.d.ts +19 -0
  44. package/dist/modules/Product/index.d.ts +1 -1
  45. package/dist/modules/ProductList/index.d.ts +2 -0
  46. package/dist/modules/ProductList/index.js +125 -39
  47. package/dist/modules/Quotation/types.d.ts +61 -0
  48. package/dist/modules/Resource/types.d.ts +50 -0
  49. package/dist/modules/Resource/utils.d.ts +23 -0
  50. package/dist/modules/ResourcePlanner/localClock.d.ts +33 -0
  51. package/dist/modules/ResourcePlanner/planner.js +5 -0
  52. package/dist/modules/SalesSummary/types.d.ts +69 -0
  53. package/dist/modules/ScanOrderLogger/providers/feishu.d.ts +2 -0
  54. package/dist/modules/ScanOrderLogger/providers/grafana.d.ts +2 -0
  55. package/dist/modules/ScanOrderLogger/types.d.ts +53 -0
  56. package/dist/modules/Schedule/getDateIsInSchedule.d.ts +32 -0
  57. package/dist/modules/Schedule/type.d.ts +157 -0
  58. package/dist/modules/Schedule/types.d.ts +201 -0
  59. package/dist/modules/Schedule/utils.d.ts +67 -0
  60. package/dist/modules/Step/tyeps.d.ts +20 -0
  61. package/dist/modules/SurchargeList/types.d.ts +15 -0
  62. package/dist/plugins/app.d.ts +10 -0
  63. package/dist/plugins/shopStore.d.ts +4 -0
  64. package/dist/plugins/user.d.ts +7 -0
  65. package/dist/server/modules/floor-plan/types.d.ts +43 -0
  66. package/dist/server/modules/menu/types.d.ts +68 -0
  67. package/dist/server/modules/payment/types.d.ts +9 -0
  68. package/dist/server/modules/quotation/types.d.ts +50 -0
  69. package/dist/server/modules/resource/types.d.ts +121 -0
  70. package/dist/server/modules/schedule/types.d.ts +1 -0
  71. package/dist/server/modules/schedule/utils.d.ts +32 -0
  72. package/dist/server/types.d.ts +66 -0
  73. package/dist/server/utils/index.d.ts +5 -0
  74. package/dist/server/utils/schedule.d.ts +14 -0
  75. package/dist/server/utils/time.d.ts +18 -0
  76. package/dist/solution/BaseSales/index.d.ts +12 -1
  77. package/dist/solution/BaseSales/index.js +275 -185
  78. package/dist/solution/BookingByStep/index.d.ts +2 -2
  79. package/dist/solution/BookingTicket/index.d.ts +1 -13
  80. package/dist/solution/BookingTicket/utils/bookingStatus.d.ts +77 -0
  81. package/dist/solution/BookingTicket/utils/exampleData.d.ts +123 -0
  82. package/dist/solution/BookingTicket/utils/resolveBestAddTimePlan.d.ts +185 -0
  83. package/dist/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +38 -0
  84. package/dist/solution/BookingTicket/utils/scan/scanCache.d.ts +78 -0
  85. package/dist/solution/BookingTicket/utils/scan/scanProductValues.d.ts +21 -0
  86. package/dist/solution/BookingTicket/utils/weighingProductSku.d.ts +5 -0
  87. package/dist/solution/PlaceOrder/index.d.ts +0 -0
  88. package/dist/solution/RegisterAndLogin/config.d.ts +93 -0
  89. package/dist/solution/RegisterAndLogin/types.d.ts +445 -0
  90. package/dist/solution/RegisterAndLogin/utils.d.ts +103 -0
  91. package/dist/solution/UnifiedBookingSales/index.d.ts +23 -1
  92. package/dist/solution/UnifiedBookingSales/index.js +1367 -646
  93. package/dist/solution/UnifiedBookingSales/remoteOccupancyCache.d.ts +2 -0
  94. package/dist/solution/UnifiedBookingSales/remoteOccupancyCache.js +4 -0
  95. package/dist/solution/UnifiedBookingSales/sessionResourceCache.d.ts +27 -0
  96. package/dist/solution/UnifiedBookingSales/sessionResourceCache.js +271 -0
  97. package/dist/solution/UnifiedBookingSales/types.d.ts +25 -0
  98. package/dist/solution/UnifiedBookingSales/types.js +2 -0
  99. package/dist/solution/UnifiedBookingSales/venueCatalogSession.d.ts +32 -0
  100. package/dist/solution/UnifiedBookingSales/venueCatalogSession.js +277 -0
  101. package/dist/store/createStore.d.ts +3 -0
  102. package/dist/types/index.d.ts +132 -0
  103. package/dist/utils/os-private-payload.d.ts +5 -0
  104. package/dist/utils/payment-number.d.ts +9 -0
  105. package/dist/utils/task.d.ts +40 -0
  106. package/dist/utils/watch.d.ts +102 -0
  107. package/lib/apis/picoding.d.ts +0 -0
  108. package/lib/effects/index.d.ts +19 -0
  109. package/lib/model/strategy/adapter/dataVariant/adapter.d.ts +50 -0
  110. package/lib/model/strategy/adapter/dataVariant/evaluator.d.ts +105 -0
  111. package/lib/model/strategy/adapter/dataVariant/examples.d.ts +39 -0
  112. package/lib/model/strategy/adapter/dataVariant/index.d.ts +4 -0
  113. package/lib/model/strategy/adapter/dataVariant/type.d.ts +173 -0
  114. package/lib/model/strategy/adapter/promotion/adapter.d.ts +70 -0
  115. package/lib/model/strategy/adapter/promotion/examples.d.ts +224 -0
  116. package/lib/model/strategy/adapter/promotion/type.d.ts +535 -0
  117. package/lib/model/strategy/adapter/type.d.ts +28 -0
  118. package/lib/model/strategy/adapter/walletPass/index.d.ts +32 -0
  119. package/lib/model/strategy/adapter/walletPass/locales.d.ts +1 -0
  120. package/lib/model/strategy/adapter/walletPass/type.d.ts +192 -0
  121. package/lib/model/strategy/adapter/walletPass/utils.d.ts +50 -0
  122. package/lib/model/strategy/engine.d.ts +119 -0
  123. package/lib/model/strategy/type.d.ts +245 -0
  124. package/lib/modules/Account/types.d.ts +56 -0
  125. package/lib/modules/BookingContext/types.d.ts +104 -0
  126. package/lib/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +76 -0
  127. package/lib/modules/BookingContext/utils/flexible.d.ts +28 -0
  128. package/lib/modules/BookingContext/utils/formatResourceList.d.ts +8 -0
  129. package/lib/modules/BookingContext/utils/noResource.d.ts +13 -0
  130. package/lib/modules/BookingContext/utils/orderLineDisplay.d.ts +1 -0
  131. package/lib/modules/BookingContext/utils/resourceErrors.d.ts +41 -0
  132. package/lib/modules/BookingContext/utils/resourceSelection.d.ts +7 -0
  133. package/lib/modules/BookingContext/utils/serviceTimes.d.ts +55 -0
  134. package/lib/modules/BookingContext/utils/timeSlices.d.ts +42 -0
  135. package/lib/modules/Customer/constants.d.ts +7 -0
  136. package/lib/modules/Date/types.d.ts +84 -0
  137. package/lib/modules/Date/utils.d.ts +36 -0
  138. package/lib/modules/FulfillmentTiming/index.d.ts +11 -0
  139. package/lib/modules/FulfillmentTiming/types.d.ts +67 -0
  140. package/lib/modules/Order/payment-utils.d.ts +26 -0
  141. package/lib/modules/Order/pickupTiming.d.ts +46 -0
  142. package/lib/modules/Order/utils/manualProductDiscount.d.ts +106 -0
  143. package/lib/modules/Order/utils/orderCollectionIdentity.d.ts +68 -0
  144. package/lib/modules/Order/utils/weighedProduct.d.ts +12 -0
  145. package/lib/modules/Payment/cashRecommendationAlgorithm.d.ts +21 -0
  146. package/lib/modules/Payment/mx51.d.ts +0 -0
  147. package/lib/modules/Payment/types.d.ts +943 -0
  148. package/lib/modules/Payment/utils.d.ts +19 -0
  149. package/lib/modules/Product/index.d.ts +1 -1
  150. package/lib/modules/ProductList/index.d.ts +2 -0
  151. package/lib/modules/ProductList/index.js +56 -0
  152. package/lib/modules/Quotation/types.d.ts +61 -0
  153. package/lib/modules/Resource/types.d.ts +50 -0
  154. package/lib/modules/Resource/utils.d.ts +23 -0
  155. package/lib/modules/ResourcePlanner/localClock.d.ts +33 -0
  156. package/lib/modules/ResourcePlanner/planner.js +4 -0
  157. package/lib/modules/SalesSummary/types.d.ts +69 -0
  158. package/lib/modules/ScanOrderLogger/providers/feishu.d.ts +2 -0
  159. package/lib/modules/ScanOrderLogger/providers/grafana.d.ts +2 -0
  160. package/lib/modules/ScanOrderLogger/types.d.ts +53 -0
  161. package/lib/modules/Schedule/getDateIsInSchedule.d.ts +32 -0
  162. package/lib/modules/Schedule/type.d.ts +157 -0
  163. package/lib/modules/Schedule/types.d.ts +201 -0
  164. package/lib/modules/Schedule/utils.d.ts +67 -0
  165. package/lib/modules/Step/tyeps.d.ts +20 -0
  166. package/lib/modules/SurchargeList/types.d.ts +15 -0
  167. package/lib/plugins/app.d.ts +10 -0
  168. package/lib/plugins/shopStore.d.ts +4 -0
  169. package/lib/plugins/user.d.ts +7 -0
  170. package/lib/server/modules/floor-plan/types.d.ts +43 -0
  171. package/lib/server/modules/menu/types.d.ts +68 -0
  172. package/lib/server/modules/payment/types.d.ts +9 -0
  173. package/lib/server/modules/quotation/types.d.ts +50 -0
  174. package/lib/server/modules/resource/types.d.ts +121 -0
  175. package/lib/server/modules/schedule/types.d.ts +1 -0
  176. package/lib/server/modules/schedule/utils.d.ts +32 -0
  177. package/lib/server/types.d.ts +66 -0
  178. package/lib/server/utils/index.d.ts +5 -0
  179. package/lib/server/utils/schedule.d.ts +14 -0
  180. package/lib/server/utils/time.d.ts +18 -0
  181. package/lib/solution/BaseSales/index.d.ts +12 -1
  182. package/lib/solution/BaseSales/index.js +65 -0
  183. package/lib/solution/BookingByStep/index.d.ts +2 -2
  184. package/lib/solution/BookingTicket/index.d.ts +1 -13
  185. package/lib/solution/BookingTicket/utils/bookingStatus.d.ts +77 -0
  186. package/lib/solution/BookingTicket/utils/exampleData.d.ts +123 -0
  187. package/lib/solution/BookingTicket/utils/resolveBestAddTimePlan.d.ts +185 -0
  188. package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +38 -0
  189. package/lib/solution/BookingTicket/utils/scan/scanCache.d.ts +78 -0
  190. package/lib/solution/BookingTicket/utils/scan/scanProductValues.d.ts +21 -0
  191. package/lib/solution/BookingTicket/utils/weighingProductSku.d.ts +5 -0
  192. package/lib/solution/PlaceOrder/index.d.ts +0 -0
  193. package/lib/solution/RegisterAndLogin/config.d.ts +93 -0
  194. package/lib/solution/RegisterAndLogin/types.d.ts +445 -0
  195. package/lib/solution/RegisterAndLogin/utils.d.ts +103 -0
  196. package/lib/solution/UnifiedBookingSales/index.d.ts +23 -1
  197. package/lib/solution/UnifiedBookingSales/index.js +399 -14
  198. package/lib/solution/UnifiedBookingSales/remoteOccupancyCache.d.ts +2 -0
  199. package/lib/solution/UnifiedBookingSales/remoteOccupancyCache.js +2 -0
  200. package/lib/solution/UnifiedBookingSales/sessionResourceCache.d.ts +27 -0
  201. package/lib/solution/UnifiedBookingSales/sessionResourceCache.js +199 -0
  202. package/lib/solution/UnifiedBookingSales/types.d.ts +25 -0
  203. package/lib/solution/UnifiedBookingSales/types.js +1 -0
  204. package/lib/solution/UnifiedBookingSales/venueCatalogSession.d.ts +32 -0
  205. package/lib/solution/UnifiedBookingSales/venueCatalogSession.js +151 -0
  206. package/lib/store/createStore.d.ts +3 -0
  207. package/lib/types/index.d.ts +132 -0
  208. package/lib/utils/os-private-payload.d.ts +5 -0
  209. package/lib/utils/payment-number.d.ts +9 -0
  210. package/lib/utils/task.d.ts +40 -0
  211. package/lib/utils/watch.d.ts +102 -0
  212. package/package.json +1 -1
@@ -0,0 +1,38 @@
1
+ /**
2
+ * 全局扫码搜索结果格式化(对齐 ticketBooking `formatScanGlobal`)。
3
+ */
4
+ export type GlobalScanSearchType = 'customer' | 'wallet' | 'walletPass' | 'product' | 'local_product' | 'order';
5
+ export interface GlobalScanFormattedResult {
6
+ searchType: GlobalScanSearchType;
7
+ data: any;
8
+ scanCode: string;
9
+ /** Wallet / Wallet Pass 来源客户 ID;跨店时必须先解析为当前店客户。 */
10
+ customerId?: string | number;
11
+ /** 仅 Wallet 返回;true 时禁止直接使用响应内的来源客户。 */
12
+ isCrossShopWallet?: boolean;
13
+ /** 总店 Wallet Pass 未共享给当前子店。 */
14
+ isWalletPassUnavailableAtStore?: boolean;
15
+ }
16
+ interface RawScanSearchResult {
17
+ searchType?: GlobalScanSearchType;
18
+ response?: {
19
+ status?: boolean;
20
+ code?: number;
21
+ message?: string;
22
+ data?: any;
23
+ };
24
+ }
25
+ /**
26
+ * 将 handleGlobalScan 返回的原始结构格式化为 UI/OS 统一结构。
27
+ *
28
+ * @example
29
+ * ```ts
30
+ * const formatted = formatGlobalScanResult(
31
+ * { searchType: 'wallet', response: { code: 200, data: { customer: {...} } } },
32
+ * 'WL123',
33
+ * );
34
+ * // => { searchType: 'wallet', data: customerObj, scanCode: 'WL123' }
35
+ * ```
36
+ */
37
+ export declare function formatGlobalScanResult(raw: RawScanSearchResult | null | undefined, scanCode: string): GlobalScanFormattedResult | null;
38
+ export {};
@@ -0,0 +1,78 @@
1
+ /**
2
+ * LRU缓存类,用于缓存接口数据
3
+ * 限制最多存储100条数据,超过时移除最久未使用的数据
4
+ * 支持数据压缩以减小缓存压力
5
+ * 尾部优先策略:新节点插入尾部,最近使用的节点移动到尾部,删除头部节点
6
+ */
7
+ declare class LRUCache<T> {
8
+ private head;
9
+ private tail;
10
+ private keyMap;
11
+ private readonly maxSize;
12
+ constructor(maxSize?: number);
13
+ /**
14
+ * 将节点移动到链表尾部(最近使用)
15
+ * @param node 要移动的节点
16
+ */
17
+ private moveToTail;
18
+ /**
19
+ * 添加新节点到链表尾部
20
+ * @param key 缓存键
21
+ * @param compressedData 压缩后的数据
22
+ * @param timestamp 时间戳
23
+ */
24
+ private addToTail;
25
+ /**
26
+ * 从链表中移除节点
27
+ * @param node 要移除的节点
28
+ */
29
+ private removeNode;
30
+ /**
31
+ * 移除最久未使用的节点(链表头部)
32
+ */
33
+ private removeOldest;
34
+ /**
35
+ * 设置缓存
36
+ * @param key 缓存键
37
+ * @param data 缓存数据
38
+ */
39
+ set(key: string, data: T): void;
40
+ /**
41
+ * 获取缓存
42
+ * @param key 缓存键
43
+ * @returns 缓存数据或undefined
44
+ */
45
+ get(key: string): T | undefined;
46
+ /**
47
+ * 检查是否存在缓存
48
+ * @param key 缓存键
49
+ * @returns 是否存在
50
+ */
51
+ has(key: string): boolean;
52
+ /**
53
+ * 清除所有缓存
54
+ */
55
+ clear(): void;
56
+ /**
57
+ * 获取缓存大小
58
+ * @returns 当前缓存数量
59
+ */
60
+ size(): number;
61
+ /**
62
+ * 获取缓存统计信息
63
+ * @returns 缓存统计信息
64
+ */
65
+ getStats(): {
66
+ size: number;
67
+ maxSize: number;
68
+ usage: number;
69
+ };
70
+ /**
71
+ * 删除指定的缓存项
72
+ * @param key 要删除的缓存键
73
+ * @returns 是否删除成功
74
+ */
75
+ delete(key: string): boolean;
76
+ }
77
+ declare const scanCache: LRUCache<any>;
78
+ export default scanCache;
@@ -0,0 +1,21 @@
1
+ /**
2
+ * 扫码商品条码预选规格纯函数(对齐 ticketBooking addServiceVariant/utils)。
3
+ */
4
+ /** 套餐商品 */
5
+ export declare function isScanProductBundle(item: any): boolean;
6
+ /** 单规格 / 选项组商品 */
7
+ export declare function isScanProductOption(item: any): boolean;
8
+ /**
9
+ * 根据条码匹配 variant,生成 cartDetailValue(对齐 ticketBooking `genValues`)。
10
+ *
11
+ * @example
12
+ * ```ts
13
+ * const values = genScanProductValues(catalogItem, '6901234567890');
14
+ * const itemWithSelection = { ...catalogItem, cartDetailValue: values };
15
+ * ```
16
+ */
17
+ export declare function genScanProductValues(item: any, code: string): Record<string, any>;
18
+ /**
19
+ * 统计条码命中的 variant 数量(多命中时需弹窗选择)。
20
+ */
21
+ export declare function countScanVariantMatches(item: any, code: string): number;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * 将规格弹窗的称重结果写入订单行权威字段 product_sku。
3
+ * 商品目录已有的 SKU 字段会保留,本次称重结果只覆盖运行态称重字段。
4
+ */
5
+ export declare function buildProductSkuFromCacheItem(cacheItem: Record<string, any> | null | undefined): Record<string, any> | undefined;
File without changes
@@ -0,0 +1,93 @@
1
+ /**
2
+ * 注册登录解决方案配置
3
+ * 根据不同渠道配置不同的接口地址和参数
4
+ */
5
+ /**
6
+ * API 配置接口
7
+ */
8
+ export interface ApiConfig {
9
+ url: string;
10
+ method: 'GET' | 'POST' | 'PUT' | 'DELETE';
11
+ transformParams?: (params: any) => any;
12
+ transformResponse?: (response: any) => any;
13
+ options?: Record<string, any> | ((params: any) => Record<string, any>);
14
+ }
15
+ export interface ApiCallerOptions {
16
+ baseUrl?: string;
17
+ shopDomain?: string;
18
+ }
19
+ /**
20
+ * 渠道配置接口
21
+ */
22
+ export interface ChannelConfig {
23
+ sendEmailVerificationCode: ApiConfig;
24
+ sendEmailLoginCode: ApiConfig;
25
+ sendSmsRegisterCode: ApiConfig;
26
+ sendEmailRegisterLink: ApiConfig;
27
+ verifyEmailRegistrationLink: ApiConfig;
28
+ emailPasswordLogin: ApiConfig;
29
+ emailCodeRegister: ApiConfig;
30
+ phoneCodeRegister: ApiConfig;
31
+ resendEmailRegisterLink: ApiConfig;
32
+ checkEmailLinkCode: ApiConfig;
33
+ sendSmsLoginCode: ApiConfig;
34
+ phoneCodeLogin: ApiConfig;
35
+ guestLogin: ApiConfig;
36
+ checkEmailExists: ApiConfig;
37
+ checkEmailCode: ApiConfig;
38
+ checkMobileCode: ApiConfig;
39
+ phonePasswordLogin: ApiConfig;
40
+ sendPasswordResetEmail: ApiConfig;
41
+ sendPasswordResetSms: ApiConfig;
42
+ sendResetPasswordLink: ApiConfig;
43
+ checkResetPasswordCode: ApiConfig;
44
+ resetPasswordByCode: ApiConfig;
45
+ resetPasswordByEmail: ApiConfig;
46
+ resetPasswordByPhone: ApiConfig;
47
+ verifyCode: ApiConfig;
48
+ register: ApiConfig;
49
+ login: ApiConfig;
50
+ oauthLogin: ApiConfig;
51
+ validateToken: ApiConfig;
52
+ logout: ApiConfig;
53
+ getCountries: ApiConfig;
54
+ facebookLogin: ApiConfig;
55
+ appleLogin: ApiConfig;
56
+ }
57
+ /**
58
+ * 渠道配置映射
59
+ */
60
+ export declare const channelConfigMap: Record<string, ChannelConfig>;
61
+ /**
62
+ * 获取渠道配置
63
+ */
64
+ export declare function getChannelConfig(channel: string): ChannelConfig;
65
+ /**
66
+ * API 调用器类
67
+ * 负责根据配置执行 API 调用
68
+ */
69
+ export declare class ApiCaller {
70
+ private request;
71
+ private config;
72
+ private options;
73
+ constructor(request: {
74
+ get: <T = any>(url: string, data?: any, options?: any) => Promise<T>;
75
+ post: <T = any>(url: string, data?: any, options?: any) => Promise<T>;
76
+ put: <T = any>(url: string, data?: any, options?: any) => Promise<T>;
77
+ delete: <T = any>(url: string, options?: any) => Promise<T>;
78
+ }, config: ChannelConfig, options?: ApiCallerOptions);
79
+ private resolveUrl;
80
+ /**
81
+ * 执行 API 调用
82
+ */
83
+ call<T = any>(apiName: keyof ChannelConfig, params?: any, additionalOptions?: any): Promise<T>;
84
+ }
85
+ /**
86
+ * 创建 API 调用器
87
+ */
88
+ export declare function createApiCaller(request: {
89
+ get: <T = any>(url: string, data?: any, options?: any) => Promise<T>;
90
+ post: <T = any>(url: string, data?: any, options?: any) => Promise<T>;
91
+ put: <T = any>(url: string, data?: any, options?: any) => Promise<T>;
92
+ delete: <T = any>(url: string, options?: any) => Promise<T>;
93
+ }, channel: string, options?: ApiCallerOptions): ApiCaller;
@@ -0,0 +1,445 @@
1
+ /**
2
+ * 注册登录解决方案类型定义
3
+ */
4
+ /**
5
+ * 注册登录流程 hooks
6
+ */
7
+ export declare enum RegisterAndLoginHooks {
8
+ onInited = "registerAndLogin:onInited",
9
+ onDestroy = "registerAndLogin:onDestroy",
10
+ onEmailVerificationSent = "registerAndLogin:onEmailVerificationSent",
11
+ onEmailVerificationVerified = "registerAndLogin:onEmailVerificationVerified",
12
+ onEmailVerificationFailed = "registerAndLogin:onEmailVerificationFailed",
13
+ onSmsVerificationSent = "registerAndLogin:onSmsVerificationSent",
14
+ onSmsVerificationVerified = "registerAndLogin:onSmsVerificationVerified",
15
+ onSmsVerificationFailed = "registerAndLogin:onSmsVerificationFailed",
16
+ onOAuthLoginStarted = "registerAndLogin:onOAuthLoginStarted",
17
+ onOAuthLoginSuccess = "registerAndLogin:onOAuthLoginSuccess",
18
+ onOAuthLoginFailed = "registerAndLogin:onOAuthLoginFailed",
19
+ onRegisterStarted = "registerAndLogin:onRegisterStarted",
20
+ onRegisterSuccess = "registerAndLogin:onRegisterSuccess",
21
+ onRegisterFailed = "registerAndLogin:onRegisterFailed",
22
+ onLoginStarted = "registerAndLogin:onLoginStarted",
23
+ onLoginSuccess = "registerAndLogin:onLoginSuccess",
24
+ onLoginFailed = "registerAndLogin:onLoginFailed",
25
+ onPasswordResetStarted = "registerAndLogin:onPasswordResetStarted",
26
+ onPasswordResetSuccess = "registerAndLogin:onPasswordResetSuccess",
27
+ onPasswordResetFailed = "registerAndLogin:onPasswordResetFailed"
28
+ }
29
+ /**
30
+ * OAuth 提供商类型
31
+ */
32
+ export declare enum OAuthProvider {
33
+ FACEBOOK = "facebook",
34
+ APPLE = "apple",
35
+ GOOGLE = "google",
36
+ WECHAT = "wechat",
37
+ GITHUB = "github"
38
+ }
39
+ /**
40
+ * 验证码类型
41
+ */
42
+ export declare enum VerificationCodeType {
43
+ EMAIL = "email",
44
+ SMS = "sms"
45
+ }
46
+ /**
47
+ * 验证码用途
48
+ */
49
+ export declare enum VerificationPurpose {
50
+ REGISTER = "register",
51
+ LOGIN = "login",
52
+ PASSWORD_RESET = "password_reset",
53
+ CHANGE_EMAIL = "change_email",
54
+ CHANGE_PHONE = "change_phone"
55
+ }
56
+ /**
57
+ * 用户信息接口
58
+ */
59
+ export interface UserInfo {
60
+ id: string;
61
+ email?: string;
62
+ phone?: string;
63
+ name?: string;
64
+ avatar?: string;
65
+ isEmailVerified: boolean;
66
+ isPhoneVerified: boolean;
67
+ createdAt: string;
68
+ updatedAt: string;
69
+ [key: string]: any;
70
+ }
71
+ /**
72
+ * 注册参数接口
73
+ */
74
+ export interface RegisterParams {
75
+ email?: string;
76
+ phone?: string;
77
+ password: string;
78
+ name?: string;
79
+ verificationCode?: string;
80
+ verificationCodeType?: VerificationCodeType;
81
+ [key: string]: any;
82
+ }
83
+ /**
84
+ * 登录参数接口
85
+ */
86
+ export interface LoginParams {
87
+ email?: string;
88
+ phone?: string;
89
+ password?: string;
90
+ verificationCode?: string;
91
+ verificationCodeType?: VerificationCodeType;
92
+ rememberMe?: boolean;
93
+ [key: string]: any;
94
+ }
95
+ /**
96
+ * OAuth 登录参数接口
97
+ */
98
+ export interface OAuthLoginParams {
99
+ provider: OAuthProvider;
100
+ code?: string;
101
+ accessToken?: string;
102
+ redirectUri?: string;
103
+ [key: string]: any;
104
+ }
105
+ /**
106
+ * 发送验证码参数接口
107
+ */
108
+ export interface SendVerificationCodeParams {
109
+ type: VerificationCodeType;
110
+ target: string;
111
+ purpose: VerificationPurpose;
112
+ [key: string]: any;
113
+ }
114
+ /**
115
+ * 验证验证码参数接口
116
+ */
117
+ export interface VerifyCodeParams {
118
+ type: VerificationCodeType;
119
+ target: string;
120
+ code: string;
121
+ purpose: VerificationPurpose;
122
+ [key: string]: any;
123
+ }
124
+ /**
125
+ * 密码重置参数接口
126
+ */
127
+ export interface PasswordResetParams {
128
+ type: 'email' | 'phone';
129
+ target: {
130
+ email?: string;
131
+ phone?: string;
132
+ country_calling_code?: string;
133
+ };
134
+ password: string;
135
+ code: string;
136
+ }
137
+ /**
138
+ * OAuth 配置接口
139
+ */
140
+ export interface OAuthConfig {
141
+ [OAuthProvider.FACEBOOK]?: {
142
+ appId: string;
143
+ appSecret?: string;
144
+ redirectUri?: string;
145
+ scope?: string[];
146
+ };
147
+ [OAuthProvider.APPLE]?: {
148
+ clientId: string;
149
+ teamId?: string;
150
+ keyId?: string;
151
+ privateKey?: string;
152
+ redirectUri?: string;
153
+ scope?: string[];
154
+ };
155
+ [OAuthProvider.GOOGLE]?: {
156
+ clientId: string;
157
+ clientSecret?: string;
158
+ redirectUri?: string;
159
+ scope?: string[];
160
+ };
161
+ [OAuthProvider.WECHAT]?: {
162
+ appId: string;
163
+ appSecret?: string;
164
+ redirectUri?: string;
165
+ scope?: string[];
166
+ };
167
+ [OAuthProvider.GITHUB]?: {
168
+ clientId: string;
169
+ clientSecret?: string;
170
+ redirectUri?: string;
171
+ scope?: string[];
172
+ };
173
+ }
174
+ /**
175
+ * 注册登录状态接口
176
+ */
177
+ export interface RegisterAndLoginState {
178
+ currentUser: UserInfo | null;
179
+ isLoggedIn: boolean;
180
+ isLoading: boolean;
181
+ verificationCodeSent: {
182
+ [key: string]: {
183
+ sent: boolean;
184
+ sentAt: number;
185
+ expiresAt: number;
186
+ };
187
+ };
188
+ emailRegisterLinkCode: string | null;
189
+ oauthConfig: OAuthConfig;
190
+ error: string | null;
191
+ [key: string]: any;
192
+ }
193
+ /**
194
+ * API 响应接口
195
+ */
196
+ export interface ApiResponse<T = any> {
197
+ status: boolean;
198
+ data?: T;
199
+ message?: string;
200
+ error?: string;
201
+ code?: number;
202
+ }
203
+ /**
204
+ * 登录响应接口
205
+ */
206
+ export interface LoginResponse {
207
+ user: UserInfo;
208
+ token: string;
209
+ refreshToken?: string;
210
+ expiresAt: number;
211
+ }
212
+ /**
213
+ * 注册响应接口
214
+ */
215
+ export interface RegisterResponse {
216
+ user: UserInfo;
217
+ token?: string;
218
+ refreshToken?: string;
219
+ expiresAt?: number;
220
+ needVerification?: boolean;
221
+ }
222
+ /**
223
+ * OAuth 登录响应接口
224
+ */
225
+ export interface OAuthLoginResponse {
226
+ user: UserInfo;
227
+ token: string;
228
+ refreshToken?: string;
229
+ expiresAt: number;
230
+ isNewUser: boolean;
231
+ }
232
+ /**
233
+ * 国家信息接口
234
+ */
235
+ export interface CountryInfo {
236
+ name: string;
237
+ code: string;
238
+ calling_code: string;
239
+ currency_code: string;
240
+ }
241
+ /**
242
+ * 获取国家区号响应接口
243
+ */
244
+ export interface GetCountriesResponse {
245
+ status: boolean;
246
+ code: number;
247
+ message: string;
248
+ data: CountryInfo[];
249
+ }
250
+ /**
251
+ * 发送手机号注册验证码参数接口
252
+ */
253
+ export interface SendSmsRegisterCodeParams {
254
+ phone: string;
255
+ country_calling_code: string;
256
+ }
257
+ /**
258
+ * 发送邮箱注册邀请链接参数接口
259
+ */
260
+ export interface SendEmailRegisterLinkParams {
261
+ email: string;
262
+ }
263
+ /**
264
+ * 验证邮箱注册链接参数接口
265
+ */
266
+ export interface VerifyEmailRegistrationLinkParams {
267
+ code: string;
268
+ password: string;
269
+ }
270
+ /**
271
+ * 邮箱密码登录参数接口
272
+ */
273
+ export interface EmailPasswordLoginParams {
274
+ email: string;
275
+ password: string;
276
+ }
277
+ /**
278
+ * 发送手机登录验证码参数接口
279
+ */
280
+ export interface SendSmsLoginCodeParams {
281
+ phone: string;
282
+ country_calling_code: string;
283
+ }
284
+ /**
285
+ * 手机号验证码登录参数接口
286
+ */
287
+ export interface PhoneCodeLoginParams {
288
+ phone: string;
289
+ country_calling_code: string;
290
+ code: string;
291
+ }
292
+ /**
293
+ * Guest 登录响应接口
294
+ */
295
+ export interface GuestLoginResponse {
296
+ user: UserInfo;
297
+ token: string;
298
+ refreshToken?: string;
299
+ customer: any;
300
+ }
301
+ /**
302
+ * 检查邮箱是否已注册参数接口
303
+ */
304
+ export interface CheckEmailExistsParams {
305
+ email: string;
306
+ shop_id: number;
307
+ }
308
+ /**
309
+ * 检查邮箱是否已注册响应接口
310
+ */
311
+ export interface CheckEmailExistsResponse {
312
+ exists: boolean;
313
+ }
314
+ /**
315
+ * 检查邮箱验证码是否有效参数接口
316
+ */
317
+ export interface CheckEmailCodeParams {
318
+ email: string;
319
+ shop_id: number;
320
+ code: string;
321
+ action: string;
322
+ }
323
+ /**
324
+ * 检查手机验证码是否有效参数接口
325
+ */
326
+ export interface CheckMobileCodeParams {
327
+ phone: string;
328
+ shop_id: number;
329
+ code: string;
330
+ country_calling_code: string;
331
+ action: string;
332
+ }
333
+ /**
334
+ * 验证码有效性检查响应接口
335
+ */
336
+ export interface CheckCodeValidResponse {
337
+ valid: boolean;
338
+ }
339
+ /**
340
+ * 手机号密码登录参数接口
341
+ */
342
+ export interface PhonePasswordLoginParams {
343
+ phone: string;
344
+ password: string;
345
+ country_calling_code: string;
346
+ }
347
+ /**
348
+ * 发送密码重置邮箱验证码参数接口
349
+ */
350
+ export interface SendPasswordResetEmailParams {
351
+ email: string;
352
+ }
353
+ /**
354
+ * 发送重置密码手机号验证码参数接口
355
+ */
356
+ export interface SendPasswordResetSmsParams {
357
+ phone: string;
358
+ country_calling_code: string;
359
+ }
360
+ /**
361
+ * 发送重置密码邮箱链接参数接口
362
+ */
363
+ export interface SendResetPasswordLinkParams {
364
+ email: string;
365
+ }
366
+ /**
367
+ * 检测重置密码链接code有效性参数接口
368
+ */
369
+ export interface CheckResetPasswordCodeParams {
370
+ code: string;
371
+ }
372
+ /**
373
+ * 通过code重置密码参数接口
374
+ */
375
+ export interface ResetPasswordByCodeParams {
376
+ code: string;
377
+ password: string;
378
+ }
379
+ /**
380
+ * 邮箱验证码注册参数接口
381
+ */
382
+ export interface EmailCodeRegisterParams {
383
+ email: string;
384
+ code: string;
385
+ password: string;
386
+ }
387
+ /**
388
+ * 手机验证码注册参数接口
389
+ */
390
+ export interface PhoneCodeRegisterParams {
391
+ phone: string;
392
+ password: string;
393
+ code: string;
394
+ country_calling_code: string;
395
+ }
396
+ /**
397
+ * 重新发送邮箱注册链接参数接口
398
+ */
399
+ export interface ResendEmailRegisterLinkParams {
400
+ code: string;
401
+ }
402
+ /**
403
+ * 校验邮件链接 code 有效性参数接口
404
+ */
405
+ export interface CheckEmailLinkCodeParams {
406
+ code: string;
407
+ }
408
+ /**
409
+ * 校验邮件链接 code 有效性响应接口
410
+ */
411
+ export interface CheckEmailLinkCodeResponse {
412
+ valid: boolean;
413
+ }
414
+ /**
415
+ * Apple 登录参数
416
+ */
417
+ export interface AppleLoginParams {
418
+ token: string;
419
+ }
420
+ /**
421
+ * Apple 登录响应
422
+ */
423
+ export interface AppleLoginResponse {
424
+ user: UserInfo;
425
+ token: string;
426
+ refreshToken?: string;
427
+ expiresAt: number;
428
+ isNewUser: boolean;
429
+ }
430
+ /**
431
+ * Facebook 登录参数
432
+ */
433
+ export interface FacebookLoginParams {
434
+ token: string;
435
+ }
436
+ /**
437
+ * Facebook 登录响应
438
+ */
439
+ export interface FacebookLoginResponse {
440
+ user: UserInfo;
441
+ token: string;
442
+ refreshToken?: string;
443
+ expiresAt: number;
444
+ isNewUser: boolean;
445
+ }