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/.env
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
NPM_TOKEN = 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
|
package/.eslintrc.js
ADDED
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
env: {
|
|
3
|
+
browser: true,
|
|
4
|
+
es2021: true,
|
|
5
|
+
node: true
|
|
6
|
+
},
|
|
7
|
+
extends: [
|
|
8
|
+
'plugin:react/recommended',
|
|
9
|
+
'standard'
|
|
10
|
+
],
|
|
11
|
+
overrides: [
|
|
12
|
+
],
|
|
13
|
+
parserOptions: {
|
|
14
|
+
ecmaVersion: 'latest',
|
|
15
|
+
sourceType: 'module'
|
|
16
|
+
},
|
|
17
|
+
plugins: [
|
|
18
|
+
'react',
|
|
19
|
+
'react-hooks',
|
|
20
|
+
'@typescript-eslint'
|
|
21
|
+
],
|
|
22
|
+
rules: {
|
|
23
|
+
'import/no-anonymous-default-export': ['error', {
|
|
24
|
+
allowArray: false,
|
|
25
|
+
allowArrowFunction: false,
|
|
26
|
+
allowAnonymousClass: false,
|
|
27
|
+
allowAnonymousFunction: false,
|
|
28
|
+
allowCallExpression: true, // The true value here is for backward compatibility
|
|
29
|
+
allowLiteral: false,
|
|
30
|
+
allowObject: true // anonymous-default-export
|
|
31
|
+
}],
|
|
32
|
+
// react hooks validations
|
|
33
|
+
'react-hooks/exhaustive-deps': 'warn',
|
|
34
|
+
'react-hooks/rules-of-hooks': 'error',
|
|
35
|
+
// allow jsx syntax in js files (for next.js project)
|
|
36
|
+
'react/jsx-filename-extension': [
|
|
37
|
+
1,
|
|
38
|
+
{
|
|
39
|
+
extensions: [
|
|
40
|
+
'.js',
|
|
41
|
+
'.jsx',
|
|
42
|
+
'.ts',
|
|
43
|
+
'.tsx'
|
|
44
|
+
]
|
|
45
|
+
}
|
|
46
|
+
],
|
|
47
|
+
quotes: [
|
|
48
|
+
2,
|
|
49
|
+
'single',
|
|
50
|
+
{
|
|
51
|
+
avoidEscape: true,
|
|
52
|
+
allowTemplateLiterals: true
|
|
53
|
+
}
|
|
54
|
+
],
|
|
55
|
+
'consistent-return': 2,
|
|
56
|
+
indent: [
|
|
57
|
+
2,
|
|
58
|
+
2,
|
|
59
|
+
{
|
|
60
|
+
SwitchCase: 1
|
|
61
|
+
}
|
|
62
|
+
],
|
|
63
|
+
'no-else-return': 1,
|
|
64
|
+
semi: [
|
|
65
|
+
1,
|
|
66
|
+
'never'
|
|
67
|
+
],
|
|
68
|
+
'space-unary-ops': 2,
|
|
69
|
+
'comma-dangle': [
|
|
70
|
+
'error',
|
|
71
|
+
{
|
|
72
|
+
arrays: 'never',
|
|
73
|
+
objects: 'never',
|
|
74
|
+
imports: 'never',
|
|
75
|
+
exports: 'never',
|
|
76
|
+
functions: 'never'
|
|
77
|
+
}
|
|
78
|
+
],
|
|
79
|
+
'one-var': [
|
|
80
|
+
2,
|
|
81
|
+
'never'
|
|
82
|
+
],
|
|
83
|
+
'no-var': 'error',
|
|
84
|
+
'arrow-body-style': [
|
|
85
|
+
'error',
|
|
86
|
+
'always'
|
|
87
|
+
],
|
|
88
|
+
'no-console': 'error',
|
|
89
|
+
'no-multi-spaces': [
|
|
90
|
+
'error',
|
|
91
|
+
{
|
|
92
|
+
exceptions: {
|
|
93
|
+
BinaryExpression: true
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
],
|
|
97
|
+
'no-multiple-empty-lines': [
|
|
98
|
+
'error',
|
|
99
|
+
{
|
|
100
|
+
max: 2,
|
|
101
|
+
maxBOF: 2
|
|
102
|
+
}
|
|
103
|
+
],
|
|
104
|
+
'jsx-quotes': [
|
|
105
|
+
'error',
|
|
106
|
+
'prefer-single'
|
|
107
|
+
],
|
|
108
|
+
'react/jsx-sort-props': [
|
|
109
|
+
'error',
|
|
110
|
+
{
|
|
111
|
+
noSortAlphabetically: false
|
|
112
|
+
}
|
|
113
|
+
],
|
|
114
|
+
'react/jsx-first-prop-new-line': [
|
|
115
|
+
'error',
|
|
116
|
+
'multiline'
|
|
117
|
+
],
|
|
118
|
+
'react/jsx-max-props-per-line': [
|
|
119
|
+
'error',
|
|
120
|
+
{
|
|
121
|
+
maximum: {
|
|
122
|
+
single: 2,
|
|
123
|
+
multi: 1
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
],
|
|
127
|
+
'react/jsx-closing-bracket-location': [
|
|
128
|
+
'error',
|
|
129
|
+
'line-aligned'
|
|
130
|
+
]
|
|
131
|
+
}
|
|
132
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
## What problem is this solving?
|
|
2
|
+
|
|
3
|
+
- [x] this is an example if you finish your work
|
|
4
|
+
|
|
5
|
+
## How should this be manually tested?
|
|
6
|
+
|
|
7
|
+
### Screenshots or example usage
|
|
8
|
+
|
|
9
|
+
## Types of changes
|
|
10
|
+
|
|
11
|
+
* [ ] Bug fix (a non-breaking change which fixes an issue)
|
|
12
|
+
* [ ] New feature (a non-breaking change which adds functionality)
|
|
13
|
+
* [ ] Breaking change (fix or feature that would cause existing functionality to change)
|
|
14
|
+
* [ ] Requires change to documentation, which has been updated accordingly.
|
|
15
|
+
|
|
16
|
+
## PR's related
|
|
17
|
+
|
|
18
|
+
- [x] Add the relation between pull request
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
name: Publish package to GitHub Packages
|
|
2
|
+
on:
|
|
3
|
+
push:
|
|
4
|
+
branches: [main]
|
|
5
|
+
pull_request:
|
|
6
|
+
branches: [develop]
|
|
7
|
+
types: [opened, synchronize]
|
|
8
|
+
release:
|
|
9
|
+
types: [created]
|
|
10
|
+
jobs:
|
|
11
|
+
build:
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
permissions:
|
|
14
|
+
contents: read
|
|
15
|
+
packages: write
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v3
|
|
18
|
+
# Setup .npmrc file to publish to GitHub Packages
|
|
19
|
+
- uses: actions/setup-node@v3
|
|
20
|
+
with:
|
|
21
|
+
node-version: '16.x'
|
|
22
|
+
registry-url: 'https://npm.pkg.github.com'
|
|
23
|
+
# Defaults to the user or organization that owns the workflow file
|
|
24
|
+
- run: npm install
|
|
25
|
+
- uses: JS-DevTools/npm-publish@v1
|
|
26
|
+
with:
|
|
27
|
+
token: ${{ secrets.NPM_TOKEN }}
|
|
28
|
+
# - run: npm publish
|
|
29
|
+
# env:
|
|
30
|
+
# NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
package/next.config.js
CHANGED
|
@@ -37,8 +37,8 @@ module.exports = (phase) => {
|
|
|
37
37
|
SESSION_NAME: 'vp.client',
|
|
38
38
|
SESSION_KEY: '12ba105efUaGjihGrh0LfJHTGIBGu6jXa',
|
|
39
39
|
URL_BASE: (() => {
|
|
40
|
-
if (isDev) return 'http://localhost:3001/
|
|
41
|
-
if (isProd) return 'http://localhost:3001/
|
|
40
|
+
if (isDev) return 'http://localhost:3001/'
|
|
41
|
+
if (isProd) return 'http://localhost:3001/'
|
|
42
42
|
// if (isStaging) return 'Title Stg'
|
|
43
43
|
})(),
|
|
44
44
|
MAIN_URL_BASE: (() => {
|
|
@@ -79,7 +79,7 @@ module.exports = (phase) => {
|
|
|
79
79
|
const headers = () => {
|
|
80
80
|
return [
|
|
81
81
|
{
|
|
82
|
-
source: '
|
|
82
|
+
source: '',
|
|
83
83
|
headers: [
|
|
84
84
|
{
|
|
85
85
|
key: 'x-custom-header-1',
|
|
@@ -98,7 +98,7 @@ module.exports = (phase) => {
|
|
|
98
98
|
}
|
|
99
99
|
]
|
|
100
100
|
}
|
|
101
|
-
const basePath = '
|
|
101
|
+
const basePath = ''
|
|
102
102
|
// puedes sobre escribir la ruta
|
|
103
103
|
const rewrites = () => {
|
|
104
104
|
return [
|
package/package.json
CHANGED
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "npm-pkg-hook",
|
|
3
|
-
"
|
|
3
|
+
"repository": {
|
|
4
|
+
"type": "git",
|
|
5
|
+
"url": "https://github.com/Jesus123780/pkg-hook"
|
|
6
|
+
},
|
|
7
|
+
"publishConfig": {
|
|
8
|
+
"registry": "https://registry.npmjs.org/"
|
|
9
|
+
},
|
|
10
|
+
"version": "1.0.4",
|
|
4
11
|
"description": "description-pkg-hook",
|
|
5
12
|
"main": "/src/index.jsx",
|
|
6
13
|
"scripts": {
|
|
7
14
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
15
|
+
"lint": "eslint .",
|
|
8
16
|
"rm": "rm -rf node_modules package-lock.json && npm i"
|
|
9
17
|
},
|
|
10
18
|
"author": "",
|
|
@@ -13,6 +21,8 @@
|
|
|
13
21
|
"@apollo/client": "3.6.9",
|
|
14
22
|
"@typescript-eslint/parser": "^5.37.0",
|
|
15
23
|
"js-cookie": "3.0.1",
|
|
24
|
+
"lodash": "^4.17.21",
|
|
25
|
+
"moment": "^2.29.4",
|
|
16
26
|
"react": "18.1.0",
|
|
17
27
|
"react-dom": "18.1.0",
|
|
18
28
|
"react-query": "^3.39.2"
|
|
@@ -22,12 +32,12 @@
|
|
|
22
32
|
"@babel/preset-react": "^7.18.6",
|
|
23
33
|
"@babel/preset-typescript": "^7.18.6",
|
|
24
34
|
"@types/react": "^18.0.20",
|
|
25
|
-
"eslint": "^8.
|
|
35
|
+
"eslint": "^8.33.0",
|
|
26
36
|
"eslint-config-standard": "^17.0.0",
|
|
27
|
-
"eslint-plugin-import": "^2.
|
|
28
|
-
"eslint-plugin-n": "^15.
|
|
29
|
-
"eslint-plugin-promise": "^6.
|
|
30
|
-
"eslint-plugin-react": "^7.
|
|
37
|
+
"eslint-plugin-import": "^2.27.5",
|
|
38
|
+
"eslint-plugin-n": "^15.6.1",
|
|
39
|
+
"eslint-plugin-promise": "^6.1.1",
|
|
40
|
+
"eslint-plugin-react": "^7.32.2",
|
|
31
41
|
"eslint-plugin-react-hooks": "^4.6.0"
|
|
32
42
|
}
|
|
33
|
-
}
|
|
43
|
+
}
|
package/script.txt
ADDED
package/src/hooks/index.js
CHANGED
|
@@ -1,15 +1,46 @@
|
|
|
1
|
-
export * from './
|
|
2
|
-
export * from './
|
|
3
|
-
export * from './
|
|
1
|
+
export * from './updateExtProductFoodsOptional'
|
|
2
|
+
export * from './useAcumulateDate'
|
|
3
|
+
export * from './useBanner'
|
|
4
|
+
export * from './useCategoryInStore'
|
|
5
|
+
export * from './useCategoryStore'
|
|
6
|
+
export * from './useCatWithProduct'
|
|
7
|
+
export * from './useChartData'
|
|
8
|
+
export * from './useCheckbox'
|
|
9
|
+
export * from './useClients'
|
|
10
|
+
export * from './useConnection'
|
|
11
|
+
export * from './useCreateProduct'
|
|
12
|
+
export * from './useCreateProduct/helpers/useEditImageProduct'
|
|
13
|
+
export * from './useDessert'
|
|
14
|
+
export * from './useDrag'
|
|
4
15
|
export * from './useEvent'
|
|
5
16
|
export * from './useFetchJson'
|
|
6
|
-
export * from './
|
|
17
|
+
export * from './useFormatDate'
|
|
7
18
|
export * from './useFormTools/index'
|
|
8
|
-
export * from './useDrag'
|
|
9
19
|
export * from './useHover'
|
|
20
|
+
export * from './useImageOptimization'
|
|
21
|
+
export * from './useImagesStore'
|
|
22
|
+
export * from './useImageWeight'
|
|
23
|
+
export * from './useIntersection'
|
|
10
24
|
export * from './useKeypress'
|
|
25
|
+
export * from './useLazyScript'
|
|
11
26
|
export * from './useLocalSorage'
|
|
12
|
-
export * from './
|
|
27
|
+
export * from './useLocationNavigate'
|
|
28
|
+
export * from './useMobile'
|
|
29
|
+
export * from './useMutateHeight'
|
|
30
|
+
export * from './useProductsFood'
|
|
31
|
+
export * from './useProductsFood/usetagsProducts'
|
|
32
|
+
export * from './useReport'
|
|
33
|
+
export * from './useRestaurant'
|
|
34
|
+
export * from './useSales'
|
|
35
|
+
export * from './useSales/useGetSale'
|
|
36
|
+
export * from './useSales/useTotalSales'
|
|
37
|
+
export * from './useSaveAvailableProduct'
|
|
38
|
+
export * from './useSchedule'
|
|
13
39
|
export * from './useSetState'
|
|
14
|
-
export * from './
|
|
15
|
-
export * from './
|
|
40
|
+
export * from './useStore'
|
|
41
|
+
export * from './useStoreCalendar'
|
|
42
|
+
export * from './useTimeAgo/useTimeAgo'
|
|
43
|
+
export * from './useUpdateCart'
|
|
44
|
+
export * from './useUpdateExtProductFoodsSubOptional'
|
|
45
|
+
export * from './useUser'
|
|
46
|
+
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { useMutation } from '@apollo/client'
|
|
2
|
+
import { updateCacheMod } from '../../utils'
|
|
3
|
+
import { GET_EXTRAS_PRODUCT_FOOD_OPTIONAL, UPDATE_EXTRAS_PRODUCT_FOOD_OPTIONAL } from '../useProductsFood/queriesStore'
|
|
4
|
+
|
|
5
|
+
export const useUpdateExtProductFoodsOptional = () => {
|
|
6
|
+
const [updateExtProductFoodsOptional] = useMutation(UPDATE_EXTRAS_PRODUCT_FOOD_OPTIONAL)
|
|
7
|
+
|
|
8
|
+
const handleUpdateExtProduct = async ({
|
|
9
|
+
pId,
|
|
10
|
+
code,
|
|
11
|
+
OptionalProName,
|
|
12
|
+
required,
|
|
13
|
+
numbersOptionalOnly
|
|
14
|
+
}) => {
|
|
15
|
+
await updateExtProductFoodsOptional({
|
|
16
|
+
variables: {
|
|
17
|
+
input: {
|
|
18
|
+
pId,
|
|
19
|
+
code,
|
|
20
|
+
OptionalProName,
|
|
21
|
+
required,
|
|
22
|
+
numbersOptionalOnly
|
|
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
|
+
handleUpdateExtProduct
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
|
|
2
2
|
const data = [
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
3
|
+
{ x: '2021-10-17T14:38:45.540Z', y: 2 }
|
|
4
|
+
]
|
|
5
|
+
export const getDateParts = (isString) => {
|
|
6
|
+
const [year, month, day, hr, min, sec] = isString.split(/\D/g)
|
|
7
|
+
return { year, month, day, hr, min, sec }
|
|
8
|
+
}
|
|
9
|
+
export function groupDates (arr) {
|
|
10
|
+
const total = arr.reduce((a, b) => {
|
|
11
|
+
const { hr } = getDateParts(b.x)
|
|
12
|
+
return a + parseInt(hr)
|
|
13
|
+
}, 0)
|
|
14
|
+
return total
|
|
15
|
+
}
|
|
16
|
+
const result = groupDates(data)
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { useEffect, useRef, useState } from 'react'
|
|
2
2
|
|
|
3
3
|
const fullText =
|
|
4
4
|
' this is full text it\'ll be animated again! Writing a really huge senetence here so that I can see the animation happen. I know it\'s fast but that\'s how it goes.'
|
|
5
5
|
|
|
6
|
-
const useAnimatedText = textMessage => {
|
|
6
|
+
export const useAnimatedText = textMessage => {
|
|
7
7
|
const fullTextRef = useRef(textMessage)
|
|
8
8
|
const [text, setText] = useState('')
|
|
9
9
|
const [index, setIndex] = useState(0)
|
|
10
|
+
|
|
10
11
|
useEffect(() => {
|
|
11
12
|
if (index < fullText.length) {
|
|
12
13
|
window.requestAnimationFrame(() => {
|
|
@@ -23,8 +24,8 @@ const useAnimatedText = textMessage => {
|
|
|
23
24
|
return text
|
|
24
25
|
}
|
|
25
26
|
|
|
26
|
-
export default function TextHook() {
|
|
27
|
-
|
|
27
|
+
// export default function TextHook() {
|
|
28
|
+
// const text = useAnimatedText(fullText)
|
|
28
29
|
|
|
29
|
-
|
|
30
|
-
}
|
|
30
|
+
// return <span>{text} </span>
|
|
31
|
+
// }
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { useQuery } from '@apollo/client'
|
|
2
|
+
import { GET_ONE_BANNER_STORE } from '../useProductsFood/queriesStore'
|
|
3
|
+
import { useStore } from '../useStore'
|
|
4
|
+
|
|
5
|
+
export const useBanner = () => {
|
|
6
|
+
const [store, { loading: loaStore }] = useStore()
|
|
7
|
+
|
|
8
|
+
const {
|
|
9
|
+
data,
|
|
10
|
+
loading,
|
|
11
|
+
error
|
|
12
|
+
} = useQuery(GET_ONE_BANNER_STORE, {
|
|
13
|
+
context: { clientName: 'admin-server' },
|
|
14
|
+
variables: {
|
|
15
|
+
idStore: !loaStore && store?.store
|
|
16
|
+
}
|
|
17
|
+
})
|
|
18
|
+
return [data?.getOneBanners, { loading, error }]
|
|
19
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { useQuery } from '@apollo/client'
|
|
2
|
+
import { GET_ALL_CATEGORIES_WITH_PRODUCT } from './queries'
|
|
3
|
+
|
|
4
|
+
export const useCatWithProduct = ({
|
|
5
|
+
max = 1,
|
|
6
|
+
min = 0,
|
|
7
|
+
search = null,
|
|
8
|
+
searchFilter= {}
|
|
9
|
+
}) => {
|
|
10
|
+
const {
|
|
11
|
+
gender,
|
|
12
|
+
desc,
|
|
13
|
+
speciality
|
|
14
|
+
} = searchFilter || {}
|
|
15
|
+
const {
|
|
16
|
+
data,
|
|
17
|
+
loading,
|
|
18
|
+
error,
|
|
19
|
+
fetchMore
|
|
20
|
+
} = useQuery(GET_ALL_CATEGORIES_WITH_PRODUCT, {
|
|
21
|
+
fetchPolicy: 'network-only',
|
|
22
|
+
variables:
|
|
23
|
+
{
|
|
24
|
+
search,
|
|
25
|
+
gender: gender,
|
|
26
|
+
min,
|
|
27
|
+
max: 400,
|
|
28
|
+
desc: desc,
|
|
29
|
+
categories: speciality
|
|
30
|
+
}
|
|
31
|
+
})
|
|
32
|
+
const totalCount = data?.getCatProductsWithProduct?.totalCount
|
|
33
|
+
return [
|
|
34
|
+
data?.getCatProductsWithProduct?.catProductsWithProduct,
|
|
35
|
+
{
|
|
36
|
+
loading,
|
|
37
|
+
error,
|
|
38
|
+
fetchMore,
|
|
39
|
+
totalCount
|
|
40
|
+
}
|
|
41
|
+
]
|
|
42
|
+
}
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import { gql } from '@apollo/client'
|
|
2
|
+
|
|
3
|
+
export const CREATE_FOOD_PRODUCT = gql`
|
|
4
|
+
mutation newRegisterFoodProduct($input: FoodProductInput){
|
|
5
|
+
newRegisterFoodProduct(input: $input){
|
|
6
|
+
success
|
|
7
|
+
message
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
`
|
|
11
|
+
export const GET_BANNER_PROMO_DASHBOARD = gql`
|
|
12
|
+
query getPromoStoreAdmin($min: Int, $max: Int){
|
|
13
|
+
getPromoStoreAdmin(min: $min, max: $max){
|
|
14
|
+
pSoId
|
|
15
|
+
comments
|
|
16
|
+
mainName
|
|
17
|
+
metaTags
|
|
18
|
+
urlImage
|
|
19
|
+
bPromoState
|
|
20
|
+
createAt
|
|
21
|
+
updateAt
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
`
|
|
25
|
+
|
|
26
|
+
export const CREATE_STORE_CALENDAR = gql`
|
|
27
|
+
mutation setStoreSchedule($input: ITstoreSchedule!){
|
|
28
|
+
setStoreSchedule(input: $input){
|
|
29
|
+
message
|
|
30
|
+
success
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
`
|
|
34
|
+
export const DELETE_ONE_CAT_PRODUCTS = gql`
|
|
35
|
+
mutation deleteCatOfProducts($idPc: ID!, $pState: Int){
|
|
36
|
+
deleteCatOfProducts(idPc: $idPc, pState: $pState){
|
|
37
|
+
success
|
|
38
|
+
message
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
`
|
|
42
|
+
export const DELETE_ONE_CAT_PRODUCTS_FINAL = gql`
|
|
43
|
+
|
|
44
|
+
mutation deleteCatFinalOfProducts($idPc: ID){
|
|
45
|
+
deleteCatFinalOfProducts(idPc: $idPc){
|
|
46
|
+
success
|
|
47
|
+
message
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
`
|
|
51
|
+
export const DELETE_EXTRA_PRODUCTS = gql`
|
|
52
|
+
mutation deleteextraproductfoods($id: ID, $state: Int){
|
|
53
|
+
deleteextraproductfoods(id: $id, state: $state){
|
|
54
|
+
success,
|
|
55
|
+
message
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
`
|
|
59
|
+
export const EDIT_EXTRA_PRODUCTS = gql`
|
|
60
|
+
mutation editExtProductFoods($input: InputExtProductFood!) {
|
|
61
|
+
editExtProductFoods(input: $input) {
|
|
62
|
+
success
|
|
63
|
+
message
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
`
|
|
67
|
+
export const DELETE_CAT_EXTRA_PRODUCTS = gql`
|
|
68
|
+
mutation DeleteExtProductFoodsOptional($opExPid: ID, $state: Int){
|
|
69
|
+
DeleteExtProductFoodsOptional(opExPid: $opExPid, state: $state){
|
|
70
|
+
success,
|
|
71
|
+
message
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
`
|
|
75
|
+
export const DELETE_CAT_EXTRA_SUB_OPTIONAL_PRODUCTS = gql`
|
|
76
|
+
mutation DeleteExtFoodSubsOptional($opSubExPid: ID, $state: Int){
|
|
77
|
+
DeleteExtFoodSubsOptional(opSubExPid: $opSubExPid, state: $state){
|
|
78
|
+
success,
|
|
79
|
+
message
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
`
|
|
83
|
+
export const UPDATE_CAT_IN_PRODUCT = gql`
|
|
84
|
+
mutation updatedCatWithProducts($input: LineItemsIdPro){
|
|
85
|
+
updatedCatWithProducts(input: $input){
|
|
86
|
+
success
|
|
87
|
+
message
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
`
|
|
91
|
+
export const GET_ULTIMATE_CATEGORY_PRODUCTS = gql`
|
|
92
|
+
query catProductsAll($search: String, $min: Int, $max: Int, $gender: [String], $desc: [String], $categories: [ID], ) {
|
|
93
|
+
catProductsAll(search: $search, min: $min, max: $max, gender: $gender, desc: $desc, categories: $categories,) {
|
|
94
|
+
carProId
|
|
95
|
+
idStore
|
|
96
|
+
pName
|
|
97
|
+
ProDescription
|
|
98
|
+
ProImage
|
|
99
|
+
pState
|
|
100
|
+
pDatCre
|
|
101
|
+
pDatMod
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
`
|
|
105
|
+
export const GET_ALL_EXTRA_PRODUCT = gql`
|
|
106
|
+
query ExtProductFoodsAll($search: String, $min: Int, $max: Int, $pId: ID) {
|
|
107
|
+
ExtProductFoodsAll(search: $search, min: $min, max: $max, pId: $pId) {
|
|
108
|
+
pId
|
|
109
|
+
exPid
|
|
110
|
+
exState
|
|
111
|
+
extraName
|
|
112
|
+
extraPrice
|
|
113
|
+
state
|
|
114
|
+
pDatCre
|
|
115
|
+
pDatMod
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
`
|
|
119
|
+
export const GET_ALL_CATEGORIES_WITH_PRODUCT = gql`
|
|
120
|
+
query getCatProductsWithProduct($search: String, $min: Int, $max: Int, $gender: [String], $desc: [String], $categories: [ID], ) {
|
|
121
|
+
getCatProductsWithProduct(search: $search, min: $min, max: $max, gender: $gender, desc: $desc, categories: $categories,) {
|
|
122
|
+
totalCount,
|
|
123
|
+
catProductsWithProduct {
|
|
124
|
+
carProId
|
|
125
|
+
pState
|
|
126
|
+
pState
|
|
127
|
+
ProImage
|
|
128
|
+
idStore
|
|
129
|
+
pName
|
|
130
|
+
totalCount
|
|
131
|
+
ProDescription
|
|
132
|
+
ProImage
|
|
133
|
+
pState
|
|
134
|
+
pDatCre
|
|
135
|
+
pDatMod
|
|
136
|
+
productFoodsAll {
|
|
137
|
+
pId
|
|
138
|
+
sizeId
|
|
139
|
+
colorId
|
|
140
|
+
carProId
|
|
141
|
+
cId
|
|
142
|
+
dId
|
|
143
|
+
ctId
|
|
144
|
+
idStore
|
|
145
|
+
caId
|
|
146
|
+
fId
|
|
147
|
+
pName
|
|
148
|
+
ProPrice
|
|
149
|
+
ProDescuento
|
|
150
|
+
ProUniDisponibles
|
|
151
|
+
ProDescription
|
|
152
|
+
ProProtegido
|
|
153
|
+
ProAssurance
|
|
154
|
+
ProImage
|
|
155
|
+
ProStar
|
|
156
|
+
ProWidth
|
|
157
|
+
ProHeight
|
|
158
|
+
ProLength
|
|
159
|
+
ProWeight
|
|
160
|
+
ProQuantity
|
|
161
|
+
ProOutstanding
|
|
162
|
+
ProDelivery
|
|
163
|
+
ProVoltaje
|
|
164
|
+
pState
|
|
165
|
+
sTateLogistic
|
|
166
|
+
pDatCre
|
|
167
|
+
pDatMod
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
`
|