npm-pkg-hook 1.3.7 → 1.3.8
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/.eslintrc.js +38 -38
- package/.eslintrc.json +127 -127
- package/.github/pull_request_template.md +17 -17
- package/.github/workflows/pepeline.yaml +29 -29
- package/package.json +46 -46
- package/script.txt +6 -6
- package/src/config/client/index.js +1 -1
- package/src/hooks/getCategoriesWithProduct/helpers/index.js +7 -7
- package/src/hooks/getCategoriesWithProduct/index.js +62 -62
- package/src/hooks/getSession/index.js +18 -18
- package/src/hooks/useAnimationFrame/index.js +45 -45
- package/src/hooks/useAsideCart/index.js +155 -155
- package/src/hooks/useAsideCart/queries.js +10 -10
- package/src/hooks/useCart/index.js +2 -2
- package/src/hooks/useCart/queries.js +164 -164
- package/src/hooks/useCart/useCart/helpers/index.js +75 -75
- package/src/hooks/useCart/useCart/index.js +410 -410
- package/src/hooks/useCart/useGetCart/index.js +31 -31
- package/src/hooks/useCatWithProductClient/index.js +56 -56
- package/src/hooks/useCatWithProductClient/queries.js +55 -55
- package/src/hooks/useCategoriesProduct/index.js +12 -12
- package/src/hooks/useCategoriesProduct/queries.js +16 -16
- package/src/hooks/useCategoryInStore/queries.js +78 -78
- package/src/hooks/useChartData/useChartData/index.js +199 -199
- package/src/hooks/useChartData/useChartDataAllOrders/index.js +94 -94
- package/src/hooks/useCheckbox/index.js +115 -115
- package/src/hooks/useCreateProduct/helpers/manageCacheDataCatProduct/index.js +52 -0
- package/src/hooks/useCreateProduct/index.js +8 -3
- package/src/hooks/useDeleteSubProductOptional/index.js +30 -30
- package/src/hooks/useDeleteSubProductOptional/queries.js +10 -10
- package/src/hooks/useDessert/helpers/index.js +51 -51
- package/src/hooks/useDevices/index.js +35 -35
- package/src/hooks/useDevices/queries.js +19 -19
- package/src/hooks/useDropzone/index.js +94 -94
- package/src/hooks/useDynamicAuth/index.js +13 -13
- package/src/hooks/useDynamicAuth/queries.js +24 -24
- package/src/hooks/useEditSubProductOptional/queries.js +10 -10
- package/src/hooks/useEvent/index.js +33 -33
- package/src/hooks/useFavoriteStores/index.js +19 -19
- package/src/hooks/useFavoriteStores/queries.js +47 -47
- package/src/hooks/useFetchJson/index.js +25 -25
- package/src/hooks/useFingerprintjs/index.js +172 -172
- package/src/hooks/useFullScreenMode/index.js +65 -65
- package/src/hooks/useGenerateNumberArray/index.js +17 -17
- package/src/hooks/useGetExtProductFoodsSubOptionalAll/index.js +14 -14
- package/src/hooks/useGetFoodRecomended/index.js +32 -33
- package/src/hooks/useGetFoodRecomended/queries.js +47 -47
- package/src/hooks/useGetMinPrice/index.js +12 -12
- package/src/hooks/useGetMinPrice/queries.js +7 -7
- package/src/hooks/useGetOneStoreRating/index.js +40 -40
- package/src/hooks/useGetOneStoreRating/queries.js +18 -18
- package/src/hooks/useGoogleLogin/index.js +160 -160
- package/src/hooks/useGoogleLogin/loadScript.js +15 -15
- package/src/hooks/useGoogleLogin/removeScript.js +7 -7
- package/src/hooks/useHover/index.js +29 -29
- package/src/hooks/useImagesStore/index.js +5 -4
- package/src/hooks/useInnerHtml/index.js +39 -39
- package/src/hooks/useKeypress/index.js +28 -28
- package/src/hooks/useLocationNavigate/index.js +54 -54
- package/src/hooks/useLogout/index.js +29 -21
- package/src/hooks/useManageQueryParams/index.js +37 -36
- package/src/hooks/useMobile/index.js +39 -39
- package/src/hooks/useOrderClient/index.js +5 -5
- package/src/hooks/useProviders/index.js +3 -3
- package/src/hooks/useProviders/queries.js +31 -31
- package/src/hooks/useProviders/useProvidersCreateStore/index.js +12 -12
- package/src/hooks/useProviders/useProvidersDataStore/index.js +24 -24
- package/src/hooks/useProvidersStore/index.js +24 -24
- package/src/hooks/useProvidersStore/queries.js +31 -31
- package/src/hooks/useRatingArrayData/index.js +54 -54
- package/src/hooks/useRatingArrayData/queries.js +19 -19
- package/src/hooks/useRemoveExtraProductFoodsOptional/index.js +23 -23
- package/src/hooks/useRemoveExtraProductFoodsOptional/queries.js +48 -48
- package/src/hooks/useRestaurant/index.js +19 -19
- package/src/hooks/useRestaurant/queries.js +80 -80
- package/src/hooks/useSales/useGetAllSales/index.js +25 -25
- package/src/hooks/useSchedule/index.js +72 -72
- package/src/hooks/useSchedule/index.jsx +22 -22
- package/src/hooks/useSchedule/queries.js +43 -43
- package/src/hooks/useScheduleData/index.js +123 -123
- package/src/hooks/useScroll/index.js +56 -56
- package/src/hooks/useScrollRotate/index.js +16 -16
- package/src/hooks/useStatusOpenStore/helpers/index.js +101 -101
- package/src/hooks/useStatusOpenStore/index.js +172 -172
- package/src/hooks/useStatusOrdersClient/queries.js +80 -80
- package/src/hooks/useStore/queries.js +163 -163
- package/src/hooks/useStoreCalendar/index.js +5 -5
- package/src/hooks/useStoreContacts/queries.js +1 -1
- package/src/hooks/useTimeAgo/useTimeAgo.js +39 -39
- package/src/hooks/useUpdateExtProductFoodsSubOptional/index.js +38 -38
- package/src/hooks/useWindowSize/index.js +38 -38
- package/src/mock/dessert/index.js +16 -16
- package/src/mock/index.js +1 -1
- package/.vscode/extensions.json +0 -6
- package/.vscode/settings.json +0 -8
|
@@ -1,80 +1,80 @@
|
|
|
1
|
-
import { gql } from '@apollo/client'
|
|
2
|
-
|
|
3
|
-
export const GET_ALL_PEDIDOS_STATUS = gql`
|
|
4
|
-
query getAllPedidoUserFinal($id: ID) {
|
|
5
|
-
getAllPedidoUserFinal(id: $id) {
|
|
6
|
-
pdpId
|
|
7
|
-
idStore
|
|
8
|
-
pCodeRef
|
|
9
|
-
payMethodPState
|
|
10
|
-
pPRecoger
|
|
11
|
-
totalProductsPrice
|
|
12
|
-
pSState
|
|
13
|
-
getOneStore {
|
|
14
|
-
idStore
|
|
15
|
-
cId
|
|
16
|
-
id
|
|
17
|
-
dId
|
|
18
|
-
ctId
|
|
19
|
-
neighborhoodStore
|
|
20
|
-
Viaprincipal
|
|
21
|
-
storeOwner
|
|
22
|
-
storeName
|
|
23
|
-
emailStore
|
|
24
|
-
storePhone
|
|
25
|
-
Image
|
|
26
|
-
pais {
|
|
27
|
-
cId
|
|
28
|
-
cName
|
|
29
|
-
}
|
|
30
|
-
city {
|
|
31
|
-
ctId
|
|
32
|
-
cName
|
|
33
|
-
dId
|
|
34
|
-
}
|
|
35
|
-
department {
|
|
36
|
-
dId
|
|
37
|
-
cId
|
|
38
|
-
dName
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
pDatCre
|
|
42
|
-
locationUser
|
|
43
|
-
pDatMod
|
|
44
|
-
getAllPedidoStore {
|
|
45
|
-
pdpId
|
|
46
|
-
pId
|
|
47
|
-
idStore
|
|
48
|
-
ShoppingCard
|
|
49
|
-
pCodeRef
|
|
50
|
-
pPStateP
|
|
51
|
-
payMethodPState
|
|
52
|
-
pPRecoger
|
|
53
|
-
pDatCre
|
|
54
|
-
pDatMod
|
|
55
|
-
getAllShoppingCard {
|
|
56
|
-
ShoppingCard
|
|
57
|
-
comments
|
|
58
|
-
cantProducts
|
|
59
|
-
pId
|
|
60
|
-
productFood {
|
|
61
|
-
pId
|
|
62
|
-
carProId
|
|
63
|
-
colorId
|
|
64
|
-
idStore
|
|
65
|
-
pName
|
|
66
|
-
ProPrice
|
|
67
|
-
ProDescuento
|
|
68
|
-
ProDescription
|
|
69
|
-
ValueDelivery
|
|
70
|
-
ProImage
|
|
71
|
-
ProStar
|
|
72
|
-
pState
|
|
73
|
-
pDatCre
|
|
74
|
-
pDatMod
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
`
|
|
1
|
+
import { gql } from '@apollo/client'
|
|
2
|
+
|
|
3
|
+
export const GET_ALL_PEDIDOS_STATUS = gql`
|
|
4
|
+
query getAllPedidoUserFinal($id: ID) {
|
|
5
|
+
getAllPedidoUserFinal(id: $id) {
|
|
6
|
+
pdpId
|
|
7
|
+
idStore
|
|
8
|
+
pCodeRef
|
|
9
|
+
payMethodPState
|
|
10
|
+
pPRecoger
|
|
11
|
+
totalProductsPrice
|
|
12
|
+
pSState
|
|
13
|
+
getOneStore {
|
|
14
|
+
idStore
|
|
15
|
+
cId
|
|
16
|
+
id
|
|
17
|
+
dId
|
|
18
|
+
ctId
|
|
19
|
+
neighborhoodStore
|
|
20
|
+
Viaprincipal
|
|
21
|
+
storeOwner
|
|
22
|
+
storeName
|
|
23
|
+
emailStore
|
|
24
|
+
storePhone
|
|
25
|
+
Image
|
|
26
|
+
pais {
|
|
27
|
+
cId
|
|
28
|
+
cName
|
|
29
|
+
}
|
|
30
|
+
city {
|
|
31
|
+
ctId
|
|
32
|
+
cName
|
|
33
|
+
dId
|
|
34
|
+
}
|
|
35
|
+
department {
|
|
36
|
+
dId
|
|
37
|
+
cId
|
|
38
|
+
dName
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
pDatCre
|
|
42
|
+
locationUser
|
|
43
|
+
pDatMod
|
|
44
|
+
getAllPedidoStore {
|
|
45
|
+
pdpId
|
|
46
|
+
pId
|
|
47
|
+
idStore
|
|
48
|
+
ShoppingCard
|
|
49
|
+
pCodeRef
|
|
50
|
+
pPStateP
|
|
51
|
+
payMethodPState
|
|
52
|
+
pPRecoger
|
|
53
|
+
pDatCre
|
|
54
|
+
pDatMod
|
|
55
|
+
getAllShoppingCard {
|
|
56
|
+
ShoppingCard
|
|
57
|
+
comments
|
|
58
|
+
cantProducts
|
|
59
|
+
pId
|
|
60
|
+
productFood {
|
|
61
|
+
pId
|
|
62
|
+
carProId
|
|
63
|
+
colorId
|
|
64
|
+
idStore
|
|
65
|
+
pName
|
|
66
|
+
ProPrice
|
|
67
|
+
ProDescuento
|
|
68
|
+
ProDescription
|
|
69
|
+
ValueDelivery
|
|
70
|
+
ProImage
|
|
71
|
+
ProStar
|
|
72
|
+
pState
|
|
73
|
+
pDatCre
|
|
74
|
+
pDatMod
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
`
|
|
@@ -1,163 +1,163 @@
|
|
|
1
|
-
import { gql } from '@apollo/client'
|
|
2
|
-
|
|
3
|
-
export const CREATE_ONE_STORE = gql`
|
|
4
|
-
mutation newRegisterStore($input: IStore){
|
|
5
|
-
newRegisterStore(input: $input){
|
|
6
|
-
success
|
|
7
|
-
message
|
|
8
|
-
idStore
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
`
|
|
12
|
-
|
|
13
|
-
export const GET_ONE_STORE = gql`
|
|
14
|
-
query getStore($id: ID, $idStore: ID){
|
|
15
|
-
getStore(id: $id, idStore: $idStore){
|
|
16
|
-
cId
|
|
17
|
-
id
|
|
18
|
-
scheduleOpenAll
|
|
19
|
-
dId
|
|
20
|
-
idStore
|
|
21
|
-
ctId
|
|
22
|
-
neighborhoodStore
|
|
23
|
-
Viaprincipal
|
|
24
|
-
catStore
|
|
25
|
-
storeOwner
|
|
26
|
-
storeName
|
|
27
|
-
ImageName
|
|
28
|
-
emailStore
|
|
29
|
-
storePhone
|
|
30
|
-
socialRaz
|
|
31
|
-
Image
|
|
32
|
-
banner
|
|
33
|
-
|
|
34
|
-
documentIdentifier
|
|
35
|
-
uPhoNum
|
|
36
|
-
storeName
|
|
37
|
-
ULocation
|
|
38
|
-
upLat
|
|
39
|
-
upLon
|
|
40
|
-
uState
|
|
41
|
-
siteWeb
|
|
42
|
-
|
|
43
|
-
description
|
|
44
|
-
createdAt
|
|
45
|
-
secVia
|
|
46
|
-
NitStore
|
|
47
|
-
typeRegiments
|
|
48
|
-
typeContribute
|
|
49
|
-
addressStore
|
|
50
|
-
pais {
|
|
51
|
-
cId
|
|
52
|
-
cName
|
|
53
|
-
cCalCod
|
|
54
|
-
cState
|
|
55
|
-
cDatCre
|
|
56
|
-
cDatMod
|
|
57
|
-
}
|
|
58
|
-
city {
|
|
59
|
-
ctId
|
|
60
|
-
dId
|
|
61
|
-
cName
|
|
62
|
-
cState
|
|
63
|
-
cDatCre
|
|
64
|
-
cDatMod
|
|
65
|
-
}
|
|
66
|
-
department {
|
|
67
|
-
dId
|
|
68
|
-
cId
|
|
69
|
-
dName
|
|
70
|
-
dState
|
|
71
|
-
dDatCre
|
|
72
|
-
dDatMod
|
|
73
|
-
}
|
|
74
|
-
getStoreSchedules {
|
|
75
|
-
idStore
|
|
76
|
-
schId
|
|
77
|
-
id
|
|
78
|
-
schDay
|
|
79
|
-
schHoSta
|
|
80
|
-
schHoEnd
|
|
81
|
-
schState
|
|
82
|
-
}
|
|
83
|
-
cateStore {
|
|
84
|
-
catStore
|
|
85
|
-
cName
|
|
86
|
-
cState
|
|
87
|
-
cDatCre
|
|
88
|
-
cDatMod
|
|
89
|
-
csDescription
|
|
90
|
-
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
`
|
|
95
|
-
export const GET_ONE_STORE_BY_ID = gql`
|
|
96
|
-
query getOneStore($StoreName: String, $idStore: ID){
|
|
97
|
-
getOneStore(idStore: $idStore, StoreName: $StoreName) {
|
|
98
|
-
idStore
|
|
99
|
-
cId
|
|
100
|
-
id
|
|
101
|
-
dId
|
|
102
|
-
ctId
|
|
103
|
-
catStore
|
|
104
|
-
neighborhoodStore
|
|
105
|
-
Viaprincipal
|
|
106
|
-
storeOwner
|
|
107
|
-
storeName
|
|
108
|
-
emailStore
|
|
109
|
-
storePhone
|
|
110
|
-
socialRaz
|
|
111
|
-
Image
|
|
112
|
-
banner
|
|
113
|
-
documentIdentifier
|
|
114
|
-
uPhoNum
|
|
115
|
-
ULocation
|
|
116
|
-
upLat
|
|
117
|
-
upLon
|
|
118
|
-
uState
|
|
119
|
-
siteWeb
|
|
120
|
-
description
|
|
121
|
-
NitStore
|
|
122
|
-
typeRegiments
|
|
123
|
-
typeContribute
|
|
124
|
-
secVia
|
|
125
|
-
addressStore
|
|
126
|
-
createdAt
|
|
127
|
-
pais{
|
|
128
|
-
cId
|
|
129
|
-
cName
|
|
130
|
-
cCalCod
|
|
131
|
-
cState
|
|
132
|
-
cDatCre
|
|
133
|
-
cDatMod
|
|
134
|
-
}
|
|
135
|
-
city {
|
|
136
|
-
ctId
|
|
137
|
-
dId
|
|
138
|
-
cName
|
|
139
|
-
cState
|
|
140
|
-
cDatCre
|
|
141
|
-
cDatMod
|
|
142
|
-
}
|
|
143
|
-
department {
|
|
144
|
-
dId
|
|
145
|
-
cId
|
|
146
|
-
dName
|
|
147
|
-
dState
|
|
148
|
-
dDatCre
|
|
149
|
-
dDatMod
|
|
150
|
-
}
|
|
151
|
-
cateStore {
|
|
152
|
-
catStore
|
|
153
|
-
idUser
|
|
154
|
-
cName
|
|
155
|
-
cState
|
|
156
|
-
cDatCre
|
|
157
|
-
cDatMod
|
|
158
|
-
csDescription
|
|
159
|
-
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
`
|
|
1
|
+
import { gql } from '@apollo/client'
|
|
2
|
+
|
|
3
|
+
export const CREATE_ONE_STORE = gql`
|
|
4
|
+
mutation newRegisterStore($input: IStore){
|
|
5
|
+
newRegisterStore(input: $input){
|
|
6
|
+
success
|
|
7
|
+
message
|
|
8
|
+
idStore
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
`
|
|
12
|
+
|
|
13
|
+
export const GET_ONE_STORE = gql`
|
|
14
|
+
query getStore($id: ID, $idStore: ID){
|
|
15
|
+
getStore(id: $id, idStore: $idStore){
|
|
16
|
+
cId
|
|
17
|
+
id
|
|
18
|
+
scheduleOpenAll
|
|
19
|
+
dId
|
|
20
|
+
idStore
|
|
21
|
+
ctId
|
|
22
|
+
neighborhoodStore
|
|
23
|
+
Viaprincipal
|
|
24
|
+
catStore
|
|
25
|
+
storeOwner
|
|
26
|
+
storeName
|
|
27
|
+
ImageName
|
|
28
|
+
emailStore
|
|
29
|
+
storePhone
|
|
30
|
+
socialRaz
|
|
31
|
+
Image
|
|
32
|
+
banner
|
|
33
|
+
|
|
34
|
+
documentIdentifier
|
|
35
|
+
uPhoNum
|
|
36
|
+
storeName
|
|
37
|
+
ULocation
|
|
38
|
+
upLat
|
|
39
|
+
upLon
|
|
40
|
+
uState
|
|
41
|
+
siteWeb
|
|
42
|
+
|
|
43
|
+
description
|
|
44
|
+
createdAt
|
|
45
|
+
secVia
|
|
46
|
+
NitStore
|
|
47
|
+
typeRegiments
|
|
48
|
+
typeContribute
|
|
49
|
+
addressStore
|
|
50
|
+
pais {
|
|
51
|
+
cId
|
|
52
|
+
cName
|
|
53
|
+
cCalCod
|
|
54
|
+
cState
|
|
55
|
+
cDatCre
|
|
56
|
+
cDatMod
|
|
57
|
+
}
|
|
58
|
+
city {
|
|
59
|
+
ctId
|
|
60
|
+
dId
|
|
61
|
+
cName
|
|
62
|
+
cState
|
|
63
|
+
cDatCre
|
|
64
|
+
cDatMod
|
|
65
|
+
}
|
|
66
|
+
department {
|
|
67
|
+
dId
|
|
68
|
+
cId
|
|
69
|
+
dName
|
|
70
|
+
dState
|
|
71
|
+
dDatCre
|
|
72
|
+
dDatMod
|
|
73
|
+
}
|
|
74
|
+
getStoreSchedules {
|
|
75
|
+
idStore
|
|
76
|
+
schId
|
|
77
|
+
id
|
|
78
|
+
schDay
|
|
79
|
+
schHoSta
|
|
80
|
+
schHoEnd
|
|
81
|
+
schState
|
|
82
|
+
}
|
|
83
|
+
cateStore {
|
|
84
|
+
catStore
|
|
85
|
+
cName
|
|
86
|
+
cState
|
|
87
|
+
cDatCre
|
|
88
|
+
cDatMod
|
|
89
|
+
csDescription
|
|
90
|
+
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
`
|
|
95
|
+
export const GET_ONE_STORE_BY_ID = gql`
|
|
96
|
+
query getOneStore($StoreName: String, $idStore: ID){
|
|
97
|
+
getOneStore(idStore: $idStore, StoreName: $StoreName) {
|
|
98
|
+
idStore
|
|
99
|
+
cId
|
|
100
|
+
id
|
|
101
|
+
dId
|
|
102
|
+
ctId
|
|
103
|
+
catStore
|
|
104
|
+
neighborhoodStore
|
|
105
|
+
Viaprincipal
|
|
106
|
+
storeOwner
|
|
107
|
+
storeName
|
|
108
|
+
emailStore
|
|
109
|
+
storePhone
|
|
110
|
+
socialRaz
|
|
111
|
+
Image
|
|
112
|
+
banner
|
|
113
|
+
documentIdentifier
|
|
114
|
+
uPhoNum
|
|
115
|
+
ULocation
|
|
116
|
+
upLat
|
|
117
|
+
upLon
|
|
118
|
+
uState
|
|
119
|
+
siteWeb
|
|
120
|
+
description
|
|
121
|
+
NitStore
|
|
122
|
+
typeRegiments
|
|
123
|
+
typeContribute
|
|
124
|
+
secVia
|
|
125
|
+
addressStore
|
|
126
|
+
createdAt
|
|
127
|
+
pais{
|
|
128
|
+
cId
|
|
129
|
+
cName
|
|
130
|
+
cCalCod
|
|
131
|
+
cState
|
|
132
|
+
cDatCre
|
|
133
|
+
cDatMod
|
|
134
|
+
}
|
|
135
|
+
city {
|
|
136
|
+
ctId
|
|
137
|
+
dId
|
|
138
|
+
cName
|
|
139
|
+
cState
|
|
140
|
+
cDatCre
|
|
141
|
+
cDatMod
|
|
142
|
+
}
|
|
143
|
+
department {
|
|
144
|
+
dId
|
|
145
|
+
cId
|
|
146
|
+
dName
|
|
147
|
+
dState
|
|
148
|
+
dDatCre
|
|
149
|
+
dDatMod
|
|
150
|
+
}
|
|
151
|
+
cateStore {
|
|
152
|
+
catStore
|
|
153
|
+
idUser
|
|
154
|
+
cName
|
|
155
|
+
cState
|
|
156
|
+
cDatCre
|
|
157
|
+
cDatMod
|
|
158
|
+
csDescription
|
|
159
|
+
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
`
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export const useStoreCalendar = () => {
|
|
2
|
-
return {
|
|
3
|
-
true: true
|
|
4
|
-
}
|
|
5
|
-
}
|
|
1
|
+
export const useStoreCalendar = () => {
|
|
2
|
+
return {
|
|
3
|
+
true: true
|
|
4
|
+
}
|
|
5
|
+
}
|
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
import { useEffect, useState } from 'react'
|
|
2
|
-
|
|
3
|
-
const DATE_UNITS = [
|
|
4
|
-
['day', 86400],
|
|
5
|
-
['hour', 3600],
|
|
6
|
-
['minute', 60],
|
|
7
|
-
['second', 1]
|
|
8
|
-
]
|
|
9
|
-
|
|
10
|
-
const getDateDiffs = (timestamp) => {
|
|
11
|
-
const now = Date.now()
|
|
12
|
-
const elapsed = (timestamp - now) / 1000
|
|
13
|
-
|
|
14
|
-
for (const [unit, secondsInUnit] of DATE_UNITS) {
|
|
15
|
-
if (Math.abs(elapsed) > secondsInUnit || unit === 'second') {
|
|
16
|
-
const value = Math.round(elapsed / secondsInUnit)
|
|
17
|
-
return { value, unit }
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export const useTimeAgo = (timestamp) => {
|
|
23
|
-
const [timeAgo, setTimeAgo] = useState(() => { return getDateDiffs(timestamp) })
|
|
24
|
-
|
|
25
|
-
useEffect(() => {
|
|
26
|
-
const interval = setInterval(() => {
|
|
27
|
-
const newTimeAgo = getDateDiffs(timestamp)
|
|
28
|
-
setTimeAgo(newTimeAgo)
|
|
29
|
-
}, 5000)
|
|
30
|
-
|
|
31
|
-
return () => { return clearInterval(interval) }
|
|
32
|
-
}, [timestamp])
|
|
33
|
-
|
|
34
|
-
const rtf = new Intl.RelativeTimeFormat('es', { style: 'short' })
|
|
35
|
-
|
|
36
|
-
const { value, unit } = timeAgo
|
|
37
|
-
|
|
38
|
-
return rtf && rtf?.format(value, unit)
|
|
39
|
-
}
|
|
1
|
+
import { useEffect, useState } from 'react'
|
|
2
|
+
|
|
3
|
+
const DATE_UNITS = [
|
|
4
|
+
['day', 86400],
|
|
5
|
+
['hour', 3600],
|
|
6
|
+
['minute', 60],
|
|
7
|
+
['second', 1]
|
|
8
|
+
]
|
|
9
|
+
|
|
10
|
+
const getDateDiffs = (timestamp) => {
|
|
11
|
+
const now = Date.now()
|
|
12
|
+
const elapsed = (timestamp - now) / 1000
|
|
13
|
+
|
|
14
|
+
for (const [unit, secondsInUnit] of DATE_UNITS) {
|
|
15
|
+
if (Math.abs(elapsed) > secondsInUnit || unit === 'second') {
|
|
16
|
+
const value = Math.round(elapsed / secondsInUnit)
|
|
17
|
+
return { value, unit }
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export const useTimeAgo = (timestamp) => {
|
|
23
|
+
const [timeAgo, setTimeAgo] = useState(() => { return getDateDiffs(timestamp) })
|
|
24
|
+
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
const interval = setInterval(() => {
|
|
27
|
+
const newTimeAgo = getDateDiffs(timestamp)
|
|
28
|
+
setTimeAgo(newTimeAgo)
|
|
29
|
+
}, 5000)
|
|
30
|
+
|
|
31
|
+
return () => { return clearInterval(interval) }
|
|
32
|
+
}, [timestamp])
|
|
33
|
+
|
|
34
|
+
const rtf = new Intl.RelativeTimeFormat('es', { style: 'short' })
|
|
35
|
+
|
|
36
|
+
const { value, unit } = timeAgo
|
|
37
|
+
|
|
38
|
+
return rtf && rtf?.format(value, unit)
|
|
39
|
+
}
|
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
import { useMutation } from '@apollo/client'
|
|
2
|
-
import { updateCacheMod } from '../../utils'
|
|
3
|
-
import { GET_EXTRAS_PRODUCT_FOOD_OPTIONAL, GET_EXTRAS_PRODUCT_FOOD_SUB_OPTIONAL } from '../useProductsFood/queriesStore'
|
|
4
|
-
|
|
5
|
-
export const useUpdateExtProductFoodsSubOptional = () => {
|
|
6
|
-
const [updateExtProductFoodsSubOptional] = useMutation(GET_EXTRAS_PRODUCT_FOOD_SUB_OPTIONAL)
|
|
7
|
-
|
|
8
|
-
const handleMutateExtProductFoodsSubOptional = ({
|
|
9
|
-
pId,
|
|
10
|
-
title,
|
|
11
|
-
listId,
|
|
12
|
-
id,
|
|
13
|
-
state = 1
|
|
14
|
-
}) => {
|
|
15
|
-
updateExtProductFoodsSubOptional({
|
|
16
|
-
variables: {
|
|
17
|
-
input: {
|
|
18
|
-
pId,
|
|
19
|
-
OptionalSubProName: title,
|
|
20
|
-
exCodeOptionExtra: listId,
|
|
21
|
-
exCode: id,
|
|
22
|
-
state
|
|
23
|
-
}
|
|
24
|
-
},
|
|
25
|
-
update: (cache, { data: { ExtProductFoodsOptionalAll } }) => {
|
|
26
|
-
return updateCacheMod({
|
|
27
|
-
cache,
|
|
28
|
-
query: GET_EXTRAS_PRODUCT_FOOD_OPTIONAL,
|
|
29
|
-
nameFun: 'ExtProductFoodsOptionalAll',
|
|
30
|
-
dataNew: ExtProductFoodsOptionalAll
|
|
31
|
-
})
|
|
32
|
-
}
|
|
33
|
-
})
|
|
34
|
-
}
|
|
35
|
-
return {
|
|
36
|
-
handleMutateExtProductFoodsSubOptional
|
|
37
|
-
}
|
|
38
|
-
}
|
|
1
|
+
import { useMutation } from '@apollo/client'
|
|
2
|
+
import { updateCacheMod } from '../../utils'
|
|
3
|
+
import { GET_EXTRAS_PRODUCT_FOOD_OPTIONAL, GET_EXTRAS_PRODUCT_FOOD_SUB_OPTIONAL } from '../useProductsFood/queriesStore'
|
|
4
|
+
|
|
5
|
+
export const useUpdateExtProductFoodsSubOptional = () => {
|
|
6
|
+
const [updateExtProductFoodsSubOptional] = useMutation(GET_EXTRAS_PRODUCT_FOOD_SUB_OPTIONAL)
|
|
7
|
+
|
|
8
|
+
const handleMutateExtProductFoodsSubOptional = ({
|
|
9
|
+
pId,
|
|
10
|
+
title,
|
|
11
|
+
listId,
|
|
12
|
+
id,
|
|
13
|
+
state = 1
|
|
14
|
+
}) => {
|
|
15
|
+
updateExtProductFoodsSubOptional({
|
|
16
|
+
variables: {
|
|
17
|
+
input: {
|
|
18
|
+
pId,
|
|
19
|
+
OptionalSubProName: title,
|
|
20
|
+
exCodeOptionExtra: listId,
|
|
21
|
+
exCode: id,
|
|
22
|
+
state
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
update: (cache, { data: { ExtProductFoodsOptionalAll } }) => {
|
|
26
|
+
return updateCacheMod({
|
|
27
|
+
cache,
|
|
28
|
+
query: GET_EXTRAS_PRODUCT_FOOD_OPTIONAL,
|
|
29
|
+
nameFun: 'ExtProductFoodsOptionalAll',
|
|
30
|
+
dataNew: ExtProductFoodsOptionalAll
|
|
31
|
+
})
|
|
32
|
+
}
|
|
33
|
+
})
|
|
34
|
+
}
|
|
35
|
+
return {
|
|
36
|
+
handleMutateExtProductFoodsSubOptional
|
|
37
|
+
}
|
|
38
|
+
}
|