@pisell/pisellos 3.0.55 → 3.0.57

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 (268) hide show
  1. package/dist/core/index.js +2 -1
  2. package/dist/effects/index.d.ts +4 -3
  3. package/dist/effects/index.js +15 -6
  4. package/dist/modules/AccountList/index.d.ts +7 -1
  5. package/dist/modules/AccountList/index.js +81 -14
  6. package/dist/modules/AccountList/types.d.ts +28 -0
  7. package/dist/modules/AccountList/types.js +8 -0
  8. package/dist/modules/Cart/index.js +1 -1
  9. package/dist/modules/Cart/utils/changePrice.d.ts +2 -2
  10. package/dist/modules/Cart/utils/changePrice.js +1 -1
  11. package/dist/modules/Customer/constants.d.ts +7 -0
  12. package/dist/modules/Customer/constants.js +12 -0
  13. package/dist/modules/Customer/index.d.ts +122 -0
  14. package/dist/modules/Customer/index.js +697 -0
  15. package/dist/modules/Customer/types.d.ts +146 -0
  16. package/dist/modules/Customer/types.js +41 -0
  17. package/dist/modules/Payment/cash.d.ts +11 -0
  18. package/dist/modules/Payment/cash.js +78 -0
  19. package/dist/modules/Payment/eftpos.d.ts +11 -0
  20. package/dist/modules/Payment/eftpos.js +80 -0
  21. package/dist/modules/Payment/index.d.ts +273 -9
  22. package/dist/modules/Payment/index.js +2525 -109
  23. package/dist/modules/Payment/types.d.ts +382 -30
  24. package/dist/modules/Payment/types.js +116 -14
  25. package/dist/modules/Payment/wallet.d.ts +11 -0
  26. package/dist/modules/Payment/wallet.js +78 -0
  27. package/dist/modules/Payment/walletpass.d.ts +0 -0
  28. package/dist/modules/Payment/walletpass.js +0 -0
  29. package/dist/modules/ProductList/index.d.ts +14 -3
  30. package/dist/modules/ProductList/index.js +58 -44
  31. package/dist/modules/ProductList/types.d.ts +0 -1
  32. package/dist/modules/Rules/index.js +27 -14
  33. package/dist/modules/Rules/types.d.ts +1 -0
  34. package/dist/modules/index.d.ts +1 -0
  35. package/dist/modules/index.js +1 -0
  36. package/dist/plugins/app-types/app/app.d.ts +83 -0
  37. package/dist/plugins/app-types/app/const.d.ts +4 -0
  38. package/dist/plugins/app-types/app/index.d.ts +14 -0
  39. package/dist/plugins/app-types/applicationManager/application.d.ts +50 -0
  40. package/dist/plugins/app-types/applicationManager/index.d.ts +13 -0
  41. package/dist/plugins/app-types/config.d.ts +3 -0
  42. package/dist/plugins/app-types/cookie/index.d.ts +13 -0
  43. package/dist/plugins/app-types/data/index.d.ts +8 -0
  44. package/dist/plugins/app-types/history/config.d.ts +24 -0
  45. package/dist/plugins/app-types/history/index.d.ts +20 -0
  46. package/dist/plugins/app-types/history/type.d.ts +2 -0
  47. package/dist/plugins/app-types/hooks/index.d.ts +12 -0
  48. package/dist/plugins/app-types/hooks/useDelayedValue/index.d.ts +2 -0
  49. package/dist/plugins/app-types/hooks/useDispatch/index.d.ts +2 -0
  50. package/dist/plugins/app-types/hooks/useLowCode/index.d.ts +13 -0
  51. package/dist/plugins/app-types/hooks/useStore/index.d.ts +6 -0
  52. package/dist/plugins/app-types/index.d.ts +6 -0
  53. package/dist/plugins/app-types/indexDB/index.d.ts +178 -0
  54. package/dist/plugins/app-types/locales/en.d.ts +3 -0
  55. package/dist/plugins/app-types/locales/index.d.ts +37 -0
  56. package/dist/plugins/app-types/locales/original.d.ts +3 -0
  57. package/dist/plugins/app-types/locales/type.d.ts +19 -0
  58. package/dist/plugins/app-types/locales/zh-CN.d.ts +3 -0
  59. package/dist/plugins/app-types/locales/zh-HK.d.ts +3 -0
  60. package/dist/plugins/app-types/logger/feishu.d.ts +11 -0
  61. package/dist/plugins/app-types/logger/index.d.ts +122 -0
  62. package/dist/plugins/app-types/menuManager/hooks.d.ts +17 -0
  63. package/dist/plugins/app-types/menuManager/index.d.ts +28 -0
  64. package/dist/plugins/app-types/models/global.d.ts +32 -0
  65. package/dist/plugins/app-types/models/index.d.ts +45 -0
  66. package/dist/plugins/app-types/models/type.d.ts +2 -0
  67. package/dist/plugins/app-types/package.json +15 -0
  68. package/dist/plugins/app-types/plugin/index.d.ts +0 -0
  69. package/dist/plugins/app-types/pubsub/example.d.ts +5 -0
  70. package/dist/plugins/app-types/pubsub/index.d.ts +63 -0
  71. package/dist/plugins/app-types/request/cache.d.ts +46 -0
  72. package/dist/plugins/app-types/request/cancelToken.d.ts +38 -0
  73. package/dist/plugins/app-types/request/config.d.ts +3 -0
  74. package/dist/plugins/app-types/request/constants.d.ts +2 -0
  75. package/dist/plugins/app-types/request/index.d.ts +24 -0
  76. package/dist/plugins/app-types/request/pisell2Request.d.ts +6 -0
  77. package/dist/plugins/app-types/request/type.d.ts +41 -0
  78. package/dist/plugins/app-types/request/utils.d.ts +46 -0
  79. package/dist/plugins/app-types/routes/config.d.ts +7 -0
  80. package/dist/plugins/app-types/routes/index.d.ts +28 -0
  81. package/dist/plugins/app-types/socket/components/SocketMonitorPage.d.ts +6 -0
  82. package/dist/plugins/app-types/socket/components/index.d.ts +2 -0
  83. package/dist/plugins/app-types/socket/constants.d.ts +33 -0
  84. package/dist/plugins/app-types/socket/events.d.ts +31 -0
  85. package/dist/plugins/app-types/socket/heartbeat.d.ts +66 -0
  86. package/dist/plugins/app-types/socket/index.d.ts +61 -0
  87. package/dist/plugins/app-types/socket/monitor.d.ts +169 -0
  88. package/dist/plugins/app-types/socket/reconnect.d.ts +61 -0
  89. package/dist/plugins/app-types/socket/socket.d.ts +129 -0
  90. package/dist/plugins/app-types/socket/types.d.ts +85 -0
  91. package/dist/plugins/app-types/storage/index.d.ts +17 -0
  92. package/dist/plugins/app-types/tasks/index.d.ts +77 -0
  93. package/dist/plugins/app-types/tasks/type.d.ts +62 -0
  94. package/dist/plugins/app-types/tasks/useTasks.d.ts +5 -0
  95. package/dist/plugins/app-types/type.d.ts +2 -0
  96. package/dist/plugins/app-types/variables/VariablesProvider.d.ts +7 -0
  97. package/dist/plugins/app-types/variables/config.d.ts +3 -0
  98. package/dist/plugins/app-types/variables/index.d.ts +6 -0
  99. package/dist/plugins/app-types/variables/type.d.ts +2 -0
  100. package/dist/plugins/app-types/website/index.d.ts +6 -0
  101. package/dist/plugins/app.d.ts +8 -0
  102. package/dist/plugins/app.js +1 -0
  103. package/dist/plugins/window.d.ts +1 -0
  104. package/dist/solution/BookingByStep/index.js +59 -35
  105. package/dist/solution/BookingByStep/types.d.ts +3 -2
  106. package/dist/solution/BookingTicket/index.d.ts +172 -0
  107. package/dist/solution/BookingTicket/index.js +665 -0
  108. package/dist/solution/BookingTicket/types.d.ts +68 -0
  109. package/dist/solution/BookingTicket/types.js +43 -0
  110. package/dist/solution/BookingTicket/utils/scan/cloudSearch.d.ts +22 -0
  111. package/dist/solution/BookingTicket/utils/scan/cloudSearch.js +159 -0
  112. package/dist/solution/BookingTicket/utils/scan/handleScan.d.ts +16 -0
  113. package/dist/solution/BookingTicket/utils/scan/handleScan.js +174 -0
  114. package/dist/solution/BookingTicket/utils/scan/index.d.ts +81 -0
  115. package/dist/solution/BookingTicket/utils/scan/index.js +285 -0
  116. package/dist/solution/BookingTicket/utils/scan/scanCache.d.ts +78 -0
  117. package/dist/solution/BookingTicket/utils/scan/scanCache.js +305 -0
  118. package/dist/solution/BuyTickets/index.d.ts +2 -2
  119. package/dist/solution/BuyTickets/index.js +1 -1
  120. package/dist/solution/Checkout/appointmentDemo.json +1 -0
  121. package/dist/solution/Checkout/index.d.ts +181 -0
  122. package/dist/solution/Checkout/index.js +1596 -0
  123. package/dist/solution/Checkout/types.d.ts +550 -0
  124. package/dist/solution/Checkout/types.js +132 -0
  125. package/dist/solution/Checkout/utils/index.d.ts +73 -0
  126. package/dist/solution/Checkout/utils/index.js +371 -0
  127. package/dist/solution/ShopDiscount/index.js +4 -2
  128. package/dist/solution/index.d.ts +2 -0
  129. package/dist/solution/index.js +3 -1
  130. package/dist/types/index.d.ts +3 -1
  131. package/dist/utils/task.d.ts +40 -0
  132. package/dist/utils/task.js +171 -0
  133. package/dist/utils/watch.d.ts +102 -0
  134. package/dist/utils/watch.js +294 -0
  135. package/lib/core/index.js +1 -1
  136. package/lib/effects/index.d.ts +4 -3
  137. package/lib/effects/index.js +4 -1
  138. package/lib/modules/AccountList/index.d.ts +7 -1
  139. package/lib/modules/AccountList/index.js +27 -0
  140. package/lib/modules/AccountList/types.d.ts +28 -0
  141. package/lib/modules/Cart/index.js +1 -1
  142. package/lib/modules/Cart/utils/changePrice.d.ts +2 -2
  143. package/lib/modules/Cart/utils/changePrice.js +1 -1
  144. package/lib/modules/Customer/constants.d.ts +7 -0
  145. package/lib/modules/Customer/constants.js +39 -0
  146. package/lib/modules/Customer/index.d.ts +122 -0
  147. package/lib/modules/Customer/index.js +440 -0
  148. package/lib/modules/Customer/types.d.ts +146 -0
  149. package/lib/modules/Customer/types.js +37 -0
  150. package/lib/modules/Payment/cash.d.ts +11 -0
  151. package/lib/modules/Payment/cash.js +51 -0
  152. package/lib/modules/Payment/eftpos.d.ts +11 -0
  153. package/lib/modules/Payment/eftpos.js +51 -0
  154. package/lib/modules/Payment/index.d.ts +273 -9
  155. package/lib/modules/Payment/index.js +1285 -50
  156. package/lib/modules/Payment/types.d.ts +382 -30
  157. package/lib/modules/Payment/types.js +41 -6
  158. package/lib/modules/Payment/wallet.d.ts +11 -0
  159. package/lib/modules/Payment/wallet.js +51 -0
  160. package/lib/modules/Payment/walletpass.d.ts +0 -0
  161. package/lib/modules/Payment/walletpass.js +0 -0
  162. package/lib/modules/ProductList/index.d.ts +14 -3
  163. package/lib/modules/ProductList/index.js +42 -28
  164. package/lib/modules/ProductList/types.d.ts +0 -1
  165. package/lib/modules/Rules/index.js +20 -12
  166. package/lib/modules/Rules/types.d.ts +1 -0
  167. package/lib/modules/index.d.ts +1 -0
  168. package/lib/modules/index.js +2 -0
  169. package/lib/plugins/app-types/app/app.d.ts +83 -0
  170. package/lib/plugins/app-types/app/const.d.ts +4 -0
  171. package/lib/plugins/app-types/app/index.d.ts +14 -0
  172. package/lib/plugins/app-types/applicationManager/application.d.ts +50 -0
  173. package/lib/plugins/app-types/applicationManager/index.d.ts +13 -0
  174. package/lib/plugins/app-types/config.d.ts +3 -0
  175. package/lib/plugins/app-types/cookie/index.d.ts +13 -0
  176. package/lib/plugins/app-types/data/index.d.ts +8 -0
  177. package/lib/plugins/app-types/history/config.d.ts +24 -0
  178. package/lib/plugins/app-types/history/index.d.ts +20 -0
  179. package/lib/plugins/app-types/history/type.d.ts +2 -0
  180. package/lib/plugins/app-types/hooks/index.d.ts +12 -0
  181. package/lib/plugins/app-types/hooks/useDelayedValue/index.d.ts +2 -0
  182. package/lib/plugins/app-types/hooks/useDispatch/index.d.ts +2 -0
  183. package/lib/plugins/app-types/hooks/useLowCode/index.d.ts +13 -0
  184. package/lib/plugins/app-types/hooks/useStore/index.d.ts +6 -0
  185. package/lib/plugins/app-types/index.d.ts +6 -0
  186. package/lib/plugins/app-types/indexDB/index.d.ts +178 -0
  187. package/lib/plugins/app-types/locales/en.d.ts +3 -0
  188. package/lib/plugins/app-types/locales/index.d.ts +37 -0
  189. package/lib/plugins/app-types/locales/original.d.ts +3 -0
  190. package/lib/plugins/app-types/locales/type.d.ts +19 -0
  191. package/lib/plugins/app-types/locales/zh-CN.d.ts +3 -0
  192. package/lib/plugins/app-types/locales/zh-HK.d.ts +3 -0
  193. package/lib/plugins/app-types/logger/feishu.d.ts +11 -0
  194. package/lib/plugins/app-types/logger/index.d.ts +122 -0
  195. package/lib/plugins/app-types/menuManager/hooks.d.ts +17 -0
  196. package/lib/plugins/app-types/menuManager/index.d.ts +28 -0
  197. package/lib/plugins/app-types/models/global.d.ts +32 -0
  198. package/lib/plugins/app-types/models/index.d.ts +45 -0
  199. package/lib/plugins/app-types/models/type.d.ts +2 -0
  200. package/lib/plugins/app-types/package.json +15 -0
  201. package/lib/plugins/app-types/plugin/index.d.ts +0 -0
  202. package/lib/plugins/app-types/pubsub/example.d.ts +5 -0
  203. package/lib/plugins/app-types/pubsub/index.d.ts +63 -0
  204. package/lib/plugins/app-types/request/cache.d.ts +46 -0
  205. package/lib/plugins/app-types/request/cancelToken.d.ts +38 -0
  206. package/lib/plugins/app-types/request/config.d.ts +3 -0
  207. package/lib/plugins/app-types/request/constants.d.ts +2 -0
  208. package/lib/plugins/app-types/request/index.d.ts +24 -0
  209. package/lib/plugins/app-types/request/pisell2Request.d.ts +6 -0
  210. package/lib/plugins/app-types/request/type.d.ts +41 -0
  211. package/lib/plugins/app-types/request/utils.d.ts +46 -0
  212. package/lib/plugins/app-types/routes/config.d.ts +7 -0
  213. package/lib/plugins/app-types/routes/index.d.ts +28 -0
  214. package/lib/plugins/app-types/socket/components/SocketMonitorPage.d.ts +6 -0
  215. package/lib/plugins/app-types/socket/components/index.d.ts +2 -0
  216. package/lib/plugins/app-types/socket/constants.d.ts +33 -0
  217. package/lib/plugins/app-types/socket/events.d.ts +31 -0
  218. package/lib/plugins/app-types/socket/heartbeat.d.ts +66 -0
  219. package/lib/plugins/app-types/socket/index.d.ts +61 -0
  220. package/lib/plugins/app-types/socket/monitor.d.ts +169 -0
  221. package/lib/plugins/app-types/socket/reconnect.d.ts +61 -0
  222. package/lib/plugins/app-types/socket/socket.d.ts +129 -0
  223. package/lib/plugins/app-types/socket/types.d.ts +85 -0
  224. package/lib/plugins/app-types/storage/index.d.ts +17 -0
  225. package/lib/plugins/app-types/tasks/index.d.ts +77 -0
  226. package/lib/plugins/app-types/tasks/type.d.ts +62 -0
  227. package/lib/plugins/app-types/tasks/useTasks.d.ts +5 -0
  228. package/lib/plugins/app-types/type.d.ts +2 -0
  229. package/lib/plugins/app-types/variables/VariablesProvider.d.ts +7 -0
  230. package/lib/plugins/app-types/variables/config.d.ts +3 -0
  231. package/lib/plugins/app-types/variables/index.d.ts +6 -0
  232. package/lib/plugins/app-types/variables/type.d.ts +2 -0
  233. package/lib/plugins/app-types/website/index.d.ts +6 -0
  234. package/lib/plugins/app.d.ts +8 -0
  235. package/lib/plugins/app.js +17 -0
  236. package/lib/plugins/window.d.ts +1 -0
  237. package/lib/solution/BookingByStep/index.js +40 -29
  238. package/lib/solution/BookingByStep/types.d.ts +3 -2
  239. package/lib/solution/BookingTicket/index.d.ts +172 -0
  240. package/lib/solution/BookingTicket/index.js +399 -0
  241. package/lib/solution/BookingTicket/types.d.ts +68 -0
  242. package/lib/solution/BookingTicket/types.js +72 -0
  243. package/lib/solution/BookingTicket/utils/scan/cloudSearch.d.ts +22 -0
  244. package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +117 -0
  245. package/lib/solution/BookingTicket/utils/scan/handleScan.d.ts +16 -0
  246. package/lib/solution/BookingTicket/utils/scan/handleScan.js +125 -0
  247. package/lib/solution/BookingTicket/utils/scan/index.d.ts +81 -0
  248. package/lib/solution/BookingTicket/utils/scan/index.js +210 -0
  249. package/lib/solution/BookingTicket/utils/scan/scanCache.d.ts +78 -0
  250. package/lib/solution/BookingTicket/utils/scan/scanCache.js +231 -0
  251. package/lib/solution/BuyTickets/index.d.ts +2 -2
  252. package/lib/solution/BuyTickets/index.js +1 -1
  253. package/lib/solution/Checkout/appointmentDemo.json +1 -0
  254. package/lib/solution/Checkout/index.d.ts +181 -0
  255. package/lib/solution/Checkout/index.js +864 -0
  256. package/lib/solution/Checkout/types.d.ts +550 -0
  257. package/lib/solution/Checkout/types.js +75 -0
  258. package/lib/solution/Checkout/utils/index.d.ts +73 -0
  259. package/lib/solution/Checkout/utils/index.js +266 -0
  260. package/lib/solution/ShopDiscount/index.js +2 -1
  261. package/lib/solution/index.d.ts +2 -0
  262. package/lib/solution/index.js +5 -1
  263. package/lib/types/index.d.ts +3 -1
  264. package/lib/utils/task.d.ts +40 -0
  265. package/lib/utils/task.js +109 -0
  266. package/lib/utils/watch.d.ts +102 -0
  267. package/lib/utils/watch.js +217 -0
  268. package/package.json +4 -2
@@ -0,0 +1,3 @@
1
+ import { RequestConfig } from './type';
2
+ export declare const setConfig: (newConfig: Partial<RequestConfig>) => void;
3
+ export declare const getConfig: () => RequestConfig;
@@ -0,0 +1,2 @@
1
+ import { CreateAxiosDefaults } from "axios";
2
+ export declare const axiosConfig: CreateAxiosDefaults;
@@ -0,0 +1,24 @@
1
+ import { RequestWrapperProps, RequestConfig } from "./type";
2
+ export declare const createRequest: (props: RequestWrapperProps) => Promise<unknown>;
3
+ /**
4
+ * 请求
5
+ * @param props
6
+ * @returns
7
+ */
8
+ export declare const request: (props: RequestWrapperProps) => Promise<any>;
9
+ export declare const get: (url: RequestWrapperProps["url"], data: RequestWrapperProps["data"], config: RequestWrapperProps["config"]) => Promise<any>;
10
+ export declare const post: (url: RequestWrapperProps["url"], data: RequestWrapperProps["data"], config: RequestWrapperProps["config"]) => Promise<any>;
11
+ export declare const put: (url: RequestWrapperProps["url"], data: RequestWrapperProps["data"], config: RequestWrapperProps["config"]) => Promise<any>;
12
+ export declare const remove: (url: RequestWrapperProps["url"], data: RequestWrapperProps["data"], config: RequestWrapperProps["config"]) => Promise<any>;
13
+ export declare const custom: (url: RequestWrapperProps["url"], config: RequestWrapperProps["config"]) => Promise<any>;
14
+ export * from "./type";
15
+ declare const _default: {
16
+ get: (url: RequestWrapperProps["url"], data: RequestWrapperProps["data"], config: RequestWrapperProps["config"]) => Promise<any>;
17
+ post: (url: RequestWrapperProps["url"], data: RequestWrapperProps["data"], config: RequestWrapperProps["config"]) => Promise<any>;
18
+ put: (url: RequestWrapperProps["url"], data: RequestWrapperProps["data"], config: RequestWrapperProps["config"]) => Promise<any>;
19
+ remove: (url: RequestWrapperProps["url"], data: RequestWrapperProps["data"], config: RequestWrapperProps["config"]) => Promise<any>;
20
+ custom: (url: RequestWrapperProps["url"], config: RequestWrapperProps["config"]) => Promise<any>;
21
+ setConfig: (newConfig: Partial<RequestConfig>) => void;
22
+ getConfig: () => RequestConfig;
23
+ };
24
+ export default _default;
@@ -0,0 +1,6 @@
1
+ type RequestMethod = any;
2
+ declare const pisell2Get: RequestMethod;
3
+ declare const pisell2Post: RequestMethod;
4
+ declare const pisell2Put: RequestMethod;
5
+ declare const pisell2Remove: RequestMethod;
6
+ export { pisell2Get as get, pisell2Post as post, pisell2Put as put, pisell2Remove as remove, };
@@ -0,0 +1,41 @@
1
+ import { CreateAxiosDefaults } from "axios";
2
+ import { CacheType } from './cache';
3
+ export interface RequestConfig {
4
+ interceptorsRequest?: ((value: any) => any | Promise<any>) | null;
5
+ interceptorsRequestError?: ((error: any) => any) | null;
6
+ interceptorsResponse?: any;
7
+ interceptorsResponseError?: ((error: any) => any) | null;
8
+ axiosConfig?: CreateAxiosDefaults;
9
+ storage?: any;
10
+ getToken?: () => string | null;
11
+ setToken?: (token: string) => void;
12
+ getLocale?: () => string | null;
13
+ getUrl?: (config: any) => string;
14
+ requestCallbacks?: {
15
+ 200?: (data: any) => void;
16
+ 401?: (data: any) => void;
17
+ 403?: (data: any) => void;
18
+ other?: (data: any) => void;
19
+ [key: string]: any;
20
+ };
21
+ }
22
+ export interface CacheProps {
23
+ key?: string;
24
+ type?: CacheType;
25
+ updateCache?: boolean;
26
+ cacheUpdateChange?: (data: any) => void;
27
+ }
28
+ export interface RequestSetting {
29
+ abort?: boolean;
30
+ headers?: any;
31
+ cache?: CacheProps;
32
+ signal?: any;
33
+ token?: string;
34
+ [key: string]: any;
35
+ }
36
+ export interface RequestWrapperProps {
37
+ url: string;
38
+ method: 'get' | 'post' | 'remove' | 'put';
39
+ data?: any;
40
+ config?: RequestSetting;
41
+ }
@@ -0,0 +1,46 @@
1
+ import { InternalAxiosRequestConfig } from "axios";
2
+ import { RequestSetting, RequestConfig, RequestWrapperProps } from "./type";
3
+ export declare const getRequestHeaders: (config: InternalAxiosRequestConfig<RequestSetting> & Record<string, any>) => Record<string, string | null>;
4
+ /**
5
+ * @title: 请求前拦截
6
+ * @description:
7
+ * @param {any} config
8
+ * @return {*}
9
+ * @Author: zhiwei.Wang
10
+ * @Date: 2024-07-04 10:51
11
+ */
12
+ export declare const interceptorsRequest: (config: InternalAxiosRequestConfig<RequestSetting> & Record<string, any>) => Promise<InternalAxiosRequestConfig<RequestSetting> & Record<string, any>>;
13
+ /**
14
+ * @title: 请求前error
15
+ * @description:
16
+ * @param {any} err
17
+ * @return {*}
18
+ * @Author: zhiwei.Wang
19
+ * @Date: 2024-07-04 10:51
20
+ */
21
+ export declare const interceptorsRequestError: (err: RequestConfig["interceptorsRequestError"]) => any;
22
+ /**
23
+ * @title: 请求后拦截
24
+ * @description:
25
+ * @param {any} response
26
+ * @return {*}
27
+ * @Author: zhiwei.Wang
28
+ * @Date: 2024-07-04 10:51
29
+ */
30
+ export declare const interceptorsResponse: (response: RequestConfig["interceptorsResponse"]) => any;
31
+ /**
32
+ * @title: 请求后错误拦截
33
+ * @description:
34
+ * @param {any} response
35
+ * @return {*}
36
+ * @Author: zhiwei.Wang
37
+ * @Date: 2024-07-04 10:51
38
+ */
39
+ export declare const interceptorsResponseError: (response: RequestConfig["interceptorsResponseError"]) => any;
40
+ export declare const requestCallback: (resData: {
41
+ res?: any;
42
+ props: RequestWrapperProps;
43
+ resolve: (value: unknown) => void;
44
+ reject: () => void;
45
+ err?: any;
46
+ }) => void;
@@ -0,0 +1,7 @@
1
+ export interface RouteItem {
2
+ path: string;
3
+ component: any;
4
+ exact?: boolean;
5
+ routes?: RouteItem[];
6
+ }
7
+ export declare const routes: RouteItem[];
@@ -0,0 +1,28 @@
1
+ import App from '../app';
2
+ import React from 'react';
3
+ import type { ApplicationInterface } from '../applicationManager/application';
4
+ export interface RouterOptions {
5
+ routes?: Record<string, RouteType>;
6
+ basename?: string;
7
+ }
8
+ export interface RouteType extends ApplicationInterface {
9
+ }
10
+ export declare class RouterManager {
11
+ routes: Record<string, RouteType>;
12
+ options: RouterOptions;
13
+ app: App;
14
+ constructor(options: RouterOptions | undefined, app: App);
15
+ init(): void;
16
+ getRoutes(): Record<string, RouteType>;
17
+ getBasename(): string | undefined;
18
+ setBasename(basename: string): void;
19
+ add(name: string, route: any): void;
20
+ get(name: string): RouteType;
21
+ has(name: string): boolean;
22
+ remove(name: string): void;
23
+ renderComponent(item: RouteType, children?: React.ReactNode): string | number | boolean | Iterable<React.ReactNode> | React.JSX.Element | null | undefined;
24
+ getPageByRoute(route: string): ApplicationInterface | undefined;
25
+ getRouterComponent({ fallback }: {
26
+ fallback?: React.ReactNode;
27
+ }): React.JSX.Element[];
28
+ }
@@ -0,0 +1,6 @@
1
+ import React from "react";
2
+ /**
3
+ * Socket监控页面组件
4
+ */
5
+ declare const SocketMonitorPage: React.FC;
6
+ export default SocketMonitorPage;
@@ -0,0 +1,2 @@
1
+ import SocketMonitorPage from './SocketMonitorPage';
2
+ export { SocketMonitorPage };
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Socket模块常量
3
+ */
4
+ /** 默认配置选项 */
5
+ export declare const DEFAULT_SOCKET_OPTIONS: {
6
+ autoConnect: boolean;
7
+ reconnection: boolean;
8
+ reconnectionAttempts: number;
9
+ reconnectionDelay: number;
10
+ reconnectionDelayMax: number;
11
+ heartbeat: boolean;
12
+ heartbeatInterval: number;
13
+ heartbeatTimeout: number;
14
+ timeout: number;
15
+ };
16
+ /** 默认心跳消息 */
17
+ export declare const DEFAULT_HEARTBEAT_MESSAGE: {
18
+ type: string;
19
+ };
20
+ /** 默认心跳响应事件 */
21
+ export declare const DEFAULT_HEARTBEAT_RESPONSE = "pong";
22
+ /** 最小心跳间隔(毫秒) */
23
+ export declare const MIN_HEARTBEAT_INTERVAL = 1000;
24
+ /** 最小重连延迟(毫秒) */
25
+ export declare const MIN_RECONNECTION_DELAY = 500;
26
+ /** 连接状态码映射 */
27
+ export declare const WS_STATUS_MAP: {
28
+ 0: string;
29
+ 1: string;
30
+ 2: string;
31
+ 3: string;
32
+ 4: string;
33
+ };
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Socket标准事件类型
3
+ */
4
+ export declare enum SocketEvents {
5
+ /** 连接成功事件 */
6
+ CONNECT = "connect",
7
+ /** 连接断开事件 */
8
+ DISCONNECT = "disconnect",
9
+ /** 连接错误事件 */
10
+ ERROR = "error",
11
+ /** 接收消息事件 */
12
+ MESSAGE = "message",
13
+ /** 发送消息事件 */
14
+ SEND = "send",
15
+ /** 重连中事件 */
16
+ RECONNECTING = "reconnecting",
17
+ /** 重连尝试事件 */
18
+ RECONNECT_ATTEMPT = "reconnect_attempt",
19
+ /** 重连成功事件 */
20
+ RECONNECT = "reconnect",
21
+ /** 重连失败事件 */
22
+ RECONNECT_ERROR = "reconnect_error",
23
+ /** 重连次数超限 */
24
+ RECONNECT_FAILED = "reconnect_failed",
25
+ /** 心跳发送事件 */
26
+ HEARTBEAT = "heartbeat",
27
+ /** 心跳响应事件 */
28
+ HEARTBEAT_RESPONSE = "heartbeat_response",
29
+ /** 心跳超时事件 */
30
+ HEARTBEAT_TIMEOUT = "heartbeat_timeout"
31
+ }
@@ -0,0 +1,66 @@
1
+ import { HeartbeatOptions, SocketMessage } from "./types";
2
+ /**
3
+ * Socket心跳管理器
4
+ * 处理WebSocket连接的心跳检测
5
+ */
6
+ export declare class HeartbeatManager {
7
+ private options;
8
+ private intervalTimer;
9
+ private timeoutTimer;
10
+ private lastHeartbeatTime;
11
+ private lastHeartbeatResponse;
12
+ private active;
13
+ private sendHeartbeat;
14
+ private onTimeout;
15
+ private onResponse;
16
+ /**
17
+ * 创建心跳管理器
18
+ * @param options 心跳配置选项
19
+ * @param sendHeartbeat 发送心跳的回调函数
20
+ * @param callbacks 回调函数集合
21
+ */
22
+ constructor(options: HeartbeatOptions, sendHeartbeat: (msg: SocketMessage) => void, callbacks?: {
23
+ onTimeout?: () => void;
24
+ onResponse?: () => void;
25
+ });
26
+ /**
27
+ * 启动心跳检测
28
+ */
29
+ start(): void;
30
+ /**
31
+ * 停止心跳检测
32
+ */
33
+ stop(): void;
34
+ /**
35
+ * 重启心跳检测
36
+ */
37
+ restart(): void;
38
+ /**
39
+ * 接收到心跳响应
40
+ */
41
+ receiveHeartbeatResponse(): void;
42
+ /**
43
+ * 获取上次心跳时间
44
+ */
45
+ getLastHeartbeatTime(): number;
46
+ /**
47
+ * 获取上次心跳响应时间
48
+ */
49
+ getLastHeartbeatResponseTime(): number;
50
+ /**
51
+ * 获取心跳是否活跃
52
+ */
53
+ isActive(): boolean;
54
+ /**
55
+ * 安排下一次心跳
56
+ */
57
+ private scheduleHeartbeat;
58
+ /**
59
+ * 发送心跳消息
60
+ */
61
+ private sendHeartbeatMessage;
62
+ /**
63
+ * 清除所有计时器
64
+ */
65
+ private clearTimers;
66
+ }
@@ -0,0 +1,61 @@
1
+ import { Socket } from './socket';
2
+ import { SocketOptions, SocketStatus, SocketMessage } from './types';
3
+ import { SocketEvents } from './events';
4
+ import { SocketMonitor, SocketMonitorOptions, SocketHistoryItem, SocketStatusItem, SocketStats } from './monitor';
5
+ import * as components from './components';
6
+ /**
7
+ * 创建Socket实例
8
+ * @param url WebSocket连接URL
9
+ * @param options Socket配置选项
10
+ */
11
+ export declare function createSocket(url: string, options?: Partial<Omit<SocketOptions, 'url'>>): Socket;
12
+ declare const _default: {
13
+ /**
14
+ * 创建新的Socket实例
15
+ */
16
+ create: (url: string, options?: Partial<Omit<SocketOptions, "url">>, key?: string) => Socket;
17
+ /**
18
+ * 获取指定键的Socket实例
19
+ */
20
+ get: (key: string) => Socket | undefined;
21
+ /**
22
+ * 移除Socket实例
23
+ */
24
+ remove: (key: string) => boolean;
25
+ /**
26
+ * 关闭并移除所有Socket实例
27
+ */
28
+ closeAll: () => void;
29
+ /**
30
+ * 检查指定键的Socket是否存在
31
+ */
32
+ has: (key: string) => boolean;
33
+ /**
34
+ * 获取所有Socket标识键
35
+ */
36
+ getKeys: () => string[];
37
+ /**
38
+ * 获取所有Socket实例
39
+ */
40
+ getAllSockets: () => Socket[];
41
+ /**
42
+ * 为指定的Socket启用监控
43
+ */
44
+ enableMonitoring: (key: string, options?: SocketMonitorOptions) => SocketMonitor | null;
45
+ /**
46
+ * 获取指定Socket的监控器
47
+ */
48
+ getMonitor: (key: string) => SocketMonitor | null;
49
+ /**
50
+ * 获取所有Socket的监控信息
51
+ */
52
+ getAllMonitors: () => Map<string, SocketMonitor | null>;
53
+ /**
54
+ * 监控组件
55
+ */
56
+ components: typeof components;
57
+ };
58
+ export default _default;
59
+ export { Socket, SocketMonitor };
60
+ export type { SocketOptions, SocketMessage, SocketMonitorOptions, SocketHistoryItem, SocketStatusItem, SocketStats };
61
+ export { SocketStatus, SocketEvents };
@@ -0,0 +1,169 @@
1
+ import { Socket } from './socket';
2
+ import { SocketMessage, SocketStatus } from './types';
3
+ /**
4
+ * Socket历史消息记录项
5
+ */
6
+ export interface SocketHistoryItem {
7
+ /** 消息ID */
8
+ id: string;
9
+ /** 消息时间戳 */
10
+ timestamp: number;
11
+ /** 消息方向(发送/接收) */
12
+ direction: 'in' | 'out';
13
+ /** 消息内容 */
14
+ message: SocketMessage | Partial<SocketMessage>;
15
+ /** 消息大小(字节) */
16
+ size?: number;
17
+ }
18
+ /**
19
+ * Socket状态记录项
20
+ */
21
+ export interface SocketStatusItem {
22
+ /** 状态变更时间戳 */
23
+ timestamp: number;
24
+ /** 变更前状态 */
25
+ from: SocketStatus;
26
+ /** 变更后状态 */
27
+ to: SocketStatus;
28
+ /** 相关事件(如果有) */
29
+ event?: string;
30
+ /** 附加信息 */
31
+ info?: any;
32
+ }
33
+ /**
34
+ * Socket监控配置选项
35
+ */
36
+ export interface SocketMonitorOptions {
37
+ /** 最大历史消息记录数 */
38
+ maxHistoryItems?: number;
39
+ /** 最大状态变更记录数 */
40
+ maxStatusItems?: number;
41
+ /** 是否记录消息内容 */
42
+ recordMessageContent?: boolean;
43
+ /** 是否自动开始监控 */
44
+ autoStart?: boolean;
45
+ /** 过滤掉的消息类型(不记录) */
46
+ excludeEvents?: string[];
47
+ }
48
+ /**
49
+ * Socket监控统计信息
50
+ */
51
+ export interface SocketStats {
52
+ /** 总发送消息数 */
53
+ totalSent: number;
54
+ /** 总接收消息数 */
55
+ totalReceived: number;
56
+ /** 总发送字节数 */
57
+ bytesSent: number;
58
+ /** 总接收字节数 */
59
+ bytesReceived: number;
60
+ /** 连接次数 */
61
+ connectionCount: number;
62
+ /** 重连次数 */
63
+ reconnectionCount: number;
64
+ /** 错误次数 */
65
+ errorCount: number;
66
+ /** 心跳发送次数 */
67
+ heartbeatCount: number;
68
+ /** 心跳超时次数 */
69
+ heartbeatTimeoutCount: number;
70
+ /** 首次连接时间 */
71
+ firstConnectTime: number | null;
72
+ /** 最后连接时间 */
73
+ lastConnectTime: number | null;
74
+ /** 当前连接持续时间(毫秒,连接状态下有效) */
75
+ currentConnectionDuration: number | null;
76
+ /** 平均消息大小(字节) */
77
+ averageMessageSize: number;
78
+ }
79
+ /**
80
+ * Socket监控器
81
+ * 用于监控Socket的连接状态和消息历史
82
+ */
83
+ export declare class SocketMonitor {
84
+ private socket;
85
+ private options;
86
+ private isMonitoring;
87
+ private messageHistory;
88
+ private statusHistory;
89
+ private stats;
90
+ private connectStartTime;
91
+ private eventHandlers;
92
+ /**
93
+ * 创建Socket监控器
94
+ * @param socket 要监控的Socket实例
95
+ * @param options 监控配置选项
96
+ */
97
+ constructor(socket: Socket, options?: SocketMonitorOptions);
98
+ /**
99
+ * 开始监控
100
+ */
101
+ start(): void;
102
+ /**
103
+ * 停止监控
104
+ */
105
+ stop(): void;
106
+ /**
107
+ * 检查监控器是否处于活跃状态
108
+ */
109
+ isActive(): boolean;
110
+ /**
111
+ * 清除历史记录
112
+ */
113
+ clearHistory(): void;
114
+ /**
115
+ * 重置统计数据
116
+ */
117
+ resetStats(): void;
118
+ /**
119
+ * 获取消息历史记录
120
+ * @param limit 返回的最大记录数
121
+ * @param direction 消息方向过滤
122
+ */
123
+ getMessageHistory(limit?: number, direction?: 'in' | 'out'): SocketHistoryItem[];
124
+ /**
125
+ * 获取状态变更历史
126
+ * @param limit 返回的最大记录数
127
+ */
128
+ getStatusHistory(limit?: number): SocketStatusItem[];
129
+ /**
130
+ * 获取统计信息
131
+ */
132
+ getStats(): SocketStats;
133
+ /**
134
+ * 设置监控事件监听
135
+ */
136
+ private setupEventListeners;
137
+ /**
138
+ * 移除监控事件监听
139
+ */
140
+ private removeEventListeners;
141
+ /**
142
+ * 记录已发送的消息
143
+ */
144
+ private recordMessageSent;
145
+ /**
146
+ * 记录已接收的消息
147
+ */
148
+ private recordMessageReceived;
149
+ /**
150
+ * 记录状态变化
151
+ */
152
+ private recordStatusChange;
153
+ /**
154
+ * 添加消息到历史记录,并控制记录数量
155
+ */
156
+ private addToMessageHistory;
157
+ /**
158
+ * 添加状态到历史记录,并控制记录数量
159
+ */
160
+ private addToStatusHistory;
161
+ /**
162
+ * 更新平均消息大小
163
+ */
164
+ private updateAverageMessageSize;
165
+ /**
166
+ * 释放资源
167
+ */
168
+ destroy(): void;
169
+ }
@@ -0,0 +1,61 @@
1
+ import { ReconnectOptions } from './types';
2
+ /**
3
+ * Socket重连管理器
4
+ * 处理断线重连逻辑
5
+ */
6
+ export declare class ReconnectManager {
7
+ private options;
8
+ private attempts;
9
+ private timer;
10
+ private isReconnecting;
11
+ private reconnectCallback;
12
+ private onAttempt;
13
+ private onSuccess;
14
+ private onFail;
15
+ private onMaxAttemptsExceeded;
16
+ /**
17
+ * 创建重连管理器实例
18
+ * @param options 重连配置
19
+ * @param reconnectCallback 重连执行函数
20
+ * @param callbacks 回调函数集合
21
+ */
22
+ constructor(options: ReconnectOptions, reconnectCallback: () => Promise<boolean>, callbacks?: {
23
+ onAttempt?: (attempt: number) => void;
24
+ onSuccess?: () => void;
25
+ onFail?: (error: Error) => void;
26
+ onMaxAttemptsExceeded?: () => void;
27
+ });
28
+ /**
29
+ * 启动重连过程
30
+ */
31
+ startReconnect(): void;
32
+ /**
33
+ * 停止重连过程
34
+ */
35
+ stopReconnect(): void;
36
+ /**
37
+ * 获取当前重连尝试次数
38
+ */
39
+ getReconnectAttempts(): number;
40
+ /**
41
+ * 获取当前是否正在重连
42
+ */
43
+ isActive(): boolean;
44
+ /**
45
+ * 重置重连状态
46
+ */
47
+ reset(): void;
48
+ /**
49
+ * 安排下一次重连尝试
50
+ */
51
+ private scheduleReconnect;
52
+ /**
53
+ * 执行重连操作
54
+ */
55
+ private executeReconnect;
56
+ /**
57
+ * 计算重连延迟时间
58
+ * 支持指数退避算法,增加随机抖动
59
+ */
60
+ private getReconnectDelay;
61
+ }