npm-pkg-hook 1.1.0 → 1.1.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.
Files changed (72) hide show
  1. package/.eslintrc.js +132 -132
  2. package/next.config.js +0 -1
  3. package/package.json +46 -43
  4. package/src/config/client/errors.js +2 -1
  5. package/src/hooks/getSession/index.js +18 -0
  6. package/src/hooks/index.js +27 -7
  7. package/src/hooks/useAnimationFrame/index.js +45 -0
  8. package/src/hooks/useAnimationText/index.jsx +11 -13
  9. package/src/hooks/useCatWithProduct/index.js +37 -4
  10. package/src/hooks/useCatWithProduct/queries.js +0 -16
  11. package/src/hooks/useCategoriesProduct/index.js +12 -0
  12. package/src/hooks/useCategoriesProduct/queries.js +16 -0
  13. package/src/hooks/useChartData/index.js +2 -169
  14. package/src/hooks/useChartData/useChartData/index.js +197 -0
  15. package/src/hooks/useChartData/useChartDataAllOrders/index.js +89 -0
  16. package/src/hooks/useCheckbox/index.js +5 -1
  17. package/src/hooks/useClients/index.js +17 -8
  18. package/src/hooks/useCreateProduct/index.js +95 -65
  19. package/src/hooks/useDeleteSubProductOptional/index.js +30 -0
  20. package/src/hooks/useDeleteSubProductOptional/queries.js +10 -0
  21. package/src/hooks/useDessert/helpers/index.js +51 -0
  22. package/src/hooks/useDessert/index.js +319 -121
  23. package/src/hooks/useDevices/index.js +36 -0
  24. package/src/hooks/useDevices/queries.js +19 -0
  25. package/src/hooks/useDrag/index.js +1 -1
  26. package/src/hooks/useDropzone/index.js +79 -0
  27. package/src/hooks/useDynamicAuth/index.js +13 -0
  28. package/src/hooks/useDynamicAuth/queries.js +24 -0
  29. package/src/hooks/useEmployee/index.js +11 -8
  30. package/src/hooks/useFingerprintjs/index.js +176 -0
  31. package/src/hooks/useFormTools/index.js +1 -1
  32. package/src/hooks/useFullScreenMode/index.js +8 -9
  33. package/src/hooks/useGenerateNumberArray/index.js +17 -0
  34. package/src/hooks/useImagesStore/index.js +176 -143
  35. package/src/hooks/useImagesStore/queries.js +1 -28
  36. package/src/hooks/useKeypress/index.js +7 -1
  37. package/src/hooks/useLocalSorage/index.js +1 -1
  38. package/src/hooks/useLogout/index.js +22 -25
  39. package/src/hooks/useManageQueryParams/index.js +37 -0
  40. package/src/hooks/useProductsFood/queriesStore.js +3 -16
  41. package/src/hooks/useProductsFood/usetagsProducts.js +30 -5
  42. package/src/hooks/useProviders/index.js +3 -0
  43. package/src/hooks/useProviders/queries.js +31 -0
  44. package/src/hooks/useProviders/useProvidersCreateStore/index.js +13 -0
  45. package/src/hooks/useProviders/useProvidersDataStore/index.js +24 -0
  46. package/src/hooks/useProvidersStore/index.js +24 -0
  47. package/src/hooks/useProvidersStore/queries.js +31 -0
  48. package/src/hooks/useRatingData/index.js +53 -0
  49. package/src/hooks/useRatingData/queries.js +18 -0
  50. package/src/hooks/useRemoveExtraProductFoodsOptional/index.js +23 -0
  51. package/src/hooks/useRemoveExtraProductFoodsOptional/queries.js +48 -0
  52. package/src/hooks/useReport/index.js +16 -7
  53. package/src/hooks/useReport/queries.js +47 -32
  54. package/src/hooks/useSales/index.js +53 -22
  55. package/src/hooks/useSales/queries.js +48 -38
  56. package/src/hooks/useSales/useGetAllSales/index.js +25 -0
  57. package/src/hooks/useSales/useGetSale.js +16 -2
  58. package/src/hooks/useSchedule/index.js +36 -0
  59. package/src/hooks/useSchedule/queries.js +35 -0
  60. package/src/hooks/useScheduleData/index.js +171 -0
  61. package/src/hooks/useScroll/index.js +57 -0
  62. package/src/hooks/useScrollRotate/index.js +14 -0
  63. package/src/hooks/useStatusOpenStore/helpers/index.js +102 -0
  64. package/src/hooks/useStatusOpenStore/index.js +173 -0
  65. package/src/hooks/useStoreContacts/index.js +5 -1
  66. package/src/hooks/useUpdateExistingOrders/index.js +8 -8
  67. package/src/hooks/useUser/index.js +7 -2
  68. package/src/hooks/useUser/queries.js +40 -0
  69. package/src/index.jsx +3 -1
  70. package/.vscode/extensions.json +0 -6
  71. package/.vscode/settings.json +0 -8
  72. package/src/hooks/useSchedule/index.jsx +0 -23
@@ -0,0 +1,176 @@
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: logicalCores,
15
+ physicalCores: physicalCores,
16
+ hyperThreaded: 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 context = canvas.getContext('2d');
31
+ const audioContext = new (window.AudioContext || window.webkitAudioContext)();
32
+
33
+ const userAgent = navigator.userAgent;
34
+ const language = navigator.language;
35
+ const colorDepth = window.screen.colorDepth;
36
+ const availableScreenHeight = window.screen.availHeight;
37
+ const platform = navigator.platform;
38
+ const cpuClass = navigator.cpuClass || 'unknown';
39
+
40
+ const canvasFingerprint = await generateCanvasFingerprint(canvas);
41
+ const audioFingerprint = await generateAudioFingerprint(audioContext);
42
+
43
+ const cpuInfo = await getCPUInfo();
44
+ const webGLInfo = await getWebGLInfo();
45
+ const fonts = getInstalledFonts();
46
+ const touchscreenInfo = getTouchscreenInfo();
47
+
48
+ const fingerprintData = {
49
+ browser: {
50
+ userAgent,
51
+ language,
52
+ colorDepth,
53
+ availableScreenHeight,
54
+ plugins: Array.from(navigator.plugins).map(plugin => plugin.name).join(','),
55
+ timeZone: Intl.DateTimeFormat().resolvedOptions().timeZone,
56
+ hardwareConcurrency: cpuInfo.logicalCores || 'unknown',
57
+ platformVersion: navigator.platformVersion || 'unknown',
58
+ },
59
+ device: {
60
+ platform,
61
+ cpuClass,
62
+ },
63
+ canvas: canvasFingerprint,
64
+ audio: audioFingerprint,
65
+ cpu: cpuInfo,
66
+ webgl: webGLInfo,
67
+ fonts,
68
+ touchscreen: touchscreenInfo,
69
+ };
70
+
71
+ const fingerprint = JSON.stringify(fingerprintData);
72
+ const uniqueID = md5(fingerprint);
73
+
74
+ return uniqueID;
75
+ }
76
+
77
+ // Función para generar huella digital del audio
78
+ async function generateAudioFingerprint(audioContext) {
79
+ if (audioContext) {
80
+ try {
81
+ await audioContext.resume();
82
+
83
+ // Obtén propiedades del audio que puedas obtener en modo incógnito
84
+ const audioProperties = {
85
+ isAudioContextAvailable: true,
86
+ // Agrega más propiedades relevantes aquí
87
+ };
88
+
89
+ return audioProperties;
90
+ } catch (error) {
91
+ console.error('Error al generar huella digital de audio:', error);
92
+ }
93
+ }
94
+
95
+ return { isAudioContextAvailable: false };
96
+ }
97
+
98
+ // Función para generar huella digital del canvas
99
+ async function generateCanvasFingerprint(canvas) {
100
+ if (canvas) {
101
+ try {
102
+ canvas.width = 200;
103
+ canvas.height = 200;
104
+ const context = canvas.getContext('2d');
105
+ context.clearRect(0, 0, canvas.width, canvas.height);
106
+ context.fillStyle = '#f60';
107
+ context.fillRect(125, 1, 62, 20);
108
+ context.fillStyle = '#069';
109
+ context.font = '16pt Arial';
110
+ context.fillText('Cwm fjordbank glyphs vext quiz', 125, 20);
111
+
112
+ // Obtén más propiedades del canvas que puedas obtener en modo incógnito
113
+ const canvasProperties = {
114
+ width: canvas.width,
115
+ height: canvas.height,
116
+ // Agrega más propiedades relevantes aquí
117
+ };
118
+
119
+ return canvasProperties;
120
+ } catch (error) {
121
+ console.error('Error al generar huella digital del canvas:', error);
122
+ }
123
+ }
124
+
125
+ return { width: 0, height: 0 };
126
+ }
127
+
128
+
129
+
130
+ async function getWebGLInfo() {
131
+ if ('WebGLRenderingContext' in window) {
132
+ const canvas = document.createElement('canvas');
133
+ const gl = canvas.getContext('webgl') || canvas.getContext('experimental-webgl');
134
+
135
+ if (gl) {
136
+ const renderer = gl.getParameter(gl.RENDERER);
137
+ const version = gl.getParameter(gl.VERSION);
138
+
139
+ // Obtener más información sobre las capacidades WebGL si es necesario
140
+
141
+ return `${renderer}-${version}`;
142
+ }
143
+ }
144
+
145
+ return 'webgl-info-not-supported';
146
+ }
147
+
148
+ function getInstalledFonts() {
149
+ const fonts = [];
150
+
151
+ if ('fonts' in document) {
152
+ document.fonts.forEach(font => {
153
+ fonts.push(font.family);
154
+ });
155
+ }
156
+
157
+ return fonts.join(',');
158
+ }
159
+
160
+ function getTouchscreenInfo() {
161
+ if ('maxTouchPoints' in navigator) {
162
+ const maxTouchPoints = navigator.maxTouchPoints;
163
+ const touchEvent = 'ontouchstart' in window ? 'true' : 'false';
164
+
165
+ return `${maxTouchPoints}-${touchEvent}`;
166
+ }
167
+
168
+ return 'touchscreen-info-not-supported';
169
+ }
170
+
171
+
172
+ export async function fingerprintJs() {
173
+ const fingerprint = await generateFingerprint();
174
+ const uniqueID = md5(fingerprint)
175
+ return uniqueID;
176
+ }
@@ -75,7 +75,7 @@ export const useFormTools = ({ sendNotification = () => { } } = {}) => {
75
75
 
76
76
  // Ejecuta la accion si es válido
77
77
  if (!errSub && action) {
78
- action().then(res => {
78
+ action()?.then(res => {
79
79
  if (res) {
80
80
  sendNotification({
81
81
  message: msgSuccess || 'Operación exitosa',
@@ -1,7 +1,10 @@
1
- import React, { useState, useRef, useEffect } from 'react'
2
- import styled from 'styled-components'
1
+ import React, {
2
+ useState,
3
+ useRef,
4
+ useEffect
5
+ } from 'react'
3
6
 
4
- const useFullscreenMode = () => {
7
+ export const useFullScreenMode = () => {
5
8
  const [isFullscreen, setFullscreen] = useState(false)
6
9
  const elementRef = useRef()
7
10
 
@@ -56,11 +59,7 @@ const useFullscreenMode = () => {
56
59
  }
57
60
 
58
61
  const ToggleIcon = (
59
- <Button onDoubleClick={() => {return (!isFullscreen ? goFullscreen() : exitFullScreen())}}>{!isFullscreen ? 'FullScreen' : 'Normal'}</Button>
62
+ <button onDoubleClick={() => {return (!isFullscreen ? goFullscreen() : exitFullScreen())}}>{!isFullscreen ? 'FullScreen' : 'Normal'}</button>
60
63
  )
61
64
  return [elementRef, ToggleIcon] //Icon, ref
62
- }
63
- const Button = styled.button`
64
-
65
- `
66
- export default useFullscreenMode
65
+ }
@@ -0,0 +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,6 +1,7 @@
1
1
  import { useMutation } from '@apollo/client';
2
2
  import {
3
3
  useRef,
4
+ useCallback,
4
5
  useState
5
6
  } from 'react';
6
7
  import {
@@ -11,158 +12,191 @@ import {
11
12
  GET_ONE_BANNER_STORE
12
13
  } from '../useProductsFood/queriesStore';
13
14
  import { GET_ONE_STORE } from '../useStore/queries';
14
-
15
- export const useImageStore = ({ idStore, sendNotification = () => { return } } = {}) => {
16
- // STATES
17
- const fileInputRef = useRef(null)
18
- const [{ altLogo, srcLogo }, setPreviewImgLogo] = useState({})
19
- const initialState = { alt: '/images/DEFAULTBANNER.png', src: '/images/DEFAULTBANNER.png' }
20
- const [{ alt, src }, setPreviewImg] = useState(initialState)
21
- const fileInputRefLogo = useRef(null)
22
- // HOOKS
23
- const [registerBanner] = useMutation(CREATE_BANNER_STORE, {
24
- onCompleted: (data) => { return console.log({ message: data?.registerBanner?.message }) },
25
- context: { clientName: 'admin-server' }
26
- })
27
- const [setALogoStore] = useMutation(CREATE_LOGO, {
28
- onCompleted: (data) => { return console.log({ message: data?.setALogoStore?.message }) },
29
- context: { clientName: 'admin-server' }
30
- })
31
- const [DeleteOneBanner] = useMutation(DELETE_ONE_BANNER_STORE, {
32
- onCompleted: (data) => { return console.log({ message: data?.DeleteOneBanner?.message }) },
33
- context: { clientName: 'admin-server' }
34
- })
35
- const [deleteALogoStore] = useMutation(DELETE_ONE_LOGO_STORE, {
36
- onCompleted: (data) => {
37
- console.log({
38
- message: data.deleteALogoStore.message
39
- })
40
- setPreviewImgLogo(initialState)
15
+ /**
16
+ * Custom hook to handle image upload and management for a store's banner and logo.
17
+ * @typedef {Object} ImageStoreHookResult
18
+ * @property {React.RefObject} fileInputRefLogo - Reference to the logo file input element.
19
+ * @property {string} src - Source URL of the store's banner image.
20
+ * @property {string} alt - Alternate text for the store's banner image.
21
+ * @property {Object} initialState - Initial state for the store's banner image.
22
+ * @property {string} srcLogo - Source URL of the store's logo image.
23
+ * @property {string} altLogo - Alternate text for the store's logo image.
24
+ * @property {React.RefObject} fileInputRef - Reference to the banner file input element.
25
+ * @property {function} handleDeleteLogo - Callback function to handle logo deletion.
26
+ * @property {function} onTargetClick - Callback function to trigger banner file input click.
27
+ * @property {function} onTargetClickLogo - Callback function to trigger logo file input click.
28
+ * @property {function} HandleDeleteBanner - Callback function to handle banner deletion.
29
+ * @property {function} handleInputChangeLogo - Callback function to handle logo file input change.
30
+ * @property {function} handleUpdateBanner - Callback function to handle banner file input change.
31
+ * @param {Object} options - Options for the hook.
32
+ * @param {string} options.idStore - ID of the store.
33
+ * @param {Function} options.sendNotification - Function to send a notification (optional).
34
+ * @returns {ImageStoreHookResult} Object containing image handling functions and state.
35
+ */
36
+ export const useImageStore = ({ idStore, sendNotification = () => {} } = {}) => {
37
+ // STATES
38
+ const fileInputRef = useRef(null);
39
+ const [{ altLogo, srcLogo }, setPreviewImgLogo] = useState({});
40
+ const initialState = { alt: '/images/DEFAULTBANNER.png', src: '/images/DEFAULTBANNER.png' };
41
+ const [{ alt, src }, setPreviewImg] = useState(initialState);
42
+ const fileInputRefLogo = useRef(null);
43
+ // HOOKS
44
+ const [registerBanner] = useMutation(CREATE_BANNER_STORE, {
45
+ onCompleted: (data) => console.log({ message: data?.registerBanner?.message }),
46
+ context: { clientName: 'admin-server' },
47
+ });
48
+ const [setALogoStore] = useMutation(CREATE_LOGO, {
49
+ onCompleted: (data) => console.log({ message: data?.setALogoStore?.message }),
50
+ context: { clientName: 'admin-server' },
51
+ });
52
+ const [DeleteOneBanner] = useMutation(DELETE_ONE_BANNER_STORE, {
53
+ onCompleted: (data) => console.log({ message: data?.DeleteOneBanner?.message }),
54
+ context: { clientName: 'admin-server' },
55
+ });
56
+ const [deleteALogoStore] = useMutation(DELETE_ONE_LOGO_STORE, {
57
+ onCompleted: (data) => {
58
+ console.log({ message: data.deleteALogoStore.message });
59
+ setPreviewImgLogo(initialState);
60
+ },
61
+ context: { clientName: 'admin-server' },
62
+ update(cache) {
63
+ cache.modify({
64
+ fields: {
65
+ getStore(dataOld = []) {
66
+ return cache.writeQuery({ query: GET_ONE_STORE, data: dataOld });
67
+ },
41
68
  },
42
- context: { clientName: 'admin-server' },
43
- update(cache) {
44
- cache.modify({
45
- fields: {
46
- getStore(dataOld = []) {
47
- return cache.writeQuery({ query: GET_ONE_STORE, data: dataOld })
48
- }
49
- }
50
- })
51
- }
52
- })
53
- // HANDLESS
54
- const handleDeleteLogo = () => {
55
- return deleteALogoStore({
56
- variables: {
57
- Image: ImageName || null
58
- }
59
- })
60
- }
69
+ });
70
+ },
71
+ });
61
72
 
62
- const handleUpdateBanner = event => {
63
- try {
64
- const { files } = event.target
65
- setPreviewImg(
66
- files.length
67
- ? {
68
- src: URL.createObjectURL(files[0]),
69
- alt: files[0].name
70
- }
71
- : initialState
72
- )
73
- registerBanner({
74
- variables: {
75
- input: {
76
- bnImage: files[0],
77
- idStore: idStore
78
- }
79
- }, update(cache) {
80
- cache.modify({
81
- fields: {
82
- getOneBanners(dataOld = []) {
83
- return cache.writeQuery({ query: GET_ONE_BANNER_STORE, data: dataOld })
84
- }
85
- }
86
- })
87
- }
88
- }).catch(() => {
89
- sendNotification({
90
- title: 'No pudimos cargar la imagen',
91
- description: 'Error',
92
- backgroundColor: 'error'
93
- })
94
- setPreviewImg(initialState)
95
- })
96
- } catch {
97
- setPreviewImg(initialState)
98
- sendNotification({
99
- title: 'No pudimos cargar la imagen',
100
- description: 'Error',
101
- backgroundColor: 'error'
102
- })
103
- }
104
- }
105
- const handleInputChangeLogo = event => {
106
- const { files } = event.target
107
- setPreviewImgLogo(
73
+ // HANDLESS
74
+ const handleDeleteLogo = useCallback(() => {
75
+ return deleteALogoStore({
76
+ variables: {
77
+ Image: ImageName || null,
78
+ },
79
+ });
80
+ }, [deleteALogoStore]);
81
+
82
+ const handleUpdateBanner = useCallback(
83
+ (event) => {
84
+ try {
85
+ const { files } = event.target;
86
+ setPreviewImg(
108
87
  files.length
109
88
  ? {
110
- srcLogo: URL.createObjectURL(files[0]),
111
- altLogo: files[0].name
112
- }
89
+ src: URL.createObjectURL(files[0]),
90
+ alt: files[0].name,
91
+ }
113
92
  : initialState
114
- )
115
- setALogoStore({
93
+ );
94
+ registerBanner({
116
95
  variables: {
117
- logo: files[0],
118
- idStore: idStore
119
- }, update(cache) {
96
+ input: {
97
+ bnImage: files[0],
98
+ idStore: idStore,
99
+ },
100
+ },
101
+ update(cache) {
120
102
  cache.modify({
121
103
  fields: {
122
- getStore(dataOld = []) {
123
- return cache.writeQuery({ query: GET_ONE_STORE, data: dataOld })
124
- }
125
- }
126
- })
127
- }
104
+ getOneBanners(dataOld = []) {
105
+ return cache.writeQuery({ query: GET_ONE_BANNER_STORE, data: dataOld });
106
+ },
107
+ },
108
+ });
109
+ },
128
110
  }).catch(() => {
129
111
  sendNotification({
130
112
  title: 'No pudimos cargar la imagen',
131
113
  description: 'Error',
132
- backgroundColor: 'error'
133
- })
134
- setPreviewImgLogo(initialState)
135
- })
136
- }
137
- const HandleDeleteBanner = async () => {
138
- setPreviewImg(initialState)
139
- DeleteOneBanner({
140
- variables: {
141
- bnState: bnState,
142
- bnImageFileName: bnImageFileName,
143
- idStore,
144
- bnId
145
- }, update(cache) {
146
- cache.modify({
147
- fields: {
148
- getOneBanners(dataOld = []) {
149
- return cache.writeQuery({ query: GET_ONE_BANNER_STORE, data: dataOld })
150
- }
151
- }
152
- })
153
- }
154
- }).then(() => {
155
- setPreviewImg(initialState)
156
- })
114
+ backgroundColor: 'error',
115
+ });
116
+ setPreviewImg(initialState);
117
+ });
118
+ } catch {
119
+ setPreviewImg(initialState);
120
+ sendNotification({
121
+ title: 'No pudimos cargar la imagen',
122
+ description: 'Error',
123
+ backgroundColor: 'error',
124
+ });
157
125
  }
158
- const onTargetClickLogo = e => {
159
- e.preventDefault()
160
- fileInputRefLogo.current.click()
161
- }
162
- const onTargetClick = e => {
163
- e.preventDefault()
164
- fileInputRef.current.click()
165
- }
126
+ },
127
+ [setPreviewImg, initialState, sendNotification, idStore, registerBanner]
128
+ );
129
+
130
+ const handleInputChangeLogo = useCallback(
131
+ (event) => {
132
+ const { files } = event.target;
133
+ setPreviewImgLogo(
134
+ files.length
135
+ ? {
136
+ srcLogo: URL.createObjectURL(files[0]),
137
+ altLogo: files[0].name,
138
+ }
139
+ : initialState
140
+ );
141
+ setALogoStore({
142
+ variables: {
143
+ logo: files[0],
144
+ idStore: idStore,
145
+ },
146
+ update(cache) {
147
+ cache.modify({
148
+ fields: {
149
+ getStore(dataOld = []) {
150
+ return cache.writeQuery({ query: GET_ONE_STORE, data: dataOld });
151
+ },
152
+ },
153
+ });
154
+ },
155
+ }).catch(() => {
156
+ sendNotification({
157
+ title: 'No pudimos cargar la imagen',
158
+ description: 'Error',
159
+ backgroundColor: 'error',
160
+ });
161
+ setPreviewImgLogo(initialState);
162
+ });
163
+ },
164
+ [setPreviewImgLogo, initialState, idStore, setALogoStore]
165
+ );
166
+
167
+ const HandleDeleteBanner = useCallback(async () => {
168
+ setPreviewImg(initialState);
169
+ DeleteOneBanner({
170
+ variables: {
171
+ bnState: bnState, // You should provide bnState and bnImageFileName
172
+ bnImageFileName: bnImageFileName,
173
+ idStore,
174
+ bnId,
175
+ },
176
+ update(cache) {
177
+ cache.modify({
178
+ fields: {
179
+ getOneBanners(dataOld = []) {
180
+ return cache.writeQuery({ query: GET_ONE_BANNER_STORE, data: dataOld });
181
+ },
182
+ },
183
+ });
184
+ },
185
+ }).then(() => {
186
+ setPreviewImg(initialState);
187
+ });
188
+ }, [setPreviewImg, initialState, DeleteOneBanner]);
189
+
190
+ const onTargetClickLogo = useCallback((e) => {
191
+ e.preventDefault();
192
+ fileInputRefLogo.current.click();
193
+ }, []);
194
+
195
+ const onTargetClick = useCallback((e) => {
196
+ e.preventDefault();
197
+ fileInputRef.current.click();
198
+ }, []);
199
+
166
200
  return {
167
201
  fileInputRefLogo,
168
202
  src,
@@ -176,7 +210,6 @@ export const useImageStore = ({ idStore, sendNotification = () => { return } } =
176
210
  onTargetClickLogo,
177
211
  HandleDeleteBanner,
178
212
  handleInputChangeLogo,
179
- handleUpdateBanner
180
- }
181
- }
182
-
213
+ handleUpdateBanner,
214
+ };
215
+ };
@@ -8,29 +8,7 @@ export const CREATE_SCHEDULE_STORE = gql`
8
8
  }
9
9
  }
10
10
  `;
11
- export const GET_SCHEDULE_STORE = gql`
12
- query getStoreSchedules($schDay: Int, $idStore: ID) {
13
- getStoreSchedules(schDay: $schDay, idStore: $idStore) {
14
- schId
15
- idStore
16
- schDay
17
- schHoSta
18
- schHoEnd
19
- schState
20
- }
21
- }
22
- `;
23
- export const GET_ONE_SCHEDULE_STORE = gql`
24
- query getOneStoreSchedules($schDay: Int, $idStore: ID) {
25
- getOneStoreSchedules(schDay: $schDay, idStore: $idStore) {
26
- schId
27
- schDay
28
- schHoSta
29
- schHoEnd
30
- schState
31
- }
32
- }
33
- `;
11
+
34
12
  export const GET_CAT_OF_PRODUCTS = gql`
35
13
  query getAllCatOfProducts($idStore: ID) {
36
14
  getAllCatOfProducts(idStore: $idStore) {
@@ -174,11 +152,6 @@ export const GET_ALL_VISITOR_STORE = gql`
174
152
  }
175
153
  }
176
154
  `;
177
- export const GET_MIN_PEDIDO = gql`
178
- query getMinPrice($idStore: ID) {
179
- getMinPrice(idStore: $idStore)
180
- }
181
- `;
182
155
 
183
156
  export const GET_All_RATING_STORE = gql`
184
157
  query getAllRating($idStore: ID) {
@@ -25,4 +25,10 @@ export const useKeyPress = (targetKey) => {
25
25
  }, [targetKey])
26
26
 
27
27
  return keyPressed
28
- }
28
+ }
29
+
30
+ export function useMultiKeyPress(targetKeyA, targetKeyB) {
31
+ const keyPressedA = useKeyPress(targetKeyA)
32
+ const keyPressedB = useKeyPress(targetKeyB)
33
+ return keyPressedA && keyPressedB
34
+ }
@@ -1,6 +1,6 @@
1
1
  import { useState } from 'react'
2
2
 
3
- export default function 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