npm-pkg-hook 1.0.1 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env +1 -0
- package/.eslintrc.js +132 -0
- package/.github/pull_request_template.md +18 -0
- package/.github/workflows/pepeline.yaml +30 -0
- package/.vscode/extensions.json +6 -0
- package/.vscode/settings.json +12 -0
- package/next.config.js +4 -4
- package/package.json +17 -7
- package/script.txt +7 -0
- package/src/hooks/index.js +39 -8
- package/src/hooks/updateExtProductFoodsOptional/index.js +38 -0
- package/src/hooks/useAcumulateDate/index.js +14 -14
- package/src/hooks/useAnimationText/index.jsx +7 -6
- package/src/hooks/useBanner/index.js +19 -0
- package/src/hooks/useCatWithProduct/index.js +42 -0
- package/src/hooks/useCatWithProduct/queries.js +172 -0
- package/src/hooks/useCategoryInStore/index.js +94 -0
- package/src/hooks/{useGetCategorieStore → useCategoryInStore}/queries.js +0 -0
- package/src/hooks/useChartData/index.js +168 -0
- package/src/hooks/useCheckbox/index.js +114 -0
- package/src/hooks/useClients/index.js +13 -0
- package/src/hooks/useClients/queries.js +118 -0
- package/src/hooks/useConnection/index.js +23 -0
- package/src/hooks/useCreateProduct/helpers/useEditImageProduct/index.js +165 -0
- package/src/hooks/useCreateProduct/index.js +268 -0
- package/src/hooks/useDessert/index.js +141 -0
- package/src/hooks/useDrag/index.js +14 -9
- package/src/hooks/useFetchMoreInteractions/index.jsx +6 -3
- package/src/hooks/useFormTools/index.js +16 -3
- package/src/hooks/useFormatDate/index.js +34 -0
- package/src/hooks/useImageOptimization/index.js +28 -0
- package/src/hooks/useImageWeight/index.js +52 -0
- package/src/hooks/useImagesStore/index.js +171 -0
- package/src/hooks/useImagesStore/queries.js +216 -0
- package/src/hooks/useIntersection/index.js +54 -1
- package/src/hooks/useLazyScript/index.js +72 -0
- package/src/hooks/useLocationNavigate/index.js +1 -1
- package/src/hooks/useMobile/index.js +38 -0
- package/src/hooks/useMutateHeight/index.js +37 -0
- package/src/hooks/useProductsFood/index.js +190 -0
- package/src/hooks/useProductsFood/queriesStore.js +781 -0
- package/src/hooks/useProductsFood/usetagsProducts.js +57 -0
- package/src/hooks/useReport/index.js +35 -0
- package/src/hooks/useReport/queries.js +122 -0
- package/src/hooks/useRestaurant/queries.js +11 -1
- package/src/hooks/useSales/index.js +589 -0
- package/src/hooks/useSales/queries.js +291 -0
- package/src/hooks/useSales/useGetSale.js +12 -0
- package/src/hooks/useSales/useTotalSales.js +17 -0
- package/src/hooks/useSaveAvailableProduct/helpers/index.js +30 -0
- package/src/hooks/useSaveAvailableProduct/index.js +26 -0
- package/src/hooks/useSaveAvailableProduct/queries.js +10 -0
- package/src/hooks/useSchedule/index.jsx +23 -0
- package/src/hooks/useStore/index.js +18 -0
- package/src/hooks/useStore/queries.js +136 -0
- package/src/hooks/useStoreCalendar/index.js +7 -0
- package/src/hooks/useUpdateCart/index.js +5 -4
- package/src/hooks/useUpdateExtProductFoodsSubOptional/index.js +37 -0
- package/src/hooks/useUser/index.js +6 -2
- package/src/hooks/useUser/queries.js +69 -0
- package/src/index.jsx +2 -1
- package/src/mock/dessert/index.js +16 -0
- package/src/mock/index.js +2 -0
- package/src/utils/index.js +80 -1
- package/src/hooks/useGetCategorieStore/index.js +0 -21
package/src/index.jsx
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export * from './hooks/index'
|
|
1
|
+
export * from './hooks/index'
|
|
2
|
+
export * from './utils'
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { RandomCode } from '../../utils'
|
|
2
|
+
|
|
3
|
+
export const MockData = {
|
|
4
|
+
lists: {
|
|
5
|
+
'01list': {
|
|
6
|
+
id: RandomCode(9),
|
|
7
|
+
title: 'Elige tu salsa favorita',
|
|
8
|
+
numberLimit: 0,
|
|
9
|
+
required: 0,
|
|
10
|
+
value: '',
|
|
11
|
+
cards: [
|
|
12
|
+
]
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
listIds: ['01list']
|
|
16
|
+
}
|
package/src/utils/index.js
CHANGED
|
@@ -24,4 +24,83 @@ export const validationSubmitHooks = elements => {
|
|
|
24
24
|
export const getCurrentDomain = () => {
|
|
25
25
|
return typeof window !== 'undefined' && window.location.hostname.split('.').slice(-2).join('.')
|
|
26
26
|
}
|
|
27
|
-
|
|
27
|
+
|
|
28
|
+
export function RandomCode(length) {
|
|
29
|
+
let result = ''
|
|
30
|
+
let characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'
|
|
31
|
+
let charactersLength = characters.length
|
|
32
|
+
for (let i = 0; i < length; i++) {
|
|
33
|
+
result += characters.charAt(Math.floor(Math.random() *
|
|
34
|
+
charactersLength))
|
|
35
|
+
}
|
|
36
|
+
return result
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* actualizar cache de apollo
|
|
40
|
+
* @param {{ cache: object, query: object, nameFun: string, dataNew: object, type: number, id: string }} params Parámetros para actualizar el cachet de apollo
|
|
41
|
+
* @returns {null} no hay retorno
|
|
42
|
+
*/
|
|
43
|
+
export const updateCacheMod = async ({ cache, query, nameFun, dataNew, type, id }) => {
|
|
44
|
+
return cache.modify({
|
|
45
|
+
fields: {
|
|
46
|
+
[nameFun](dataOld = []) {
|
|
47
|
+
if (type === 1) return cache.writeQuery({ query, data: [...(dataOld || []), { ...(dataNew || {}) }] })
|
|
48
|
+
if (type === 2) return cache.writeQuery({ query, data: { ...(dataOld || {}), ...(dataNew || {}) } })
|
|
49
|
+
if (type === 3) return cache.writeQuery({ query, data: dataOld.filter(x => { return x === id }) })
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
})
|
|
53
|
+
}
|
|
54
|
+
export const initializer = (initialValue = initialState) => { return JSON.parse(localStorage.getItem(process.env.LOCAL_SALES_STORE)) || initialValue }
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
export const numberFormat = value => { return value ? (parseInt(value) ? new Intl.NumberFormat('de-DE').format(parseFloat(`${value}`.replace(/\./g, ''))) : value) : (value) }
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
export const MONTHS = [
|
|
62
|
+
'January',
|
|
63
|
+
'February',
|
|
64
|
+
'March',
|
|
65
|
+
'April',
|
|
66
|
+
'May',
|
|
67
|
+
'June',
|
|
68
|
+
'July',
|
|
69
|
+
'August',
|
|
70
|
+
'September',
|
|
71
|
+
'October',
|
|
72
|
+
'November',
|
|
73
|
+
'December'
|
|
74
|
+
]
|
|
75
|
+
export const SPANISH_MONTHS = {
|
|
76
|
+
0:'Enero',
|
|
77
|
+
1:'Febrero',
|
|
78
|
+
2:'Marzo',
|
|
79
|
+
3:'Abril',
|
|
80
|
+
4:'Mayo',
|
|
81
|
+
5:'Junio',
|
|
82
|
+
6:'Julio',
|
|
83
|
+
7:'Augosto',
|
|
84
|
+
8:'Septiembre',
|
|
85
|
+
9:'Octubre',
|
|
86
|
+
10:'Noviembre ',
|
|
87
|
+
11:'Diciembre'
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
export const convertBase64 = file => {
|
|
92
|
+
return new Promise((resolve, reject) => {
|
|
93
|
+
const reader = new FileReader()
|
|
94
|
+
if (file) {
|
|
95
|
+
reader.readAsDataURL(file)
|
|
96
|
+
}
|
|
97
|
+
reader.onload = () => {
|
|
98
|
+
resolve(reader.result)
|
|
99
|
+
}
|
|
100
|
+
reader.onerror = error => {
|
|
101
|
+
reject(error)
|
|
102
|
+
}
|
|
103
|
+
})
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export const validationImg = file => { return (/\.(jpg|png|gif|jpeg)$/i).test(file.name) }
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { useQuery } from '@apollo/client'
|
|
2
|
-
import { useEffect, useState } from 'react'
|
|
3
|
-
import { GET_ONE_STORE_IN_CATEGORY } from './queries'
|
|
4
|
-
|
|
5
|
-
export const useGetCategorieStore = ({ catStoreId }) => {
|
|
6
|
-
|
|
7
|
-
const { data: dataCatSto, loading, error } = useQuery(GET_ONE_STORE_IN_CATEGORY, {
|
|
8
|
-
variables: {
|
|
9
|
-
catStore: catStoreId
|
|
10
|
-
},
|
|
11
|
-
onError: () => {
|
|
12
|
-
console.log({ message: '', duration: 5000 })
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
})
|
|
16
|
-
const [categories, setCategorieStore] = useState([])
|
|
17
|
-
useEffect(() => {
|
|
18
|
-
setCategorieStore(dataCatSto?.getOneCatStore || [])
|
|
19
|
-
}, [dataCatSto])
|
|
20
|
-
return [categories, { loading, error }]
|
|
21
|
-
}
|