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,215 +0,0 @@
|
|
|
1
|
-
import { gql } from '@apollo/client'
|
|
2
|
-
|
|
3
|
-
export const CREATE_CLIENTS = gql`
|
|
4
|
-
mutation createClients ($input: IClients) {
|
|
5
|
-
createClients(input: $input) {
|
|
6
|
-
success
|
|
7
|
-
message
|
|
8
|
-
errors {
|
|
9
|
-
path
|
|
10
|
-
message
|
|
11
|
-
type
|
|
12
|
-
context {
|
|
13
|
-
limit
|
|
14
|
-
value
|
|
15
|
-
label
|
|
16
|
-
key
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
data {
|
|
20
|
-
cliId
|
|
21
|
-
idStore
|
|
22
|
-
idUser
|
|
23
|
-
clState
|
|
24
|
-
ClientAddress
|
|
25
|
-
clientNumber
|
|
26
|
-
ccClient
|
|
27
|
-
gender
|
|
28
|
-
clientLastName
|
|
29
|
-
clientName
|
|
30
|
-
default
|
|
31
|
-
createAt
|
|
32
|
-
updateAt
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
`
|
|
37
|
-
export const DELETE_ONE_CLIENTS = gql`
|
|
38
|
-
mutation deleteClient($cliId: ID, $clState: Int!) {
|
|
39
|
-
deleteClient(cliId: $cliId, clState: $clState) {
|
|
40
|
-
success
|
|
41
|
-
message
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
`
|
|
45
|
-
export const GET_ALL_CLIENTS = gql`
|
|
46
|
-
query getAllClients($idStore: ID, $search: String, $min: Int, $max: Int, $fromDate: DateTime, $toDate: DateTime, $page: Int) {
|
|
47
|
-
getAllClients(idStore: $idStore, search: $search, min: $min, max: $max, fromDate: $fromDate, toDate: $toDate, page: $page) {
|
|
48
|
-
success
|
|
49
|
-
message
|
|
50
|
-
data {
|
|
51
|
-
cliId
|
|
52
|
-
idStore
|
|
53
|
-
gender
|
|
54
|
-
clState
|
|
55
|
-
clientNumber
|
|
56
|
-
ccClient
|
|
57
|
-
clientLastName
|
|
58
|
-
|
|
59
|
-
clientName
|
|
60
|
-
default
|
|
61
|
-
createAt
|
|
62
|
-
updateAt
|
|
63
|
-
}
|
|
64
|
-
pagination {
|
|
65
|
-
totalRecords
|
|
66
|
-
totalPages
|
|
67
|
-
currentPage
|
|
68
|
-
}
|
|
69
|
-
errors {
|
|
70
|
-
path
|
|
71
|
-
message
|
|
72
|
-
type
|
|
73
|
-
context {
|
|
74
|
-
limit
|
|
75
|
-
value
|
|
76
|
-
label
|
|
77
|
-
key
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
`
|
|
85
|
-
export const GET_ONE_CLIENT = gql`
|
|
86
|
-
query getOneClients($cliId: ID) {
|
|
87
|
-
getOneClients(cliId: $cliId) {
|
|
88
|
-
cliId
|
|
89
|
-
idStore
|
|
90
|
-
idUser
|
|
91
|
-
clState
|
|
92
|
-
clientNumber
|
|
93
|
-
ClientAddress
|
|
94
|
-
gender
|
|
95
|
-
ccClient
|
|
96
|
-
clientLastName
|
|
97
|
-
clientName
|
|
98
|
-
default
|
|
99
|
-
createAt
|
|
100
|
-
updateAt
|
|
101
|
-
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
`
|
|
105
|
-
|
|
106
|
-
export const EDIT_ONE_CLIENT = gql`
|
|
107
|
-
mutation editOneClient($input: IClients) {
|
|
108
|
-
editOneClient(input: $input) {
|
|
109
|
-
success
|
|
110
|
-
message
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
`
|
|
114
|
-
|
|
115
|
-
export const CREATE_SHOPPING_CARD = gql`
|
|
116
|
-
mutation registerShoppingCard($input: IShoppingCard, $idSubArray: IID_SUB_ITEMS){
|
|
117
|
-
registerShoppingCard(input: $input, idSubArray: $idSubArray){
|
|
118
|
-
ShoppingCard
|
|
119
|
-
id
|
|
120
|
-
pId
|
|
121
|
-
subProductsId
|
|
122
|
-
ShoppingCardRefCode
|
|
123
|
-
uuid
|
|
124
|
-
discountCardProduct
|
|
125
|
-
idUser
|
|
126
|
-
cName
|
|
127
|
-
idStore
|
|
128
|
-
cState
|
|
129
|
-
cDatCre
|
|
130
|
-
cDatMod
|
|
131
|
-
csDescription
|
|
132
|
-
cantProducts
|
|
133
|
-
comments
|
|
134
|
-
# idSubArray
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
`
|
|
138
|
-
export const CREATE_SHOPPING_CARD_TO_USER_STORE = gql`
|
|
139
|
-
mutation registerSalesStore(
|
|
140
|
-
$input: [IShoppingCart]
|
|
141
|
-
$id: ID
|
|
142
|
-
$tableId: ID
|
|
143
|
-
$discount: DiscountInput
|
|
144
|
-
$idStore: ID
|
|
145
|
-
$pCodeRef: String
|
|
146
|
-
$change: Float
|
|
147
|
-
$shoppingCartRefCode: String
|
|
148
|
-
$payId: ID
|
|
149
|
-
$pickUp: Int
|
|
150
|
-
$totalProductsPrice: Float
|
|
151
|
-
$valueDelivery: Float
|
|
152
|
-
$idSubArray: IID_SUB_ITEMS
|
|
153
|
-
) {
|
|
154
|
-
registerSalesStore(
|
|
155
|
-
input: $input
|
|
156
|
-
id: $id
|
|
157
|
-
tableId: $tableId
|
|
158
|
-
discount: $discount
|
|
159
|
-
shoppingCartRefCode: $shoppingCartRefCode
|
|
160
|
-
idStore: $idStore
|
|
161
|
-
pCodeRef: $pCodeRef
|
|
162
|
-
change: $change
|
|
163
|
-
|
|
164
|
-
payId: $payId
|
|
165
|
-
pickUp: $pickUp
|
|
166
|
-
totalProductsPrice: $totalProductsPrice
|
|
167
|
-
valueDelivery: $valueDelivery
|
|
168
|
-
idSubArray: $idSubArray
|
|
169
|
-
) {
|
|
170
|
-
success
|
|
171
|
-
message
|
|
172
|
-
errors {
|
|
173
|
-
path
|
|
174
|
-
message
|
|
175
|
-
type
|
|
176
|
-
context {
|
|
177
|
-
limit
|
|
178
|
-
value
|
|
179
|
-
label
|
|
180
|
-
key
|
|
181
|
-
__typename
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
data {
|
|
185
|
-
pCodeRef
|
|
186
|
-
idStore
|
|
187
|
-
id
|
|
188
|
-
channel
|
|
189
|
-
payId
|
|
190
|
-
pSState
|
|
191
|
-
createdAt
|
|
192
|
-
updatedAt
|
|
193
|
-
unidProducts
|
|
194
|
-
totalProductsPrice
|
|
195
|
-
getOneStore {
|
|
196
|
-
idStore
|
|
197
|
-
cId
|
|
198
|
-
dId
|
|
199
|
-
catStore
|
|
200
|
-
scheduleOpenAll
|
|
201
|
-
dailyGoal
|
|
202
|
-
deliveryTimeMinutes
|
|
203
|
-
}
|
|
204
|
-
getUser {
|
|
205
|
-
id
|
|
206
|
-
name
|
|
207
|
-
email
|
|
208
|
-
createdAt
|
|
209
|
-
updatedAt
|
|
210
|
-
__typename
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
`
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
3
|
-
*/
|
|
4
|
-
class AleaGen {
|
|
5
|
-
/**
|
|
6
|
-
*
|
|
7
|
-
* @param seed
|
|
8
|
-
*/
|
|
9
|
-
constructor (seed) {
|
|
10
|
-
if (seed == null) { seed = +(new Date()) }
|
|
11
|
-
let n = 0xefc8249d
|
|
12
|
-
// Apply the seeding algorithm from Baagoe.
|
|
13
|
-
this.c = 1
|
|
14
|
-
this.s0 = mash(' ')
|
|
15
|
-
this.s1 = mash(' ')
|
|
16
|
-
this.s2 = mash(' ')
|
|
17
|
-
this.s0 -= mash(seed)
|
|
18
|
-
if (this.s0 < 0) {
|
|
19
|
-
this.s0 += 1
|
|
20
|
-
}
|
|
21
|
-
this.s1 -= mash(seed)
|
|
22
|
-
if (this.s1 < 0) {
|
|
23
|
-
this.s1 += 1
|
|
24
|
-
}
|
|
25
|
-
this.s2 -= mash(seed)
|
|
26
|
-
if (this.s2 < 0) {
|
|
27
|
-
this.s2 += 1
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
*
|
|
31
|
-
* @param data
|
|
32
|
-
*/
|
|
33
|
-
function mash (data) {
|
|
34
|
-
data = String(data)
|
|
35
|
-
for (let i = 0; i < data.length; i++) {
|
|
36
|
-
n += data.charCodeAt(i)
|
|
37
|
-
let h = 0.02519603282416938 * n
|
|
38
|
-
n = h >>> 0
|
|
39
|
-
h -= n
|
|
40
|
-
h *= n
|
|
41
|
-
n = h >>> 0
|
|
42
|
-
h -= n
|
|
43
|
-
n += h * 0x100000000 // 2^32
|
|
44
|
-
}
|
|
45
|
-
return (n >>> 0) * 2.3283064365386963e-10 // 2^-32
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
*
|
|
51
|
-
*/
|
|
52
|
-
next () {
|
|
53
|
-
const { c, s0, s1, s2 } = this
|
|
54
|
-
const t = 2091639 * s0 + c * 2.3283064365386963e-10 // 2^-32
|
|
55
|
-
this.s0 = s1
|
|
56
|
-
this.s1 = s2
|
|
57
|
-
return this.s2 = t - (this.c = t | 0)
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
*
|
|
62
|
-
* @param f
|
|
63
|
-
* @param t
|
|
64
|
-
*/
|
|
65
|
-
copy (f, t) {
|
|
66
|
-
t.c = f.c
|
|
67
|
-
t.s0 = f.s0
|
|
68
|
-
t.s1 = f.s1
|
|
69
|
-
t.s2 = f.s2
|
|
70
|
-
return t
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
export default AleaGen
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
export const BACKGROUND_COLORS = [
|
|
2
|
-
'#F7F9FC',
|
|
3
|
-
'#EEEDFD',
|
|
4
|
-
'#FFEBEE',
|
|
5
|
-
'#FDEFE2',
|
|
6
|
-
'#E7F9F3',
|
|
7
|
-
'#EDEEFD',
|
|
8
|
-
'#ECFAFE',
|
|
9
|
-
'#F2FFD1',
|
|
10
|
-
'#FFF7E0',
|
|
11
|
-
'#FDF1F7',
|
|
12
|
-
'#EAEFE6',
|
|
13
|
-
'#E0E6EB',
|
|
14
|
-
'#E4E2F3',
|
|
15
|
-
'#E6DFEC',
|
|
16
|
-
'#E2F4E8',
|
|
17
|
-
'#E6EBEF',
|
|
18
|
-
'#EBE6EF',
|
|
19
|
-
'#E8DEF6',
|
|
20
|
-
'#D8E8F3',
|
|
21
|
-
'#ECE1FE'
|
|
22
|
-
]
|
|
23
|
-
|
|
24
|
-
export const TEXT_COLORS = [
|
|
25
|
-
'#060A23',
|
|
26
|
-
'#4409B9',
|
|
27
|
-
'#BD0F2C',
|
|
28
|
-
'#C56511',
|
|
29
|
-
'#216E55',
|
|
30
|
-
'#05128A',
|
|
31
|
-
'#1F84A3',
|
|
32
|
-
'#526E0C',
|
|
33
|
-
'#935F10',
|
|
34
|
-
'#973562',
|
|
35
|
-
'#69785E',
|
|
36
|
-
'#2D3A46',
|
|
37
|
-
'#280F6D',
|
|
38
|
-
'#37364F',
|
|
39
|
-
'#363548',
|
|
40
|
-
'#4D176E',
|
|
41
|
-
'#AB133E',
|
|
42
|
-
'#420790',
|
|
43
|
-
'#222A54',
|
|
44
|
-
'#192251'
|
|
45
|
-
]
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import AleaGen from './alea'
|
|
2
|
-
import MersenneTwister from './mersenne_twister'
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
*
|
|
6
|
-
* @param opts
|
|
7
|
-
*/
|
|
8
|
-
function minMax (opts: { random: number; min: number; max: number }): number {
|
|
9
|
-
const { random, min, max } = opts
|
|
10
|
-
return Math.floor(random * (max - min + 1) + min)
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export const randomNumber = (opts: { value: string; min: number; max: number }): number => {
|
|
14
|
-
const { value, min, max } = opts
|
|
15
|
-
|
|
16
|
-
const prepareSeed = new AleaGen(value)
|
|
17
|
-
// @ts-ignore
|
|
18
|
-
const seedOutput = prepareSeed.s1 * 10000000
|
|
19
|
-
|
|
20
|
-
// @ts-ignore
|
|
21
|
-
const mersenne = new MersenneTwister(seedOutput)
|
|
22
|
-
|
|
23
|
-
return minMax({ random: mersenne.random(), min, max })
|
|
24
|
-
}
|
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
const MersenneTwister = function (seed) {
|
|
2
|
-
if (seed === undefined) {
|
|
3
|
-
// kept random number same size as time used previously to ensure no unexpected results downstream
|
|
4
|
-
seed = Math.floor(Math.random() * Math.pow(10, 13))
|
|
5
|
-
}
|
|
6
|
-
/* Period parameters */
|
|
7
|
-
this.N = 624
|
|
8
|
-
this.M = 397
|
|
9
|
-
this.MATRIX_A = 0x9908b0df /* constant vector a */
|
|
10
|
-
this.UPPER_MASK = 0x80000000 /* most significant w-r bits */
|
|
11
|
-
this.LOWER_MASK = 0x7fffffff /* least significant r bits */
|
|
12
|
-
this.mt = new Array(this.N) /* the array for the state vector */
|
|
13
|
-
this.mti = this.N + 1 /* mti==N + 1 means mt[N] is not initialized */
|
|
14
|
-
this.init_genrand(seed)
|
|
15
|
-
}
|
|
16
|
-
/* initializes mt[N] with a seed */
|
|
17
|
-
MersenneTwister.prototype.init_genrand = function (s) {
|
|
18
|
-
this.mt[0] = s >>> 0
|
|
19
|
-
for (this.mti = 1; this.mti < this.N; this.mti++) {
|
|
20
|
-
s = this.mt[this.mti - 1] ^ (this.mt[this.mti - 1] >>> 30)
|
|
21
|
-
this.mt[this.mti] = (((((s & 0xffff0000) >>> 16) * 1812433253) << 16) + (s & 0x0000ffff) * 1812433253) + this.mti
|
|
22
|
-
/* See Knuth TAOCP Vol2. 3rd Ed. P.106 for multiplier. */
|
|
23
|
-
/* In the previous versions, MSBs of the seed affect */
|
|
24
|
-
/* only MSBs of the array mt[]. */
|
|
25
|
-
/* 2002/01/09 modified by Makoto Matsumoto */
|
|
26
|
-
this.mt[this.mti] >>>= 0
|
|
27
|
-
/* for >32 bit machines */
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
/* initialize by an array with array-length */
|
|
31
|
-
/* init_key is the array for initializing keys */
|
|
32
|
-
/* key_length is its length */
|
|
33
|
-
/* slight change for C++, 2004/2/26 */
|
|
34
|
-
MersenneTwister.prototype.init_by_array = function (init_key, key_length) {
|
|
35
|
-
let i = 1; let j = 0; let k; let s
|
|
36
|
-
this.init_genrand(19650218)
|
|
37
|
-
k = (this.N > key_length ? this.N : key_length)
|
|
38
|
-
for (; k; k--) {
|
|
39
|
-
s = this.mt[i - 1] ^ (this.mt[i - 1] >>> 30)
|
|
40
|
-
this.mt[i] = (this.mt[i] ^ (((((s & 0xffff0000) >>> 16) * 1664525) << 16) + ((s & 0x0000ffff) * 1664525))) + init_key[j] + j /* non linear */
|
|
41
|
-
this.mt[i] >>>= 0 /* for WORDSIZE > 32 machines */
|
|
42
|
-
i++
|
|
43
|
-
j++
|
|
44
|
-
if (i >= this.N) {
|
|
45
|
-
this.mt[0] = this.mt[this.N - 1]
|
|
46
|
-
i = 1
|
|
47
|
-
}
|
|
48
|
-
if (j >= key_length) {
|
|
49
|
-
j = 0
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
for (k = this.N - 1; k; k--) {
|
|
53
|
-
s = this.mt[i - 1] ^ (this.mt[i - 1] >>> 30)
|
|
54
|
-
this.mt[i] = (this.mt[i] ^ (((((s & 0xffff0000) >>> 16) * 1566083941) << 16) + (s & 0x0000ffff) * 1566083941)) - i /* non linear */
|
|
55
|
-
this.mt[i] >>>= 0 /* for WORDSIZE > 32 machines */
|
|
56
|
-
i++
|
|
57
|
-
if (i >= this.N) {
|
|
58
|
-
this.mt[0] = this.mt[this.N - 1]
|
|
59
|
-
i = 1
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
this.mt[0] = 0x80000000 /* MSB is 1; assuring non-zero initial array */
|
|
63
|
-
}
|
|
64
|
-
/* generates a random number on [0,0xffffffff]-interval */
|
|
65
|
-
MersenneTwister.prototype.genrand_int32 = function () {
|
|
66
|
-
let y
|
|
67
|
-
const mag01 = [0x0, this.MATRIX_A]
|
|
68
|
-
/* mag01[x] = x * MATRIX_A for x=0,1 */
|
|
69
|
-
if (this.mti >= this.N) { /* generate N words at one time */
|
|
70
|
-
let kk
|
|
71
|
-
if (this.mti === this.N + 1) { /* if init_genrand() has not been called, */
|
|
72
|
-
this.init_genrand(5489) /* a default initial seed is used */
|
|
73
|
-
}
|
|
74
|
-
for (kk = 0; kk < this.N - this.M; kk++) {
|
|
75
|
-
y = (this.mt[kk] & this.UPPER_MASK) | (this.mt[kk + 1] & this.LOWER_MASK)
|
|
76
|
-
this.mt[kk] = this.mt[kk + this.M] ^ (y >>> 1) ^ mag01[y & 0x1]
|
|
77
|
-
}
|
|
78
|
-
for (; kk < this.N - 1; kk++) {
|
|
79
|
-
y = (this.mt[kk] & this.UPPER_MASK) | (this.mt[kk + 1] & this.LOWER_MASK)
|
|
80
|
-
this.mt[kk] = this.mt[kk + (this.M - this.N)] ^ (y >>> 1) ^ mag01[y & 0x1]
|
|
81
|
-
}
|
|
82
|
-
y = (this.mt[this.N - 1] & this.UPPER_MASK) | (this.mt[0] & this.LOWER_MASK)
|
|
83
|
-
this.mt[this.N - 1] = this.mt[this.M - 1] ^ (y >>> 1) ^ mag01[y & 0x1]
|
|
84
|
-
this.mti = 0
|
|
85
|
-
}
|
|
86
|
-
y = this.mt[this.mti++]
|
|
87
|
-
/* Tempering */
|
|
88
|
-
y ^= (y >>> 11)
|
|
89
|
-
y ^= (y << 7) & 0x9d2c5680
|
|
90
|
-
y ^= (y << 15) & 0xefc60000
|
|
91
|
-
y ^= (y >>> 18)
|
|
92
|
-
return y >>> 0
|
|
93
|
-
}
|
|
94
|
-
/* generates a random number on [0,0x7fffffff]-interval */
|
|
95
|
-
MersenneTwister.prototype.genrand_int31 = function () {
|
|
96
|
-
return (this.genrand_int32() >>> 1)
|
|
97
|
-
}
|
|
98
|
-
/* generates a random number on [0,1]-real-interval */
|
|
99
|
-
MersenneTwister.prototype.genrand_real1 = function () {
|
|
100
|
-
return this.genrand_int32() * (1.0 / 4294967295.0)
|
|
101
|
-
/* divided by 2^32-1 */
|
|
102
|
-
}
|
|
103
|
-
/* generates a random number on [0,1)-real-interval */
|
|
104
|
-
MersenneTwister.prototype.random = function () {
|
|
105
|
-
return this.genrand_int32() * (1.0 / 4294967296.0)
|
|
106
|
-
/* divided by 2^32 */
|
|
107
|
-
}
|
|
108
|
-
/* generates a random number on (0,1)-real-interval */
|
|
109
|
-
MersenneTwister.prototype.genrand_real3 = function () {
|
|
110
|
-
return (this.genrand_int32() + 0.5) * (1.0 / 4294967296.0)
|
|
111
|
-
/* divided by 2^32 */
|
|
112
|
-
}
|
|
113
|
-
/* generates a random number on [0,1) with 53-bit resolution */
|
|
114
|
-
MersenneTwister.prototype.genrand_res53 = function () {
|
|
115
|
-
const a = this.genrand_int32() >>> 5; const b = this.genrand_int32() >>> 6
|
|
116
|
-
return (a * 67108864.0 + b) * (1.0 / 9007199254740992.0)
|
|
117
|
-
}
|
|
118
|
-
export default MersenneTwister
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { randomNumber } from './helpers'
|
|
2
|
-
import { BACKGROUND_COLORS, TEXT_COLORS } from './helpers/colors'
|
|
3
|
-
|
|
4
|
-
export const useColorByLetters = (params?: { value?: string }) => {
|
|
5
|
-
const value = params?.value ?? '';
|
|
6
|
-
const key = randomNumber({ value, min: 0, max: 19 })
|
|
7
|
-
|
|
8
|
-
const getCustomColors = (text: string) => {
|
|
9
|
-
const key = randomNumber({ text, min: 0, max: 19 })
|
|
10
|
-
return {
|
|
11
|
-
key,
|
|
12
|
-
color: TEXT_COLORS[key],
|
|
13
|
-
borderColor: TEXT_COLORS[key],
|
|
14
|
-
bgColor: BACKGROUND_COLORS[key]
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
return {
|
|
18
|
-
key,
|
|
19
|
-
color: TEXT_COLORS[key],
|
|
20
|
-
borderColor: TEXT_COLORS[key],
|
|
21
|
-
bgColor: BACKGROUND_COLORS[key],
|
|
22
|
-
getCustomColors
|
|
23
|
-
}
|
|
24
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
export const useConnection = ({ setConnectionStatus }) => {
|
|
2
|
-
/**
|
|
3
|
-
*
|
|
4
|
-
*/
|
|
5
|
-
async function updateConnectionStatus () {
|
|
6
|
-
if (navigator.onLine) {
|
|
7
|
-
setConnectionStatus(navigator.onLine)
|
|
8
|
-
} else {
|
|
9
|
-
setConnectionStatus(navigator.onLine)
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
if (typeof window !== 'undefined') {
|
|
14
|
-
// Attaching event handler for the online event
|
|
15
|
-
window.addEventListener('online', function () {
|
|
16
|
-
updateConnectionStatus()
|
|
17
|
-
})
|
|
18
|
-
|
|
19
|
-
// Attaching event handler for the offline event
|
|
20
|
-
window.addEventListener('offline', function () {
|
|
21
|
-
updateConnectionStatus()
|
|
22
|
-
})
|
|
23
|
-
}
|
|
24
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { useQuery } from '@apollo/client'
|
|
2
|
-
|
|
3
|
-
import { GET_ALL_COUNTRIES } from './queries'
|
|
4
|
-
/**
|
|
5
|
-
|
|
6
|
-
* Hook personalizado para obtener todos los países.
|
|
7
|
-
*
|
|
8
|
-
* @returns {Object} - Retorna un objeto con la data de los países y cualquier otro estado/error relacionado con la consulta.
|
|
9
|
-
*/
|
|
10
|
-
export function useCountries () {
|
|
11
|
-
const { data, loading, error } = useQuery(GET_ALL_COUNTRIES)
|
|
12
|
-
|
|
13
|
-
// Aquí puedes manejar la lógica adicional que necesites, como mapear la data, manejar errores, etc.
|
|
14
|
-
|
|
15
|
-
return {
|
|
16
|
-
data: data ? data.countries : [],
|
|
17
|
-
loading,
|
|
18
|
-
error
|
|
19
|
-
}
|
|
20
|
-
}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { useMutation, gql } from '@apollo/client'
|
|
2
|
-
|
|
3
|
-
const CREATE_DELIVERY_TIME = gql`
|
|
4
|
-
mutation CreateDeliveryTime($minutes: Int!) {
|
|
5
|
-
createDeliveryTime(minutes: $minutes) {
|
|
6
|
-
success
|
|
7
|
-
message
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
`
|
|
11
|
-
|
|
12
|
-
export const useCreateDeliveryTime = ({
|
|
13
|
-
sendNotification = ({ description, title, backgroundColor }) => {
|
|
14
|
-
return { description, title, backgroundColor }
|
|
15
|
-
}
|
|
16
|
-
}) => {
|
|
17
|
-
const [createDeliveryTimeMutation, { loading, error }] =
|
|
18
|
-
useMutation(CREATE_DELIVERY_TIME)
|
|
19
|
-
|
|
20
|
-
const createDeliveryTime = async (minutes) => {
|
|
21
|
-
try {
|
|
22
|
-
if (!minutes) {
|
|
23
|
-
sendNotification({
|
|
24
|
-
backgroundColor: 'error',
|
|
25
|
-
title: 'Error',
|
|
26
|
-
description: 'The delivery time is required.'
|
|
27
|
-
})
|
|
28
|
-
return
|
|
29
|
-
}
|
|
30
|
-
const { data } = await createDeliveryTimeMutation({
|
|
31
|
-
variables: { minutes: parseInt(minutes) }
|
|
32
|
-
})
|
|
33
|
-
if (data?.createDeliveryTime?.success) {
|
|
34
|
-
sendNotification({
|
|
35
|
-
title: 'Delivery Time Created',
|
|
36
|
-
description: data.createDeliveryTime.message,
|
|
37
|
-
backgroundColor: 'success'
|
|
38
|
-
})
|
|
39
|
-
}
|
|
40
|
-
return data.createDeliveryTime
|
|
41
|
-
} catch (error) {
|
|
42
|
-
sendNotification({
|
|
43
|
-
backgroundColor: 'error',
|
|
44
|
-
title: 'Error',
|
|
45
|
-
description: 'An error occurred while creating the delivery time.'
|
|
46
|
-
})
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
return { createDeliveryTime, loading, error }
|
|
51
|
-
}
|