@pisell/pisellos 3.0.75 → 3.0.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 (319) hide show
  1. package/dist/core/index.js +2 -1
  2. package/dist/effects/index.d.ts +5 -3
  3. package/dist/effects/index.js +40 -8
  4. package/dist/modules/Account/index.js +2 -3
  5. package/dist/modules/AccountList/index.d.ts +7 -1
  6. package/dist/modules/AccountList/index.js +81 -14
  7. package/dist/modules/AccountList/types.d.ts +28 -0
  8. package/dist/modules/AccountList/types.js +8 -0
  9. package/dist/modules/BaseModule.d.ts +3 -0
  10. package/dist/modules/BaseModule.js +15 -0
  11. package/dist/modules/Cart/index.d.ts +1 -0
  12. package/dist/modules/Cart/index.js +2 -1
  13. package/dist/modules/Cart/utils/cartProduct.js +21 -4
  14. package/dist/modules/Customer/constants.d.ts +7 -0
  15. package/dist/modules/Customer/constants.js +12 -0
  16. package/dist/modules/Customer/index.d.ts +122 -0
  17. package/dist/modules/Customer/index.js +696 -0
  18. package/dist/modules/Customer/types.d.ts +146 -0
  19. package/dist/modules/Customer/types.js +41 -0
  20. package/dist/modules/Discount/index.d.ts +1 -0
  21. package/dist/modules/Discount/index.js +3 -3
  22. package/dist/modules/Discount/types.d.ts +9 -0
  23. package/dist/modules/Guests/index.js +9 -9
  24. package/dist/modules/Order/index.d.ts +25 -1
  25. package/dist/modules/Order/index.js +224 -3
  26. package/dist/modules/Order/types.d.ts +45 -0
  27. package/dist/modules/Order/types.js +8 -0
  28. package/dist/modules/Order/utils.js +1 -1
  29. package/dist/modules/Payment/cash.d.ts +19 -0
  30. package/dist/modules/Payment/cash.js +97 -0
  31. package/dist/modules/Payment/cashRecommendationAlgorithm.d.ts +22 -0
  32. package/dist/modules/Payment/cashRecommendationAlgorithm.js +423 -0
  33. package/dist/modules/Payment/eftpos.d.ts +11 -0
  34. package/dist/modules/Payment/eftpos.js +80 -0
  35. package/dist/modules/Payment/index.d.ts +184 -9
  36. package/dist/modules/Payment/index.js +2084 -109
  37. package/dist/modules/Payment/mx51.d.ts +0 -0
  38. package/dist/modules/Payment/mx51.js +0 -0
  39. package/dist/modules/Payment/types.d.ts +772 -30
  40. package/dist/modules/Payment/types.js +236 -12
  41. package/dist/modules/Payment/utils.d.ts +17 -0
  42. package/dist/modules/Payment/utils.js +62 -0
  43. package/dist/modules/Payment/walletpass.d.ts +99 -0
  44. package/dist/modules/Payment/walletpass.js +711 -0
  45. package/dist/modules/ProductList/index.d.ts +12 -1
  46. package/dist/modules/ProductList/index.js +37 -15
  47. package/dist/modules/Resource/index.js +1 -1
  48. package/dist/modules/Rules/index.d.ts +2 -1
  49. package/dist/modules/Rules/index.js +470 -127
  50. package/dist/modules/Rules/types.d.ts +1 -0
  51. package/dist/modules/Schedule/index.d.ts +9 -0
  52. package/dist/modules/Schedule/index.js +77 -0
  53. package/dist/modules/Summary/utils.d.ts +5 -0
  54. package/dist/modules/Summary/utils.js +36 -1
  55. package/dist/modules/index.d.ts +1 -0
  56. package/dist/modules/index.js +1 -0
  57. package/dist/plugins/app-types/app/app.d.ts +83 -0
  58. package/dist/plugins/app-types/app/const.d.ts +4 -0
  59. package/dist/plugins/app-types/app/index.d.ts +14 -0
  60. package/dist/plugins/app-types/applicationManager/application.d.ts +50 -0
  61. package/dist/plugins/app-types/applicationManager/index.d.ts +13 -0
  62. package/dist/plugins/app-types/config.d.ts +3 -0
  63. package/dist/plugins/app-types/cookie/index.d.ts +13 -0
  64. package/dist/plugins/app-types/data/index.d.ts +8 -0
  65. package/dist/plugins/app-types/history/config.d.ts +24 -0
  66. package/dist/plugins/app-types/history/index.d.ts +20 -0
  67. package/dist/plugins/app-types/history/type.d.ts +2 -0
  68. package/dist/plugins/app-types/hooks/index.d.ts +12 -0
  69. package/dist/plugins/app-types/hooks/useDelayedValue/index.d.ts +2 -0
  70. package/dist/plugins/app-types/hooks/useDispatch/index.d.ts +2 -0
  71. package/dist/plugins/app-types/hooks/useLowCode/index.d.ts +13 -0
  72. package/dist/plugins/app-types/hooks/useStore/index.d.ts +6 -0
  73. package/dist/plugins/app-types/index.d.ts +6 -0
  74. package/dist/plugins/app-types/indexDB/index.d.ts +178 -0
  75. package/dist/plugins/app-types/locales/en.d.ts +3 -0
  76. package/dist/plugins/app-types/locales/index.d.ts +37 -0
  77. package/dist/plugins/app-types/locales/original.d.ts +3 -0
  78. package/dist/plugins/app-types/locales/type.d.ts +19 -0
  79. package/dist/plugins/app-types/locales/zh-CN.d.ts +3 -0
  80. package/dist/plugins/app-types/locales/zh-HK.d.ts +3 -0
  81. package/dist/plugins/app-types/logger/feishu.d.ts +11 -0
  82. package/dist/plugins/app-types/logger/index.d.ts +122 -0
  83. package/dist/plugins/app-types/menuManager/hooks.d.ts +17 -0
  84. package/dist/plugins/app-types/menuManager/index.d.ts +28 -0
  85. package/dist/plugins/app-types/models/global.d.ts +32 -0
  86. package/dist/plugins/app-types/models/index.d.ts +45 -0
  87. package/dist/plugins/app-types/models/type.d.ts +2 -0
  88. package/dist/plugins/app-types/package.json +15 -0
  89. package/dist/plugins/app-types/plugin/index.d.ts +0 -0
  90. package/dist/plugins/app-types/pubsub/example.d.ts +5 -0
  91. package/dist/plugins/app-types/pubsub/index.d.ts +63 -0
  92. package/dist/plugins/app-types/request/cache.d.ts +46 -0
  93. package/dist/plugins/app-types/request/cancelToken.d.ts +38 -0
  94. package/dist/plugins/app-types/request/config.d.ts +3 -0
  95. package/dist/plugins/app-types/request/constants.d.ts +2 -0
  96. package/dist/plugins/app-types/request/index.d.ts +24 -0
  97. package/dist/plugins/app-types/request/pisell2Request.d.ts +6 -0
  98. package/dist/plugins/app-types/request/type.d.ts +41 -0
  99. package/dist/plugins/app-types/request/utils.d.ts +46 -0
  100. package/dist/plugins/app-types/routes/config.d.ts +7 -0
  101. package/dist/plugins/app-types/routes/index.d.ts +28 -0
  102. package/dist/plugins/app-types/socket/components/SocketMonitorPage.d.ts +6 -0
  103. package/dist/plugins/app-types/socket/components/index.d.ts +2 -0
  104. package/dist/plugins/app-types/socket/constants.d.ts +33 -0
  105. package/dist/plugins/app-types/socket/events.d.ts +31 -0
  106. package/dist/plugins/app-types/socket/heartbeat.d.ts +66 -0
  107. package/dist/plugins/app-types/socket/index.d.ts +61 -0
  108. package/dist/plugins/app-types/socket/monitor.d.ts +169 -0
  109. package/dist/plugins/app-types/socket/reconnect.d.ts +61 -0
  110. package/dist/plugins/app-types/socket/socket.d.ts +129 -0
  111. package/dist/plugins/app-types/socket/types.d.ts +85 -0
  112. package/dist/plugins/app-types/storage/index.d.ts +17 -0
  113. package/dist/plugins/app-types/tasks/index.d.ts +77 -0
  114. package/dist/plugins/app-types/tasks/type.d.ts +62 -0
  115. package/dist/plugins/app-types/tasks/useTasks.d.ts +5 -0
  116. package/dist/plugins/app-types/type.d.ts +2 -0
  117. package/dist/plugins/app-types/variables/VariablesProvider.d.ts +7 -0
  118. package/dist/plugins/app-types/variables/config.d.ts +3 -0
  119. package/dist/plugins/app-types/variables/index.d.ts +6 -0
  120. package/dist/plugins/app-types/variables/type.d.ts +2 -0
  121. package/dist/plugins/app-types/website/index.d.ts +6 -0
  122. package/dist/plugins/app.d.ts +8 -0
  123. package/dist/plugins/app.js +1 -0
  124. package/dist/plugins/window.d.ts +1 -0
  125. package/dist/solution/BookingByStep/index.js +43 -13
  126. package/dist/solution/BookingByStep/utils/capacity.js +1 -1
  127. package/dist/solution/BookingByStep/utils/products.d.ts +6 -0
  128. package/dist/solution/BookingByStep/utils/products.js +10 -0
  129. package/dist/solution/BookingTicket/index.d.ts +184 -0
  130. package/dist/solution/BookingTicket/index.js +698 -0
  131. package/dist/solution/BookingTicket/types.d.ts +68 -0
  132. package/dist/solution/BookingTicket/types.js +43 -0
  133. package/dist/solution/BookingTicket/utils/scan/cloudSearch.d.ts +22 -0
  134. package/dist/solution/BookingTicket/utils/scan/cloudSearch.js +159 -0
  135. package/dist/solution/BookingTicket/utils/scan/handleScan.d.ts +22 -0
  136. package/dist/solution/BookingTicket/utils/scan/handleScan.js +189 -0
  137. package/dist/solution/BookingTicket/utils/scan/index.d.ts +85 -0
  138. package/dist/solution/BookingTicket/utils/scan/index.js +294 -0
  139. package/dist/solution/BookingTicket/utils/scan/scanCache.d.ts +78 -0
  140. package/dist/solution/BookingTicket/utils/scan/scanCache.js +305 -0
  141. package/dist/solution/BuyTickets/index.js +7 -8
  142. package/dist/solution/Checkout/appointmentDemo.json +1 -0
  143. package/dist/solution/Checkout/index.d.ts +432 -0
  144. package/dist/solution/Checkout/index.js +4452 -0
  145. package/dist/solution/Checkout/types.d.ts +727 -0
  146. package/dist/solution/Checkout/types.js +104 -0
  147. package/dist/solution/Checkout/utils/index.d.ts +121 -0
  148. package/dist/solution/Checkout/utils/index.js +511 -0
  149. package/dist/solution/ShopDiscount/index.d.ts +10 -10
  150. package/dist/solution/ShopDiscount/index.js +111 -60
  151. package/dist/solution/ShopDiscount/types.d.ts +8 -0
  152. package/dist/solution/ShopDiscount/utils.d.ts +24 -0
  153. package/dist/solution/ShopDiscount/utils.js +135 -1
  154. package/dist/solution/index.d.ts +2 -0
  155. package/dist/solution/index.js +3 -1
  156. package/dist/types/index.d.ts +4 -1
  157. package/dist/utils/task.d.ts +40 -0
  158. package/dist/utils/task.js +171 -0
  159. package/dist/utils/watch.d.ts +102 -0
  160. package/dist/utils/watch.js +294 -0
  161. package/lib/core/index.js +1 -1
  162. package/lib/effects/index.d.ts +5 -3
  163. package/lib/effects/index.js +17 -1
  164. package/lib/modules/Account/index.js +2 -3
  165. package/lib/modules/AccountList/index.d.ts +7 -1
  166. package/lib/modules/AccountList/index.js +27 -0
  167. package/lib/modules/AccountList/types.d.ts +28 -0
  168. package/lib/modules/BaseModule.d.ts +3 -0
  169. package/lib/modules/BaseModule.js +9 -0
  170. package/lib/modules/Cart/index.d.ts +1 -0
  171. package/lib/modules/Cart/index.js +5 -2
  172. package/lib/modules/Cart/utils/cartProduct.js +22 -6
  173. package/lib/modules/Customer/constants.d.ts +7 -0
  174. package/lib/modules/Customer/constants.js +39 -0
  175. package/lib/modules/Customer/index.d.ts +122 -0
  176. package/lib/modules/Customer/index.js +439 -0
  177. package/lib/modules/Customer/types.d.ts +146 -0
  178. package/lib/modules/Customer/types.js +37 -0
  179. package/lib/modules/Discount/index.d.ts +1 -0
  180. package/lib/modules/Discount/index.js +3 -3
  181. package/lib/modules/Discount/types.d.ts +9 -0
  182. package/lib/modules/Guests/index.js +9 -9
  183. package/lib/modules/Order/index.d.ts +25 -1
  184. package/lib/modules/Order/index.js +186 -1
  185. package/lib/modules/Order/types.d.ts +45 -0
  186. package/lib/modules/Order/utils.js +1 -1
  187. package/lib/modules/Payment/cash.d.ts +19 -0
  188. package/lib/modules/Payment/cash.js +64 -0
  189. package/lib/modules/Payment/cashRecommendationAlgorithm.d.ts +22 -0
  190. package/lib/modules/Payment/cashRecommendationAlgorithm.js +342 -0
  191. package/lib/modules/Payment/eftpos.d.ts +11 -0
  192. package/lib/modules/Payment/eftpos.js +51 -0
  193. package/lib/modules/Payment/index.d.ts +184 -9
  194. package/lib/modules/Payment/index.js +1084 -51
  195. package/lib/modules/Payment/mx51.d.ts +0 -0
  196. package/lib/modules/Payment/mx51.js +0 -0
  197. package/lib/modules/Payment/types.d.ts +772 -30
  198. package/lib/modules/Payment/types.js +79 -6
  199. package/lib/modules/Payment/utils.d.ts +17 -0
  200. package/lib/modules/Payment/utils.js +67 -0
  201. package/lib/modules/Payment/walletpass.d.ts +99 -0
  202. package/lib/modules/Payment/walletpass.js +484 -0
  203. package/lib/modules/ProductList/index.d.ts +12 -1
  204. package/lib/modules/ProductList/index.js +31 -12
  205. package/lib/modules/Resource/index.js +1 -1
  206. package/lib/modules/Rules/index.d.ts +2 -1
  207. package/lib/modules/Rules/index.js +318 -72
  208. package/lib/modules/Rules/types.d.ts +1 -0
  209. package/lib/modules/Schedule/index.d.ts +9 -0
  210. package/lib/modules/Schedule/index.js +60 -0
  211. package/lib/modules/Summary/utils.d.ts +5 -0
  212. package/lib/modules/Summary/utils.js +27 -3
  213. package/lib/modules/index.d.ts +1 -0
  214. package/lib/modules/index.js +2 -0
  215. package/lib/plugins/app-types/app/app.d.ts +83 -0
  216. package/lib/plugins/app-types/app/const.d.ts +4 -0
  217. package/lib/plugins/app-types/app/index.d.ts +14 -0
  218. package/lib/plugins/app-types/applicationManager/application.d.ts +50 -0
  219. package/lib/plugins/app-types/applicationManager/index.d.ts +13 -0
  220. package/lib/plugins/app-types/config.d.ts +3 -0
  221. package/lib/plugins/app-types/cookie/index.d.ts +13 -0
  222. package/lib/plugins/app-types/data/index.d.ts +8 -0
  223. package/lib/plugins/app-types/history/config.d.ts +24 -0
  224. package/lib/plugins/app-types/history/index.d.ts +20 -0
  225. package/lib/plugins/app-types/history/type.d.ts +2 -0
  226. package/lib/plugins/app-types/hooks/index.d.ts +12 -0
  227. package/lib/plugins/app-types/hooks/useDelayedValue/index.d.ts +2 -0
  228. package/lib/plugins/app-types/hooks/useDispatch/index.d.ts +2 -0
  229. package/lib/plugins/app-types/hooks/useLowCode/index.d.ts +13 -0
  230. package/lib/plugins/app-types/hooks/useStore/index.d.ts +6 -0
  231. package/lib/plugins/app-types/index.d.ts +6 -0
  232. package/lib/plugins/app-types/indexDB/index.d.ts +178 -0
  233. package/lib/plugins/app-types/locales/en.d.ts +3 -0
  234. package/lib/plugins/app-types/locales/index.d.ts +37 -0
  235. package/lib/plugins/app-types/locales/original.d.ts +3 -0
  236. package/lib/plugins/app-types/locales/type.d.ts +19 -0
  237. package/lib/plugins/app-types/locales/zh-CN.d.ts +3 -0
  238. package/lib/plugins/app-types/locales/zh-HK.d.ts +3 -0
  239. package/lib/plugins/app-types/logger/feishu.d.ts +11 -0
  240. package/lib/plugins/app-types/logger/index.d.ts +122 -0
  241. package/lib/plugins/app-types/menuManager/hooks.d.ts +17 -0
  242. package/lib/plugins/app-types/menuManager/index.d.ts +28 -0
  243. package/lib/plugins/app-types/models/global.d.ts +32 -0
  244. package/lib/plugins/app-types/models/index.d.ts +45 -0
  245. package/lib/plugins/app-types/models/type.d.ts +2 -0
  246. package/lib/plugins/app-types/package.json +15 -0
  247. package/lib/plugins/app-types/plugin/index.d.ts +0 -0
  248. package/lib/plugins/app-types/pubsub/example.d.ts +5 -0
  249. package/lib/plugins/app-types/pubsub/index.d.ts +63 -0
  250. package/lib/plugins/app-types/request/cache.d.ts +46 -0
  251. package/lib/plugins/app-types/request/cancelToken.d.ts +38 -0
  252. package/lib/plugins/app-types/request/config.d.ts +3 -0
  253. package/lib/plugins/app-types/request/constants.d.ts +2 -0
  254. package/lib/plugins/app-types/request/index.d.ts +24 -0
  255. package/lib/plugins/app-types/request/pisell2Request.d.ts +6 -0
  256. package/lib/plugins/app-types/request/type.d.ts +41 -0
  257. package/lib/plugins/app-types/request/utils.d.ts +46 -0
  258. package/lib/plugins/app-types/routes/config.d.ts +7 -0
  259. package/lib/plugins/app-types/routes/index.d.ts +28 -0
  260. package/lib/plugins/app-types/socket/components/SocketMonitorPage.d.ts +6 -0
  261. package/lib/plugins/app-types/socket/components/index.d.ts +2 -0
  262. package/lib/plugins/app-types/socket/constants.d.ts +33 -0
  263. package/lib/plugins/app-types/socket/events.d.ts +31 -0
  264. package/lib/plugins/app-types/socket/heartbeat.d.ts +66 -0
  265. package/lib/plugins/app-types/socket/index.d.ts +61 -0
  266. package/lib/plugins/app-types/socket/monitor.d.ts +169 -0
  267. package/lib/plugins/app-types/socket/reconnect.d.ts +61 -0
  268. package/lib/plugins/app-types/socket/socket.d.ts +129 -0
  269. package/lib/plugins/app-types/socket/types.d.ts +85 -0
  270. package/lib/plugins/app-types/storage/index.d.ts +17 -0
  271. package/lib/plugins/app-types/tasks/index.d.ts +77 -0
  272. package/lib/plugins/app-types/tasks/type.d.ts +62 -0
  273. package/lib/plugins/app-types/tasks/useTasks.d.ts +5 -0
  274. package/lib/plugins/app-types/type.d.ts +2 -0
  275. package/lib/plugins/app-types/variables/VariablesProvider.d.ts +7 -0
  276. package/lib/plugins/app-types/variables/config.d.ts +3 -0
  277. package/lib/plugins/app-types/variables/index.d.ts +6 -0
  278. package/lib/plugins/app-types/variables/type.d.ts +2 -0
  279. package/lib/plugins/app-types/website/index.d.ts +6 -0
  280. package/lib/plugins/app.d.ts +8 -0
  281. package/lib/plugins/app.js +17 -0
  282. package/lib/plugins/window.d.ts +1 -0
  283. package/lib/solution/BookingByStep/index.js +18 -6
  284. package/lib/solution/BookingByStep/utils/capacity.js +1 -1
  285. package/lib/solution/BookingByStep/utils/products.d.ts +6 -0
  286. package/lib/solution/BookingByStep/utils/products.js +8 -2
  287. package/lib/solution/BookingTicket/index.d.ts +184 -0
  288. package/lib/solution/BookingTicket/index.js +426 -0
  289. package/lib/solution/BookingTicket/types.d.ts +68 -0
  290. package/lib/solution/BookingTicket/types.js +72 -0
  291. package/lib/solution/BookingTicket/utils/scan/cloudSearch.d.ts +22 -0
  292. package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +117 -0
  293. package/lib/solution/BookingTicket/utils/scan/handleScan.d.ts +22 -0
  294. package/lib/solution/BookingTicket/utils/scan/handleScan.js +132 -0
  295. package/lib/solution/BookingTicket/utils/scan/index.d.ts +85 -0
  296. package/lib/solution/BookingTicket/utils/scan/index.js +216 -0
  297. package/lib/solution/BookingTicket/utils/scan/scanCache.d.ts +78 -0
  298. package/lib/solution/BookingTicket/utils/scan/scanCache.js +231 -0
  299. package/lib/solution/BuyTickets/index.js +7 -8
  300. package/lib/solution/Checkout/appointmentDemo.json +1 -0
  301. package/lib/solution/Checkout/index.d.ts +432 -0
  302. package/lib/solution/Checkout/index.js +2776 -0
  303. package/lib/solution/Checkout/types.d.ts +727 -0
  304. package/lib/solution/Checkout/types.js +63 -0
  305. package/lib/solution/Checkout/utils/index.d.ts +121 -0
  306. package/lib/solution/Checkout/utils/index.js +362 -0
  307. package/lib/solution/ShopDiscount/index.d.ts +10 -10
  308. package/lib/solution/ShopDiscount/index.js +53 -27
  309. package/lib/solution/ShopDiscount/types.d.ts +8 -0
  310. package/lib/solution/ShopDiscount/utils.d.ts +24 -0
  311. package/lib/solution/ShopDiscount/utils.js +88 -1
  312. package/lib/solution/index.d.ts +2 -0
  313. package/lib/solution/index.js +5 -1
  314. package/lib/types/index.d.ts +4 -1
  315. package/lib/utils/task.d.ts +40 -0
  316. package/lib/utils/task.js +109 -0
  317. package/lib/utils/watch.d.ts +102 -0
  318. package/lib/utils/watch.js +217 -0
  319. package/package.json +3 -1
@@ -0,0 +1,37 @@
1
+ import { Locale, LibraryItem, LoadLibraryByUrlParams } from "./type";
2
+ import App from "../app";
3
+ export interface LocalesOptions {
4
+ locale?: Locale;
5
+ library?: {
6
+ [key in Locale]: LibraryItem;
7
+ };
8
+ }
9
+ export declare class Locales {
10
+ private app;
11
+ locale: string;
12
+ library: {
13
+ [key in Locale]: LibraryItem;
14
+ };
15
+ constructor(app: App, options?: LocalesOptions);
16
+ getLocale: () => string;
17
+ getCurrentTexts: (locale?: Locale) => {
18
+ [key: string]: string;
19
+ };
20
+ setLocale: (locale: Locale, reload?: boolean) => void;
21
+ getText: (id: string, locale?: Locale) => string;
22
+ isCN: () => boolean;
23
+ loadLibraryByUrl: (urls: LoadLibraryByUrlParams) => Promise<{
24
+ [x: string]: LibraryItem;
25
+ }>;
26
+ loadLibraryByItems(libraryList: LibraryItem[]): void;
27
+ loadLibrary: (urls: LoadLibraryByUrlParams) => Promise<{
28
+ [x: string]: LibraryItem;
29
+ }>;
30
+ translation: (text: string | {
31
+ [key: Locale]: string;
32
+ }, locale?: Locale) => string | number;
33
+ getLibraryByData: (data: LibraryItem[]) => LibraryItem;
34
+ createTextsByLibrary: (id: string, library?: { [key in Locale]: LibraryItem; }) => {
35
+ [x: string]: string;
36
+ };
37
+ }
@@ -0,0 +1,3 @@
1
+ import { LibraryItem } from './type';
2
+ declare const _default: LibraryItem;
3
+ export default _default;
@@ -0,0 +1,19 @@
1
+ export type Locale = 'original' | 'en' | 'zh-CN' | 'zh-HK' | string;
2
+ export type MultiLanguage = {
3
+ [key in Locale]: string;
4
+ };
5
+ export interface LibraryItem {
6
+ locale: Locale;
7
+ name: string;
8
+ translations: {
9
+ [key: string]: string;
10
+ };
11
+ [key: string]: any;
12
+ }
13
+ export interface LocaleConfig {
14
+ locale: Locale;
15
+ library: {
16
+ [key in Locale]: LibraryItem;
17
+ };
18
+ }
19
+ export type LoadLibraryByUrlParams = (string | Promise<LibraryItem> | (() => Promise<LibraryItem>) | LibraryItem)[];
@@ -0,0 +1,3 @@
1
+ import { LibraryItem } from './type';
2
+ declare const _default: LibraryItem;
3
+ export default _default;
@@ -0,0 +1,3 @@
1
+ import { LibraryItem } from './type';
2
+ declare const _default: LibraryItem;
3
+ export default _default;
@@ -0,0 +1,11 @@
1
+ interface contentItem {
2
+ key: string;
3
+ value: string;
4
+ }
5
+ interface sendWebhookProps {
6
+ title: string;
7
+ content: contentItem[];
8
+ webhook: string;
9
+ }
10
+ export declare const sendWarningLog: ({ title, content, webhook }: sendWebhookProps) => Promise<any>;
11
+ export {};
@@ -0,0 +1,122 @@
1
+ import App from "../app";
2
+ export type LogConsoleType = "info" | "warning" | "error" | "debug";
3
+ /**
4
+ * 日志项接口
5
+ */
6
+ interface LogItem {
7
+ type: LogConsoleType;
8
+ title: string;
9
+ date?: string;
10
+ metadata?: any;
11
+ }
12
+ interface LogFile {
13
+ fileName: string;
14
+ date: string;
15
+ fileContent: LogFileContent;
16
+ }
17
+ interface LogFileContent {
18
+ metadata: any;
19
+ logs: LogItem[];
20
+ }
21
+ export interface LoggerOptions {
22
+ prefix?: string;
23
+ checkInterval?: number;
24
+ feishuConfig?: any;
25
+ retentionDays?: number;
26
+ }
27
+ /**
28
+ * 日志管理器类
29
+ */
30
+ declare class LoggerManager {
31
+ private logBuffer;
32
+ private timer;
33
+ private checkInterval;
34
+ private prefix;
35
+ private metadata;
36
+ private db;
37
+ private app;
38
+ private feishuConfig;
39
+ private retentionDays;
40
+ private metadataFunction;
41
+ /**
42
+ * 构造函数
43
+ * @param prefix 日志前缀
44
+ * @param checkInterval 检查间隔时间,默认5分钟
45
+ */
46
+ constructor(app: App, options?: LoggerOptions);
47
+ init(): void;
48
+ /**
49
+ * 初始化 IndexDB
50
+ */
51
+ private initDB;
52
+ /**
53
+ * 设置元数据
54
+ * @param metadata 元数据
55
+ */
56
+ setMetadata(metadata: any): void;
57
+ setMetadataFunction(metadataFunction: () => any): void;
58
+ /**
59
+ * 初始化定时器
60
+ */
61
+ initTimer(): void;
62
+ /**
63
+ * 添加日志
64
+ * @param log 日志项
65
+ */
66
+ addLog(log: LogItem): void;
67
+ /**
68
+ * 发送飞书通知
69
+ * @param log 日志项
70
+ */
71
+ private sendFeishuNotification;
72
+ /**
73
+ * 创建日志文件名
74
+ * @returns 日志文件名
75
+ */
76
+ private createFileName;
77
+ /**
78
+ * 创建日志文件
79
+ * @param _fileName 文件名
80
+ * @returns 日志文件对象
81
+ */
82
+ private createFile;
83
+ /**
84
+ * 存储日志到持久化存储
85
+ */
86
+ private storeLog;
87
+ /**
88
+ * 清理旧日志,只保留最近指定天数的日志
89
+ */
90
+ private cleanupOldLogs;
91
+ /**
92
+ * 获取日志文件列表
93
+ * @returns 日志文件列表
94
+ */
95
+ getLogFiles(): Promise<LogFile[]>;
96
+ /**
97
+ * 获取指定日志文件的内容
98
+ * @param fileName 日志文件名
99
+ * @returns 日志文件内容
100
+ */
101
+ getLogFile(fileName: string): Promise<LogFile | null>;
102
+ /**
103
+ * 清空指定日志文件
104
+ * @param fileName 日志文件名,不指定则清空所有日志
105
+ * @returns 是否成功
106
+ */
107
+ clearLogs(fileName?: string): Promise<boolean>;
108
+ /**
109
+ * 设置日志保留天数
110
+ * @param days 保留天数
111
+ */
112
+ setRetentionDays(days: number): void;
113
+ /**
114
+ * 手动触发清理旧日志
115
+ */
116
+ manualCleanup(): Promise<void>;
117
+ /**
118
+ * 销毁实例
119
+ */
120
+ destroy(): void;
121
+ }
122
+ export default LoggerManager;
@@ -0,0 +1,17 @@
1
+ import React from "react";
2
+ import { MenuItem } from "./index";
3
+ export declare const isHttp: (url: string) => boolean;
4
+ export interface MenuContextType {
5
+ selectedKeys: string[];
6
+ openKeys: string[];
7
+ setOpenKeys: (keys: string[]) => void;
8
+ handleClick: (key: string) => void;
9
+ menuItems: MenuItem[];
10
+ getShowChildren: (children: MenuItem[]) => MenuItem[];
11
+ setMenuItems: (items: MenuItem[]) => void;
12
+ }
13
+ export declare const MenuProvider: React.FC<{
14
+ children: React.ReactNode;
15
+ menus: MenuItem[];
16
+ }>;
17
+ export declare const useMenu: () => MenuContextType;
@@ -0,0 +1,28 @@
1
+ import React from 'react';
2
+ import App from '../app';
3
+ export interface MenuItem {
4
+ key: string;
5
+ label: string;
6
+ path: string;
7
+ children?: MenuItem[];
8
+ icon?: string | React.ReactNode;
9
+ hide?: boolean;
10
+ }
11
+ export declare class MenuManager {
12
+ private menuItems;
13
+ private menuMaps;
14
+ private app;
15
+ useMenu: () => import("./hooks").MenuContextType;
16
+ MenuProvider: React.FC<{
17
+ children: React.ReactNode;
18
+ menus: MenuItem[];
19
+ }>;
20
+ constructor(items: MenuItem[], app: App);
21
+ set(items: MenuItem[]): void;
22
+ getMenus(): MenuItem[];
23
+ getMenuMaps(): void;
24
+ findMenuItemByPath(items: MenuItem[], path: string): MenuItem | null;
25
+ findParent(items: MenuItem[], key: string, parent?: MenuItem | null): MenuItem | null;
26
+ getShowChildren(items: MenuItem[]): MenuItem[];
27
+ findMenuItemByKey(items: MenuItem[], key: string): MenuItem | null;
28
+ }
@@ -0,0 +1,32 @@
1
+ import { Effect, Subscription } from 'dva';
2
+ import { Reducer } from 'redux';
3
+ export interface GlobalModal {
4
+ namespace: 'global';
5
+ state: {
6
+ isLogin: boolean;
7
+ account: any;
8
+ core: any;
9
+ isInstallAPP: boolean;
10
+ app: {
11
+ status: {
12
+ login: boolean;
13
+ storage: boolean;
14
+ network: boolean;
15
+ materials: boolean;
16
+ pisell2: boolean;
17
+ };
18
+ };
19
+ };
20
+ effects: {
21
+ init: Effect;
22
+ };
23
+ reducers: {
24
+ saveGlobalState: Reducer<any>;
25
+ setInit: Reducer<any>;
26
+ };
27
+ subscriptions: {
28
+ _init: Subscription;
29
+ };
30
+ }
31
+ declare const modal: GlobalModal;
32
+ export default modal;
@@ -0,0 +1,45 @@
1
+ import hooks from '../hooks';
2
+ import { Provider as StoreProvider } from "react-redux";
3
+ declare const models: import("./global").GlobalModal[];
4
+ type ModalsType = (typeof models[number]);
5
+ export interface Store {
6
+ getDataByModel: typeof getDataByModel;
7
+ useStore: typeof hooks.useStore;
8
+ useDispatch: typeof hooks.useDispatch;
9
+ setDataByModel: typeof setDataByModel;
10
+ dispatch: any;
11
+ getState: any;
12
+ }
13
+ export type ModelsNames = ModalsType['namespace'];
14
+ export type ModelsState = {
15
+ [K in (ModalsType['namespace'])]: Extract<ModalsType, {
16
+ namespace: K;
17
+ }>['state'];
18
+ };
19
+ /**
20
+ * @title: 从store内获取数据
21
+ * @description:
22
+ * @param {string} model
23
+ * @param {string} key
24
+ * @return {*}
25
+ * @Author: zhiwei.Wang
26
+ * @Date: 2024-09-03 11:07
27
+ */
28
+ declare const getDataByModel: <T extends keyof ModelsState, D extends keyof ModelsState[T]>(model: string, key?: D) => D extends undefined ? ModelsState[T] : ModelsState[T][D];
29
+ /**
30
+ * @title: 设置数据到store
31
+ * @description:
32
+ * @param {string} model
33
+ * @param {string} key
34
+ * @param {string} value
35
+ * @return {*}
36
+ * @Author: zhiwei.Wang
37
+ * @Date: 2024-09-08 15:17
38
+ */
39
+ declare const setDataByModel: <T extends keyof ModelsState, D extends keyof ModelsState[T]>(model: string, key: any, value: any) => void;
40
+ declare const _default: {
41
+ getStore: () => Store;
42
+ StoreProvider: typeof StoreProvider;
43
+ setConfig: (models: any[]) => void;
44
+ };
45
+ export default _default;
@@ -0,0 +1,2 @@
1
+ export interface ModelsConfig {
2
+ }
@@ -0,0 +1,15 @@
1
+ {
2
+ "name": "@pisell/core-types",
3
+ "version": "1.0.1",
4
+ "description": "TypeScript type definitions for @pisell/core",
5
+ "main": "index.d.ts",
6
+ "types": "index.d.ts",
7
+ "typings": "index.d.ts",
8
+ "peerDependencies": {
9
+ "react": "^16.8.0 || ^17.0.0 || ^18.0.0"
10
+ },
11
+ "files": ["**/*.d.ts"],
12
+ "publishConfig": {
13
+ "access": "public"
14
+ }
15
+ }
File without changes
@@ -0,0 +1,5 @@
1
+ /**
2
+ * 发布订阅模块使用示例
3
+ * 此文件仅用于演示,不会被实际引入项目
4
+ */
5
+ export {};
@@ -0,0 +1,63 @@
1
+ /**
2
+ * 发布订阅模块
3
+ * 用于组件/服务间的事件通信
4
+ */
5
+ type EventCallback = (...args: any[]) => void;
6
+ interface EventSubscription {
7
+ unsubscribe: () => void;
8
+ }
9
+ declare class PubSub {
10
+ private events;
11
+ /**
12
+ * 订阅事件
13
+ * @param event 事件名称
14
+ * @param callback 回调函数
15
+ * @returns 订阅对象,可用于取消订阅
16
+ */
17
+ subscribe(event: string, callback: EventCallback): EventSubscription;
18
+ /**
19
+ * 取消订阅事件
20
+ * @param event 事件名称
21
+ * @param callback 回调函数
22
+ * @returns 是否成功取消订阅
23
+ */
24
+ unsubscribe(event: string, callback: EventCallback): boolean;
25
+ /**
26
+ * 发布事件
27
+ * @param event 事件名称
28
+ * @param args 事件参数
29
+ */
30
+ publish(event: string, ...args: any[]): void;
31
+ /**
32
+ * 移除某个事件的所有订阅
33
+ * @param event 事件名称
34
+ * @returns 是否成功移除
35
+ */
36
+ clearEvent(event: string): boolean;
37
+ /**
38
+ * 移除所有事件订阅
39
+ */
40
+ clearAllEvents(): void;
41
+ /**
42
+ * 获取事件的订阅数量
43
+ * @param event 事件名称
44
+ * @returns 订阅数量
45
+ */
46
+ getSubscriberCount(event: string): number;
47
+ /**
48
+ * 检查事件是否有订阅者
49
+ * @param event 事件名称
50
+ * @returns 是否有订阅者
51
+ */
52
+ hasSubscribers(event: string): boolean;
53
+ /**
54
+ * 一次性订阅事件,事件触发后自动取消订阅
55
+ * @param event 事件名称
56
+ * @param callback 回调函数
57
+ * @returns 订阅对象,可用于取消订阅
58
+ */
59
+ once(event: string, callback: EventCallback): EventSubscription;
60
+ }
61
+ declare const pubsub: PubSub;
62
+ export default pubsub;
63
+ export { PubSub, type EventCallback, type EventSubscription };
@@ -0,0 +1,46 @@
1
+ import { CacheProps } from './type';
2
+ export type CacheType = 'memory' | 'storage' | 'indexDB';
3
+ /**
4
+ * @title: 设置缓存
5
+ * @description:
6
+ * @return {*}
7
+ * @Author: zhiwei.Wang
8
+ */
9
+ export declare const setCache: (key: string, data: any, cache: CacheProps) => Promise<void>;
10
+ /**
11
+ * @title: 删除缓存数据
12
+ * @description:
13
+ * @return {*}
14
+ * @Author: zhiwei.Wang
15
+ */
16
+ export declare const removeCache: (key: string, cache: CacheProps) => void;
17
+ /**
18
+ * @title: 获取数据
19
+ * @description:
20
+ * @param {any} url
21
+ * @param {any} data
22
+ * @return {*}
23
+ * @Author: zhiwei.Wang
24
+ */
25
+ export declare const getCacheData: (url: string, data: any, cache: CacheProps) => Promise<any>;
26
+ /**
27
+ * @title: 设置缓存
28
+ * @description:
29
+ * @param {any} url 路径
30
+ * @param {any} data 参数
31
+ * @param {any} res 数据
32
+ * @return {*}
33
+ * @Author: zhiwei.Wang
34
+ */
35
+ export declare const setCacheData: (url: string, data: any, res: any, cache: CacheProps) => any | null;
36
+ /**
37
+ * @title: 缓存函数包装器
38
+ * @description:
39
+ * @param {any} url
40
+ * @param {any} data
41
+ * @param {any} config
42
+ * @param {any} fn
43
+ * @return {*}
44
+ * @Author: zhiwei.Wang
45
+ */
46
+ export declare const cacheFn: (props: any, fn: any) => Promise<any>;
@@ -0,0 +1,38 @@
1
+ /**
2
+ * @Title: 请求列表
3
+ * @Describe:
4
+ * @Author: Wzw
5
+ */
6
+ export declare let requestList: {
7
+ [key: string]: AbortController;
8
+ };
9
+ /**
10
+ * @Title: 创建一个控制器
11
+ * @Describe:
12
+ * @Author: Wzw
13
+ * @param {string} key
14
+ */
15
+ export declare const createController: (key: string) => AbortController;
16
+ /**
17
+ * @Title: 储存请求
18
+ * @Describe:
19
+ * @Author: Wzw
20
+ * @param {AbortController} controller
21
+ * @param {string} key
22
+ */
23
+ export declare const setRequestList: (controller: AbortController, key: string) => void;
24
+ /**
25
+ * @Title: 取消请求
26
+ * @Describe:
27
+ * @Author: Wzw
28
+ * @param {string} key
29
+ */
30
+ export declare const abortRequest: (key: string) => void;
31
+ /**
32
+ * @Title: 创建signal
33
+ * @Describe:
34
+ * @Author: Wzw
35
+ * @param {string} isAbort
36
+ * @param {string} url
37
+ */
38
+ export declare const createSignal: (isAbort: boolean, url: string) => AbortSignal | null;
@@ -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[];