npm-pkg-hook 1.3.9 → 1.4.0
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/.babelrc +2 -10
- package/.env +5 -1
- package/dist/index.js +17953 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +17711 -0
- package/dist/index.mjs.map +1 -0
- package/eslint.config.mjs +154 -0
- package/expire.json +1 -0
- package/index.d.ts +2 -0
- package/jest.config.ts +9 -0
- package/package.json +45 -36
- package/src/config/client/errors.ts +39 -0
- package/src/config/content/en.json +5 -0
- package/src/config/content/es.json +5 -0
- package/src/config/content/index.ts +16 -0
- package/src/hooks/addTenMinutes/index.ts +14 -0
- package/src/hooks/calculateLogLatHaversine/index.ts +41 -0
- package/src/hooks/completeSchedules/index.ts +22 -0
- package/src/hooks/convertToMilitaryTime/index.ts +18 -0
- package/src/hooks/generateStoreURL/index.ts +41 -0
- package/src/hooks/generateTemplate/index.ts +66 -0
- package/src/hooks/getCardType/index.ts +24 -0
- package/src/hooks/getCategoriesWithProduct/{index.js → index.ts} +7 -7
- package/src/hooks/getGlobalSession/index.ts +69 -0
- package/src/hooks/getSession/index.ts +72 -0
- package/src/hooks/getTodayTimestamps/index.ts +70 -0
- package/src/hooks/getTotalHours/index.ts +76 -0
- package/src/hooks/handleLogin/index.ts +14 -0
- package/src/hooks/index.ts +154 -0
- package/src/hooks/isTokenExpired/index.ts +17 -0
- package/src/hooks/newMessageSubscription/index.ts +28 -0
- package/src/hooks/newStoreOrderSubscription/index.ts +26 -0
- package/src/hooks/{useStatusOpenStore/helpers/index.js → statusOpenStores/helpers/index.ts} +24 -1
- package/src/hooks/statusOpenStores/index.ts +221 -0
- package/src/hooks/updateExtProductFoodsOptional/{index.js → index.ts} +15 -6
- package/src/hooks/useAcumulateDate/index.ts +18 -0
- package/src/hooks/useAllStoresPendingToRegister/index.ts +37 -0
- package/src/hooks/useAmountInput/index.ts +127 -0
- package/src/hooks/useAnimationText/{index.jsx → index.ts} +2 -2
- package/src/hooks/useAsideCart/index.ts +217 -0
- package/src/hooks/useBanner/{index.js → index.ts} +2 -1
- package/src/hooks/useCart/{queries.js → queries.ts} +11 -1
- package/src/hooks/useCart/useCart/helpers/{index.js → index.ts} +10 -6
- package/src/hooks/useCart/useCart/{index.js → index.ts} +58 -44
- package/src/hooks/useCart/useGetCart/{index.js → index.ts} +6 -3
- package/src/hooks/useCatWithProduct/{index.js → index.ts} +17 -7
- package/src/hooks/useCatWithProduct/{queries.js → queries.ts} +50 -23
- package/src/hooks/useCatWithProduct/types/index.ts +104 -0
- package/src/hooks/useCatWithProductClient/{index.js → index.ts} +19 -18
- package/src/hooks/useCatWithProductClient/{queries.js → queries.ts} +1 -0
- package/src/hooks/useCategoriesProduct/{index.js → index.ts} +3 -1
- package/src/hooks/useCategoriesProduct/{queries.js → queries.ts} +2 -2
- package/src/hooks/useCategoryInStore/index.ts +167 -0
- package/src/hooks/useCategoryInStore/{queries.js → queries.ts} +2 -2
- package/src/hooks/useCategoryStore/{index.js → index.ts} +4 -3
- package/src/hooks/useCategoryStore/{queries.js → queries.ts} +2 -2
- package/src/hooks/useChartData/{index.js → index.ts} +31 -34
- package/src/hooks/useChartData/useChartData/{index.js → index.ts} +31 -30
- package/src/hooks/useChartData/useChartDataAllOrders/{index.js → index.ts} +4 -4
- package/src/hooks/useChatRoomSubscription/index.ts +28 -0
- package/src/hooks/useCheckbox/{index.js → index.ts} +1 -1
- package/src/hooks/useCities/index.ts +14 -0
- package/src/hooks/useCities/queries.ts +12 -0
- package/src/hooks/useClients/{index.js → index.ts} +36 -10
- package/src/hooks/useClients/queries.ts +215 -0
- package/src/hooks/useColorByLetters/helpers/alea.ts +73 -0
- package/src/hooks/useColorByLetters/helpers/colors.ts +45 -0
- package/src/hooks/useColorByLetters/helpers/index.ts +24 -0
- package/src/hooks/useColorByLetters/helpers/mersenne_twister.ts +118 -0
- package/src/hooks/useColorByLetters/index.ts +24 -0
- package/src/hooks/useConnection/index.ts +24 -0
- package/src/hooks/useCountries/index.ts +20 -0
- package/src/hooks/useCountries/queries.ts +12 -0
- package/src/hooks/useCreateDeliveryTime/index.ts +51 -0
- package/src/hooks/useCreateOrderStatusType/index.ts +134 -0
- package/src/hooks/useCreateProduct/helpers/index.ts +23 -0
- package/src/hooks/useCreateProduct/helpers/manageCacheDataCatProduct/{index.js → index.ts} +1 -1
- package/src/hooks/useCreateProduct/helpers/useEditImageProduct/{index.js → index.ts} +14 -8
- package/src/hooks/useCreateProduct/index.ts +337 -0
- package/src/hooks/useCreateStorePendingToRegister/index.ts +17 -0
- package/src/hooks/useCreateStorePendingToRegister/queries.ts +10 -0
- package/src/hooks/useDashboardComponents/index.ts +50 -0
- package/src/hooks/useDeleteExtraProductFoods/index.ts +13 -0
- package/src/hooks/useDeleteSubProductOptional/{index.js → index.ts} +5 -3
- package/src/hooks/useDeliveryTime/index.ts +29 -0
- package/src/hooks/useDepartments/index.ts +14 -0
- package/src/hooks/useDepartments/queries.ts +13 -0
- package/src/hooks/useDessert/{index.js → index.ts} +162 -114
- package/src/hooks/useDessertWithPrice/helpers/index.ts +76 -0
- package/src/hooks/useDessertWithPrice/index.ts +381 -0
- package/src/hooks/useDessertWithPrice/queries.ts +18 -0
- package/src/hooks/useDevWS/index.ts +53 -0
- package/src/hooks/useDevices/index.ts +2 -0
- package/src/hooks/useDevices/queries.ts +28 -0
- package/src/hooks/useDevices/useGetDevices.ts +28 -0
- package/src/hooks/useDevices/useRegisterDevices.ts +75 -0
- package/src/hooks/useDownloadReports/helpers/downloadFileFromResponse.ts +21 -0
- package/src/hooks/useDownloadReports/index.ts +2 -0
- package/src/hooks/useDownloadReports/useDownloadReportByDay/index.ts +105 -0
- package/src/hooks/useDownloadReports/useGetReportByDateRange/index.ts +116 -0
- package/src/hooks/useDrag/{index.js → index.ts} +16 -0
- package/src/hooks/useDropzone/{index.js → index.ts} +2 -2
- package/src/hooks/useDynamicAuth/{index.js → index.ts} +2 -1
- package/src/hooks/useEditCategory/{index.js → index.ts} +14 -14
- package/src/hooks/useEditOneExtProductFoodOptional/index.ts +28 -0
- package/src/hooks/useEditOneExtProductFoodOptional/{queries.js → queries.ts} +2 -2
- package/src/hooks/useEditSubProductOptional/index.ts +12 -0
- package/src/hooks/useEmployee/index.ts +18 -0
- package/src/hooks/useEmployee/queries.ts +85 -0
- package/src/hooks/useEmployee/useCreateEmployee.ts +90 -0
- package/src/hooks/useEvent/{index.js → index.ts} +1 -0
- package/src/hooks/useFavoriteStores/index.ts +31 -0
- package/src/hooks/useFavoriteStores/queries.ts +54 -0
- package/src/hooks/useFetchMoreInteractions/index.jsx +26 -26
- package/src/hooks/useFilterConfigs/index.ts +173 -0
- package/src/hooks/useFingerprintjs/{index.js → index.ts} +32 -7
- package/src/hooks/useFormTools/index.ts +143 -0
- package/src/hooks/useFormatDate/index.ts +91 -0
- package/src/hooks/useFullScreenMode/{index.js → index.ts} +1 -5
- package/src/hooks/useGetAllLocationUser/index.ts +13 -0
- package/src/hooks/useGetAllLocationUser/queries.ts +44 -0
- package/src/hooks/{useSales/useGetAllSales/index.js → useGetAllSales/index.ts} +3 -2
- package/src/hooks/useGetCookies/index.ts +43 -0
- package/src/hooks/useGetExtProductFoodsSubOptionalAll/{index.js → index.ts} +2 -1
- package/src/hooks/useGetFoodRecomended/{index.js → index.ts} +2 -1
- package/src/hooks/useGetMessagesToRoom/index.ts +23 -0
- package/src/hooks/useGetMinPrice/{index.js → index.ts} +2 -1
- package/src/hooks/useGetOneStoreRating/{index.js → index.ts} +2 -1
- package/src/hooks/useGetSalesAmountToday/index.ts +31 -0
- package/src/hooks/useGetStoreCookie/index.ts +21 -0
- package/src/hooks/useGoogleLogin/{index.js → index.ts} +14 -5
- package/src/hooks/useHover/{index.js → index.ts} +3 -0
- package/src/hooks/useImageOptimization/{index.js → index.ts} +4 -0
- package/src/hooks/useImageUploaderProduct/helper/canvasUtils.ts +146 -0
- package/src/hooks/useImageUploaderProduct/helper/getOrientation.ts +54 -0
- package/src/hooks/useImageUploaderProduct/helper/index.ts +5 -0
- package/src/hooks/useImageUploaderProduct/index.ts +295 -0
- package/src/hooks/useImageWeight/{index.js → index.ts} +4 -0
- package/src/hooks/useImagesStore/index.ts +227 -0
- package/src/hooks/useImagesStore/{queries.js → queries.ts} +4 -68
- package/src/hooks/useImagesStore/utils/index.ts +4 -0
- package/src/hooks/useIncomingOrders/index.ts +11 -0
- package/src/hooks/useIncomingOrders/queries.ts +87 -0
- package/src/hooks/useIntersection/{index.js → index.ts} +1 -1
- package/src/hooks/useInventory/index.ts +2 -0
- package/src/hooks/useInventory/queries.ts +58 -0
- package/src/hooks/useInventory/useGetProductsInStock.ts +16 -0
- package/src/hooks/useInventory/useUpdateManageStock.ts +41 -0
- package/src/hooks/useLazyScript/{index.js → index.ts} +3 -0
- package/src/hooks/useLocalBackendIp/index.ts +34 -0
- package/src/hooks/useLocalSorage/{index.js → index.ts} +3 -3
- package/src/hooks/useLocationManager/index.ts +63 -0
- package/src/hooks/useLoginEmployeeInStore/index.ts +38 -0
- package/src/hooks/useLogout/helpers/BroadcastChannel.ts +74 -0
- package/src/hooks/useLogout/helpers/apiBaseUrl.ts +12 -0
- package/src/hooks/useLogout/helpers/fetchData.ts +37 -0
- package/src/hooks/useLogout/helpers/getCsrfToken.ts +37 -0
- package/src/hooks/useLogout/helpers/index.ts +65 -0
- package/src/hooks/useLogout/helpers/logger.ts +88 -0
- package/src/hooks/useLogout/helpers/parseUrl.ts +39 -0
- package/src/hooks/useLogout/index.ts +105 -0
- package/src/hooks/useManageNewOrder/helpers/index.ts +45 -0
- package/src/hooks/useManageNewOrder/index.ts +104 -0
- package/src/hooks/useManageQueryParams/index.ts +120 -0
- package/src/hooks/useMobile/index.ts +65 -0
- package/src/hooks/useModules/helpers/index.ts +1 -0
- package/src/hooks/useModules/helpers/validateModules.ts +43 -0
- package/src/hooks/useModules/index.ts +124 -0
- package/src/hooks/useMouse/index.ts +55 -0
- package/src/hooks/useOrderStatusTypes/index.ts +2 -0
- package/src/hooks/useOrderStatusTypes/useOrderStatusTypes/index.ts +133 -0
- package/src/hooks/useOrderStatusTypes/useUpdateOrderStatusPriorities/index.ts +99 -0
- package/src/hooks/useOrders/index.ts +3 -0
- package/src/hooks/useOrders/queries.ts +99 -0
- package/src/hooks/useOrders/useChangeOrderState/index.ts +128 -0
- package/src/hooks/useOrders/{index.js → useOrdersFromStore/index.ts} +20 -18
- package/src/hooks/usePWAInstall/index.ts +38 -0
- package/src/hooks/usePaymentMethod/index.ts +3 -0
- package/src/hooks/usePaymentMethod/paymentMethod.gql.ts +62 -0
- package/src/hooks/usePaymentMethod/paymentMethod.types.ts +28 -0
- package/src/hooks/usePaymentMethod/useCreatePaymentMethod/index.ts +25 -0
- package/src/hooks/usePaymentMethod/useGetAllPaymentMethods/index.ts +19 -0
- package/src/hooks/usePaymentMethod/useGetPaymentMethod/index.ts +26 -0
- package/src/hooks/usePortFetcher/index.ts +33 -0
- package/src/hooks/usePrintSaleTicket/index.ts +68 -0
- package/src/hooks/useProductsFood/index.ts +341 -0
- package/src/hooks/useProductsFood/{queriesStore.js → queriesStore.ts} +151 -84
- package/src/hooks/useProductsFood/types/index.ts +0 -0
- package/src/hooks/useProductsFood/useEditProduct.ts +49 -0
- package/src/hooks/useProductsFood/usetagsProducts.ts +101 -0
- package/src/hooks/useProviders/useProvidersCreateStore/{index.js → index.ts} +2 -1
- package/src/hooks/useProviders/useProvidersDataStore/{index.js → index.ts} +2 -1
- package/src/hooks/useProvidersStore/{index.js → index.ts} +2 -1
- package/src/hooks/usePushNotificationOrder/index.ts +52 -0
- package/src/hooks/usePushNotifications/helpers/index.ts +123 -0
- package/src/hooks/usePushNotifications/index.ts +150 -0
- package/src/hooks/useQueryLocationsMap/index.ts +20 -0
- package/src/hooks/useQueryLocationsMap/queries.ts +40 -0
- package/src/hooks/useRatingArrayData/{index.js → index.ts} +4 -4
- package/src/hooks/useRatingArrayData/{queries.js → queries.ts} +1 -1
- package/src/hooks/useReactToPrint/index.ts +4 -0
- package/src/hooks/useRemoveExtraProductFoodsOptional/{index.js → index.ts} +2 -1
- package/src/hooks/useRemoveExtraProductFoodsOptional/{queries.js → queries.ts} +4 -4
- package/src/hooks/useReport/{index.js → index.ts} +5 -5
- package/src/hooks/useReport/{queries.js → queries.ts} +4 -55
- package/src/hooks/useRestaurant/helpers/index.ts +28 -0
- package/src/hooks/useRestaurant/helpers/manageStatusOpen.ts +26 -0
- package/src/hooks/useRestaurant/index.ts +71 -0
- package/src/hooks/useRestaurant/{queries.js → queries.ts} +2 -1
- package/src/hooks/useRoads/index.ts +20 -0
- package/src/hooks/useRoads/queries.ts +13 -0
- package/src/hooks/useRoles/index.ts +4 -0
- package/src/hooks/useRoles/queries.ts +70 -0
- package/src/hooks/useRoles/useCreateRole.ts +40 -0
- package/src/hooks/useRoles/useGetRoles.ts +37 -0
- package/src/hooks/useRoles/useRemoveRoles.ts +40 -0
- package/src/hooks/useRoles/useUpdateRolesPriority.ts +44 -0
- package/src/hooks/useSales/helpers/add-product.utils.ts +120 -0
- package/src/hooks/useSales/helpers/apply-discount-to-cart.utils.ts +292 -0
- package/src/hooks/useSales/helpers/comment-product.utils.ts +41 -0
- package/src/hooks/useSales/helpers/constants/index.ts +38 -0
- package/src/hooks/useSales/helpers/extras.utils.ts +42 -0
- package/src/hooks/useSales/helpers/filterProductsByCarProId.utils.ts +17 -0
- package/src/hooks/useSales/helpers/increment-product-quantity.utils.ts +76 -0
- package/src/hooks/useSales/helpers/index.ts +3 -0
- package/src/hooks/useSales/helpers/initializer.utils.ts +22 -0
- package/src/hooks/useSales/helpers/isStockInsufficient.ts +3 -0
- package/src/hooks/useSales/helpers/remove-product.utils.test.ts +49 -0
- package/src/hooks/useSales/helpers/remove-product.utils.ts +34 -0
- package/src/hooks/useSales/helpers/resolveProduct.ts +29 -0
- package/src/hooks/useSales/helpers/useAddToCart.ts +64 -0
- package/src/hooks/useSales/index.ts +1418 -0
- package/src/hooks/useSales/{queries.js → queries.ts} +256 -166
- package/src/hooks/useSales/types/index.ts +206 -0
- package/src/hooks/useSales/types/use-sales.types.ts +8 -0
- package/src/hooks/useSales/useGetSale.ts +21 -0
- package/src/hooks/useSales/useTotalSales.ts +24 -0
- package/src/hooks/useSaveAvailableProduct/helpers/{index.js → index.ts} +4 -4
- package/src/hooks/useSaveAvailableProduct/{index.js → index.ts} +7 -1
- package/src/hooks/useSaveLocation/index.ts +17 -0
- package/src/hooks/useSaveLocation/queries.ts +19 -0
- package/src/hooks/useSchedule/{index.jsx → index.ts} +16 -4
- package/src/hooks/useSchedule/{index.js → schedule.ts} +22 -15
- package/src/hooks/useScheduleData/{index.js → index.ts} +21 -9
- package/src/hooks/useSetImageProducts/index.ts +59 -0
- package/src/hooks/useSetImageProducts/queries.ts +18 -0
- package/src/hooks/useSetSession/{index.js → index.ts} +16 -17
- package/src/hooks/useSetupSchedule/helpers/index.ts +85 -0
- package/src/hooks/useSetupSchedule/index.ts +284 -0
- package/src/hooks/useStatusOpenStore/helpers/index.ts +124 -0
- package/src/hooks/useStatusOpenStore/{index.js → index.ts} +39 -16
- package/src/hooks/useStatusOrdersClient/{index.js → index.ts} +3 -2
- package/src/hooks/useStatusOrdersClient/{queries.js → queries.ts} +2 -2
- package/src/hooks/useStock/index.ts +1 -0
- package/src/hooks/useStock/useStockUpdatedAllSubscription.ts +40 -0
- package/src/hooks/useStockMovements/helpers/index.ts +16 -0
- package/src/hooks/useStockMovements/index.ts +39 -0
- package/src/hooks/useStore/index.ts +83 -0
- package/src/hooks/useStore/{queries.js → queries.ts} +71 -71
- package/src/hooks/useStoreContacts/{index.js → index.ts} +11 -5
- package/src/hooks/useStoreTable/index.ts +2 -0
- package/src/hooks/useStoreTable/queries.ts +47 -0
- package/src/hooks/useStoreTable/useStoreTableCreate.ts +77 -0
- package/src/hooks/useStoreTable/useStoreTables.ts +15 -0
- package/src/hooks/useSubscriptionValidation/index.ts +112 -0
- package/src/hooks/useTagProducts/index.ts +3 -0
- package/src/hooks/useTagProducts/useDeleteOneTag.ts +106 -0
- package/src/hooks/useTagProducts/useGetAllTags.ts +68 -0
- package/src/hooks/useTagProducts/useRegisterMultipleTags.ts +157 -0
- package/src/hooks/useTheme/index.ts +65 -0
- package/src/hooks/useTimeAgo/{useTimeAgo.js → useTimeAgo.ts} +7 -7
- package/src/hooks/useTokenCards/index.ts +45 -0
- package/src/hooks/useTopProductsMovements/index.ts +27 -0
- package/src/hooks/useTotalAllSales/index.ts +25 -0
- package/src/hooks/useTotalProductsInStock/index.ts +23 -0
- package/src/hooks/useTotalProductsSold/index.ts +23 -0
- package/src/hooks/useTotalProductsSolded/index.ts +20 -0
- package/src/hooks/useUpdateCart/{index.js → index.ts} +3 -2
- package/src/hooks/useUpdateCartCookie/index.ts +60 -0
- package/src/hooks/useUpdateDashboardComponent/index.ts +91 -0
- package/src/hooks/useUpdateExistingOrders/{index.js → index.ts} +5 -11
- package/src/hooks/useUpdateExtProductFoodsSubOptional/index.ts +61 -0
- package/src/hooks/useUpdateModuleOrder/index.ts +37 -0
- package/src/hooks/useUpdateMultipleExtProduct/index.ts +34 -0
- package/src/hooks/useUpdateMultipleExtProduct/queries.ts +33 -0
- package/src/hooks/useUpdateMultipleProducts/index.ts +117 -0
- package/src/hooks/useUpdateMultipleProducts/queries.ts +51 -0
- package/src/hooks/useUploadProducts/helpers/index.ts +1 -0
- package/src/hooks/useUploadProducts/helpers/parseNumber.ts +37 -0
- package/src/hooks/useUploadProducts/helpers/validateProductDataExcel.ts +73 -0
- package/src/hooks/useUploadProducts/index.ts +442 -0
- package/src/hooks/useUpsertGoal/index.ts +68 -0
- package/src/hooks/useUser/{index.js → index.ts} +11 -4
- package/src/hooks/useUser/{queries.js → queries.ts} +9 -4
- package/src/hooks/useWeeklyStockMovement/helpers/index.ts +32 -0
- package/src/hooks/useWeeklyStockMovement/index.ts +52 -0
- package/src/hooks/useWindowSize/{index.js → index.ts} +9 -2
- package/src/index.ts +12 -0
- package/src/security/index.ts +1 -0
- package/src/services/index.ts +1 -0
- package/src/utils/UtilDateRange.ts +56 -0
- package/src/utils/generateCode.ts +222 -0
- package/src/utils/index.ts +2 -0
- package/src/utils/utils.ts +344 -0
- package/tsconfig.eslint.json +17 -0
- package/tsconfig.json +21 -0
- package/tsup.config.ts +24 -0
- package/.eslintrc.js +0 -38
- package/.eslintrc.json +0 -127
- package/next.config.js +0 -126
- package/src/config/client/errors.js +0 -26
- package/src/hooks/getGlobalSession/index.js +0 -49
- package/src/hooks/getSession/index.js +0 -18
- package/src/hooks/handleLogin/index.js +0 -10
- package/src/hooks/index.js +0 -77
- package/src/hooks/useAcumulateDate/index.js +0 -16
- package/src/hooks/useAsideCart/index.js +0 -155
- package/src/hooks/useCategoryInStore/index.js +0 -98
- package/src/hooks/useClients/queries.js +0 -127
- package/src/hooks/useConnection/index.js +0 -22
- package/src/hooks/useCreateProduct/index.js +0 -291
- package/src/hooks/useDevices/index.js +0 -35
- package/src/hooks/useDevices/queries.js +0 -19
- package/src/hooks/useEditOneExtProductFoodOptional/index.js +0 -28
- package/src/hooks/useEditSubProductOptional/index.js +0 -11
- package/src/hooks/useEmployee/index.js +0 -13
- package/src/hooks/useEmployee/queries.js +0 -17
- package/src/hooks/useFavoriteStores/index.js +0 -19
- package/src/hooks/useFavoriteStores/queries.js +0 -47
- package/src/hooks/useFormTools/index.js +0 -100
- package/src/hooks/useFormatDate/index.js +0 -33
- package/src/hooks/useGetStoreCookie/index.js +0 -22
- package/src/hooks/useImagesStore/index.js +0 -183
- package/src/hooks/useLogout/helpers/BroadcastChannel.js +0 -32
- package/src/hooks/useLogout/helpers/apiBaseUrl.js +0 -8
- package/src/hooks/useLogout/helpers/fetchData.js +0 -29
- package/src/hooks/useLogout/helpers/getCsrfToken.js +0 -30
- package/src/hooks/useLogout/helpers/index.js +0 -54
- package/src/hooks/useLogout/helpers/logger.js +0 -72
- package/src/hooks/useLogout/helpers/parseUrl.js +0 -36
- package/src/hooks/useLogout/index.js +0 -46
- package/src/hooks/useManageQueryParams/index.js +0 -37
- package/src/hooks/useMobile/index.js +0 -39
- package/src/hooks/useOrders/queries.js +0 -328
- package/src/hooks/useProductsFood/index.js +0 -234
- package/src/hooks/useProductsFood/useEditProduct.js +0 -8
- package/src/hooks/useProductsFood/usetagsProducts.js +0 -94
- package/src/hooks/useRestaurant/index.js +0 -19
- package/src/hooks/useSales/helpers/index.js +0 -8
- package/src/hooks/useSales/index.js +0 -1102
- package/src/hooks/useSales/useGetSale.js +0 -13
- package/src/hooks/useSales/useTotalSales.js +0 -24
- package/src/hooks/useStore/index.js +0 -70
- package/src/hooks/useUpdateExtProductFoodsSubOptional/index.js +0 -38
- package/src/index.jsx +0 -4
- package/src/utils/index.js +0 -141
- /package/src/config/client/{index.js → index.ts} +0 -0
- /package/src/hooks/getCategoriesWithProduct/helpers/{index.js → index.ts} +0 -0
- /package/src/hooks/useAnimationFrame/{index.js → index.ts} +0 -0
- /package/src/hooks/useAsideCart/helpers/{index.js → index.ts} +0 -0
- /package/src/hooks/useAsideCart/{queries.js → queries.ts} +0 -0
- /package/src/hooks/useCart/{index.js → index.ts} +0 -0
- /package/src/hooks/useDeleteSubProductOptional/{queries.js → queries.ts} +0 -0
- /package/src/hooks/useDessert/helpers/{index.js → index.ts} +0 -0
- /package/src/hooks/useDynamicAuth/{queries.js → queries.ts} +0 -0
- /package/src/hooks/useEditSubProductOptional/{queries.js → queries.ts} +0 -0
- /package/src/hooks/useFetchJson/{index.js → index.ts} +0 -0
- /package/src/hooks/useFormatNumberPhone/{index.js → index.ts} +0 -0
- /package/src/hooks/useGenerateNumberArray/{index.js → index.ts} +0 -0
- /package/src/hooks/useGetFoodRecomended/{queries.js → queries.ts} +0 -0
- /package/src/hooks/useGetMinPrice/{queries.js → queries.ts} +0 -0
- /package/src/hooks/useGetOneStoreRating/{queries.js → queries.ts} +0 -0
- /package/src/hooks/useGoogleLogin/{loadScript.js → loadScript.ts} +0 -0
- /package/src/hooks/useGoogleLogin/{removeScript.js → removeScript.ts} +0 -0
- /package/src/hooks/useInnerHtml/{index.js → index.ts} +0 -0
- /package/src/hooks/useKeypress/{index.js → index.ts} +0 -0
- /package/src/hooks/useLocationNavigate/{index.js → index.ts} +0 -0
- /package/src/{security/index.js → hooks/useManageNewOrder/helpers/mock.ts} +0 -0
- /package/src/hooks/useMutateHeight/{index.js → index.ts} +0 -0
- /package/src/hooks/useOrderClient/{index.js → index.ts} +0 -0
- /package/src/hooks/useProviders/{index.js → index.ts} +0 -0
- /package/src/hooks/useProviders/{queries.js → queries.ts} +0 -0
- /package/src/hooks/useProvidersStore/{queries.js → queries.ts} +0 -0
- /package/src/hooks/useReactToPrint/{index.js → index.txt} +0 -0
- /package/src/hooks/useSaveAvailableProduct/{queries.js → queries.ts} +0 -0
- /package/src/hooks/useSchedule/{queries.js → queries.ts} +0 -0
- /package/src/hooks/useScroll/{index.js → index.ts} +0 -0
- /package/src/hooks/useScrollRotate/{index.js → index.ts} +0 -0
- /package/src/hooks/useSetState/{index.js → index.ts} +0 -0
- /package/src/hooks/useStatusOrdersClient/helpers/{index.js → index.ts} +0 -0
- /package/src/hooks/useStoreCalendar/{index.js → index.ts} +0 -0
- /package/src/hooks/useStoreContacts/{queries.js → queries.ts} +0 -0
- /package/src/mock/dessert/{index.js → index.ts} +0 -0
- /package/src/mock/{index.js → index.ts} +0 -0
|
@@ -1,26 +1,41 @@
|
|
|
1
1
|
import { gql } from '@apollo/client'
|
|
2
2
|
|
|
3
3
|
export const GET_ALL_SALES = gql`
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
4
|
+
query getAllSalesStore {
|
|
5
|
+
getAllSalesStore {
|
|
6
|
+
change
|
|
7
|
+
channel
|
|
8
|
+
status
|
|
9
|
+
createdAt
|
|
10
|
+
pCodeRef
|
|
11
|
+
idStore
|
|
12
|
+
pdpId
|
|
13
|
+
locationUser
|
|
14
|
+
shoppingCartRefCode
|
|
15
|
+
statusOrder {
|
|
16
|
+
idStatus
|
|
17
|
+
name
|
|
18
|
+
description
|
|
19
|
+
color
|
|
20
|
+
backgroundColor
|
|
21
|
+
priority
|
|
22
|
+
state
|
|
23
|
+
createdAt
|
|
24
|
+
updatedAt
|
|
25
|
+
}
|
|
26
|
+
updatedAt
|
|
27
|
+
totalProductsPrice
|
|
28
|
+
unidProducts
|
|
29
|
+
getUser {
|
|
30
|
+
associateStore
|
|
31
|
+
avatar
|
|
32
|
+
createdAt
|
|
33
|
+
id
|
|
34
|
+
email
|
|
22
35
|
}
|
|
23
36
|
}
|
|
37
|
+
}
|
|
38
|
+
|
|
24
39
|
`
|
|
25
40
|
|
|
26
41
|
export const GET_ALL_COUNT_SALES = gql`
|
|
@@ -48,7 +63,7 @@ export const GET_ALL_SALES_STATISTICS = gql`
|
|
|
48
63
|
pdpId
|
|
49
64
|
idStore
|
|
50
65
|
pCodeRef
|
|
51
|
-
|
|
66
|
+
payId
|
|
52
67
|
pPRecoger
|
|
53
68
|
totalProductsPrice
|
|
54
69
|
pSState
|
|
@@ -62,7 +77,7 @@ export const GET_ALL_SALES_STATISTICS = gql`
|
|
|
62
77
|
ShoppingCard
|
|
63
78
|
pCodeRef
|
|
64
79
|
pPStateP
|
|
65
|
-
|
|
80
|
+
payId
|
|
66
81
|
pPRecoger
|
|
67
82
|
pDatCre
|
|
68
83
|
pDatMod
|
|
@@ -93,55 +108,6 @@ export const GET_ALL_SALES_STATISTICS = gql`
|
|
|
93
108
|
}
|
|
94
109
|
`
|
|
95
110
|
|
|
96
|
-
export const GET_ONE_SALES = gql`
|
|
97
|
-
query getOnePedidoStore($pCodeRef: String) {
|
|
98
|
-
getOnePedidoStore(pCodeRef: $pCodeRef) {
|
|
99
|
-
pdpId
|
|
100
|
-
pCodeRef
|
|
101
|
-
idStore
|
|
102
|
-
pPDate
|
|
103
|
-
channel
|
|
104
|
-
pSState
|
|
105
|
-
pDatCre
|
|
106
|
-
pDatMod
|
|
107
|
-
pPRecoger
|
|
108
|
-
payMethodPState
|
|
109
|
-
pdpId
|
|
110
|
-
totalProductsPrice
|
|
111
|
-
locationUser
|
|
112
|
-
getAllPedidoStore {
|
|
113
|
-
pdpId
|
|
114
|
-
idStore
|
|
115
|
-
pCodeRef
|
|
116
|
-
ShoppingCard
|
|
117
|
-
getAllShoppingCard {
|
|
118
|
-
ShoppingCard
|
|
119
|
-
cantProducts
|
|
120
|
-
subProductsId
|
|
121
|
-
comments
|
|
122
|
-
pId
|
|
123
|
-
productFood {
|
|
124
|
-
pId
|
|
125
|
-
carProId
|
|
126
|
-
colorId
|
|
127
|
-
idStore
|
|
128
|
-
pName
|
|
129
|
-
ProPrice
|
|
130
|
-
ProDescuento
|
|
131
|
-
ProDescription
|
|
132
|
-
ValueDelivery
|
|
133
|
-
ProImage
|
|
134
|
-
ProStar
|
|
135
|
-
pState
|
|
136
|
-
pDatCre
|
|
137
|
-
pDatMod
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
`
|
|
144
|
-
|
|
145
111
|
export const CREATE_CLIENTS = gql`
|
|
146
112
|
mutation createClients($input: IClients) {
|
|
147
113
|
createClients(input: $input) {
|
|
@@ -252,34 +218,146 @@ export const CREATE_SHOPPING_CARD = gql`
|
|
|
252
218
|
}
|
|
253
219
|
`
|
|
254
220
|
export const GET_ONE_SALE = gql`
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
221
|
+
query getOneSalesStore($pCodeRef: String) {
|
|
222
|
+
getOneSalesStore(pCodeRef: $pCodeRef) {
|
|
223
|
+
message
|
|
224
|
+
message
|
|
225
|
+
errors {
|
|
226
|
+
message
|
|
227
|
+
path
|
|
228
|
+
type
|
|
229
|
+
context {
|
|
230
|
+
key
|
|
231
|
+
label
|
|
232
|
+
limit
|
|
233
|
+
value
|
|
234
|
+
__typename
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
data {
|
|
238
|
+
statusOrder {
|
|
239
|
+
idStatus
|
|
240
|
+
name
|
|
241
|
+
description
|
|
242
|
+
color
|
|
243
|
+
backgroundColor
|
|
244
|
+
priority
|
|
245
|
+
state
|
|
246
|
+
createdAt
|
|
247
|
+
updatedAt
|
|
248
|
+
}
|
|
249
|
+
paymentMethod {
|
|
250
|
+
payId
|
|
251
|
+
name
|
|
252
|
+
icon
|
|
253
|
+
state
|
|
254
|
+
paymentPriority
|
|
255
|
+
createdAt
|
|
256
|
+
updatedAt
|
|
257
|
+
}
|
|
258
|
+
totals {
|
|
259
|
+
name
|
|
260
|
+
value
|
|
261
|
+
}
|
|
262
|
+
createdAt
|
|
263
|
+
change
|
|
261
264
|
channel
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
payMethodPState
|
|
265
|
+
pCodeRef
|
|
266
|
+
id
|
|
267
|
+
locationUser
|
|
268
|
+
pCodeRef
|
|
267
269
|
pdpId
|
|
270
|
+
ppState
|
|
271
|
+
ppState
|
|
272
|
+
shoppingCartRefCode
|
|
273
|
+
pSState
|
|
268
274
|
totalProductsPrice
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
275
|
+
unidProducts
|
|
276
|
+
updatedAt
|
|
277
|
+
createdAt
|
|
278
|
+
store {
|
|
279
|
+
addressStore
|
|
280
|
+
banner
|
|
281
|
+
cId
|
|
282
|
+
createdAt
|
|
283
|
+
dailyGoal
|
|
284
|
+
description
|
|
285
|
+
upLon
|
|
286
|
+
upLat
|
|
287
|
+
deliveryTimeMinutes
|
|
288
|
+
emailStore
|
|
289
|
+
documentIdentifier
|
|
290
|
+
Viaprincipal
|
|
291
|
+
uState
|
|
292
|
+
}
|
|
293
|
+
client {
|
|
294
|
+
cliId
|
|
272
295
|
idStore
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
296
|
+
idUser
|
|
297
|
+
clState
|
|
298
|
+
clientNumber
|
|
299
|
+
ClientAddress
|
|
300
|
+
ccClient
|
|
301
|
+
gender
|
|
302
|
+
clientLastName
|
|
303
|
+
clientName
|
|
304
|
+
createAt
|
|
305
|
+
updateAt
|
|
306
|
+
}
|
|
307
|
+
shoppingCarts {
|
|
308
|
+
shoppingCartId
|
|
309
|
+
id
|
|
310
|
+
pId
|
|
311
|
+
shoppingCartRefCode
|
|
312
|
+
priceProduct
|
|
313
|
+
comments
|
|
314
|
+
cantProducts
|
|
315
|
+
refCodePid
|
|
316
|
+
idUser
|
|
317
|
+
idStore
|
|
318
|
+
sState
|
|
319
|
+
createdAt
|
|
320
|
+
updatedAt
|
|
321
|
+
products {
|
|
281
322
|
pId
|
|
282
|
-
|
|
323
|
+
carProId
|
|
324
|
+
sizeId
|
|
325
|
+
colorId
|
|
326
|
+
idStore
|
|
327
|
+
cId
|
|
328
|
+
caId
|
|
329
|
+
dId
|
|
330
|
+
ctId
|
|
331
|
+
tpId
|
|
332
|
+
fId
|
|
333
|
+
pName
|
|
334
|
+
pCode
|
|
335
|
+
ProPrice
|
|
336
|
+
free
|
|
337
|
+
ProDescuento
|
|
338
|
+
ProUniDisponibles
|
|
339
|
+
ProDescription
|
|
340
|
+
ValueDelivery
|
|
341
|
+
ProProtegido
|
|
342
|
+
ProAssurance
|
|
343
|
+
ProImage
|
|
344
|
+
ProStar
|
|
345
|
+
ProWidth
|
|
346
|
+
ProHeight
|
|
347
|
+
ProLength
|
|
348
|
+
ProWeight
|
|
349
|
+
ProQuantity
|
|
350
|
+
ProOutstanding
|
|
351
|
+
ProDelivery
|
|
352
|
+
ProVoltaje
|
|
353
|
+
pState
|
|
354
|
+
tgId
|
|
355
|
+
sTateLogistic
|
|
356
|
+
ProBarCode
|
|
357
|
+
stock
|
|
358
|
+
manageStock
|
|
359
|
+
vat
|
|
360
|
+
ExtProductFoodOptional {
|
|
283
361
|
pId
|
|
284
362
|
opExPid
|
|
285
363
|
OptionalProName
|
|
@@ -287,9 +365,9 @@ export const GET_ONE_SALE = gql`
|
|
|
287
365
|
code
|
|
288
366
|
required
|
|
289
367
|
numbersOptionalOnly
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
368
|
+
createdAt
|
|
369
|
+
updatedAt
|
|
370
|
+
ExtProductFoodsSubOptionalAll {
|
|
293
371
|
pId
|
|
294
372
|
opExPid
|
|
295
373
|
idStore
|
|
@@ -298,8 +376,6 @@ export const GET_ONE_SALE = gql`
|
|
|
298
376
|
exCodeOptionExtra
|
|
299
377
|
exCode
|
|
300
378
|
state
|
|
301
|
-
pDatCre
|
|
302
|
-
pDatMod
|
|
303
379
|
}
|
|
304
380
|
}
|
|
305
381
|
ExtProductFoodsAll {
|
|
@@ -308,94 +384,107 @@ export const GET_ONE_SALE = gql`
|
|
|
308
384
|
exState
|
|
309
385
|
extraName
|
|
310
386
|
extraPrice
|
|
311
|
-
newExtraPrice
|
|
312
387
|
quantity
|
|
388
|
+
newExtraPrice
|
|
313
389
|
state
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
}
|
|
317
|
-
productFood {
|
|
318
|
-
pId
|
|
319
|
-
carProId
|
|
320
|
-
colorId
|
|
321
|
-
idStore
|
|
322
|
-
pName
|
|
323
|
-
ProPrice
|
|
324
|
-
ProDescuento
|
|
325
|
-
ProDescription
|
|
326
|
-
ValueDelivery
|
|
327
|
-
ProImage
|
|
328
|
-
ProStar
|
|
329
|
-
pState
|
|
330
|
-
pDatCre
|
|
331
|
-
pDatMod
|
|
390
|
+
createdAt
|
|
391
|
+
updatedAt
|
|
332
392
|
}
|
|
393
|
+
createdAt
|
|
394
|
+
updatedAt
|
|
333
395
|
}
|
|
334
396
|
}
|
|
397
|
+
__typename
|
|
335
398
|
}
|
|
336
399
|
}
|
|
400
|
+
}
|
|
337
401
|
`
|
|
338
|
-
|
|
339
402
|
export const CREATE_SHOPPING_CARD_TO_USER_STORE = gql`
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
403
|
+
mutation registerSalesStore(
|
|
404
|
+
$input: [IShoppingCart]
|
|
405
|
+
$id: ID
|
|
406
|
+
$tableId: ID
|
|
407
|
+
$discount: DiscountInput
|
|
408
|
+
$idStore: ID
|
|
409
|
+
$pCodeRef: String
|
|
410
|
+
$change: Float
|
|
411
|
+
$shoppingCartRefCode: String
|
|
412
|
+
$payId: ID
|
|
413
|
+
$pickUp: Int
|
|
414
|
+
$totalProductsPrice: Float
|
|
415
|
+
$valueDelivery: Float
|
|
416
|
+
$idSubArray: IID_SUB_ITEMS
|
|
417
|
+
) {
|
|
418
|
+
registerSalesStore(
|
|
419
|
+
input: $input
|
|
420
|
+
id: $id
|
|
421
|
+
tableId: $tableId
|
|
422
|
+
discount: $discount
|
|
423
|
+
shoppingCartRefCode: $shoppingCartRefCode
|
|
424
|
+
idStore: $idStore
|
|
425
|
+
pCodeRef: $pCodeRef
|
|
426
|
+
change: $change
|
|
427
|
+
|
|
428
|
+
payId: $payId
|
|
429
|
+
pickUp: $pickUp
|
|
430
|
+
totalProductsPrice: $totalProductsPrice
|
|
431
|
+
valueDelivery: $valueDelivery
|
|
432
|
+
idSubArray: $idSubArray
|
|
352
433
|
) {
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
434
|
+
success
|
|
435
|
+
message
|
|
436
|
+
errors {
|
|
437
|
+
path
|
|
438
|
+
message
|
|
439
|
+
type
|
|
440
|
+
context {
|
|
441
|
+
limit
|
|
442
|
+
value
|
|
443
|
+
label
|
|
444
|
+
key
|
|
445
|
+
__typename
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
data {
|
|
449
|
+
pCodeRef
|
|
450
|
+
idStore
|
|
451
|
+
id
|
|
452
|
+
channel
|
|
453
|
+
payId
|
|
454
|
+
pSState
|
|
455
|
+
createdAt
|
|
456
|
+
updatedAt
|
|
457
|
+
unidProducts
|
|
458
|
+
totalProductsPrice
|
|
459
|
+
getOneStore {
|
|
376
460
|
idStore
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
461
|
+
cId
|
|
462
|
+
dId
|
|
463
|
+
catStore
|
|
464
|
+
scheduleOpenAll
|
|
465
|
+
dailyGoal
|
|
466
|
+
deliveryTimeMinutes
|
|
383
467
|
}
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
468
|
+
getUser {
|
|
469
|
+
id
|
|
470
|
+
name
|
|
471
|
+
email
|
|
472
|
+
createdAt
|
|
473
|
+
updatedAt
|
|
474
|
+
__typename
|
|
387
475
|
}
|
|
388
476
|
}
|
|
389
477
|
}
|
|
478
|
+
}
|
|
390
479
|
`
|
|
391
480
|
|
|
392
|
-
export const
|
|
393
|
-
query
|
|
394
|
-
|
|
481
|
+
export const GET_ALL_ORDER = gql`
|
|
482
|
+
query getAllOrderStoreFinal($idStore: ID, $search: String, $min: Int, $max: Int, $statusOrder: Int) {
|
|
483
|
+
getAllOrderStoreFinal(idStore: $idStore, search: $search, min: $min, max: $max, statusOrder: $statusOrder) {
|
|
395
484
|
pdpId
|
|
396
485
|
idStore
|
|
397
486
|
pCodeRef
|
|
398
|
-
|
|
487
|
+
payId
|
|
399
488
|
pPRecoger
|
|
400
489
|
totalProductsPrice
|
|
401
490
|
pSState
|
|
@@ -410,12 +499,13 @@ query getAllPedidoStoreFinal($idStore: ID, $search: String, $min: Int, $max: Int
|
|
|
410
499
|
ShoppingCard
|
|
411
500
|
pCodeRef
|
|
412
501
|
pPStateP
|
|
413
|
-
|
|
502
|
+
payId
|
|
414
503
|
pPRecoger
|
|
415
504
|
pDatCre
|
|
416
505
|
pDatMod
|
|
417
506
|
getAllShoppingCard {
|
|
418
507
|
ShoppingCard
|
|
508
|
+
priceProduct
|
|
419
509
|
comments
|
|
420
510
|
cantProducts
|
|
421
511
|
pId
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import { TypeDiscount } from '../helpers/apply-discount-to-cart.utils'
|
|
2
|
+
import { SalesActionTypes } from '../helpers/constants'
|
|
3
|
+
/**
|
|
4
|
+
* Basic notification payload used across hook
|
|
5
|
+
*/
|
|
6
|
+
export interface NotificationPayload {
|
|
7
|
+
title?: string
|
|
8
|
+
description?: string
|
|
9
|
+
backgroundColor?: 'success' | 'error' | 'warning' | 'info'
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface SalesState {
|
|
13
|
+
PRODUCT: any[];
|
|
14
|
+
totalPrice: number;
|
|
15
|
+
sortBy: string | null;
|
|
16
|
+
itemsInCart: number;
|
|
17
|
+
animateType: string;
|
|
18
|
+
startAnimateUp: string;
|
|
19
|
+
priceRange: number;
|
|
20
|
+
counter: number;
|
|
21
|
+
totalAmount: number;
|
|
22
|
+
payId: string;
|
|
23
|
+
discountType: TypeDiscount;
|
|
24
|
+
discountPercent: number;
|
|
25
|
+
discountAmount: number;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Basic product model as returned by productsFood (server model).
|
|
30
|
+
* Add fields as your GraphQL schema evolves; keep server -> client mapping explicit.
|
|
31
|
+
*/
|
|
32
|
+
export interface ProductFood {
|
|
33
|
+
pId: string
|
|
34
|
+
pName: string
|
|
35
|
+
ProPrice: number
|
|
36
|
+
unitPrice?: number
|
|
37
|
+
stock?: number
|
|
38
|
+
manageStock?: boolean
|
|
39
|
+
ProQuantity?: number
|
|
40
|
+
existsInSale?: boolean
|
|
41
|
+
// allow extra server metadata
|
|
42
|
+
[key: string]: any
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Extra product attached to a product inside cart.
|
|
47
|
+
*/
|
|
48
|
+
export interface ExtraItem {
|
|
49
|
+
exPid: string
|
|
50
|
+
extraPrice: number
|
|
51
|
+
quantity: number
|
|
52
|
+
newExtraPrice?: number
|
|
53
|
+
__typename?: string
|
|
54
|
+
[key: string]: any
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Sub option element for optional groups
|
|
59
|
+
*/
|
|
60
|
+
export interface SubOptionalItem {
|
|
61
|
+
opSubExPid: string
|
|
62
|
+
name?: string
|
|
63
|
+
check?: boolean
|
|
64
|
+
price?: number
|
|
65
|
+
__typename?: string
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Optional group of sub options
|
|
70
|
+
*/
|
|
71
|
+
export interface OptionalGroup {
|
|
72
|
+
opExPid: string
|
|
73
|
+
name?: string
|
|
74
|
+
ExtProductFoodsSubOptionalAll: SubOptionalItem[]
|
|
75
|
+
code?: string
|
|
76
|
+
__typename?: string
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Item stored inside the sales reducer PRODUCT array.
|
|
82
|
+
*/
|
|
83
|
+
export interface SaleProduct {
|
|
84
|
+
pId: string
|
|
85
|
+
pName?: string
|
|
86
|
+
// quantity currently chosen
|
|
87
|
+
ProQuantity: number
|
|
88
|
+
// total price for the quantity (without extras)
|
|
89
|
+
ProPrice: number
|
|
90
|
+
unitPrice?: number
|
|
91
|
+
comment?: string
|
|
92
|
+
dataExtra?: ExtraItem[]
|
|
93
|
+
dataOptional?: OptionalGroup[]
|
|
94
|
+
free?: boolean
|
|
95
|
+
editing?: boolean
|
|
96
|
+
oldQuantity?: number
|
|
97
|
+
// additional UI-only helpers
|
|
98
|
+
refCodePid?: string
|
|
99
|
+
[key: string]: any
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export type SalesReducerAction =
|
|
103
|
+
| { type: SalesActionTypes.ADD_TO_CART; payload: ProductFood }
|
|
104
|
+
| { type: SalesActionTypes.ADD_PRODUCT; payload: SaleProduct }
|
|
105
|
+
| { type: SalesActionTypes.REMOVE_PRODUCT; payload: { pId: string } }
|
|
106
|
+
| { type: SalesActionTypes.REMOVE_PRODUCT_TO_CART; payload: { pId: string; ProQuantity: number } }
|
|
107
|
+
| { type: SalesActionTypes.ON_CHANGE; payload: { payload: { value: number; index: number; id: string } } }
|
|
108
|
+
| { type: SalesActionTypes.UPDATE_SUCCESS_QUANTITY_EDITING_PRODUCT; payload: { payload: { pId: string } } }
|
|
109
|
+
| { type: SalesActionTypes.CANCEL_UPDATE_QUANTITY_EDITING_PRODUCT; payload: { payload: { pId: string } } }
|
|
110
|
+
| { type: SalesActionTypes.REMOVE_ALL_PRODUCTS }
|
|
111
|
+
| { type: SalesActionTypes.TOGGLE_FREE_PRODUCT; payload: { pId: string } }
|
|
112
|
+
| { type: SalesActionTypes.TOGGLE_EDITING_PRODUCT; payload: { payload: { pId: string } } }
|
|
113
|
+
| { type: SalesActionTypes.INCREMENT; id: string }
|
|
114
|
+
| { type: SalesActionTypes.PUT_COMMENT; payload: string, value: string }
|
|
115
|
+
| { type: SalesActionTypes.PUT_EXTRA_PRODUCTS_AND_OPTIONAL_PRODUCT; payload: string; dataOptional?: OptionalGroup[]; dataExtra?: ExtraItem[] }
|
|
116
|
+
| { type: SalesActionTypes.PRICE_RANGE; payload: number }
|
|
117
|
+
| { type: SalesActionTypes.SORT; payload: string }
|
|
118
|
+
| { type: SalesActionTypes.DECREMENT }
|
|
119
|
+
| { type: SalesActionTypes.PAYMENT_METHOD; payload: string }
|
|
120
|
+
| { type: SalesActionTypes.APPLY_DISCOUNT; payload: any }
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Values used in forms (change, client id, comments etc)
|
|
125
|
+
*/
|
|
126
|
+
export interface ValuesState {
|
|
127
|
+
change: string | number
|
|
128
|
+
cliId: string | null
|
|
129
|
+
comment: string
|
|
130
|
+
tableId: string | null
|
|
131
|
+
valueDelivery: string | number
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Hook return shape — keep in sync with actual returned object.
|
|
136
|
+
* Export a minimal public API so consumers only see typed surface.
|
|
137
|
+
*/
|
|
138
|
+
export interface UseSalesReturn {
|
|
139
|
+
loading: boolean
|
|
140
|
+
loadingExtraProduct: boolean
|
|
141
|
+
disabledModalItems: boolean
|
|
142
|
+
loadingRegisterSale: boolean
|
|
143
|
+
errorSale: boolean
|
|
144
|
+
openCurrentSale: boolean | null
|
|
145
|
+
code: string | null
|
|
146
|
+
totalProductPrice: number
|
|
147
|
+
saveDataState: any
|
|
148
|
+
product: { PRODUCT: { pId: string | null } }
|
|
149
|
+
data: SalesState
|
|
150
|
+
openCommentModal: boolean
|
|
151
|
+
inputValue: string
|
|
152
|
+
arrayProduct: any[]
|
|
153
|
+
delivery: boolean
|
|
154
|
+
valuesDates: { fromDate: string; toDate?: string }
|
|
155
|
+
print: boolean
|
|
156
|
+
finalFilter: any[]
|
|
157
|
+
showMore: number
|
|
158
|
+
search: string
|
|
159
|
+
values: ValuesState
|
|
160
|
+
initialStateSales: SalesState
|
|
161
|
+
productsFood: ProductFood[]
|
|
162
|
+
modalItem: boolean
|
|
163
|
+
sumExtraProducts: number
|
|
164
|
+
oneProductToComment: any
|
|
165
|
+
dataProduct: any
|
|
166
|
+
dataOptional: OptionalGroup[]
|
|
167
|
+
dataExtra: ExtraItem[]
|
|
168
|
+
fetchMore: Function
|
|
169
|
+
pagination: any
|
|
170
|
+
discount: number
|
|
171
|
+
datCat: any[]
|
|
172
|
+
currentPage: number
|
|
173
|
+
loadingProduct: boolean
|
|
174
|
+
handleChangeCheck: (caId: string) => void
|
|
175
|
+
errors: Record<string, boolean>
|
|
176
|
+
handleUpdateAllExtra: () => void
|
|
177
|
+
handleAddAllProductsToCart: () => void
|
|
178
|
+
dispatch: React.Dispatch<SalesReducerAction>
|
|
179
|
+
handlePageChange: (pageNumber: number) => void
|
|
180
|
+
handleComment: (product: any) => void
|
|
181
|
+
setModalItem: (v: boolean) => void
|
|
182
|
+
handleChangeFilter: (value: string) => void
|
|
183
|
+
handleProduct: (PRODUCT: any) => Promise<void>
|
|
184
|
+
handleChange: (e: React.ChangeEvent<HTMLInputElement> | { target: { name: string; value: any } }, error: boolean) => void
|
|
185
|
+
setOpenCurrentSale: (v: any) => void
|
|
186
|
+
setErrors: (e: any) => void
|
|
187
|
+
onChangeInput: (e: React.ChangeEvent<HTMLInputElement>) => void
|
|
188
|
+
handleAddProduct: (product: any) => Promise<void>
|
|
189
|
+
handleRemoveValue: ({ name, value, pId }: { name: string; value: any; pId: string }) => void
|
|
190
|
+
setDelivery: (v: boolean) => void
|
|
191
|
+
setValues: (v: ValuesState) => void
|
|
192
|
+
setShowMore: (n: number) => void
|
|
193
|
+
PriceRangeFunc: (products: any[], price: number) => any[]
|
|
194
|
+
handleCleanFilter: () => null
|
|
195
|
+
handleSubmit: () => void
|
|
196
|
+
handleChangeFilterProduct: (e: React.ChangeEvent<HTMLInputElement>) => void
|
|
197
|
+
handleDecrementExtra: ({ Adicionales }: { Adicionales: any }) => void
|
|
198
|
+
setTotalProductPrice: (n: number) => void
|
|
199
|
+
setInputValue: (s: string) => void
|
|
200
|
+
getSortedProduct: (data: any[], sort: string) => any[]
|
|
201
|
+
handleAddOptional: ({ exOptional, codeCategory }: { exOptional?: string | null; codeCategory?: string | null }) => void
|
|
202
|
+
handleIncrementExtra: ({ Adicionales, index }: { Adicionales: any; index?: number }) => void
|
|
203
|
+
setProduct: (p: any) => void
|
|
204
|
+
setPrint: () => void
|
|
205
|
+
PRODUCT: (state: SalesState, action: SalesReducerAction) => SalesState
|
|
206
|
+
}
|