npm-pkg-hook 1.1.5 → 1.1.9

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 (144) hide show
  1. package/.eslintrc.js +19 -113
  2. package/.eslintrc.json +127 -108
  3. package/.github/pull_request_template.md +17 -17
  4. package/.github/workflows/pepeline.yaml +29 -29
  5. package/next.config.js +2 -5
  6. package/package.json +27 -24
  7. package/script.txt +6 -6
  8. package/src/config/client/errors.js +14 -14
  9. package/src/config/client/index.js +1 -1
  10. package/src/hooks/getCategoriesWithProduct/helpers/index.js +7 -0
  11. package/src/hooks/getCategoriesWithProduct/index.js +62 -0
  12. package/src/hooks/getSession/index.js +18 -18
  13. package/src/hooks/index.js +13 -9
  14. package/src/hooks/useAcumulateDate/index.js +1 -1
  15. package/src/hooks/useAnimationFrame/index.js +45 -45
  16. package/src/hooks/useAsideCart/helpers/index.js +22 -0
  17. package/src/hooks/useAsideCart/index.js +156 -0
  18. package/src/hooks/useAsideCart/queries.js +10 -0
  19. package/src/hooks/useBanner/index.js +11 -11
  20. package/src/hooks/useCart/index.js +2 -0
  21. package/src/hooks/useCart/queries.js +164 -0
  22. package/src/hooks/useCart/useCart/helpers/index.js +75 -0
  23. package/src/hooks/useCart/useCart/index.js +411 -0
  24. package/src/hooks/useCart/useGetCart/index.js +31 -0
  25. package/src/hooks/useCatWithProduct/index.js +15 -15
  26. package/src/hooks/useCatWithProduct/queries.js +1 -1
  27. package/src/hooks/useCatWithProductClient/index.js +48 -0
  28. package/src/hooks/useCatWithProductClient/queries.js +55 -0
  29. package/src/hooks/useCategoriesProduct/index.js +12 -12
  30. package/src/hooks/useCategoriesProduct/queries.js +16 -16
  31. package/src/hooks/useCategoryInStore/index.js +39 -36
  32. package/src/hooks/useCategoryInStore/queries.js +78 -78
  33. package/src/hooks/useCategoryStore/index.js +2 -2
  34. package/src/hooks/useChartData/index.js +159 -156
  35. package/src/hooks/useChartData/useChartData/index.js +199 -197
  36. package/src/hooks/useChartData/useChartDataAllOrders/index.js +94 -94
  37. package/src/hooks/useCheckbox/index.js +115 -115
  38. package/src/hooks/useClients/index.js +12 -14
  39. package/src/hooks/useClients/queries.js +1 -1
  40. package/src/hooks/useConnection/index.js +20 -21
  41. package/src/hooks/useCreateProduct/helpers/useEditImageProduct/index.js +6 -2
  42. package/src/hooks/useCreateProduct/index.js +22 -19
  43. package/src/hooks/useDeleteSubProductOptional/index.js +31 -30
  44. package/src/hooks/useDeleteSubProductOptional/queries.js +10 -10
  45. package/src/hooks/useDessert/helpers/index.js +51 -51
  46. package/src/hooks/useDessert/index.js +56 -65
  47. package/src/hooks/useDevices/index.js +35 -36
  48. package/src/hooks/useDevices/queries.js +19 -19
  49. package/src/hooks/useDropzone/index.js +94 -79
  50. package/src/hooks/useDynamicAuth/index.js +13 -13
  51. package/src/hooks/useDynamicAuth/queries.js +24 -24
  52. package/src/hooks/useEmployee/queries.js +1 -1
  53. package/src/hooks/useEvent/index.js +33 -33
  54. package/src/hooks/useFavoriteStores/index.js +19 -0
  55. package/src/hooks/useFavoriteStores/queries.js +47 -0
  56. package/src/hooks/useFetchJson/index.js +25 -25
  57. package/src/hooks/useFingerprintjs/index.js +172 -176
  58. package/src/hooks/useFormTools/index.js +12 -11
  59. package/src/hooks/useFormatDate/index.js +20 -21
  60. package/src/hooks/useFormatNumberPhone/index.js +9 -9
  61. package/src/hooks/useFullScreenMode/index.js +65 -65
  62. package/src/hooks/useGenerateNumberArray/index.js +17 -17
  63. package/src/hooks/useGetExtProductFoodsSubOptionalAll/index.js +14 -0
  64. package/src/hooks/useGetFoodRecomended/index.js +33 -0
  65. package/src/hooks/useGetFoodRecomended/queries.js +47 -0
  66. package/src/hooks/useGetMinPrice/index.js +8 -0
  67. package/src/hooks/useGetMinPrice/queries.js +7 -0
  68. package/src/hooks/useGetOneStoreRating/index.js +40 -0
  69. package/src/hooks/useGetOneStoreRating/queries.js +18 -0
  70. package/src/hooks/useGoogleLogin/index.js +160 -161
  71. package/src/hooks/useHover/index.js +29 -29
  72. package/src/hooks/useImageOptimization/index.js +15 -15
  73. package/src/hooks/useImageWeight/index.js +18 -19
  74. package/src/hooks/useImagesStore/index.js +139 -140
  75. package/src/hooks/useImagesStore/queries.js +19 -18
  76. package/src/hooks/useInnerHtml/index.js +39 -38
  77. package/src/hooks/useIntersection/index.js +4 -4
  78. package/src/hooks/useKeypress/index.js +28 -28
  79. package/src/hooks/useLazyScript/index.js +35 -36
  80. package/src/hooks/useLocalSorage/index.js +2 -2
  81. package/src/hooks/useLocationNavigate/index.js +54 -54
  82. package/src/hooks/useLogout/index.js +24 -24
  83. package/src/hooks/useManageQueryParams/index.js +36 -37
  84. package/src/hooks/useMobile/index.js +39 -38
  85. package/src/hooks/useMutateHeight/index.js +15 -16
  86. package/src/hooks/useOrderClient/index.js +5 -0
  87. package/src/hooks/useOrders/index.js +10 -16
  88. package/src/hooks/useOrders/queries.js +1 -1
  89. package/src/hooks/useProductsFood/index.js +32 -32
  90. package/src/hooks/useProductsFood/queriesStore.js +49 -48
  91. package/src/hooks/useProductsFood/useEditProduct.js +2 -4
  92. package/src/hooks/useProductsFood/usetagsProducts.js +83 -83
  93. package/src/hooks/useProviders/index.js +3 -3
  94. package/src/hooks/useProviders/queries.js +31 -31
  95. package/src/hooks/useProviders/useProvidersCreateStore/index.js +12 -13
  96. package/src/hooks/useProviders/useProvidersDataStore/index.js +24 -24
  97. package/src/hooks/useProvidersStore/index.js +24 -24
  98. package/src/hooks/useProvidersStore/queries.js +31 -31
  99. package/src/hooks/useRatingArrayData/index.js +54 -0
  100. package/src/hooks/{useRatingData → useRatingArrayData}/queries.js +19 -18
  101. package/src/hooks/useReactToPrint/index.js +1120 -1098
  102. package/src/hooks/useRemoveExtraProductFoodsOptional/index.js +23 -23
  103. package/src/hooks/useRemoveExtraProductFoodsOptional/queries.js +48 -48
  104. package/src/hooks/useReport/index.js +9 -9
  105. package/src/hooks/useReport/queries.js +1 -1
  106. package/src/hooks/useRestaurant/index.js +19 -19
  107. package/src/hooks/useRestaurant/queries.js +80 -80
  108. package/src/hooks/useSales/index.js +476 -451
  109. package/src/hooks/useSales/queries.js +14 -15
  110. package/src/hooks/useSales/useGetAllSales/index.js +25 -25
  111. package/src/hooks/useSales/useTotalSales.js +18 -18
  112. package/src/hooks/useSaveAvailableProduct/helpers/index.js +29 -29
  113. package/src/hooks/useSaveAvailableProduct/index.js +16 -16
  114. package/src/hooks/useSaveAvailableProduct/queries.js +1 -1
  115. package/src/hooks/useSchedule/index.js +33 -36
  116. package/src/hooks/useSchedule/index.jsx +22 -22
  117. package/src/hooks/useSchedule/queries.js +34 -35
  118. package/src/hooks/useScheduleData/index.js +123 -171
  119. package/src/hooks/useScroll/index.js +56 -57
  120. package/src/hooks/useScrollRotate/index.js +16 -14
  121. package/src/hooks/useSetSession/index.js +16 -16
  122. package/src/hooks/useSetState/index.js +3 -3
  123. package/src/hooks/useStatusOpenStore/helpers/index.js +101 -102
  124. package/src/hooks/useStatusOpenStore/index.js +172 -173
  125. package/src/hooks/useStatusOrdersClient/helpers/index.js +14 -0
  126. package/src/hooks/useStatusOrdersClient/index.js +17 -0
  127. package/src/hooks/useStatusOrdersClient/queries.js +80 -0
  128. package/src/hooks/useStore/index.js +40 -25
  129. package/src/hooks/useStore/queries.js +162 -136
  130. package/src/hooks/useStoreCalendar/index.js +5 -7
  131. package/src/hooks/useStoreContacts/index.js +16 -16
  132. package/src/hooks/useStoreContacts/queries.js +1 -1
  133. package/src/hooks/useTimeAgo/useTimeAgo.js +39 -39
  134. package/src/hooks/useUpdateCart/index.js +34 -28
  135. package/src/hooks/useUpdateExistingOrders/index.js +35 -35
  136. package/src/hooks/useUpdateExtProductFoodsSubOptional/index.js +38 -37
  137. package/src/hooks/useUser/index.js +1 -1
  138. package/src/hooks/useUser/queries.js +1 -1
  139. package/src/hooks/useWindowSize/index.js +38 -38
  140. package/src/mock/dessert/index.js +16 -16
  141. package/src/mock/index.js +1 -2
  142. package/src/utils/index.js +42 -45
  143. package/src/hooks/useRatingData/index.js +0 -53
  144. package/src/hooks/useSalesClient/index.js +0 -1
@@ -1,72 +1,71 @@
1
- import React, { useEffect, useState } from 'react';
1
+ import { useEffect, useState } from 'react'
2
2
 
3
3
  export const useLazyScript = (src, delay = null) => {
4
- const [status, setStatus] = useState(src ? 'loading' : 'idle');
4
+ const [status, setStatus] = useState(src ? 'loading' : 'idle')
5
5
 
6
6
  useEffect(() => {
7
7
  if (!src) {
8
- setStatus('idle');
9
- return 'idle';
8
+ setStatus('idle')
9
+ return 'idle'
10
10
  }
11
11
 
12
- let script = document.querySelector(`script[src='${src}']`);
13
- let timeout = null;
12
+ let script = document.querySelector(`script[src='${src}']`)
13
+ let timeout = null
14
14
 
15
15
  if (!script) {
16
16
  if (delay) {
17
17
  timeout = setTimeout(() => {
18
- injectScript();
18
+ injectScript()
19
19
  // Add event listener after the script is added
20
- script.addEventListener('load', setStateStatus);
21
- script.addEventListener('error', setStateStatus);
22
- }, delay);
20
+ script.addEventListener('load', setStateStatus)
21
+ script.addEventListener('error', setStateStatus)
22
+ }, delay)
23
23
  } else {
24
- injectScript();
24
+ injectScript()
25
25
  }
26
26
  } else {
27
- setStatus(script.getAttribute('data-status'));
27
+ setStatus(script.getAttribute('data-status'))
28
28
  }
29
29
 
30
30
  const setStateStatus = (event) => {
31
- setStatus(event.type === 'load' ? 'ready' : 'error');
32
- };
31
+ setStatus(event.type === 'load' ? 'ready' : 'error')
32
+ }
33
33
 
34
- //code to inject script
35
- function injectScript() {
36
- script = document.createElement('script');
37
- script.src = src;
38
- script.async = true;
39
- script.setAttribute('data-status', 'loading');
40
- document.body.appendChild(script);
34
+ // code to inject script
35
+ function injectScript () {
36
+ script = document.createElement('script')
37
+ script.src = src
38
+ script.async = true
39
+ script.setAttribute('data-status', 'loading')
40
+ document.body.appendChild(script)
41
41
 
42
42
  const setDataStatus = (event) => {
43
43
  script.setAttribute(
44
44
  'data-status',
45
45
  event.type === 'load' ? 'ready' : 'error'
46
- );
47
- };
46
+ )
47
+ }
48
48
 
49
- script.addEventListener('load', setDataStatus);
50
- script.addEventListener('error', setDataStatus);
49
+ script.addEventListener('load', setDataStatus)
50
+ script.addEventListener('error', setDataStatus)
51
51
  }
52
52
 
53
53
  if (script) {
54
- //script will be be undefined available when its delayed hence check it before adding listener
55
- script.addEventListener('load', setStateStatus);
56
- script.addEventListener('error', setStateStatus);
54
+ // script will be be undefined available when its delayed hence check it before adding listener
55
+ script.addEventListener('load', setStateStatus)
56
+ script.addEventListener('error', setStateStatus)
57
57
  }
58
58
 
59
59
  return () => {
60
60
  if (script) {
61
- script.removeEventListener('load', setStateStatus);
62
- script.removeEventListener('error', setStateStatus);
61
+ script.removeEventListener('load', setStateStatus)
62
+ script.removeEventListener('error', setStateStatus)
63
63
  }
64
64
  if (timeout) {
65
- clearTimeout(timeout);
65
+ clearTimeout(timeout)
66
66
  }
67
- };
68
- }, [src]);
69
-
70
- return status;
71
- };
67
+ }
68
+ }, [src])
72
69
 
70
+ return status
71
+ }
@@ -1,6 +1,6 @@
1
1
  import { useState } from 'react'
2
2
 
3
- export const useLocalStorage= (key, initialValue) => {
3
+ export const useLocalStorage = (key, initialValue) => {
4
4
  // const { setAlertBox } = useContext(Context)
5
5
  // State to store our value
6
6
  // Pass initial state function to useState so logic is only executed once
@@ -33,4 +33,4 @@ export const useLocalStorage= (key, initialValue) => {
33
33
  }
34
34
 
35
35
  return [storedValue, setValue]
36
- }
36
+ }
@@ -1,54 +1,54 @@
1
- import { useEffect, useState } from 'react'
2
-
3
- const defaultSettings = {
4
- enableHighAccuracy: false,
5
- timeout: Infinity,
6
- maximumAge: 0
7
- }
8
-
9
- export const usePosition = (watch = false, settings = defaultSettings) => {
10
- const [position, setPosition] = useState({})
11
- const [error, setError] = useState(null)
12
-
13
- const onChange = ({ coords, timestamp }) => {
14
- setPosition({
15
- latitude: coords.latitude,
16
- longitude: coords.longitude,
17
- accuracy: coords.accuracy,
18
- speed: coords.speed,
19
- timestamp
20
- })
21
- }
22
-
23
- const onError = () => {
24
- setError(error?.message)
25
- }
26
-
27
- useEffect(() => {
28
- if (!navigator || !navigator.geolocation) {
29
- setError('Geolocation is not supported')
30
- return
31
- }
32
-
33
- let watcher = null
34
- if (watch) {
35
- watcher = navigator.geolocation.watchPosition(
36
- onChange,
37
- onError,
38
- settings
39
- )
40
- } else {
41
- navigator.geolocation.getCurrentPosition(onChange, onError, settings)
42
- }
43
-
44
- return () => { return watcher && navigator.geolocation.clearWatch(watcher) }
45
- }, [
46
- settings,
47
- settings.enableHighAccuracy,
48
- settings.timeout,
49
- settings.maximumAge,
50
- watch
51
- ])
52
-
53
- return { ...position, error }
54
- }
1
+ import { useEffect, useState } from 'react'
2
+
3
+ const defaultSettings = {
4
+ enableHighAccuracy: false,
5
+ timeout: Infinity,
6
+ maximumAge: 0
7
+ }
8
+
9
+ export const usePosition = (watch = false, settings = defaultSettings) => {
10
+ const [position, setPosition] = useState({})
11
+ const [error, setError] = useState(null)
12
+
13
+ const onChange = ({ coords, timestamp }) => {
14
+ setPosition({
15
+ latitude: coords.latitude,
16
+ longitude: coords.longitude,
17
+ accuracy: coords.accuracy,
18
+ speed: coords.speed,
19
+ timestamp
20
+ })
21
+ }
22
+
23
+ const onError = () => {
24
+ setError(error?.message)
25
+ }
26
+
27
+ useEffect(() => {
28
+ if (!navigator || !navigator.geolocation) {
29
+ setError('Geolocation is not supported')
30
+ return
31
+ }
32
+
33
+ let watcher = null
34
+ if (watch) {
35
+ watcher = navigator.geolocation.watchPosition(
36
+ onChange,
37
+ onError,
38
+ settings
39
+ )
40
+ } else {
41
+ navigator.geolocation.getCurrentPosition(onChange, onError, settings)
42
+ }
43
+
44
+ return () => { return watcher && navigator.geolocation.clearWatch(watcher) }
45
+ }, [
46
+ settings,
47
+ settings.enableHighAccuracy,
48
+ settings.timeout,
49
+ settings.maximumAge,
50
+ watch
51
+ ])
52
+
53
+ return { ...position, error }
54
+ }
@@ -1,35 +1,35 @@
1
- import { useApolloClient } from '@apollo/client';
2
- import { useState, useCallback } from 'react'
3
- import { useRouter } from 'next/router';
4
- import { Cookies } from '../../cookies';
1
+ import { useApolloClient } from '@apollo/client'
2
+ import { useState } from 'react'
3
+ import { useRouter } from 'next/router'
4
+ import { Cookies } from '../../cookies'
5
5
 
6
- export const useLogout = ({ setAlertBox = () => { } } = {}) => {
6
+ export const useLogout = ({ setAlertBox = () => { } } = {}) => {
7
7
  const [loading, setLoading] = useState(false)
8
8
  const [error, setError] = useState(false)
9
- const router = useRouter();
10
- const client = useApolloClient();
9
+ const router = useRouter()
10
+ const client = useApolloClient()
11
11
 
12
12
  const onClickLogout = async () => {
13
13
  setLoading(true)
14
14
  await window
15
- .fetch(`${process.env.URL_BASE}api/auth/logout/`, {})
15
+ .fetch(`${process.env.URL_BASE}/api/auth/logout/`, {})
16
16
  .then(res => {
17
17
  if (res) {
18
- localStorage.removeItem('session');
19
- localStorage.removeItem('usuario');
20
- localStorage.removeItem('location');
21
- localStorage.removeItem('sessionGoogle');
22
- localStorage.removeItem('namefood');
23
- localStorage.removeItem('longitude');
24
- localStorage.removeItem('latitude');
25
- localStorage.removeItem('userlogin');
26
- localStorage.removeItem('restaurant');
27
- Cookies.remove('vp.store');
28
- Cookies.remove('app.cart.sales');
29
- Cookies.remove('restaurant');
30
- client?.clearStore();
31
- router.replace('/entrar');
32
- setLoading(false);
18
+ localStorage.removeItem('session')
19
+ localStorage.removeItem('usuario')
20
+ localStorage.removeItem('location')
21
+ localStorage.removeItem('sessionGoogle')
22
+ localStorage.removeItem('namefood')
23
+ localStorage.removeItem('longitude')
24
+ localStorage.removeItem('latitude')
25
+ localStorage.removeItem('userlogin')
26
+ localStorage.removeItem('restaurant')
27
+ Cookies.remove('vp.store')
28
+ Cookies.remove('app.cart.sales')
29
+ Cookies.remove('restaurant')
30
+ client?.clearStore()
31
+ router.replace('/entrar')
32
+ setLoading(false)
33
33
  }
34
34
  })
35
35
  .catch(() => {
@@ -40,4 +40,4 @@ export const useLogout = ({ setAlertBox = () => { } } = {}) => {
40
40
  }
41
41
 
42
42
  return [onClickLogout, { loading, error }]
43
- }
43
+ }
@@ -1,37 +1,36 @@
1
- import { useRouter } from 'next/router'
2
- // Hola mundo
3
- export const useManageQueryParams = () => {
4
- const router = useRouter()
5
-
6
- const handleQuery = (name, value = '') => {
7
- router.push(
8
- {
9
- query: {
10
- ...router.query,
11
- [name]: value
12
- }
13
- },
14
- undefined,
15
- { shallow: true }
16
- )
17
- }
18
-
19
- const handleCleanQuery = (name, value = '') => {
20
- router.push(
21
- {
22
- query: {
23
- ...router.query,
24
- [name]: value || ''
25
- }
26
- },
27
- undefined,
28
- { shallow: true }
29
- )
30
- }
31
-
32
-
33
- return {
34
- handleQuery,
35
- handleCleanQuery
36
- }
37
- }
1
+ import { useRouter } from 'next/router'
2
+ // Hola mundo
3
+ export const useManageQueryParams = () => {
4
+ const router = useRouter()
5
+
6
+ const handleQuery = (name, value = '') => {
7
+ router.push(
8
+ {
9
+ query: {
10
+ ...router.query,
11
+ [name]: value
12
+ }
13
+ },
14
+ undefined,
15
+ { shallow: true }
16
+ )
17
+ }
18
+
19
+ const handleCleanQuery = (name, value = '') => {
20
+ router.push(
21
+ {
22
+ query: {
23
+ ...router.query,
24
+ [name]: value || ''
25
+ }
26
+ },
27
+ undefined,
28
+ { shallow: true }
29
+ )
30
+ }
31
+
32
+ return {
33
+ handleQuery,
34
+ handleCleanQuery
35
+ }
36
+ }
@@ -1,38 +1,39 @@
1
- import { useEffect, useState } from 'react';
2
-
3
- export const useMobile = (props) => {
4
- const { callBack = () => { return null; } } = props || {};
5
- const [innerHeight, setInnerHeight] = useState();
6
- const [innerWidth, setInnerWidth] = useState();
7
- let isMobile = false;
8
- useEffect(() => {
9
- setInnerHeight(window.innerHeight);
10
- setInnerWidth(window.innerWidth);
11
- callBack();
12
- }, []);
13
- useEffect(() => {
14
- const handleResize = () => {
15
- if (!isNaN(window === null || window === void 0 ? void 0 : window.innerHeight) && (window === null || window === void 0 ? void 0 : window.innerHeight) != innerHeight) {
16
- setInnerHeight(window.innerHeight);
17
- }
18
- if (!isNaN(window.innerWidth) && window.innerWidth != innerWidth) {
19
- setInnerWidth(window.innerWidth);
20
- }
21
- callBack();
22
- };
23
- if (typeof window !== 'undefined') {
24
- window.addEventListener('resize', handleResize);
25
- }
26
- return () => {
27
- window.removeEventListener('resize', handleResize);
28
- };
29
- });
30
- if (typeof window !== 'undefined' && /Mobile/i.test((navigator === null || navigator === void 0 ? void 0 : navigator.userAgent) || (navigator === null || navigator === void 0 ? void 0 : navigator.vendor))) {
31
- isMobile = true;
32
- }
33
- return {
34
- isMobile,
35
- innerHeight,
36
- innerWidth
37
- };
38
- };
1
+ /* eslint-disable no-void */
2
+ import { useEffect, useState } from 'react'
3
+
4
+ export const useMobile = (props) => {
5
+ const { callBack = () => { return null } } = props || {}
6
+ const [innerHeight, setInnerHeight] = useState()
7
+ const [innerWidth, setInnerWidth] = useState()
8
+ let isMobile = false
9
+ useEffect(() => {
10
+ setInnerHeight(window.innerHeight)
11
+ setInnerWidth(window.innerWidth)
12
+ callBack()
13
+ }, [])
14
+ useEffect(() => {
15
+ const handleResize = () => {
16
+ if (!isNaN(window === null || window === void 0 ? void 0 : window.innerHeight) && (window === null || window === void 0 ? void 0 : window.innerHeight) !== innerHeight) {
17
+ setInnerHeight(window.innerHeight)
18
+ }
19
+ if (!isNaN(window.innerWidth) && window.innerWidth !== innerWidth) {
20
+ setInnerWidth(window.innerWidth)
21
+ }
22
+ callBack()
23
+ }
24
+ if (typeof window !== 'undefined') {
25
+ window.addEventListener('resize', handleResize)
26
+ }
27
+ return () => {
28
+ window.removeEventListener('resize', handleResize)
29
+ }
30
+ })
31
+ if (typeof window !== 'undefined' && /Mobile/i.test((navigator === null || navigator === void 0 ? void 0 : navigator.userAgent) || (navigator === null || navigator === void 0 ? void 0 : navigator.vendor))) {
32
+ isMobile = true
33
+ }
34
+ return {
35
+ isMobile,
36
+ innerHeight,
37
+ innerWidth
38
+ }
39
+ }
@@ -2,36 +2,35 @@ import {
2
2
  useEffect,
3
3
  useRef,
4
4
  useState
5
- } from 'react';
5
+ } from 'react'
6
6
 
7
-
8
- export const useMutateHeight = ({ isCollapsed = false }) => {
9
- const [collapsed, setCollapsed] = useState(isCollapsed);
10
- const childrenContainerRef = useRef(null);
7
+ export const useMutateHeight = ({ isCollapsed = false }) => {
8
+ const [collapsed, setCollapsed] = useState(isCollapsed)
9
+ const childrenContainerRef = useRef(null)
11
10
 
12
11
  useEffect(() => {
13
- setCollapsed(isCollapsed);
12
+ setCollapsed(isCollapsed)
14
13
  if (childrenContainerRef.current !== null) {
15
14
  const height = isCollapsed
16
15
  ? childrenContainerRef.current.scrollHeight
17
- : 0;
18
- childrenContainerRef.current.style.height = `${height}px`;
16
+ : 0
17
+ childrenContainerRef.current.style.height = `${height}px`
19
18
  }
20
- }, [isCollapsed]);
19
+ }, [isCollapsed])
21
20
 
22
21
  const handleCollapsed = visible => {
23
- setCollapsed(visible);
22
+ setCollapsed(visible)
24
23
  if (childrenContainerRef.current !== null) {
25
- const height = visible ? childrenContainerRef.current.scrollHeight : 0;
26
- childrenContainerRef.current.style.height = `${height}px`;
24
+ const height = visible ? childrenContainerRef.current.scrollHeight : 0
25
+ childrenContainerRef.current.style.height = `${height}px`
27
26
  }
28
- };
27
+ }
29
28
 
30
29
  return {
31
30
  handleCollapsed,
32
31
  childrenContainerRef,
33
32
  collapsed
34
- };
35
- };
33
+ }
34
+ }
36
35
 
37
- // https://codesandbox.io/s/dropdown-navigation-9fx6r?file=/src/Navigation/Navigation.js:357-775
36
+ // https://codesandbox.io/s/dropdown-navigation-9fx6r?file=/src/Navigation/Navigation.js:357-775
@@ -0,0 +1,5 @@
1
+ export const useOrderClient = () => {
2
+ return {
3
+
4
+ }
5
+ }
@@ -1,8 +1,4 @@
1
- /* eslint-disable react-hooks/exhaustive-deps */
2
1
  import { useQuery } from '@apollo/client'
3
- import {
4
- useState
5
- } from 'react'
6
2
  import { GET_ALL_PEDIDOS, GET_ALL_PEDIDOS_FROM_STORE } from './queries'
7
3
 
8
4
  export const useOrders = ({
@@ -19,19 +15,17 @@ export const useOrders = ({
19
15
  }) => {
20
16
  const { data, loading, error, fetchMore } = useQuery(GET_ALL_PEDIDOS, {
21
17
  notifyOnNetworkStatusChange: true,
22
- refetchWritePolicy: refetchWritePolicy,
18
+ refetchWritePolicy,
23
19
  pollInterval,
24
20
  fetchPolicy,
25
21
  refetch,
26
22
  refetchReadPolicy,
27
- nextFetchPolicy: nextFetchPolicy,
28
- onError: onError
29
- ? onError
30
- : () => {
31
- return
32
- },
23
+ nextFetchPolicy,
24
+ onError: onError || (() => {
25
+
26
+ }),
33
27
  variables: {
34
- statusOrder: statusOrder,
28
+ statusOrder,
35
29
  fromDate,
36
30
  toDate
37
31
  }
@@ -73,9 +67,9 @@ export const useOrdersFromStore = ({
73
67
  max,
74
68
  statusOrder
75
69
  }
76
- });
70
+ })
77
71
 
78
- return [data?.getAllOrdersFromStore || [], { loading: called ? false: loading, error }];
79
- };
72
+ return [data?.getAllOrdersFromStore || [], { loading: called ? false : loading, error }]
73
+ }
80
74
 
81
- export * from './queries'
75
+ export * from './queries'
@@ -325,4 +325,4 @@ query getAllOrdersFromStore(
325
325
  }
326
326
 
327
327
 
328
- `
328
+ `