npm-pkg-hook 1.0.1 → 1.0.2

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 (46) hide show
  1. package/.babelrc +13 -13
  2. package/.eslintrc.json +107 -107
  3. package/.github/pull_request_template.md +18 -0
  4. package/.github/workflows/pepeline.yaml +30 -0
  5. package/README.md +1 -1
  6. package/jsconfig.json +27 -27
  7. package/next.config.js +128 -128
  8. package/package.json +10 -2
  9. package/src/cookies/index.ts +3 -3
  10. package/src/hooks/index.js +19 -15
  11. package/src/hooks/useAcumulateDate/index.js +15 -15
  12. package/src/hooks/useAnimationText/index.jsx +29 -29
  13. package/src/hooks/useCategoryStore/index.js +7 -7
  14. package/src/hooks/useCategoryStore/queries.js +16 -16
  15. package/src/hooks/useCheckbox/index.js +114 -0
  16. package/src/hooks/useClients/index.js +13 -0
  17. package/src/hooks/useClients/queries.js +118 -0
  18. package/src/hooks/useDrag/index.js +56 -56
  19. package/src/hooks/useEvent/index.js +33 -33
  20. package/src/hooks/useFetchJson/index.js +24 -24
  21. package/src/hooks/useFetchMoreInteractions/index.jsx +34 -34
  22. package/src/hooks/useFormTools/index.js +70 -70
  23. package/src/hooks/useFullScreenMode/index.js +65 -65
  24. package/src/hooks/useGetCategorieStore/index.js +20 -20
  25. package/src/hooks/useGetCategorieStore/queries.js +77 -77
  26. package/src/hooks/useGetProductsFood/index.js +46 -0
  27. package/src/hooks/useGetProductsFood/queriesStore.js +766 -0
  28. package/src/hooks/useHover/index.js +28 -28
  29. package/src/hooks/useInnerHtml/index.js +37 -37
  30. package/src/hooks/useIntersection/index.js +30 -30
  31. package/src/hooks/useKeypress/index.js +27 -27
  32. package/src/hooks/useLocalSorage/index.js +35 -35
  33. package/src/hooks/useLocationNavigate/index.js +54 -54
  34. package/src/hooks/useMobile/index.js +38 -0
  35. package/src/hooks/useRestaurant/index.js +19 -19
  36. package/src/hooks/useRestaurant/queries.js +69 -69
  37. package/src/hooks/useSales/index.js +489 -0
  38. package/src/hooks/useSales/queries.js +230 -0
  39. package/src/hooks/useSetState/index.js +24 -24
  40. package/src/hooks/useStore/index.js +18 -0
  41. package/src/hooks/useStore/queries.js +136 -0
  42. package/src/hooks/useTimeAgo/useTimeAgo.js +39 -39
  43. package/src/hooks/useUpdateCart/index.js +124 -123
  44. package/src/hooks/useUser/index.js +3 -3
  45. package/src/hooks/useWindowSize/index.js +37 -37
  46. package/src/utils/index.js +54 -27
package/.babelrc CHANGED
@@ -1,14 +1,14 @@
1
- {
2
- "presets": [
3
- [
4
- "@babel/preset-env",
5
- {
6
- "targets": {
7
- "node": "current"
8
- }
9
- }
10
- ],
11
- "@babel/preset-react",
12
- "@babel/preset-typescript"
13
- ]
1
+ {
2
+ "presets": [
3
+ [
4
+ "@babel/preset-env",
5
+ {
6
+ "targets": {
7
+ "node": "current"
8
+ }
9
+ }
10
+ ],
11
+ "@babel/preset-react",
12
+ "@babel/preset-typescript"
13
+ ]
14
14
  }
package/.eslintrc.json CHANGED
@@ -1,108 +1,108 @@
1
- {
2
- "env": {
3
- "browser": true,
4
- "es2021": true
5
- },
6
- "extends": [
7
- "eslint:recommended",
8
- "plugin:react/recommended",
9
- "plugin:@typescript-eslint/recommended"
10
- ],
11
- "parser": "@typescript-eslint/parser",
12
- "parserOptions": {
13
- "ecmaFeatures": {
14
- "jsx": true
15
- },
16
- "ecmaVersion": 12,
17
- "sourceType": "module"
18
- },
19
- "plugins": [
20
- "react",
21
- "react-hooks",
22
- "@typescript-eslint"
23
- ],
24
- "settings": {
25
- "react": {
26
- "version": "detect"
27
- }
28
- },
29
- "rules": {
30
- // react hooks validations
31
- "react-hooks/rules-of-hooks": "error",
32
- // suppress errors for missing "import React" in files
33
- "react/react-in-jsx-scope": "off",
34
- // allow jsx syntax in js files (for next.js project)
35
- "react/jsx-filename-extension": [
36
- 1,
37
- {
38
- "extensions": [
39
- ".js",
40
- ".jsx",
41
- ".ts",
42
- ".tsx"
43
- ]
44
- }
45
- ],
46
- "quotes": [
47
- 2,
48
- "single",
49
- {
50
- "avoidEscape": true,
51
- "allowTemplateLiterals": true
52
- }
53
- ],
54
- "consistent-return": 2,
55
- "indent": [
56
- 2,
57
- 2,
58
- {
59
- "SwitchCase": 1
60
- }
61
- ],
62
- "no-else-return": 1,
63
- "semi": [
64
- 1,
65
- "never"
66
- ],
67
- "space-unary-ops": 2,
68
- "comma-dangle": [
69
- "error",
70
- {
71
- "arrays": "never",
72
- "objects": "never",
73
- "imports": "never",
74
- "exports": "never",
75
- "functions": "never"
76
- }
77
- ],
78
- "one-var": [
79
- 2,
80
- "never"
81
- ],
82
- "no-var": "error",
83
- "arrow-body-style": [
84
- "error",
85
- "always"
86
- ],
87
- "no-console": "error",
88
- "no-multi-spaces": [
89
- "error",
90
- {
91
- "exceptions": {
92
- "BinaryExpression": true
93
- }
94
- }
95
- ],
96
- "no-multiple-empty-lines": [
97
- "error",
98
- {
99
- "max": 1,
100
- "maxBOF": 1
101
- }
102
- ],
103
- "jsx-quotes": [
104
- "error",
105
- "prefer-single"
106
- ]
107
- }
1
+ {
2
+ "env": {
3
+ "browser": true,
4
+ "es2021": true
5
+ },
6
+ "extends": [
7
+ "eslint:recommended",
8
+ "plugin:react/recommended",
9
+ "plugin:@typescript-eslint/recommended"
10
+ ],
11
+ "parser": "@typescript-eslint/parser",
12
+ "parserOptions": {
13
+ "ecmaFeatures": {
14
+ "jsx": true
15
+ },
16
+ "ecmaVersion": 12,
17
+ "sourceType": "module"
18
+ },
19
+ "plugins": [
20
+ "react",
21
+ "react-hooks",
22
+ "@typescript-eslint"
23
+ ],
24
+ "settings": {
25
+ "react": {
26
+ "version": "detect"
27
+ }
28
+ },
29
+ "rules": {
30
+ // react hooks validations
31
+ "react-hooks/rules-of-hooks": "error",
32
+ // suppress errors for missing "import React" in files
33
+ "react/react-in-jsx-scope": "off",
34
+ // allow jsx syntax in js files (for next.js project)
35
+ "react/jsx-filename-extension": [
36
+ 1,
37
+ {
38
+ "extensions": [
39
+ ".js",
40
+ ".jsx",
41
+ ".ts",
42
+ ".tsx"
43
+ ]
44
+ }
45
+ ],
46
+ "quotes": [
47
+ 2,
48
+ "single",
49
+ {
50
+ "avoidEscape": true,
51
+ "allowTemplateLiterals": true
52
+ }
53
+ ],
54
+ "consistent-return": 2,
55
+ "indent": [
56
+ 2,
57
+ 2,
58
+ {
59
+ "SwitchCase": 1
60
+ }
61
+ ],
62
+ "no-else-return": 1,
63
+ "semi": [
64
+ 1,
65
+ "never"
66
+ ],
67
+ "space-unary-ops": 2,
68
+ "comma-dangle": [
69
+ "error",
70
+ {
71
+ "arrays": "never",
72
+ "objects": "never",
73
+ "imports": "never",
74
+ "exports": "never",
75
+ "functions": "never"
76
+ }
77
+ ],
78
+ "one-var": [
79
+ 2,
80
+ "never"
81
+ ],
82
+ "no-var": "error",
83
+ "arrow-body-style": [
84
+ "error",
85
+ "always"
86
+ ],
87
+ "no-console": "error",
88
+ "no-multi-spaces": [
89
+ "error",
90
+ {
91
+ "exceptions": {
92
+ "BinaryExpression": true
93
+ }
94
+ }
95
+ ],
96
+ "no-multiple-empty-lines": [
97
+ "error",
98
+ {
99
+ "max": 1,
100
+ "maxBOF": 1
101
+ }
102
+ ],
103
+ "jsx-quotes": [
104
+ "error",
105
+ "prefer-single"
106
+ ]
107
+ }
108
108
  }
@@ -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/README.md CHANGED
@@ -1 +1 @@
1
- # pkg-hook
1
+ # pkg-hook
package/jsconfig.json CHANGED
@@ -1,28 +1,28 @@
1
- {
2
- "compilerOptions": {
3
- "target": "es5",
4
- "lib": [
5
- "dom",
6
- "dom.iterable"
7
- ],
8
- "allowJs": true,
9
- "skipLibCheck": true,
10
- "strict": false,
11
- "forceConsistentCasingInFileNames": true,
12
- "noEmit": true,
13
- "esModuleInterop": true,
14
- "module": "commonjs",
15
- "moduleResolution": "node",
16
- "resolveJsonModule": true,
17
- "isolatedModules": true,
18
- "jsx": "preserve",
19
- "incremental": true
20
- },
21
- "include": [
22
- "**/*.ts",
23
- "**/*.tsx"
24
- ],
25
- "exclude": [
26
- "node_modules"
27
- ]
1
+ {
2
+ "compilerOptions": {
3
+ "target": "es5",
4
+ "lib": [
5
+ "dom",
6
+ "dom.iterable"
7
+ ],
8
+ "allowJs": true,
9
+ "skipLibCheck": true,
10
+ "strict": false,
11
+ "forceConsistentCasingInFileNames": true,
12
+ "noEmit": true,
13
+ "esModuleInterop": true,
14
+ "module": "commonjs",
15
+ "moduleResolution": "node",
16
+ "resolveJsonModule": true,
17
+ "isolatedModules": true,
18
+ "jsx": "preserve",
19
+ "incremental": true
20
+ },
21
+ "include": [
22
+ "**/*.ts",
23
+ "**/*.tsx"
24
+ ],
25
+ "exclude": [
26
+ "node_modules"
27
+ ]
28
28
  }
package/next.config.js CHANGED
@@ -1,129 +1,129 @@
1
- /* eslint-disable consistent-return */
2
- /** @type {import('next').NextConfig} */
3
- const {
4
- PHASE_DEVELOPMENT_SERVER,
5
- PHASE_PRODUCTION_BUILD
6
- // eslint-disable-next-line @typescript-eslint/no-var-requires
7
- } = require('next/constants')
8
- const nextConfig = {
9
- reactStrictMode: true
10
- }
11
- module.exports = (phase) => {
12
-
13
- // npm run dev or next dev
14
- const isDev = phase === PHASE_DEVELOPMENT_SERVER
15
- // npm run build or next build
16
- const isProd = phase === PHASE_PRODUCTION_BUILD && process.env.STAGING !== '1'
17
- // npm run build or next build
18
- const isStaging = phase === PHASE_PRODUCTION_BUILD && process.env.STAGING === '1'
19
- const env = {
20
- NAMEDB: (() => {
21
- if (isDev) return 'app'
22
- if (isProd) return 'railway'
23
- })(),
24
- USERDB: (() => {
25
- if (isDev) return 'root'
26
- if (isProd) return 'root'
27
- })(),
28
- PASSDB: (() => {
29
- if (isDev) return ''
30
- if (isProd) return '8jpgm70bhVjWIxEFbsrt'
31
- })(),
32
- HOSTDB: (() => {
33
- if (isDev) return 'localhost'
34
- if (isProd) return 'containers-us-west-65.railway.app'
35
- })(),
36
- DIALECTDB: 'mysql',
37
- SESSION_NAME: 'vp.client',
38
- SESSION_KEY: '12ba105efUaGjihGrh0LfJHTGIBGu6jXa',
39
- URL_BASE: (() => {
40
- if (isDev) return 'http://localhost:3001/app/'
41
- if (isProd) return 'http://localhost:3001/app/'
42
- // if (isStaging) return 'Title Stg'
43
- })(),
44
- MAIN_URL_BASE: (() => {
45
- if (isDev) return 'http://localhost:3000/'
46
- if (isProd) return 'http://localhost:3000/'
47
- if (isStaging) return 'Title Stg'
48
- })(),
49
- // URL_BASE_WS
50
- URL_ADMIN_SERVER: (() => {
51
- if (isDev) return 'http://localhost:4000/'
52
- // if (isDev) return 'https://server-image-food.herokuapp.com/'
53
- if (isProd) return 'http://localhost:4000/'
54
- })(),
55
- // BANCOLOMBIA
56
- BANCOLOMBIA_CLIENT_KEY: '55929729-85fe-4ffe-928d-0bd317817be4',
57
- BANCOLOMBIA_SECRET_KEY: 'E1aM2bV2lD7vS8cH1qJ8oN0nD7eN0eP0rM8gU0cG2lL6uY5sO7',
58
- JWT_EXPIRY: 333300,
59
- REFRESH_TOKEN_EXPIRY: '604800',
60
- AUTHO_USER_KEY: '12ba105efUaGjihGrh0LfJHTGIBGu6jXV',
61
- ACCESS_SID_TWILIO: 'AC7c9ccbdb50400c504faf629e35aea8e4',
62
- REACT_APP_API_KEY_GOOGLE_MAPS: 'AIzaSyAy0SY1G3OFqesWSTQRHJvzyJzNgURPoN8',
63
- ACCESS_TOKEN_AUTH_TWILIO: '22e090d4d776ace7bb596ca77cba6b18'
64
- }
65
-
66
- const resolveUniqueReactForHooks = {
67
- webpack: (config, options) => {
68
- if (options.isServer) {
69
- config.externals = ['react', ...config.externals]
70
- }
71
- // eslint-disable-next-line no-undef
72
- config.resolve.alias.react = reactPath
73
- return config
74
- },
75
- images: {
76
- domains: ['http2.mlstatic.com', 'localhost', 'server-image-food.herokuapp.com']
77
- }
78
- }
79
- const headers = () => {
80
- return [
81
- {
82
- source: '/app',
83
- headers: [
84
- {
85
- key: 'x-custom-header-1',
86
- value: 'my custom header 1'
87
- }
88
- ]
89
- }
90
- ]
91
- }
92
- const redirects = () => {
93
- return [
94
- {
95
- source: '/home',
96
- destination: '/',
97
- permanent: true
98
- }
99
- ]
100
- }
101
- const basePath = '/app'
102
- // puedes sobre escribir la ruta
103
- const rewrites = () => {
104
- return [
105
- {
106
- source: '/ab',
107
- destination: '/about'
108
- }
109
- ]
110
- }
111
- const assetPrefix = isProd ? 'https://cdn.mydomain.com' : ''
112
- const images = {
113
- domains: ['http2.mlstatic.com', 'localhost', 'server-image-food.herokuapp.com', '*']
114
- }
115
- return {
116
- env,
117
- swcMinify: false,
118
- images,
119
- headers,
120
- optimizeFonts: false,
121
- nextConfig,
122
- // basePath,
123
- rewrites,
124
- redirects,
125
- assetPrefix,
126
- resolveUniqueReactForHooks
127
- }
128
- }
1
+ /* eslint-disable consistent-return */
2
+ /** @type {import('next').NextConfig} */
3
+ const {
4
+ PHASE_DEVELOPMENT_SERVER,
5
+ PHASE_PRODUCTION_BUILD
6
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
7
+ } = require('next/constants')
8
+ const nextConfig = {
9
+ reactStrictMode: true
10
+ }
11
+ module.exports = (phase) => {
12
+
13
+ // npm run dev or next dev
14
+ const isDev = phase === PHASE_DEVELOPMENT_SERVER
15
+ // npm run build or next build
16
+ const isProd = phase === PHASE_PRODUCTION_BUILD && process.env.STAGING !== '1'
17
+ // npm run build or next build
18
+ const isStaging = phase === PHASE_PRODUCTION_BUILD && process.env.STAGING === '1'
19
+ const env = {
20
+ NAMEDB: (() => {
21
+ if (isDev) return 'app'
22
+ if (isProd) return 'railway'
23
+ })(),
24
+ USERDB: (() => {
25
+ if (isDev) return 'root'
26
+ if (isProd) return 'root'
27
+ })(),
28
+ PASSDB: (() => {
29
+ if (isDev) return ''
30
+ if (isProd) return '8jpgm70bhVjWIxEFbsrt'
31
+ })(),
32
+ HOSTDB: (() => {
33
+ if (isDev) return 'localhost'
34
+ if (isProd) return 'containers-us-west-65.railway.app'
35
+ })(),
36
+ DIALECTDB: 'mysql',
37
+ SESSION_NAME: 'vp.client',
38
+ SESSION_KEY: '12ba105efUaGjihGrh0LfJHTGIBGu6jXa',
39
+ URL_BASE: (() => {
40
+ if (isDev) return 'http://localhost:3001/app/'
41
+ if (isProd) return 'http://localhost:3001/app/'
42
+ // if (isStaging) return 'Title Stg'
43
+ })(),
44
+ MAIN_URL_BASE: (() => {
45
+ if (isDev) return 'http://localhost:3000/'
46
+ if (isProd) return 'http://localhost:3000/'
47
+ if (isStaging) return 'Title Stg'
48
+ })(),
49
+ // URL_BASE_WS
50
+ URL_ADMIN_SERVER: (() => {
51
+ if (isDev) return 'http://localhost:4000/'
52
+ // if (isDev) return 'https://server-image-food.herokuapp.com/'
53
+ if (isProd) return 'http://localhost:4000/'
54
+ })(),
55
+ // BANCOLOMBIA
56
+ BANCOLOMBIA_CLIENT_KEY: '55929729-85fe-4ffe-928d-0bd317817be4',
57
+ BANCOLOMBIA_SECRET_KEY: 'E1aM2bV2lD7vS8cH1qJ8oN0nD7eN0eP0rM8gU0cG2lL6uY5sO7',
58
+ JWT_EXPIRY: 333300,
59
+ REFRESH_TOKEN_EXPIRY: '604800',
60
+ AUTHO_USER_KEY: '12ba105efUaGjihGrh0LfJHTGIBGu6jXV',
61
+ ACCESS_SID_TWILIO: 'AC7c9ccbdb50400c504faf629e35aea8e4',
62
+ REACT_APP_API_KEY_GOOGLE_MAPS: 'AIzaSyAy0SY1G3OFqesWSTQRHJvzyJzNgURPoN8',
63
+ ACCESS_TOKEN_AUTH_TWILIO: '22e090d4d776ace7bb596ca77cba6b18'
64
+ }
65
+
66
+ const resolveUniqueReactForHooks = {
67
+ webpack: (config, options) => {
68
+ if (options.isServer) {
69
+ config.externals = ['react', ...config.externals]
70
+ }
71
+ // eslint-disable-next-line no-undef
72
+ config.resolve.alias.react = reactPath
73
+ return config
74
+ },
75
+ images: {
76
+ domains: ['http2.mlstatic.com', 'localhost', 'server-image-food.herokuapp.com']
77
+ }
78
+ }
79
+ const headers = () => {
80
+ return [
81
+ {
82
+ source: '/app',
83
+ headers: [
84
+ {
85
+ key: 'x-custom-header-1',
86
+ value: 'my custom header 1'
87
+ }
88
+ ]
89
+ }
90
+ ]
91
+ }
92
+ const redirects = () => {
93
+ return [
94
+ {
95
+ source: '/home',
96
+ destination: '/',
97
+ permanent: true
98
+ }
99
+ ]
100
+ }
101
+ const basePath = '/app'
102
+ // puedes sobre escribir la ruta
103
+ const rewrites = () => {
104
+ return [
105
+ {
106
+ source: '/ab',
107
+ destination: '/about'
108
+ }
109
+ ]
110
+ }
111
+ const assetPrefix = isProd ? 'https://cdn.mydomain.com' : ''
112
+ const images = {
113
+ domains: ['http2.mlstatic.com', 'localhost', 'server-image-food.herokuapp.com', '*']
114
+ }
115
+ return {
116
+ env,
117
+ swcMinify: false,
118
+ images,
119
+ headers,
120
+ optimizeFonts: false,
121
+ nextConfig,
122
+ // basePath,
123
+ rewrites,
124
+ redirects,
125
+ assetPrefix,
126
+ resolveUniqueReactForHooks
127
+ }
128
+ }
129
129
  // module.exports = nextConfig
package/package.json CHANGED
@@ -1,6 +1,13 @@
1
1
  {
2
2
  "name": "npm-pkg-hook",
3
- "version": "1.0.1",
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.2",
4
11
  "description": "description-pkg-hook",
5
12
  "main": "/src/index.jsx",
6
13
  "scripts": {
@@ -13,6 +20,7 @@
13
20
  "@apollo/client": "3.6.9",
14
21
  "@typescript-eslint/parser": "^5.37.0",
15
22
  "js-cookie": "3.0.1",
23
+ "moment": "^2.29.4",
16
24
  "react": "18.1.0",
17
25
  "react-dom": "18.1.0",
18
26
  "react-query": "^3.39.2"
@@ -30,4 +38,4 @@
30
38
  "eslint-plugin-react": "^7.31.8",
31
39
  "eslint-plugin-react-hooks": "^4.6.0"
32
40
  }
33
- }
41
+ }
@@ -1,3 +1,3 @@
1
- import Cookies from 'js-cookie'
2
-
3
- export { Cookies }
1
+ import Cookies from 'js-cookie'
2
+
3
+ export { Cookies }