@wbsuite/react-hooks 1.0.214 → 1.0.215

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 (308) hide show
  1. package/cjs/hooks/useAgents/index.d.ts +2 -0
  2. package/cjs/hooks/useAgents/index.js +32 -0
  3. package/cjs/hooks/useApps/index.d.ts +2 -0
  4. package/cjs/hooks/useApps/index.js +32 -0
  5. package/cjs/hooks/useArticles/index.d.ts +5 -0
  6. package/cjs/hooks/useArticles/index.js +45 -0
  7. package/cjs/hooks/useAttributes/index.d.ts +2 -0
  8. package/cjs/hooks/useAttributes/index.js +52 -0
  9. package/cjs/hooks/useAttributesGroups/index.d.ts +3 -0
  10. package/cjs/hooks/useAttributesGroups/index.js +47 -0
  11. package/cjs/hooks/useAutomations/index.d.ts +2 -0
  12. package/cjs/hooks/useAutomations/index.js +32 -0
  13. package/cjs/hooks/useBackend/get.d.ts +2 -0
  14. package/cjs/hooks/useBackend/get.js +52 -0
  15. package/cjs/hooks/useBackend/index.d.ts +17 -0
  16. package/cjs/hooks/useBackend/index.js +22 -0
  17. package/cjs/hooks/useBackend/list.d.ts +2 -0
  18. package/cjs/hooks/useBackend/list.js +55 -0
  19. package/cjs/hooks/useBackend/post.d.ts +2 -0
  20. package/cjs/hooks/useBackend/post.js +52 -0
  21. package/cjs/hooks/useBackend/put.d.ts +2 -0
  22. package/cjs/hooks/useBackend/put.js +52 -0
  23. package/cjs/hooks/useCampaigns/index.d.ts +2 -0
  24. package/cjs/hooks/useCampaigns/index.js +35 -0
  25. package/cjs/hooks/useCategories/index.d.ts +3 -0
  26. package/cjs/hooks/useCategories/index.js +37 -0
  27. package/cjs/hooks/useChats/index.d.ts +3 -0
  28. package/cjs/hooks/useChats/index.js +37 -0
  29. package/cjs/hooks/useContactGroups/index.d.ts +3 -0
  30. package/cjs/hooks/useContactGroups/index.js +57 -0
  31. package/cjs/hooks/useContacts/index.d.ts +3 -0
  32. package/cjs/hooks/useContacts/index.js +52 -0
  33. package/cjs/hooks/useCurrencies/index.d.ts +3 -0
  34. package/cjs/hooks/useCurrencies/index.js +37 -0
  35. package/cjs/hooks/useCustomers/index.d.ts +3 -0
  36. package/cjs/hooks/useCustomers/index.js +52 -0
  37. package/cjs/hooks/useDocuments/index.d.ts +10 -0
  38. package/cjs/hooks/useDocuments/index.js +145 -0
  39. package/cjs/hooks/useDomains/index.d.ts +2 -0
  40. package/cjs/hooks/useDomains/index.js +32 -0
  41. package/cjs/hooks/useEmailTemplates/index.d.ts +2 -0
  42. package/cjs/hooks/useEmailTemplates/index.js +37 -0
  43. package/cjs/hooks/useEntityStatuses/index.d.ts +2 -0
  44. package/cjs/hooks/useEntityStatuses/index.js +34 -0
  45. package/cjs/hooks/useFormSubmissions/index.d.ts +2 -0
  46. package/cjs/hooks/useFormSubmissions/index.js +9 -0
  47. package/cjs/hooks/useForms/index.d.ts +2 -0
  48. package/cjs/hooks/useForms/index.js +37 -0
  49. package/cjs/hooks/useIntegrations/index.d.ts +2 -0
  50. package/cjs/hooks/useIntegrations/index.js +39 -0
  51. package/cjs/hooks/useInvites/index.d.ts +2 -0
  52. package/cjs/hooks/useInvites/index.js +47 -0
  53. package/cjs/hooks/useLabels/index.d.ts +3 -0
  54. package/cjs/hooks/useLabels/index.js +32 -0
  55. package/cjs/hooks/useLanguages/index.d.ts +5 -0
  56. package/cjs/hooks/useLanguages/index.js +39 -0
  57. package/cjs/hooks/useLeads/index.d.ts +30 -0
  58. package/cjs/hooks/useLeads/index.js +113 -0
  59. package/cjs/hooks/useMedia/index.d.ts +2 -0
  60. package/cjs/hooks/useMedia/index.js +34 -0
  61. package/cjs/hooks/useOrders/index.d.ts +2 -0
  62. package/cjs/hooks/useOrders/index.js +76 -0
  63. package/cjs/hooks/usePaths/index.d.ts +2 -0
  64. package/cjs/hooks/usePaths/index.js +37 -0
  65. package/cjs/hooks/usePermissions/index.d.ts +2 -0
  66. package/cjs/hooks/usePermissions/index.js +47 -0
  67. package/cjs/hooks/useProducts/index.d.ts +2 -0
  68. package/cjs/hooks/useProducts/index.js +52 -0
  69. package/cjs/hooks/useProfile/index.d.ts +3 -0
  70. package/cjs/hooks/useProfile/index.js +57 -0
  71. package/cjs/hooks/useRenting/index.d.ts +47 -0
  72. package/cjs/hooks/useRenting/index.js +52 -0
  73. package/cjs/hooks/useRoles/index.d.ts +2 -0
  74. package/cjs/hooks/useRoles/index.js +32 -0
  75. package/cjs/hooks/useRoom/index.d.ts +3 -0
  76. package/cjs/hooks/useRoom/index.js +55 -0
  77. package/cjs/hooks/useRotations/index.d.ts +2 -0
  78. package/cjs/hooks/useRotations/index.js +37 -0
  79. package/cjs/hooks/useSiteConfig/index.d.ts +5 -0
  80. package/cjs/hooks/useSiteConfig/index.js +33 -0
  81. package/cjs/hooks/useStatuses/index.d.ts +2 -0
  82. package/cjs/hooks/useStatuses/index.js +32 -0
  83. package/cjs/hooks/useStock/index.d.ts +20 -0
  84. package/cjs/hooks/useStock/index.js +51 -0
  85. package/cjs/hooks/useStores/index.d.ts +3 -0
  86. package/cjs/hooks/useStores/index.js +62 -0
  87. package/cjs/hooks/useSubscriptions/index.d.ts +2 -0
  88. package/cjs/hooks/useSubscriptions/index.js +37 -0
  89. package/cjs/hooks/useTable/index.d.ts +3 -0
  90. package/cjs/hooks/useTable/index.js +34 -0
  91. package/cjs/hooks/useTeams/index.d.ts +5 -0
  92. package/cjs/hooks/useTeams/index.js +52 -0
  93. package/cjs/hooks/useTickets/index.d.ts +3 -0
  94. package/cjs/hooks/useTickets/index.js +47 -0
  95. package/cjs/hooks/useTransactions/index.d.ts +8 -0
  96. package/cjs/hooks/useTransactions/index.js +61 -0
  97. package/cjs/hooks/useTranslations/index.d.ts +5 -0
  98. package/cjs/hooks/useTranslations/index.js +42 -0
  99. package/cjs/hooks/useUserConnections/index.d.ts +2 -0
  100. package/cjs/hooks/useUserConnections/index.js +53 -0
  101. package/cjs/hooks/useUserSubscriptions/index.d.ts +6 -0
  102. package/cjs/hooks/useUserSubscriptions/index.js +47 -0
  103. package/cjs/hooks/useUsers/index.d.ts +17 -0
  104. package/cjs/hooks/useUsers/index.js +141 -0
  105. package/cjs/hooks/useWBSuite/index.d.ts +2 -0
  106. package/cjs/hooks/useWBSuite/index.js +39 -0
  107. package/cjs/hooks/useWebsites/index.d.ts +2 -0
  108. package/cjs/hooks/useWebsites/index.js +72 -0
  109. package/{src/index.ts → cjs/index.d.ts} +1 -1
  110. package/cjs/index.js +119 -0
  111. package/cjs/models/Requestor.d.ts +24 -0
  112. package/cjs/models/Requestor.js +53 -0
  113. package/{src/next/utils/index.ts → cjs/next/utils/index.d.ts} +1 -1
  114. package/cjs/next/utils/index.js +6 -0
  115. package/cjs/next/utils/wrapAsync.d.ts +1 -0
  116. package/cjs/next/utils/wrapAsync.js +54 -0
  117. package/cjs/utils/authWithApiKey.d.ts +4 -0
  118. package/cjs/utils/authWithApiKey.js +8 -0
  119. package/cjs/utils/authWithToken.d.ts +4 -0
  120. package/cjs/utils/authWithToken.js +8 -0
  121. package/cjs/utils/index.d.ts +11 -0
  122. package/cjs/utils/index.js +19 -0
  123. package/esm/hooks/useAgents/index.d.ts +2 -0
  124. package/esm/hooks/useAgents/index.js +28 -0
  125. package/esm/hooks/useApps/index.d.ts +2 -0
  126. package/esm/hooks/useApps/index.js +28 -0
  127. package/esm/hooks/useArticles/index.d.ts +5 -0
  128. package/esm/hooks/useArticles/index.js +40 -0
  129. package/esm/hooks/useAttributes/index.d.ts +2 -0
  130. package/esm/hooks/useAttributes/index.js +48 -0
  131. package/esm/hooks/useAttributesGroups/index.d.ts +3 -0
  132. package/esm/hooks/useAttributesGroups/index.js +43 -0
  133. package/esm/hooks/useAutomations/index.d.ts +2 -0
  134. package/esm/hooks/useAutomations/index.js +28 -0
  135. package/esm/hooks/useBackend/get.d.ts +2 -0
  136. package/esm/hooks/useBackend/get.js +48 -0
  137. package/esm/hooks/useBackend/index.d.ts +17 -0
  138. package/esm/hooks/useBackend/index.js +18 -0
  139. package/esm/hooks/useBackend/list.d.ts +2 -0
  140. package/esm/hooks/useBackend/list.js +51 -0
  141. package/esm/hooks/useBackend/post.d.ts +2 -0
  142. package/esm/hooks/useBackend/post.js +48 -0
  143. package/esm/hooks/useBackend/put.d.ts +2 -0
  144. package/esm/hooks/useBackend/put.js +48 -0
  145. package/esm/hooks/useCampaigns/index.d.ts +2 -0
  146. package/esm/hooks/useCampaigns/index.js +31 -0
  147. package/esm/hooks/useCategories/index.d.ts +3 -0
  148. package/esm/hooks/useCategories/index.js +33 -0
  149. package/esm/hooks/useChats/index.d.ts +3 -0
  150. package/esm/hooks/useChats/index.js +33 -0
  151. package/esm/hooks/useContactGroups/index.d.ts +3 -0
  152. package/esm/hooks/useContactGroups/index.js +53 -0
  153. package/esm/hooks/useContacts/index.d.ts +3 -0
  154. package/esm/hooks/useContacts/index.js +48 -0
  155. package/esm/hooks/useCurrencies/index.d.ts +3 -0
  156. package/esm/hooks/useCurrencies/index.js +33 -0
  157. package/esm/hooks/useCustomers/index.d.ts +3 -0
  158. package/esm/hooks/useCustomers/index.js +48 -0
  159. package/esm/hooks/useDocuments/index.d.ts +10 -0
  160. package/esm/hooks/useDocuments/index.js +141 -0
  161. package/esm/hooks/useDomains/index.d.ts +2 -0
  162. package/esm/hooks/useDomains/index.js +28 -0
  163. package/esm/hooks/useEmailTemplates/index.d.ts +2 -0
  164. package/esm/hooks/useEmailTemplates/index.js +33 -0
  165. package/esm/hooks/useEntityStatuses/index.d.ts +2 -0
  166. package/esm/hooks/useEntityStatuses/index.js +30 -0
  167. package/esm/hooks/useFormSubmissions/index.d.ts +2 -0
  168. package/esm/hooks/useFormSubmissions/index.js +5 -0
  169. package/esm/hooks/useForms/index.d.ts +2 -0
  170. package/esm/hooks/useForms/index.js +33 -0
  171. package/esm/hooks/useIntegrations/index.d.ts +2 -0
  172. package/esm/hooks/useIntegrations/index.js +35 -0
  173. package/esm/hooks/useInvites/index.d.ts +2 -0
  174. package/esm/hooks/useInvites/index.js +43 -0
  175. package/esm/hooks/useLabels/index.d.ts +3 -0
  176. package/esm/hooks/useLabels/index.js +28 -0
  177. package/esm/hooks/useLanguages/index.d.ts +5 -0
  178. package/esm/hooks/useLanguages/index.js +35 -0
  179. package/esm/hooks/useLeads/index.d.ts +30 -0
  180. package/esm/hooks/useLeads/index.js +109 -0
  181. package/esm/hooks/useMedia/index.d.ts +2 -0
  182. package/esm/hooks/useMedia/index.js +30 -0
  183. package/esm/hooks/useOrders/index.d.ts +2 -0
  184. package/esm/hooks/useOrders/index.js +72 -0
  185. package/esm/hooks/usePaths/index.d.ts +2 -0
  186. package/esm/hooks/usePaths/index.js +33 -0
  187. package/esm/hooks/usePermissions/index.d.ts +2 -0
  188. package/esm/hooks/usePermissions/index.js +43 -0
  189. package/esm/hooks/useProducts/index.d.ts +2 -0
  190. package/esm/hooks/useProducts/index.js +48 -0
  191. package/esm/hooks/useProfile/index.d.ts +3 -0
  192. package/esm/hooks/useProfile/index.js +53 -0
  193. package/esm/hooks/useRenting/index.d.ts +47 -0
  194. package/esm/hooks/useRenting/index.js +48 -0
  195. package/esm/hooks/useRoles/index.d.ts +2 -0
  196. package/esm/hooks/useRoles/index.js +28 -0
  197. package/esm/hooks/useRoom/index.d.ts +3 -0
  198. package/esm/hooks/useRoom/index.js +51 -0
  199. package/esm/hooks/useRotations/index.d.ts +2 -0
  200. package/esm/hooks/useRotations/index.js +33 -0
  201. package/esm/hooks/useSiteConfig/index.d.ts +5 -0
  202. package/esm/hooks/useSiteConfig/index.js +29 -0
  203. package/esm/hooks/useStatuses/index.d.ts +2 -0
  204. package/esm/hooks/useStatuses/index.js +28 -0
  205. package/esm/hooks/useStock/index.d.ts +20 -0
  206. package/esm/hooks/useStock/index.js +47 -0
  207. package/esm/hooks/useStores/index.d.ts +3 -0
  208. package/esm/hooks/useStores/index.js +58 -0
  209. package/esm/hooks/useSubscriptions/index.d.ts +2 -0
  210. package/esm/hooks/useSubscriptions/index.js +33 -0
  211. package/esm/hooks/useTable/index.d.ts +3 -0
  212. package/esm/hooks/useTable/index.js +30 -0
  213. package/esm/hooks/useTeams/index.d.ts +5 -0
  214. package/esm/hooks/useTeams/index.js +48 -0
  215. package/esm/hooks/useTickets/index.d.ts +3 -0
  216. package/esm/hooks/useTickets/index.js +43 -0
  217. package/esm/hooks/useTransactions/index.d.ts +8 -0
  218. package/esm/hooks/useTransactions/index.js +57 -0
  219. package/esm/hooks/useTranslations/index.d.ts +5 -0
  220. package/esm/hooks/useTranslations/index.js +38 -0
  221. package/esm/hooks/useUserConnections/index.d.ts +2 -0
  222. package/esm/hooks/useUserConnections/index.js +49 -0
  223. package/esm/hooks/useUserSubscriptions/index.d.ts +6 -0
  224. package/esm/hooks/useUserSubscriptions/index.js +43 -0
  225. package/esm/hooks/useUsers/index.d.ts +17 -0
  226. package/esm/hooks/useUsers/index.js +137 -0
  227. package/esm/hooks/useWBSuite/index.d.ts +2 -0
  228. package/esm/hooks/useWBSuite/index.js +35 -0
  229. package/esm/hooks/useWebsites/index.d.ts +2 -0
  230. package/esm/hooks/useWebsites/index.js +68 -0
  231. package/esm/index.d.ts +51 -0
  232. package/esm/index.js +52 -0
  233. package/esm/models/Requestor.d.ts +24 -0
  234. package/esm/models/Requestor.js +47 -0
  235. package/esm/next/utils/index.d.ts +2 -0
  236. package/esm/next/utils/index.js +3 -0
  237. package/esm/next/utils/wrapAsync.d.ts +1 -0
  238. package/esm/next/utils/wrapAsync.js +50 -0
  239. package/esm/utils/authWithApiKey.d.ts +4 -0
  240. package/esm/utils/authWithApiKey.js +4 -0
  241. package/esm/utils/authWithToken.d.ts +4 -0
  242. package/esm/utils/authWithToken.js +4 -0
  243. package/esm/utils/index.d.ts +11 -0
  244. package/esm/utils/index.js +3 -0
  245. package/package.json +1 -1
  246. package/README.md +0 -66
  247. package/docs/USAGE.md +0 -107
  248. package/eslint.config.js +0 -12
  249. package/src/hooks/useAgents/index.ts +0 -10
  250. package/src/hooks/useApps/index.ts +0 -10
  251. package/src/hooks/useArticles/index.ts +0 -18
  252. package/src/hooks/useAttributes/index.ts +0 -18
  253. package/src/hooks/useAttributesGroups/index.ts +0 -17
  254. package/src/hooks/useAutomations/index.ts +0 -10
  255. package/src/hooks/useBackend/get.ts +0 -6
  256. package/src/hooks/useBackend/index.ts +0 -40
  257. package/src/hooks/useBackend/list.ts +0 -6
  258. package/src/hooks/useBackend/post.ts +0 -6
  259. package/src/hooks/useBackend/put.ts +0 -6
  260. package/src/hooks/useCampaigns/index.ts +0 -11
  261. package/src/hooks/useCategories/index.ts +0 -13
  262. package/src/hooks/useChats/index.ts +0 -13
  263. package/src/hooks/useContactGroups/index.ts +0 -28
  264. package/src/hooks/useContacts/index.ts +0 -21
  265. package/src/hooks/useCurrencies/index.ts +0 -14
  266. package/src/hooks/useCustomers/index.ts +0 -21
  267. package/src/hooks/useDocuments/index.ts +0 -86
  268. package/src/hooks/useDomains/index.ts +0 -10
  269. package/src/hooks/useEmailTemplates/index.ts +0 -13
  270. package/src/hooks/useEntityStatuses/index.ts +0 -13
  271. package/src/hooks/useFormSubmissions/index.ts +0 -6
  272. package/src/hooks/useForms/index.ts +0 -16
  273. package/src/hooks/useIntegrations/index.ts +0 -15
  274. package/src/hooks/useInvites/index.ts +0 -19
  275. package/src/hooks/useLabels/index.ts +0 -13
  276. package/src/hooks/useLanguages/index.ts +0 -16
  277. package/src/hooks/useLeads/index.ts +0 -149
  278. package/src/hooks/useMedia/index.ts +0 -13
  279. package/src/hooks/useOrders/index.ts +0 -74
  280. package/src/hooks/usePaths/index.ts +0 -16
  281. package/src/hooks/usePermissions/index.ts +0 -16
  282. package/src/hooks/useProducts/index.ts +0 -18
  283. package/src/hooks/useProfile/index.ts +0 -20
  284. package/src/hooks/useRenting/index.ts +0 -57
  285. package/src/hooks/useRoles/index.ts +0 -10
  286. package/src/hooks/useRoom/index.ts +0 -20
  287. package/src/hooks/useRotations/index.ts +0 -13
  288. package/src/hooks/useSiteConfig/index.ts +0 -13
  289. package/src/hooks/useStatuses/index.ts +0 -10
  290. package/src/hooks/useStock/index.ts +0 -48
  291. package/src/hooks/useStores/index.ts +0 -23
  292. package/src/hooks/useSubscriptions/index.ts +0 -17
  293. package/src/hooks/useTable/index.ts +0 -15
  294. package/src/hooks/useTeams/index.ts +0 -29
  295. package/src/hooks/useTickets/index.ts +0 -17
  296. package/src/hooks/useTransactions/index.ts +0 -43
  297. package/src/hooks/useTranslations/index.ts +0 -20
  298. package/src/hooks/useUserConnections/index.ts +0 -18
  299. package/src/hooks/useUserSubscriptions/index.ts +0 -28
  300. package/src/hooks/useUsers/index.ts +0 -57
  301. package/src/hooks/useWBSuite/index.ts +0 -29
  302. package/src/hooks/useWebsites/index.ts +0 -34
  303. package/src/models/Requestor.ts +0 -67
  304. package/src/next/utils/wrapAsync.ts +0 -2
  305. package/src/utils/authWithApiKey.ts +0 -3
  306. package/src/utils/authWithToken.ts +0 -3
  307. package/src/utils/index.ts +0 -7
  308. package/tsconfig.json +0 -20
@@ -1,19 +0,0 @@
1
- import { RequestorOptions } from 'models/Requestor';
2
- import { BackendHook, useBackend } from '../useBackend';
3
-
4
- export const useInvites: BackendHook<any> = (auth?: RequestorOptions['auth']) => {
5
- const { requestor, ...endpoints } = useBackend<any>('invites', { auth });
6
- return {
7
- requestor,
8
- ...endpoints,
9
- validate: (invite: string) => {
10
- return requestor.makeRequest.post(`invites/validate`, { invite }).then(({ data }) => data);
11
- },
12
- accept: (invite: string) => {
13
- return requestor.makeRequest.post(`invites/accept`, { invite }).then(({ data }) => data);
14
- },
15
- reject: (invite: string) => {
16
- return requestor.makeRequest.post(`invites/reject`, { invite }).then(({ data }) => data);
17
- }
18
- };
19
- };
@@ -1,13 +0,0 @@
1
-
2
- import { RequestorOptions } from 'models/Requestor';
3
- import { BackendHook, useBackend } from '../useBackend';
4
-
5
- export type ILabel = Record<string, unknown>;
6
-
7
- export const useLabels: BackendHook<ILabel> = (auth?: RequestorOptions['auth']) => {
8
- const { requestor, ...endpoints } = useBackend<ILabel>('labels', { auth });
9
- return {
10
- requestor,
11
- ...endpoints,
12
- };
13
- };
@@ -1,16 +0,0 @@
1
- import { RequestorOptions } from 'models/Requestor';
2
- import { BackendHook, useBackend } from '../useBackend';
3
- import { ILang } from '@wb/types/lang/lang.model';
4
-
5
- export const useLanguages: BackendHook<ILang, any, { getProductLanguages: () => Promise<ILang[]> }> = (auth?: RequestorOptions['auth']) => {
6
- const { requestor, ...rest } = useBackend('languages', { auth });
7
- return {
8
- ...rest,
9
- requestor,
10
- getProductLanguages: () => {
11
- return requestor.makeRequest
12
- .get(`languages/product`)
13
- .then(({ data }) => data);
14
- },
15
- };
16
- };
@@ -1,149 +0,0 @@
1
- import { BackendHook, useBackend } from '../useBackend';
2
- import { RequestorOptions } from 'models/Requestor';
3
-
4
- export type LeadStatus = 'new' | 'contacted' | 'closed' | 'bad' | 'lost';
5
- export enum LeadGradeValues {
6
- BAD = -1,
7
- NEUTRAL = 0,
8
- GOOD = 1,
9
- }
10
-
11
- export const useLeads: BackendHook<
12
- any,
13
- any,
14
- {
15
- createLead: (campaignId: string, lead: any) => Promise<any>;
16
- getLeadSummary: (filter: Record<string, unknown>) => Promise<any>;
17
- getAvailableAsignees: (leadId: string) => Promise<any>;
18
- assign: (leadId: string, userId: string) => Promise<any>;
19
- archive: (leadId: string) => Promise<any>;
20
- addLog: (leadId: string, log: { text: string; extra?: Record<string, unknown> }) => Promise<any>;
21
- logHistory: (leadId: string, limit?: number) => Promise<any>;
22
- assignmentHistory: (leadId: string, limit?: number) => Promise<any>;
23
- actionHistory: (leadId: string, limit?: number) => Promise<any>;
24
- commentsHistory: (leadId: string, limit?: number) => Promise<any>;
25
- addAction: (leadId: string, action: Record<string, unknown>) => Promise<any>;
26
- editAction: (leadId: string, actionId: string, action: Record<string, unknown>) => Promise<any>;
27
- deleteAction: (leadId: string, actionId: string) => Promise<any>;
28
- completeAction: (leadId: string, actionId: string, completed: boolean) => Promise<any>;
29
- grade: (leadId: string, grade: { assessment: LeadGradeValues; description?: string }) => Promise<any>;
30
- }
31
- > = (auth?: RequestorOptions['auth']) => {
32
- const { requestor, ...endpoints } = useBackend(`leads`, { auth });
33
-
34
- return {
35
- requestor,
36
- ...endpoints,
37
- createLead: (campaignId: string, lead: any) => {
38
- return requestor.makeRequest.post(`leads/${campaignId}`, lead).then((r: { data: any }) => r.data);
39
- },
40
- getLeadSummary: (filter: Record<string, unknown> = {}) => {
41
- return requestor.makeRequest.get('leads/summary', { params: filter }).then((r: { data: any }) => r.data);
42
- },
43
- getAvailableAsignees: (leadId: string) => {
44
- return requestor.makeRequest.get(`leads/${leadId}/available-assignees`).then((r: { data: any }) => r.data);
45
- },
46
- assign: (leadId: string, userId: string) => {
47
- return requestor.makeRequest.post(`leads/${leadId}/assign/${userId}`, {}).then((r: { data: any }) => r.data);
48
- },
49
- manualAssign: (leadId: string, userId: string) => {
50
- return requestor.makeRequest.post(`leads/${leadId}/assign/manual/${userId}`, {}).then((r: { data: any }) => r.data);
51
- },
52
- archive: (leadId: string) => {
53
- return requestor.makeRequest.post(`leads/${leadId}/archive`).then((r: { data: any }) => r.data);
54
- },
55
- addLog: (leadId: string, log: { text: string; extra?: Record<string, unknown> }) => {
56
- return requestor.makeRequest.post(`leads/${leadId}/log`, log).then((r) => r.data);
57
- },
58
- logHistory: (leadId: string, limit?: number) => {
59
- return requestor.makeRequest.get(`leads/${leadId}/log/history`, { params: { limit } }).then((r) => r.data);
60
- },
61
- assignmentHistory: (leadId: string, limit?: number) => {
62
- return requestor.makeRequest.get(`leads/${leadId}/assignment/history`, { params: { limit } }).then((r) => r.data);
63
- },
64
- actionHistory: (leadId: string, limit?: number) => {
65
- return requestor.makeRequest.get(`leads/${leadId}/action/history`, { params: { limit } }).then((r) => r.data);
66
- },
67
- commentsHistory: (leadId: string, limit?: number) => {
68
- return requestor.makeRequest.get(`leads/${leadId}/comment/history`, { params: { limit } }).then((r) => r.data);
69
- },
70
- addAction: (leadId: string, action: Record<string, unknown>) => {
71
- return requestor.makeRequest.post(`leads/${leadId}/action`, action).then((r: { data: any }) => r.data);
72
- },
73
- editAction: (leadId: string, actionId: string, action: Record<string, unknown>) => {
74
- return requestor.makeRequest.put(`leads/${leadId}/action/${actionId}`, action).then((r: { data: any }) => r.data);
75
- },
76
- deleteAction: (leadId: string, actionId: string) => {
77
- return requestor.makeRequest.delete(`leads/${leadId}/action/${actionId}`).then((r: { data: any }) => r.data);
78
- },
79
- completeAction: (leadId: string, actionId: string, completed: boolean) => {
80
- return requestor.makeRequest
81
- .post(`leads/${leadId}/action/${actionId}/complete`, {
82
- completed,
83
- })
84
- .then((r: { data: any }) => r.data);
85
- },
86
- grade: (
87
- leadId: string,
88
- grade: {
89
- assessment: (typeof LeadGradeValues)[keyof typeof LeadGradeValues];
90
- description?: string;
91
- }
92
- ) => {
93
- return requestor.makeRequest.post(`leads/${leadId}/grade`, { ...grade }).then((r: { data: any }) => r.data);
94
- },
95
- createQuote: (leadId: string, quote: Record<string, unknown>) => {
96
- return requestor.makeRequest.post(`leads/${leadId}/quote`, quote).then((r: { data: any }) => r.data);
97
- },
98
- createManualQuote: (leadId: string, quote: Record<string, unknown>) => {
99
- return requestor.makeRequest.post(`leads/${leadId}/quote/manual`, quote).then((r: { data: any }) => r.data);
100
- },
101
- acceptQuote: (leadId: string, quoteId: string) => {
102
- return requestor.makeRequest.post(`leads/${leadId}/quote/${quoteId}/accept`).then((r: { data: any }) => r.data);
103
- },
104
- linkToCustomer: (leadId: string, customerId: string) => {
105
- return requestor.makeRequest
106
- .post(`leads/${leadId}/link/customer/${customerId}`)
107
- .then((r: { data: any }) => r.data);
108
- },
109
- changeLeadStatus: (leadId: string, request: { newStatus: string; reason?: string }) => {
110
- return requestor.makeRequest.put(`leads/${leadId}/status`, request).then((r) => r.data);
111
- },
112
- closeLead: (leadId: string, request: { reason?: string }) => {
113
- return requestor.makeRequest.post(`leads/${leadId}/close`, request).then((r) => r.data);
114
- },
115
- cancelLead: (leadId: string, request: { reason?: string }) => {
116
- return requestor.makeRequest.post(`leads/${leadId}/cancel`, request).then((r) => r.data);
117
- },
118
- reevaluateLeadStatus: (leadId: string) => {
119
- return requestor.makeRequest.post(`leads/${leadId}/reevaluate/status`).then((r) => r.data);
120
- },
121
- relocate: (leadId: string, { campaign, store }: { campaign?: string; store?: string }) => {
122
- return requestor.makeRequest.put(`leads/${leadId}/relocate`, { campaign, store }).then((r) => r.data);
123
- },
124
- unassign: (leadId: string) => {
125
- return requestor.makeRequest.post(`leads/${leadId}/unassign`).then((r) => r.data);
126
- },
127
- updateStore: (leadId: string, storeId: string) => {
128
- return requestor.makeRequest.put(`leads/${leadId}/store/${storeId}`).then((r) => r.data);
129
- },
130
- bulkUpdateStore: (leadIds: string[], storeId: string) => {
131
- return requestor.makeRequest.put(`leads/bulk/store/${storeId}`, { leadIds }).then((r) => r.data);
132
- },
133
- updateRotation: (leadId: string, rotationId: string) => {
134
- return requestor.makeRequest.put(`leads/${leadId}/rotation/${rotationId}`).then((r) => r.data);
135
- },
136
- bulkUpdateRotation: (leadIds: string[], rotationId: string) => {
137
- return requestor.makeRequest.put(`leads/bulk/rotation/${rotationId}`, { leadIds }).then((r) => r.data);
138
- },
139
- bulkAssign: (leadIds: string[], userId: string) => {
140
- return requestor.makeRequest.put(`leads/bulk/assign/${userId}`, { leadIds }).then((r) => r.data);
141
- },
142
- bulkClose: (leadIds: string[], reason?: string) => {
143
- return requestor.makeRequest.put(`leads/bulk/close`, { leadIds, reason }).then((r) => r.data);
144
- },
145
- getReport: (filters: Record<string, unknown>, options: Partial<{ sendEmail: boolean, email: string; format: 'csv' | 'xlsx' }> = {}) => {
146
- return requestor.makeRequest.post(`leads/report/request`, { filters, options }).then((r) => r.data);
147
- },
148
- };
149
- };
@@ -1,13 +0,0 @@
1
- import { RequestorOptions } from 'models/Requestor';
2
- import { BackendHook, useBackend } from '../useBackend';
3
-
4
- export const useMedia: BackendHook<any, any> = (auth?: RequestorOptions['auth']) => {
5
- const { requestor, ...rest } = useBackend('media', { auth });
6
- return {
7
- ...rest,
8
- requestor,
9
- getShareableLink: (entity: string, entityId: string) => {
10
- return requestor.makeRequest.post(`media/share`, { entity, entityId }).then((r: { data: any }) => r.data);
11
- },
12
- };
13
- };
@@ -1,74 +0,0 @@
1
- import { RequestorOptions } from 'models/Requestor';
2
- import { BackendHook, useBackend } from '../useBackend';
3
-
4
- export const useOrders: BackendHook<any> = (auth?: RequestorOptions['auth']) => {
5
- const { requestor, ...endpoints } = useBackend(`orders`, { auth });
6
-
7
- return {
8
- requestor,
9
- ...endpoints,
10
- createManual: (order: any) => {
11
- return requestor.makeRequest.post(`orders/manual`, order).then((r) => r.data);
12
- },
13
- get: (orderId: string, skipProductDetails: boolean = true) => {
14
- return requestor.makeRequest.get(`orders/${orderId}?skipProductDetails=${skipProductDetails}`).then((r) => r.data);
15
- },
16
- addLog: (orderId: string, log: { text: string; extra?: Record<string, unknown> }) => {
17
- return requestor.makeRequest.post(`orders/${orderId}/notes`, log).then((r) => r.data);
18
- },
19
- logHistory: (orderId: string, limit?: number) => {
20
- return requestor.makeRequest.get(`orders/${orderId}/log/history`, { params: { limit } }).then((r) => r.data);
21
- },
22
- deleteLog: (orderId: string, logId: string) => {
23
- return requestor.makeRequest.delete(`orders/${orderId}/notes/${logId}`).then((r) => r.data);
24
- },
25
- commentsHistory: (orderId: string, limit?: number) => {
26
- return requestor.makeRequest.get(`orders/${orderId}/notes`, { params: { limit } }).then((r) => r.data);
27
- },
28
- paymentHistory: (orderId: string, limit?: number) => {
29
- return requestor.makeRequest.get(`orders/${orderId}/payment/history`, { params: { limit } }).then((r) => r.data);
30
- },
31
- getAvailableStock: (orderId: string, productId: string) => {
32
- return requestor.makeRequest.get(`orders/${orderId}/stock/${productId}/available`).then((r) => r.data);
33
- },
34
- assignStock: (orderId: string, productId: string, stockId: string) => {
35
- return requestor.makeRequest.post(`orders/${orderId}/stock/${productId}/assign/${stockId}`).then((r) => r.data);
36
- },
37
- unassignStock: (orderId: string, productId: string, stockId: string) => {
38
- return requestor.makeRequest.post(`orders/${orderId}/stock/${productId}/unassign/${stockId}`).then((r) => r.data);
39
- },
40
- replaceStock: (orderId: string, productId: string, stockId: string, newStockId: string) => {
41
- return requestor.makeRequest.post(`orders/${orderId}/stock/${productId}/replace/${stockId}/${newStockId}`).then((r) => r.data);
42
- },
43
- convertToDraft: (orderId: string) =>{
44
- return requestor.makeRequest.post(`orders/${orderId}/draft`).then((r) => r.data);
45
- },
46
- convertToUndraft: (orderId: string) =>{
47
- return requestor.makeRequest.post(`orders/${orderId}/undraft`).then((r) => r.data);
48
- },
49
- changeOrderStatus: (orderId: string, request: { newStatus: string, reason?: string }) =>{
50
- return requestor.makeRequest.put(`orders/${orderId}/status`, request).then((r) => r.data);
51
- },
52
- closeOrder: (orderId: string, request: { reason?: string }) =>{
53
- return requestor.makeRequest.post(`orders/${orderId}/close`, request).then((r) => r.data);
54
- },
55
- cancelOrder: (orderId: string, request: { reason?: string }) =>{
56
- return requestor.makeRequest.post(`orders/${orderId}/cancel`, request).then((r) => r.data);
57
- },
58
- approveOrder: (orderId: string) =>{
59
- return requestor.makeRequest.post(`orders/${orderId}/approve`).then((r) => r.data);
60
- },
61
- rejectOrder: (orderId: string) =>{
62
- return requestor.makeRequest.post(`orders/${orderId}/reject`).then((r) => r.data);
63
- },
64
- reevaluateOrderStatus: (orderId: string) =>{
65
- return requestor.makeRequest.post(`orders/${orderId}/reevaluate/status`).then((r) => r.data);
66
- },
67
- getPublic: (orderId: string) => {
68
- return requestor.makeRequest.get(`orders/${orderId}/public`).then((r) => r.data);
69
- },
70
- getReport: (filters: Record<string, unknown>, options: Partial<{ sendEmail: boolean, email?: string; format?: 'csv' | 'xlsx' }> = {}) => {
71
- return requestor.makeRequest.post(`orders/report/request`, { filters, options }).then((r) => r.data);
72
- },
73
- };
74
- };
@@ -1,16 +0,0 @@
1
- import { RequestorOptions } from 'models/Requestor';
2
- import { BackendHook, useBackend } from '../useBackend';
3
-
4
- export const usePaths: BackendHook<
5
- Record<string, string>,
6
- undefined
7
- > = (auth?: RequestorOptions['auth']) => {
8
- const { requestor, ...rest } = useBackend('paths', { auth });
9
- return {
10
- ...rest,
11
- requestor,
12
- getByKey: (key: string) => {
13
- return requestor.makeRequest.get(`paths/${key}`).then(({ data }) => data);
14
- }
15
- };
16
- };
@@ -1,16 +0,0 @@
1
- import { BackendHook, useBackend } from '../useBackend';
2
- import { RequestorOptions } from 'models/Requestor';
3
-
4
- export const usePermissions: BackendHook = (auth?: RequestorOptions['auth']) => {
5
- const { requestor, ...endpoints } = useBackend('permissions', { auth });
6
- return {
7
- requestor,
8
- ...endpoints,
9
- create: (data) =>
10
- requestor.makeRequest.post(`permissions`, data).then(({ data }) => data),
11
- update: (id: any, data: any) =>
12
- requestor.makeRequest.put(`permissions/${id}`, data).then(({ data }) => data),
13
- delete: (id: string) =>
14
- requestor.makeRequest.delete(`permissions/${id}`).then(({ data }) => data),
15
- };
16
- };
@@ -1,18 +0,0 @@
1
- import { BackendHook, useBackend } from '../useBackend';
2
- import { RequestorOptions } from 'models/Requestor';
3
-
4
- export const useProducts: BackendHook = (auth?: RequestorOptions['auth']) => {
5
- const { requestor, ...endpoints } = useBackend('products', { auth });
6
- return {
7
- requestor,
8
- ...endpoints,
9
- create: (data) =>
10
- requestor.makeRequest.post(`products`, data).then(({ data }) => data),
11
- update: (id: any, data: any) =>
12
- requestor.makeRequest.put(`products/${id}`, data).then(({ data }) => data),
13
- delete: (id: string) =>
14
- requestor.makeRequest.delete(`products/${id}`).then(({ data }) => data),
15
- import: (userConnectionId: string, storeId: string | null) =>
16
- requestor.makeRequest.post(`products/import`, { userConnectionId, storeId }).then(({ data }) => data),
17
- };
18
- };
@@ -1,20 +0,0 @@
1
- import { BackendHook, useBackend } from '../useBackend';
2
- import { Chat } from '@wb/types/chats/chats.model';
3
- import { RequestorOptions } from 'models/Requestor';
4
-
5
- export const useProfile: BackendHook<Chat> = (auth?: RequestorOptions['auth']) => {
6
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
7
- const { requestor, ...endpoints } = useBackend('users/profile', { auth });
8
- return {
9
- requestor,
10
- ...endpoints,
11
- updateProfile: (profile: { name: string }) => requestor.makeRequest.put(`users/profile`, profile).then(({ data }) => data),
12
- requestPasswordChange: () => requestor.makeRequest.post(`users/profile/request-password-change`).then(({ data }) => data),
13
- requestEmailChange: () => requestor.makeRequest.post(`users/profile/request-email-change`).then(({ data }) => data),
14
- requestEmailVerification: () => requestor.makeRequest.post(`users/profile/request-email-verification`).then(({ data }) => data),
15
- passwordRecovery: (emailOrUsername: string) => requestor.makeRequest.post(`users/profile/recover-password`, { emailOrUsername }).then(({ data }) => data),
16
- changeEmail: (token: string, newEmail: string) => requestor.makeRequest.post(`users/profile/change-email`, { token, newEmail }).then(({ data }) => data),
17
- changePassword: (token: string, newPassword: string) => requestor.makeRequest.post(`users/profile/change-password`, { token, newPassword }).then(({ data }) => data),
18
- verifyEmail: (token: string) => requestor.makeRequest.post(`users/profile/verify-email`, { token }).then(({ data }) => data),
19
- };
20
- };
@@ -1,57 +0,0 @@
1
- import { RequestorOptions } from 'models/Requestor';
2
- import { BackendHook, useBackend } from '../useBackend';
3
-
4
- type RentingDetails = {
5
- startsAt: string,
6
- endsAt: string,
7
- pickUpStore?: string;
8
- dropOffStore?: string;
9
- }
10
-
11
- type ListAvailableRentingDetails = RentingDetails & {
12
- categories: string[];
13
- }
14
-
15
- type GetBugdetRentingDetails = RentingDetails & {
16
- products: { product: string, variant?: { variant: string, orderedQty?: number }[], orderedQty?: number }[];
17
- }
18
-
19
- type PlaceRentRentingDetails = GetBugdetRentingDetails & {
20
- customer: {
21
- name: string,
22
- email: string
23
- }
24
- }
25
-
26
- export const useRenting: BackendHook<any, any, {
27
- listAvailable: (storeId: string, rentingDetails: ListAvailableRentingDetails) => Promise<RentingDetails>,
28
- getBudget: (storeId: string, rentingDetails: GetBugdetRentingDetails) => Promise<{
29
- price: number;
30
- priceBeforeDiscounts: number;
31
- priceInBase: number;
32
- priceInBaseBeforeDiscounts: number;
33
- endsAt: string;
34
- startsAt: string;
35
- pickUpStore: { store: string, name: Record<string, string> };
36
- dropOffStore: { store: string, name: Record<string, string> };
37
- }>,
38
- rent: (storeId: string, rentingDetails: PlaceRentRentingDetails) => Promise<Record<string, unknown>>
39
- }> = (auth?: RequestorOptions['auth']) => {
40
- const { requestor, ...rest } = useBackend('rentings', { auth });
41
- return {
42
- requestor,
43
- ...rest,
44
- listAvailable: (storeId: string, rentingDetails: ListAvailableRentingDetails) => {
45
- return requestor.makeRequest.post(`rentings/available/${storeId}`, rentingDetails).then(({ data }) => data)
46
- },
47
- getBudget: (storeId: string, rentingDetails: GetBugdetRentingDetails) => {
48
- return requestor.makeRequest.post(`rentings/getPrice/${storeId}`, rentingDetails).then(({ data }) => data)
49
- },
50
- rent: (storeId: string, rentingDetails: PlaceRentRentingDetails) => {
51
- return requestor.makeRequest.post(`rentings/${storeId}`, rentingDetails).then(({ data }) => data)
52
- },
53
- getPublic: (rentingId: string) => {
54
- return requestor.makeRequest.get(`rentings/${rentingId}/public`).then(({ data }) => data);
55
- },
56
- };
57
- };
@@ -1,10 +0,0 @@
1
- import { BackendHook, useBackend } from '../useBackend';
2
- import { RequestorOptions } from 'models/Requestor';
3
-
4
- export const useRoles: BackendHook<Record<string, string>, any> = (auth?: RequestorOptions['auth']) => {
5
- const { requestor, ...rest } = useBackend('roles', { auth });
6
- return {
7
- ...rest,
8
- requestor,
9
- };
10
- };
@@ -1,20 +0,0 @@
1
- import { BackendHook, useBackend } from '../useBackend';
2
- import { Chat } from '@wb/types/chats/chats.model';
3
- import { RequestorOptions } from 'models/Requestor';
4
-
5
- export const useRooms: BackendHook<Chat> = (auth?: RequestorOptions['auth']) => {
6
- const { requestor, ...endpoints } = useBackend('rooms', { auth });
7
- return {
8
- requestor,
9
- ...endpoints,
10
- createRoom: (chatId: string) =>
11
- requestor.makeRequest.post(`rooms/${chatId}`).then(({ data }) => data),
12
- message: (roomId: string, message: any) =>
13
- requestor.makeRequest.post(`rooms/reply/${roomId}`, message).then(({ data }) => data),
14
- reset: (roomId: string) => requestor.makeRequest.post(`rooms/${roomId}/reset`).then(({ data }) => data),
15
- createRoomForUserConnection: (userConnectionId: string, identityId:string) =>
16
- requestor.makeRequest.post(`rooms/${userConnectionId}/${identityId}`).then(({ data }) => data),
17
- comment: (roomId: string, message: any) =>
18
- requestor.makeRequest.post(`rooms/${roomId}/comment`, message).then(({ data }) => data),
19
- };
20
- };
@@ -1,13 +0,0 @@
1
- import { RequestorOptions } from 'models/Requestor';
2
- import { BackendHook, useBackend } from '../useBackend';
3
-
4
- export const useRotations: BackendHook<any, any> = (auth?: RequestorOptions['auth']) => {
5
- const { requestor, ...rest } = useBackend('rotations', { auth });
6
- return {
7
- ...rest,
8
- requestor,
9
- makeDefault: (rotationId: string) => {
10
- return requestor.makeRequest.post(`rotations/${rotationId}/makeDefault`).then(({ data }) => data);
11
- },
12
- };
13
- };
@@ -1,13 +0,0 @@
1
- import { CustomResponse } from '@wb/types/custom-response/custom-response.model';
2
- import { BackendHook, useBackend } from '../useBackend';
3
- import { RequestorOptions } from 'models/Requestor';
4
-
5
- export const useSiteConfig: BackendHook<any, any, { getForSession: () => Promise<CustomResponse> }> = (auth?: RequestorOptions['auth']) => {
6
- // eslint-disable-next-line
7
- const { requestor, ...rest } = useBackend('app-configs', { auth });
8
- return {
9
- requestor,
10
- ...rest,
11
- getForSession: () => requestor.makeRequest.get('app-configs').then(r => r.data)
12
- };
13
- };
@@ -1,10 +0,0 @@
1
- import { RequestorOptions } from 'models/Requestor';
2
- import { BackendHook, useBackend } from '../useBackend';
3
-
4
- export const useStatuses: BackendHook<any, any> = (auth?: RequestorOptions['auth']) => {
5
- const { requestor, ...rest } = useBackend('statuses', { auth });
6
- return {
7
- ...rest,
8
- requestor,
9
- };
10
- };
@@ -1,48 +0,0 @@
1
- import { RequestorOptions } from 'models/Requestor';
2
- import { BackendHook, useBackend } from '../useBackend';
3
- import { IProductStock } from '@wb/types/products/products.model';
4
-
5
- export const useStock: BackendHook<IProductStock, undefined, {
6
- getStatus: (unitId: string) => Promise<IProductStock>;
7
- addNote: (unitId: string, { text, extra }: { text: string; extra?: Record<string, unknown> }) => Promise<IProductStock>;
8
- delete: (unitId: string) => Promise<boolean>;
9
- logHistory: (unitId: string, limit?: number) => Promise<IProductStock>;
10
- commentsHistory: (unitId: string, limit?: number) => Promise<IProductStock>;
11
- changeStockStatus: (unitId: string, request: { newStatus: string, reason?: string }) => Promise<IProductStock>;
12
- reevaluateStockStatus: (unitId: string) => Promise<IProductStock>;
13
- markReceived: (unitId: string, request: { comment?: string }) => Promise<IProductStock>;
14
- }> = (auth?: RequestorOptions['auth']) => {
15
- const { requestor, ...endpoints } = useBackend('products/stock', { auth });
16
-
17
- return {
18
- requestor,
19
- ...endpoints,
20
- delete: (unitId: string) => {
21
- return requestor.makeRequest.delete(`products/stock/${unitId}`).then((r) => r.data);
22
- },
23
- getStatus: (unitId: string) => {
24
- return requestor.makeRequest.get(`products/stock/status/${unitId}`).then((r) => r.data);
25
- },
26
- addNote: (unitId: string, { text, extra }: { text: string; extra?: Record<string, unknown> }) => {
27
- return requestor.makeRequest.post(`products/stock/${unitId}/notes`, { text, extra }).then((r) => r.data);
28
- },
29
- logHistory: (unitId: string, limit?: number) => {
30
- return requestor.makeRequest.get(`products/stock/${unitId}/log/history`, { params: { limit } }).then((r) => r.data);
31
- },
32
- commentsHistory: (unitId: string, limit?: number) => {
33
- return requestor.makeRequest.get(`products/stock/${unitId}/comment/history`, { params: { limit } }).then((r) => r.data);
34
- },
35
- changeStockStatus: (unitId: string, request: { newStatus: string, reason?: string }) =>{
36
- return requestor.makeRequest.put(`products/stock/${unitId}/status`, request).then((r) => r.data);
37
- },
38
- reevaluateStockStatus: (unitId: string) =>{
39
- return requestor.makeRequest.post(`products/stock/${unitId}/reevaluate/status`).then((r) => r.data);
40
- },
41
- markReceived: (unitId: string, request: { comment?: string }) =>{
42
- return requestor.makeRequest.post(`products/stock/${unitId}/mark-received`, request).then((r) => r.data);
43
- },
44
- bulkMarkReceived: (stockIds: string[], request: { comment?: string }) => {
45
- return requestor.makeRequest.put(`products/stock/bulk/mark-received`, { unitIds: stockIds, ...request }).then((r) => r.data);
46
- },
47
- };
48
- };
@@ -1,23 +0,0 @@
1
- import { RequestorOptions } from 'models/Requestor';
2
- import { BackendHook, useBackend } from '../useBackend';
3
- import { IStore } from '@wb/types/store/store.model';
4
-
5
- export const useStores: BackendHook<IStore> = (auth?: RequestorOptions['auth']) => {
6
- const { requestor, ...rest } = useBackend<IStore>('stores', { auth });
7
- return {
8
- ...rest,
9
- requestor,
10
- delete: (id: string) =>
11
- requestor.makeRequest.delete(`stores/${id}`).then(({ data }) => data),
12
- delegate: (id: string, data: { userId: string } | { teamId: string }) =>
13
- requestor.makeRequest.post(`stores/${id}/delegate`, data).then(({ data }) => data),
14
- undelegate: (id: string, reason?: string) =>
15
- requestor.makeRequest.post(`stores/${id}/undelegate`, { reason }).then(({ data }) => data),
16
- inviteToManage: (storeId: string, data: { userEmail: string }) =>
17
- requestor.makeRequest.post(`stores/${storeId}/invite-to-manage`, data).then(({ data }) => data),
18
- acceptManagement: (requestToken: string) =>
19
- requestor.makeRequest.post(`stores/accept-manage`, { requestToken }).then(({ data }) => data),
20
- rejectManagement: (requestToken: string) =>
21
- requestor.makeRequest.post(`stores/reject-manage`, { requestToken }).then(({ data }) => data),
22
- };
23
- };
@@ -1,17 +0,0 @@
1
-
2
- import { BackendHook, useBackend } from '../useBackend';
3
- import { RequestorOptions } from 'models/Requestor';
4
-
5
- export const useSubscriptions: BackendHook<
6
- Record<string, string>,
7
- any
8
- > = (auth?: RequestorOptions['auth']) => {
9
- const { requestor, ...rest } = useBackend('subscriptions', { auth });
10
- return {
11
- ...rest,
12
- requestor,
13
- listPaymentMethods: () => {
14
- return requestor.makeRequest.get(`subscriptions/payment-methods`).then(({ data }) => data);
15
- },
16
- };
17
- };
@@ -1,15 +0,0 @@
1
- import { RequestorOptions } from 'models/Requestor';
2
- import { BackendHook, useBackend } from '../useBackend';
3
- import { IStore } from '@wb/types/store/store.model';
4
-
5
- export const useTables: BackendHook<IStore> = (auth?: RequestorOptions['auth']) => {
6
- const { requestor, ...endpoints } = useBackend('tables', { auth });
7
-
8
- return {
9
- requestor,
10
- ...endpoints,
11
- list: () => {
12
- return requestor.makeRequest.get(`tables/list`).then((r) => r.data);
13
- },
14
- };
15
- };
@@ -1,29 +0,0 @@
1
- import { RequestorOptions } from 'models/Requestor';
2
- import { BackendHook, useBackend } from '../useBackend';
3
-
4
- export const useTeams: BackendHook<
5
- Record<string, string>,
6
- undefined,
7
- {
8
- getTeamInfo: (teamId: string) => Promise<void>;
9
- updateTeamName: (teamId: string, name: string) => Promise<void>;
10
- }
11
- > = (auth?: RequestorOptions['auth']) => {
12
- const { requestor, ...rest } = useBackend('teams', { auth });
13
- return {
14
- ...rest,
15
- requestor,
16
- updateTeamName: (teamId: string, name: string) => {
17
- return requestor.makeRequest.put(`teams/${teamId}`, { name }).then(({ data }) => data);
18
- },
19
- getTeamInfo: (teamId: string) => {
20
- return requestor.makeRequest.get(`teams/${teamId}`).then(({ data }) => data);
21
- },
22
- inviteToTeam: (invitation: { email: string; roles: string[]; store: string[] }) => {
23
- return requestor.makeRequest.post(`teams/invite`, invitation).then(({ data }) => data);
24
- },
25
- subscriptionStatus: () => {
26
- return requestor.makeRequest.get(`teams/subscription-status`).then(({ data }) => data);
27
- },
28
- };
29
- };