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,54 +0,0 @@
1
- import { gql } from '@apollo/client'
2
-
3
- export const GET_ALL_FAV_STORE = gql`
4
- query getFavorite {
5
- getFavorite {
6
- fIStoreId
7
- fState
8
- createAt
9
- updateAt
10
- idStore
11
-
12
- getOneStore {
13
- getStoreSchedules {
14
- schId
15
- idStore
16
- schDay
17
- schHoSta
18
- schHoEnd
19
- schState
20
- }
21
- deliveryTimeMinutes
22
- scheduleOpenAll
23
- idStore
24
- cId
25
- id
26
- Image
27
- open
28
- cateStore {
29
- catStore
30
- cName
31
- }
32
- ctId
33
- catStore
34
- dId
35
- storeName
36
- Image
37
- city {
38
- ctId
39
- dId
40
- cName
41
- }
42
- department {
43
- dId
44
- cId
45
- dName
46
- }
47
- pais {
48
- cId
49
- cName
50
- }
51
- }
52
- }
53
- }
54
- `
@@ -1,25 +0,0 @@
1
- /**
2
- * It fetches a json response, and if the response is not ok, it throws an error with the response and
3
- * the data
4
- * @param args - The arguments to pass to fetch.
5
- */
6
- export const fetchJson = async (...args) => {
7
- try {
8
- const response = await fetch(...args)
9
- // if the server replies, there's always some data in json
10
- // if there's a network error, it will throw at the previous line
11
- const data = await response.json()
12
- if (response.ok) {
13
- return data
14
- }
15
- const error = new Error(response.statusText)
16
- error.response = response
17
- error.data = data
18
- throw error
19
- } catch (error) {
20
- if (!error.data) {
21
- error.data = { message: error.message }
22
- }
23
- throw error
24
- }
25
- }
@@ -1,39 +0,0 @@
1
- import React, {
2
- useEffect,
3
- useRef,
4
- useState
5
- } from 'react'
6
-
7
- export const useFetchMoreInteractions = ({
8
- render,
9
- fetchMore = true,
10
- callback = () => {}
11
- }) => {
12
- const loadingRef = useRef()
13
-
14
- const useOnScreen = ref => {
15
- const [isIntersecting, setIsIntersecting] = useState(false)
16
-
17
- const observer = new IntersectionObserver(
18
- ([entry]) => setIsIntersecting(entry.isIntersecting)
19
- )
20
-
21
- useEffect(() => {
22
- if (ref.current) observer.observe(ref.current)
23
- // Remove the observer as soon as the component is unmounted
24
- return () => { observer.disconnect() }
25
- }, [ref, observer])
26
-
27
- return isIntersecting
28
- }
29
-
30
- const isVisible = useOnScreen(loadingRef)
31
-
32
- useEffect(() => {
33
- if (isVisible && fetchMore) callback()
34
- }, [isVisible, callback, fetchMore])
35
-
36
- return <div ref={loadingRef}>
37
- {isVisible && fetchMore ? render || <div style={{ background: 'red' }} >Loading...{isVisible && 'lol'}</div> : <></>}
38
- </div>
39
- }
@@ -1,172 +0,0 @@
1
- // import md5 from 'md5'
2
-
3
- async function getCPUInfo () {
4
- if (navigator.hardwareConcurrency) {
5
- try {
6
- const logicalCores = navigator.hardwareConcurrency
7
- const agent = window.navigator.userAgent
8
- const hyperThreaded = /Intel|Apple/.test(agent) && /Win64|Linux x86_64|MacIntel/.test(agent)
9
-
10
- // Ajustar el número de núcleos lógicos si se sospecha hiperprocesamiento
11
- const physicalCores = hyperThreaded ? logicalCores / 2 : logicalCores
12
-
13
- const cpuInfo = {
14
- logicalCores,
15
- physicalCores,
16
- hyperThreaded
17
- }
18
- return JSON.stringify(cpuInfo)
19
- } catch (error) {
20
- console.error('Error al obtener información de la CPU:', error)
21
- return 'cpu-info-error'
22
- }
23
- } else {
24
- return 'cpu-info-not-available'
25
- }
26
- }
27
-
28
- async function generateFingerprint () {
29
- const canvas = document.createElement('canvas')
30
- const audioContext = new (window.AudioContext || window.webkitAudioContext)()
31
-
32
- const userAgent = navigator.userAgent
33
- const language = navigator.language
34
- const colorDepth = window.screen.colorDepth
35
- const availableScreenHeight = window.screen.availHeight
36
- const platform = navigator.platform
37
- const cpuClass = navigator.cpuClass || 'unknown'
38
-
39
- const canvasFingerprint = await generateCanvasFingerprint(canvas)
40
- const audioFingerprint = await generateAudioFingerprint(audioContext)
41
-
42
- const cpuInfo = await getCPUInfo()
43
- const webGLInfo = await getWebGLInfo()
44
- const fonts = getInstalledFonts()
45
- const touchscreenInfo = getTouchscreenInfo()
46
-
47
- const fingerprintData = {
48
- browser: {
49
- userAgent,
50
- language,
51
- colorDepth,
52
- availableScreenHeight,
53
- plugins: Array.from(navigator.plugins).map(plugin => plugin.name).join(','),
54
- timeZone: Intl.DateTimeFormat().resolvedOptions().timeZone,
55
- hardwareConcurrency: cpuInfo.logicalCores || 'unknown',
56
- platformVersion: navigator.platformVersion || 'unknown'
57
- },
58
- device: {
59
- platform,
60
- cpuClass
61
- },
62
- canvas: canvasFingerprint,
63
- audio: audioFingerprint,
64
- cpu: cpuInfo,
65
- webgl: webGLInfo,
66
- fonts,
67
- touchscreen: touchscreenInfo
68
- }
69
-
70
- const fingerprint = JSON.stringify(fingerprintData)
71
- // const uniqueID = md5(fingerprint)
72
-
73
- return null
74
- }
75
-
76
- // Función para generar huella digital del audio
77
- async function generateAudioFingerprint (audioContext) {
78
- if (audioContext) {
79
- try {
80
- await audioContext.resume()
81
-
82
- // Obtén propiedades del audio que puedas obtener en modo incógnito
83
- const audioProperties = {
84
- isAudioContextAvailable: true
85
- // Agrega más propiedades relevantes aquí
86
- }
87
-
88
- return audioProperties
89
- } catch (error) {
90
- console.error('Error al generar huella digital de audio:', error)
91
- }
92
- }
93
-
94
- return { isAudioContextAvailable: false }
95
- }
96
-
97
- // Función para generar huella digital del canvas
98
- async function generateCanvasFingerprint (canvas) {
99
- if (canvas) {
100
- try {
101
- canvas.width = 200
102
- canvas.height = 200
103
- const context = canvas.getContext('2d')
104
- context.clearRect(0, 0, canvas.width, canvas.height)
105
- context.fillStyle = '#f60'
106
- context.fillRect(125, 1, 62, 20)
107
- context.fillStyle = '#069'
108
- context.font = '16pt Arial'
109
- context.fillText('Cwm fjordbank glyphs vext quiz', 125, 20)
110
-
111
- // Obtén más propiedades del canvas que puedas obtener en modo incógnito
112
- const canvasProperties = {
113
- width: canvas.width,
114
- height: canvas.height
115
- // Agrega más propiedades relevantes aquí
116
- }
117
-
118
- return canvasProperties
119
- } catch (error) {
120
- console.error('Error al generar huella digital del canvas:', error)
121
- }
122
- }
123
-
124
- return { width: 0, height: 0 }
125
- }
126
-
127
- async function getWebGLInfo () {
128
- if ('WebGLRenderingContext' in window) {
129
- const canvas = document.createElement('canvas')
130
- const gl = canvas.getContext('webgl') || canvas.getContext('experimental-webgl')
131
-
132
- if (gl) {
133
- const renderer = gl.getParameter(gl.RENDERER)
134
- const version = gl.getParameter(gl.VERSION)
135
-
136
- // Obtener más información sobre las capacidades WebGL si es necesario
137
-
138
- return `${renderer}-${version}`
139
- }
140
- }
141
-
142
- return 'webgl-info-not-supported'
143
- }
144
-
145
- function getInstalledFonts () {
146
- const fonts = []
147
-
148
- if ('fonts' in document) {
149
- document.fonts.forEach(font => {
150
- fonts.push(font.family)
151
- })
152
- }
153
-
154
- return fonts.join(',')
155
- }
156
-
157
- function getTouchscreenInfo () {
158
- if ('maxTouchPoints' in navigator) {
159
- const maxTouchPoints = navigator.maxTouchPoints
160
- const touchEvent = 'ontouchstart' in window ? 'true' : 'false'
161
-
162
- return `${maxTouchPoints}-${touchEvent}`
163
- }
164
-
165
- return 'touchscreen-info-not-supported'
166
- }
167
-
168
- export async function fingerprintJs () {
169
- const fingerprint = await generateFingerprint()
170
- // const uniqueID = md5(fingerprint)
171
- return null
172
- }
@@ -1,116 +0,0 @@
1
- import {
2
- useCallback,
3
- useEffect,
4
- useState
5
- } from 'react'
6
- import { validationSubmitHooks } from '../../utils'
7
- /**
8
- * @version 0.0.1
9
- * @description Hook con herramientas de validación y eventos de cambio
10
- * @return {Array} devuelve la función onChange a ejecutar y el estado de error de cada input
11
- */
12
- export const useFormTools = ({
13
- initialValues = {},
14
- sendNotification = ({
15
- title = '',
16
- description = '',
17
- backgroundColor = ''
18
- }) => { }
19
- }
20
- = {}) => {
21
- const [dataForm, setDataForm] = useState({ ...initialValues })
22
- const [errorForm, setErrorForm] = useState({})
23
- const [errorSubmit, setErrorSubmit] = useState(false)
24
- const [calledSubmit, setCalledSubmit] = useState(false)
25
- // Handle Change
26
- const handleChange = useCallback((e, error) => {
27
- setDataForm({ ...dataForm, [e.target.name]: e.target.value })
28
- setErrorForm({ ...errorForm, [e.target.name]: error })
29
- }, [setDataForm, dataForm, errorForm, setErrorForm])
30
-
31
- // Forzar datos desde una ventana externa
32
- const handleForcedData = useCallback(data => {
33
- setDataForm(data)
34
- }, [setDataForm])
35
-
36
- // Forzar datos de error desde una ventana externa
37
- const setForcedError = useCallback(errors => {
38
- setErrorForm(errors)
39
- }, [setErrorForm])
40
-
41
- // Handle submit, al enviar formulario
42
- const listErrors = Object.values(errorForm)
43
- const errors = listErrors.find((error) => {
44
- return error === true
45
- })
46
-
47
- const handleSubmit = ({
48
- event,
49
- msgError = '',
50
- msgSuccess,
51
- action = () => { return Promise.resolve() },
52
- actionAfterSuccess = () => { }
53
- }) => {
54
- event.preventDefault()
55
- setCalledSubmit(true)
56
- let errSub = false
57
-
58
- // Valida los errores locales
59
- for (const x in errorForm) {
60
- if (errorForm[x]) errSub = true
61
- }
62
- if (errSub) {
63
- sendNotification({
64
- description: 'Completa los campos requeridos',
65
- title: 'Error',
66
- backgroundColor: 'error'
67
- })
68
- }
69
- if (errors) {
70
- setErrorSubmit(true)
71
- return setForcedError({ ...errorForm })
72
- }
73
-
74
- if (errSub) return setErrorSubmit(errSub)
75
-
76
- // Valida los errores desde el evento
77
- const errores = validationSubmitHooks(event.target.elements)
78
- setErrorForm(errores)
79
- for (const x in errores) {
80
- if (errores[x]) errSub = true
81
- }
82
- if (errSub) return setErrorSubmit(errSub)
83
-
84
- // Ejecuta la accion si es válido
85
- if (!errSub && typeof action === 'function') {
86
- const result = action()
87
- if (result && typeof result.then === 'function') {
88
- result.then((res) => {
89
- if (res) {
90
- sendNotification({
91
- message: msgSuccess ?? 'Operación exitosa',
92
- description: 'Operación exitosa',
93
- backgroundColor: 'success'
94
- })
95
- if (actionAfterSuccess) actionAfterSuccess()
96
- }
97
- }).catch((e) => {
98
- sendNotification({
99
- title: msgError || e?.message || 'Ha ocurrido un error',
100
- backgroundColor: 'error'
101
- })
102
- })
103
- }
104
- }
105
-
106
- setErrorSubmit(errSub)
107
- }
108
-
109
- useEffect(() => { return setCalledSubmit(false) }, [calledSubmit])
110
- useEffect(() => {
111
- return setCalledSubmit(false)
112
- },
113
- [])
114
-
115
- return [handleChange, handleSubmit, handleForcedData, { dataForm, errorForm, errorSubmit, calledSubmit, setForcedError }]
116
- }
@@ -1,86 +0,0 @@
1
- export const useFormatDate = ({
2
- date,
3
- local = 'ES-CO'
4
- } = {}) => {
5
- const dateToFormat = new Date(date ?? Date.now())
6
- const fullDate = dateToFormat.toLocaleDateString(local, { year: 'numeric', month: '2-digit', day: '2-digit' })
7
- const day = fullDate.split('/')[0]
8
- const month = fullDate.split('/')[1]
9
- const year = fullDate.split('/')[2]
10
- const yearMonthDay = dateToFormat.toLocaleDateString('ES-CO')
11
- const numberDay = dateToFormat.getDay()
12
- const shortDayName = dateToFormat.toLocaleDateString(local, { weekday: 'short' })
13
- const longDayName = dateToFormat.toLocaleDateString(local, { weekday: 'long' })
14
- const hourMinutes12 = dateToFormat.toLocaleTimeString('ES-CO', { hour: '2-digit', minute: '2-digit' })
15
- const hourMinutes24 = dateToFormat.toLocaleTimeString('ES-CO', { hour: '2-digit', minute: '2-digit', hour12: false })
16
- const handleHourPmAM = (hour) => {
17
- const hourPmAm = new Date(`1/1/1999 ${hour}`).toLocaleString('en-US', { hour: 'numeric', minute: 'numeric', hour12: true })
18
- return hour ? hourPmAm : ''
19
- }
20
- /**
21
- * Formats a date into Colombian time zone and Spanish locale for POS display.
22
- * Example output: "15 de mayo de 2025 a las 14:23"
23
- *
24
- * @param {string | number | Date} dateInput - Date to format (ISO string, timestamp or Date object)
25
- * @returns {string} - Formatted date string in Colombian time
26
- */
27
- function formatDateInTimeZone (dateInput) {
28
- const timeZone = 'America/Bogota'
29
- const locale = 'es-CO'
30
- const options = {
31
- timeZone,
32
- year: 'numeric',
33
- month: 'long',
34
- day: '2-digit',
35
- hour: '2-digit',
36
- minute: '2-digit',
37
- hour12: false
38
- }
39
-
40
- const date = new Date(dateInput)
41
- const formatted = new Intl.DateTimeFormat(locale, options).format(date)
42
-
43
- // Cambiar coma por "a las" para mejor legibilidad
44
- return formatted.replace(',', ' a las')
45
- }
46
- /**
47
- * Formats a date into YYYY-MM-DD using a given IANA timezone.
48
- *
49
- * @param {string | number | Date} inputDate - The date to format.
50
- * @param {string} timeZone - IANA timezone string (default is "America/Bogota").
51
- * @returns {string} Formatted date string in YYYY-MM-DD.
52
- * @throws {Error} If the input date is invalid.
53
- */
54
- const formatToLocalDateYMD = (inputDate, timeZone = 'America/Bogota') => {
55
- const date = new Date(inputDate)
56
-
57
- if (isNaN(date.getTime())) {
58
- throw new Error('Invalid date input provided to formatToLocalDateYMD')
59
- }
60
-
61
- const localDateStr = date.toLocaleString('en-US', { timeZone })
62
- const localDate = new Date(localDateStr)
63
-
64
- const year = localDate.getFullYear()
65
- const month = String(localDate.getMonth() + 1).padStart(2, '0')
66
- const day = String(localDate.getDate()).padStart(2, '0')
67
-
68
- return `${year}-${month}-${day}`
69
- }
70
-
71
- return {
72
- day,
73
- fullDate,
74
- formatToLocalDateYMD,
75
- hourMinutes12,
76
- numberDay,
77
- yearMonthDay,
78
- hourMinutes24,
79
- longDayName,
80
- shortDayName,
81
- month,
82
- year,
83
- handleHourPmAM,
84
- formatDateInTimeZone
85
- }
86
- }
@@ -1,23 +0,0 @@
1
- /**
2
- * Description
3
- * @param {any} phoneNumber type number or string
4
- * @returns {any}
5
- */
6
- export const formatPhoneNumber = (phoneNumber) => {
7
- const cleaned = ('' + phoneNumber).replace(/\D/g, '')
8
- const match = cleaned.match(/^(\d{3})(\d{3})(\d{4})$/)
9
- if (match) {
10
- return `(${match[1]}) ${match[2]}-${match[3]}`
11
- }
12
- return phoneNumber
13
- }
14
-
15
- /**
16
- * Description
17
- * @param {any} phoneNumber type number or string
18
- * @returns {any}
19
- */
20
- export const validatePhoneNumber = (phoneNumber) => {
21
- const regex = /^\(\d{3}\) \d{3}-\d{4}$/
22
- return regex.test(phoneNumber)
23
- }
@@ -1,65 +0,0 @@
1
- import React, { useState, useRef, useEffect } from 'react'
2
- import styled from 'styled-components'
3
-
4
- export const useFullscreenMode = () => {
5
- const [isFullscreen, setFullscreen] = useState(false)
6
- const elementRef = useRef()
7
-
8
- useEffect(() => {
9
- const changeHandler = () => { return setFullscreen(mode => { return !mode }) }
10
-
11
- document.addEventListener('fullscreenchange', changeHandler, false)
12
- document.addEventListener('mozfullscreenchange', changeHandler, false)
13
- document.addEventListener('MSFullScreenChange', changeHandler, false)
14
- document.addEventListener(
15
- 'webkitfullscreenchange',
16
- changeHandler,
17
- false
18
- )
19
-
20
- return () => {
21
- document.removeEventListener('fullscreenchange', changeHandler)
22
- document.removeEventListener('mozfullscreenchange', changeHandler)
23
- document.removeEventListener('MSFullScreenChange', changeHandler)
24
- document.removeEventListener(
25
- 'webkitfullscreenchange',
26
- changeHandler
27
- )
28
- }
29
- }, [])
30
-
31
- const goFullscreen = () => {
32
- if (elementRef.current.requestFullscreen) {
33
- elementRef.current.requestFullscreen()
34
- } else if (elementRef.current.mozRequestFullscreen) {
35
- // Firefox
36
- elementRef.current.mozRequestFullscreen()
37
- } else if (elementRef.current.webkitRequestFullscreen) {
38
- // Chrome, safari, opera
39
- elementRef.current.webkitRequestFullscreen()
40
- } else if (elementRef.current.msRequestFullscreen) {
41
- // IE, edge
42
- elementRef.current.msRequestFullscreen()
43
- }
44
- }
45
-
46
- const exitFullScreen = () => {
47
- if (document.exitFullscreen) {
48
- document.exitFullscreen()
49
- } else if (document.mozCancelFullScreen) {
50
- document.mozCancelFullScreen()
51
- } else if (document.webkitExitFullscreen) {
52
- document.webkitExitFullscreen()
53
- } else if (document.msExitFullscreen) {
54
- document.msExitFullscreen()
55
- }
56
- }
57
-
58
- const ToggleIcon = (
59
- <Button onDoubleClick={() => { return (!isFullscreen ? goFullscreen() : exitFullScreen()) }}>{!isFullscreen ? 'FullScreen' : 'Normal'}</Button>
60
- )
61
- return [elementRef, ToggleIcon] // Icon, ref
62
- }
63
- const Button = styled.button`
64
-
65
- `
@@ -1,17 +0,0 @@
1
- const addButtonValues = (values, max) => {
2
- const value1 = values.splice(Math.floor(Math.random() * (max - 0)) + 0, 1)
3
- return { max: max - 2, values: [value1] }
4
- }
5
-
6
- export const useGenerateNumberArray = () => {
7
- const values = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
8
- let max = 9
9
- const buttons = Array.from(Array(10)).map(() => {
10
- return Array.from(Array(1)).map(() => {
11
- const buttonValues = addButtonValues(values, max)
12
- max = buttonValues.max
13
- return buttonValues.values
14
- })
15
- })
16
- return buttons
17
- }
@@ -1,12 +0,0 @@
1
- import { useQuery } from '@apollo/client'
2
- import { GET_ALL_LOCATIONS } from './queries'
3
-
4
- /**
5
- * useGetAllLocationUser
6
- * @returns {any}
7
- */
8
- export const useGetAllLocationUser = () => {
9
- const { data, loading } = useQuery(GET_ALL_LOCATIONS)
10
-
11
- return [data, { loading }]
12
- }
@@ -1,44 +0,0 @@
1
- import { gql } from '@apollo/client';
2
-
3
- export const GET_ALL_LOCATIONS = gql`
4
-
5
- query getUserLocations {
6
- getUserLocations {
7
- locationId
8
- # id
9
- cId
10
- dId
11
- ctId
12
- uLatitud
13
- uLongitude
14
- uLocationKnow
15
- uPiso
16
- DatCre
17
- DatMod
18
- pais {
19
- cId
20
- cName
21
- cCalCod
22
- cState
23
- cDatCre
24
- cDatMod
25
- }
26
- city {
27
- ctId
28
- dId
29
- cName
30
- cState
31
- cDatCre
32
- cDatMod
33
- }
34
- department {
35
- dId
36
- cId
37
- dName
38
- dState
39
- dDatCre
40
- dDatMod
41
- }
42
- }
43
- }
44
- `
@@ -1,43 +0,0 @@
1
- import Cookies from 'js-cookie'
2
-
3
- export const useGetCookies = () => {
4
- const getCookies = (cookieNames) => {
5
- try {
6
- if (!Array.isArray(cookieNames)) {
7
- throw new Error('Input cookie names should be an array.')
8
- }
9
-
10
- const cookiesData = []
11
-
12
- for (const cookieName of cookieNames) {
13
- const cookieValue = Cookies.get(cookieName)
14
- if (cookieValue) {
15
- cookiesData.push({ name: cookieName, value: cookieValue })
16
- }
17
- }
18
- return cookiesData
19
- } catch (error) {
20
- console.error('Error al traer las cookies:', error)
21
- return []
22
- }
23
- }
24
-
25
- const getCookie = (cookieName) => {
26
- try {
27
- if (typeof cookieName !== 'string') {
28
- throw new Error('Input cookie name should be a string.')
29
- }
30
-
31
- const cookieValue = Cookies.get(cookieName)
32
- if (cookieValue) {
33
- return { name: cookieName, value: cookieValue }
34
- }
35
- return null
36
- } catch (error) {
37
- console.error('Error al traer la cookie:', error)
38
- return null
39
- }
40
- }
41
-
42
- return { getCookies, getCookie }
43
- }