@omniumretail/shared-resources 0.0.75 → 0.0.76

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (191) hide show
  1. package/.eslintrc.json +31 -31
  2. package/README.md +44 -44
  3. package/dist/bundle.js +259 -259
  4. package/dist/types/components/BottomDrawer/index.d.ts +9 -9
  5. package/dist/types/components/Button/index.d.ts +2 -2
  6. package/dist/types/components/Footer/index.d.ts +3 -3
  7. package/dist/types/components/Form/FormInputField/index.d.ts +8 -8
  8. package/dist/types/components/Form/FormSelectField/index.d.ts +9 -9
  9. package/dist/types/components/Form/index.d.ts +2 -2
  10. package/dist/types/components/Header/index.d.ts +4 -4
  11. package/dist/types/components/Link/index.d.ts +6 -6
  12. package/dist/types/components/Navigation/index.d.ts +8 -8
  13. package/dist/types/components/Page/index.d.ts +13 -13
  14. package/dist/types/components/SharedContextProvider/index.d.ts +7 -7
  15. package/dist/types/components/index.d.ts +9 -9
  16. package/dist/types/constants/Icons.d.ts +15 -15
  17. package/dist/types/constants/QueryClient.d.ts +2 -2
  18. package/dist/types/constants/index.d.ts +2 -2
  19. package/dist/types/contexts/useStore.d.ts +8 -8
  20. package/dist/types/hooks/activateEvaluationCycleQuery.hook.d.ts +2 -2
  21. package/dist/types/hooks/activateQuestionnaireQuery.hook.d.ts +2 -2
  22. package/dist/types/hooks/cancelEvaluationCycleQuery.hook.d.ts +2 -2
  23. package/dist/types/hooks/cancelQuestionnaireQuery.hook.d.ts +2 -2
  24. package/dist/types/hooks/deleteEvaluationCycleQuery.hook.d.ts +2 -2
  25. package/dist/types/hooks/deleteQuestionnaireQuery.hook.d.ts +2 -2
  26. package/dist/types/hooks/duplicateQuestionnaireQuery.hook.d.ts +2 -2
  27. package/dist/types/hooks/finishEvaluationCycleQuery.hook.d.ts +2 -2
  28. package/dist/types/hooks/finishQuestionnaireQuery.hook.d.ts +2 -2
  29. package/dist/types/hooks/index.d.ts +44 -44
  30. package/dist/types/hooks/useAllRolesQuery.hook.d.ts +11 -11
  31. package/dist/types/hooks/useAllStoreQuery.hook.d.ts +13 -13
  32. package/dist/types/hooks/useAnalyticsEvaluationCyclesQuery.hook.d.ts +7 -7
  33. package/dist/types/hooks/useAnalyticsQuestionsQuery.hook.d.ts +9 -9
  34. package/dist/types/hooks/useAnalyticsSideBarQuery.hook.d.ts +7 -7
  35. package/dist/types/hooks/useAnalyticsUserIdQuery.hook.d.ts +9 -9
  36. package/dist/types/hooks/useAnalyticsUserQuery.hook.d.ts +11 -9
  37. package/dist/types/hooks/useAnswerIdQuery.hook.d.ts +2 -2
  38. package/dist/types/hooks/useAnswerMutateQuery.hook.d.ts +9 -9
  39. package/dist/types/hooks/useAnswersUserSupervisorQuery.hook.d.ts +7 -7
  40. package/dist/types/hooks/useApplicationDataQuery.hook.d.ts +2 -2
  41. package/dist/types/hooks/useContractStatesQuery.hook.d.ts +7 -7
  42. package/dist/types/hooks/useCountriesQuery.hook.d.ts +7 -7
  43. package/dist/types/hooks/useCustomersQuery.hook.d.ts +138 -138
  44. package/dist/types/hooks/useEvaluationCycleIdQuery.hook.d.ts +2 -2
  45. package/dist/types/hooks/useEvaluationCycleMutateQuery.hook.d.ts +2 -2
  46. package/dist/types/hooks/useEvaluationCycleQuery.hook.d.ts +10 -8
  47. package/dist/types/hooks/useExpUsersAnswersQuery.hook.d.ts +8 -8
  48. package/dist/types/hooks/useJobTitlesQuery.hook.d.ts +7 -7
  49. package/dist/types/hooks/useProductHierarchies.hook.d.ts +7 -7
  50. package/dist/types/hooks/useProductsQuery.hook.d.ts +138 -138
  51. package/dist/types/hooks/useQuestionnaireIdQuery.hook.d.ts +2 -2
  52. package/dist/types/hooks/useQuestionnaireMutateQuery.hook.d.ts +2 -2
  53. package/dist/types/hooks/useQuestionnaireQuery.hook.d.ts +11 -9
  54. package/dist/types/hooks/useSingleUserIdMutateQuery.hook.d.ts +2 -2
  55. package/dist/types/hooks/useSingleUserIdQuery.hook.d.ts +2 -2
  56. package/dist/types/hooks/useSingleUserResetPassword.hook.d.ts +2 -2
  57. package/dist/types/hooks/useStoreQuery.d.ts +7 -7
  58. package/dist/types/hooks/useTermNotificationQuery.hook.d.ts +2 -2
  59. package/dist/types/hooks/useUpdateSupervisorMutateQuery.hook.d.ts +8 -8
  60. package/dist/types/hooks/useUserBlockQuery.hook.d.ts +2 -2
  61. package/dist/types/hooks/useUserEmailVerifQuery.hook.d.ts +2 -2
  62. package/dist/types/hooks/useUserIdQuery.hook.d.ts +2 -2
  63. package/dist/types/hooks/useUserListQuery.hook.d.ts +8 -8
  64. package/dist/types/hooks/useUserQuery.hook.d.ts +12 -10
  65. package/dist/types/index.d.ts +7 -7
  66. package/dist/types/interfaces/AnalyticsEvaluationCycle.d.ts +19 -19
  67. package/dist/types/interfaces/AnalyticsUserId.d.ts +12 -12
  68. package/dist/types/interfaces/Answer.d.ts +12 -12
  69. package/dist/types/interfaces/AnswersUserSupervisor.d.ts +42 -42
  70. package/dist/types/interfaces/ApplicationsByCategory.d.ts +16 -16
  71. package/dist/types/interfaces/Brand.d.ts +4 -4
  72. package/dist/types/interfaces/Cart.d.ts +10 -10
  73. package/dist/types/interfaces/Configuration.d.ts +6 -6
  74. package/dist/types/interfaces/ContractStates.d.ts +7 -7
  75. package/dist/types/interfaces/Countries.d.ts +10 -10
  76. package/dist/types/interfaces/Customer.d.ts +21 -21
  77. package/dist/types/interfaces/EvaluationCycle.d.ts +32 -32
  78. package/dist/types/interfaces/ExpUsersAnswers.d.ts +15 -15
  79. package/dist/types/interfaces/JobTitles.d.ts +7 -7
  80. package/dist/types/interfaces/Product.d.ts +15 -15
  81. package/dist/types/interfaces/ProductsHierarchies.d.ts +5 -5
  82. package/dist/types/interfaces/Questionnaire.d.ts +36 -36
  83. package/dist/types/interfaces/ResponseList.d.ts +5 -5
  84. package/dist/types/interfaces/Roles.d.ts +5 -5
  85. package/dist/types/interfaces/Store.d.ts +7 -7
  86. package/dist/types/interfaces/TermNotification.d.ts +5 -5
  87. package/dist/types/interfaces/User.d.ts +67 -65
  88. package/dist/types/interfaces/index.d.ts +22 -22
  89. package/dist/types/services/ApiService/index.d.ts +9 -9
  90. package/dist/types/services/InitService/index.d.ts +3 -3
  91. package/dist/types/services/index.d.ts +2 -2
  92. package/package.json +54 -54
  93. package/src/assets/sitoo.svg +9 -9
  94. package/src/components/BottomDrawer/index.tsx +32 -32
  95. package/src/components/BottomDrawer/styles.module.scss +59 -59
  96. package/src/components/Button/index.tsx +7 -7
  97. package/src/components/Footer/index.tsx +44 -44
  98. package/src/components/Footer/styles.module.scss +33 -33
  99. package/src/components/Form/FormInputField/index.tsx +18 -18
  100. package/src/components/Form/FormSelectField/index.tsx +16 -16
  101. package/src/components/Form/index.ts +2 -2
  102. package/src/components/Header/index.tsx +20 -20
  103. package/src/components/Header/styles.module.scss +16 -16
  104. package/src/components/Link/index.tsx +21 -21
  105. package/src/components/Link/styles.module.scss +24 -24
  106. package/src/components/Navigation/index.tsx +30 -30
  107. package/src/components/Navigation/styles.module.scss +34 -34
  108. package/src/components/Page/index.tsx +35 -35
  109. package/src/components/Page/styles.module.scss +26 -26
  110. package/src/components/SharedContextProvider/index.tsx +30 -30
  111. package/src/components/index.ts +9 -9
  112. package/src/constants/Icons.ts +23 -23
  113. package/src/constants/QueryClient.ts +10 -10
  114. package/src/constants/index.ts +2 -2
  115. package/src/contexts/useStore.tsx +20 -20
  116. package/src/global.scss +124 -124
  117. package/src/hooks/activateEvaluationCycleQuery.hook.ts +15 -15
  118. package/src/hooks/activateQuestionnaireQuery.hook.ts +15 -15
  119. package/src/hooks/cancelEvaluationCycleQuery.hook.ts +15 -15
  120. package/src/hooks/cancelQuestionnaireQuery.hook.ts +15 -15
  121. package/src/hooks/deleteEvaluationCycleQuery.hook.ts +15 -15
  122. package/src/hooks/deleteQuestionnaireQuery.hook.ts +15 -15
  123. package/src/hooks/duplicateQuestionnaireQuery.hook.ts +14 -14
  124. package/src/hooks/finishEvaluationCycleQuery.hook.ts +15 -15
  125. package/src/hooks/finishQuestionnaireQuery.hook.ts +15 -15
  126. package/src/hooks/index.ts +44 -44
  127. package/src/hooks/useAllRolesQuery.hook.ts +25 -25
  128. package/src/hooks/useAllStoreQuery.hook.ts +39 -39
  129. package/src/hooks/useAnalyticsEvaluationCyclesQuery.hook.ts +21 -21
  130. package/src/hooks/useAnalyticsQuestionsQuery.hook.ts +22 -22
  131. package/src/hooks/useAnalyticsSideBarQuery.hook.ts +21 -21
  132. package/src/hooks/useAnalyticsUserIdQuery.hook.ts +24 -24
  133. package/src/hooks/useAnalyticsUserQuery.hook.ts +29 -27
  134. package/src/hooks/useAnswerIdQuery.hook.ts +13 -13
  135. package/src/hooks/useAnswerMutateQuery.hook.ts +31 -31
  136. package/src/hooks/useAnswersUserSupervisorQuery.hook.tsx +21 -21
  137. package/src/hooks/useApplicationDataQuery.hook.ts +10 -10
  138. package/src/hooks/useContractStatesQuery.hook.ts +14 -14
  139. package/src/hooks/useCountriesQuery.hook.ts +14 -14
  140. package/src/hooks/useCustomersQuery.hook.ts +30 -30
  141. package/src/hooks/useEvaluationCycleIdQuery.hook.ts +13 -13
  142. package/src/hooks/useEvaluationCycleMutateQuery.hook.ts +17 -17
  143. package/src/hooks/useEvaluationCycleQuery.hook.ts +27 -25
  144. package/src/hooks/useExpUsersAnswersQuery.hook.ts +25 -25
  145. package/src/hooks/useJobTitlesQuery.hook.ts +14 -14
  146. package/src/hooks/useProductHierarchies.hook.ts +12 -12
  147. package/src/hooks/useProductsQuery.hook.ts +30 -30
  148. package/src/hooks/useQuestionnaireIdQuery.hook.ts +13 -13
  149. package/src/hooks/useQuestionnaireMutateQuery.hook.ts +17 -17
  150. package/src/hooks/useQuestionnaireQuery.hook.ts +29 -27
  151. package/src/hooks/useSingleUserIdMutateQuery.hook.ts +18 -18
  152. package/src/hooks/useSingleUserIdQuery.hook.ts +14 -14
  153. package/src/hooks/useSingleUserResetPassword.hook.ts +15 -15
  154. package/src/hooks/useStoreQuery.ts +13 -13
  155. package/src/hooks/useTermNotificationQuery.hook.ts +11 -11
  156. package/src/hooks/useUpdateSupervisorMutateQuery.hook.ts +27 -27
  157. package/src/hooks/useUserBlockQuery.hook.ts +15 -15
  158. package/src/hooks/useUserEmailVerifQuery.hook.ts +15 -15
  159. package/src/hooks/useUserIdQuery.hook.ts +14 -14
  160. package/src/hooks/useUserListQuery.hook.ts +25 -25
  161. package/src/hooks/useUserQuery.hook.ts +31 -29
  162. package/src/index.ts +9 -9
  163. package/src/interfaces/AnalyticsEvaluationCycle.ts +24 -24
  164. package/src/interfaces/AnalyticsUserId.ts +13 -13
  165. package/src/interfaces/Answer.ts +13 -13
  166. package/src/interfaces/AnswersUserSupervisor.ts +45 -45
  167. package/src/interfaces/ApplicationsByCategory.ts +19 -19
  168. package/src/interfaces/Brand.ts +4 -4
  169. package/src/interfaces/Cart.ts +13 -13
  170. package/src/interfaces/Configuration.ts +7 -7
  171. package/src/interfaces/ContractStates.ts +7 -7
  172. package/src/interfaces/Countries.ts +10 -10
  173. package/src/interfaces/Customer.ts +23 -23
  174. package/src/interfaces/EvaluationCycle.ts +32 -32
  175. package/src/interfaces/ExpUsersAnswers.ts +16 -16
  176. package/src/interfaces/JobTitles.ts +7 -7
  177. package/src/interfaces/Product.ts +17 -17
  178. package/src/interfaces/ProductsHierarchies.ts +6 -6
  179. package/src/interfaces/Questionnaire.ts +38 -38
  180. package/src/interfaces/ResponseList.ts +6 -6
  181. package/src/interfaces/Roles.ts +5 -5
  182. package/src/interfaces/Store.ts +8 -8
  183. package/src/interfaces/TermNotification.ts +5 -5
  184. package/src/interfaces/User.ts +71 -69
  185. package/src/interfaces/index.ts +22 -22
  186. package/src/services/ApiService/index.ts +125 -125
  187. package/src/services/InitService/index.ts +7 -7
  188. package/src/services/index.ts +3 -3
  189. package/src/types/Global.d.ts +4 -4
  190. package/tsconfig.json +27 -27
  191. package/webpack.config.js +48 -48
@@ -1,25 +1,25 @@
1
- import { useQuery, UseQueryOptions } from "@tanstack/react-query";
2
- import { Roles, ResponseList } from "../interfaces";
3
- import { getAuth0 } from "../services";
4
-
5
- interface RolesQueryProps extends UseQueryOptions<ResponseList<"Roles", Roles>> {
6
- records: number | string;
7
- sortBy: string;
8
- sortDirection: string;
9
- tags?: string;
10
- page?: number;
11
- }
12
-
13
- export const useAllRolesQuery = ({ records, sortBy, sortDirection, tags, page, ...options }: RolesQueryProps) => {
14
- const queryKey = ['ROLES_QUERY', records, sortBy, sortDirection, tags, page];
15
-
16
- const queryFn = () => getAuth0<ResponseList<"Roles", Roles>>(`/Roles`, {
17
- pPage: 1,
18
- pRecords: records || 50,
19
- pSortBy: sortBy,
20
- pSortDirection: sortDirection,
21
- pTerms: tags,
22
- })
23
-
24
- return useQuery(queryKey, queryFn, options);
25
- }
1
+ import { useQuery, UseQueryOptions } from "@tanstack/react-query";
2
+ import { Roles, ResponseList } from "../interfaces";
3
+ import { getAuth0 } from "../services";
4
+
5
+ interface RolesQueryProps extends UseQueryOptions<ResponseList<"Roles", Roles>> {
6
+ records: number | string;
7
+ sortBy: string;
8
+ sortDirection: string;
9
+ tags?: string;
10
+ page?: number;
11
+ }
12
+
13
+ export const useAllRolesQuery = ({ records, sortBy, sortDirection, tags, page, ...options }: RolesQueryProps) => {
14
+ const queryKey = ['ROLES_QUERY', records, sortBy, sortDirection, tags, page];
15
+
16
+ const queryFn = () => getAuth0<ResponseList<"Roles", Roles>>(`/Roles`, {
17
+ pPage: 1,
18
+ pRecords: records || 50,
19
+ pSortBy: sortBy,
20
+ pSortDirection: sortDirection,
21
+ pTerms: tags,
22
+ })
23
+
24
+ return useQuery(queryKey, queryFn, options);
25
+ }
@@ -1,39 +1,39 @@
1
- import { useQuery, UseQueryOptions } from "@tanstack/react-query";
2
- import { Store, ResponseList } from "../interfaces";
3
- import { get } from "../services";
4
-
5
- interface StoreQueryProps extends UseQueryOptions<Store> {
6
- records: number | string;
7
- sortBy: string;
8
- sortDirection: string;
9
- page: number;
10
- tags?: string;
11
- advancedTags?: string;
12
- filter?: any;
13
- }
14
-
15
- export const useAllStoreQuery = ({ records, sortBy, sortDirection, tags, advancedTags, filter, page, ...options }: StoreQueryProps) => {
16
- const pQueryValue = advancedTags && filter
17
- ? `${advancedTags} and ${filter}`
18
- : advancedTags
19
- ? advancedTags
20
- : filter
21
- ? filter
22
- : '';
23
-
24
- return useQuery(['STORE_QUERY', records, sortBy, sortDirection, tags, advancedTags, filter, page],
25
- () => get<ResponseList<"Locations", Store>>(`/Franchise/Locations`, {
26
- pPage: page || 1,
27
- pRecords: records || 50,
28
- pSortBy: sortBy,
29
- pSortDirection: sortDirection,
30
- pTerms: tags,
31
- pQuery: pQueryValue,
32
- }),
33
- {
34
- keepPreviousData: true,
35
- }
36
- );
37
- }
38
-
39
-
1
+ import { useQuery, UseQueryOptions } from "@tanstack/react-query";
2
+ import { Store, ResponseList } from "../interfaces";
3
+ import { get } from "../services";
4
+
5
+ interface StoreQueryProps extends UseQueryOptions<Store> {
6
+ records: number | string;
7
+ sortBy: string;
8
+ sortDirection: string;
9
+ page: number;
10
+ tags?: string;
11
+ advancedTags?: string;
12
+ filter?: any;
13
+ }
14
+
15
+ export const useAllStoreQuery = ({ records, sortBy, sortDirection, tags, advancedTags, filter, page, ...options }: StoreQueryProps) => {
16
+ const pQueryValue = advancedTags && filter
17
+ ? `${advancedTags} and ${filter}`
18
+ : advancedTags
19
+ ? advancedTags
20
+ : filter
21
+ ? filter
22
+ : '';
23
+
24
+ return useQuery(['STORE_QUERY', records, sortBy, sortDirection, tags, advancedTags, filter, page],
25
+ () => get<ResponseList<"Locations", Store>>(`/Franchise/Locations`, {
26
+ pPage: page || 1,
27
+ pRecords: records || 50,
28
+ pSortBy: sortBy,
29
+ pSortDirection: sortDirection,
30
+ pTerms: tags,
31
+ pQuery: pQueryValue,
32
+ }),
33
+ {
34
+ keepPreviousData: true,
35
+ }
36
+ );
37
+ }
38
+
39
+
@@ -1,21 +1,21 @@
1
- import { useQuery, UseQueryOptions } from "@tanstack/react-query";
2
- import { AnalyticsEvaluationCycle } from "../interfaces";
3
- import { getAuth0 } from "../services/ApiService";
4
-
5
- export interface AnalyticsEvaluationCycles extends UseQueryOptions<AnalyticsEvaluationCycle[]> {
6
- pSortDirection?: string;
7
- pFilter?: string;
8
- }
9
-
10
- export const useAnalyticsEvaluationCyclesQueryHook = ({ pSortDirection, pFilter }: AnalyticsEvaluationCycles) => {
11
- return useQuery(
12
- ['ANALYTICS_EVALUATION_CYCLE_QUERY', pSortDirection, pFilter],
13
- () => getAuth0<AnalyticsEvaluationCycle[]>(`/APE/Analytics/EvaluationCycles`, {
14
- pPage: 1,
15
- pRecords: 50,
16
- pSortBy: pFilter || 'Type',
17
- pSortDirection: pSortDirection || 'asc',
18
- pFilter: pFilter || 'Type'
19
- }),
20
- );
21
- }
1
+ import { useQuery, UseQueryOptions } from "@tanstack/react-query";
2
+ import { AnalyticsEvaluationCycle } from "../interfaces";
3
+ import { getAuth0 } from "../services/ApiService";
4
+
5
+ export interface AnalyticsEvaluationCycles extends UseQueryOptions<AnalyticsEvaluationCycle[]> {
6
+ pSortDirection?: string;
7
+ pFilter?: string;
8
+ }
9
+
10
+ export const useAnalyticsEvaluationCyclesQueryHook = ({ pSortDirection, pFilter }: AnalyticsEvaluationCycles) => {
11
+ return useQuery(
12
+ ['ANALYTICS_EVALUATION_CYCLE_QUERY', pSortDirection, pFilter],
13
+ () => getAuth0<AnalyticsEvaluationCycle[]>(`/APE/Analytics/EvaluationCycles`, {
14
+ pPage: 1,
15
+ pRecords: 50,
16
+ pSortBy: pFilter || 'Type',
17
+ pSortDirection: pSortDirection || 'asc',
18
+ pFilter: pFilter || 'Type'
19
+ }),
20
+ );
21
+ }
@@ -1,22 +1,22 @@
1
- import { useQuery, UseQueryOptions } from "@tanstack/react-query";
2
- import { Answer, ResponseList } from "../interfaces";
3
- import { getAuth0 } from "../services/ApiService";
4
-
5
- export interface AnalyticsQuestionsQuery extends UseQueryOptions<ResponseList<"Answers", Answer>> {
6
- id: string;
7
- page?: number;
8
- records?: number;
9
- tags?: string;
10
- }
11
-
12
- export const useAnalyticsQuestionsQueryHook = ({ page, records, id, tags }: AnalyticsQuestionsQuery) => {
13
- return useQuery(
14
- ['ANALYTICS_QUESTIONS_QUERY', page, records, id, tags],
15
- () => getAuth0<ResponseList<"Answers", Answer>>(`/APE/Analytics/Questions`, {
16
- pId: id,
17
- pPage: page || 1,
18
- pRecords: records || 50,
19
- pTerms: tags,
20
- }),
21
- );
22
- }
1
+ import { useQuery, UseQueryOptions } from "@tanstack/react-query";
2
+ import { Answer, ResponseList } from "../interfaces";
3
+ import { getAuth0 } from "../services/ApiService";
4
+
5
+ export interface AnalyticsQuestionsQuery extends UseQueryOptions<ResponseList<"Answers", Answer>> {
6
+ id: string;
7
+ page?: number;
8
+ records?: number;
9
+ tags?: string;
10
+ }
11
+
12
+ export const useAnalyticsQuestionsQueryHook = ({ page, records, id, tags }: AnalyticsQuestionsQuery) => {
13
+ return useQuery(
14
+ ['ANALYTICS_QUESTIONS_QUERY', page, records, id, tags],
15
+ () => getAuth0<ResponseList<"Answers", Answer>>(`/APE/Analytics/Questions`, {
16
+ pId: id,
17
+ pPage: page || 1,
18
+ pRecords: records || 50,
19
+ pTerms: tags,
20
+ }),
21
+ );
22
+ }
@@ -1,21 +1,21 @@
1
- import { useQuery, UseQueryOptions } from "@tanstack/react-query";
2
- import { AnalyticsEvaluationCycle } from "../interfaces";
3
- import { getAuth0 } from "../services/ApiService";
4
-
5
- export interface AnalyticsSideBar extends UseQueryOptions<AnalyticsEvaluationCycle[]> {
6
- pSortDirection?: string;
7
- pFilter?: string;
8
- }
9
-
10
- export const useAnalyticsSideBarQueryHook = ({ pSortDirection, pFilter }: AnalyticsSideBar) => {
11
- return useQuery(
12
- ['ANALYTICS_SIDE_BAR_QUERY', pSortDirection, pFilter],
13
- () => getAuth0<AnalyticsEvaluationCycle[]>(`/APE/Analytics/EvaluationCycles/SideBar`, {
14
- pPage: 1,
15
- pRecords: 50,
16
- pSortBy: pFilter || 'Type',
17
- pSortDirection: pSortDirection || 'asc',
18
- pFilter: pFilter || 'Type'
19
- }),
20
- );
21
- }
1
+ import { useQuery, UseQueryOptions } from "@tanstack/react-query";
2
+ import { AnalyticsEvaluationCycle } from "../interfaces";
3
+ import { getAuth0 } from "../services/ApiService";
4
+
5
+ export interface AnalyticsSideBar extends UseQueryOptions<AnalyticsEvaluationCycle[]> {
6
+ pSortDirection?: string;
7
+ pFilter?: string;
8
+ }
9
+
10
+ export const useAnalyticsSideBarQueryHook = ({ pSortDirection, pFilter }: AnalyticsSideBar) => {
11
+ return useQuery(
12
+ ['ANALYTICS_SIDE_BAR_QUERY', pSortDirection, pFilter],
13
+ () => getAuth0<AnalyticsEvaluationCycle[]>(`/APE/Analytics/EvaluationCycles/SideBar`, {
14
+ pPage: 1,
15
+ pRecords: 50,
16
+ pSortBy: pFilter || 'Type',
17
+ pSortDirection: pSortDirection || 'asc',
18
+ pFilter: pFilter || 'Type'
19
+ }),
20
+ );
21
+ }
@@ -1,24 +1,24 @@
1
- import { useQuery, UseQueryOptions } from "@tanstack/react-query";
2
- import { AnalyticsUserId, ResponseList } from "../interfaces";
3
- import { getAuth0 } from "../services/ApiService";
4
-
5
- export interface AnalyticsUserIdQuery extends UseQueryOptions<ResponseList<"UserEvaluationCycleDTOs", AnalyticsUserId>> {
6
- page?: number;
7
- records?: number;
8
- pYear?: string;
9
- userId: string;
10
- }
11
-
12
- export const useAnalyticsUserIdQueryHook = ({ page, records, userId, pYear }: AnalyticsUserIdQuery) => {
13
- return useQuery(
14
- ['ANALYTICS_USER_ID_QUERY', page, records, userId, pYear],
15
- () => getAuth0<ResponseList<"UserEvaluationCycleDTOs", AnalyticsUserId>>(`/APE/Analytics/EvaluationCycles/User/${userId}`, {
16
- pPage: page || 1,
17
- pRecords: records || 50,
18
- pYear: pYear
19
- }),
20
- {
21
- keepPreviousData: true,
22
- }
23
- );
24
- }
1
+ import { useQuery, UseQueryOptions } from "@tanstack/react-query";
2
+ import { AnalyticsUserId, ResponseList } from "../interfaces";
3
+ import { getAuth0 } from "../services/ApiService";
4
+
5
+ export interface AnalyticsUserIdQuery extends UseQueryOptions<ResponseList<"UserEvaluationCycleDTOs", AnalyticsUserId>> {
6
+ page?: number;
7
+ records?: number;
8
+ pYear?: string;
9
+ userId: string;
10
+ }
11
+
12
+ export const useAnalyticsUserIdQueryHook = ({ page, records, userId, pYear }: AnalyticsUserIdQuery) => {
13
+ return useQuery(
14
+ ['ANALYTICS_USER_ID_QUERY', page, records, userId, pYear],
15
+ () => getAuth0<ResponseList<"UserEvaluationCycleDTOs", AnalyticsUserId>>(`/APE/Analytics/EvaluationCycles/User/${userId}`, {
16
+ pPage: page || 1,
17
+ pRecords: records || 50,
18
+ pYear: pYear
19
+ }),
20
+ {
21
+ keepPreviousData: true,
22
+ }
23
+ );
24
+ }
@@ -1,27 +1,29 @@
1
- import { useQuery, UseQueryOptions } from "@tanstack/react-query";
2
- import { User, ResponseList } from "../interfaces";
3
- import { getAuth0 } from "../services/ApiService";
4
-
5
- export interface AnalyticsUserQuery extends UseQueryOptions<ResponseList<"Users", User>> {
6
- tags?: string;
7
- filter?: string;
8
- page?: number;
9
- records?: number;
10
- }
11
-
12
- export const useAnalyticsUserQueryHook = ({ tags, page, records, filter }: AnalyticsUserQuery) => {
13
- return useQuery(
14
- ['ANALYTICS_USER_QUERY', tags, page, records, filter],
15
- () => getAuth0<ResponseList<"Users", User>>('/APE/Analytics/EvaluationCycle/Users', {
16
- pPage: page || 1,
17
- pRecords: records || 50,
18
- pSortBy: 'Type',
19
- pSortDirection: 'asc',
20
- pTerms: filter,
21
- pTermsUser: tags
22
- }),
23
- {
24
- keepPreviousData: true,
25
- }
26
- );
27
- }
1
+ import { useQuery, UseQueryOptions } from "@tanstack/react-query";
2
+ import { User, ResponseList } from "../interfaces";
3
+ import { getAuth0 } from "../services/ApiService";
4
+
5
+ export interface AnalyticsUserQuery extends UseQueryOptions<ResponseList<"Users", User>> {
6
+ tags?: string;
7
+ filter?: string;
8
+ page?: number;
9
+ records?: number;
10
+ sortBy?: string;
11
+ sortDirection?: string;
12
+ }
13
+
14
+ export const useAnalyticsUserQueryHook = ({ tags, page, records, filter, sortBy, sortDirection }: AnalyticsUserQuery) => {
15
+ return useQuery(
16
+ ['ANALYTICS_USER_QUERY', tags, page, records, filter, sortBy, sortDirection],
17
+ () => getAuth0<ResponseList<"Users", User>>('/APE/Analytics/EvaluationCycle/Users', {
18
+ pPage: page || 1,
19
+ pRecords: records || 50,
20
+ pSortBy: sortBy || 'Type',
21
+ pSortDirection: sortDirection || 'asc',
22
+ pTerms: filter,
23
+ pTermsUser: tags
24
+ }),
25
+ {
26
+ keepPreviousData: true,
27
+ }
28
+ );
29
+ }
@@ -1,13 +1,13 @@
1
- import { useQuery } from "@tanstack/react-query";
2
- import { Answer } from "../interfaces";
3
- import { getAuth0 } from "../services/ApiService";
4
-
5
- export const useAnswerIdQueryHook = (answerId: string) => {
6
- return useQuery(
7
- ['ANSWER_ID_QUERY', answerId],
8
- () => getAuth0<Answer>(`/APE/Answers/${answerId}`),
9
- {
10
- enabled: !!(answerId),
11
- },
12
- );
13
- }
1
+ import { useQuery } from "@tanstack/react-query";
2
+ import { Answer } from "../interfaces";
3
+ import { getAuth0 } from "../services/ApiService";
4
+
5
+ export const useAnswerIdQueryHook = (answerId: string) => {
6
+ return useQuery(
7
+ ['ANSWER_ID_QUERY', answerId],
8
+ () => getAuth0<Answer>(`/APE/Answers/${answerId}`),
9
+ {
10
+ enabled: !!(answerId),
11
+ },
12
+ );
13
+ }
@@ -1,31 +1,31 @@
1
- import { useMutation, useQueryClient, UseQueryOptions } from '@tanstack/react-query';
2
- import { Answer } from '../interfaces';
3
- import { putAuth0, postAuth0 } from '../services/ApiService';
4
-
5
- export interface AnswerQuery extends UseQueryOptions<Answer> {
6
- pQuestionnaireId?: string;
7
- pEvaluationCycleId?: string;
8
- pUserId?: string;
9
- pTargetUserId?: string;
10
- }
11
-
12
- export const useAnswerMutateHook = ({ pQuestionnaireId, pEvaluationCycleId, pUserId, pTargetUserId }: AnswerQuery, answerId: string) => {
13
- const queryClient = useQueryClient();
14
- return useMutation<Answer, unknown, Answer>((data: Answer) => {
15
- return answerId ?
16
- putAuth0(`/APE/Answers/${answerId}`, undefined, data) :
17
- postAuth0(`/APE/Answers?`, {
18
- pQuestionnaireId: pQuestionnaireId,
19
- pEvaluationCycleId: pEvaluationCycleId,
20
- pUserId: pUserId,
21
- pTargetUserId: pTargetUserId
22
- },
23
- data
24
- );
25
- }, {
26
- onSuccess: (data: Answer) => {
27
- queryClient.setQueryData(
28
- ['ANSWER_ID_QUERY'], data);
29
- },
30
- });
31
- }
1
+ import { useMutation, useQueryClient, UseQueryOptions } from '@tanstack/react-query';
2
+ import { Answer } from '../interfaces';
3
+ import { putAuth0, postAuth0 } from '../services/ApiService';
4
+
5
+ export interface AnswerQuery extends UseQueryOptions<Answer> {
6
+ pQuestionnaireId?: string;
7
+ pEvaluationCycleId?: string;
8
+ pUserId?: string;
9
+ pTargetUserId?: string;
10
+ }
11
+
12
+ export const useAnswerMutateHook = ({ pQuestionnaireId, pEvaluationCycleId, pUserId, pTargetUserId }: AnswerQuery, answerId: string) => {
13
+ const queryClient = useQueryClient();
14
+ return useMutation<Answer, unknown, Answer>((data: Answer) => {
15
+ return answerId ?
16
+ putAuth0(`/APE/Answers/${answerId}`, undefined, data) :
17
+ postAuth0(`/APE/Answers?`, {
18
+ pQuestionnaireId: pQuestionnaireId,
19
+ pEvaluationCycleId: pEvaluationCycleId,
20
+ pUserId: pUserId,
21
+ pTargetUserId: pTargetUserId
22
+ },
23
+ data
24
+ );
25
+ }, {
26
+ onSuccess: (data: Answer) => {
27
+ queryClient.setQueryData(
28
+ ['ANSWER_ID_QUERY'], data);
29
+ },
30
+ });
31
+ }
@@ -1,21 +1,21 @@
1
- import { useQuery, UseQueryOptions } from "@tanstack/react-query";
2
- import { AnswersUserSupervisor, ResponseList } from "../interfaces";
3
- import { getAuth0 } from "../services/ApiService";
4
-
5
- export interface AnswersUserSupervisorQuery extends UseQueryOptions<AnswersUserSupervisor> {
6
- evaluationId: string;
7
- userId: string;
8
- }
9
-
10
- export const useAnswersUserSupervisorQuery = ({ evaluationId, userId }: AnswersUserSupervisorQuery) => {
11
- return useQuery(
12
- ['ANSWERS_USER_SUPERVISOR_QUERY', evaluationId, userId],
13
- () => getAuth0<AnswersUserSupervisor>('/APE/Answers/UserAndSupervisor', {
14
- pUserId: userId,
15
- pEvaluationCycleId: evaluationId,
16
- }),
17
- {
18
- keepPreviousData: true,
19
- }
20
- );
21
- }
1
+ import { useQuery, UseQueryOptions } from "@tanstack/react-query";
2
+ import { AnswersUserSupervisor, ResponseList } from "../interfaces";
3
+ import { getAuth0 } from "../services/ApiService";
4
+
5
+ export interface AnswersUserSupervisorQuery extends UseQueryOptions<AnswersUserSupervisor> {
6
+ evaluationId: string;
7
+ userId: string;
8
+ }
9
+
10
+ export const useAnswersUserSupervisorQuery = ({ evaluationId, userId }: AnswersUserSupervisorQuery) => {
11
+ return useQuery(
12
+ ['ANSWERS_USER_SUPERVISOR_QUERY', evaluationId, userId],
13
+ () => getAuth0<AnswersUserSupervisor>('/APE/Answers/UserAndSupervisor', {
14
+ pUserId: userId,
15
+ pEvaluationCycleId: evaluationId,
16
+ }),
17
+ {
18
+ keepPreviousData: true,
19
+ }
20
+ );
21
+ }
@@ -1,10 +1,10 @@
1
- import { useQuery } from "@tanstack/react-query";
2
- import { ApplicationsByCategory, ResponseList } from "../interfaces";
3
- import { getAuth0 } from "../services/ApiService";
4
-
5
- export const useApplicationDataQueryHook = () => {
6
- return useQuery(
7
- ['APPLICATIONS_QUERY'],
8
- () => getAuth0<ResponseList<"Categories", ApplicationsByCategory>>('/Applications/groupByCategory')
9
- );
10
- }
1
+ import { useQuery } from "@tanstack/react-query";
2
+ import { ApplicationsByCategory, ResponseList } from "../interfaces";
3
+ import { getAuth0 } from "../services/ApiService";
4
+
5
+ export const useApplicationDataQueryHook = () => {
6
+ return useQuery(
7
+ ['APPLICATIONS_QUERY'],
8
+ () => getAuth0<ResponseList<"Categories", ApplicationsByCategory>>('/Applications/groupByCategory')
9
+ );
10
+ }
@@ -1,14 +1,14 @@
1
- import { useQuery, UseQueryOptions } from "@tanstack/react-query";
2
- import { ContractStates, ResponseList } from "../interfaces";
3
- import { getAuth0 } from "../services";
4
-
5
- interface ContractStatesQueryProps extends UseQueryOptions<ContractStates> {
6
- records: string;
7
- }
8
-
9
- export const useContractStatesQuery = ({ records }: ContractStatesQueryProps) => {
10
- return useQuery(
11
- ['CONTRACTSTATES_QUERY', records],
12
- () => getAuth0<ResponseList<"ContractStates", ContractStates>>(`/ContractStates`, { pPage: 1, pRecords: records || 195 })
13
- );
14
- }
1
+ import { useQuery, UseQueryOptions } from "@tanstack/react-query";
2
+ import { ContractStates, ResponseList } from "../interfaces";
3
+ import { getAuth0 } from "../services";
4
+
5
+ interface ContractStatesQueryProps extends UseQueryOptions<ContractStates> {
6
+ records: string;
7
+ }
8
+
9
+ export const useContractStatesQuery = ({ records }: ContractStatesQueryProps) => {
10
+ return useQuery(
11
+ ['CONTRACTSTATES_QUERY', records],
12
+ () => getAuth0<ResponseList<"ContractStates", ContractStates>>(`/ContractStates`, { pPage: 1, pRecords: records || 195 })
13
+ );
14
+ }
@@ -1,14 +1,14 @@
1
- import { useQuery, UseQueryOptions } from "@tanstack/react-query";
2
- import { Countries, ResponseList } from "../interfaces";
3
- import { get } from "../services";
4
-
5
- interface CountriesQueryProps extends UseQueryOptions<Countries> {
6
- records: string;
7
- }
8
-
9
- export const useCountriesQuery = ({ records }: CountriesQueryProps) => {
10
- return useQuery(
11
- ['COUNTRIES_QUERY', records],
12
- () => get<ResponseList<"Countries", Countries>>(`/Franchise/Countries`, { pPage: 1, pRecords: records || 195 })
13
- );
14
- }
1
+ import { useQuery, UseQueryOptions } from "@tanstack/react-query";
2
+ import { Countries, ResponseList } from "../interfaces";
3
+ import { get } from "../services";
4
+
5
+ interface CountriesQueryProps extends UseQueryOptions<Countries> {
6
+ records: string;
7
+ }
8
+
9
+ export const useCountriesQuery = ({ records }: CountriesQueryProps) => {
10
+ return useQuery(
11
+ ['COUNTRIES_QUERY', records],
12
+ () => get<ResponseList<"Countries", Countries>>(`/Franchise/Countries`, { pPage: 1, pRecords: records || 195 })
13
+ );
14
+ }
@@ -1,30 +1,30 @@
1
- import { get, Customer, ResponseList } from '..';
2
- import { useInfiniteQuery, useQuery, UseQueryOptions } from '@tanstack/react-query';
3
-
4
- export interface CustomersQuery extends UseQueryOptions<ResponseList<"Customers", Customer>> {
5
- page?: number;
6
- limit?: number;
7
- filterBy?: string;
8
- search?: string;
9
- }
10
-
11
- export const useCustomersQueryHook = ({ page, limit, ...options }: CustomersQuery) => {
12
- return useQuery<ResponseList<"Customers", Customer>>(['Customers', page, limit], () =>
13
- get('/CRMCustomers', { pPage: page, pRecords: limit || 50, pSource: 'Custom' }), options);
14
- };
15
-
16
- export const useCustomersInfiniteQueryHook = ({ filterBy, search }: Omit<CustomersQuery, 'page' | 'limit' > = {}) => {
17
- const infiniteQuery = useInfiniteQuery(['Customers_Infinite', filterBy, search], ({ pageParam = 1 }) =>
18
- get<ResponseList<"Customers", Customer>>('/CRMCustomers', {
19
- pPage: pageParam, pRecords: 50, pSource: 'Custom',
20
- }));
21
-
22
- const pagesMulti = infiniteQuery.data?.pages?.map((page) => (page.Customers as Customer[]) || []) || [];
23
- const allDataGrouped = ([] as Customer[]).concat(...pagesMulti);
24
-
25
- return {
26
- ...infiniteQuery,
27
- count: infiniteQuery.data?.pages?.[0].Count || 0,
28
- data: allDataGrouped,
29
- }
30
- };
1
+ import { get, Customer, ResponseList } from '..';
2
+ import { useInfiniteQuery, useQuery, UseQueryOptions } from '@tanstack/react-query';
3
+
4
+ export interface CustomersQuery extends UseQueryOptions<ResponseList<"Customers", Customer>> {
5
+ page?: number;
6
+ limit?: number;
7
+ filterBy?: string;
8
+ search?: string;
9
+ }
10
+
11
+ export const useCustomersQueryHook = ({ page, limit, ...options }: CustomersQuery) => {
12
+ return useQuery<ResponseList<"Customers", Customer>>(['Customers', page, limit], () =>
13
+ get('/CRMCustomers', { pPage: page, pRecords: limit || 50, pSource: 'Custom' }), options);
14
+ };
15
+
16
+ export const useCustomersInfiniteQueryHook = ({ filterBy, search }: Omit<CustomersQuery, 'page' | 'limit' > = {}) => {
17
+ const infiniteQuery = useInfiniteQuery(['Customers_Infinite', filterBy, search], ({ pageParam = 1 }) =>
18
+ get<ResponseList<"Customers", Customer>>('/CRMCustomers', {
19
+ pPage: pageParam, pRecords: 50, pSource: 'Custom',
20
+ }));
21
+
22
+ const pagesMulti = infiniteQuery.data?.pages?.map((page) => (page.Customers as Customer[]) || []) || [];
23
+ const allDataGrouped = ([] as Customer[]).concat(...pagesMulti);
24
+
25
+ return {
26
+ ...infiniteQuery,
27
+ count: infiniteQuery.data?.pages?.[0].Count || 0,
28
+ data: allDataGrouped,
29
+ }
30
+ };