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.
Files changed (65) hide show
  1. package/.env +1 -0
  2. package/.eslintrc.js +132 -0
  3. package/.github/pull_request_template.md +18 -0
  4. package/.github/workflows/pepeline.yaml +30 -0
  5. package/.vscode/extensions.json +6 -0
  6. package/.vscode/settings.json +12 -0
  7. package/next.config.js +4 -4
  8. package/package.json +17 -7
  9. package/script.txt +7 -0
  10. package/src/hooks/index.js +39 -8
  11. package/src/hooks/updateExtProductFoodsOptional/index.js +38 -0
  12. package/src/hooks/useAcumulateDate/index.js +14 -14
  13. package/src/hooks/useAnimationText/index.jsx +7 -6
  14. package/src/hooks/useBanner/index.js +19 -0
  15. package/src/hooks/useCatWithProduct/index.js +42 -0
  16. package/src/hooks/useCatWithProduct/queries.js +172 -0
  17. package/src/hooks/useCategoryInStore/index.js +94 -0
  18. package/src/hooks/{useGetCategorieStore → useCategoryInStore}/queries.js +0 -0
  19. package/src/hooks/useChartData/index.js +168 -0
  20. package/src/hooks/useCheckbox/index.js +114 -0
  21. package/src/hooks/useClients/index.js +13 -0
  22. package/src/hooks/useClients/queries.js +118 -0
  23. package/src/hooks/useConnection/index.js +23 -0
  24. package/src/hooks/useCreateProduct/helpers/useEditImageProduct/index.js +165 -0
  25. package/src/hooks/useCreateProduct/index.js +268 -0
  26. package/src/hooks/useDessert/index.js +141 -0
  27. package/src/hooks/useDrag/index.js +14 -9
  28. package/src/hooks/useFetchMoreInteractions/index.jsx +6 -3
  29. package/src/hooks/useFormTools/index.js +16 -3
  30. package/src/hooks/useFormatDate/index.js +34 -0
  31. package/src/hooks/useImageOptimization/index.js +28 -0
  32. package/src/hooks/useImageWeight/index.js +52 -0
  33. package/src/hooks/useImagesStore/index.js +171 -0
  34. package/src/hooks/useImagesStore/queries.js +216 -0
  35. package/src/hooks/useIntersection/index.js +54 -1
  36. package/src/hooks/useLazyScript/index.js +72 -0
  37. package/src/hooks/useLocationNavigate/index.js +1 -1
  38. package/src/hooks/useMobile/index.js +38 -0
  39. package/src/hooks/useMutateHeight/index.js +37 -0
  40. package/src/hooks/useProductsFood/index.js +190 -0
  41. package/src/hooks/useProductsFood/queriesStore.js +781 -0
  42. package/src/hooks/useProductsFood/usetagsProducts.js +57 -0
  43. package/src/hooks/useReport/index.js +35 -0
  44. package/src/hooks/useReport/queries.js +122 -0
  45. package/src/hooks/useRestaurant/queries.js +11 -1
  46. package/src/hooks/useSales/index.js +589 -0
  47. package/src/hooks/useSales/queries.js +291 -0
  48. package/src/hooks/useSales/useGetSale.js +12 -0
  49. package/src/hooks/useSales/useTotalSales.js +17 -0
  50. package/src/hooks/useSaveAvailableProduct/helpers/index.js +30 -0
  51. package/src/hooks/useSaveAvailableProduct/index.js +26 -0
  52. package/src/hooks/useSaveAvailableProduct/queries.js +10 -0
  53. package/src/hooks/useSchedule/index.jsx +23 -0
  54. package/src/hooks/useStore/index.js +18 -0
  55. package/src/hooks/useStore/queries.js +136 -0
  56. package/src/hooks/useStoreCalendar/index.js +7 -0
  57. package/src/hooks/useUpdateCart/index.js +5 -4
  58. package/src/hooks/useUpdateExtProductFoodsSubOptional/index.js +37 -0
  59. package/src/hooks/useUser/index.js +6 -2
  60. package/src/hooks/useUser/queries.js +69 -0
  61. package/src/index.jsx +2 -1
  62. package/src/mock/dessert/index.js +16 -0
  63. package/src/mock/index.js +2 -0
  64. package/src/utils/index.js +80 -1
  65. package/src/hooks/useGetCategorieStore/index.js +0 -21
@@ -0,0 +1,57 @@
1
+ import { useMutation } from "@apollo/client"
2
+ import { useState } from "react"
3
+ import { RandomCode } from "../../utils"
4
+ import { REGISTER_TAGS_PRODUCT } from "./queriesStore"
5
+
6
+ export const useTagsProducts = () => {
7
+ const [registerTag] = useMutation(REGISTER_TAGS_PRODUCT)
8
+ const data = [
9
+ {
10
+ id: RandomCode(5),
11
+ tag: 'Bebida fria'
12
+ },
13
+ {
14
+ id: RandomCode(5),
15
+ tag: 'Bebida caliente'
16
+ },
17
+ {
18
+ id: RandomCode(5),
19
+ tag: 'Bebida alcohólica'
20
+ },
21
+ {
22
+ id: RandomCode(5),
23
+ tag: 'Bebida sin alcohol'
24
+ }
25
+ ]
26
+ const [tags, setTags] = useState({
27
+ id: '',
28
+ tag: ''
29
+ })
30
+ const handleAddTag = (id, tag) => {
31
+ setTags({
32
+ id,
33
+ tag
34
+ })
35
+ }
36
+ const handleRegister = tag => {
37
+ const { pId, idUser, idStore, nameTag } = tag || {}
38
+ registerTag({
39
+ variables: {
40
+ input: {
41
+ pId,
42
+ idUser,
43
+ nameTag,
44
+ idStore
45
+ }
46
+ }
47
+ }).catch(err => { return console.log({ message: `${err}`, duration: 7000 }) })
48
+ }
49
+ return {
50
+ tags,
51
+ error: false,
52
+ data,
53
+ loading: false,
54
+ handleRegister,
55
+ handleAddTag
56
+ }
57
+ }
@@ -0,0 +1,35 @@
1
+ import { useQuery } from '@apollo/client'
2
+ import { GET_ALL_SALES, GET_ALL_TOTAL_SALES } from './queries'
3
+
4
+ export const useReport = ({
5
+ more,
6
+ fromDate,
7
+ toDate
8
+ }) => {
9
+ const { data, fetchMore, loading } = useQuery(GET_ALL_SALES,{
10
+ fetchPolicy: 'network-only',
11
+ variables: {
12
+ min: 0,
13
+ fromDate,
14
+ toDate,
15
+ max: more
16
+ }
17
+ })
18
+ // get total sales
19
+ const { data: totalSales } = useQuery(GET_ALL_TOTAL_SALES, {
20
+ variables: {
21
+ fromDate,
22
+ toDate,
23
+ }
24
+ })
25
+ // console.log({totalSales})
26
+
27
+ return {
28
+ data,
29
+ loading,
30
+ totalSales: totalSales?.getAllSalesStoreTotal.TOTAL ?? 0,
31
+ restaurant: totalSales?.getAllSalesStoreTotal.restaurant ?? 0,
32
+ delivery: totalSales?.getAllSalesStoreTotal.delivery ?? 0,
33
+ fetchMore
34
+ }
35
+ }
@@ -0,0 +1,122 @@
1
+ import { gql } from '@apollo/client'
2
+
3
+ export const GET_ALL_SALES = gql`
4
+ query getAllSalesStore($idStore: ID,$search: String, $min: Int, $max: Int $fromDate: DateTime, $toDate: DateTime ) {
5
+ getAllSalesStore(idStore: $idStore, search: $search, min: $min, max: $max, toDate: $toDate, fromDate: $fromDate) {
6
+ totalProductsPrice
7
+ pDatCre,
8
+ pCodeRef
9
+ }
10
+ }
11
+ `
12
+
13
+ export const GET_ALL_TOTAL_SALES = gql`
14
+ query getAllSalesStoreTotal($idStore: ID,$search: String, $min: Int, $max: Int $fromDate: DateTime, $toDate: DateTime ) {
15
+ getAllSalesStoreTotal(idStore: $idStore, search: $search, min: $min, max: $max, toDate: $toDate, fromDate: $fromDate) {
16
+ restaurant
17
+ delivery
18
+ TOTAL
19
+ }
20
+ }
21
+ `
22
+ export const GET_ALL_SALES_STATISTICS = gql`
23
+ query getAllSalesStoreStatistic($idStore: ID,$search: String, $min: Int, $max: Int $fromDate: DateTime, $toDate: DateTime ) {
24
+ getAllSalesStoreStatistic(idStore: $idStore, search: $search, min: $min, max: $max, toDate: $toDate, fromDate: $fromDate) {
25
+ pdpId
26
+ idStore
27
+ pCodeRef
28
+ payMethodPState
29
+ pPRecoger
30
+ totalProductsPrice
31
+ pSState
32
+ pDatCre
33
+ locationUser
34
+ pDatMod
35
+ getAllPedidoStore{
36
+ pdpId
37
+ pId
38
+ idStore
39
+ ShoppingCard
40
+ pCodeRef
41
+ pPStateP
42
+ payMethodPState
43
+ pPRecoger
44
+ pDatCre
45
+ pDatMod
46
+ getAllShoppingCard {
47
+ ShoppingCard
48
+ comments
49
+ cantProducts
50
+ pId
51
+ productFood{
52
+ pId
53
+ carProId
54
+ colorId
55
+ idStore
56
+ pName
57
+ ProPrice
58
+ ProDescuento
59
+ ProDescription
60
+ ValueDelivery
61
+ ProImage
62
+ ProStar
63
+ pState
64
+ pDatCre
65
+ pDatMod
66
+ }
67
+ }
68
+ }
69
+ }
70
+ }
71
+ `
72
+
73
+ export const GET_ONE_SALES = gql`
74
+ query getOneSalesStore($pCodeRef: String) {
75
+ getOneSalesStore(pCodeRef: $pCodeRef) {
76
+ pdpId
77
+ idStore
78
+ pCodeRef
79
+ payMethodPState
80
+ pPRecoger
81
+ totalProductsPrice
82
+ pSState
83
+ pDatCre
84
+ locationUser
85
+ pDatMod
86
+ getAllPedidoStore{
87
+ pdpId
88
+ pId
89
+ idStore
90
+ ShoppingCard
91
+ pCodeRef
92
+ pPStateP
93
+ payMethodPState
94
+ pPRecoger
95
+ pDatCre
96
+ pDatMod
97
+ getAllShoppingCard {
98
+ ShoppingCard
99
+ comments
100
+ cantProducts
101
+ pId
102
+ productFood{
103
+ pId
104
+ carProId
105
+ colorId
106
+ idStore
107
+ pName
108
+ ProPrice
109
+ ProDescuento
110
+ ProDescription
111
+ ValueDelivery
112
+ ProImage
113
+ ProStar
114
+ pState
115
+ pDatCre
116
+ pDatMod
117
+ }
118
+ }
119
+ }
120
+ }
121
+ }
122
+ `
@@ -2,6 +2,15 @@ import { gql } from '@apollo/client'
2
2
  export const GET_ALL_RESTAURANT = gql`
3
3
  query getAllStoreInStore($search: String, $min: Int, $max: Int){
4
4
  getAllStoreInStore(search: $search, min: $min, max: $max) {
5
+ open
6
+ getStoreSchedules {
7
+ idStore
8
+ schId
9
+ schDay
10
+ schHoSta
11
+ schHoEnd
12
+ schState
13
+ }
5
14
  idStore
6
15
  cId
7
16
  id
@@ -36,7 +45,7 @@ query getAllStoreInStore($search: String, $min: Int, $max: Int){
36
45
  addressStore
37
46
  createdAt
38
47
  pais{
39
- cId
48
+ cId
40
49
  cName
41
50
  cCalCod
42
51
  cState
@@ -66,5 +75,6 @@ query getAllStoreInStore($search: String, $min: Int, $max: Int){
66
75
  createAt
67
76
  }
68
77
  }
78
+
69
79
  }
70
80
  `