@wbsuite/react-hooks 1.0.211 → 1.0.212
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.
- package/README.md +66 -0
- package/docs/USAGE.md +107 -0
- package/eslint.config.js +12 -0
- package/package.json +1 -1
- package/src/hooks/useAgents/index.ts +10 -0
- package/src/hooks/useApps/index.ts +10 -0
- package/src/hooks/useArticles/index.ts +18 -0
- package/src/hooks/useAttributes/index.ts +18 -0
- package/src/hooks/useAttributesGroups/index.ts +17 -0
- package/src/hooks/useAutomations/index.ts +10 -0
- package/src/hooks/useBackend/get.ts +6 -0
- package/src/hooks/useBackend/index.ts +40 -0
- package/src/hooks/useBackend/list.ts +6 -0
- package/src/hooks/useBackend/post.ts +6 -0
- package/src/hooks/useBackend/put.ts +6 -0
- package/src/hooks/useCampaigns/index.ts +11 -0
- package/src/hooks/useCategories/index.ts +7 -0
- package/src/hooks/useChats/index.ts +13 -0
- package/src/hooks/useContactGroups/index.ts +28 -0
- package/src/hooks/useContacts/index.ts +21 -0
- package/src/hooks/useCurrencies/index.ts +14 -0
- package/src/hooks/useCustomers/index.ts +21 -0
- package/src/hooks/useDocuments/index.ts +86 -0
- package/src/hooks/useDomains/index.ts +10 -0
- package/src/hooks/useEmailTemplates/index.ts +13 -0
- package/src/hooks/useEntityStatuses/index.ts +13 -0
- package/src/hooks/useFormSubmissions/index.ts +6 -0
- package/src/hooks/useForms/index.ts +16 -0
- package/src/hooks/useIntegrations/index.ts +15 -0
- package/src/hooks/useInvites/index.ts +19 -0
- package/src/hooks/useLabels/index.ts +13 -0
- package/src/hooks/useLanguages/index.ts +16 -0
- package/src/hooks/useLeads/index.ts +149 -0
- package/src/hooks/useMedia/index.ts +13 -0
- package/src/hooks/useOrders/index.ts +74 -0
- package/src/hooks/usePaths/index.ts +16 -0
- package/src/hooks/usePermissions/index.ts +16 -0
- package/src/hooks/useProducts/index.ts +18 -0
- package/src/hooks/useProfile/index.ts +20 -0
- package/src/hooks/useRenting/index.ts +57 -0
- package/src/hooks/useRoles/index.ts +10 -0
- package/src/hooks/useRoom/index.ts +20 -0
- package/src/hooks/useRotations/index.ts +13 -0
- package/src/hooks/useSiteConfig/index.ts +13 -0
- package/src/hooks/useStatuses/index.ts +10 -0
- package/src/hooks/useStock/index.ts +48 -0
- package/src/hooks/useStores/index.ts +23 -0
- package/src/hooks/useSubscriptions/index.ts +17 -0
- package/src/hooks/useTable/index.ts +15 -0
- package/src/hooks/useTeams/index.ts +29 -0
- package/src/hooks/useTickets/index.ts +17 -0
- package/src/hooks/useTransactions/index.ts +43 -0
- package/src/hooks/useTranslations/index.ts +20 -0
- package/src/hooks/useUserConnections/index.ts +18 -0
- package/src/hooks/useUserSubscriptions/index.ts +28 -0
- package/src/hooks/useUsers/index.ts +57 -0
- package/src/hooks/useWBSuite/index.ts +29 -0
- package/src/hooks/useWebsites/index.ts +34 -0
- package/{esm/index.d.ts → src/index.ts} +2 -1
- package/src/models/Requestor.ts +67 -0
- package/{cjs/next/utils/index.d.ts → src/next/utils/index.ts} +1 -1
- package/src/next/utils/wrapAsync.ts +2 -0
- package/src/utils/authWithApiKey.ts +3 -0
- package/src/utils/authWithToken.ts +3 -0
- package/src/utils/index.ts +7 -0
- package/tsconfig.json +20 -0
- package/cjs/hooks/useAgents/index.d.ts +0 -2
- package/cjs/hooks/useAgents/index.js +0 -32
- package/cjs/hooks/useApps/index.d.ts +0 -2
- package/cjs/hooks/useApps/index.js +0 -32
- package/cjs/hooks/useArticles/index.d.ts +0 -5
- package/cjs/hooks/useArticles/index.js +0 -45
- package/cjs/hooks/useAttributes/index.d.ts +0 -2
- package/cjs/hooks/useAttributes/index.js +0 -52
- package/cjs/hooks/useAttributesGroups/index.d.ts +0 -3
- package/cjs/hooks/useAttributesGroups/index.js +0 -47
- package/cjs/hooks/useAutomations/index.d.ts +0 -2
- package/cjs/hooks/useAutomations/index.js +0 -32
- package/cjs/hooks/useBackend/get.d.ts +0 -2
- package/cjs/hooks/useBackend/get.js +0 -52
- package/cjs/hooks/useBackend/index.d.ts +0 -17
- package/cjs/hooks/useBackend/index.js +0 -22
- package/cjs/hooks/useBackend/list.d.ts +0 -2
- package/cjs/hooks/useBackend/list.js +0 -55
- package/cjs/hooks/useBackend/post.d.ts +0 -2
- package/cjs/hooks/useBackend/post.js +0 -52
- package/cjs/hooks/useBackend/put.d.ts +0 -2
- package/cjs/hooks/useBackend/put.js +0 -52
- package/cjs/hooks/useCampaigns/index.d.ts +0 -2
- package/cjs/hooks/useCampaigns/index.js +0 -35
- package/cjs/hooks/useCategories/index.d.ts +0 -3
- package/cjs/hooks/useCategories/index.js +0 -9
- package/cjs/hooks/useChats/index.d.ts +0 -3
- package/cjs/hooks/useChats/index.js +0 -37
- package/cjs/hooks/useContactGroups/index.d.ts +0 -3
- package/cjs/hooks/useContactGroups/index.js +0 -57
- package/cjs/hooks/useContacts/index.d.ts +0 -3
- package/cjs/hooks/useContacts/index.js +0 -52
- package/cjs/hooks/useCurrencies/index.d.ts +0 -3
- package/cjs/hooks/useCurrencies/index.js +0 -37
- package/cjs/hooks/useCustomers/index.d.ts +0 -3
- package/cjs/hooks/useCustomers/index.js +0 -52
- package/cjs/hooks/useDocuments/index.d.ts +0 -10
- package/cjs/hooks/useDocuments/index.js +0 -145
- package/cjs/hooks/useDomains/index.d.ts +0 -2
- package/cjs/hooks/useDomains/index.js +0 -32
- package/cjs/hooks/useEmailTemplates/index.d.ts +0 -2
- package/cjs/hooks/useEmailTemplates/index.js +0 -37
- package/cjs/hooks/useEntityStatuses/index.d.ts +0 -2
- package/cjs/hooks/useEntityStatuses/index.js +0 -34
- package/cjs/hooks/useForms/index.d.ts +0 -2
- package/cjs/hooks/useForms/index.js +0 -37
- package/cjs/hooks/useIntegrations/index.d.ts +0 -2
- package/cjs/hooks/useIntegrations/index.js +0 -39
- package/cjs/hooks/useInvites/index.d.ts +0 -2
- package/cjs/hooks/useInvites/index.js +0 -47
- package/cjs/hooks/useLabels/index.d.ts +0 -3
- package/cjs/hooks/useLabels/index.js +0 -32
- package/cjs/hooks/useLanguages/index.d.ts +0 -5
- package/cjs/hooks/useLanguages/index.js +0 -39
- package/cjs/hooks/useLeads/index.d.ts +0 -30
- package/cjs/hooks/useLeads/index.js +0 -113
- package/cjs/hooks/useMedia/index.d.ts +0 -2
- package/cjs/hooks/useMedia/index.js +0 -34
- package/cjs/hooks/useOrders/index.d.ts +0 -2
- package/cjs/hooks/useOrders/index.js +0 -76
- package/cjs/hooks/usePaths/index.d.ts +0 -2
- package/cjs/hooks/usePaths/index.js +0 -37
- package/cjs/hooks/usePermissions/index.d.ts +0 -2
- package/cjs/hooks/usePermissions/index.js +0 -47
- package/cjs/hooks/useProducts/index.d.ts +0 -2
- package/cjs/hooks/useProducts/index.js +0 -52
- package/cjs/hooks/useProfile/index.d.ts +0 -3
- package/cjs/hooks/useProfile/index.js +0 -57
- package/cjs/hooks/useRenting/index.d.ts +0 -47
- package/cjs/hooks/useRenting/index.js +0 -52
- package/cjs/hooks/useRoles/index.d.ts +0 -2
- package/cjs/hooks/useRoles/index.js +0 -32
- package/cjs/hooks/useRoom/index.d.ts +0 -3
- package/cjs/hooks/useRoom/index.js +0 -55
- package/cjs/hooks/useRotations/index.d.ts +0 -2
- package/cjs/hooks/useRotations/index.js +0 -37
- package/cjs/hooks/useSiteConfig/index.d.ts +0 -5
- package/cjs/hooks/useSiteConfig/index.js +0 -33
- package/cjs/hooks/useStatuses/index.d.ts +0 -2
- package/cjs/hooks/useStatuses/index.js +0 -32
- package/cjs/hooks/useStock/index.d.ts +0 -20
- package/cjs/hooks/useStock/index.js +0 -51
- package/cjs/hooks/useStores/index.d.ts +0 -3
- package/cjs/hooks/useStores/index.js +0 -62
- package/cjs/hooks/useSubscriptions/index.d.ts +0 -2
- package/cjs/hooks/useSubscriptions/index.js +0 -37
- package/cjs/hooks/useTable/index.d.ts +0 -3
- package/cjs/hooks/useTable/index.js +0 -34
- package/cjs/hooks/useTeams/index.d.ts +0 -5
- package/cjs/hooks/useTeams/index.js +0 -52
- package/cjs/hooks/useTickets/index.d.ts +0 -3
- package/cjs/hooks/useTickets/index.js +0 -47
- package/cjs/hooks/useTransactions/index.d.ts +0 -8
- package/cjs/hooks/useTransactions/index.js +0 -61
- package/cjs/hooks/useTranslations/index.d.ts +0 -5
- package/cjs/hooks/useTranslations/index.js +0 -42
- package/cjs/hooks/useUserConnections/index.d.ts +0 -2
- package/cjs/hooks/useUserConnections/index.js +0 -53
- package/cjs/hooks/useUserSubscriptions/index.d.ts +0 -6
- package/cjs/hooks/useUserSubscriptions/index.js +0 -47
- package/cjs/hooks/useUsers/index.d.ts +0 -17
- package/cjs/hooks/useUsers/index.js +0 -141
- package/cjs/hooks/useWBSuite/index.d.ts +0 -2
- package/cjs/hooks/useWBSuite/index.js +0 -39
- package/cjs/hooks/useWebsites/index.d.ts +0 -2
- package/cjs/hooks/useWebsites/index.js +0 -72
- package/cjs/index.d.ts +0 -50
- package/cjs/index.js +0 -117
- package/cjs/models/Requestor.d.ts +0 -24
- package/cjs/models/Requestor.js +0 -53
- package/cjs/next/utils/index.js +0 -6
- package/cjs/next/utils/wrapAsync.d.ts +0 -1
- package/cjs/next/utils/wrapAsync.js +0 -54
- package/cjs/utils/authWithApiKey.d.ts +0 -4
- package/cjs/utils/authWithApiKey.js +0 -8
- package/cjs/utils/authWithToken.d.ts +0 -4
- package/cjs/utils/authWithToken.js +0 -8
- package/cjs/utils/index.d.ts +0 -11
- package/cjs/utils/index.js +0 -19
- package/esm/hooks/useAgents/index.d.ts +0 -2
- package/esm/hooks/useAgents/index.js +0 -28
- package/esm/hooks/useApps/index.d.ts +0 -2
- package/esm/hooks/useApps/index.js +0 -28
- package/esm/hooks/useArticles/index.d.ts +0 -5
- package/esm/hooks/useArticles/index.js +0 -40
- package/esm/hooks/useAttributes/index.d.ts +0 -2
- package/esm/hooks/useAttributes/index.js +0 -48
- package/esm/hooks/useAttributesGroups/index.d.ts +0 -3
- package/esm/hooks/useAttributesGroups/index.js +0 -43
- package/esm/hooks/useAutomations/index.d.ts +0 -2
- package/esm/hooks/useAutomations/index.js +0 -28
- package/esm/hooks/useBackend/get.d.ts +0 -2
- package/esm/hooks/useBackend/get.js +0 -48
- package/esm/hooks/useBackend/index.d.ts +0 -17
- package/esm/hooks/useBackend/index.js +0 -18
- package/esm/hooks/useBackend/list.d.ts +0 -2
- package/esm/hooks/useBackend/list.js +0 -51
- package/esm/hooks/useBackend/post.d.ts +0 -2
- package/esm/hooks/useBackend/post.js +0 -48
- package/esm/hooks/useBackend/put.d.ts +0 -2
- package/esm/hooks/useBackend/put.js +0 -48
- package/esm/hooks/useCampaigns/index.d.ts +0 -2
- package/esm/hooks/useCampaigns/index.js +0 -31
- package/esm/hooks/useCategories/index.d.ts +0 -3
- package/esm/hooks/useCategories/index.js +0 -5
- package/esm/hooks/useChats/index.d.ts +0 -3
- package/esm/hooks/useChats/index.js +0 -33
- package/esm/hooks/useContactGroups/index.d.ts +0 -3
- package/esm/hooks/useContactGroups/index.js +0 -53
- package/esm/hooks/useContacts/index.d.ts +0 -3
- package/esm/hooks/useContacts/index.js +0 -48
- package/esm/hooks/useCurrencies/index.d.ts +0 -3
- package/esm/hooks/useCurrencies/index.js +0 -33
- package/esm/hooks/useCustomers/index.d.ts +0 -3
- package/esm/hooks/useCustomers/index.js +0 -48
- package/esm/hooks/useDocuments/index.d.ts +0 -10
- package/esm/hooks/useDocuments/index.js +0 -141
- package/esm/hooks/useDomains/index.d.ts +0 -2
- package/esm/hooks/useDomains/index.js +0 -28
- package/esm/hooks/useEmailTemplates/index.d.ts +0 -2
- package/esm/hooks/useEmailTemplates/index.js +0 -33
- package/esm/hooks/useEntityStatuses/index.d.ts +0 -2
- package/esm/hooks/useEntityStatuses/index.js +0 -30
- package/esm/hooks/useForms/index.d.ts +0 -2
- package/esm/hooks/useForms/index.js +0 -33
- package/esm/hooks/useIntegrations/index.d.ts +0 -2
- package/esm/hooks/useIntegrations/index.js +0 -35
- package/esm/hooks/useInvites/index.d.ts +0 -2
- package/esm/hooks/useInvites/index.js +0 -43
- package/esm/hooks/useLabels/index.d.ts +0 -3
- package/esm/hooks/useLabels/index.js +0 -28
- package/esm/hooks/useLanguages/index.d.ts +0 -5
- package/esm/hooks/useLanguages/index.js +0 -35
- package/esm/hooks/useLeads/index.d.ts +0 -30
- package/esm/hooks/useLeads/index.js +0 -109
- package/esm/hooks/useMedia/index.d.ts +0 -2
- package/esm/hooks/useMedia/index.js +0 -30
- package/esm/hooks/useOrders/index.d.ts +0 -2
- package/esm/hooks/useOrders/index.js +0 -72
- package/esm/hooks/usePaths/index.d.ts +0 -2
- package/esm/hooks/usePaths/index.js +0 -33
- package/esm/hooks/usePermissions/index.d.ts +0 -2
- package/esm/hooks/usePermissions/index.js +0 -43
- package/esm/hooks/useProducts/index.d.ts +0 -2
- package/esm/hooks/useProducts/index.js +0 -48
- package/esm/hooks/useProfile/index.d.ts +0 -3
- package/esm/hooks/useProfile/index.js +0 -53
- package/esm/hooks/useRenting/index.d.ts +0 -47
- package/esm/hooks/useRenting/index.js +0 -48
- package/esm/hooks/useRoles/index.d.ts +0 -2
- package/esm/hooks/useRoles/index.js +0 -28
- package/esm/hooks/useRoom/index.d.ts +0 -3
- package/esm/hooks/useRoom/index.js +0 -51
- package/esm/hooks/useRotations/index.d.ts +0 -2
- package/esm/hooks/useRotations/index.js +0 -33
- package/esm/hooks/useSiteConfig/index.d.ts +0 -5
- package/esm/hooks/useSiteConfig/index.js +0 -29
- package/esm/hooks/useStatuses/index.d.ts +0 -2
- package/esm/hooks/useStatuses/index.js +0 -28
- package/esm/hooks/useStock/index.d.ts +0 -20
- package/esm/hooks/useStock/index.js +0 -47
- package/esm/hooks/useStores/index.d.ts +0 -3
- package/esm/hooks/useStores/index.js +0 -58
- package/esm/hooks/useSubscriptions/index.d.ts +0 -2
- package/esm/hooks/useSubscriptions/index.js +0 -33
- package/esm/hooks/useTable/index.d.ts +0 -3
- package/esm/hooks/useTable/index.js +0 -30
- package/esm/hooks/useTeams/index.d.ts +0 -5
- package/esm/hooks/useTeams/index.js +0 -48
- package/esm/hooks/useTickets/index.d.ts +0 -3
- package/esm/hooks/useTickets/index.js +0 -43
- package/esm/hooks/useTransactions/index.d.ts +0 -8
- package/esm/hooks/useTransactions/index.js +0 -57
- package/esm/hooks/useTranslations/index.d.ts +0 -5
- package/esm/hooks/useTranslations/index.js +0 -38
- package/esm/hooks/useUserConnections/index.d.ts +0 -2
- package/esm/hooks/useUserConnections/index.js +0 -49
- package/esm/hooks/useUserSubscriptions/index.d.ts +0 -6
- package/esm/hooks/useUserSubscriptions/index.js +0 -43
- package/esm/hooks/useUsers/index.d.ts +0 -17
- package/esm/hooks/useUsers/index.js +0 -137
- package/esm/hooks/useWBSuite/index.d.ts +0 -2
- package/esm/hooks/useWBSuite/index.js +0 -35
- package/esm/hooks/useWebsites/index.d.ts +0 -2
- package/esm/hooks/useWebsites/index.js +0 -68
- package/esm/index.js +0 -51
- package/esm/models/Requestor.d.ts +0 -24
- package/esm/models/Requestor.js +0 -47
- package/esm/next/utils/index.d.ts +0 -2
- package/esm/next/utils/index.js +0 -3
- package/esm/next/utils/wrapAsync.d.ts +0 -1
- package/esm/next/utils/wrapAsync.js +0 -50
- package/esm/utils/authWithApiKey.d.ts +0 -4
- package/esm/utils/authWithApiKey.js +0 -4
- package/esm/utils/authWithToken.d.ts +0 -4
- package/esm/utils/authWithToken.js +0 -4
- package/esm/utils/index.d.ts +0 -11
- package/esm/utils/index.js +0 -3
|
@@ -0,0 +1,17 @@
|
|
|
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 useTickets: BackendHook<Chat> = (auth?: RequestorOptions['auth']) => {
|
|
6
|
+
const { requestor, ...endpoints } = useBackend('tickets', { auth });
|
|
7
|
+
return {
|
|
8
|
+
requestor,
|
|
9
|
+
...endpoints,
|
|
10
|
+
resolve: (ticketId: string) =>
|
|
11
|
+
requestor.makeRequest.post(`tickets/${ticketId}/resolve`).then(({ data }) => data),
|
|
12
|
+
addComment: (ticketId: string, note: { text: string, extra: Record<string, unknown> }) =>
|
|
13
|
+
requestor.makeRequest.post(`tickets/${ticketId}/comment`, note).then(({ data }) => data),
|
|
14
|
+
commentHistory: (ticketId: string) =>
|
|
15
|
+
requestor.makeRequest.post(`tickets/${ticketId}/comment/history`).then(({ data }) => data),
|
|
16
|
+
};
|
|
17
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
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
|
+
type EntityTypes = 'renting' | 'order';
|
|
6
|
+
|
|
7
|
+
export const useTransactions: BackendHook<
|
|
8
|
+
Record<string, string>,
|
|
9
|
+
any,
|
|
10
|
+
{
|
|
11
|
+
listPaymentMethods: () => Promise<CustomResponse<Record<string, unknown>[]>>;
|
|
12
|
+
getPublicPayment: (
|
|
13
|
+
entity: EntityTypes,
|
|
14
|
+
entityId: string,
|
|
15
|
+
method: string
|
|
16
|
+
) => Promise<CustomResponse<Record<string, unknown>[]>>;
|
|
17
|
+
}
|
|
18
|
+
> = (auth?: RequestorOptions['auth']) => {
|
|
19
|
+
const { requestor, ...rest } = useBackend('transactions', { auth });
|
|
20
|
+
return {
|
|
21
|
+
...rest,
|
|
22
|
+
requestor,
|
|
23
|
+
listPaymentMethods: () => {
|
|
24
|
+
return requestor.makeRequest.get(`transactions/methods`).then(({ data }) => data);
|
|
25
|
+
},
|
|
26
|
+
getPayment: (entity: EntityTypes, entityId: string, method: string, amount?: number) => {
|
|
27
|
+
return requestor.makeRequest
|
|
28
|
+
.post(`transactions/${method}/${entity}/${entityId}`, { amount })
|
|
29
|
+
.then(({ data }) => data);
|
|
30
|
+
},
|
|
31
|
+
getPublicPayment: (entity: EntityTypes, entityId: string, method: string, amount?: number) => {
|
|
32
|
+
return requestor.makeRequest
|
|
33
|
+
.post(`transactions/public/${method}/${entity}/${entityId}`, { amount })
|
|
34
|
+
.then(({ data }) => data);
|
|
35
|
+
},
|
|
36
|
+
cancelPayment: (transactionId: string) => {
|
|
37
|
+
return requestor.makeRequest.post(`transactions/cancel/${transactionId}`).then(({ data }) => data);
|
|
38
|
+
},
|
|
39
|
+
completePayment: (transactionId: string) => {
|
|
40
|
+
return requestor.makeRequest.post(`transactions/complete/${transactionId}`).then(({ data }) => data);
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { RequestorOptions } from 'models/Requestor';
|
|
2
|
+
import { BackendHook, useBackend } from '../useBackend';
|
|
3
|
+
|
|
4
|
+
export const useTranslations: BackendHook<
|
|
5
|
+
Record<string, string>,
|
|
6
|
+
any,
|
|
7
|
+
{ getJson: () => Promise<Record<string, unknown>>; getProductJson: () => Promise<Record<string, unknown>> }
|
|
8
|
+
> = (auth?: RequestorOptions['auth']) => {
|
|
9
|
+
const { requestor, ...rest } = useBackend('translations', { auth });
|
|
10
|
+
return {
|
|
11
|
+
...rest,
|
|
12
|
+
requestor,
|
|
13
|
+
getJson: () => {
|
|
14
|
+
return requestor.makeRequest.get(`translations/getAll`).then(({ data }) => data);
|
|
15
|
+
},
|
|
16
|
+
getProductJson: () => {
|
|
17
|
+
return requestor.makeRequest.get(`translations/product/getAll`).then(({ data }) => data);
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { BackendHook, useBackend } from '../useBackend';
|
|
2
|
+
import { RequestorOptions } from 'models/Requestor';
|
|
3
|
+
|
|
4
|
+
export const useUserConnection: BackendHook = (auth?: RequestorOptions['auth']) => {
|
|
5
|
+
const { requestor, ...endpoints } = useBackend('user-connections', { auth });
|
|
6
|
+
return {
|
|
7
|
+
requestor,
|
|
8
|
+
...endpoints,
|
|
9
|
+
create: (data) =>
|
|
10
|
+
requestor.makeRequest.post(`user-connections`, data).then(({ data }) => data),
|
|
11
|
+
update: (id: any, data: any) =>
|
|
12
|
+
requestor.makeRequest.put(`user-connections/${id}`, data).then(({ data }) => data),
|
|
13
|
+
delete: (id: string) =>
|
|
14
|
+
requestor.makeRequest.delete(`user-connections/${id}`).then(({ data }) => data),
|
|
15
|
+
searchContactExternalId: (searchValue: string, { userConnectionIds }: { userConnectionIds?: string[] }) =>
|
|
16
|
+
requestor.makeRequest.get(`user-connections/search/contact/${searchValue}`, { params: { userConnectionIds } }).then(({ data }) => data),
|
|
17
|
+
};
|
|
18
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
|
|
2
|
+
import { BackendHook, useBackend } from '../useBackend';
|
|
3
|
+
import { RequestorOptions } from 'models/Requestor';
|
|
4
|
+
|
|
5
|
+
export const useUserSubscriptions: BackendHook<
|
|
6
|
+
Record<string, string>,
|
|
7
|
+
any,
|
|
8
|
+
{
|
|
9
|
+
subscribe: (subscriptionId: string, subscriptionDetails: Record<string, unknown>) => Promise<void>;
|
|
10
|
+
requestPayment: (userSubscriptionId: string, data: Record<string, unknown>) => Promise<void>;
|
|
11
|
+
cancel: (userSubscriptionId: string) => Promise<void>;
|
|
12
|
+
}
|
|
13
|
+
> = (auth?: RequestorOptions['auth']) => {
|
|
14
|
+
const { requestor, ...rest } = useBackend('user-subscriptions', { auth });
|
|
15
|
+
return {
|
|
16
|
+
...rest,
|
|
17
|
+
requestor,
|
|
18
|
+
subscribe: (subscriptionId: string, subscriptionDetails: Record<string, unknown>) => {
|
|
19
|
+
return requestor.makeRequest.post(`user-subscriptions/${subscriptionId}`, subscriptionDetails).then(({ data }) => data);
|
|
20
|
+
},
|
|
21
|
+
requestPayment: (userSubscriptionId: string, data: Record<string, unknown>) => {
|
|
22
|
+
return requestor.makeRequest.post(`user-subscriptions/payment/request/${userSubscriptionId}`, data).then(({ data }) => data);
|
|
23
|
+
},
|
|
24
|
+
cancel: (userSubscriptionId: string) => {
|
|
25
|
+
return requestor.makeRequest.post(`user-subscriptions/${userSubscriptionId}/cancel`).then(({ data }) => data);
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { BackendHook, useBackend } from '../useBackend';
|
|
2
|
+
import { CustomResponse } from '@wb/types/custom-response/custom-response.model';
|
|
3
|
+
import { RequestorOptions } from 'models/Requestor';
|
|
4
|
+
|
|
5
|
+
type LoginResponse = CustomResponse<{ user: unknown; token: { access_token: string; expires_in: number; token_type: string } }>;
|
|
6
|
+
type LoginFunction = (
|
|
7
|
+
username: string,
|
|
8
|
+
password: string
|
|
9
|
+
) => Promise<LoginResponse>;
|
|
10
|
+
|
|
11
|
+
export const useUsers: BackendHook<
|
|
12
|
+
any,
|
|
13
|
+
any,
|
|
14
|
+
{
|
|
15
|
+
login: LoginFunction;
|
|
16
|
+
getSession: () => Promise<LoginResponse>
|
|
17
|
+
restartSession: (token: string) => Promise<LoginResponse> | Promise<CustomResponse>
|
|
18
|
+
}
|
|
19
|
+
> = (auth?: RequestorOptions['auth']) => {
|
|
20
|
+
const { requestor, ...endpoints } = useBackend('users', { auth });
|
|
21
|
+
return {
|
|
22
|
+
...endpoints,
|
|
23
|
+
requestor,
|
|
24
|
+
login: async (username: string, password: string) => {
|
|
25
|
+
const { data: response } = await requestor.makeRequest.post<LoginResponse>('users/login', { username, password });
|
|
26
|
+
return response;
|
|
27
|
+
},
|
|
28
|
+
getSession: async () => {
|
|
29
|
+
const { data: response } = await requestor.makeRequest.get<LoginResponse>('users/login');
|
|
30
|
+
return response;
|
|
31
|
+
},
|
|
32
|
+
restartSession: async () => {
|
|
33
|
+
try {
|
|
34
|
+
const { data: response } = await requestor.makeRequest.get<LoginResponse>('users/login')
|
|
35
|
+
return response;
|
|
36
|
+
} catch(err) {
|
|
37
|
+
return { success: false, data: null };
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
getPermissions: async () => {
|
|
41
|
+
return requestor.makeRequest.get<LoginResponse>('users/permissions').then(({ data }) => data);
|
|
42
|
+
},
|
|
43
|
+
getUserSummary: async (userId: string) => {
|
|
44
|
+
const { data: response } = await requestor.makeRequest.get<LoginResponse>(`users/${userId}/profile`).then(({ data }) => data);
|
|
45
|
+
return response;
|
|
46
|
+
},
|
|
47
|
+
logout: async () => {
|
|
48
|
+
return requestor.makeRequest.post<LoginResponse>('users/logout').then(({ data }) => data);
|
|
49
|
+
},
|
|
50
|
+
updateStore: (userId: string, stores: string[]) => {
|
|
51
|
+
return requestor.makeRequest.put(`users/${userId}/stores`, { stores }).then(({ data }) => data);
|
|
52
|
+
},
|
|
53
|
+
updateRoles: (userId: string, roles: string[]) => {
|
|
54
|
+
return requestor.makeRequest.put(`users/${userId}/roles`, { roles }).then(({ data }) => data);
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { WBBackendConfig } from '@wb/types/backendConfig/backendConfig';
|
|
2
|
+
|
|
3
|
+
const process = (globalThis as any).process || {};
|
|
4
|
+
|
|
5
|
+
const DEFAULTS = {
|
|
6
|
+
apiURL: process?.env?.WB_API_URL || 'https://api.wbsuite.app/api/v2',
|
|
7
|
+
publicURL: process?.env?.WB_PUBLIC_URL || 'https://api.wbsuite.app/public',
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
(globalThis as any).WBSUITE_CONFIG;
|
|
11
|
+
(globalThis as any).initialized = false;
|
|
12
|
+
|
|
13
|
+
export const useWBSuite = (wbsuiteConfiguration: Partial<WBBackendConfig> = {}) => {
|
|
14
|
+
if (!(globalThis as any).initialized) {
|
|
15
|
+
(globalThis as any).initialized = true;
|
|
16
|
+
(globalThis as any).WBSUITE_CONFIG = {
|
|
17
|
+
...DEFAULTS,
|
|
18
|
+
...Object.fromEntries(
|
|
19
|
+
Object.entries({
|
|
20
|
+
...wbsuiteConfiguration,
|
|
21
|
+
}).filter(([, value]) => value !== undefined && value !== null)
|
|
22
|
+
),
|
|
23
|
+
};
|
|
24
|
+
return true;
|
|
25
|
+
} else {
|
|
26
|
+
console.warn('Configuration skipped since it was already configured');
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { RequestorOptions } from 'models/Requestor';
|
|
2
|
+
import { BackendHook, useBackend } from '../useBackend';
|
|
3
|
+
|
|
4
|
+
export const useWebsites: BackendHook<Record<string, string>, any> = (auth?: RequestorOptions['auth']) => {
|
|
5
|
+
const { requestor, ...rest } = useBackend('websites', { auth });
|
|
6
|
+
return {
|
|
7
|
+
...rest,
|
|
8
|
+
requestor,
|
|
9
|
+
getProductSiteById: (siteId: string) => {
|
|
10
|
+
return requestor.makeRequest.get(`websites/product/${siteId}`).then(({ data }) => data);
|
|
11
|
+
},
|
|
12
|
+
getPublicById: (siteId: string) => {
|
|
13
|
+
return requestor.makeRequest.get(`websites/${siteId}/public`).then(({ data }) => data);
|
|
14
|
+
},
|
|
15
|
+
resetApiKey: (siteId: string) => {
|
|
16
|
+
return requestor.makeRequest.put(`websites/${siteId}/apiKey`).then(({ data }) => data);
|
|
17
|
+
},
|
|
18
|
+
expireApiKey: (siteId: string) => {
|
|
19
|
+
return requestor.makeRequest.delete(`websites/${siteId}/apiKey`).then(({ data }) => data);
|
|
20
|
+
},
|
|
21
|
+
getIntegrationDetails: (siteId: string) => {
|
|
22
|
+
return requestor.makeRequest.get(`websites/${siteId}/integrate`).then(({ data }) => data);
|
|
23
|
+
},
|
|
24
|
+
addDomain: (siteId: string, origin: string) => {
|
|
25
|
+
return requestor.makeRequest.post(`websites/${siteId}/domain`, { origin }).then(({ data }) => data);
|
|
26
|
+
},
|
|
27
|
+
removeDomain: (siteId: string) => {
|
|
28
|
+
return requestor.makeRequest.delete(`websites/${siteId}/domain`).then(({ data }) => data);
|
|
29
|
+
},
|
|
30
|
+
duplicateSite: (siteId: string, overrides: { name?: string; description?: string }) => {
|
|
31
|
+
return requestor.makeRequest.post(`websites/${siteId}/duplicate`, overrides).then(({ data }) => data);
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
};
|
|
@@ -39,6 +39,7 @@ export { useUserConnection } from './hooks/useUserConnections';
|
|
|
39
39
|
export { useIntegrations } from './hooks/useIntegrations';
|
|
40
40
|
export { useContacts } from './hooks/useContacts';
|
|
41
41
|
export { useForms } from './hooks/useForms';
|
|
42
|
+
export { useFormSubmissions } from './hooks/useFormSubmissions';
|
|
42
43
|
export { usePaths } from './hooks/usePaths';
|
|
43
44
|
export { useUserSubscriptions } from './hooks/useUserSubscriptions';
|
|
44
45
|
export { useSubscriptions } from './hooks/useSubscriptions';
|
|
@@ -47,4 +48,4 @@ export { useLabels } from './hooks/useLabels';
|
|
|
47
48
|
export { useAgents } from './hooks/useAgents';
|
|
48
49
|
export { useAutomations } from './hooks/useAutomations';
|
|
49
50
|
export { useTickets } from './hooks/useTickets';
|
|
50
|
-
export { useApps } from './hooks/useApps';
|
|
51
|
+
export { useApps } from './hooks/useApps';
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { WBBackendConfig } from '@wb/types/backendConfig/backendConfig';
|
|
2
|
+
import axios, { AxiosInstance, AxiosResponse, InternalAxiosRequestConfig } from 'axios';
|
|
3
|
+
import { useWBSuite } from '../hooks/useWBSuite';
|
|
4
|
+
|
|
5
|
+
type Validator = (isCreate: boolean, body: any) => boolean;
|
|
6
|
+
|
|
7
|
+
export type RequestorOptions = {
|
|
8
|
+
auth:
|
|
9
|
+
| { type: 'token' | 'apiKey' } & (
|
|
10
|
+
| { type: 'token'; token: string }
|
|
11
|
+
| { type: 'apiKey'; apiKey: string }
|
|
12
|
+
);
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export class Requestor {
|
|
16
|
+
makeRequest: AxiosInstance;
|
|
17
|
+
validateWith?: Validator;
|
|
18
|
+
|
|
19
|
+
constructor(
|
|
20
|
+
config: Partial<WBBackendConfig>,
|
|
21
|
+
validator?: Validator,
|
|
22
|
+
opts: Partial<RequestorOptions> = {}
|
|
23
|
+
) {
|
|
24
|
+
if (!config) {
|
|
25
|
+
useWBSuite();
|
|
26
|
+
}
|
|
27
|
+
this.makeRequest = axios.create({ baseURL: config?.apiURL ?? (globalThis as any).WBSUITE_CONFIG?.apiURL });
|
|
28
|
+
this.validateWith = validator;
|
|
29
|
+
this.makeRequest.interceptors.request.use((requestConfig: InternalAxiosRequestConfig) => {
|
|
30
|
+
if ((opts.auth?.type === 'apiKey' && opts.auth.apiKey) || config?.apiKey) {
|
|
31
|
+
requestConfig.headers['x-api-key'] = (opts.auth?.type === 'apiKey' && opts.auth.apiKey) || config?.apiKey;
|
|
32
|
+
}
|
|
33
|
+
if (opts.auth?.type === 'token' && opts.auth.token) {
|
|
34
|
+
delete requestConfig.headers['x-api-key'];
|
|
35
|
+
requestConfig.headers.Authorization = `Bearer ${opts.auth?.type === 'token' && opts.auth.token}`;
|
|
36
|
+
}
|
|
37
|
+
return requestConfig;
|
|
38
|
+
});
|
|
39
|
+
if (config?.environment === 'development') {
|
|
40
|
+
this.makeRequest.interceptors.response.use(
|
|
41
|
+
(response: AxiosResponse) => {
|
|
42
|
+
console.log(
|
|
43
|
+
`${new Date().toISOString()} [INFO] --- ${response.request.host} ${response.status} ${JSON.stringify(
|
|
44
|
+
response.data
|
|
45
|
+
)}`
|
|
46
|
+
);
|
|
47
|
+
return response;
|
|
48
|
+
},
|
|
49
|
+
(response: AxiosResponse) => {
|
|
50
|
+
console.error(
|
|
51
|
+
`${new Date().toISOString()} [ERROR] --- ${response.request.host} ${response.status} ${JSON.stringify(
|
|
52
|
+
response.data
|
|
53
|
+
)}`
|
|
54
|
+
);
|
|
55
|
+
return Promise.reject(response);
|
|
56
|
+
}
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
public get validate() {
|
|
62
|
+
return {
|
|
63
|
+
create: (body: any) => this.validateWith?.(true, body) ?? true,
|
|
64
|
+
edit: (body: any) => this.validateWith?.(false, body) ?? true,
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { wrapAsync } from "./wrapAsync";
|
|
2
|
-
export { wrapAsync };
|
|
2
|
+
export { wrapAsync };
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"module": "esnext",
|
|
4
|
+
"moduleResolution": "node" /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */,
|
|
5
|
+
"lib": ["es6", "dom", "es2016", "es2017", "es2020"],
|
|
6
|
+
"target": "es5",
|
|
7
|
+
"outDir": "./dist/react-hooks/esm" /* Redirect output structure to the directory. */,
|
|
8
|
+
"baseUrl": "./src" /* Base directory to resolve non-absolute module names. */,
|
|
9
|
+
"declaration": true /* Concatenate and emit output to single file. */,
|
|
10
|
+
"strict": true /* Enable all strict type-checking options. */,
|
|
11
|
+
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */,
|
|
12
|
+
"inlineSourceMap": true /* Emit a single file with source maps instead of having a separate file. */,
|
|
13
|
+
"inlineSources": true /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */,
|
|
14
|
+
"skipLibCheck": true /* Skip type checking of declaration files. */,
|
|
15
|
+
"forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */,
|
|
16
|
+
"allowSyntheticDefaultImports": true
|
|
17
|
+
},
|
|
18
|
+
"include": ["src/**/*.ts", "eslint.config.js"],
|
|
19
|
+
"exclude": ["node_modules", "dist"]
|
|
20
|
+
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
14
|
-
var t = {};
|
|
15
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
16
|
-
t[p] = s[p];
|
|
17
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
18
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
19
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
20
|
-
t[p[i]] = s[p[i]];
|
|
21
|
-
}
|
|
22
|
-
return t;
|
|
23
|
-
};
|
|
24
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
exports.useAgents = void 0;
|
|
26
|
-
var useBackend_1 = require("../useBackend");
|
|
27
|
-
var useAgents = function (auth) {
|
|
28
|
-
var _a = (0, useBackend_1.useBackend)('agents', { auth: auth }), requestor = _a.requestor, rest = __rest(_a, ["requestor"]);
|
|
29
|
-
return __assign(__assign({}, rest), { requestor: requestor });
|
|
30
|
-
};
|
|
31
|
-
exports.useAgents = useAgents;
|
|
32
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi9zcmMvaG9va3MvdXNlQWdlbnRzL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7QUFDQSw0Q0FBd0Q7QUFFakQsSUFBTSxTQUFTLEdBQWdDLFVBQUMsSUFBK0I7SUFDcEYsSUFBTSxLQUF5QixJQUFBLHVCQUFVLEVBQUMsUUFBUSxFQUFFLEVBQUUsSUFBSSxNQUFBLEVBQUUsQ0FBQyxFQUFyRCxTQUFTLGVBQUEsRUFBSyxJQUFJLGNBQXBCLGFBQXNCLENBQWlDLENBQUM7SUFDOUQsNkJBQ0ssSUFBSSxLQUNQLFNBQVMsV0FBQSxJQUNUO0FBQ0osQ0FBQyxDQUFDO0FBTlcsUUFBQSxTQUFTLGFBTXBCIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgUmVxdWVzdG9yT3B0aW9ucyB9IGZyb20gJ21vZGVscy9SZXF1ZXN0b3InO1xuaW1wb3J0IHsgQmFja2VuZEhvb2ssIHVzZUJhY2tlbmQgfSBmcm9tICcuLi91c2VCYWNrZW5kJztcblxuZXhwb3J0IGNvbnN0IHVzZUFnZW50czogQmFja2VuZEhvb2s8YW55LCB1bmRlZmluZWQ+ID0gKGF1dGg/OiBSZXF1ZXN0b3JPcHRpb25zWydhdXRoJ10pID0+IHtcbiAgY29uc3QgeyByZXF1ZXN0b3IsIC4uLnJlc3QgfSA9IHVzZUJhY2tlbmQoJ2FnZW50cycsIHsgYXV0aCB9KTtcbiAgcmV0dXJuIHtcbiAgICAuLi5yZXN0LFxuICAgIHJlcXVlc3RvcixcbiAgfTtcbn07XG4iXX0=
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
14
|
-
var t = {};
|
|
15
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
16
|
-
t[p] = s[p];
|
|
17
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
18
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
19
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
20
|
-
t[p[i]] = s[p[i]];
|
|
21
|
-
}
|
|
22
|
-
return t;
|
|
23
|
-
};
|
|
24
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
exports.useApps = void 0;
|
|
26
|
-
var useBackend_1 = require("../useBackend");
|
|
27
|
-
var useApps = function (auth) {
|
|
28
|
-
var _a = (0, useBackend_1.useBackend)('apps', { auth: auth }), requestor = _a.requestor, rest = __rest(_a, ["requestor"]);
|
|
29
|
-
return __assign(__assign({}, rest), { requestor: requestor });
|
|
30
|
-
};
|
|
31
|
-
exports.useApps = useApps;
|
|
32
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi9zcmMvaG9va3MvdXNlQXBwcy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7O0FBQ0EsNENBQXdEO0FBRWpELElBQU0sT0FBTyxHQUFnQyxVQUFDLElBQStCO0lBQ2xGLElBQU0sS0FBeUIsSUFBQSx1QkFBVSxFQUFDLE1BQU0sRUFBRSxFQUFFLElBQUksTUFBQSxFQUFFLENBQUMsRUFBbkQsU0FBUyxlQUFBLEVBQUssSUFBSSxjQUFwQixhQUFzQixDQUErQixDQUFDO0lBQzVELDZCQUNLLElBQUksS0FDUCxTQUFTLFdBQUEsSUFDVDtBQUNKLENBQUMsQ0FBQztBQU5XLFFBQUEsT0FBTyxXQU1sQiIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IFJlcXVlc3Rvck9wdGlvbnMgfSBmcm9tICdtb2RlbHMvUmVxdWVzdG9yJztcbmltcG9ydCB7IEJhY2tlbmRIb29rLCB1c2VCYWNrZW5kIH0gZnJvbSAnLi4vdXNlQmFja2VuZCc7XG5cbmV4cG9ydCBjb25zdCB1c2VBcHBzOiBCYWNrZW5kSG9vazxhbnksIHVuZGVmaW5lZD4gPSAoYXV0aD86IFJlcXVlc3Rvck9wdGlvbnNbJ2F1dGgnXSkgPT4ge1xuICBjb25zdCB7IHJlcXVlc3RvciwgLi4ucmVzdCB9ID0gdXNlQmFja2VuZCgnYXBwcycsIHsgYXV0aCB9KTtcbiAgcmV0dXJuIHtcbiAgICAuLi5yZXN0LFxuICAgIHJlcXVlc3RvcixcbiAgfTtcbn07XG4iXX0=
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
14
|
-
var t = {};
|
|
15
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
16
|
-
t[p] = s[p];
|
|
17
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
18
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
19
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
20
|
-
t[p[i]] = s[p[i]];
|
|
21
|
-
}
|
|
22
|
-
return t;
|
|
23
|
-
};
|
|
24
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
exports.useArticles = exports.deserialize = void 0;
|
|
26
|
-
var html_1 = require("@slate-serializers/html");
|
|
27
|
-
var useBackend_1 = require("../useBackend");
|
|
28
|
-
var deserialize = function (content) {
|
|
29
|
-
try {
|
|
30
|
-
var deserializedContent = JSON.parse(content);
|
|
31
|
-
if (Array.isArray(deserializedContent))
|
|
32
|
-
return (0, html_1.slateToHtml)(deserializedContent);
|
|
33
|
-
return deserializedContent;
|
|
34
|
-
}
|
|
35
|
-
catch (e) {
|
|
36
|
-
return content;
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
exports.deserialize = deserialize;
|
|
40
|
-
var useArticles = function (auth) {
|
|
41
|
-
var endpoints = __rest((0, useBackend_1.useBackend)('articles', { auth: auth }), []);
|
|
42
|
-
return __assign(__assign({}, endpoints), { deserialize: exports.deserialize });
|
|
43
|
-
};
|
|
44
|
-
exports.useArticles = useArticles;
|
|
45
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi9zcmMvaG9va3MvdXNlQXJ0aWNsZXMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OztBQUFBLGdEQUFzRDtBQUN0RCw0Q0FBd0Q7QUFHakQsSUFBTSxXQUFXLEdBQUcsVUFBQyxPQUFlO0lBQ3pDLElBQUksQ0FBQztRQUNILElBQU0sbUJ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pYWxpemVkQ29udGVudCkpIHJldHVybiBzbGF0ZVRvSHRtbChkZXNlcmlhbGl6ZWRDb250ZW50KTtcbiAgICByZXR1cm4gZGVzZXJpYWxpemVkQ29udGVudDtcbiAgfSBjYXRjaCAoZSkge1xuICAgIHJldHVybiBjb250ZW50O1xuICB9XG59XG5cbmV4cG9ydCBjb25zdCB1c2VBcnRpY2xlczogQmFja2VuZEhvb2s8YW55LCBhbnksIHsgZGVzZXJpYWxpemU6IChjb250ZW50OiBzdHJpbmcpID0+IHN0cmluZyB9PiAgPSAoYXV0aD86IFJlcXVlc3Rvck9wdGlvbnNbJ2F1dGgnXSkgPT4ge1xuICBjb25zdCB7IC4uLmVuZHBvaW50cyB9ID0gdXNlQmFja2VuZCgnYXJ0aWNsZXMnLCB7IGF1dGggfSk7XG4gIHJldHVybiB7IC4uLmVuZHBvaW50cywgZGVzZXJpYWxpemUgfTtcbn07XG4iXX0=
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
14
|
-
var t = {};
|
|
15
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
16
|
-
t[p] = s[p];
|
|
17
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
18
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
19
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
20
|
-
t[p[i]] = s[p[i]];
|
|
21
|
-
}
|
|
22
|
-
return t;
|
|
23
|
-
};
|
|
24
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
exports.useAttributes = void 0;
|
|
26
|
-
var useBackend_1 = require("../useBackend");
|
|
27
|
-
var useAttributes = function (auth) {
|
|
28
|
-
var _a = (0, useBackend_1.useBackend)('attributes', { auth: auth }), requestor = _a.requestor, endpoints = __rest(_a, ["requestor"]);
|
|
29
|
-
return __assign(__assign({ requestor: requestor }, endpoints), { create: function (data) {
|
|
30
|
-
return requestor.makeRequest.post("attributes", data).then(function (_a) {
|
|
31
|
-
var data = _a.data;
|
|
32
|
-
return data;
|
|
33
|
-
});
|
|
34
|
-
}, update: function (id, data) {
|
|
35
|
-
return requestor.makeRequest.put("attributes/".concat(id), data).then(function (_a) {
|
|
36
|
-
var data = _a.data;
|
|
37
|
-
return data;
|
|
38
|
-
});
|
|
39
|
-
}, delete: function (id) {
|
|
40
|
-
return requestor.makeRequest.delete("attributes/".concat(id)).then(function (_a) {
|
|
41
|
-
var data = _a.data;
|
|
42
|
-
return data;
|
|
43
|
-
});
|
|
44
|
-
}, getGrouped: function () {
|
|
45
|
-
return requestor.makeRequest.get("attributes/grouped").then(function (_a) {
|
|
46
|
-
var data = _a.data;
|
|
47
|
-
return data;
|
|
48
|
-
});
|
|
49
|
-
} });
|
|
50
|
-
};
|
|
51
|
-
exports.useAttributes = useAttributes;
|
|
52
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi9zcmMvaG9va3MvdXNlQXR0cmlidXRlcy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7O0FBQUEsNENBQXdEO0FBR2pELElBQU0sY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XRHcm91cGVkOiAoKSA9PlxuICAgICAgcmVxdWVzdG9yLm1ha2VSZXF1ZXN0LmdldChgYXR0cmlidXRlcy9ncm91cGVkYCkudGhlbigoeyBkYXRhIH0pID0+IGRhdGEpLFxuICB9O1xufTtcbiJdfQ==
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
14
|
-
var t = {};
|
|
15
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
16
|
-
t[p] = s[p];
|
|
17
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
18
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
19
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
20
|
-
t[p[i]] = s[p[i]];
|
|
21
|
-
}
|
|
22
|
-
return t;
|
|
23
|
-
};
|
|
24
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
exports.useAttributesGroups = void 0;
|
|
26
|
-
var useBackend_1 = require("../useBackend");
|
|
27
|
-
var useAttributesGroups = function (auth) {
|
|
28
|
-
var _a = (0, useBackend_1.useBackend)('attribute/groups', { auth: auth }), requestor = _a.requestor, endpoints = __rest(_a, ["requestor"]);
|
|
29
|
-
return __assign(__assign({ requestor: requestor }, endpoints), { create: function (data) {
|
|
30
|
-
return requestor.makeRequest.post("attribute/groups", data).then(function (_a) {
|
|
31
|
-
var data = _a.data;
|
|
32
|
-
return data;
|
|
33
|
-
});
|
|
34
|
-
}, update: function (id, data) {
|
|
35
|
-
return requestor.makeRequest.put("attribute/groups/".concat(id), data).then(function (_a) {
|
|
36
|
-
var data = _a.data;
|
|
37
|
-
return data;
|
|
38
|
-
});
|
|
39
|
-
}, delete: function (id) {
|
|
40
|
-
return requestor.makeRequest.delete("attribute/groups/".concat(id)).then(function (_a) {
|
|
41
|
-
var data = _a.data;
|
|
42
|
-
return data;
|
|
43
|
-
});
|
|
44
|
-
} });
|
|
45
|
-
};
|
|
46
|
-
exports.useAttributesGroups = useAttributesGroups;
|
|
47
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi9zcmMvaG9va3MvdXNlQXR0cmlidXRlc0dyb3Vwcy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7O0FBQUEsNENBQXdEO0FBSWpELElBQU0sbUJBQW1CLEdBQWlDLFVBQUMsSUFBK0I7SUFDL0YsSUFBTSxLQUE4QixJQUFBLHVCQUFVLEVBQUMsa0JBQWtCLEVBQUUsRUFBRSxJQUFJLE1BQUEsRUFBRSxDQUFDLEVBQXBFLFNBQVMsZUFBQSxFQUFLLFNBQVMsY0FBekIsYUFBMkIsQ0FBMkMsQ0FBQztJQUM3RSwyQkFDRSxTQUFTLFdBQUEsSUFDTixTQUFTLEtBQ1osTUFBTSxFQUFFLFVBQUMsSUFBSTtZQUNYLE9BQUEsU0FBUyxDQUFDLFdBQVcsQ0FBQyxJQUFJLENBQUMsa0JBQWtCLEVBQUUsSUFBSSxDQUFDLENBQUMsSUFBSSxDQUFDLFVBQUMsRUFBUTtvQkFBTixJQUFJLFVBQUE7Z0JBQU8sT0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