npm-pkg-hook 1.12.3 → 1.12.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (315) hide show
  1. package/dist/index.cjs +20089 -0
  2. package/dist/index.js +19854 -0
  3. package/dist/index.mjs +19854 -0
  4. package/package.json +28 -6
  5. package/.babelrc +0 -0
  6. package/.env +0 -5
  7. package/.eslintrc.js +0 -38
  8. package/.eslintrc.json +0 -127
  9. package/.github/pull_request_template.md +0 -18
  10. package/.github/workflows/pepeline.yaml +0 -30
  11. package/expire.json +0 -1
  12. package/jsconfig.json +0 -28
  13. package/script.txt +0 -7
  14. package/src/config/client/errors.js +0 -26
  15. package/src/config/client/index.js +0 -1
  16. package/src/config/content/en.json +0 -5
  17. package/src/config/content/es.json +0 -5
  18. package/src/config/content/index.js +0 -16
  19. package/src/cookies/index.js +0 -3
  20. package/src/hooks/addTenMinutes/index.js +0 -14
  21. package/src/hooks/calculateLogLatHaversine/index.js +0 -30
  22. package/src/hooks/completeSchedules/index.js +0 -22
  23. package/src/hooks/convertToMilitaryTime/index.js +0 -14
  24. package/src/hooks/generateStoreURL/index.js +0 -38
  25. package/src/hooks/generateTemplate/index.js +0 -62
  26. package/src/hooks/getCardType/index.js +0 -24
  27. package/src/hooks/getCategoriesWithProduct/helpers/index.js +0 -7
  28. package/src/hooks/getCategoriesWithProduct/index.js +0 -62
  29. package/src/hooks/getGlobalSession/index.js +0 -49
  30. package/src/hooks/getSession/index.js +0 -18
  31. package/src/hooks/getTodayTimestamps/index.js +0 -64
  32. package/src/hooks/getTotalHours/index.js +0 -48
  33. package/src/hooks/handleLogin/index.js +0 -10
  34. package/src/hooks/index.ts +0 -146
  35. package/src/hooks/isTokenExpired/index.js +0 -17
  36. package/src/hooks/newMessageSubscription/index.js +0 -28
  37. package/src/hooks/newStoreOrderSubscription/index.js +0 -26
  38. package/src/hooks/statusOpenStores/helpers/index.js +0 -101
  39. package/src/hooks/statusOpenStores/index.js +0 -156
  40. package/src/hooks/updateExtProductFoodsOptional/index.js +0 -40
  41. package/src/hooks/useAcumulateDate/index.js +0 -16
  42. package/src/hooks/useAllStoresPendingToRegister/index.js +0 -34
  43. package/src/hooks/useAmountInput/index.ts +0 -117
  44. package/src/hooks/useAnimationFrame/index.js +0 -45
  45. package/src/hooks/useAnimationText/index.jsx +0 -31
  46. package/src/hooks/useAsideCart/helpers/index.js +0 -22
  47. package/src/hooks/useAsideCart/index.js +0 -214
  48. package/src/hooks/useAsideCart/queries.js +0 -10
  49. package/src/hooks/useBanner/index.js +0 -19
  50. package/src/hooks/useCart/index.js +0 -2
  51. package/src/hooks/useCart/queries.js +0 -174
  52. package/src/hooks/useCart/useCart/helpers/index.js +0 -75
  53. package/src/hooks/useCart/useCart/index.js +0 -412
  54. package/src/hooks/useCart/useGetCart/index.js +0 -33
  55. package/src/hooks/useCatWithProduct/index.js +0 -48
  56. package/src/hooks/useCatWithProduct/queries.js +0 -200
  57. package/src/hooks/useCatWithProductClient/index.js +0 -56
  58. package/src/hooks/useCatWithProductClient/queries.js +0 -56
  59. package/src/hooks/useCategoriesProduct/index.js +0 -13
  60. package/src/hooks/useCategoriesProduct/queries.js +0 -16
  61. package/src/hooks/useCategoryInStore/index.js +0 -100
  62. package/src/hooks/useCategoryInStore/queries.js +0 -78
  63. package/src/hooks/useCategoryStore/index.js +0 -7
  64. package/src/hooks/useCategoryStore/queries.js +0 -16
  65. package/src/hooks/useChartData/index.js +0 -170
  66. package/src/hooks/useChartData/useChartData/index.js +0 -199
  67. package/src/hooks/useChartData/useChartDataAllOrders/index.js +0 -94
  68. package/src/hooks/useChatRoomSubscription/index.js +0 -28
  69. package/src/hooks/useCheckbox/index.js +0 -115
  70. package/src/hooks/useCities/index.js +0 -13
  71. package/src/hooks/useCities/queries.js +0 -12
  72. package/src/hooks/useClients/index.js +0 -96
  73. package/src/hooks/useClients/queries.js +0 -212
  74. package/src/hooks/useColorByLetters/helpers/alea.js +0 -54
  75. package/src/hooks/useColorByLetters/helpers/colors.js +0 -45
  76. package/src/hooks/useColorByLetters/helpers/index.js +0 -18
  77. package/src/hooks/useColorByLetters/helpers/mersenne_twister.js +0 -118
  78. package/src/hooks/useColorByLetters/index.js +0 -27
  79. package/src/hooks/useConnection/index.js +0 -24
  80. package/src/hooks/useCountries/index.js +0 -19
  81. package/src/hooks/useCountries/queries.js +0 -12
  82. package/src/hooks/useCreateDeliveryTime/index.js +0 -51
  83. package/src/hooks/useCreateOrderStatusType/index.ts +0 -132
  84. package/src/hooks/useCreateProduct/helpers/index.js +0 -23
  85. package/src/hooks/useCreateProduct/helpers/manageCacheDataCatProduct/index.js +0 -52
  86. package/src/hooks/useCreateProduct/helpers/useEditImageProduct/index.js +0 -176
  87. package/src/hooks/useCreateProduct/index.js +0 -334
  88. package/src/hooks/useCreateStorePendingToRegister/index.js +0 -13
  89. package/src/hooks/useCreateStorePendingToRegister/queries.js +0 -10
  90. package/src/hooks/useDashboardComponents/index.js +0 -50
  91. package/src/hooks/useDeleteExtraProductFoods/index.js +0 -12
  92. package/src/hooks/useDeleteSubProductOptional/index.js +0 -30
  93. package/src/hooks/useDeleteSubProductOptional/queries.js +0 -10
  94. package/src/hooks/useDeliveryTime/index.js +0 -27
  95. package/src/hooks/useDepartments/index.js +0 -13
  96. package/src/hooks/useDepartments/queries.js +0 -13
  97. package/src/hooks/useDessert/helpers/index.js +0 -51
  98. package/src/hooks/useDessert/index.js +0 -525
  99. package/src/hooks/useDessertWithPrice/helpers/index.js +0 -76
  100. package/src/hooks/useDessertWithPrice/index.js +0 -373
  101. package/src/hooks/useDessertWithPrice/queries.js +0 -18
  102. package/src/hooks/useDevWS/index.ts +0 -53
  103. package/src/hooks/useDevices/index.js +0 -2
  104. package/src/hooks/useDevices/queries.js +0 -28
  105. package/src/hooks/useDevices/useGetDevices.js +0 -28
  106. package/src/hooks/useDevices/useRegisterDevices.js +0 -75
  107. package/src/hooks/useDownloadReports/helpers/downloadFileFromResponse.ts +0 -21
  108. package/src/hooks/useDownloadReports/index.ts +0 -2
  109. package/src/hooks/useDownloadReports/useDownloadReportByDay/index.ts +0 -103
  110. package/src/hooks/useDownloadReports/useGetReportByDateRange/index.ts +0 -115
  111. package/src/hooks/useDrag/index.js +0 -63
  112. package/src/hooks/useDropzone/index.js +0 -94
  113. package/src/hooks/useDynamicAuth/index.js +0 -13
  114. package/src/hooks/useDynamicAuth/queries.js +0 -24
  115. package/src/hooks/useEditCategory/index.js +0 -41
  116. package/src/hooks/useEditOneExtProductFoodOptional/index.js +0 -28
  117. package/src/hooks/useEditOneExtProductFoodOptional/queries.js +0 -16
  118. package/src/hooks/useEditSubProductOptional/index.js +0 -11
  119. package/src/hooks/useEditSubProductOptional/queries.js +0 -10
  120. package/src/hooks/useEmployee/index.js +0 -17
  121. package/src/hooks/useEmployee/queries.js +0 -85
  122. package/src/hooks/useEmployee/useCreateEmployee.js +0 -86
  123. package/src/hooks/useEvent/index.js +0 -34
  124. package/src/hooks/useFavoriteStores/index.js +0 -29
  125. package/src/hooks/useFavoriteStores/queries.js +0 -54
  126. package/src/hooks/useFetchJson/index.js +0 -25
  127. package/src/hooks/useFetchMoreInteractions/index.jsx +0 -39
  128. package/src/hooks/useFingerprintjs/index.js +0 -172
  129. package/src/hooks/useFormTools/index.js +0 -116
  130. package/src/hooks/useFormatDate/index.js +0 -86
  131. package/src/hooks/useFormatNumberPhone/index.js +0 -23
  132. package/src/hooks/useFullScreenMode/index.js +0 -65
  133. package/src/hooks/useGenerateNumberArray/index.js +0 -17
  134. package/src/hooks/useGetAllLocationUser/index.js +0 -12
  135. package/src/hooks/useGetAllLocationUser/queries.js +0 -44
  136. package/src/hooks/useGetCookies/index.js +0 -43
  137. package/src/hooks/useGetExtProductFoodsSubOptionalAll/index.js +0 -14
  138. package/src/hooks/useGetFoodRecomended/index.js +0 -32
  139. package/src/hooks/useGetFoodRecomended/queries.js +0 -47
  140. package/src/hooks/useGetMessagesToRoom/index.js +0 -23
  141. package/src/hooks/useGetMinPrice/index.js +0 -12
  142. package/src/hooks/useGetMinPrice/queries.js +0 -7
  143. package/src/hooks/useGetOneStoreRating/index.js +0 -40
  144. package/src/hooks/useGetOneStoreRating/queries.js +0 -18
  145. package/src/hooks/useGetSalesAmountToday/index.js +0 -31
  146. package/src/hooks/useGetStoreCookie/index.js +0 -21
  147. package/src/hooks/useGoogleLogin/index.js +0 -160
  148. package/src/hooks/useGoogleLogin/loadScript.js +0 -15
  149. package/src/hooks/useGoogleLogin/removeScript.js +0 -7
  150. package/src/hooks/useHover/index.js +0 -29
  151. package/src/hooks/useImageOptimization/index.js +0 -28
  152. package/src/hooks/useImageUploaderProduct/helper/canvasUtils.ts +0 -130
  153. package/src/hooks/useImageUploaderProduct/helper/getOrientation.ts +0 -53
  154. package/src/hooks/useImageUploaderProduct/helper/index.ts +0 -5
  155. package/src/hooks/useImageUploaderProduct/index.ts +0 -292
  156. package/src/hooks/useImageWeight/index.js +0 -51
  157. package/src/hooks/useImagesStore/index.js +0 -225
  158. package/src/hooks/useImagesStore/queries.js +0 -193
  159. package/src/hooks/useImagesStore/utils/index.js +0 -4
  160. package/src/hooks/useIncomingOrders/index.js +0 -10
  161. package/src/hooks/useIncomingOrders/queries.js +0 -87
  162. package/src/hooks/useInnerHtml/index.js +0 -39
  163. package/src/hooks/useIntersection/index.js +0 -84
  164. package/src/hooks/useInventory/index.js +0 -2
  165. package/src/hooks/useInventory/queries.js +0 -58
  166. package/src/hooks/useInventory/useGetProductsInStock.js +0 -15
  167. package/src/hooks/useInventory/useUpdateManageStock.js +0 -41
  168. package/src/hooks/useKeypress/index.js +0 -28
  169. package/src/hooks/useLazyScript/index.js +0 -71
  170. package/src/hooks/useLocalBackendIp/index.js +0 -34
  171. package/src/hooks/useLocalSorage/index.js +0 -36
  172. package/src/hooks/useLocationManager/index.js +0 -63
  173. package/src/hooks/useLocationNavigate/index.js +0 -54
  174. package/src/hooks/useLoginEmployeeInStore/index.js +0 -38
  175. package/src/hooks/useLogout/helpers/BroadcastChannel.js +0 -31
  176. package/src/hooks/useLogout/helpers/apiBaseUrl.js +0 -8
  177. package/src/hooks/useLogout/helpers/fetchData.js +0 -28
  178. package/src/hooks/useLogout/helpers/getCsrfToken.js +0 -30
  179. package/src/hooks/useLogout/helpers/index.js +0 -57
  180. package/src/hooks/useLogout/helpers/logger.js +0 -70
  181. package/src/hooks/useLogout/helpers/parseUrl.js +0 -36
  182. package/src/hooks/useLogout/index.js +0 -96
  183. package/src/hooks/useManageNewOrder/helpers/index.js +0 -45
  184. package/src/hooks/useManageNewOrder/helpers/mock.js +0 -0
  185. package/src/hooks/useManageNewOrder/index.js +0 -102
  186. package/src/hooks/useManageQueryParams/index.js +0 -40
  187. package/src/hooks/useMobile/index.js +0 -65
  188. package/src/hooks/useModules/helpers/index.js +0 -1
  189. package/src/hooks/useModules/helpers/validateModules.js +0 -29
  190. package/src/hooks/useModules/index.js +0 -58
  191. package/src/hooks/useMouse/index.ts +0 -50
  192. package/src/hooks/useMutateHeight/index.js +0 -36
  193. package/src/hooks/useOrderClient/index.js +0 -5
  194. package/src/hooks/useOrderStatusTypes/index.ts +0 -2
  195. package/src/hooks/useOrderStatusTypes/useOrderStatusTypes/index.ts +0 -133
  196. package/src/hooks/useOrderStatusTypes/useUpdateOrderStatusPriorities/index.ts +0 -97
  197. package/src/hooks/useOrders/index.js +0 -3
  198. package/src/hooks/useOrders/queries.js +0 -89
  199. package/src/hooks/useOrders/useChangeOrderState/index.ts +0 -125
  200. package/src/hooks/useOrders/useOrdersFromStore/index.ts +0 -77
  201. package/src/hooks/usePWAInstall/index.js +0 -38
  202. package/src/hooks/usePortFetcher/index.ts +0 -33
  203. package/src/hooks/useProductsFood/index.js +0 -253
  204. package/src/hooks/useProductsFood/queriesStore.js +0 -964
  205. package/src/hooks/useProductsFood/useEditProduct.js +0 -48
  206. package/src/hooks/useProductsFood/usetagsProducts.js +0 -98
  207. package/src/hooks/useProviders/index.js +0 -3
  208. package/src/hooks/useProviders/queries.js +0 -31
  209. package/src/hooks/useProviders/useProvidersCreateStore/index.js +0 -12
  210. package/src/hooks/useProviders/useProvidersDataStore/index.js +0 -24
  211. package/src/hooks/useProvidersStore/index.js +0 -24
  212. package/src/hooks/useProvidersStore/queries.js +0 -31
  213. package/src/hooks/usePushNotificationOrder/index.js +0 -52
  214. package/src/hooks/usePushNotifications/helpers/index.js +0 -114
  215. package/src/hooks/usePushNotifications/index.js +0 -149
  216. package/src/hooks/useQueryLocationsMap/index.js +0 -19
  217. package/src/hooks/useQueryLocationsMap/queries.js +0 -40
  218. package/src/hooks/useRatingArrayData/index.js +0 -54
  219. package/src/hooks/useRatingArrayData/queries.js +0 -19
  220. package/src/hooks/useReactToPrint/index.js +0 -1223
  221. package/src/hooks/useRemoveExtraProductFoodsOptional/index.js +0 -23
  222. package/src/hooks/useRemoveExtraProductFoodsOptional/queries.js +0 -48
  223. package/src/hooks/useReport/index.js +0 -47
  224. package/src/hooks/useReport/queries.js +0 -123
  225. package/src/hooks/useRestaurant/helpers/index.js +0 -24
  226. package/src/hooks/useRestaurant/helpers/manageStatusOpen.js +0 -26
  227. package/src/hooks/useRestaurant/index.js +0 -69
  228. package/src/hooks/useRestaurant/queries.js +0 -81
  229. package/src/hooks/useRoads/index.js +0 -19
  230. package/src/hooks/useRoads/queries.js +0 -13
  231. package/src/hooks/useRoles/index.js +0 -4
  232. package/src/hooks/useRoles/queries.js +0 -70
  233. package/src/hooks/useRoles/useCreateRole.js +0 -37
  234. package/src/hooks/useRoles/useGetRoles.js +0 -36
  235. package/src/hooks/useRoles/useRemoveRoles.js +0 -40
  236. package/src/hooks/useRoles/useUpdateRolesPriority.js +0 -44
  237. package/src/hooks/useSales/helpers/index.js +0 -55
  238. package/src/hooks/useSales/index.js +0 -1381
  239. package/src/hooks/useSales/queries.js +0 -424
  240. package/src/hooks/useSales/useGetAllSales/index.js +0 -25
  241. package/src/hooks/useSales/useGetSale.js +0 -13
  242. package/src/hooks/useSales/useTotalSales.js +0 -23
  243. package/src/hooks/useSaveAvailableProduct/helpers/index.js +0 -38
  244. package/src/hooks/useSaveAvailableProduct/index.js +0 -31
  245. package/src/hooks/useSaveAvailableProduct/queries.js +0 -10
  246. package/src/hooks/useSaveLocation/index.js +0 -16
  247. package/src/hooks/useSaveLocation/queries.js +0 -19
  248. package/src/hooks/useSchedule/index.js +0 -78
  249. package/src/hooks/useSchedule/index.jsx +0 -22
  250. package/src/hooks/useSchedule/queries.js +0 -43
  251. package/src/hooks/useScheduleData/index.js +0 -123
  252. package/src/hooks/useScroll/index.js +0 -56
  253. package/src/hooks/useScrollRotate/index.js +0 -16
  254. package/src/hooks/useSetImageProducts/index.js +0 -57
  255. package/src/hooks/useSetImageProducts/queries.js +0 -18
  256. package/src/hooks/useSetSession/index.js +0 -44
  257. package/src/hooks/useSetState/index.js +0 -24
  258. package/src/hooks/useSetupSchedule/helpers/index.js +0 -85
  259. package/src/hooks/useSetupSchedule/index.js +0 -272
  260. package/src/hooks/useStatusOpenStore/helpers/index.js +0 -101
  261. package/src/hooks/useStatusOpenStore/index.js +0 -179
  262. package/src/hooks/useStatusOrdersClient/helpers/index.js +0 -14
  263. package/src/hooks/useStatusOrdersClient/index.js +0 -17
  264. package/src/hooks/useStatusOrdersClient/queries.js +0 -80
  265. package/src/hooks/useStockMovements/helpers/index.js +0 -16
  266. package/src/hooks/useStockMovements/index.js +0 -38
  267. package/src/hooks/useStore/index.js +0 -80
  268. package/src/hooks/useStore/queries.js +0 -163
  269. package/src/hooks/useStoreCalendar/index.js +0 -5
  270. package/src/hooks/useStoreContacts/index.js +0 -47
  271. package/src/hooks/useStoreContacts/queries.js +0 -48
  272. package/src/hooks/useStoreTable/index.js +0 -2
  273. package/src/hooks/useStoreTable/queries.js +0 -47
  274. package/src/hooks/useStoreTable/useStoreTableCreate.js +0 -76
  275. package/src/hooks/useStoreTable/useStoreTables.js +0 -14
  276. package/src/hooks/useSubscriptionValidation/index.js +0 -41
  277. package/src/hooks/useTagProducts/index.ts +0 -3
  278. package/src/hooks/useTagProducts/useDeleteOneTag.ts +0 -106
  279. package/src/hooks/useTagProducts/useGetAllTags.ts +0 -68
  280. package/src/hooks/useTagProducts/useRegisterMultipleTags.ts +0 -156
  281. package/src/hooks/useTimeAgo/useTimeAgo.js +0 -39
  282. package/src/hooks/useTokenCards/index.js +0 -41
  283. package/src/hooks/useTopProductsMovements/index.js +0 -27
  284. package/src/hooks/useTotalAllSales/index.js +0 -25
  285. package/src/hooks/useTotalProductsInStock/index.js +0 -23
  286. package/src/hooks/useTotalProductsSold/index.js +0 -23
  287. package/src/hooks/useTotalProductsSolded/index.js +0 -20
  288. package/src/hooks/useUpdateCart/index.js +0 -130
  289. package/src/hooks/useUpdateCartCookie/index.js +0 -43
  290. package/src/hooks/useUpdateDashboardComponent/index.ts +0 -91
  291. package/src/hooks/useUpdateExistingOrders/index.js +0 -85
  292. package/src/hooks/useUpdateExtProductFoodsSubOptional/index.js +0 -60
  293. package/src/hooks/useUpdateModuleOrder/index.js +0 -37
  294. package/src/hooks/useUpdateMultipleExtProduct/index.js +0 -33
  295. package/src/hooks/useUpdateMultipleExtProduct/queries.js +0 -33
  296. package/src/hooks/useUpdateMultipleProducts/index.js +0 -80
  297. package/src/hooks/useUpdateMultipleProducts/queries.js +0 -51
  298. package/src/hooks/useUploadProducts/helpers/index.js +0 -1
  299. package/src/hooks/useUploadProducts/helpers/parseNumber.js +0 -37
  300. package/src/hooks/useUploadProducts/helpers/validateProductDataExcel.js +0 -73
  301. package/src/hooks/useUploadProducts/index.js +0 -422
  302. package/src/hooks/useUpsertGoal/index.js +0 -68
  303. package/src/hooks/useUser/index.js +0 -23
  304. package/src/hooks/useUser/queries.js +0 -131
  305. package/src/hooks/useWeeklyStockMovement/helpers/index.js +0 -32
  306. package/src/hooks/useWeeklyStockMovement/index.js +0 -51
  307. package/src/hooks/useWindowSize/index.js +0 -38
  308. package/src/index.jsx +0 -9
  309. package/src/mock/dessert/index.js +0 -16
  310. package/src/mock/index.js +0 -1
  311. package/src/security/index.js +0 -1
  312. package/src/services/index.js +0 -0
  313. package/src/utils/UtilDateRange.js +0 -31
  314. package/src/utils/index.js +0 -306
  315. package/tsconfig.json +0 -5
@@ -1,96 +0,0 @@
1
- import {
2
- useQuery,
3
- useMutation,
4
- useLazyQuery
5
- } from '@apollo/client'
6
- import {
7
- CREATE_CLIENTS,
8
- DELETE_ONE_CLIENTS,
9
- GET_ALL_CLIENTS,
10
- GET_ONE_CLIENT,
11
- EDIT_ONE_CLIENT
12
- } from './queries'
13
-
14
- export const useGetClients = ({
15
- max,
16
- order = 'DESC',
17
- search,
18
- sendNotification = () => { }
19
- } = {}) => {
20
- const {
21
- loading,
22
- error,
23
- called,
24
- data,
25
- refetch
26
- } = useQuery(GET_ALL_CLIENTS, {
27
- onError: () => {
28
- sendNotification({
29
- title: 'Error',
30
- description: 'Algo salió mal',
31
- backgroundColor: 'error'
32
- })
33
- },
34
- variables: {
35
- search,
36
- max: max || 100,
37
- order
38
- }
39
- })
40
- return [data?.getAllClients || [], {
41
- loading: called ? false : loading,
42
- buttonLoading: loading,
43
- error,
44
- refetch
45
- }]
46
- }
47
-
48
- export const useDeleteClients = ({ sendNotification = () => { } } = {}) => {
49
- const [deleteClient, { loading, error }] = useMutation(DELETE_ONE_CLIENTS)
50
- return [deleteClient, { loading, error }]
51
- }
52
-
53
- export const useCreateClient = ({ sendNotification = () => { } } = {}) => {
54
- const [createClients, { loading, error }] = useMutation(CREATE_CLIENTS, {
55
- onError: (data) => {
56
- sendNotification({
57
- title: '',
58
- description: 'Error',
59
- backgroundColor: 'error'
60
- })
61
- }
62
- })
63
-
64
- return [createClients || [], { loading, error }]
65
- }
66
-
67
- export const useEditClient = ({ sendNotification = () => { } } = {}) => {
68
- const [editOneClient, { loading, error, data }] = useMutation(EDIT_ONE_CLIENT, {
69
- onCompleted: (data) => {
70
- if (data?.editOneClient?.success) {
71
- return sendNotification({
72
- title: 'Éxito',
73
- description: data?.editOneClient?.message,
74
- backgroundColor: 'success'
75
- })
76
- }
77
- },
78
- onError: (data) => {
79
- if (data?.editOneClient) {
80
- return sendNotification({
81
- title: 'Error',
82
- description: data?.editOneClient?.message,
83
- backgroundColor: 'error'
84
- })
85
- }
86
- }
87
- })
88
-
89
- return [editOneClient, { loading, error, data }]
90
- }
91
-
92
- export const useGetOneClient = ({ sendNotification = () => { } } = {}) => {
93
- const [getOneClients, { data, loading, error }] = useLazyQuery(GET_ONE_CLIENT)
94
-
95
- return [getOneClients || [], { loading, error, data }]
96
- }
@@ -1,212 +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
- createAt
31
- updateAt
32
- }
33
- }
34
- }
35
- `
36
- export const DELETE_ONE_CLIENTS = gql`
37
- mutation deleteClient($cliId: ID, $clState: Int!) {
38
- deleteClient(cliId: $cliId, clState: $clState) {
39
- success
40
- message
41
- }
42
- }
43
- `
44
- export const GET_ALL_CLIENTS = gql`
45
- query getAllClients($idStore: ID, $search: String, $min: Int, $max: Int, $fromDate: DateTime, $toDate: DateTime, $page: Int) {
46
- getAllClients(idStore: $idStore, search: $search, min: $min, max: $max, fromDate: $fromDate, toDate: $toDate, page: $page) {
47
- success
48
- message
49
- data {
50
- cliId
51
- idStore
52
- gender
53
- clState
54
- clientNumber
55
- ccClient
56
- clientLastName
57
-
58
- clientName
59
- createAt
60
- updateAt
61
- }
62
- pagination {
63
- totalRecords
64
- totalPages
65
- currentPage
66
- }
67
- errors {
68
- path
69
- message
70
- type
71
- context {
72
- limit
73
- value
74
- label
75
- key
76
- }
77
- }
78
- }
79
- }
80
-
81
-
82
- `
83
- export const GET_ONE_CLIENT = gql`
84
- query getOneClients($cliId: ID) {
85
- getOneClients(cliId: $cliId) {
86
- cliId
87
- idStore
88
- idUser
89
- clState
90
- clientNumber
91
- ClientAddress
92
- gender
93
- ccClient
94
- clientLastName
95
- clientName
96
- createAt
97
- updateAt
98
-
99
- }
100
- }
101
- `
102
-
103
- export const EDIT_ONE_CLIENT = gql`
104
- mutation editOneClient($input: IClients) {
105
- editOneClient(input: $input) {
106
- success
107
- message
108
- }
109
- }
110
- `
111
-
112
- export const CREATE_SHOPPING_CARD = gql`
113
- mutation registerShoppingCard($input: IShoppingCard, $idSubArray: IID_SUB_ITEMS){
114
- registerShoppingCard(input: $input, idSubArray: $idSubArray){
115
- ShoppingCard
116
- id
117
- pId
118
- subProductsId
119
- ShoppingCardRefCode
120
- uuid
121
- discountCardProduct
122
- idUser
123
- cName
124
- idStore
125
- cState
126
- cDatCre
127
- cDatMod
128
- csDescription
129
- cantProducts
130
- comments
131
- # idSubArray
132
- }
133
- }
134
- `
135
- export const CREATE_SHOPPING_CARD_TO_USER_STORE = gql`
136
- mutation registerSalesStore(
137
- $input: [IShoppingCart]
138
- $id: ID
139
- $tableId: ID
140
- $discount: Int
141
- $idStore: ID
142
- $pCodeRef: String
143
- $change: Float
144
- $shoppingCartRefCode: String
145
- $payMethodPState: Int
146
- $pickUp: Int
147
- $totalProductsPrice: Float
148
- $valueDelivery: Float
149
- $idSubArray: IID_SUB_ITEMS
150
- ) {
151
- registerSalesStore(
152
- input: $input
153
- id: $id
154
- tableId: $tableId
155
- discount: $discount
156
- shoppingCartRefCode: $shoppingCartRefCode
157
- idStore: $idStore
158
- pCodeRef: $pCodeRef
159
- change: $change
160
-
161
- payMethodPState: $payMethodPState
162
- pickUp: $pickUp
163
- totalProductsPrice: $totalProductsPrice
164
- valueDelivery: $valueDelivery
165
- idSubArray: $idSubArray
166
- ) {
167
- success
168
- message
169
- errors {
170
- path
171
- message
172
- type
173
- context {
174
- limit
175
- value
176
- label
177
- key
178
- __typename
179
- }
180
- }
181
- data {
182
- pCodeRef
183
- idStore
184
- id
185
- channel
186
- payMethodPState
187
- pSState
188
- createdAt
189
- updatedAt
190
- unidProducts
191
- totalProductsPrice
192
- getOneStore {
193
- idStore
194
- cId
195
- dId
196
- catStore
197
- scheduleOpenAll
198
- dailyGoal
199
- deliveryTimeMinutes
200
- }
201
- getUser {
202
- id
203
- name
204
- email
205
- createdAt
206
- updatedAt
207
- __typename
208
- }
209
- }
210
- }
211
- }
212
- `
@@ -1,54 +0,0 @@
1
- class AleaGen {
2
- constructor (seed) {
3
- if (seed == null) { seed = +(new Date()) }
4
- let n = 0xefc8249d
5
- // Apply the seeding algorithm from Baagoe.
6
- this.c = 1
7
- this.s0 = mash(' ')
8
- this.s1 = mash(' ')
9
- this.s2 = mash(' ')
10
- this.s0 -= mash(seed)
11
- if (this.s0 < 0) {
12
- this.s0 += 1
13
- }
14
- this.s1 -= mash(seed)
15
- if (this.s1 < 0) {
16
- this.s1 += 1
17
- }
18
- this.s2 -= mash(seed)
19
- if (this.s2 < 0) {
20
- this.s2 += 1
21
- }
22
- function mash (data) {
23
- data = String(data)
24
- for (let i = 0; i < data.length; i++) {
25
- n += data.charCodeAt(i)
26
- let h = 0.02519603282416938 * n
27
- n = h >>> 0
28
- h -= n
29
- h *= n
30
- n = h >>> 0
31
- h -= n
32
- n += h * 0x100000000 // 2^32
33
- }
34
- return (n >>> 0) * 2.3283064365386963e-10 // 2^-32
35
- }
36
- }
37
-
38
- next () {
39
- const { c, s0, s1, s2 } = this
40
- const t = 2091639 * s0 + c * 2.3283064365386963e-10 // 2^-32
41
- this.s0 = s1
42
- this.s1 = s2
43
- return this.s2 = t - (this.c = t | 0)
44
- }
45
-
46
- copy (f, t) {
47
- t.c = f.c
48
- t.s0 = f.s0
49
- t.s1 = f.s1
50
- t.s2 = f.s2
51
- return t
52
- }
53
- }
54
- 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,18 +0,0 @@
1
- import MersenneTwister from './mersenne_twister.js'
2
- import AleaGen from './alea.js'
3
-
4
- function minMax (opts) {
5
- const { random, min, max } = opts
6
- return Math.floor(random * (max - min + 1) + min)
7
- }
8
-
9
- export const randomNumber = (opts) => {
10
- const { value, min, max } = opts
11
-
12
- const prepareSeed = new AleaGen(value)
13
- const seedOutput = prepareSeed.s1 * 10000000
14
-
15
- const mersenne = new MersenneTwister(seedOutput)
16
-
17
- return minMax({ random: mersenne.random(), min, max })
18
- }
@@ -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 = new Array(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,27 +0,0 @@
1
- import { randomNumber } from './helpers'
2
- import { BACKGROUND_COLORS, TEXT_COLORS } from './helpers/colors'
3
-
4
- export const useColorByLetters = ({
5
- value = ''
6
- } = {
7
- value: ''
8
- }) => {
9
- const key = randomNumber({ value, min: 0, max: 19 })
10
-
11
- const getCustomColors = (text) => {
12
- const key = randomNumber({ text, min: 0, max: 19 })
13
- return {
14
- key,
15
- color: TEXT_COLORS[key],
16
- borderColor: TEXT_COLORS[key],
17
- bgColor: BACKGROUND_COLORS[key]
18
- }
19
- }
20
- return {
21
- key,
22
- color: TEXT_COLORS[key],
23
- borderColor: TEXT_COLORS[key],
24
- bgColor: BACKGROUND_COLORS[key],
25
- getCustomColors
26
- }
27
- }
@@ -1,24 +0,0 @@
1
- export const useConnection = ({ setConnectionStatus }) => {
2
- async function updateConnectionStatus () {
3
- if (navigator.onLine) {
4
- setConnectionStatus(navigator.onLine)
5
- } else {
6
- setConnectionStatus(navigator.onLine)
7
- }
8
- }
9
-
10
- // Attaching event handler for the load event
11
- // window.addEventListener('load', updateConnectionStatus);
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,19 +0,0 @@
1
- import { useQuery } from '@apollo/client'
2
- import { GET_ALL_COUNTRIES } from './queries'
3
- /**
4
-
5
- * Hook personalizado para obtener todos los países.
6
- *
7
- * @returns {Object} - Retorna un objeto con la data de los países y cualquier otro estado/error relacionado con la consulta.
8
- */
9
- export function useCountries () {
10
- const { data, loading, error } = useQuery(GET_ALL_COUNTRIES)
11
-
12
- // Aquí puedes manejar la lógica adicional que necesites, como mapear la data, manejar errores, etc.
13
-
14
- return {
15
- data: data ? data.countries : [],
16
- loading,
17
- error
18
- }
19
- }
@@ -1,12 +0,0 @@
1
- import { gql } from '@apollo/client'
2
-
3
- export const GET_ALL_COUNTRIES = gql`
4
- query countries {
5
- countries {
6
- cId
7
- cName
8
- cCalCod
9
- cState
10
- }
11
- }
12
- `
@@ -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
- }