npm-pkg-hook 1.12.4 → 1.12.7
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/dist/index.cjs +20089 -0
- package/dist/index.js +19854 -0
- package/dist/index.mjs +19854 -0
- package/package.json +28 -6
- package/.babelrc +0 -0
- package/.env +0 -5
- package/.eslintrc.js +0 -38
- package/.eslintrc.json +0 -127
- package/.github/pull_request_template.md +0 -18
- package/.github/workflows/pepeline.yaml +0 -30
- package/expire.json +0 -1
- package/jsconfig.json +0 -28
- package/script.txt +0 -7
- package/src/config/client/errors.js +0 -26
- package/src/config/client/index.js +0 -1
- package/src/config/content/en.json +0 -5
- package/src/config/content/es.json +0 -5
- package/src/config/content/index.js +0 -16
- package/src/cookies/index.js +0 -3
- package/src/hooks/addTenMinutes/index.js +0 -14
- package/src/hooks/calculateLogLatHaversine/index.js +0 -30
- package/src/hooks/completeSchedules/index.js +0 -22
- package/src/hooks/convertToMilitaryTime/index.js +0 -14
- package/src/hooks/generateStoreURL/index.js +0 -38
- package/src/hooks/generateTemplate/index.js +0 -62
- package/src/hooks/getCardType/index.js +0 -24
- package/src/hooks/getCategoriesWithProduct/helpers/index.js +0 -7
- package/src/hooks/getCategoriesWithProduct/index.js +0 -62
- package/src/hooks/getGlobalSession/index.js +0 -49
- package/src/hooks/getSession/index.js +0 -18
- package/src/hooks/getTodayTimestamps/index.js +0 -64
- package/src/hooks/getTotalHours/index.js +0 -48
- package/src/hooks/handleLogin/index.js +0 -10
- package/src/hooks/index.ts +0 -147
- package/src/hooks/isTokenExpired/index.js +0 -17
- package/src/hooks/newMessageSubscription/index.js +0 -28
- package/src/hooks/newStoreOrderSubscription/index.js +0 -26
- package/src/hooks/statusOpenStores/helpers/index.js +0 -101
- package/src/hooks/statusOpenStores/index.js +0 -156
- package/src/hooks/updateExtProductFoodsOptional/index.js +0 -40
- package/src/hooks/useAcumulateDate/index.js +0 -16
- package/src/hooks/useAllStoresPendingToRegister/index.js +0 -34
- package/src/hooks/useAmountInput/index.ts +0 -117
- package/src/hooks/useAnimationFrame/index.js +0 -45
- package/src/hooks/useAnimationText/index.jsx +0 -31
- package/src/hooks/useAsideCart/helpers/index.js +0 -22
- package/src/hooks/useAsideCart/index.js +0 -214
- package/src/hooks/useAsideCart/queries.js +0 -10
- package/src/hooks/useBanner/index.js +0 -19
- package/src/hooks/useCart/index.js +0 -2
- package/src/hooks/useCart/queries.js +0 -174
- package/src/hooks/useCart/useCart/helpers/index.js +0 -75
- package/src/hooks/useCart/useCart/index.js +0 -412
- package/src/hooks/useCart/useGetCart/index.js +0 -33
- package/src/hooks/useCatWithProduct/index.js +0 -48
- package/src/hooks/useCatWithProduct/queries.js +0 -200
- package/src/hooks/useCatWithProductClient/index.js +0 -56
- package/src/hooks/useCatWithProductClient/queries.js +0 -56
- package/src/hooks/useCategoriesProduct/index.js +0 -13
- package/src/hooks/useCategoriesProduct/queries.js +0 -16
- package/src/hooks/useCategoryInStore/index.js +0 -100
- package/src/hooks/useCategoryInStore/queries.js +0 -78
- package/src/hooks/useCategoryStore/index.js +0 -7
- package/src/hooks/useCategoryStore/queries.js +0 -16
- package/src/hooks/useChartData/index.js +0 -170
- package/src/hooks/useChartData/useChartData/index.js +0 -199
- package/src/hooks/useChartData/useChartDataAllOrders/index.js +0 -94
- package/src/hooks/useChatRoomSubscription/index.js +0 -28
- package/src/hooks/useCheckbox/index.js +0 -115
- package/src/hooks/useCities/index.js +0 -13
- package/src/hooks/useCities/queries.js +0 -12
- package/src/hooks/useClients/index.js +0 -96
- package/src/hooks/useClients/queries.js +0 -212
- package/src/hooks/useColorByLetters/helpers/alea.js +0 -54
- package/src/hooks/useColorByLetters/helpers/colors.js +0 -45
- package/src/hooks/useColorByLetters/helpers/index.js +0 -18
- package/src/hooks/useColorByLetters/helpers/mersenne_twister.js +0 -118
- package/src/hooks/useColorByLetters/index.js +0 -27
- package/src/hooks/useConnection/index.js +0 -24
- package/src/hooks/useCountries/index.js +0 -19
- package/src/hooks/useCountries/queries.js +0 -12
- package/src/hooks/useCreateDeliveryTime/index.js +0 -51
- package/src/hooks/useCreateOrderStatusType/index.ts +0 -132
- package/src/hooks/useCreateProduct/helpers/index.js +0 -23
- package/src/hooks/useCreateProduct/helpers/manageCacheDataCatProduct/index.js +0 -52
- package/src/hooks/useCreateProduct/helpers/useEditImageProduct/index.js +0 -176
- package/src/hooks/useCreateProduct/index.js +0 -334
- package/src/hooks/useCreateStorePendingToRegister/index.js +0 -13
- package/src/hooks/useCreateStorePendingToRegister/queries.js +0 -10
- package/src/hooks/useDashboardComponents/index.js +0 -50
- package/src/hooks/useDeleteExtraProductFoods/index.js +0 -12
- package/src/hooks/useDeleteSubProductOptional/index.js +0 -30
- package/src/hooks/useDeleteSubProductOptional/queries.js +0 -10
- package/src/hooks/useDeliveryTime/index.js +0 -27
- package/src/hooks/useDepartments/index.js +0 -13
- package/src/hooks/useDepartments/queries.js +0 -13
- package/src/hooks/useDessert/helpers/index.js +0 -51
- package/src/hooks/useDessert/index.js +0 -525
- package/src/hooks/useDessertWithPrice/helpers/index.js +0 -76
- package/src/hooks/useDessertWithPrice/index.js +0 -373
- package/src/hooks/useDessertWithPrice/queries.js +0 -18
- package/src/hooks/useDevWS/index.ts +0 -53
- package/src/hooks/useDevices/index.js +0 -2
- package/src/hooks/useDevices/queries.js +0 -28
- package/src/hooks/useDevices/useGetDevices.js +0 -28
- package/src/hooks/useDevices/useRegisterDevices.js +0 -75
- package/src/hooks/useDownloadReports/helpers/downloadFileFromResponse.ts +0 -21
- package/src/hooks/useDownloadReports/index.ts +0 -2
- package/src/hooks/useDownloadReports/useDownloadReportByDay/index.ts +0 -103
- package/src/hooks/useDownloadReports/useGetReportByDateRange/index.ts +0 -115
- package/src/hooks/useDrag/index.js +0 -63
- package/src/hooks/useDropzone/index.js +0 -94
- package/src/hooks/useDynamicAuth/index.js +0 -13
- package/src/hooks/useDynamicAuth/queries.js +0 -24
- package/src/hooks/useEditCategory/index.js +0 -41
- package/src/hooks/useEditOneExtProductFoodOptional/index.js +0 -28
- package/src/hooks/useEditOneExtProductFoodOptional/queries.js +0 -16
- package/src/hooks/useEditSubProductOptional/index.js +0 -11
- package/src/hooks/useEditSubProductOptional/queries.js +0 -10
- package/src/hooks/useEmployee/index.js +0 -17
- package/src/hooks/useEmployee/queries.js +0 -85
- package/src/hooks/useEmployee/useCreateEmployee.js +0 -86
- package/src/hooks/useEvent/index.js +0 -34
- package/src/hooks/useFavoriteStores/index.js +0 -29
- package/src/hooks/useFavoriteStores/queries.js +0 -54
- package/src/hooks/useFetchJson/index.js +0 -25
- package/src/hooks/useFetchMoreInteractions/index.jsx +0 -39
- package/src/hooks/useFingerprintjs/index.js +0 -172
- package/src/hooks/useFormTools/index.js +0 -116
- package/src/hooks/useFormatDate/index.js +0 -86
- package/src/hooks/useFormatNumberPhone/index.js +0 -23
- package/src/hooks/useFullScreenMode/index.js +0 -65
- package/src/hooks/useGenerateNumberArray/index.js +0 -17
- package/src/hooks/useGetAllLocationUser/index.js +0 -12
- package/src/hooks/useGetAllLocationUser/queries.js +0 -44
- package/src/hooks/useGetCookies/index.js +0 -43
- package/src/hooks/useGetExtProductFoodsSubOptionalAll/index.js +0 -14
- package/src/hooks/useGetFoodRecomended/index.js +0 -32
- package/src/hooks/useGetFoodRecomended/queries.js +0 -47
- package/src/hooks/useGetMessagesToRoom/index.js +0 -23
- package/src/hooks/useGetMinPrice/index.js +0 -12
- package/src/hooks/useGetMinPrice/queries.js +0 -7
- package/src/hooks/useGetOneStoreRating/index.js +0 -40
- package/src/hooks/useGetOneStoreRating/queries.js +0 -18
- package/src/hooks/useGetSalesAmountToday/index.js +0 -31
- package/src/hooks/useGetStoreCookie/index.js +0 -21
- package/src/hooks/useGoogleLogin/index.js +0 -160
- package/src/hooks/useGoogleLogin/loadScript.js +0 -15
- package/src/hooks/useGoogleLogin/removeScript.js +0 -7
- package/src/hooks/useHover/index.js +0 -29
- package/src/hooks/useImageOptimization/index.js +0 -28
- package/src/hooks/useImageUploaderProduct/helper/canvasUtils.ts +0 -130
- package/src/hooks/useImageUploaderProduct/helper/getOrientation.ts +0 -53
- package/src/hooks/useImageUploaderProduct/helper/index.ts +0 -5
- package/src/hooks/useImageUploaderProduct/index.ts +0 -292
- package/src/hooks/useImageWeight/index.js +0 -51
- package/src/hooks/useImagesStore/index.js +0 -225
- package/src/hooks/useImagesStore/queries.js +0 -193
- package/src/hooks/useImagesStore/utils/index.js +0 -4
- package/src/hooks/useIncomingOrders/index.js +0 -10
- package/src/hooks/useIncomingOrders/queries.js +0 -87
- package/src/hooks/useInnerHtml/index.js +0 -39
- package/src/hooks/useIntersection/index.js +0 -84
- package/src/hooks/useInventory/index.js +0 -2
- package/src/hooks/useInventory/queries.js +0 -58
- package/src/hooks/useInventory/useGetProductsInStock.js +0 -15
- package/src/hooks/useInventory/useUpdateManageStock.js +0 -41
- package/src/hooks/useKeypress/index.js +0 -28
- package/src/hooks/useLazyScript/index.js +0 -71
- package/src/hooks/useLocalBackendIp/index.js +0 -34
- package/src/hooks/useLocalSorage/index.js +0 -36
- package/src/hooks/useLocationManager/index.js +0 -63
- package/src/hooks/useLocationNavigate/index.js +0 -54
- package/src/hooks/useLoginEmployeeInStore/index.js +0 -38
- package/src/hooks/useLogout/helpers/BroadcastChannel.js +0 -31
- package/src/hooks/useLogout/helpers/apiBaseUrl.js +0 -8
- package/src/hooks/useLogout/helpers/fetchData.js +0 -28
- package/src/hooks/useLogout/helpers/getCsrfToken.js +0 -30
- package/src/hooks/useLogout/helpers/index.js +0 -57
- package/src/hooks/useLogout/helpers/logger.js +0 -70
- package/src/hooks/useLogout/helpers/parseUrl.js +0 -36
- package/src/hooks/useLogout/index.js +0 -96
- package/src/hooks/useManageNewOrder/helpers/index.js +0 -45
- package/src/hooks/useManageNewOrder/helpers/mock.js +0 -0
- package/src/hooks/useManageNewOrder/index.js +0 -102
- package/src/hooks/useManageQueryParams/index.js +0 -40
- package/src/hooks/useMobile/index.js +0 -65
- package/src/hooks/useModules/helpers/index.js +0 -1
- package/src/hooks/useModules/helpers/validateModules.js +0 -29
- package/src/hooks/useModules/index.js +0 -58
- package/src/hooks/useMouse/index.ts +0 -50
- package/src/hooks/useMutateHeight/index.js +0 -36
- package/src/hooks/useOrderClient/index.js +0 -5
- package/src/hooks/useOrderStatusTypes/index.ts +0 -2
- package/src/hooks/useOrderStatusTypes/useOrderStatusTypes/index.ts +0 -133
- package/src/hooks/useOrderStatusTypes/useUpdateOrderStatusPriorities/index.ts +0 -97
- package/src/hooks/useOrders/index.js +0 -3
- package/src/hooks/useOrders/queries.js +0 -89
- package/src/hooks/useOrders/useChangeOrderState/index.ts +0 -125
- package/src/hooks/useOrders/useOrdersFromStore/index.ts +0 -77
- package/src/hooks/usePWAInstall/index.js +0 -38
- package/src/hooks/usePortFetcher/index.ts +0 -33
- package/src/hooks/usePrintSaleTicket/index.ts +0 -64
- package/src/hooks/useProductsFood/index.js +0 -253
- package/src/hooks/useProductsFood/queriesStore.js +0 -964
- package/src/hooks/useProductsFood/useEditProduct.js +0 -48
- package/src/hooks/useProductsFood/usetagsProducts.js +0 -98
- package/src/hooks/useProviders/index.js +0 -3
- package/src/hooks/useProviders/queries.js +0 -31
- package/src/hooks/useProviders/useProvidersCreateStore/index.js +0 -12
- package/src/hooks/useProviders/useProvidersDataStore/index.js +0 -24
- package/src/hooks/useProvidersStore/index.js +0 -24
- package/src/hooks/useProvidersStore/queries.js +0 -31
- package/src/hooks/usePushNotificationOrder/index.js +0 -52
- package/src/hooks/usePushNotifications/helpers/index.js +0 -114
- package/src/hooks/usePushNotifications/index.js +0 -149
- package/src/hooks/useQueryLocationsMap/index.js +0 -19
- package/src/hooks/useQueryLocationsMap/queries.js +0 -40
- package/src/hooks/useRatingArrayData/index.js +0 -54
- package/src/hooks/useRatingArrayData/queries.js +0 -19
- package/src/hooks/useReactToPrint/index.js +0 -1223
- package/src/hooks/useRemoveExtraProductFoodsOptional/index.js +0 -23
- package/src/hooks/useRemoveExtraProductFoodsOptional/queries.js +0 -48
- package/src/hooks/useReport/index.js +0 -47
- package/src/hooks/useReport/queries.js +0 -123
- package/src/hooks/useRestaurant/helpers/index.js +0 -24
- package/src/hooks/useRestaurant/helpers/manageStatusOpen.js +0 -26
- package/src/hooks/useRestaurant/index.js +0 -69
- package/src/hooks/useRestaurant/queries.js +0 -81
- package/src/hooks/useRoads/index.js +0 -19
- package/src/hooks/useRoads/queries.js +0 -13
- package/src/hooks/useRoles/index.js +0 -4
- package/src/hooks/useRoles/queries.js +0 -70
- package/src/hooks/useRoles/useCreateRole.js +0 -37
- package/src/hooks/useRoles/useGetRoles.js +0 -36
- package/src/hooks/useRoles/useRemoveRoles.js +0 -40
- package/src/hooks/useRoles/useUpdateRolesPriority.js +0 -44
- package/src/hooks/useSales/helpers/index.js +0 -55
- package/src/hooks/useSales/index.js +0 -1381
- package/src/hooks/useSales/queries.js +0 -424
- package/src/hooks/useSales/useGetAllSales/index.js +0 -25
- package/src/hooks/useSales/useGetSale.js +0 -13
- package/src/hooks/useSales/useTotalSales.js +0 -23
- package/src/hooks/useSaveAvailableProduct/helpers/index.js +0 -38
- package/src/hooks/useSaveAvailableProduct/index.js +0 -31
- package/src/hooks/useSaveAvailableProduct/queries.js +0 -10
- package/src/hooks/useSaveLocation/index.js +0 -16
- package/src/hooks/useSaveLocation/queries.js +0 -19
- package/src/hooks/useSchedule/index.js +0 -78
- package/src/hooks/useSchedule/index.jsx +0 -22
- package/src/hooks/useSchedule/queries.js +0 -43
- package/src/hooks/useScheduleData/index.js +0 -123
- package/src/hooks/useScroll/index.js +0 -56
- package/src/hooks/useScrollRotate/index.js +0 -16
- package/src/hooks/useSetImageProducts/index.js +0 -57
- package/src/hooks/useSetImageProducts/queries.js +0 -18
- package/src/hooks/useSetSession/index.js +0 -44
- package/src/hooks/useSetState/index.js +0 -24
- package/src/hooks/useSetupSchedule/helpers/index.js +0 -85
- package/src/hooks/useSetupSchedule/index.js +0 -272
- package/src/hooks/useStatusOpenStore/helpers/index.js +0 -101
- package/src/hooks/useStatusOpenStore/index.js +0 -179
- package/src/hooks/useStatusOrdersClient/helpers/index.js +0 -14
- package/src/hooks/useStatusOrdersClient/index.js +0 -17
- package/src/hooks/useStatusOrdersClient/queries.js +0 -80
- package/src/hooks/useStockMovements/helpers/index.js +0 -16
- package/src/hooks/useStockMovements/index.js +0 -38
- package/src/hooks/useStore/index.js +0 -80
- package/src/hooks/useStore/queries.js +0 -163
- package/src/hooks/useStoreCalendar/index.js +0 -5
- package/src/hooks/useStoreContacts/index.js +0 -47
- package/src/hooks/useStoreContacts/queries.js +0 -48
- package/src/hooks/useStoreTable/index.js +0 -2
- package/src/hooks/useStoreTable/queries.js +0 -47
- package/src/hooks/useStoreTable/useStoreTableCreate.js +0 -76
- package/src/hooks/useStoreTable/useStoreTables.js +0 -14
- package/src/hooks/useSubscriptionValidation/index.js +0 -41
- package/src/hooks/useTagProducts/index.ts +0 -3
- package/src/hooks/useTagProducts/useDeleteOneTag.ts +0 -106
- package/src/hooks/useTagProducts/useGetAllTags.ts +0 -68
- package/src/hooks/useTagProducts/useRegisterMultipleTags.ts +0 -156
- package/src/hooks/useTimeAgo/useTimeAgo.js +0 -39
- package/src/hooks/useTokenCards/index.js +0 -41
- package/src/hooks/useTopProductsMovements/index.js +0 -27
- package/src/hooks/useTotalAllSales/index.js +0 -25
- package/src/hooks/useTotalProductsInStock/index.js +0 -23
- package/src/hooks/useTotalProductsSold/index.js +0 -23
- package/src/hooks/useTotalProductsSolded/index.js +0 -20
- package/src/hooks/useUpdateCart/index.js +0 -130
- package/src/hooks/useUpdateCartCookie/index.js +0 -43
- package/src/hooks/useUpdateDashboardComponent/index.ts +0 -91
- package/src/hooks/useUpdateExistingOrders/index.js +0 -85
- package/src/hooks/useUpdateExtProductFoodsSubOptional/index.js +0 -60
- package/src/hooks/useUpdateModuleOrder/index.js +0 -37
- package/src/hooks/useUpdateMultipleExtProduct/index.js +0 -33
- package/src/hooks/useUpdateMultipleExtProduct/queries.js +0 -33
- package/src/hooks/useUpdateMultipleProducts/index.js +0 -80
- package/src/hooks/useUpdateMultipleProducts/queries.js +0 -51
- package/src/hooks/useUploadProducts/helpers/index.js +0 -1
- package/src/hooks/useUploadProducts/helpers/parseNumber.js +0 -37
- package/src/hooks/useUploadProducts/helpers/validateProductDataExcel.js +0 -73
- package/src/hooks/useUploadProducts/index.js +0 -422
- package/src/hooks/useUpsertGoal/index.js +0 -68
- package/src/hooks/useUser/index.js +0 -23
- package/src/hooks/useUser/queries.js +0 -131
- package/src/hooks/useWeeklyStockMovement/helpers/index.js +0 -32
- package/src/hooks/useWeeklyStockMovement/index.js +0 -51
- package/src/hooks/useWindowSize/index.js +0 -38
- package/src/index.jsx +0 -9
- package/src/mock/dessert/index.js +0 -16
- package/src/mock/index.js +0 -1
- package/src/security/index.js +0 -1
- package/src/services/index.js +0 -0
- package/src/utils/UtilDateRange.js +0 -31
- package/src/utils/index.js +0 -306
- package/tsconfig.json +0 -5
|
@@ -1,48 +0,0 @@
|
|
|
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
|
-
productName = null,
|
|
9
|
-
searchFilter = {}
|
|
10
|
-
}) => {
|
|
11
|
-
const {
|
|
12
|
-
gender,
|
|
13
|
-
desc,
|
|
14
|
-
speciality
|
|
15
|
-
} = searchFilter ?? {
|
|
16
|
-
gender: [],
|
|
17
|
-
desc: null,
|
|
18
|
-
speciality: []
|
|
19
|
-
}
|
|
20
|
-
const {
|
|
21
|
-
data,
|
|
22
|
-
loading,
|
|
23
|
-
error,
|
|
24
|
-
fetchMore
|
|
25
|
-
} = useQuery(GET_ALL_CATEGORIES_WITH_PRODUCT, {
|
|
26
|
-
fetchPolicy: 'network-only',
|
|
27
|
-
variables:
|
|
28
|
-
{
|
|
29
|
-
search,
|
|
30
|
-
productName,
|
|
31
|
-
gender,
|
|
32
|
-
min,
|
|
33
|
-
max: 400,
|
|
34
|
-
desc,
|
|
35
|
-
categories: speciality
|
|
36
|
-
}
|
|
37
|
-
})
|
|
38
|
-
const totalCount = data?.getCatProductsWithProduct?.totalCount
|
|
39
|
-
return [
|
|
40
|
-
data?.getCatProductsWithProduct?.catProductsWithProduct,
|
|
41
|
-
{
|
|
42
|
-
loading,
|
|
43
|
-
error,
|
|
44
|
-
fetchMore,
|
|
45
|
-
totalCount
|
|
46
|
-
}
|
|
47
|
-
]
|
|
48
|
-
}
|
|
@@ -1,200 +0,0 @@
|
|
|
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, $withProduct: Boolean) {
|
|
45
|
-
deleteCatFinalOfProducts(idPc: $idPc, withProduct: $withProduct) {
|
|
46
|
-
success
|
|
47
|
-
message
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
`
|
|
51
|
-
export const DELETE_EXTRA_PRODUCTS = gql`
|
|
52
|
-
mutation deleteExtraProduct($id: ID, $state: Int){
|
|
53
|
-
deleteExtraProduct(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(
|
|
121
|
-
$search: String
|
|
122
|
-
$productName: String
|
|
123
|
-
$min: Int
|
|
124
|
-
$max: Int
|
|
125
|
-
$gender: [String]
|
|
126
|
-
$desc: [String]
|
|
127
|
-
$categories: [ID]
|
|
128
|
-
) {
|
|
129
|
-
getCatProductsWithProduct(
|
|
130
|
-
search: $search
|
|
131
|
-
min: $min
|
|
132
|
-
productName: $productName
|
|
133
|
-
max: $max
|
|
134
|
-
gender: $gender
|
|
135
|
-
desc: $desc
|
|
136
|
-
categories: $categories
|
|
137
|
-
) {
|
|
138
|
-
totalCount
|
|
139
|
-
catProductsWithProduct {
|
|
140
|
-
carProId
|
|
141
|
-
pState
|
|
142
|
-
pState
|
|
143
|
-
ProImage
|
|
144
|
-
idStore
|
|
145
|
-
pName
|
|
146
|
-
totalCount
|
|
147
|
-
ProDescription
|
|
148
|
-
ProImage
|
|
149
|
-
pState
|
|
150
|
-
createdAt
|
|
151
|
-
updatedAt
|
|
152
|
-
productFoodsAll {
|
|
153
|
-
pId
|
|
154
|
-
stock
|
|
155
|
-
manageStock
|
|
156
|
-
sizeId
|
|
157
|
-
colorId
|
|
158
|
-
carProId
|
|
159
|
-
cId
|
|
160
|
-
dId
|
|
161
|
-
ctId
|
|
162
|
-
idStore
|
|
163
|
-
caId
|
|
164
|
-
fId
|
|
165
|
-
pName
|
|
166
|
-
ProPrice
|
|
167
|
-
ProDescuento
|
|
168
|
-
ProUniDisponibles
|
|
169
|
-
ProDescription
|
|
170
|
-
ProProtegido
|
|
171
|
-
ProAssurance
|
|
172
|
-
ProImage
|
|
173
|
-
ProStar
|
|
174
|
-
ProWidth
|
|
175
|
-
ProHeight
|
|
176
|
-
ProLength
|
|
177
|
-
ProWeight
|
|
178
|
-
ProQuantity
|
|
179
|
-
ProOutstanding
|
|
180
|
-
ProDelivery
|
|
181
|
-
ProVoltaje
|
|
182
|
-
pState
|
|
183
|
-
sTateLogistic
|
|
184
|
-
createdAt
|
|
185
|
-
updatedAt
|
|
186
|
-
product_availables {
|
|
187
|
-
availableProductId
|
|
188
|
-
pId
|
|
189
|
-
idStore
|
|
190
|
-
dayAvailable
|
|
191
|
-
startDate
|
|
192
|
-
endDate
|
|
193
|
-
createdAt
|
|
194
|
-
updatedAt
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
`
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { useMemo } from 'react'
|
|
2
|
-
import { useQuery } from '@apollo/client'
|
|
3
|
-
import { GET_ALL_CATEGORIES_WITH_PRODUCT_CLIENTS } from './queries'
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Custom hook to fetch categories with product data.
|
|
7
|
-
*
|
|
8
|
-
* @param {string} idStore - The ID of the store.
|
|
9
|
-
* @returns {object} - The hook result containing filtered data, loading state, and fetch function.
|
|
10
|
-
*/
|
|
11
|
-
export const useCatWithProductClient = (idStore) => {
|
|
12
|
-
const { data, loading, error, fetchMore } = useQuery(GET_ALL_CATEGORIES_WITH_PRODUCT_CLIENTS, {
|
|
13
|
-
fetchPolicy: 'cache-and-network',
|
|
14
|
-
variables: {
|
|
15
|
-
max: 100,
|
|
16
|
-
idStore,
|
|
17
|
-
search: '',
|
|
18
|
-
gender: [],
|
|
19
|
-
desc: [],
|
|
20
|
-
categories: []
|
|
21
|
-
}
|
|
22
|
-
})
|
|
23
|
-
|
|
24
|
-
const fetchCategories = () => {
|
|
25
|
-
fetchMore({
|
|
26
|
-
variables: {
|
|
27
|
-
max: 100,
|
|
28
|
-
idStore,
|
|
29
|
-
search: '',
|
|
30
|
-
gender: [],
|
|
31
|
-
desc: [],
|
|
32
|
-
categories: []
|
|
33
|
-
},
|
|
34
|
-
updateQuery: (prev, { fetchMoreResult }) => {
|
|
35
|
-
if (!fetchMoreResult) return prev
|
|
36
|
-
return {
|
|
37
|
-
...prev,
|
|
38
|
-
getCatProductsWithProductClient: fetchMoreResult.getCatProductsWithProductClient
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
})
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
// Utiliza useMemo para memorizar el resultado filtrado
|
|
45
|
-
const filteredData = useMemo(() => {
|
|
46
|
-
return data?.getCatProductsWithProductClient?.filter(
|
|
47
|
-
(category) => category?.productFoodsAll?.length > 0
|
|
48
|
-
) || []
|
|
49
|
-
}, [data])
|
|
50
|
-
|
|
51
|
-
return [filteredData, {
|
|
52
|
-
loading,
|
|
53
|
-
error,
|
|
54
|
-
fetchCategories
|
|
55
|
-
}]
|
|
56
|
-
}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { gql } from '@apollo/client'
|
|
2
|
-
|
|
3
|
-
export const GET_ALL_CATEGORIES_WITH_PRODUCT_CLIENTS = gql`
|
|
4
|
-
query getCatProductsWithProductClient($search: String, $min: Int, $max: Int, $gender: [String], $desc: [String], $categories: [ID], $carProId: ID $idStore: ID ) {
|
|
5
|
-
getCatProductsWithProductClient(search: $search, min: $min, max: $max, gender: $gender, desc: $desc, categories: $categories, carProId: $carProId idStore: $idStore) {
|
|
6
|
-
carProId
|
|
7
|
-
pState
|
|
8
|
-
pState
|
|
9
|
-
ProImage
|
|
10
|
-
idStore
|
|
11
|
-
pName
|
|
12
|
-
ProDescription
|
|
13
|
-
ProImage
|
|
14
|
-
pState
|
|
15
|
-
pDatCre
|
|
16
|
-
pDatMod
|
|
17
|
-
productFoodsAll {
|
|
18
|
-
pId
|
|
19
|
-
sizeId
|
|
20
|
-
stock
|
|
21
|
-
colorId
|
|
22
|
-
carProId
|
|
23
|
-
cId
|
|
24
|
-
dId
|
|
25
|
-
ValueDelivery
|
|
26
|
-
ctId
|
|
27
|
-
idStore
|
|
28
|
-
caId
|
|
29
|
-
fId
|
|
30
|
-
pName
|
|
31
|
-
ProPrice
|
|
32
|
-
ProDescuento
|
|
33
|
-
ProUniDisponibles
|
|
34
|
-
ProDescription
|
|
35
|
-
ProProtegido
|
|
36
|
-
ProAssurance
|
|
37
|
-
ProImage
|
|
38
|
-
ProStar
|
|
39
|
-
ProWidth
|
|
40
|
-
ProHeight
|
|
41
|
-
ProLength
|
|
42
|
-
ProWeight
|
|
43
|
-
ProQuantity
|
|
44
|
-
ProOutstanding
|
|
45
|
-
ProDelivery
|
|
46
|
-
ProVoltaje
|
|
47
|
-
pState
|
|
48
|
-
sTateLogistic
|
|
49
|
-
pDatCre
|
|
50
|
-
pDatMod
|
|
51
|
-
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
`
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { useQuery } from '@apollo/client'
|
|
2
|
-
import { GET_ULTIMATE_CATEGORY_PRODUCTS } from './queries'
|
|
3
|
-
|
|
4
|
-
export const useCategoriesProduct = () => {
|
|
5
|
-
const {
|
|
6
|
-
data,
|
|
7
|
-
loading,
|
|
8
|
-
error,
|
|
9
|
-
networkStatus
|
|
10
|
-
} = useQuery(GET_ULTIMATE_CATEGORY_PRODUCTS)
|
|
11
|
-
|
|
12
|
-
return [data?.catProductsAll, { loading, error, networkStatus }]
|
|
13
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { gql } from '@apollo/client'
|
|
2
|
-
|
|
3
|
-
export const GET_ULTIMATE_CATEGORY_PRODUCTS = gql`
|
|
4
|
-
query catProductsAll($search: String, $min: Int, $max: Int, $gender: [String], $desc: [String], $categories: [ID], ) {
|
|
5
|
-
catProductsAll(search: $search, min: $min, max: $max, gender: $gender, desc: $desc, categories: $categories,) {
|
|
6
|
-
carProId
|
|
7
|
-
idStore
|
|
8
|
-
pName
|
|
9
|
-
ProDescription
|
|
10
|
-
ProImage
|
|
11
|
-
pState
|
|
12
|
-
createdAt
|
|
13
|
-
updatedAt
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
`
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
import { useMutation, useQuery } from '@apollo/client'
|
|
2
|
-
import { useState } from 'react'
|
|
3
|
-
import {
|
|
4
|
-
DELETE_ONE_CAT_PRODUCTS,
|
|
5
|
-
GET_ULTIMATE_CATEGORY_PRODUCTS,
|
|
6
|
-
UPDATE_CAT_IN_PRODUCT
|
|
7
|
-
} from '../useProductsFood/queriesStore'
|
|
8
|
-
import { GET_ONE_STORE_IN_CATEGORY } from './queries'
|
|
9
|
-
|
|
10
|
-
export const useCategoryInStore = ({ catStoreId, setAlertBox = () => {} } = {}) => {
|
|
11
|
-
// STATES
|
|
12
|
-
const [categories, setOneCategoryInStore] = useState([])
|
|
13
|
-
const [deleteCatOfProducts] = useMutation(DELETE_ONE_CAT_PRODUCTS, {
|
|
14
|
-
onError: (e) => {
|
|
15
|
-
setAlertBox({
|
|
16
|
-
message: e.graphQLErrors[0].message,
|
|
17
|
-
color: 'error'
|
|
18
|
-
})
|
|
19
|
-
},
|
|
20
|
-
update (cache) {
|
|
21
|
-
cache.modify({
|
|
22
|
-
fields: {
|
|
23
|
-
catProductsAll (dataOld = []) {
|
|
24
|
-
return cache.writeQuery({ query: GET_ULTIMATE_CATEGORY_PRODUCTS, data: dataOld })
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
})
|
|
28
|
-
}
|
|
29
|
-
})
|
|
30
|
-
const [updatedCatWithProducts] = useMutation(UPDATE_CAT_IN_PRODUCT, {
|
|
31
|
-
onError: (e) => {
|
|
32
|
-
console.log({
|
|
33
|
-
message: e.graphQLErrors[0].message,
|
|
34
|
-
color: 'error'
|
|
35
|
-
})
|
|
36
|
-
},
|
|
37
|
-
update (cache) {
|
|
38
|
-
cache.modify({
|
|
39
|
-
fields: {
|
|
40
|
-
catProductsAll (dataOld = []) {
|
|
41
|
-
return cache.writeQuery({ query: GET_ULTIMATE_CATEGORY_PRODUCTS, data: dataOld })
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
})
|
|
45
|
-
}
|
|
46
|
-
})
|
|
47
|
-
// QUERIES
|
|
48
|
-
const { data } = useQuery(GET_ULTIMATE_CATEGORY_PRODUCTS)
|
|
49
|
-
const {
|
|
50
|
-
loading,
|
|
51
|
-
error
|
|
52
|
-
} = useQuery(GET_ONE_STORE_IN_CATEGORY, {
|
|
53
|
-
variables: {
|
|
54
|
-
catStore: catStoreId
|
|
55
|
-
},
|
|
56
|
-
onError: () => {
|
|
57
|
-
console.log({ message: '', duration: 5000 })
|
|
58
|
-
},
|
|
59
|
-
onCompleted: () => {
|
|
60
|
-
if (data?.getOneCatStore) {
|
|
61
|
-
setOneCategoryInStore(data?.getOneCatStore)
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
})
|
|
65
|
-
// HANDLESS
|
|
66
|
-
const handlerDeleteCategoryInStore = (category) => {
|
|
67
|
-
const { pState, idPc } = category || {}
|
|
68
|
-
if (!idPc || !pState) return
|
|
69
|
-
return deleteCatOfProducts({
|
|
70
|
-
variables: { idPc, pState },
|
|
71
|
-
update (cache) {
|
|
72
|
-
cache.modify({
|
|
73
|
-
fields: {
|
|
74
|
-
catProductsAll (dataOld = []) {
|
|
75
|
-
return cache.writeQuery({ query: GET_ULTIMATE_CATEGORY_PRODUCTS, data: dataOld })
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
})
|
|
79
|
-
}
|
|
80
|
-
})
|
|
81
|
-
}
|
|
82
|
-
const handleUpdateCatInProduct = async ({ data }) => {
|
|
83
|
-
await updatedCatWithProducts({
|
|
84
|
-
variables: {
|
|
85
|
-
input: {
|
|
86
|
-
setData: data?.map(x => { return { idProduct: x.pId } }),
|
|
87
|
-
idCat: ''
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
})
|
|
91
|
-
}
|
|
92
|
-
return {
|
|
93
|
-
categories,
|
|
94
|
-
data: data?.catProductsAll || [],
|
|
95
|
-
loading,
|
|
96
|
-
error,
|
|
97
|
-
handlerDeleteCategoryInStore,
|
|
98
|
-
handleUpdateCatInProduct
|
|
99
|
-
}
|
|
100
|
-
}
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import { gql } from '@apollo/client'
|
|
2
|
-
|
|
3
|
-
export const GET_ONE_STORE_IN_CATEGORY = gql`
|
|
4
|
-
query getOneCatStore($catStore: ID){
|
|
5
|
-
getOneCatStore(catStore: $catStore){
|
|
6
|
-
catStore
|
|
7
|
-
idUser
|
|
8
|
-
cName
|
|
9
|
-
cState
|
|
10
|
-
createdAt
|
|
11
|
-
cPathImage
|
|
12
|
-
updatedAt
|
|
13
|
-
csDescription
|
|
14
|
-
getAllStore {
|
|
15
|
-
idStore
|
|
16
|
-
cId
|
|
17
|
-
id
|
|
18
|
-
dId
|
|
19
|
-
ctId
|
|
20
|
-
catStore
|
|
21
|
-
neighborhoodStore
|
|
22
|
-
Viaprincipal
|
|
23
|
-
storeOwner
|
|
24
|
-
storeName
|
|
25
|
-
emailStore
|
|
26
|
-
storePhone
|
|
27
|
-
socialRaz
|
|
28
|
-
Image
|
|
29
|
-
banner
|
|
30
|
-
documentIdentifier
|
|
31
|
-
uPhoNum
|
|
32
|
-
ULocation
|
|
33
|
-
upLat
|
|
34
|
-
upLon
|
|
35
|
-
uState
|
|
36
|
-
siteWeb
|
|
37
|
-
description
|
|
38
|
-
NitStore
|
|
39
|
-
typeRegiments
|
|
40
|
-
typeContribute
|
|
41
|
-
secVia
|
|
42
|
-
addressStore
|
|
43
|
-
createdAt
|
|
44
|
-
pais {
|
|
45
|
-
cId
|
|
46
|
-
cName
|
|
47
|
-
cCalCod
|
|
48
|
-
cState
|
|
49
|
-
cDatCre
|
|
50
|
-
cDatMod
|
|
51
|
-
}
|
|
52
|
-
city {
|
|
53
|
-
ctId
|
|
54
|
-
dId
|
|
55
|
-
cName
|
|
56
|
-
cState
|
|
57
|
-
cDatCre
|
|
58
|
-
cDatMod
|
|
59
|
-
}
|
|
60
|
-
department {
|
|
61
|
-
dId
|
|
62
|
-
cId
|
|
63
|
-
dName
|
|
64
|
-
dState
|
|
65
|
-
dDatCre
|
|
66
|
-
dDatMod
|
|
67
|
-
}
|
|
68
|
-
getAllRatingStar {
|
|
69
|
-
rSId
|
|
70
|
-
rScore
|
|
71
|
-
idStore
|
|
72
|
-
createAt
|
|
73
|
-
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
`
|