npm-pkg-hook 1.13.0 → 1.13.1
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.js +8 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +8 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +8 -2
- package/.babelrc +0 -0
- package/.github/pull_request_template.md +0 -18
- package/.github/workflows/pepeline.yaml +0 -30
- package/eslint.config.mts +0 -153
- package/expire.json +0 -1
- package/jsconfig.json +0 -28
- package/script.txt +0 -7
- package/src/config/client/errors.ts +0 -39
- package/src/config/client/index.ts +0 -1
- package/src/config/content/en.json +0 -5
- package/src/config/content/es.json +0 -5
- package/src/config/content/index.ts +0 -16
- package/src/cookies/index.ts +0 -3
- package/src/hooks/addTenMinutes/index.ts +0 -14
- package/src/hooks/calculateLogLatHaversine/index.ts +0 -41
- package/src/hooks/completeSchedules/index.ts +0 -22
- package/src/hooks/convertToMilitaryTime/index.ts +0 -18
- package/src/hooks/generateStoreURL/index.ts +0 -41
- package/src/hooks/generateTemplate/index.ts +0 -66
- package/src/hooks/getCardType/index.ts +0 -24
- package/src/hooks/getCategoriesWithProduct/helpers/index.ts +0 -7
- package/src/hooks/getCategoriesWithProduct/index.ts +0 -62
- package/src/hooks/getGlobalSession/index.ts +0 -69
- package/src/hooks/getSession/index.ts +0 -72
- package/src/hooks/getTodayTimestamps/index.ts +0 -70
- package/src/hooks/getTotalHours/index.ts +0 -76
- package/src/hooks/handleLogin/index.ts +0 -14
- package/src/hooks/index.ts +0 -154
- package/src/hooks/isTokenExpired/index.ts +0 -17
- package/src/hooks/newMessageSubscription/index.ts +0 -28
- package/src/hooks/newStoreOrderSubscription/index.ts +0 -26
- package/src/hooks/statusOpenStores/helpers/index.ts +0 -124
- package/src/hooks/statusOpenStores/index.ts +0 -221
- package/src/hooks/updateExtProductFoodsOptional/index.ts +0 -49
- package/src/hooks/useAcumulateDate/index.ts +0 -18
- package/src/hooks/useAllStoresPendingToRegister/index.ts +0 -37
- package/src/hooks/useAmountInput/index.ts +0 -127
- package/src/hooks/useAnimationFrame/index.ts +0 -45
- package/src/hooks/useAnimationText/index.ts +0 -31
- package/src/hooks/useAsideCart/helpers/index.ts +0 -22
- package/src/hooks/useAsideCart/index.ts +0 -217
- package/src/hooks/useAsideCart/queries.ts +0 -10
- package/src/hooks/useBanner/index.ts +0 -20
- package/src/hooks/useCart/index.ts +0 -2
- package/src/hooks/useCart/queries.ts +0 -174
- package/src/hooks/useCart/useCart/helpers/index.ts +0 -79
- package/src/hooks/useCart/useCart/index.ts +0 -424
- package/src/hooks/useCart/useGetCart/index.ts +0 -34
- package/src/hooks/useCatWithProduct/index.ts +0 -54
- package/src/hooks/useCatWithProduct/queries.ts +0 -200
- package/src/hooks/useCatWithProduct/types/index.ts +0 -104
- package/src/hooks/useCatWithProductClient/index.ts +0 -57
- package/src/hooks/useCatWithProductClient/queries.ts +0 -56
- package/src/hooks/useCategoriesProduct/index.ts +0 -14
- package/src/hooks/useCategoriesProduct/queries.ts +0 -16
- package/src/hooks/useCategoryInStore/index.ts +0 -167
- package/src/hooks/useCategoryInStore/queries.ts +0 -78
- package/src/hooks/useCategoryStore/index.ts +0 -8
- package/src/hooks/useCategoryStore/queries.ts +0 -16
- package/src/hooks/useChartData/index.ts +0 -171
- package/src/hooks/useChartData/useChartData/index.ts +0 -200
- package/src/hooks/useChartData/useChartDataAllOrders/index.ts +0 -94
- package/src/hooks/useChatRoomSubscription/index.ts +0 -28
- package/src/hooks/useCheckbox/index.ts +0 -115
- package/src/hooks/useCities/index.ts +0 -14
- package/src/hooks/useCities/queries.ts +0 -12
- package/src/hooks/useClients/index.ts +0 -97
- package/src/hooks/useClients/queries.ts +0 -215
- package/src/hooks/useColorByLetters/helpers/alea.ts +0 -73
- package/src/hooks/useColorByLetters/helpers/colors.ts +0 -45
- package/src/hooks/useColorByLetters/helpers/index.ts +0 -24
- package/src/hooks/useColorByLetters/helpers/mersenne_twister.ts +0 -118
- package/src/hooks/useColorByLetters/index.ts +0 -24
- package/src/hooks/useConnection/index.ts +0 -24
- package/src/hooks/useCountries/index.ts +0 -20
- package/src/hooks/useCountries/queries.ts +0 -12
- package/src/hooks/useCreateDeliveryTime/index.ts +0 -51
- package/src/hooks/useCreateOrderStatusType/index.ts +0 -134
- package/src/hooks/useCreateProduct/helpers/index.ts +0 -23
- package/src/hooks/useCreateProduct/helpers/manageCacheDataCatProduct/index.ts +0 -52
- package/src/hooks/useCreateProduct/helpers/useEditImageProduct/index.ts +0 -182
- package/src/hooks/useCreateProduct/index.ts +0 -337
- package/src/hooks/useCreateStorePendingToRegister/index.ts +0 -17
- package/src/hooks/useCreateStorePendingToRegister/queries.ts +0 -10
- package/src/hooks/useDashboardComponents/index.ts +0 -50
- package/src/hooks/useDeleteExtraProductFoods/index.ts +0 -13
- package/src/hooks/useDeleteSubProductOptional/index.ts +0 -32
- package/src/hooks/useDeleteSubProductOptional/queries.ts +0 -10
- package/src/hooks/useDeliveryTime/index.ts +0 -29
- package/src/hooks/useDepartments/index.ts +0 -14
- package/src/hooks/useDepartments/queries.ts +0 -13
- package/src/hooks/useDessert/helpers/index.ts +0 -51
- package/src/hooks/useDessert/index.ts +0 -529
- package/src/hooks/useDessertWithPrice/helpers/index.ts +0 -76
- package/src/hooks/useDessertWithPrice/index.ts +0 -381
- package/src/hooks/useDessertWithPrice/queries.ts +0 -18
- package/src/hooks/useDevWS/index.ts +0 -53
- package/src/hooks/useDevices/index.ts +0 -2
- package/src/hooks/useDevices/queries.ts +0 -28
- package/src/hooks/useDevices/useGetDevices.ts +0 -28
- package/src/hooks/useDevices/useRegisterDevices.ts +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 -105
- package/src/hooks/useDownloadReports/useGetReportByDateRange/index.ts +0 -116
- package/src/hooks/useDrag/index.ts +0 -79
- package/src/hooks/useDropzone/index.ts +0 -94
- package/src/hooks/useDynamicAuth/index.ts +0 -14
- package/src/hooks/useDynamicAuth/queries.ts +0 -24
- package/src/hooks/useEditCategory/index.ts +0 -41
- package/src/hooks/useEditOneExtProductFoodOptional/index.ts +0 -28
- package/src/hooks/useEditOneExtProductFoodOptional/queries.ts +0 -16
- package/src/hooks/useEditSubProductOptional/index.ts +0 -12
- package/src/hooks/useEditSubProductOptional/queries.ts +0 -10
- package/src/hooks/useEmployee/index.ts +0 -18
- package/src/hooks/useEmployee/queries.ts +0 -85
- package/src/hooks/useEmployee/useCreateEmployee.ts +0 -90
- package/src/hooks/useEvent/index.ts +0 -34
- package/src/hooks/useFavoriteStores/index.ts +0 -31
- package/src/hooks/useFavoriteStores/queries.ts +0 -54
- package/src/hooks/useFetchJson/index.ts +0 -25
- package/src/hooks/useFetchMoreInteractions/index.jsx +0 -39
- package/src/hooks/useFilterConfigs/index.ts +0 -173
- package/src/hooks/useFingerprintjs/index.ts +0 -197
- package/src/hooks/useFormTools/index.ts +0 -143
- package/src/hooks/useFormatDate/index.ts +0 -91
- package/src/hooks/useFormatNumberPhone/index.ts +0 -23
- package/src/hooks/useFullScreenMode/index.ts +0 -61
- package/src/hooks/useGenerateNumberArray/index.ts +0 -17
- package/src/hooks/useGetAllLocationUser/index.ts +0 -13
- package/src/hooks/useGetAllLocationUser/queries.ts +0 -44
- package/src/hooks/useGetAllSales/index.ts +0 -26
- package/src/hooks/useGetCookies/index.ts +0 -43
- package/src/hooks/useGetExtProductFoodsSubOptionalAll/index.ts +0 -15
- package/src/hooks/useGetFoodRecomended/index.ts +0 -33
- package/src/hooks/useGetFoodRecomended/queries.ts +0 -47
- package/src/hooks/useGetMessagesToRoom/index.ts +0 -23
- package/src/hooks/useGetMinPrice/index.ts +0 -13
- package/src/hooks/useGetMinPrice/queries.ts +0 -7
- package/src/hooks/useGetOneStoreRating/index.ts +0 -41
- package/src/hooks/useGetOneStoreRating/queries.ts +0 -18
- package/src/hooks/useGetSalesAmountToday/index.ts +0 -31
- package/src/hooks/useGetStoreCookie/index.ts +0 -21
- package/src/hooks/useGoogleLogin/index.ts +0 -169
- package/src/hooks/useGoogleLogin/loadScript.ts +0 -15
- package/src/hooks/useGoogleLogin/removeScript.ts +0 -7
- package/src/hooks/useHover/index.ts +0 -32
- package/src/hooks/useImageOptimization/index.ts +0 -32
- package/src/hooks/useImageUploaderProduct/helper/canvasUtils.ts +0 -146
- package/src/hooks/useImageUploaderProduct/helper/getOrientation.ts +0 -54
- package/src/hooks/useImageUploaderProduct/helper/index.ts +0 -5
- package/src/hooks/useImageUploaderProduct/index.ts +0 -295
- package/src/hooks/useImageWeight/index.ts +0 -55
- package/src/hooks/useImagesStore/index.ts +0 -227
- package/src/hooks/useImagesStore/queries.ts +0 -193
- package/src/hooks/useImagesStore/utils/index.ts +0 -4
- package/src/hooks/useIncomingOrders/index.ts +0 -11
- package/src/hooks/useIncomingOrders/queries.ts +0 -87
- package/src/hooks/useInnerHtml/index.ts +0 -39
- package/src/hooks/useIntersection/index.ts +0 -84
- package/src/hooks/useInventory/index.ts +0 -2
- package/src/hooks/useInventory/queries.ts +0 -58
- package/src/hooks/useInventory/useGetProductsInStock.ts +0 -16
- package/src/hooks/useInventory/useUpdateManageStock.ts +0 -41
- package/src/hooks/useKeypress/index.ts +0 -28
- package/src/hooks/useLazyScript/index.ts +0 -74
- package/src/hooks/useLocalBackendIp/index.ts +0 -34
- package/src/hooks/useLocalSorage/index.ts +0 -36
- package/src/hooks/useLocationManager/index.ts +0 -63
- package/src/hooks/useLocationNavigate/index.ts +0 -54
- package/src/hooks/useLoginEmployeeInStore/index.ts +0 -38
- package/src/hooks/useLogout/helpers/BroadcastChannel.ts +0 -74
- package/src/hooks/useLogout/helpers/apiBaseUrl.ts +0 -12
- package/src/hooks/useLogout/helpers/fetchData.ts +0 -37
- package/src/hooks/useLogout/helpers/getCsrfToken.ts +0 -37
- package/src/hooks/useLogout/helpers/index.ts +0 -65
- package/src/hooks/useLogout/helpers/logger.ts +0 -88
- package/src/hooks/useLogout/helpers/parseUrl.ts +0 -39
- package/src/hooks/useLogout/index.ts +0 -105
- package/src/hooks/useManageNewOrder/helpers/index.ts +0 -45
- package/src/hooks/useManageNewOrder/helpers/mock.ts +0 -0
- package/src/hooks/useManageNewOrder/index.ts +0 -104
- package/src/hooks/useManageQueryParams/index.ts +0 -120
- package/src/hooks/useMobile/index.ts +0 -65
- package/src/hooks/useModules/helpers/index.ts +0 -1
- package/src/hooks/useModules/helpers/validateModules.ts +0 -43
- package/src/hooks/useModules/index.ts +0 -124
- package/src/hooks/useMouse/index.ts +0 -55
- package/src/hooks/useMutateHeight/index.ts +0 -36
- package/src/hooks/useOrderClient/index.ts +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 -99
- package/src/hooks/useOrders/index.ts +0 -3
- package/src/hooks/useOrders/queries.ts +0 -99
- package/src/hooks/useOrders/useChangeOrderState/index.ts +0 -128
- package/src/hooks/useOrders/useOrdersFromStore/index.ts +0 -77
- package/src/hooks/usePWAInstall/index.ts +0 -38
- package/src/hooks/usePaymentMethod/index.ts +0 -3
- package/src/hooks/usePaymentMethod/paymentMethod.gql.ts +0 -62
- package/src/hooks/usePaymentMethod/paymentMethod.types.ts +0 -28
- package/src/hooks/usePaymentMethod/useCreatePaymentMethod/index.ts +0 -25
- package/src/hooks/usePaymentMethod/useGetAllPaymentMethods/index.ts +0 -19
- package/src/hooks/usePaymentMethod/useGetPaymentMethod/index.ts +0 -26
- package/src/hooks/usePortFetcher/index.ts +0 -33
- package/src/hooks/usePrintSaleTicket/index.ts +0 -68
- package/src/hooks/useProductsFood/index.ts +0 -341
- package/src/hooks/useProductsFood/queriesStore.ts +0 -964
- package/src/hooks/useProductsFood/types/index.ts +0 -0
- package/src/hooks/useProductsFood/useEditProduct.ts +0 -49
- package/src/hooks/useProductsFood/usetagsProducts.ts +0 -101
- package/src/hooks/useProviders/index.ts +0 -3
- package/src/hooks/useProviders/queries.ts +0 -31
- package/src/hooks/useProviders/useProvidersCreateStore/index.ts +0 -13
- package/src/hooks/useProviders/useProvidersDataStore/index.ts +0 -25
- package/src/hooks/useProvidersStore/index.ts +0 -25
- package/src/hooks/useProvidersStore/queries.ts +0 -31
- package/src/hooks/usePushNotificationOrder/index.ts +0 -52
- package/src/hooks/usePushNotifications/helpers/index.ts +0 -123
- package/src/hooks/usePushNotifications/index.ts +0 -150
- package/src/hooks/useQueryLocationsMap/index.ts +0 -20
- package/src/hooks/useQueryLocationsMap/queries.ts +0 -40
- package/src/hooks/useRatingArrayData/index.ts +0 -54
- package/src/hooks/useRatingArrayData/queries.ts +0 -19
- package/src/hooks/useReactToPrint/index.ts +0 -4
- package/src/hooks/useReactToPrint/index.txt +0 -1223
- package/src/hooks/useRemoveExtraProductFoodsOptional/index.ts +0 -24
- package/src/hooks/useRemoveExtraProductFoodsOptional/queries.ts +0 -48
- package/src/hooks/useReport/index.ts +0 -48
- package/src/hooks/useReport/queries.ts +0 -72
- package/src/hooks/useRestaurant/helpers/index.ts +0 -28
- package/src/hooks/useRestaurant/helpers/manageStatusOpen.ts +0 -26
- package/src/hooks/useRestaurant/index.ts +0 -71
- package/src/hooks/useRestaurant/queries.ts +0 -81
- package/src/hooks/useRoads/index.ts +0 -20
- package/src/hooks/useRoads/queries.ts +0 -13
- package/src/hooks/useRoles/index.ts +0 -4
- package/src/hooks/useRoles/queries.ts +0 -70
- package/src/hooks/useRoles/useCreateRole.ts +0 -40
- package/src/hooks/useRoles/useGetRoles.ts +0 -37
- package/src/hooks/useRoles/useRemoveRoles.ts +0 -40
- package/src/hooks/useRoles/useUpdateRolesPriority.ts +0 -44
- package/src/hooks/useSales/helpers/add-product.utils.ts +0 -120
- package/src/hooks/useSales/helpers/apply-discount-to-cart.utils.ts +0 -292
- package/src/hooks/useSales/helpers/comment-product.utils.ts +0 -41
- package/src/hooks/useSales/helpers/constants/index.ts +0 -38
- package/src/hooks/useSales/helpers/extras.utils.ts +0 -42
- package/src/hooks/useSales/helpers/filterProductsByCarProId.utils.ts +0 -17
- package/src/hooks/useSales/helpers/increment-product-quantity.utils.ts +0 -76
- package/src/hooks/useSales/helpers/index.ts +0 -3
- package/src/hooks/useSales/helpers/initializer.utils.ts +0 -22
- package/src/hooks/useSales/helpers/isStockInsufficient.ts +0 -3
- package/src/hooks/useSales/helpers/remove-product.utils.test.ts +0 -49
- package/src/hooks/useSales/helpers/remove-product.utils.ts +0 -34
- package/src/hooks/useSales/helpers/resolveProduct.ts +0 -29
- package/src/hooks/useSales/helpers/useAddToCart.ts +0 -64
- package/src/hooks/useSales/index.ts +0 -1418
- package/src/hooks/useSales/queries.ts +0 -532
- package/src/hooks/useSales/types/index.ts +0 -206
- package/src/hooks/useSales/types/use-sales.types.ts +0 -8
- package/src/hooks/useSales/useGetSale.ts +0 -21
- package/src/hooks/useSales/useTotalSales.ts +0 -24
- package/src/hooks/useSaveAvailableProduct/helpers/index.ts +0 -38
- package/src/hooks/useSaveAvailableProduct/index.ts +0 -32
- package/src/hooks/useSaveAvailableProduct/queries.ts +0 -10
- package/src/hooks/useSaveLocation/index.ts +0 -17
- package/src/hooks/useSaveLocation/queries.ts +0 -19
- package/src/hooks/useSchedule/index.ts +0 -35
- package/src/hooks/useSchedule/queries.ts +0 -43
- package/src/hooks/useSchedule/schedule.ts +0 -79
- package/src/hooks/useScheduleData/index.ts +0 -135
- package/src/hooks/useScroll/index.ts +0 -56
- package/src/hooks/useScrollRotate/index.ts +0 -16
- package/src/hooks/useSetImageProducts/index.ts +0 -59
- package/src/hooks/useSetImageProducts/queries.ts +0 -18
- package/src/hooks/useSetSession/index.ts +0 -44
- package/src/hooks/useSetState/index.ts +0 -24
- package/src/hooks/useSetupSchedule/helpers/index.ts +0 -85
- package/src/hooks/useSetupSchedule/index.ts +0 -284
- package/src/hooks/useStatusOpenStore/helpers/index.ts +0 -124
- package/src/hooks/useStatusOpenStore/index.ts +0 -195
- package/src/hooks/useStatusOrdersClient/helpers/index.ts +0 -14
- package/src/hooks/useStatusOrdersClient/index.ts +0 -18
- package/src/hooks/useStatusOrdersClient/queries.ts +0 -80
- package/src/hooks/useStock/index.ts +0 -1
- package/src/hooks/useStock/useStockUpdatedAllSubscription.ts +0 -40
- package/src/hooks/useStockMovements/helpers/index.ts +0 -16
- package/src/hooks/useStockMovements/index.ts +0 -39
- package/src/hooks/useStore/index.ts +0 -83
- package/src/hooks/useStore/queries.ts +0 -163
- package/src/hooks/useStoreCalendar/index.ts +0 -5
- package/src/hooks/useStoreContacts/index.ts +0 -53
- package/src/hooks/useStoreContacts/queries.ts +0 -48
- package/src/hooks/useStoreTable/index.ts +0 -2
- package/src/hooks/useStoreTable/queries.ts +0 -47
- package/src/hooks/useStoreTable/useStoreTableCreate.ts +0 -77
- package/src/hooks/useStoreTable/useStoreTables.ts +0 -15
- package/src/hooks/useSubscriptionValidation/index.ts +0 -112
- 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 -157
- package/src/hooks/useTheme/index.ts +0 -65
- package/src/hooks/useTimeAgo/useTimeAgo.ts +0 -39
- package/src/hooks/useTokenCards/index.ts +0 -45
- package/src/hooks/useTopProductsMovements/index.ts +0 -27
- package/src/hooks/useTotalAllSales/index.ts +0 -25
- package/src/hooks/useTotalProductsInStock/index.ts +0 -23
- package/src/hooks/useTotalProductsSold/index.ts +0 -23
- package/src/hooks/useTotalProductsSolded/index.ts +0 -20
- package/src/hooks/useUpdateCart/index.ts +0 -131
- package/src/hooks/useUpdateCartCookie/index.ts +0 -60
- package/src/hooks/useUpdateDashboardComponent/index.ts +0 -91
- package/src/hooks/useUpdateExistingOrders/index.ts +0 -85
- package/src/hooks/useUpdateExtProductFoodsSubOptional/index.ts +0 -61
- package/src/hooks/useUpdateModuleOrder/index.ts +0 -37
- package/src/hooks/useUpdateMultipleExtProduct/index.ts +0 -34
- package/src/hooks/useUpdateMultipleExtProduct/queries.ts +0 -33
- package/src/hooks/useUpdateMultipleProducts/index.ts +0 -117
- package/src/hooks/useUpdateMultipleProducts/queries.ts +0 -51
- package/src/hooks/useUploadProducts/helpers/index.ts +0 -1
- package/src/hooks/useUploadProducts/helpers/parseNumber.ts +0 -37
- package/src/hooks/useUploadProducts/helpers/validateProductDataExcel.ts +0 -73
- package/src/hooks/useUploadProducts/index.ts +0 -442
- package/src/hooks/useUpsertGoal/index.ts +0 -68
- package/src/hooks/useUser/index.ts +0 -24
- package/src/hooks/useUser/queries.ts +0 -131
- package/src/hooks/useWeeklyStockMovement/helpers/index.ts +0 -32
- package/src/hooks/useWeeklyStockMovement/index.ts +0 -52
- package/src/hooks/useWindowSize/index.ts +0 -45
- package/src/index.ts +0 -11
- package/src/mock/dessert/index.ts +0 -16
- package/src/mock/index.ts +0 -1
- package/src/security/index.ts +0 -1
- package/src/services/index.ts +0 -1
- package/src/utils/UtilDateRange.ts +0 -56
- package/src/utils/generateCode.ts +0 -222
- package/src/utils/index.ts +0 -2
- package/src/utils/utils.ts +0 -344
- package/tsconfig.eslint.json +0 -16
- package/tsconfig.json +0 -21
- package/tsup.config.ts +0 -24
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
useCallback,
|
|
3
|
-
useEffect,
|
|
4
|
-
useState
|
|
5
|
-
} from 'react'
|
|
6
|
-
|
|
7
|
-
import { validationSubmitHooks } from '../../utils'
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
interface UseFormToolsProps {
|
|
11
|
-
initialValues?: Record<string, any>;
|
|
12
|
-
sendNotification?: ({
|
|
13
|
-
title,
|
|
14
|
-
description,
|
|
15
|
-
backgroundColor
|
|
16
|
-
}: {
|
|
17
|
-
title?: string;
|
|
18
|
-
description?: string;
|
|
19
|
-
backgroundColor?: string;
|
|
20
|
-
}) => void;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* @param root0
|
|
25
|
-
* @param root0.initialValues
|
|
26
|
-
* @param root0.sendNotification
|
|
27
|
-
* @version 0.0.1
|
|
28
|
-
* @description Hook con herramientas de validación y eventos de cambio
|
|
29
|
-
* @return {Array} devuelve la función onChange a ejecutar y el estado de error de cada input
|
|
30
|
-
*/
|
|
31
|
-
export const useFormTools = ({
|
|
32
|
-
initialValues = {},
|
|
33
|
-
sendNotification = ({
|
|
34
|
-
title = '',
|
|
35
|
-
description = '',
|
|
36
|
-
backgroundColor = ''
|
|
37
|
-
}) => {
|
|
38
|
-
console.log({ title, description, backgroundColor })
|
|
39
|
-
}
|
|
40
|
-
}: UseFormToolsProps = {}) => {
|
|
41
|
-
const [dataForm, setDataForm] = useState<Record<string, any>>({ ...initialValues })
|
|
42
|
-
const [errorForm, setErrorForm] = useState<Record<string, boolean>>({})
|
|
43
|
-
const [errorSubmit, setErrorSubmit] = useState(false)
|
|
44
|
-
const [calledSubmit, setCalledSubmit] = useState(false)
|
|
45
|
-
// Handle Change
|
|
46
|
-
const handleChange = useCallback((e: React.ChangeEvent<HTMLInputElement>, error: boolean) => {
|
|
47
|
-
setDataForm({ ...dataForm, [e.target.name]: e.target.value })
|
|
48
|
-
setErrorForm({ ...errorForm, [e.target.name]: error })
|
|
49
|
-
}, [setDataForm, dataForm, errorForm, setErrorForm])
|
|
50
|
-
|
|
51
|
-
// Forzar datos desde una ventana externa
|
|
52
|
-
const handleForcedData = useCallback((data: Record<string, any>) => {
|
|
53
|
-
setDataForm(data)
|
|
54
|
-
}, [setDataForm])
|
|
55
|
-
|
|
56
|
-
// Forzar datos de error desde una ventana externa
|
|
57
|
-
const setForcedError = useCallback((errors: Record<string, boolean>) => {
|
|
58
|
-
setErrorForm(errors)
|
|
59
|
-
}, [setErrorForm])
|
|
60
|
-
|
|
61
|
-
// Handle submit, al enviar formulario
|
|
62
|
-
const listErrors = Object.values(errorForm)
|
|
63
|
-
const errors = listErrors.find((error) => {
|
|
64
|
-
return error === true
|
|
65
|
-
})
|
|
66
|
-
|
|
67
|
-
const handleSubmit = ({
|
|
68
|
-
event,
|
|
69
|
-
msgError = '',
|
|
70
|
-
msgSuccess,
|
|
71
|
-
action = () => { return Promise.resolve() },
|
|
72
|
-
actionAfterSuccess = () => { }
|
|
73
|
-
}: {
|
|
74
|
-
event: React.FormEvent<HTMLFormElement>,
|
|
75
|
-
msgError?: string,
|
|
76
|
-
msgSuccess?: string,
|
|
77
|
-
action?: () => Promise<any>,
|
|
78
|
-
actionAfterSuccess?: () => void
|
|
79
|
-
}) => {
|
|
80
|
-
event.preventDefault()
|
|
81
|
-
setCalledSubmit(true)
|
|
82
|
-
let errSub = false
|
|
83
|
-
|
|
84
|
-
// Valida los errores locales
|
|
85
|
-
for (const x in errorForm) {
|
|
86
|
-
if (errorForm[x]) errSub = true
|
|
87
|
-
}
|
|
88
|
-
if (errSub) {
|
|
89
|
-
sendNotification({
|
|
90
|
-
description: 'Completa los campos requeridos',
|
|
91
|
-
title: 'Error',
|
|
92
|
-
backgroundColor: 'error'
|
|
93
|
-
})
|
|
94
|
-
}
|
|
95
|
-
if (errors) {
|
|
96
|
-
setErrorSubmit(true)
|
|
97
|
-
return setForcedError({ ...errorForm })
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
if (errSub) return setErrorSubmit(errSub)
|
|
101
|
-
|
|
102
|
-
// Valida los errores desde el evento
|
|
103
|
-
const errores = validationSubmitHooks(event.currentTarget.elements)
|
|
104
|
-
setErrorForm(errores)
|
|
105
|
-
for (const x in errores) {
|
|
106
|
-
// @ts-ignore
|
|
107
|
-
if (errores[x]) errSub = true
|
|
108
|
-
}
|
|
109
|
-
if (errSub) return setErrorSubmit(errSub)
|
|
110
|
-
|
|
111
|
-
// Ejecuta la accion si es válido
|
|
112
|
-
if (!errSub && typeof action === 'function') {
|
|
113
|
-
const result = action()
|
|
114
|
-
if (result && typeof result.then === 'function') {
|
|
115
|
-
result.then((res) => {
|
|
116
|
-
if (res) {
|
|
117
|
-
sendNotification({
|
|
118
|
-
title: msgSuccess ?? 'Operación exitosa',
|
|
119
|
-
description: 'Operación exitosa',
|
|
120
|
-
backgroundColor: 'success'
|
|
121
|
-
})
|
|
122
|
-
if (actionAfterSuccess) actionAfterSuccess()
|
|
123
|
-
}
|
|
124
|
-
}).catch((e) => {
|
|
125
|
-
sendNotification({
|
|
126
|
-
title: msgError || e?.message || 'Ha ocurrido un error',
|
|
127
|
-
backgroundColor: 'error'
|
|
128
|
-
})
|
|
129
|
-
})
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
setErrorSubmit(errSub)
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
useEffect(() => { return setCalledSubmit(false) }, [calledSubmit])
|
|
137
|
-
useEffect(() => {
|
|
138
|
-
return setCalledSubmit(false)
|
|
139
|
-
},
|
|
140
|
-
[])
|
|
141
|
-
|
|
142
|
-
return [handleChange, handleSubmit, handleForcedData, { dataForm, errorForm, errorSubmit, calledSubmit, setForcedError }]
|
|
143
|
-
}
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
interface UseFormatDateProps {
|
|
2
|
-
date?: string | number | Date;
|
|
3
|
-
local?: string;
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
export const useFormatDate = ({
|
|
7
|
-
date,
|
|
8
|
-
local = 'ES-CO'
|
|
9
|
-
}: UseFormatDateProps = {}) => {
|
|
10
|
-
const dateToFormat = new Date(date ?? Date.now())
|
|
11
|
-
const fullDate = dateToFormat.toLocaleDateString(local, { year: 'numeric', month: '2-digit', day: '2-digit' })
|
|
12
|
-
const day = fullDate.split('/')[0]
|
|
13
|
-
const month = fullDate.split('/')[1]
|
|
14
|
-
const year = fullDate.split('/')[2]
|
|
15
|
-
const yearMonthDay = dateToFormat.toLocaleDateString('ES-CO')
|
|
16
|
-
const numberDay = dateToFormat.getDay()
|
|
17
|
-
const shortDayName = dateToFormat.toLocaleDateString(local, { weekday: 'short' })
|
|
18
|
-
const longDayName = dateToFormat.toLocaleDateString(local, { weekday: 'long' })
|
|
19
|
-
const hourMinutes12 = dateToFormat.toLocaleTimeString('ES-CO', { hour: '2-digit', minute: '2-digit' })
|
|
20
|
-
const hourMinutes24 = dateToFormat.toLocaleTimeString('ES-CO', { hour: '2-digit', minute: '2-digit', hour12: false })
|
|
21
|
-
const handleHourPmAM = (hour: string) => {
|
|
22
|
-
const hourPmAm = new Date(`1/1/1999 ${hour}`).toLocaleString('en-US', { hour: 'numeric', minute: 'numeric', hour12: true })
|
|
23
|
-
return hour ? hourPmAm : ''
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Formats a date into Colombian time zone and Spanish locale for POS display.
|
|
27
|
-
* Example output: "15 de mayo de 2025 a las 14:23"
|
|
28
|
-
*
|
|
29
|
-
* @param {string | number | Date} dateInput - Date to format (ISO string, timestamp or Date object)
|
|
30
|
-
* @returns {string} - Formatted date string in Colombian time
|
|
31
|
-
*/
|
|
32
|
-
function formatDateInTimeZone (dateInput : string | number | Date): string {
|
|
33
|
-
const timeZone = 'America/Bogota'
|
|
34
|
-
const locale = 'es-CO'
|
|
35
|
-
const options: Intl.DateTimeFormatOptions = {
|
|
36
|
-
timeZone,
|
|
37
|
-
year: 'numeric',
|
|
38
|
-
month: 'long',
|
|
39
|
-
day: '2-digit',
|
|
40
|
-
hour: '2-digit',
|
|
41
|
-
minute: '2-digit',
|
|
42
|
-
hour12: false
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
const date = new Date(dateInput)
|
|
46
|
-
const formatted = new Intl.DateTimeFormat(locale, options).format(date)
|
|
47
|
-
|
|
48
|
-
// Cambiar coma por "a las" para mejor legibilidad
|
|
49
|
-
return formatted.replace(',', ' a las')
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* Formats a date into YYYY-MM-DD using a given IANA timezone.
|
|
53
|
-
*
|
|
54
|
-
* @param {string | number | Date} inputDate - The date to format.
|
|
55
|
-
* @param {string} timeZone - IANA timezone string (default is "America/Bogota").
|
|
56
|
-
* @returns {string} Formatted date string in YYYY-MM-DD.
|
|
57
|
-
* @throws {Error} If the input date is invalid.
|
|
58
|
-
*/
|
|
59
|
-
const formatToLocalDateYMD = (inputDate: string | number | Date, timeZone = 'America/Bogota') => {
|
|
60
|
-
const date = new Date(inputDate)
|
|
61
|
-
|
|
62
|
-
if (isNaN(date.getTime())) {
|
|
63
|
-
throw new Error('Invalid date input provided to formatToLocalDateYMD')
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
const localDateStr = date.toLocaleString('en-US', { timeZone })
|
|
67
|
-
const localDate = new Date(localDateStr)
|
|
68
|
-
|
|
69
|
-
const year = localDate.getFullYear()
|
|
70
|
-
const month = String(localDate.getMonth() + 1).padStart(2, '0')
|
|
71
|
-
const day = String(localDate.getDate()).padStart(2, '0')
|
|
72
|
-
|
|
73
|
-
return `${year}-${month}-${day}`
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
return {
|
|
77
|
-
day,
|
|
78
|
-
fullDate,
|
|
79
|
-
formatToLocalDateYMD,
|
|
80
|
-
hourMinutes12,
|
|
81
|
-
numberDay,
|
|
82
|
-
yearMonthDay,
|
|
83
|
-
hourMinutes24,
|
|
84
|
-
longDayName,
|
|
85
|
-
shortDayName,
|
|
86
|
-
month,
|
|
87
|
-
year,
|
|
88
|
-
handleHourPmAM,
|
|
89
|
-
formatDateInTimeZone
|
|
90
|
-
}
|
|
91
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Description
|
|
3
|
-
* @param {any} phoneNumber type number or string
|
|
4
|
-
* @returns {any}
|
|
5
|
-
*/
|
|
6
|
-
export const formatPhoneNumber = (phoneNumber) => {
|
|
7
|
-
const cleaned = ('' + phoneNumber).replace(/\D/g, '')
|
|
8
|
-
const match = cleaned.match(/^(\d{3})(\d{3})(\d{4})$/)
|
|
9
|
-
if (match) {
|
|
10
|
-
return `(${match[1]}) ${match[2]}-${match[3]}`
|
|
11
|
-
}
|
|
12
|
-
return phoneNumber
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Description
|
|
17
|
-
* @param {any} phoneNumber type number or string
|
|
18
|
-
* @returns {any}
|
|
19
|
-
*/
|
|
20
|
-
export const validatePhoneNumber = (phoneNumber) => {
|
|
21
|
-
const regex = /^\(\d{3}\) \d{3}-\d{4}$/
|
|
22
|
-
return regex.test(phoneNumber)
|
|
23
|
-
}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import React, { useState, useRef, useEffect } from 'react'
|
|
2
|
-
|
|
3
|
-
export const useFullscreenMode = () => {
|
|
4
|
-
const [isFullscreen, setFullscreen] = useState(false)
|
|
5
|
-
const elementRef = useRef()
|
|
6
|
-
|
|
7
|
-
useEffect(() => {
|
|
8
|
-
const changeHandler = () => { return setFullscreen(mode => { return !mode }) }
|
|
9
|
-
|
|
10
|
-
document.addEventListener('fullscreenchange', changeHandler, false)
|
|
11
|
-
document.addEventListener('mozfullscreenchange', changeHandler, false)
|
|
12
|
-
document.addEventListener('MSFullScreenChange', changeHandler, false)
|
|
13
|
-
document.addEventListener(
|
|
14
|
-
'webkitfullscreenchange',
|
|
15
|
-
changeHandler,
|
|
16
|
-
false
|
|
17
|
-
)
|
|
18
|
-
|
|
19
|
-
return () => {
|
|
20
|
-
document.removeEventListener('fullscreenchange', changeHandler)
|
|
21
|
-
document.removeEventListener('mozfullscreenchange', changeHandler)
|
|
22
|
-
document.removeEventListener('MSFullScreenChange', changeHandler)
|
|
23
|
-
document.removeEventListener(
|
|
24
|
-
'webkitfullscreenchange',
|
|
25
|
-
changeHandler
|
|
26
|
-
)
|
|
27
|
-
}
|
|
28
|
-
}, [])
|
|
29
|
-
|
|
30
|
-
const goFullscreen = () => {
|
|
31
|
-
if (elementRef.current.requestFullscreen) {
|
|
32
|
-
elementRef.current.requestFullscreen()
|
|
33
|
-
} else if (elementRef.current.mozRequestFullscreen) {
|
|
34
|
-
// Firefox
|
|
35
|
-
elementRef.current.mozRequestFullscreen()
|
|
36
|
-
} else if (elementRef.current.webkitRequestFullscreen) {
|
|
37
|
-
// Chrome, safari, opera
|
|
38
|
-
elementRef.current.webkitRequestFullscreen()
|
|
39
|
-
} else if (elementRef.current.msRequestFullscreen) {
|
|
40
|
-
// IE, edge
|
|
41
|
-
elementRef.current.msRequestFullscreen()
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
const exitFullScreen = () => {
|
|
46
|
-
if (document.exitFullscreen) {
|
|
47
|
-
document.exitFullscreen()
|
|
48
|
-
} else if (document.mozCancelFullScreen) {
|
|
49
|
-
document.mozCancelFullScreen()
|
|
50
|
-
} else if (document.webkitExitFullscreen) {
|
|
51
|
-
document.webkitExitFullscreen()
|
|
52
|
-
} else if (document.msExitFullscreen) {
|
|
53
|
-
document.msExitFullscreen()
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
const ToggleIcon = (
|
|
58
|
-
<button onDoubleClick={() => { return (!isFullscreen ? goFullscreen() : exitFullScreen()) }}>{!isFullscreen ? 'FullScreen' : 'Normal'}</button>
|
|
59
|
-
)
|
|
60
|
-
return [elementRef, ToggleIcon] // Icon, ref
|
|
61
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
const addButtonValues = (values, max) => {
|
|
2
|
-
const value1 = values.splice(Math.floor(Math.random() * (max - 0)) + 0, 1)
|
|
3
|
-
return { max: max - 2, values: [value1] }
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
export const useGenerateNumberArray = () => {
|
|
7
|
-
const values = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
|
|
8
|
-
let max = 9
|
|
9
|
-
const buttons = Array.from(Array(10)).map(() => {
|
|
10
|
-
return Array.from(Array(1)).map(() => {
|
|
11
|
-
const buttonValues = addButtonValues(values, max)
|
|
12
|
-
max = buttonValues.max
|
|
13
|
-
return buttonValues.values
|
|
14
|
-
})
|
|
15
|
-
})
|
|
16
|
-
return buttons
|
|
17
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { useQuery } from '@apollo/client'
|
|
2
|
-
|
|
3
|
-
import { GET_ALL_LOCATIONS } from './queries'
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* useGetAllLocationUser
|
|
7
|
-
* @returns {any}
|
|
8
|
-
*/
|
|
9
|
-
export const useGetAllLocationUser = () => {
|
|
10
|
-
const { data, loading } = useQuery(GET_ALL_LOCATIONS)
|
|
11
|
-
|
|
12
|
-
return [data, { loading }]
|
|
13
|
-
}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { gql } from '@apollo/client'
|
|
2
|
-
|
|
3
|
-
export const GET_ALL_LOCATIONS = gql`
|
|
4
|
-
|
|
5
|
-
query getUserLocations {
|
|
6
|
-
getUserLocations {
|
|
7
|
-
locationId
|
|
8
|
-
# id
|
|
9
|
-
cId
|
|
10
|
-
dId
|
|
11
|
-
ctId
|
|
12
|
-
uLatitud
|
|
13
|
-
uLongitude
|
|
14
|
-
uLocationKnow
|
|
15
|
-
uPiso
|
|
16
|
-
DatCre
|
|
17
|
-
DatMod
|
|
18
|
-
pais {
|
|
19
|
-
cId
|
|
20
|
-
cName
|
|
21
|
-
cCalCod
|
|
22
|
-
cState
|
|
23
|
-
cDatCre
|
|
24
|
-
cDatMod
|
|
25
|
-
}
|
|
26
|
-
city {
|
|
27
|
-
ctId
|
|
28
|
-
dId
|
|
29
|
-
cName
|
|
30
|
-
cState
|
|
31
|
-
cDatCre
|
|
32
|
-
cDatMod
|
|
33
|
-
}
|
|
34
|
-
department {
|
|
35
|
-
dId
|
|
36
|
-
cId
|
|
37
|
-
dName
|
|
38
|
-
dState
|
|
39
|
-
dDatCre
|
|
40
|
-
dDatMod
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
`
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { useQuery } from '@apollo/client'
|
|
2
|
-
|
|
3
|
-
import { GET_ALL_SALES_STATISTICS } from '../useSales/queries'
|
|
4
|
-
|
|
5
|
-
export const useGetAllSales = ({
|
|
6
|
-
fromDate = '',
|
|
7
|
-
toDate = ''
|
|
8
|
-
} = {}) => {
|
|
9
|
-
const {
|
|
10
|
-
data,
|
|
11
|
-
loading,
|
|
12
|
-
error
|
|
13
|
-
} = useQuery(GET_ALL_SALES_STATISTICS, {
|
|
14
|
-
fetchPolicy: 'cache-first',
|
|
15
|
-
variables: {
|
|
16
|
-
fromDate,
|
|
17
|
-
toDate
|
|
18
|
-
}
|
|
19
|
-
})
|
|
20
|
-
|
|
21
|
-
return {
|
|
22
|
-
data: data?.getAllSalesStoreStatistic || [],
|
|
23
|
-
error,
|
|
24
|
-
loading
|
|
25
|
-
}
|
|
26
|
-
}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import Cookies from 'js-cookie'
|
|
2
|
-
|
|
3
|
-
export const useGetCookies = () => {
|
|
4
|
-
const getCookies = (cookieNames) => {
|
|
5
|
-
try {
|
|
6
|
-
if (!Array.isArray(cookieNames)) {
|
|
7
|
-
throw new Error('Input cookie names should be an array.')
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
const cookiesData = []
|
|
11
|
-
|
|
12
|
-
for (const cookieName of cookieNames) {
|
|
13
|
-
const cookieValue = Cookies.get(cookieName)
|
|
14
|
-
if (cookieValue) {
|
|
15
|
-
cookiesData.push({ name: cookieName, value: cookieValue })
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
return cookiesData
|
|
19
|
-
} catch (error) {
|
|
20
|
-
console.error('Error al traer las cookies:', error)
|
|
21
|
-
return []
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
const getCookie = (cookieName) => {
|
|
26
|
-
try {
|
|
27
|
-
if (typeof cookieName !== 'string') {
|
|
28
|
-
throw new Error('Input cookie name should be a string.')
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
const cookieValue = Cookies.get(cookieName)
|
|
32
|
-
if (cookieValue) {
|
|
33
|
-
return { name: cookieName, value: cookieValue }
|
|
34
|
-
}
|
|
35
|
-
return null
|
|
36
|
-
} catch (error) {
|
|
37
|
-
console.error('Error al traer la cookie:', error)
|
|
38
|
-
return null
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
return { getCookies, getCookie }
|
|
43
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { useLazyQuery } from '@apollo/client'
|
|
2
|
-
|
|
3
|
-
import { GET_EXTRAS_PRODUCT_FOOD_OPTIONAL } from '../useProductsFood/queriesStore'
|
|
4
|
-
|
|
5
|
-
export const useGetExtProductFoodsSubOptionalAll = ({ setDataOptional = () => { } } = {}) => {
|
|
6
|
-
const [ExtProductFoodsSubOptionalAll] = useLazyQuery(
|
|
7
|
-
GET_EXTRAS_PRODUCT_FOOD_OPTIONAL,
|
|
8
|
-
{
|
|
9
|
-
onError: () => {
|
|
10
|
-
setDataOptional([])
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
)
|
|
14
|
-
return [ExtProductFoodsSubOptionalAll]
|
|
15
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { useQuery } from '@apollo/client'
|
|
2
|
-
|
|
3
|
-
import { GET_ALL_PRODUCT_STORE_RECOMENDED } from './queries'
|
|
4
|
-
|
|
5
|
-
export const useGetFoodRecomended = ({
|
|
6
|
-
name = ''
|
|
7
|
-
}) => {
|
|
8
|
-
const {
|
|
9
|
-
data,
|
|
10
|
-
called,
|
|
11
|
-
fetchMore,
|
|
12
|
-
loading,
|
|
13
|
-
error
|
|
14
|
-
} = useQuery(GET_ALL_PRODUCT_STORE_RECOMENDED, {
|
|
15
|
-
fetchPolicy: 'cache-and-network',
|
|
16
|
-
skip: !name,
|
|
17
|
-
notifyOnNetworkStatusChange: true,
|
|
18
|
-
nextFetchPolicy: 'cache-first',
|
|
19
|
-
refetchWritePolicy: 'merge',
|
|
20
|
-
variables:
|
|
21
|
-
{
|
|
22
|
-
max: 6,
|
|
23
|
-
search: name
|
|
24
|
-
}
|
|
25
|
-
})
|
|
26
|
-
|
|
27
|
-
return [data?.productFoodsAllRecommended, {
|
|
28
|
-
called,
|
|
29
|
-
fetchMore,
|
|
30
|
-
loading,
|
|
31
|
-
error
|
|
32
|
-
}]
|
|
33
|
-
}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { gql } from '@apollo/client'
|
|
2
|
-
|
|
3
|
-
export const GET_ALL_PRODUCT_STORE_RECOMENDED = gql`
|
|
4
|
-
query productFoodsAllRecommended($search: String, $min: Int, $max: Int, $gender: [String], $desc: [String], $categories: [ID], ) {
|
|
5
|
-
productFoodsAllRecommended(search: $search, min: $min, max: $max, gender: $gender, desc: $desc, categories: $categories,) {
|
|
6
|
-
pId
|
|
7
|
-
sizeId #Talla
|
|
8
|
-
colorId #Color
|
|
9
|
-
cId #Country
|
|
10
|
-
dId #Department
|
|
11
|
-
ctId #Cuidad
|
|
12
|
-
fId #Características
|
|
13
|
-
pName
|
|
14
|
-
ProPrice
|
|
15
|
-
ProDescuento
|
|
16
|
-
ProUniDisponibles
|
|
17
|
-
ProDescription
|
|
18
|
-
ProProtegido
|
|
19
|
-
ProAssurance
|
|
20
|
-
ProStar
|
|
21
|
-
sTateLogistic
|
|
22
|
-
ProImage
|
|
23
|
-
ProWidth
|
|
24
|
-
ProHeight
|
|
25
|
-
ProLength
|
|
26
|
-
ProWeight
|
|
27
|
-
ProQuantity
|
|
28
|
-
ProOutstanding
|
|
29
|
-
pDatCre
|
|
30
|
-
pDatMod
|
|
31
|
-
ProDelivery
|
|
32
|
-
ProVoltaje
|
|
33
|
-
pState
|
|
34
|
-
feat {
|
|
35
|
-
fId
|
|
36
|
-
thpId
|
|
37
|
-
hpqrQuestion
|
|
38
|
-
}
|
|
39
|
-
area {
|
|
40
|
-
aId
|
|
41
|
-
aName
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
`
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { useQuery, gql } from '@apollo/client'
|
|
2
|
-
|
|
3
|
-
// Define la consulta GraphQL
|
|
4
|
-
const GET_MESSAGES = gql`
|
|
5
|
-
query getMessages($codeRoom: String!, $id: String!) {
|
|
6
|
-
getMessages(codeRoom: $codeRoom, id: $id) {
|
|
7
|
-
uuid
|
|
8
|
-
content
|
|
9
|
-
from
|
|
10
|
-
to
|
|
11
|
-
aDatCre
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
`
|
|
15
|
-
|
|
16
|
-
export const useGetMessagesToRoom = (codeRoom, id) => {
|
|
17
|
-
const { loading, error, data } = useQuery(GET_MESSAGES, {
|
|
18
|
-
context: { clientName: 'web-socket-chat' },
|
|
19
|
-
variables: { codeRoom, id }
|
|
20
|
-
})
|
|
21
|
-
|
|
22
|
-
return [data?.getMessages ?? [], { loading, error }]
|
|
23
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { useQuery } from '@apollo/client'
|
|
2
|
-
|
|
3
|
-
import { GET_MIN_PEDIDO } from './queries'
|
|
4
|
-
|
|
5
|
-
export const useGetMinPrice = ({ idStore = '' } = {}) => {
|
|
6
|
-
const { data, loading, error } = useQuery(GET_MIN_PEDIDO, {
|
|
7
|
-
variables: {
|
|
8
|
-
idStore
|
|
9
|
-
}
|
|
10
|
-
})
|
|
11
|
-
|
|
12
|
-
return [data, { loading, error }]
|
|
13
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { useLazyQuery } from '@apollo/client'
|
|
2
|
-
import { useState } from 'react'
|
|
3
|
-
|
|
4
|
-
import { GET_ONE_RATING_STORE } from './queries'
|
|
5
|
-
|
|
6
|
-
export const useGetOneStoreRating = () => {
|
|
7
|
-
const [ratings, setRatings] = useState({
|
|
8
|
-
rGoodTemperature: 0,
|
|
9
|
-
rGoodCondition: 0,
|
|
10
|
-
rTasty: 0,
|
|
11
|
-
appearance: 0
|
|
12
|
-
})
|
|
13
|
-
|
|
14
|
-
const [getOneRating] = useLazyQuery(GET_ONE_RATING_STORE, {
|
|
15
|
-
onCompleted: res => {
|
|
16
|
-
if (res) {
|
|
17
|
-
setRatings((prevState) => {
|
|
18
|
-
const {
|
|
19
|
-
rGoodTemperature,
|
|
20
|
-
rGoodCondition,
|
|
21
|
-
rTasty,
|
|
22
|
-
rAppearance
|
|
23
|
-
} = res.getOneRating || {}
|
|
24
|
-
return {
|
|
25
|
-
...prevState,
|
|
26
|
-
rGoodTemperature: rGoodTemperature || 0,
|
|
27
|
-
rGoodCondition: rGoodCondition || 0,
|
|
28
|
-
rTasty: rTasty || 0,
|
|
29
|
-
appearance: rAppearance || 0
|
|
30
|
-
}
|
|
31
|
-
})
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
})
|
|
35
|
-
|
|
36
|
-
return {
|
|
37
|
-
ratings,
|
|
38
|
-
setRatings,
|
|
39
|
-
getOneRating
|
|
40
|
-
}
|
|
41
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { gql } from '@apollo/client'
|
|
2
|
-
|
|
3
|
-
export const GET_ONE_RATING_STORE = gql`
|
|
4
|
-
query getOneRating($idStore: ID){
|
|
5
|
-
getOneRating(idStore: $idStore){
|
|
6
|
-
idStore
|
|
7
|
-
rId
|
|
8
|
-
id
|
|
9
|
-
rAppearance
|
|
10
|
-
rTasty
|
|
11
|
-
rGoodTemperature
|
|
12
|
-
rGoodCondition
|
|
13
|
-
rState
|
|
14
|
-
createAt
|
|
15
|
-
updateAt
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
`
|