npm-pkg-hook 1.3.7 → 1.3.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 (95) hide show
  1. package/.eslintrc.js +38 -38
  2. package/.eslintrc.json +127 -127
  3. package/.github/pull_request_template.md +17 -17
  4. package/.github/workflows/pepeline.yaml +29 -29
  5. package/package.json +46 -46
  6. package/script.txt +6 -6
  7. package/src/config/client/index.js +1 -1
  8. package/src/hooks/getCategoriesWithProduct/helpers/index.js +7 -7
  9. package/src/hooks/getCategoriesWithProduct/index.js +62 -62
  10. package/src/hooks/getSession/index.js +18 -18
  11. package/src/hooks/useAnimationFrame/index.js +45 -45
  12. package/src/hooks/useAsideCart/index.js +155 -155
  13. package/src/hooks/useAsideCart/queries.js +10 -10
  14. package/src/hooks/useCart/index.js +2 -2
  15. package/src/hooks/useCart/queries.js +164 -164
  16. package/src/hooks/useCart/useCart/helpers/index.js +75 -75
  17. package/src/hooks/useCart/useCart/index.js +410 -410
  18. package/src/hooks/useCart/useGetCart/index.js +31 -31
  19. package/src/hooks/useCatWithProductClient/index.js +56 -56
  20. package/src/hooks/useCatWithProductClient/queries.js +55 -55
  21. package/src/hooks/useCategoriesProduct/index.js +12 -12
  22. package/src/hooks/useCategoriesProduct/queries.js +16 -16
  23. package/src/hooks/useCategoryInStore/queries.js +78 -78
  24. package/src/hooks/useChartData/useChartData/index.js +199 -199
  25. package/src/hooks/useChartData/useChartDataAllOrders/index.js +94 -94
  26. package/src/hooks/useCheckbox/index.js +115 -115
  27. package/src/hooks/useCreateProduct/helpers/manageCacheDataCatProduct/index.js +52 -0
  28. package/src/hooks/useCreateProduct/index.js +8 -3
  29. package/src/hooks/useDeleteSubProductOptional/index.js +30 -30
  30. package/src/hooks/useDeleteSubProductOptional/queries.js +10 -10
  31. package/src/hooks/useDessert/helpers/index.js +51 -51
  32. package/src/hooks/useDevices/index.js +35 -35
  33. package/src/hooks/useDevices/queries.js +19 -19
  34. package/src/hooks/useDropzone/index.js +94 -94
  35. package/src/hooks/useDynamicAuth/index.js +13 -13
  36. package/src/hooks/useDynamicAuth/queries.js +24 -24
  37. package/src/hooks/useEditSubProductOptional/queries.js +10 -10
  38. package/src/hooks/useEvent/index.js +33 -33
  39. package/src/hooks/useFavoriteStores/index.js +19 -19
  40. package/src/hooks/useFavoriteStores/queries.js +47 -47
  41. package/src/hooks/useFetchJson/index.js +25 -25
  42. package/src/hooks/useFingerprintjs/index.js +172 -172
  43. package/src/hooks/useFullScreenMode/index.js +65 -65
  44. package/src/hooks/useGenerateNumberArray/index.js +17 -17
  45. package/src/hooks/useGetExtProductFoodsSubOptionalAll/index.js +14 -14
  46. package/src/hooks/useGetFoodRecomended/index.js +32 -33
  47. package/src/hooks/useGetFoodRecomended/queries.js +47 -47
  48. package/src/hooks/useGetMinPrice/index.js +12 -12
  49. package/src/hooks/useGetMinPrice/queries.js +7 -7
  50. package/src/hooks/useGetOneStoreRating/index.js +40 -40
  51. package/src/hooks/useGetOneStoreRating/queries.js +18 -18
  52. package/src/hooks/useGoogleLogin/index.js +160 -160
  53. package/src/hooks/useGoogleLogin/loadScript.js +15 -15
  54. package/src/hooks/useGoogleLogin/removeScript.js +7 -7
  55. package/src/hooks/useHover/index.js +29 -29
  56. package/src/hooks/useImagesStore/index.js +5 -4
  57. package/src/hooks/useInnerHtml/index.js +39 -39
  58. package/src/hooks/useKeypress/index.js +28 -28
  59. package/src/hooks/useLocationNavigate/index.js +54 -54
  60. package/src/hooks/useLogout/index.js +29 -21
  61. package/src/hooks/useManageQueryParams/index.js +37 -36
  62. package/src/hooks/useMobile/index.js +39 -39
  63. package/src/hooks/useOrderClient/index.js +5 -5
  64. package/src/hooks/useProviders/index.js +3 -3
  65. package/src/hooks/useProviders/queries.js +31 -31
  66. package/src/hooks/useProviders/useProvidersCreateStore/index.js +12 -12
  67. package/src/hooks/useProviders/useProvidersDataStore/index.js +24 -24
  68. package/src/hooks/useProvidersStore/index.js +24 -24
  69. package/src/hooks/useProvidersStore/queries.js +31 -31
  70. package/src/hooks/useRatingArrayData/index.js +54 -54
  71. package/src/hooks/useRatingArrayData/queries.js +19 -19
  72. package/src/hooks/useRemoveExtraProductFoodsOptional/index.js +23 -23
  73. package/src/hooks/useRemoveExtraProductFoodsOptional/queries.js +48 -48
  74. package/src/hooks/useRestaurant/index.js +19 -19
  75. package/src/hooks/useRestaurant/queries.js +80 -80
  76. package/src/hooks/useSales/useGetAllSales/index.js +25 -25
  77. package/src/hooks/useSchedule/index.js +72 -72
  78. package/src/hooks/useSchedule/index.jsx +22 -22
  79. package/src/hooks/useSchedule/queries.js +43 -43
  80. package/src/hooks/useScheduleData/index.js +123 -123
  81. package/src/hooks/useScroll/index.js +56 -56
  82. package/src/hooks/useScrollRotate/index.js +16 -16
  83. package/src/hooks/useStatusOpenStore/helpers/index.js +101 -101
  84. package/src/hooks/useStatusOpenStore/index.js +172 -172
  85. package/src/hooks/useStatusOrdersClient/queries.js +80 -80
  86. package/src/hooks/useStore/queries.js +163 -163
  87. package/src/hooks/useStoreCalendar/index.js +5 -5
  88. package/src/hooks/useStoreContacts/queries.js +1 -1
  89. package/src/hooks/useTimeAgo/useTimeAgo.js +39 -39
  90. package/src/hooks/useUpdateExtProductFoodsSubOptional/index.js +38 -38
  91. package/src/hooks/useWindowSize/index.js +38 -38
  92. package/src/mock/dessert/index.js +16 -16
  93. package/src/mock/index.js +1 -1
  94. package/.vscode/extensions.json +0 -6
  95. package/.vscode/settings.json +0 -8
@@ -1,172 +1,172 @@
1
- import md5 from 'md5'
2
-
3
- async function getCPUInfo () {
4
- if (navigator.hardwareConcurrency) {
5
- try {
6
- const logicalCores = navigator.hardwareConcurrency
7
- const agent = window.navigator.userAgent
8
- const hyperThreaded = /Intel|Apple/.test(agent) && /Win64|Linux x86_64|MacIntel/.test(agent)
9
-
10
- // Ajustar el número de núcleos lógicos si se sospecha hiperprocesamiento
11
- const physicalCores = hyperThreaded ? logicalCores / 2 : logicalCores
12
-
13
- const cpuInfo = {
14
- logicalCores,
15
- physicalCores,
16
- hyperThreaded
17
- }
18
- return JSON.stringify(cpuInfo)
19
- } catch (error) {
20
- console.error('Error al obtener información de la CPU:', error)
21
- return 'cpu-info-error'
22
- }
23
- } else {
24
- return 'cpu-info-not-available'
25
- }
26
- }
27
-
28
- async function generateFingerprint () {
29
- const canvas = document.createElement('canvas')
30
- const audioContext = new (window.AudioContext || window.webkitAudioContext)()
31
-
32
- const userAgent = navigator.userAgent
33
- const language = navigator.language
34
- const colorDepth = window.screen.colorDepth
35
- const availableScreenHeight = window.screen.availHeight
36
- const platform = navigator.platform
37
- const cpuClass = navigator.cpuClass || 'unknown'
38
-
39
- const canvasFingerprint = await generateCanvasFingerprint(canvas)
40
- const audioFingerprint = await generateAudioFingerprint(audioContext)
41
-
42
- const cpuInfo = await getCPUInfo()
43
- const webGLInfo = await getWebGLInfo()
44
- const fonts = getInstalledFonts()
45
- const touchscreenInfo = getTouchscreenInfo()
46
-
47
- const fingerprintData = {
48
- browser: {
49
- userAgent,
50
- language,
51
- colorDepth,
52
- availableScreenHeight,
53
- plugins: Array.from(navigator.plugins).map(plugin => plugin.name).join(','),
54
- timeZone: Intl.DateTimeFormat().resolvedOptions().timeZone,
55
- hardwareConcurrency: cpuInfo.logicalCores || 'unknown',
56
- platformVersion: navigator.platformVersion || 'unknown'
57
- },
58
- device: {
59
- platform,
60
- cpuClass
61
- },
62
- canvas: canvasFingerprint,
63
- audio: audioFingerprint,
64
- cpu: cpuInfo,
65
- webgl: webGLInfo,
66
- fonts,
67
- touchscreen: touchscreenInfo
68
- }
69
-
70
- const fingerprint = JSON.stringify(fingerprintData)
71
- const uniqueID = md5(fingerprint)
72
-
73
- return uniqueID
74
- }
75
-
76
- // Función para generar huella digital del audio
77
- async function generateAudioFingerprint (audioContext) {
78
- if (audioContext) {
79
- try {
80
- await audioContext.resume()
81
-
82
- // Obtén propiedades del audio que puedas obtener en modo incógnito
83
- const audioProperties = {
84
- isAudioContextAvailable: true
85
- // Agrega más propiedades relevantes aquí
86
- }
87
-
88
- return audioProperties
89
- } catch (error) {
90
- console.error('Error al generar huella digital de audio:', error)
91
- }
92
- }
93
-
94
- return { isAudioContextAvailable: false }
95
- }
96
-
97
- // Función para generar huella digital del canvas
98
- async function generateCanvasFingerprint (canvas) {
99
- if (canvas) {
100
- try {
101
- canvas.width = 200
102
- canvas.height = 200
103
- const context = canvas.getContext('2d')
104
- context.clearRect(0, 0, canvas.width, canvas.height)
105
- context.fillStyle = '#f60'
106
- context.fillRect(125, 1, 62, 20)
107
- context.fillStyle = '#069'
108
- context.font = '16pt Arial'
109
- context.fillText('Cwm fjordbank glyphs vext quiz', 125, 20)
110
-
111
- // Obtén más propiedades del canvas que puedas obtener en modo incógnito
112
- const canvasProperties = {
113
- width: canvas.width,
114
- height: canvas.height
115
- // Agrega más propiedades relevantes aquí
116
- }
117
-
118
- return canvasProperties
119
- } catch (error) {
120
- console.error('Error al generar huella digital del canvas:', error)
121
- }
122
- }
123
-
124
- return { width: 0, height: 0 }
125
- }
126
-
127
- async function getWebGLInfo () {
128
- if ('WebGLRenderingContext' in window) {
129
- const canvas = document.createElement('canvas')
130
- const gl = canvas.getContext('webgl') || canvas.getContext('experimental-webgl')
131
-
132
- if (gl) {
133
- const renderer = gl.getParameter(gl.RENDERER)
134
- const version = gl.getParameter(gl.VERSION)
135
-
136
- // Obtener más información sobre las capacidades WebGL si es necesario
137
-
138
- return `${renderer}-${version}`
139
- }
140
- }
141
-
142
- return 'webgl-info-not-supported'
143
- }
144
-
145
- function getInstalledFonts () {
146
- const fonts = []
147
-
148
- if ('fonts' in document) {
149
- document.fonts.forEach(font => {
150
- fonts.push(font.family)
151
- })
152
- }
153
-
154
- return fonts.join(',')
155
- }
156
-
157
- function getTouchscreenInfo () {
158
- if ('maxTouchPoints' in navigator) {
159
- const maxTouchPoints = navigator.maxTouchPoints
160
- const touchEvent = 'ontouchstart' in window ? 'true' : 'false'
161
-
162
- return `${maxTouchPoints}-${touchEvent}`
163
- }
164
-
165
- return 'touchscreen-info-not-supported'
166
- }
167
-
168
- export async function fingerprintJs () {
169
- const fingerprint = await generateFingerprint()
170
- const uniqueID = md5(fingerprint)
171
- return uniqueID
172
- }
1
+ import md5 from 'md5'
2
+
3
+ async function getCPUInfo () {
4
+ if (navigator.hardwareConcurrency) {
5
+ try {
6
+ const logicalCores = navigator.hardwareConcurrency
7
+ const agent = window.navigator.userAgent
8
+ const hyperThreaded = /Intel|Apple/.test(agent) && /Win64|Linux x86_64|MacIntel/.test(agent)
9
+
10
+ // Ajustar el número de núcleos lógicos si se sospecha hiperprocesamiento
11
+ const physicalCores = hyperThreaded ? logicalCores / 2 : logicalCores
12
+
13
+ const cpuInfo = {
14
+ logicalCores,
15
+ physicalCores,
16
+ hyperThreaded
17
+ }
18
+ return JSON.stringify(cpuInfo)
19
+ } catch (error) {
20
+ console.error('Error al obtener información de la CPU:', error)
21
+ return 'cpu-info-error'
22
+ }
23
+ } else {
24
+ return 'cpu-info-not-available'
25
+ }
26
+ }
27
+
28
+ async function generateFingerprint () {
29
+ const canvas = document.createElement('canvas')
30
+ const audioContext = new (window.AudioContext || window.webkitAudioContext)()
31
+
32
+ const userAgent = navigator.userAgent
33
+ const language = navigator.language
34
+ const colorDepth = window.screen.colorDepth
35
+ const availableScreenHeight = window.screen.availHeight
36
+ const platform = navigator.platform
37
+ const cpuClass = navigator.cpuClass || 'unknown'
38
+
39
+ const canvasFingerprint = await generateCanvasFingerprint(canvas)
40
+ const audioFingerprint = await generateAudioFingerprint(audioContext)
41
+
42
+ const cpuInfo = await getCPUInfo()
43
+ const webGLInfo = await getWebGLInfo()
44
+ const fonts = getInstalledFonts()
45
+ const touchscreenInfo = getTouchscreenInfo()
46
+
47
+ const fingerprintData = {
48
+ browser: {
49
+ userAgent,
50
+ language,
51
+ colorDepth,
52
+ availableScreenHeight,
53
+ plugins: Array.from(navigator.plugins).map(plugin => plugin.name).join(','),
54
+ timeZone: Intl.DateTimeFormat().resolvedOptions().timeZone,
55
+ hardwareConcurrency: cpuInfo.logicalCores || 'unknown',
56
+ platformVersion: navigator.platformVersion || 'unknown'
57
+ },
58
+ device: {
59
+ platform,
60
+ cpuClass
61
+ },
62
+ canvas: canvasFingerprint,
63
+ audio: audioFingerprint,
64
+ cpu: cpuInfo,
65
+ webgl: webGLInfo,
66
+ fonts,
67
+ touchscreen: touchscreenInfo
68
+ }
69
+
70
+ const fingerprint = JSON.stringify(fingerprintData)
71
+ const uniqueID = md5(fingerprint)
72
+
73
+ return uniqueID
74
+ }
75
+
76
+ // Función para generar huella digital del audio
77
+ async function generateAudioFingerprint (audioContext) {
78
+ if (audioContext) {
79
+ try {
80
+ await audioContext.resume()
81
+
82
+ // Obtén propiedades del audio que puedas obtener en modo incógnito
83
+ const audioProperties = {
84
+ isAudioContextAvailable: true
85
+ // Agrega más propiedades relevantes aquí
86
+ }
87
+
88
+ return audioProperties
89
+ } catch (error) {
90
+ console.error('Error al generar huella digital de audio:', error)
91
+ }
92
+ }
93
+
94
+ return { isAudioContextAvailable: false }
95
+ }
96
+
97
+ // Función para generar huella digital del canvas
98
+ async function generateCanvasFingerprint (canvas) {
99
+ if (canvas) {
100
+ try {
101
+ canvas.width = 200
102
+ canvas.height = 200
103
+ const context = canvas.getContext('2d')
104
+ context.clearRect(0, 0, canvas.width, canvas.height)
105
+ context.fillStyle = '#f60'
106
+ context.fillRect(125, 1, 62, 20)
107
+ context.fillStyle = '#069'
108
+ context.font = '16pt Arial'
109
+ context.fillText('Cwm fjordbank glyphs vext quiz', 125, 20)
110
+
111
+ // Obtén más propiedades del canvas que puedas obtener en modo incógnito
112
+ const canvasProperties = {
113
+ width: canvas.width,
114
+ height: canvas.height
115
+ // Agrega más propiedades relevantes aquí
116
+ }
117
+
118
+ return canvasProperties
119
+ } catch (error) {
120
+ console.error('Error al generar huella digital del canvas:', error)
121
+ }
122
+ }
123
+
124
+ return { width: 0, height: 0 }
125
+ }
126
+
127
+ async function getWebGLInfo () {
128
+ if ('WebGLRenderingContext' in window) {
129
+ const canvas = document.createElement('canvas')
130
+ const gl = canvas.getContext('webgl') || canvas.getContext('experimental-webgl')
131
+
132
+ if (gl) {
133
+ const renderer = gl.getParameter(gl.RENDERER)
134
+ const version = gl.getParameter(gl.VERSION)
135
+
136
+ // Obtener más información sobre las capacidades WebGL si es necesario
137
+
138
+ return `${renderer}-${version}`
139
+ }
140
+ }
141
+
142
+ return 'webgl-info-not-supported'
143
+ }
144
+
145
+ function getInstalledFonts () {
146
+ const fonts = []
147
+
148
+ if ('fonts' in document) {
149
+ document.fonts.forEach(font => {
150
+ fonts.push(font.family)
151
+ })
152
+ }
153
+
154
+ return fonts.join(',')
155
+ }
156
+
157
+ function getTouchscreenInfo () {
158
+ if ('maxTouchPoints' in navigator) {
159
+ const maxTouchPoints = navigator.maxTouchPoints
160
+ const touchEvent = 'ontouchstart' in window ? 'true' : 'false'
161
+
162
+ return `${maxTouchPoints}-${touchEvent}`
163
+ }
164
+
165
+ return 'touchscreen-info-not-supported'
166
+ }
167
+
168
+ export async function fingerprintJs () {
169
+ const fingerprint = await generateFingerprint()
170
+ const uniqueID = md5(fingerprint)
171
+ return uniqueID
172
+ }
@@ -1,65 +1,65 @@
1
- import React, { useState, useRef, useEffect } from 'react'
2
- import styled from 'styled-components'
3
-
4
- export const useFullscreenMode = () => {
5
- const [isFullscreen, setFullscreen] = useState(false)
6
- const elementRef = useRef()
7
-
8
- useEffect(() => {
9
- const changeHandler = () => { return setFullscreen(mode => { return !mode }) }
10
-
11
- document.addEventListener('fullscreenchange', changeHandler, false)
12
- document.addEventListener('mozfullscreenchange', changeHandler, false)
13
- document.addEventListener('MSFullScreenChange', changeHandler, false)
14
- document.addEventListener(
15
- 'webkitfullscreenchange',
16
- changeHandler,
17
- false
18
- )
19
-
20
- return () => {
21
- document.removeEventListener('fullscreenchange', changeHandler)
22
- document.removeEventListener('mozfullscreenchange', changeHandler)
23
- document.removeEventListener('MSFullScreenChange', changeHandler)
24
- document.removeEventListener(
25
- 'webkitfullscreenchange',
26
- changeHandler
27
- )
28
- }
29
- }, [])
30
-
31
- const goFullscreen = () => {
32
- if (elementRef.current.requestFullscreen) {
33
- elementRef.current.requestFullscreen()
34
- } else if (elementRef.current.mozRequestFullscreen) {
35
- // Firefox
36
- elementRef.current.mozRequestFullscreen()
37
- } else if (elementRef.current.webkitRequestFullscreen) {
38
- // Chrome, safari, opera
39
- elementRef.current.webkitRequestFullscreen()
40
- } else if (elementRef.current.msRequestFullscreen) {
41
- // IE, edge
42
- elementRef.current.msRequestFullscreen()
43
- }
44
- }
45
-
46
- const exitFullScreen = () => {
47
- if (document.exitFullscreen) {
48
- document.exitFullscreen()
49
- } else if (document.mozCancelFullScreen) {
50
- document.mozCancelFullScreen()
51
- } else if (document.webkitExitFullscreen) {
52
- document.webkitExitFullscreen()
53
- } else if (document.msExitFullscreen) {
54
- document.msExitFullscreen()
55
- }
56
- }
57
-
58
- const ToggleIcon = (
59
- <Button onDoubleClick={() => { return (!isFullscreen ? goFullscreen() : exitFullScreen()) }}>{!isFullscreen ? 'FullScreen' : 'Normal'}</Button>
60
- )
61
- return [elementRef, ToggleIcon] // Icon, ref
62
- }
63
- const Button = styled.button`
64
-
65
- `
1
+ import React, { useState, useRef, useEffect } from 'react'
2
+ import styled from 'styled-components'
3
+
4
+ export const useFullscreenMode = () => {
5
+ const [isFullscreen, setFullscreen] = useState(false)
6
+ const elementRef = useRef()
7
+
8
+ useEffect(() => {
9
+ const changeHandler = () => { return setFullscreen(mode => { return !mode }) }
10
+
11
+ document.addEventListener('fullscreenchange', changeHandler, false)
12
+ document.addEventListener('mozfullscreenchange', changeHandler, false)
13
+ document.addEventListener('MSFullScreenChange', changeHandler, false)
14
+ document.addEventListener(
15
+ 'webkitfullscreenchange',
16
+ changeHandler,
17
+ false
18
+ )
19
+
20
+ return () => {
21
+ document.removeEventListener('fullscreenchange', changeHandler)
22
+ document.removeEventListener('mozfullscreenchange', changeHandler)
23
+ document.removeEventListener('MSFullScreenChange', changeHandler)
24
+ document.removeEventListener(
25
+ 'webkitfullscreenchange',
26
+ changeHandler
27
+ )
28
+ }
29
+ }, [])
30
+
31
+ const goFullscreen = () => {
32
+ if (elementRef.current.requestFullscreen) {
33
+ elementRef.current.requestFullscreen()
34
+ } else if (elementRef.current.mozRequestFullscreen) {
35
+ // Firefox
36
+ elementRef.current.mozRequestFullscreen()
37
+ } else if (elementRef.current.webkitRequestFullscreen) {
38
+ // Chrome, safari, opera
39
+ elementRef.current.webkitRequestFullscreen()
40
+ } else if (elementRef.current.msRequestFullscreen) {
41
+ // IE, edge
42
+ elementRef.current.msRequestFullscreen()
43
+ }
44
+ }
45
+
46
+ const exitFullScreen = () => {
47
+ if (document.exitFullscreen) {
48
+ document.exitFullscreen()
49
+ } else if (document.mozCancelFullScreen) {
50
+ document.mozCancelFullScreen()
51
+ } else if (document.webkitExitFullscreen) {
52
+ document.webkitExitFullscreen()
53
+ } else if (document.msExitFullscreen) {
54
+ document.msExitFullscreen()
55
+ }
56
+ }
57
+
58
+ const ToggleIcon = (
59
+ <Button onDoubleClick={() => { return (!isFullscreen ? goFullscreen() : exitFullScreen()) }}>{!isFullscreen ? 'FullScreen' : 'Normal'}</Button>
60
+ )
61
+ return [elementRef, ToggleIcon] // Icon, ref
62
+ }
63
+ const Button = styled.button`
64
+
65
+ `
@@ -1,17 +1,17 @@
1
- const addButtonValues = (values, max) => {
2
- const value1 = values.splice(Math.floor(Math.random() * (max - 0)) + 0, 1)
3
- return { max: max - 2, values: [value1] }
4
- }
5
-
6
- export const useGenerateNumberArray = () => {
7
- const values = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
8
- let max = 9
9
- const buttons = Array.from(Array(10)).map(() => {
10
- return Array.from(Array(1)).map(() => {
11
- const buttonValues = addButtonValues(values, max)
12
- max = buttonValues.max
13
- return buttonValues.values
14
- })
15
- })
16
- return buttons
17
- }
1
+ const addButtonValues = (values, max) => {
2
+ const value1 = values.splice(Math.floor(Math.random() * (max - 0)) + 0, 1)
3
+ return { max: max - 2, values: [value1] }
4
+ }
5
+
6
+ export const useGenerateNumberArray = () => {
7
+ const values = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
8
+ let max = 9
9
+ const buttons = Array.from(Array(10)).map(() => {
10
+ return Array.from(Array(1)).map(() => {
11
+ const buttonValues = addButtonValues(values, max)
12
+ max = buttonValues.max
13
+ return buttonValues.values
14
+ })
15
+ })
16
+ return buttons
17
+ }
@@ -1,14 +1,14 @@
1
- import { GET_EXTRAS_PRODUCT_FOOD_OPTIONAL } from '../useProductsFood/queriesStore'
2
- import { useLazyQuery } from '@apollo/client'
3
-
4
- export const useGetExtProductFoodsSubOptionalAll = ({ setDataOptional = () => { } } = {}) => {
5
- const [ExtProductFoodsSubOptionalAll] = useLazyQuery(
6
- GET_EXTRAS_PRODUCT_FOOD_OPTIONAL,
7
- {
8
- onError: () => {
9
- setDataOptional([])
10
- }
11
- }
12
- )
13
- return [ExtProductFoodsSubOptionalAll]
14
- }
1
+ import { GET_EXTRAS_PRODUCT_FOOD_OPTIONAL } from '../useProductsFood/queriesStore'
2
+ import { useLazyQuery } from '@apollo/client'
3
+
4
+ export const useGetExtProductFoodsSubOptionalAll = ({ setDataOptional = () => { } } = {}) => {
5
+ const [ExtProductFoodsSubOptionalAll] = useLazyQuery(
6
+ GET_EXTRAS_PRODUCT_FOOD_OPTIONAL,
7
+ {
8
+ onError: () => {
9
+ setDataOptional([])
10
+ }
11
+ }
12
+ )
13
+ return [ExtProductFoodsSubOptionalAll]
14
+ }
@@ -1,33 +1,32 @@
1
- import { useQuery } from '@apollo/client'
2
- import { GET_ALL_PRODUCT_STORE_RECOMENDED } from './queries'
3
-
4
- export const useGetFoodRecomended = ({
5
- name = ''
6
- }) => {
7
- console.log({ name })
8
- const {
9
- data,
10
- called,
11
- fetchMore,
12
- loading,
13
- error
14
- } = useQuery(GET_ALL_PRODUCT_STORE_RECOMENDED, {
15
- fetchPolicy: 'cache-and-network',
16
- skip: !name,
17
- notifyOnNetworkStatusChange: true,
18
- nextFetchPolicy: 'cache-first',
19
- refetchWritePolicy: 'merge',
20
- variables:
21
- {
22
- max: 6,
23
- search: name
24
- }
25
- })
26
-
27
- return [data?.productFoodsAllRecommended, {
28
- called,
29
- fetchMore,
30
- loading,
31
- error
32
- }]
33
- }
1
+ import { useQuery } from '@apollo/client'
2
+ import { GET_ALL_PRODUCT_STORE_RECOMENDED } from './queries'
3
+
4
+ export const useGetFoodRecomended = ({
5
+ name = ''
6
+ }) => {
7
+ const {
8
+ data,
9
+ called,
10
+ fetchMore,
11
+ loading,
12
+ error
13
+ } = useQuery(GET_ALL_PRODUCT_STORE_RECOMENDED, {
14
+ fetchPolicy: 'cache-and-network',
15
+ skip: !name,
16
+ notifyOnNetworkStatusChange: true,
17
+ nextFetchPolicy: 'cache-first',
18
+ refetchWritePolicy: 'merge',
19
+ variables:
20
+ {
21
+ max: 6,
22
+ search: name
23
+ }
24
+ })
25
+
26
+ return [data?.productFoodsAllRecommended, {
27
+ called,
28
+ fetchMore,
29
+ loading,
30
+ error
31
+ }]
32
+ }