@makana-cl/portal-internal-client 1.2.3
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 +404 -0
- package/dist/client/apollo-client.d.ts +25 -0
- package/dist/client/apollo-client.d.ts.map +1 -0
- package/dist/client/apollo-client.js +93 -0
- package/dist/client/apollo-client.js.map +1 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.esm.js/client/apollo-client.d.ts +25 -0
- package/dist/index.esm.js/client/apollo-client.d.ts.map +1 -0
- package/dist/index.esm.js/client/apollo-client.js +90 -0
- package/dist/index.esm.js/client/apollo-client.js.map +1 -0
- package/dist/index.esm.js/index.d.ts +22 -0
- package/dist/index.esm.js/index.d.ts.map +1 -0
- package/dist/index.esm.js/index.esm.js.tmp/client/apollo-client.d.ts +25 -0
- package/dist/index.esm.js/index.esm.js.tmp/client/apollo-client.d.ts.map +1 -0
- package/dist/index.esm.js/index.esm.js.tmp/client/apollo-client.js +90 -0
- package/dist/index.esm.js/index.esm.js.tmp/client/apollo-client.js.map +1 -0
- package/dist/index.esm.js/index.esm.js.tmp/index.d.ts +22 -0
- package/dist/index.esm.js/index.esm.js.tmp/index.d.ts.map +1 -0
- package/dist/index.esm.js/index.esm.js.tmp/index.js +21 -0
- package/dist/index.esm.js/index.esm.js.tmp/index.js.map +1 -0
- package/dist/index.esm.js/index.esm.js.tmp/queries/businesses.d.ts +37 -0
- package/dist/index.esm.js/index.esm.js.tmp/queries/businesses.d.ts.map +1 -0
- package/dist/index.esm.js/index.esm.js.tmp/queries/businesses.js +82 -0
- package/dist/index.esm.js/index.esm.js.tmp/queries/businesses.js.map +1 -0
- package/dist/index.esm.js/index.esm.js.tmp/queries/index.d.ts +5 -0
- package/dist/index.esm.js/index.esm.js.tmp/queries/index.d.ts.map +1 -0
- package/dist/index.esm.js/index.esm.js.tmp/queries/index.js +5 -0
- package/dist/index.esm.js/index.esm.js.tmp/queries/index.js.map +1 -0
- package/dist/index.esm.js/index.esm.js.tmp/queries/searchBusinesses.d.ts +64 -0
- package/dist/index.esm.js/index.esm.js.tmp/queries/searchBusinesses.d.ts.map +1 -0
- package/dist/index.esm.js/index.esm.js.tmp/queries/searchBusinesses.js +97 -0
- package/dist/index.esm.js/index.esm.js.tmp/queries/searchBusinesses.js.map +1 -0
- package/dist/index.esm.js/index.esm.js.tmp/queries/users.d.ts +51 -0
- package/dist/index.esm.js/index.esm.js.tmp/queries/users.d.ts.map +1 -0
- package/dist/index.esm.js/index.esm.js.tmp/queries/users.js +138 -0
- package/dist/index.esm.js/index.esm.js.tmp/queries/users.js.map +1 -0
- package/dist/index.esm.js/index.esm.js.tmp/queries/usersLight.d.ts +63 -0
- package/dist/index.esm.js/index.esm.js.tmp/queries/usersLight.d.ts.map +1 -0
- package/dist/index.esm.js/index.esm.js.tmp/queries/usersLight.js +90 -0
- package/dist/index.esm.js/index.esm.js.tmp/queries/usersLight.js.map +1 -0
- package/dist/index.esm.js/index.esm.js.tmp/types/business.d.ts +20 -0
- package/dist/index.esm.js/index.esm.js.tmp/types/business.d.ts.map +1 -0
- package/dist/index.esm.js/index.esm.js.tmp/types/business.js +2 -0
- package/dist/index.esm.js/index.esm.js.tmp/types/business.js.map +1 -0
- package/dist/index.esm.js/index.esm.js.tmp/types/common.d.ts +45 -0
- package/dist/index.esm.js/index.esm.js.tmp/types/common.d.ts.map +1 -0
- package/dist/index.esm.js/index.esm.js.tmp/types/common.js +2 -0
- package/dist/index.esm.js/index.esm.js.tmp/types/common.js.map +1 -0
- package/dist/index.esm.js/index.esm.js.tmp/types/department.d.ts +6 -0
- package/dist/index.esm.js/index.esm.js.tmp/types/department.d.ts.map +1 -0
- package/dist/index.esm.js/index.esm.js.tmp/types/department.js +2 -0
- package/dist/index.esm.js/index.esm.js.tmp/types/department.js.map +1 -0
- package/dist/index.esm.js/index.esm.js.tmp/types/group.d.ts +9 -0
- package/dist/index.esm.js/index.esm.js.tmp/types/group.d.ts.map +1 -0
- package/dist/index.esm.js/index.esm.js.tmp/types/group.js +2 -0
- package/dist/index.esm.js/index.esm.js.tmp/types/group.js.map +1 -0
- package/dist/index.esm.js/index.esm.js.tmp/types/index.d.ts +6 -0
- package/dist/index.esm.js/index.esm.js.tmp/types/index.d.ts.map +1 -0
- package/dist/index.esm.js/index.esm.js.tmp/types/index.js +6 -0
- package/dist/index.esm.js/index.esm.js.tmp/types/index.js.map +1 -0
- package/dist/index.esm.js/index.esm.js.tmp/types/user.d.ts +61 -0
- package/dist/index.esm.js/index.esm.js.tmp/types/user.d.ts.map +1 -0
- package/dist/index.esm.js/index.esm.js.tmp/types/user.js +7 -0
- package/dist/index.esm.js/index.esm.js.tmp/types/user.js.map +1 -0
- package/dist/index.esm.js/index.js +21 -0
- package/dist/index.esm.js/index.js.map +1 -0
- package/dist/index.esm.js/queries/businesses.d.ts +37 -0
- package/dist/index.esm.js/queries/businesses.d.ts.map +1 -0
- package/dist/index.esm.js/queries/businesses.js +82 -0
- package/dist/index.esm.js/queries/businesses.js.map +1 -0
- package/dist/index.esm.js/queries/index.d.ts +5 -0
- package/dist/index.esm.js/queries/index.d.ts.map +1 -0
- package/dist/index.esm.js/queries/index.js +5 -0
- package/dist/index.esm.js/queries/index.js.map +1 -0
- package/dist/index.esm.js/queries/searchBusinesses.d.ts +64 -0
- package/dist/index.esm.js/queries/searchBusinesses.d.ts.map +1 -0
- package/dist/index.esm.js/queries/searchBusinesses.js +97 -0
- package/dist/index.esm.js/queries/searchBusinesses.js.map +1 -0
- package/dist/index.esm.js/queries/users.d.ts +51 -0
- package/dist/index.esm.js/queries/users.d.ts.map +1 -0
- package/dist/index.esm.js/queries/users.js +138 -0
- package/dist/index.esm.js/queries/users.js.map +1 -0
- package/dist/index.esm.js/queries/usersLight.d.ts +63 -0
- package/dist/index.esm.js/queries/usersLight.d.ts.map +1 -0
- package/dist/index.esm.js/queries/usersLight.js +90 -0
- package/dist/index.esm.js/queries/usersLight.js.map +1 -0
- package/dist/index.esm.js/types/business.d.ts +20 -0
- package/dist/index.esm.js/types/business.d.ts.map +1 -0
- package/dist/index.esm.js/types/business.js +2 -0
- package/dist/index.esm.js/types/business.js.map +1 -0
- package/dist/index.esm.js/types/common.d.ts +45 -0
- package/dist/index.esm.js/types/common.d.ts.map +1 -0
- package/dist/index.esm.js/types/common.js +2 -0
- package/dist/index.esm.js/types/common.js.map +1 -0
- package/dist/index.esm.js/types/department.d.ts +6 -0
- package/dist/index.esm.js/types/department.d.ts.map +1 -0
- package/dist/index.esm.js/types/department.js +2 -0
- package/dist/index.esm.js/types/department.js.map +1 -0
- package/dist/index.esm.js/types/group.d.ts +9 -0
- package/dist/index.esm.js/types/group.d.ts.map +1 -0
- package/dist/index.esm.js/types/group.js +2 -0
- package/dist/index.esm.js/types/group.js.map +1 -0
- package/dist/index.esm.js/types/index.d.ts +6 -0
- package/dist/index.esm.js/types/index.d.ts.map +1 -0
- package/dist/index.esm.js/types/index.js +6 -0
- package/dist/index.esm.js/types/index.js.map +1 -0
- package/dist/index.esm.js/types/user.d.ts +61 -0
- package/dist/index.esm.js/types/user.d.ts.map +1 -0
- package/dist/index.esm.js/types/user.js +7 -0
- package/dist/index.esm.js/types/user.js.map +1 -0
- package/dist/index.js +47 -0
- package/dist/index.js.map +1 -0
- package/dist/queries/businesses.d.ts +37 -0
- package/dist/queries/businesses.d.ts.map +1 -0
- package/dist/queries/businesses.js +86 -0
- package/dist/queries/businesses.js.map +1 -0
- package/dist/queries/index.d.ts +5 -0
- package/dist/queries/index.d.ts.map +1 -0
- package/dist/queries/index.js +21 -0
- package/dist/queries/index.js.map +1 -0
- package/dist/queries/searchBusinesses.d.ts +64 -0
- package/dist/queries/searchBusinesses.d.ts.map +1 -0
- package/dist/queries/searchBusinesses.js +101 -0
- package/dist/queries/searchBusinesses.js.map +1 -0
- package/dist/queries/users.d.ts +51 -0
- package/dist/queries/users.d.ts.map +1 -0
- package/dist/queries/users.js +142 -0
- package/dist/queries/users.js.map +1 -0
- package/dist/queries/usersLight.d.ts +63 -0
- package/dist/queries/usersLight.d.ts.map +1 -0
- package/dist/queries/usersLight.js +94 -0
- package/dist/queries/usersLight.js.map +1 -0
- package/dist/types/business.d.ts +20 -0
- package/dist/types/business.d.ts.map +1 -0
- package/dist/types/business.js +3 -0
- package/dist/types/business.js.map +1 -0
- package/dist/types/common.d.ts +45 -0
- package/dist/types/common.d.ts.map +1 -0
- package/dist/types/common.js +3 -0
- package/dist/types/common.js.map +1 -0
- package/dist/types/department.d.ts +6 -0
- package/dist/types/department.d.ts.map +1 -0
- package/dist/types/department.js +3 -0
- package/dist/types/department.js.map +1 -0
- package/dist/types/group.d.ts +9 -0
- package/dist/types/group.d.ts.map +1 -0
- package/dist/types/group.js +3 -0
- package/dist/types/group.js.map +1 -0
- package/dist/types/index.d.ts +6 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +22 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/user.d.ts +61 -0
- package/dist/types/user.d.ts.map +1 -0
- package/dist/types/user.js +10 -0
- package/dist/types/user.js.map +1 -0
- package/package.json +50 -0
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { gql, useQuery } from '@apollo/client';
|
|
2
|
+
export const GET_BUSINESSES = gql `
|
|
3
|
+
query FetchBusinesses(
|
|
4
|
+
$filters: FilterInput
|
|
5
|
+
$first: Int
|
|
6
|
+
$last: Int
|
|
7
|
+
$after: String
|
|
8
|
+
$before: String
|
|
9
|
+
) {
|
|
10
|
+
fetchBusinesses(
|
|
11
|
+
filters: $filters
|
|
12
|
+
first: $first
|
|
13
|
+
last: $last
|
|
14
|
+
after: $after
|
|
15
|
+
before: $before
|
|
16
|
+
) {
|
|
17
|
+
totalCount
|
|
18
|
+
edges {
|
|
19
|
+
node {
|
|
20
|
+
id
|
|
21
|
+
name
|
|
22
|
+
schedule
|
|
23
|
+
defaultDepartment
|
|
24
|
+
reservationLimit
|
|
25
|
+
reservationDuration
|
|
26
|
+
status
|
|
27
|
+
totalUsers
|
|
28
|
+
createdAt
|
|
29
|
+
dailyStaff
|
|
30
|
+
totalStaff
|
|
31
|
+
monthlyRecurrentRevenewUf
|
|
32
|
+
subdomain
|
|
33
|
+
parentGroup {
|
|
34
|
+
id
|
|
35
|
+
name
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
pageInfo {
|
|
40
|
+
hasNextPage
|
|
41
|
+
hasPreviousPage
|
|
42
|
+
startCursor
|
|
43
|
+
endCursor
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
`;
|
|
48
|
+
/**
|
|
49
|
+
* React hook to fetch businesses from Makana GraphQL API
|
|
50
|
+
*
|
|
51
|
+
* @param variables - Query variables (filters, pagination, etc.)
|
|
52
|
+
* @param options - Additional Apollo Client query options
|
|
53
|
+
* @returns Object containing businesses data, loading state, error, and refetch function
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* ```typescript
|
|
57
|
+
* const { businesses, loading, error } = useGetBusinesses({
|
|
58
|
+
* filters: { groupId: '456' },
|
|
59
|
+
* first: 20
|
|
60
|
+
* });
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
export function useGetBusinesses(variables = {}, options) {
|
|
64
|
+
const { loading, error, data, fetchMore, refetch } = useQuery(GET_BUSINESSES, {
|
|
65
|
+
variables,
|
|
66
|
+
fetchPolicy: 'cache-first',
|
|
67
|
+
...options,
|
|
68
|
+
});
|
|
69
|
+
const businesses = data?.fetchBusinesses?.edges.map((edge) => edge.node) || [];
|
|
70
|
+
const totalCount = data?.fetchBusinesses?.totalCount || 0;
|
|
71
|
+
const pageInfo = data?.fetchBusinesses?.pageInfo || null;
|
|
72
|
+
return {
|
|
73
|
+
businesses,
|
|
74
|
+
totalCount,
|
|
75
|
+
pageInfo,
|
|
76
|
+
loading,
|
|
77
|
+
error,
|
|
78
|
+
fetchMore,
|
|
79
|
+
refetch,
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=businesses.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"businesses.js","sourceRoot":"","sources":["../../../src/queries/businesses.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAoB,MAAM,gBAAgB,CAAC;AAIjE,MAAM,CAAC,MAAM,cAAc,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6ChC,CAAC;AAMF;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,gBAAgB,CAC9B,YAAgC,EAAE,EAClC,OAA0F;IAE1F,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,GAAG,QAAQ,CAG3D,cAAc,EAAE;QAChB,SAAS;QACT,WAAW,EAAE,aAAa;QAC1B,GAAG,OAAO;KACX,CAAC,CAAC;IAEH,MAAM,UAAU,GAAG,IAAI,EAAE,eAAe,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;IAC/E,MAAM,UAAU,GAAG,IAAI,EAAE,eAAe,EAAE,UAAU,IAAI,CAAC,CAAC;IAC1D,MAAM,QAAQ,GAAG,IAAI,EAAE,eAAe,EAAE,QAAQ,IAAI,IAAI,CAAC;IAEzD,OAAO;QACL,UAAU;QACV,UAAU;QACV,QAAQ;QACR,OAAO;QACP,KAAK;QACL,SAAS;QACT,OAAO;KACR,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/queries/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/queries/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { QueryHookOptions } from '@apollo/client';
|
|
2
|
+
import { Business } from '../types/business';
|
|
3
|
+
import { SortInput, PageInfo } from '../types/common';
|
|
4
|
+
export declare const SEARCH_BUSINESSES: import("@apollo/client").DocumentNode;
|
|
5
|
+
export interface SearchBusinessesVariables {
|
|
6
|
+
searchTerm?: string;
|
|
7
|
+
sort?: SortInput;
|
|
8
|
+
page?: number;
|
|
9
|
+
pageSize?: number;
|
|
10
|
+
fromDate?: string;
|
|
11
|
+
toDate?: string;
|
|
12
|
+
skip?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export interface SearchBusinessesResponse {
|
|
15
|
+
searchBusinesses: {
|
|
16
|
+
totalBusinesses: number;
|
|
17
|
+
businesses: {
|
|
18
|
+
totalCount: number;
|
|
19
|
+
edges: {
|
|
20
|
+
node: Business & {
|
|
21
|
+
totalAttentions?: number;
|
|
22
|
+
};
|
|
23
|
+
}[];
|
|
24
|
+
pageInfo: PageInfo;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* React hook to search businesses from Makana GraphQL API
|
|
30
|
+
*
|
|
31
|
+
* @param variables - Query variables (search term, sort, pagination, date filters)
|
|
32
|
+
* @param options - Additional Apollo Client query options
|
|
33
|
+
* @returns Object containing businesses data, loading state, error, and refetch function
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```typescript
|
|
37
|
+
* const { businesses, totalBusinesses, loading, error } = useSearchBusinesses({
|
|
38
|
+
* searchTerm: 'Makana',
|
|
39
|
+
* sort: { sortBy: 'name', sortOrder: 'ASC' },
|
|
40
|
+
* page: 0,
|
|
41
|
+
* pageSize: 25,
|
|
42
|
+
* fromDate: '2024-01-01',
|
|
43
|
+
* toDate: '2024-12-31'
|
|
44
|
+
* });
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
export declare function useSearchBusinesses(variables?: SearchBusinessesVariables, options?: Omit<QueryHookOptions<SearchBusinessesResponse, SearchBusinessesVariables>, 'variables'>): {
|
|
48
|
+
businesses: (Business & {
|
|
49
|
+
totalAttentions?: number;
|
|
50
|
+
})[];
|
|
51
|
+
totalCount: number;
|
|
52
|
+
totalBusinesses: number;
|
|
53
|
+
pageInfo: PageInfo | null;
|
|
54
|
+
loading: boolean;
|
|
55
|
+
error: import("@apollo/client").ApolloError | undefined;
|
|
56
|
+
refetch: (variables?: Partial<SearchBusinessesVariables> | undefined) => Promise<import("@apollo/client").ApolloQueryResult<SearchBusinessesResponse>>;
|
|
57
|
+
fetchMore: <TFetchData = SearchBusinessesResponse, TFetchVars extends import("@apollo/client").OperationVariables = SearchBusinessesVariables>(fetchMoreOptions: import("@apollo/client").FetchMoreQueryOptions<TFetchVars, TFetchData> & {
|
|
58
|
+
updateQuery?: ((previousQueryResult: SearchBusinessesResponse, options: {
|
|
59
|
+
fetchMoreResult: import("@apollo/client").Unmasked<TFetchData>;
|
|
60
|
+
variables: TFetchVars;
|
|
61
|
+
}) => SearchBusinessesResponse) | undefined;
|
|
62
|
+
}) => Promise<import("@apollo/client").ApolloQueryResult<TFetchData>>;
|
|
63
|
+
};
|
|
64
|
+
//# sourceMappingURL=searchBusinesses.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"searchBusinesses.d.ts","sourceRoot":"","sources":["../../../src/queries/searchBusinesses.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACjE,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAEtD,eAAO,MAAM,iBAAiB,uCAoD7B,CAAC;AAEF,MAAM,WAAW,yBAAyB;IACxC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,MAAM,WAAW,wBAAwB;IACvC,gBAAgB,EAAE;QAChB,eAAe,EAAE,MAAM,CAAC;QACxB,UAAU,EAAE;YACV,UAAU,EAAE,MAAM,CAAC;YACnB,KAAK,EAAE;gBAAE,IAAI,EAAE,QAAQ,GAAG;oBAAE,eAAe,CAAC,EAAE,MAAM,CAAA;iBAAE,CAAA;aAAE,EAAE,CAAC;YAC3D,QAAQ,EAAE,QAAQ,CAAC;SACpB,CAAC;KACH,CAAC;CACH;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,mBAAmB,CACjC,SAAS,GAAE,yBAA8B,EACzC,OAAO,CAAC,EAAE,IAAI,CAAC,gBAAgB,CAAC,wBAAwB,EAAE,yBAAyB,CAAC,EAAE,WAAW,CAAC;;0BA3BhD,MAAM;;;;;;;;;;;;;;EAwDzD"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { gql, useQuery } from '@apollo/client';
|
|
2
|
+
export const SEARCH_BUSINESSES = gql `
|
|
3
|
+
query SearchBusinesses(
|
|
4
|
+
$searchTerm: String
|
|
5
|
+
$sort: SortInput
|
|
6
|
+
$page: Int
|
|
7
|
+
$pageSize: Int
|
|
8
|
+
$fromDate: String
|
|
9
|
+
$toDate: String
|
|
10
|
+
) {
|
|
11
|
+
searchBusinesses(
|
|
12
|
+
searchTerm: $searchTerm
|
|
13
|
+
sort: $sort
|
|
14
|
+
page: $page
|
|
15
|
+
pageSize: $pageSize
|
|
16
|
+
fromDate: $fromDate
|
|
17
|
+
toDate: $toDate
|
|
18
|
+
) {
|
|
19
|
+
totalBusinesses
|
|
20
|
+
businesses {
|
|
21
|
+
totalCount
|
|
22
|
+
edges {
|
|
23
|
+
node {
|
|
24
|
+
id
|
|
25
|
+
name
|
|
26
|
+
status
|
|
27
|
+
totalUsers
|
|
28
|
+
totalAttentions(fromDate: $fromDate, toDate: $toDate)
|
|
29
|
+
createdAt
|
|
30
|
+
updatedAt
|
|
31
|
+
defaultDepartment
|
|
32
|
+
schedule
|
|
33
|
+
reservationLimit
|
|
34
|
+
reservationDuration
|
|
35
|
+
dailyStaff
|
|
36
|
+
totalStaff
|
|
37
|
+
monthlyRecurrentRevenewUf
|
|
38
|
+
subdomain
|
|
39
|
+
parentGroup {
|
|
40
|
+
id
|
|
41
|
+
name
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
pageInfo {
|
|
46
|
+
hasNextPage
|
|
47
|
+
hasPreviousPage
|
|
48
|
+
startCursor
|
|
49
|
+
endCursor
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
`;
|
|
55
|
+
/**
|
|
56
|
+
* React hook to search businesses from Makana GraphQL API
|
|
57
|
+
*
|
|
58
|
+
* @param variables - Query variables (search term, sort, pagination, date filters)
|
|
59
|
+
* @param options - Additional Apollo Client query options
|
|
60
|
+
* @returns Object containing businesses data, loading state, error, and refetch function
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* ```typescript
|
|
64
|
+
* const { businesses, totalBusinesses, loading, error } = useSearchBusinesses({
|
|
65
|
+
* searchTerm: 'Makana',
|
|
66
|
+
* sort: { sortBy: 'name', sortOrder: 'ASC' },
|
|
67
|
+
* page: 0,
|
|
68
|
+
* pageSize: 25,
|
|
69
|
+
* fromDate: '2024-01-01',
|
|
70
|
+
* toDate: '2024-12-31'
|
|
71
|
+
* });
|
|
72
|
+
* ```
|
|
73
|
+
*/
|
|
74
|
+
export function useSearchBusinesses(variables = {}, options) {
|
|
75
|
+
const { skip, ...queryVariables } = variables;
|
|
76
|
+
const { loading, error, data, refetch, fetchMore } = useQuery(SEARCH_BUSINESSES, {
|
|
77
|
+
variables: queryVariables,
|
|
78
|
+
fetchPolicy: 'cache-first',
|
|
79
|
+
skip: skip === true,
|
|
80
|
+
...options,
|
|
81
|
+
});
|
|
82
|
+
const businesses = data?.searchBusinesses?.businesses.edges.map((edge) => edge.node) || [];
|
|
83
|
+
const totalCount = data?.searchBusinesses?.businesses.totalCount || 0;
|
|
84
|
+
const totalBusinesses = data?.searchBusinesses?.totalBusinesses || 0;
|
|
85
|
+
const pageInfo = data?.searchBusinesses?.businesses.pageInfo || null;
|
|
86
|
+
return {
|
|
87
|
+
businesses,
|
|
88
|
+
totalCount,
|
|
89
|
+
totalBusinesses,
|
|
90
|
+
pageInfo,
|
|
91
|
+
loading,
|
|
92
|
+
error,
|
|
93
|
+
refetch,
|
|
94
|
+
fetchMore,
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
//# sourceMappingURL=searchBusinesses.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"searchBusinesses.js","sourceRoot":"","sources":["../../../src/queries/searchBusinesses.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAoB,MAAM,gBAAgB,CAAC;AAIjE,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoDnC,CAAC;AAuBF;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,mBAAmB,CACjC,YAAuC,EAAE,EACzC,OAAkG;IAElG,MAAM,EAAE,IAAI,EAAE,GAAG,cAAc,EAAE,GAAG,SAAS,CAAC;IAE9C,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,QAAQ,CAG3D,iBAAiB,EAAE;QACnB,SAAS,EAAE,cAAc;QACzB,WAAW,EAAE,aAAa;QAC1B,IAAI,EAAE,IAAI,KAAK,IAAI;QACnB,GAAG,OAAO;KACX,CAAC,CAAC;IAEH,MAAM,UAAU,GAAG,IAAI,EAAE,gBAAgB,EAAE,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;IAC3F,MAAM,UAAU,GAAG,IAAI,EAAE,gBAAgB,EAAE,UAAU,CAAC,UAAU,IAAI,CAAC,CAAC;IACtE,MAAM,eAAe,GAAG,IAAI,EAAE,gBAAgB,EAAE,eAAe,IAAI,CAAC,CAAC;IACrE,MAAM,QAAQ,GAAG,IAAI,EAAE,gBAAgB,EAAE,UAAU,CAAC,QAAQ,IAAI,IAAI,CAAC;IAErE,OAAO;QACL,UAAU;QACV,UAAU;QACV,eAAe;QACf,QAAQ;QACR,OAAO;QACP,KAAK;QACL,OAAO;QACP,SAAS;KACV,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { QueryHookOptions } from '@apollo/client';
|
|
2
|
+
import { User } from '../types/user';
|
|
3
|
+
import { FilterInput, SortInput, Connection } from '../types/common';
|
|
4
|
+
export declare const GET_USERS: import("@apollo/client").DocumentNode;
|
|
5
|
+
export interface FetchUsersVariables {
|
|
6
|
+
userId?: string;
|
|
7
|
+
name?: string;
|
|
8
|
+
rut?: string;
|
|
9
|
+
phone?: string;
|
|
10
|
+
filters?: FilterInput;
|
|
11
|
+
sort?: SortInput;
|
|
12
|
+
first?: number;
|
|
13
|
+
last?: number;
|
|
14
|
+
after?: string | null;
|
|
15
|
+
before?: string | null;
|
|
16
|
+
includeInactive?: boolean;
|
|
17
|
+
skip?: boolean;
|
|
18
|
+
}
|
|
19
|
+
export interface FetchUsersResponse {
|
|
20
|
+
fetchUsers: Connection<User>;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* React hook to fetch users from Makana GraphQL API
|
|
24
|
+
*
|
|
25
|
+
* @param variables - Query variables (filters, pagination, etc.)
|
|
26
|
+
* @param options - Additional Apollo Client query options
|
|
27
|
+
* @returns Object containing users data, loading state, error, and refetch function
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```typescript
|
|
31
|
+
* const { users, loading, error, refetch } = useGetUsers({
|
|
32
|
+
* filters: { businessId: '123' },
|
|
33
|
+
* first: 10
|
|
34
|
+
* });
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
export declare function useGetUsers(variables?: FetchUsersVariables, options?: Omit<QueryHookOptions<FetchUsersResponse, FetchUsersVariables>, 'variables'>): {
|
|
38
|
+
users: User[];
|
|
39
|
+
totalCount: number;
|
|
40
|
+
pageInfo: import("../types/common").PageInfo | null;
|
|
41
|
+
loading: boolean;
|
|
42
|
+
error: import("@apollo/client").ApolloError | undefined;
|
|
43
|
+
fetchMore: <TFetchData = FetchUsersResponse, TFetchVars extends import("@apollo/client").OperationVariables = FetchUsersVariables>(fetchMoreOptions: import("@apollo/client").FetchMoreQueryOptions<TFetchVars, TFetchData> & {
|
|
44
|
+
updateQuery?: ((previousQueryResult: FetchUsersResponse, options: {
|
|
45
|
+
fetchMoreResult: import("@apollo/client").Unmasked<TFetchData>;
|
|
46
|
+
variables: TFetchVars;
|
|
47
|
+
}) => FetchUsersResponse) | undefined;
|
|
48
|
+
}) => Promise<import("@apollo/client").ApolloQueryResult<TFetchData>>;
|
|
49
|
+
refetch: (variables?: Partial<FetchUsersVariables> | undefined) => Promise<import("@apollo/client").ApolloQueryResult<FetchUsersResponse>>;
|
|
50
|
+
};
|
|
51
|
+
//# sourceMappingURL=users.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"users.d.ts","sourceRoot":"","sources":["../../../src/queries/users.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACjE,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACrC,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAErE,eAAO,MAAM,SAAS,uCAmGrB,CAAC;AAEF,MAAM,WAAW,mBAAmB;IAClC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,MAAM,WAAW,kBAAkB;IACjC,UAAU,EAAE,UAAU,CAAC,IAAI,CAAC,CAAC;CAC9B;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,WAAW,CACzB,SAAS,GAAE,mBAAwB,EACnC,OAAO,CAAC,EAAE,IAAI,CAAC,gBAAgB,CAAC,kBAAkB,EAAE,mBAAmB,CAAC,EAAE,WAAW,CAAC;;;;;;;;;;;;;EA2BvF"}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { gql, useQuery } from '@apollo/client';
|
|
2
|
+
export const GET_USERS = gql `
|
|
3
|
+
query FetchUsers(
|
|
4
|
+
$userId: String
|
|
5
|
+
$name: String
|
|
6
|
+
$rut: String
|
|
7
|
+
$phone: String
|
|
8
|
+
$filters: FilterInput
|
|
9
|
+
$sort: SortInput
|
|
10
|
+
$first: Int
|
|
11
|
+
$last: Int
|
|
12
|
+
$after: String
|
|
13
|
+
$before: String
|
|
14
|
+
$includeInactive: Boolean
|
|
15
|
+
) {
|
|
16
|
+
fetchUsers(
|
|
17
|
+
userId: $userId
|
|
18
|
+
name: $name
|
|
19
|
+
rut: $rut
|
|
20
|
+
phone: $phone
|
|
21
|
+
filters: $filters
|
|
22
|
+
sort: $sort
|
|
23
|
+
first: $first
|
|
24
|
+
last: $last
|
|
25
|
+
after: $after
|
|
26
|
+
before: $before
|
|
27
|
+
includeInactive: $includeInactive
|
|
28
|
+
) {
|
|
29
|
+
totalCount
|
|
30
|
+
edges {
|
|
31
|
+
node {
|
|
32
|
+
id
|
|
33
|
+
name
|
|
34
|
+
firstName
|
|
35
|
+
lastName
|
|
36
|
+
phone
|
|
37
|
+
rut
|
|
38
|
+
sex
|
|
39
|
+
email
|
|
40
|
+
status
|
|
41
|
+
height
|
|
42
|
+
weight
|
|
43
|
+
birthday
|
|
44
|
+
medicals
|
|
45
|
+
disease
|
|
46
|
+
createdAt
|
|
47
|
+
currentPlan {
|
|
48
|
+
id
|
|
49
|
+
plan
|
|
50
|
+
planName
|
|
51
|
+
riskLevel
|
|
52
|
+
expectedSessions
|
|
53
|
+
stats
|
|
54
|
+
summary {
|
|
55
|
+
plan
|
|
56
|
+
priority1
|
|
57
|
+
priority2
|
|
58
|
+
priority1Name
|
|
59
|
+
priority2Name
|
|
60
|
+
}
|
|
61
|
+
x
|
|
62
|
+
y
|
|
63
|
+
z
|
|
64
|
+
createdAt
|
|
65
|
+
updatedAt
|
|
66
|
+
priorityPart1 {
|
|
67
|
+
id
|
|
68
|
+
name
|
|
69
|
+
}
|
|
70
|
+
priorityPart2 {
|
|
71
|
+
id
|
|
72
|
+
name
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
department {
|
|
76
|
+
id
|
|
77
|
+
name
|
|
78
|
+
colorTag
|
|
79
|
+
}
|
|
80
|
+
business {
|
|
81
|
+
id
|
|
82
|
+
name
|
|
83
|
+
createdAt
|
|
84
|
+
updatedAt
|
|
85
|
+
parentGroup {
|
|
86
|
+
id
|
|
87
|
+
name
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
adminLevel
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
pageInfo {
|
|
94
|
+
hasNextPage
|
|
95
|
+
hasPreviousPage
|
|
96
|
+
startCursor
|
|
97
|
+
endCursor
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
`;
|
|
102
|
+
/**
|
|
103
|
+
* React hook to fetch users from Makana GraphQL API
|
|
104
|
+
*
|
|
105
|
+
* @param variables - Query variables (filters, pagination, etc.)
|
|
106
|
+
* @param options - Additional Apollo Client query options
|
|
107
|
+
* @returns Object containing users data, loading state, error, and refetch function
|
|
108
|
+
*
|
|
109
|
+
* @example
|
|
110
|
+
* ```typescript
|
|
111
|
+
* const { users, loading, error, refetch } = useGetUsers({
|
|
112
|
+
* filters: { businessId: '123' },
|
|
113
|
+
* first: 10
|
|
114
|
+
* });
|
|
115
|
+
* ```
|
|
116
|
+
*/
|
|
117
|
+
export function useGetUsers(variables = {}, options) {
|
|
118
|
+
const { skip, ...queryVariables } = variables;
|
|
119
|
+
const { loading, error, data, fetchMore, refetch } = useQuery(GET_USERS, {
|
|
120
|
+
variables: queryVariables,
|
|
121
|
+
fetchPolicy: 'cache-first',
|
|
122
|
+
skip: skip === true,
|
|
123
|
+
...options,
|
|
124
|
+
});
|
|
125
|
+
const users = data?.fetchUsers?.edges.map((edge) => edge.node) || [];
|
|
126
|
+
const totalCount = data?.fetchUsers?.totalCount || 0;
|
|
127
|
+
const pageInfo = data?.fetchUsers?.pageInfo || null;
|
|
128
|
+
return {
|
|
129
|
+
users,
|
|
130
|
+
totalCount,
|
|
131
|
+
pageInfo,
|
|
132
|
+
loading,
|
|
133
|
+
error,
|
|
134
|
+
fetchMore,
|
|
135
|
+
refetch,
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
//# sourceMappingURL=users.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"users.js","sourceRoot":"","sources":["../../../src/queries/users.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAoB,MAAM,gBAAgB,CAAC;AAIjE,MAAM,CAAC,MAAM,SAAS,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmG3B,CAAC;AAqBF;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,WAAW,CACzB,YAAiC,EAAE,EACnC,OAAsF;IAEtF,MAAM,EAAE,IAAI,EAAE,GAAG,cAAc,EAAE,GAAG,SAAS,CAAC;IAE9C,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,GAAG,QAAQ,CAC3D,SAAS,EACT;QACE,SAAS,EAAE,cAAc;QACzB,WAAW,EAAE,aAAa;QAC1B,IAAI,EAAE,IAAI,KAAK,IAAI;QACnB,GAAG,OAAO;KACX,CACF,CAAC;IAEF,MAAM,KAAK,GAAG,IAAI,EAAE,UAAU,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;IACrE,MAAM,UAAU,GAAG,IAAI,EAAE,UAAU,EAAE,UAAU,IAAI,CAAC,CAAC;IACrD,MAAM,QAAQ,GAAG,IAAI,EAAE,UAAU,EAAE,QAAQ,IAAI,IAAI,CAAC;IAEpD,OAAO;QACL,KAAK;QACL,UAAU;QACV,QAAQ;QACR,OAAO;QACP,KAAK;QACL,SAAS;QACT,OAAO;KACR,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { QueryHookOptions } from '@apollo/client';
|
|
2
|
+
import { FilterInput, SortInput, Connection } from '../types/common';
|
|
3
|
+
export declare const GET_USERS_LIGHT: import("@apollo/client").DocumentNode;
|
|
4
|
+
export interface FetchUsersLightVariables {
|
|
5
|
+
userId?: string;
|
|
6
|
+
name?: string;
|
|
7
|
+
rut?: string;
|
|
8
|
+
phone?: string;
|
|
9
|
+
filters?: FilterInput;
|
|
10
|
+
sort?: SortInput;
|
|
11
|
+
first?: number;
|
|
12
|
+
last?: number;
|
|
13
|
+
after?: string | null;
|
|
14
|
+
before?: string | null;
|
|
15
|
+
includeInactive?: boolean;
|
|
16
|
+
skip?: boolean;
|
|
17
|
+
}
|
|
18
|
+
export interface UserLightNode {
|
|
19
|
+
id?: number;
|
|
20
|
+
name?: string;
|
|
21
|
+
rut?: string;
|
|
22
|
+
phone?: string;
|
|
23
|
+
email?: string;
|
|
24
|
+
status?: string;
|
|
25
|
+
business?: {
|
|
26
|
+
id: number;
|
|
27
|
+
name: string;
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
export interface FetchUsersLightResponse {
|
|
31
|
+
fetchUsers: Connection<UserLightNode>;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* React hook to fetch users with basic info from Makana GraphQL API
|
|
35
|
+
* This is a lightweight query compared to useGetUsers
|
|
36
|
+
*
|
|
37
|
+
* @param variables - Query variables (filters, pagination, etc.)
|
|
38
|
+
* @param options - Additional Apollo Client query options
|
|
39
|
+
* @returns Object containing users data, loading state, error, and refetch function
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* ```typescript
|
|
43
|
+
* const { users, loading, error, refetch } = useGetUsersLight({
|
|
44
|
+
* filters: { businessId: '123' },
|
|
45
|
+
* first: 10
|
|
46
|
+
* });
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
export declare function useGetUsersLight(variables?: FetchUsersLightVariables, options?: Omit<QueryHookOptions<FetchUsersLightResponse, FetchUsersLightVariables>, 'variables'>): {
|
|
50
|
+
users: UserLightNode[];
|
|
51
|
+
totalCount: number;
|
|
52
|
+
pageInfo: import("../types/common").PageInfo | null;
|
|
53
|
+
loading: boolean;
|
|
54
|
+
error: import("@apollo/client").ApolloError | undefined;
|
|
55
|
+
fetchMore: <TFetchData = FetchUsersLightResponse, TFetchVars extends import("@apollo/client").OperationVariables = FetchUsersLightVariables>(fetchMoreOptions: import("@apollo/client").FetchMoreQueryOptions<TFetchVars, TFetchData> & {
|
|
56
|
+
updateQuery?: ((previousQueryResult: FetchUsersLightResponse, options: {
|
|
57
|
+
fetchMoreResult: import("@apollo/client").Unmasked<TFetchData>;
|
|
58
|
+
variables: TFetchVars;
|
|
59
|
+
}) => FetchUsersLightResponse) | undefined;
|
|
60
|
+
}) => Promise<import("@apollo/client").ApolloQueryResult<TFetchData>>;
|
|
61
|
+
refetch: (variables?: Partial<FetchUsersLightVariables> | undefined) => Promise<import("@apollo/client").ApolloQueryResult<FetchUsersLightResponse>>;
|
|
62
|
+
};
|
|
63
|
+
//# sourceMappingURL=usersLight.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usersLight.d.ts","sourceRoot":"","sources":["../../../src/queries/usersLight.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAEjE,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAErE,eAAO,MAAM,eAAe,uCAkD3B,CAAC;AAEF,MAAM,WAAW,wBAAwB;IACvC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,MAAM,WAAW,aAAa;IAC5B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE;QACT,EAAE,EAAE,MAAM,CAAC;QACX,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;CACH;AAED,MAAM,WAAW,uBAAuB;IACtC,UAAU,EAAE,UAAU,CAAC,aAAa,CAAC,CAAC;CACvC;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,gBAAgB,CAC9B,SAAS,GAAE,wBAA6B,EACxC,OAAO,CAAC,EAAE,IAAI,CAAC,gBAAgB,CAAC,uBAAuB,EAAE,wBAAwB,CAAC,EAAE,WAAW,CAAC;;;;;;;;;;;;;EA2BjG"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { gql, useQuery } from '@apollo/client';
|
|
2
|
+
export const GET_USERS_LIGHT = gql `
|
|
3
|
+
query FetchUsers(
|
|
4
|
+
$userId: String
|
|
5
|
+
$name: String
|
|
6
|
+
$rut: String
|
|
7
|
+
$phone: String
|
|
8
|
+
$filters: FilterInput
|
|
9
|
+
$sort: SortInput
|
|
10
|
+
$first: Int
|
|
11
|
+
$last: Int
|
|
12
|
+
$after: String
|
|
13
|
+
$before: String
|
|
14
|
+
$includeInactive: Boolean
|
|
15
|
+
) {
|
|
16
|
+
fetchUsers(
|
|
17
|
+
userId: $userId
|
|
18
|
+
name: $name
|
|
19
|
+
rut: $rut
|
|
20
|
+
phone: $phone
|
|
21
|
+
filters: $filters
|
|
22
|
+
sort: $sort
|
|
23
|
+
first: $first
|
|
24
|
+
last: $last
|
|
25
|
+
after: $after
|
|
26
|
+
before: $before
|
|
27
|
+
includeInactive: $includeInactive
|
|
28
|
+
) {
|
|
29
|
+
totalCount
|
|
30
|
+
edges {
|
|
31
|
+
node {
|
|
32
|
+
id
|
|
33
|
+
name
|
|
34
|
+
rut
|
|
35
|
+
phone
|
|
36
|
+
email
|
|
37
|
+
status
|
|
38
|
+
business {
|
|
39
|
+
id
|
|
40
|
+
name
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
pageInfo {
|
|
45
|
+
hasNextPage
|
|
46
|
+
hasPreviousPage
|
|
47
|
+
startCursor
|
|
48
|
+
endCursor
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
`;
|
|
53
|
+
/**
|
|
54
|
+
* React hook to fetch users with basic info from Makana GraphQL API
|
|
55
|
+
* This is a lightweight query compared to useGetUsers
|
|
56
|
+
*
|
|
57
|
+
* @param variables - Query variables (filters, pagination, etc.)
|
|
58
|
+
* @param options - Additional Apollo Client query options
|
|
59
|
+
* @returns Object containing users data, loading state, error, and refetch function
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* ```typescript
|
|
63
|
+
* const { users, loading, error, refetch } = useGetUsersLight({
|
|
64
|
+
* filters: { businessId: '123' },
|
|
65
|
+
* first: 10
|
|
66
|
+
* });
|
|
67
|
+
* ```
|
|
68
|
+
*/
|
|
69
|
+
export function useGetUsersLight(variables = {}, options) {
|
|
70
|
+
const { skip, ...queryVariables } = variables;
|
|
71
|
+
const { loading, error, data, fetchMore, refetch } = useQuery(GET_USERS_LIGHT, {
|
|
72
|
+
variables: queryVariables,
|
|
73
|
+
fetchPolicy: 'cache-first',
|
|
74
|
+
skip: skip === true,
|
|
75
|
+
...options,
|
|
76
|
+
});
|
|
77
|
+
const users = data?.fetchUsers?.edges.map((edge) => edge.node) || [];
|
|
78
|
+
const totalCount = data?.fetchUsers?.totalCount || 0;
|
|
79
|
+
const pageInfo = data?.fetchUsers?.pageInfo || null;
|
|
80
|
+
return {
|
|
81
|
+
users,
|
|
82
|
+
totalCount,
|
|
83
|
+
pageInfo,
|
|
84
|
+
loading,
|
|
85
|
+
error,
|
|
86
|
+
fetchMore,
|
|
87
|
+
refetch,
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
//# sourceMappingURL=usersLight.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usersLight.js","sourceRoot":"","sources":["../../../src/queries/usersLight.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAoB,MAAM,gBAAgB,CAAC;AAIjE,MAAM,CAAC,MAAM,eAAe,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkDjC,CAAC;AAkCF;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,gBAAgB,CAC9B,YAAsC,EAAE,EACxC,OAAgG;IAEhG,MAAM,EAAE,IAAI,EAAE,GAAG,cAAc,EAAE,GAAG,SAAS,CAAC;IAE9C,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,GAAG,QAAQ,CAC3D,eAAe,EACf;QACE,SAAS,EAAE,cAAc;QACzB,WAAW,EAAE,aAAa;QAC1B,IAAI,EAAE,IAAI,KAAK,IAAI;QACnB,GAAG,OAAO;KACX,CACF,CAAC;IAEF,MAAM,KAAK,GAAG,IAAI,EAAE,UAAU,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;IACrE,MAAM,UAAU,GAAG,IAAI,EAAE,UAAU,EAAE,UAAU,IAAI,CAAC,CAAC;IACrD,MAAM,QAAQ,GAAG,IAAI,EAAE,UAAU,EAAE,QAAQ,IAAI,IAAI,CAAC;IAEpD,OAAO;QACL,KAAK;QACL,UAAU;QACV,QAAQ;QACR,OAAO;QACP,KAAK;QACL,SAAS;QACT,OAAO;KACR,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Group } from './group';
|
|
2
|
+
export interface Business {
|
|
3
|
+
id: number;
|
|
4
|
+
name: string;
|
|
5
|
+
reservationLimit?: number;
|
|
6
|
+
reservationDuration?: number;
|
|
7
|
+
defaultDepartment?: string;
|
|
8
|
+
schedule?: string;
|
|
9
|
+
status?: 'inactivo' | 'activo' | 'evento';
|
|
10
|
+
totalUsers?: number;
|
|
11
|
+
totalAttentions?: number;
|
|
12
|
+
createdAt?: string;
|
|
13
|
+
updatedAt?: string;
|
|
14
|
+
parentGroup?: Group | null;
|
|
15
|
+
dailyStaff?: number;
|
|
16
|
+
totalStaff?: number;
|
|
17
|
+
monthlyRecurrentRevenewUf?: number;
|
|
18
|
+
subdomain?: string;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=business.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"business.d.ts","sourceRoot":"","sources":["../../../src/types/business.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,UAAU,GAAG,QAAQ,GAAG,QAAQ,CAAC;IAC1C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC;IAC3B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,yBAAyB,CAAC,EAAE,MAAM,CAAC;IACnC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"business.js","sourceRoot":"","sources":["../../../src/types/business.ts"],"names":[],"mappings":""}
|