npm-pkg-hook 1.12.4 → 1.12.8

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 (354) hide show
  1. package/dist/index.js +57529 -0
  2. package/dist/index.js.map +1 -0
  3. package/dist/index.mjs +57315 -0
  4. package/dist/index.mjs.map +1 -0
  5. package/eslint.config.mts +153 -0
  6. package/package.json +30 -45
  7. package/src/config/client/errors.ts +39 -0
  8. package/src/hooks/addTenMinutes/{index.js → index.ts} +4 -4
  9. package/src/hooks/calculateLogLatHaversine/{index.js → index.ts} +15 -4
  10. package/src/hooks/completeSchedules/{index.js → index.ts} +4 -4
  11. package/src/hooks/convertToMilitaryTime/index.ts +18 -0
  12. package/src/hooks/generateStoreURL/index.ts +41 -0
  13. package/src/hooks/generateTemplate/{index.js → index.ts} +15 -11
  14. package/src/hooks/getCardType/{index.js → index.ts} +1 -1
  15. package/src/hooks/getCategoriesWithProduct/{index.js → index.ts} +7 -7
  16. package/src/hooks/getGlobalSession/index.ts +69 -0
  17. package/src/hooks/getSession/index.ts +72 -0
  18. package/src/hooks/getTodayTimestamps/{index.js → index.ts} +18 -12
  19. package/src/hooks/getTotalHours/index.ts +76 -0
  20. package/src/hooks/handleLogin/{index.js → index.ts} +4 -0
  21. package/src/hooks/index.ts +8 -2
  22. package/src/hooks/statusOpenStores/helpers/{index.js → index.ts} +24 -1
  23. package/src/hooks/statusOpenStores/index.ts +221 -0
  24. package/src/hooks/updateExtProductFoodsOptional/{index.js → index.ts} +12 -3
  25. package/src/hooks/useAcumulateDate/index.ts +18 -0
  26. package/src/hooks/useAllStoresPendingToRegister/{index.js → index.ts} +3 -0
  27. package/src/hooks/useAmountInput/index.ts +42 -32
  28. package/src/hooks/useAnimationText/{index.jsx → index.ts} +2 -2
  29. package/src/hooks/useAsideCart/{index.js → index.ts} +22 -19
  30. package/src/hooks/useBanner/{index.js → index.ts} +2 -1
  31. package/src/hooks/useCart/useCart/helpers/{index.js → index.ts} +10 -6
  32. package/src/hooks/useCart/useCart/{index.js → index.ts} +29 -17
  33. package/src/hooks/useCart/useGetCart/{index.js → index.ts} +2 -1
  34. package/src/hooks/useCatWithProduct/{index.js → index.ts} +11 -5
  35. package/src/hooks/useCatWithProduct/types/index.ts +104 -0
  36. package/src/hooks/useCatWithProductClient/{index.js → index.ts} +3 -2
  37. package/src/hooks/useCategoriesProduct/{index.js → index.ts} +2 -1
  38. package/src/hooks/useCategoryInStore/index.ts +167 -0
  39. package/src/hooks/useCategoryStore/{index.js → index.ts} +2 -1
  40. package/src/hooks/useCategoryStore/{queries.js → queries.ts} +2 -2
  41. package/src/hooks/useChartData/{index.js → index.ts} +9 -8
  42. package/src/hooks/useChartData/useChartData/{index.js → index.ts} +31 -30
  43. package/src/hooks/useChartData/useChartDataAllOrders/{index.js → index.ts} +2 -2
  44. package/src/hooks/useCheckbox/{index.js → index.ts} +1 -1
  45. package/src/hooks/useCities/{index.js → index.ts} +2 -1
  46. package/src/hooks/useClients/{index.js → index.ts} +2 -1
  47. package/src/hooks/useClients/{queries.js → queries.ts} +7 -4
  48. package/src/hooks/useColorByLetters/helpers/{alea.js → alea.ts} +19 -0
  49. package/src/hooks/useColorByLetters/helpers/{index.js → index.ts} +5 -1
  50. package/src/hooks/useColorByLetters/helpers/{mersenne_twister.js → mersenne_twister.ts} +1 -1
  51. package/src/hooks/useColorByLetters/{index.js → index.ts} +3 -6
  52. package/src/hooks/useConnection/{index.js → index.ts} +3 -3
  53. package/src/hooks/useCountries/{index.js → index.ts} +2 -1
  54. package/src/hooks/useCreateOrderStatusType/index.ts +8 -6
  55. package/src/hooks/useCreateProduct/helpers/{index.js → index.ts} +1 -1
  56. package/src/hooks/useCreateProduct/helpers/manageCacheDataCatProduct/{index.js → index.ts} +1 -1
  57. package/src/hooks/useCreateProduct/helpers/useEditImageProduct/{index.js → index.ts} +14 -8
  58. package/src/hooks/useCreateProduct/{index.js → index.ts} +22 -19
  59. package/src/hooks/useCreateStorePendingToRegister/{index.js → index.ts} +5 -1
  60. package/src/hooks/useDeleteExtraProductFoods/{index.js → index.ts} +2 -1
  61. package/src/hooks/useDeleteSubProductOptional/{index.js → index.ts} +5 -3
  62. package/src/hooks/useDeliveryTime/{index.js → index.ts} +3 -1
  63. package/src/hooks/useDepartments/{index.js → index.ts} +2 -1
  64. package/src/hooks/useDessert/{index.js → index.ts} +56 -52
  65. package/src/hooks/useDessertWithPrice/helpers/{index.js → index.ts} +4 -4
  66. package/src/hooks/useDessertWithPrice/{index.js → index.ts} +34 -26
  67. package/src/hooks/useDevWS/index.ts +43 -43
  68. package/src/hooks/useDevices/{useGetDevices.js → useGetDevices.ts} +3 -3
  69. package/src/hooks/useDevices/{useRegisterDevices.js → useRegisterDevices.ts} +5 -5
  70. package/src/hooks/useDownloadReports/helpers/downloadFileFromResponse.ts +17 -17
  71. package/src/hooks/useDownloadReports/useDownloadReportByDay/index.ts +4 -2
  72. package/src/hooks/useDownloadReports/useGetReportByDateRange/index.ts +3 -2
  73. package/src/hooks/useDrag/{index.js → index.ts} +16 -0
  74. package/src/hooks/useDropzone/{index.js → index.ts} +2 -2
  75. package/src/hooks/useDynamicAuth/{index.js → index.ts} +2 -1
  76. package/src/hooks/useEditCategory/{index.js → index.ts} +5 -5
  77. package/src/hooks/useEditOneExtProductFoodOptional/index.ts +28 -0
  78. package/src/hooks/useEditOneExtProductFoodOptional/{queries.js → queries.ts} +2 -2
  79. package/src/hooks/useEditSubProductOptional/index.ts +12 -0
  80. package/src/hooks/useEmployee/{index.js → index.ts} +2 -1
  81. package/src/hooks/useEmployee/{queries.js → queries.ts} +1 -1
  82. package/src/hooks/useEmployee/{useCreateEmployee.js → useCreateEmployee.ts} +6 -2
  83. package/src/hooks/useFavoriteStores/{index.js → index.ts} +5 -3
  84. package/src/hooks/useFetchMoreInteractions/index.jsx +26 -26
  85. package/src/hooks/useFilterConfigs/index.ts +173 -0
  86. package/src/hooks/useFingerprintjs/{index.js → index.ts} +29 -4
  87. package/src/hooks/useFormTools/{index.js → index.ts} +38 -11
  88. package/src/hooks/useFormatDate/{index.js → index.ts} +10 -5
  89. package/src/hooks/useFullScreenMode/{index.js → index.ts} +1 -5
  90. package/src/hooks/useGetAllLocationUser/{index.js → index.ts} +2 -1
  91. package/src/hooks/useGetAllLocationUser/{queries.js → queries.ts} +2 -2
  92. package/src/hooks/{useSales/useGetAllSales/index.js → useGetAllSales/index.ts} +3 -2
  93. package/src/hooks/useGetExtProductFoodsSubOptionalAll/{index.js → index.ts} +2 -1
  94. package/src/hooks/useGetFoodRecomended/{index.js → index.ts} +2 -1
  95. package/src/hooks/useGetMinPrice/{index.js → index.ts} +2 -1
  96. package/src/hooks/useGetOneStoreRating/{index.js → index.ts} +2 -1
  97. package/src/hooks/useGetStoreCookie/{index.js → index.ts} +1 -1
  98. package/src/hooks/useGoogleLogin/{index.js → index.ts} +14 -5
  99. package/src/hooks/useHover/{index.js → index.ts} +3 -0
  100. package/src/hooks/useImageOptimization/{index.js → index.ts} +4 -0
  101. package/src/hooks/useImageUploaderProduct/helper/canvasUtils.ts +25 -9
  102. package/src/hooks/useImageUploaderProduct/helper/getOrientation.ts +5 -4
  103. package/src/hooks/useImageUploaderProduct/index.ts +227 -224
  104. package/src/hooks/useImageWeight/{index.js → index.ts} +4 -0
  105. package/src/hooks/useImagesStore/{index.js → index.ts} +7 -5
  106. package/src/hooks/useImagesStore/{queries.js → queries.ts} +1 -1
  107. package/src/hooks/useIncomingOrders/{index.js → index.ts} +2 -1
  108. package/src/hooks/useIncomingOrders/{queries.js → queries.ts} +1 -1
  109. package/src/hooks/useIntersection/{index.js → index.ts} +1 -1
  110. package/src/hooks/useInventory/{queries.js → queries.ts} +2 -2
  111. package/src/hooks/useInventory/{useGetProductsInStock.js → useGetProductsInStock.ts} +2 -1
  112. package/src/hooks/useLazyScript/{index.js → index.ts} +3 -0
  113. package/src/hooks/useLocalSorage/{index.js → index.ts} +3 -3
  114. package/src/hooks/useLocationManager/{index.js → index.ts} +3 -3
  115. package/src/hooks/useLoginEmployeeInStore/{index.js → index.ts} +1 -1
  116. package/src/hooks/useLogout/helpers/BroadcastChannel.ts +74 -0
  117. package/src/hooks/useLogout/helpers/{apiBaseUrl.js → apiBaseUrl.ts} +4 -0
  118. package/src/hooks/useLogout/helpers/{fetchData.js → fetchData.ts} +10 -1
  119. package/src/hooks/useLogout/helpers/{getCsrfToken.js → getCsrfToken.ts} +8 -1
  120. package/src/hooks/useLogout/helpers/{index.js → index.ts} +14 -6
  121. package/src/hooks/useLogout/helpers/{logger.js → logger.ts} +26 -8
  122. package/src/hooks/useLogout/helpers/{parseUrl.js → parseUrl.ts} +5 -2
  123. package/src/hooks/useLogout/{index.js → index.ts} +29 -20
  124. package/src/hooks/useManageNewOrder/helpers/{index.js → index.ts} +1 -1
  125. package/src/hooks/useManageNewOrder/{index.js → index.ts} +6 -4
  126. package/src/hooks/useManageQueryParams/index.ts +120 -0
  127. package/src/hooks/useModules/helpers/{validateModules.js → validateModules.ts} +1 -1
  128. package/src/hooks/useModules/index.ts +124 -0
  129. package/src/hooks/useMouse/index.ts +23 -18
  130. package/src/hooks/useOrderStatusTypes/useOrderStatusTypes/index.ts +1 -1
  131. package/src/hooks/useOrderStatusTypes/useUpdateOrderStatusPriorities/index.ts +7 -5
  132. package/src/hooks/useOrders/{queries.js → queries.ts} +30 -20
  133. package/src/hooks/useOrders/useChangeOrderState/index.ts +79 -76
  134. package/src/hooks/useOrders/useOrdersFromStore/index.ts +4 -3
  135. package/src/hooks/usePaymentMethod/index.ts +3 -0
  136. package/src/hooks/usePaymentMethod/paymentMethod.gql.ts +62 -0
  137. package/src/hooks/usePaymentMethod/paymentMethod.types.ts +28 -0
  138. package/src/hooks/usePaymentMethod/useCreatePaymentMethod/index.ts +25 -0
  139. package/src/hooks/usePaymentMethod/useGetAllPaymentMethods/index.ts +19 -0
  140. package/src/hooks/usePaymentMethod/useGetPaymentMethod/index.ts +26 -0
  141. package/src/hooks/usePrintSaleTicket/index.ts +4 -0
  142. package/src/hooks/useProductsFood/{index.js → index.ts} +115 -27
  143. package/src/hooks/useProductsFood/{queriesStore.js → queriesStore.ts} +1 -1
  144. package/src/hooks/useProductsFood/{useEditProduct.js → useEditProduct.ts} +2 -1
  145. package/src/hooks/useProductsFood/{usetagsProducts.js → usetagsProducts.ts} +6 -3
  146. package/src/hooks/useProviders/useProvidersCreateStore/{index.js → index.ts} +2 -1
  147. package/src/hooks/useProviders/useProvidersDataStore/{index.js → index.ts} +2 -1
  148. package/src/hooks/useProvidersStore/{index.js → index.ts} +2 -1
  149. package/src/hooks/usePushNotificationOrder/{index.js → index.ts} +1 -1
  150. package/src/hooks/usePushNotifications/helpers/{index.js → index.ts} +9 -0
  151. package/src/hooks/usePushNotifications/{index.js → index.ts} +2 -1
  152. package/src/hooks/useQueryLocationsMap/{index.js → index.ts} +2 -1
  153. package/src/hooks/useRatingArrayData/{index.js → index.ts} +4 -4
  154. package/src/hooks/useRatingArrayData/{queries.js → queries.ts} +1 -1
  155. package/src/hooks/useRemoveExtraProductFoodsOptional/{index.js → index.ts} +2 -1
  156. package/src/hooks/useReport/{index.js → index.ts} +2 -1
  157. package/src/hooks/useReport/{queries.js → queries.ts} +2 -53
  158. package/src/hooks/useRestaurant/helpers/{index.js → index.ts} +4 -0
  159. package/src/hooks/useRestaurant/helpers/{manageStatusOpen.js → manageStatusOpen.ts} +1 -1
  160. package/src/hooks/useRestaurant/{index.js → index.ts} +5 -3
  161. package/src/hooks/useRoads/{index.js → index.ts} +2 -1
  162. package/src/hooks/useRoles/{queries.js → queries.ts} +1 -1
  163. package/src/hooks/useRoles/{useCreateRole.js → useCreateRole.ts} +4 -1
  164. package/src/hooks/useRoles/{useGetRoles.js → useGetRoles.ts} +2 -1
  165. package/src/hooks/useSales/helpers/add-product.utils.ts +120 -0
  166. package/src/hooks/useSales/helpers/apply-discount-to-cart.utils.ts +292 -0
  167. package/src/hooks/useSales/helpers/comment-product.utils.ts +41 -0
  168. package/src/hooks/useSales/helpers/constants/index.ts +38 -0
  169. package/src/hooks/useSales/helpers/extras.utils.ts +42 -0
  170. package/src/hooks/useSales/helpers/filterProductsByCarProId.utils.ts +17 -0
  171. package/src/hooks/useSales/helpers/increment-product-quantity.utils.ts +76 -0
  172. package/src/hooks/useSales/helpers/index.ts +3 -0
  173. package/src/hooks/useSales/helpers/initializer.utils.ts +22 -0
  174. package/src/hooks/useSales/helpers/isStockInsufficient.ts +3 -0
  175. package/src/hooks/useSales/helpers/remove-product.utils.test.ts +49 -0
  176. package/src/hooks/useSales/helpers/remove-product.utils.ts +34 -0
  177. package/src/hooks/useSales/helpers/resolveProduct.ts +29 -0
  178. package/src/hooks/useSales/helpers/useAddToCart.ts +64 -0
  179. package/src/hooks/useSales/{index.js → index.ts} +559 -522
  180. package/src/hooks/useSales/{queries.js → queries.ts} +187 -79
  181. package/src/hooks/useSales/types/index.ts +206 -0
  182. package/src/hooks/useSales/types/use-sales.types.ts +8 -0
  183. package/src/hooks/useSales/{useGetSale.js → useGetSale.ts} +10 -2
  184. package/src/hooks/useSales/{useTotalSales.js → useTotalSales.ts} +2 -1
  185. package/src/hooks/useSaveAvailableProduct/helpers/{index.js → index.ts} +4 -4
  186. package/src/hooks/useSaveAvailableProduct/{index.js → index.ts} +2 -1
  187. package/src/hooks/useSaveLocation/{index.js → index.ts} +2 -1
  188. package/src/hooks/useSaveLocation/{queries.js → queries.ts} +1 -1
  189. package/src/hooks/useSchedule/{index.jsx → index.ts} +14 -1
  190. package/src/hooks/useSchedule/{index.js → schedule.ts} +2 -1
  191. package/src/hooks/useScheduleData/{index.js → index.ts} +21 -9
  192. package/src/hooks/useSetImageProducts/{index.js → index.ts} +4 -2
  193. package/src/hooks/useSetupSchedule/{index.js → index.ts} +40 -28
  194. package/src/hooks/useStatusOpenStore/helpers/{index.js → index.ts} +24 -1
  195. package/src/hooks/useStatusOpenStore/{index.js → index.ts} +30 -14
  196. package/src/hooks/useStatusOrdersClient/{index.js → index.ts} +3 -2
  197. package/src/hooks/useStatusOrdersClient/{queries.js → queries.ts} +2 -2
  198. package/src/hooks/useStock/index.ts +1 -0
  199. package/src/hooks/useStock/useStockUpdatedAllSubscription.ts +40 -0
  200. package/src/hooks/useStockMovements/helpers/{index.js → index.ts} +1 -1
  201. package/src/hooks/useStockMovements/{index.js → index.ts} +4 -3
  202. package/src/hooks/useStore/{index.js → index.ts} +30 -27
  203. package/src/hooks/useStoreContacts/{index.js → index.ts} +11 -5
  204. package/src/hooks/useStoreTable/{useStoreTableCreate.js → useStoreTableCreate.ts} +3 -2
  205. package/src/hooks/useStoreTable/{useStoreTables.js → useStoreTables.ts} +2 -1
  206. package/src/hooks/useSubscriptionValidation/index.ts +112 -0
  207. package/src/hooks/useTagProducts/useDeleteOneTag.ts +66 -66
  208. package/src/hooks/useTagProducts/useGetAllTags.ts +2 -2
  209. package/src/hooks/useTagProducts/useRegisterMultipleTags.ts +27 -26
  210. package/src/hooks/useTheme/index.ts +65 -0
  211. package/src/hooks/useTimeAgo/{useTimeAgo.js → useTimeAgo.ts} +7 -7
  212. package/src/hooks/useTokenCards/{index.js → index.ts} +7 -3
  213. package/src/hooks/useUpdateCart/{index.js → index.ts} +3 -2
  214. package/src/hooks/useUpdateCartCookie/{index.js → index.ts} +23 -6
  215. package/src/hooks/useUpdateDashboardComponent/index.ts +11 -11
  216. package/src/hooks/useUpdateExtProductFoodsSubOptional/{index.js → index.ts} +2 -1
  217. package/src/hooks/useUpdateModuleOrder/{index.js → index.ts} +2 -2
  218. package/src/hooks/useUpdateMultipleExtProduct/{index.js → index.ts} +2 -1
  219. package/src/hooks/useUpdateMultipleProducts/{index.js → index.ts} +57 -20
  220. package/src/hooks/useUploadProducts/helpers/{parseNumber.js → parseNumber.ts} +3 -3
  221. package/src/hooks/useUploadProducts/{index.js → index.ts} +89 -69
  222. package/src/hooks/useUpsertGoal/{index.js → index.ts} +1 -1
  223. package/src/hooks/useUser/{index.js → index.ts} +5 -4
  224. package/src/hooks/useWeeklyStockMovement/helpers/{index.js → index.ts} +3 -3
  225. package/src/hooks/useWeeklyStockMovement/{index.js → index.ts} +4 -3
  226. package/src/hooks/useWindowSize/{index.js → index.ts} +9 -2
  227. package/src/index.ts +13 -0
  228. package/src/security/index.ts +1 -0
  229. package/src/services/index.ts +1 -0
  230. package/src/utils/UtilDateRange.ts +56 -0
  231. package/src/utils/generateCode.ts +222 -0
  232. package/src/utils/index.ts +2 -0
  233. package/src/utils/{index.js → utils.ts} +69 -31
  234. package/tsconfig.eslint.json +16 -0
  235. package/tsconfig.json +18 -2
  236. package/tsup.config.ts +24 -0
  237. package/.eslintrc.js +0 -38
  238. package/.eslintrc.json +0 -127
  239. package/src/config/client/errors.js +0 -26
  240. package/src/hooks/convertToMilitaryTime/index.js +0 -14
  241. package/src/hooks/generateStoreURL/index.js +0 -38
  242. package/src/hooks/getGlobalSession/index.js +0 -49
  243. package/src/hooks/getSession/index.js +0 -18
  244. package/src/hooks/getTotalHours/index.js +0 -48
  245. package/src/hooks/statusOpenStores/index.js +0 -156
  246. package/src/hooks/useAcumulateDate/index.js +0 -16
  247. package/src/hooks/useCategoryInStore/index.js +0 -100
  248. package/src/hooks/useEditOneExtProductFoodOptional/index.js +0 -28
  249. package/src/hooks/useEditSubProductOptional/index.js +0 -11
  250. package/src/hooks/useLogout/helpers/BroadcastChannel.js +0 -31
  251. package/src/hooks/useManageQueryParams/index.js +0 -40
  252. package/src/hooks/useModules/index.js +0 -58
  253. package/src/hooks/useSales/helpers/index.js +0 -55
  254. package/src/hooks/useSubscriptionValidation/index.js +0 -41
  255. package/src/index.jsx +0 -9
  256. package/src/security/index.js +0 -1
  257. package/src/utils/UtilDateRange.js +0 -31
  258. /package/src/config/client/{index.js → index.ts} +0 -0
  259. /package/src/config/content/{index.js → index.ts} +0 -0
  260. /package/src/cookies/{index.js → index.ts} +0 -0
  261. /package/src/hooks/getCategoriesWithProduct/helpers/{index.js → index.ts} +0 -0
  262. /package/src/hooks/isTokenExpired/{index.js → index.ts} +0 -0
  263. /package/src/hooks/newMessageSubscription/{index.js → index.ts} +0 -0
  264. /package/src/hooks/newStoreOrderSubscription/{index.js → index.ts} +0 -0
  265. /package/src/hooks/useAnimationFrame/{index.js → index.ts} +0 -0
  266. /package/src/hooks/useAsideCart/helpers/{index.js → index.ts} +0 -0
  267. /package/src/hooks/useAsideCart/{queries.js → queries.ts} +0 -0
  268. /package/src/hooks/useCart/{index.js → index.ts} +0 -0
  269. /package/src/hooks/useCart/{queries.js → queries.ts} +0 -0
  270. /package/src/hooks/useCatWithProduct/{queries.js → queries.ts} +0 -0
  271. /package/src/hooks/useCatWithProductClient/{queries.js → queries.ts} +0 -0
  272. /package/src/hooks/useCategoriesProduct/{queries.js → queries.ts} +0 -0
  273. /package/src/hooks/useCategoryInStore/{queries.js → queries.ts} +0 -0
  274. /package/src/hooks/useChatRoomSubscription/{index.js → index.ts} +0 -0
  275. /package/src/hooks/useCities/{queries.js → queries.ts} +0 -0
  276. /package/src/hooks/useColorByLetters/helpers/{colors.js → colors.ts} +0 -0
  277. /package/src/hooks/useCountries/{queries.js → queries.ts} +0 -0
  278. /package/src/hooks/useCreateDeliveryTime/{index.js → index.ts} +0 -0
  279. /package/src/hooks/useCreateStorePendingToRegister/{queries.js → queries.ts} +0 -0
  280. /package/src/hooks/useDashboardComponents/{index.js → index.ts} +0 -0
  281. /package/src/hooks/useDeleteSubProductOptional/{queries.js → queries.ts} +0 -0
  282. /package/src/hooks/useDepartments/{queries.js → queries.ts} +0 -0
  283. /package/src/hooks/useDessert/helpers/{index.js → index.ts} +0 -0
  284. /package/src/hooks/useDessertWithPrice/{queries.js → queries.ts} +0 -0
  285. /package/src/hooks/useDevices/{index.js → index.ts} +0 -0
  286. /package/src/hooks/useDevices/{queries.js → queries.ts} +0 -0
  287. /package/src/hooks/useDynamicAuth/{queries.js → queries.ts} +0 -0
  288. /package/src/hooks/useEditSubProductOptional/{queries.js → queries.ts} +0 -0
  289. /package/src/hooks/useEvent/{index.js → index.ts} +0 -0
  290. /package/src/hooks/useFavoriteStores/{queries.js → queries.ts} +0 -0
  291. /package/src/hooks/useFetchJson/{index.js → index.ts} +0 -0
  292. /package/src/hooks/useFormatNumberPhone/{index.js → index.ts} +0 -0
  293. /package/src/hooks/useGenerateNumberArray/{index.js → index.ts} +0 -0
  294. /package/src/hooks/useGetCookies/{index.js → index.ts} +0 -0
  295. /package/src/hooks/useGetFoodRecomended/{queries.js → queries.ts} +0 -0
  296. /package/src/hooks/useGetMessagesToRoom/{index.js → index.ts} +0 -0
  297. /package/src/hooks/useGetMinPrice/{queries.js → queries.ts} +0 -0
  298. /package/src/hooks/useGetOneStoreRating/{queries.js → queries.ts} +0 -0
  299. /package/src/hooks/useGetSalesAmountToday/{index.js → index.ts} +0 -0
  300. /package/src/hooks/useGoogleLogin/{loadScript.js → loadScript.ts} +0 -0
  301. /package/src/hooks/useGoogleLogin/{removeScript.js → removeScript.ts} +0 -0
  302. /package/src/hooks/useImagesStore/utils/{index.js → index.ts} +0 -0
  303. /package/src/hooks/useInnerHtml/{index.js → index.ts} +0 -0
  304. /package/src/hooks/useInventory/{index.js → index.ts} +0 -0
  305. /package/src/hooks/useInventory/{useUpdateManageStock.js → useUpdateManageStock.ts} +0 -0
  306. /package/src/hooks/useKeypress/{index.js → index.ts} +0 -0
  307. /package/src/hooks/useLocalBackendIp/{index.js → index.ts} +0 -0
  308. /package/src/hooks/useLocationNavigate/{index.js → index.ts} +0 -0
  309. /package/src/hooks/useManageNewOrder/helpers/{mock.js → mock.ts} +0 -0
  310. /package/src/hooks/useMobile/{index.js → index.ts} +0 -0
  311. /package/src/hooks/useModules/helpers/{index.js → index.ts} +0 -0
  312. /package/src/hooks/useMutateHeight/{index.js → index.ts} +0 -0
  313. /package/src/hooks/useOrderClient/{index.js → index.ts} +0 -0
  314. /package/src/hooks/useOrders/{index.js → index.ts} +0 -0
  315. /package/src/hooks/usePWAInstall/{index.js → index.ts} +0 -0
  316. /package/src/{services/index.js → hooks/useProductsFood/types/index.ts} +0 -0
  317. /package/src/hooks/useProviders/{index.js → index.ts} +0 -0
  318. /package/src/hooks/useProviders/{queries.js → queries.ts} +0 -0
  319. /package/src/hooks/useProvidersStore/{queries.js → queries.ts} +0 -0
  320. /package/src/hooks/useQueryLocationsMap/{queries.js → queries.ts} +0 -0
  321. /package/src/hooks/useReactToPrint/{index.js → index.txt} +0 -0
  322. /package/src/hooks/useRemoveExtraProductFoodsOptional/{queries.js → queries.ts} +0 -0
  323. /package/src/hooks/useRestaurant/{queries.js → queries.ts} +0 -0
  324. /package/src/hooks/useRoads/{queries.js → queries.ts} +0 -0
  325. /package/src/hooks/useRoles/{index.js → index.ts} +0 -0
  326. /package/src/hooks/useRoles/{useRemoveRoles.js → useRemoveRoles.ts} +0 -0
  327. /package/src/hooks/useRoles/{useUpdateRolesPriority.js → useUpdateRolesPriority.ts} +0 -0
  328. /package/src/hooks/useSaveAvailableProduct/{queries.js → queries.ts} +0 -0
  329. /package/src/hooks/useSchedule/{queries.js → queries.ts} +0 -0
  330. /package/src/hooks/useScroll/{index.js → index.ts} +0 -0
  331. /package/src/hooks/useScrollRotate/{index.js → index.ts} +0 -0
  332. /package/src/hooks/useSetImageProducts/{queries.js → queries.ts} +0 -0
  333. /package/src/hooks/useSetSession/{index.js → index.ts} +0 -0
  334. /package/src/hooks/useSetState/{index.js → index.ts} +0 -0
  335. /package/src/hooks/useSetupSchedule/helpers/{index.js → index.ts} +0 -0
  336. /package/src/hooks/useStatusOrdersClient/helpers/{index.js → index.ts} +0 -0
  337. /package/src/hooks/useStore/{queries.js → queries.ts} +0 -0
  338. /package/src/hooks/useStoreCalendar/{index.js → index.ts} +0 -0
  339. /package/src/hooks/useStoreContacts/{queries.js → queries.ts} +0 -0
  340. /package/src/hooks/useStoreTable/{index.js → index.ts} +0 -0
  341. /package/src/hooks/useStoreTable/{queries.js → queries.ts} +0 -0
  342. /package/src/hooks/useTopProductsMovements/{index.js → index.ts} +0 -0
  343. /package/src/hooks/useTotalAllSales/{index.js → index.ts} +0 -0
  344. /package/src/hooks/useTotalProductsInStock/{index.js → index.ts} +0 -0
  345. /package/src/hooks/useTotalProductsSold/{index.js → index.ts} +0 -0
  346. /package/src/hooks/useTotalProductsSolded/{index.js → index.ts} +0 -0
  347. /package/src/hooks/useUpdateExistingOrders/{index.js → index.ts} +0 -0
  348. /package/src/hooks/useUpdateMultipleExtProduct/{queries.js → queries.ts} +0 -0
  349. /package/src/hooks/useUpdateMultipleProducts/{queries.js → queries.ts} +0 -0
  350. /package/src/hooks/useUploadProducts/helpers/{index.js → index.ts} +0 -0
  351. /package/src/hooks/useUploadProducts/helpers/{validateProductDataExcel.js → validateProductDataExcel.ts} +0 -0
  352. /package/src/hooks/useUser/{queries.js → queries.ts} +0 -0
  353. /package/src/mock/dessert/{index.js → index.ts} +0 -0
  354. /package/src/mock/{index.js → index.ts} +0 -0
@@ -1,3 +1,7 @@
1
+ /**
2
+ *
3
+ * @param data
4
+ */
1
5
  export function useScheduleData (data) {
2
6
  const days = {
3
7
  1: 'Lunes',
@@ -20,7 +24,7 @@ export function useScheduleData (data) {
20
24
  ]
21
25
 
22
26
  const combinedArray = daysArray.map((dayObj) => {
23
- const originalObj = data?.find((item) => item.schDay === dayObj.day)
27
+ const originalObj = data?.find((item) => {return item.schDay === dayObj.day})
24
28
  return originalObj || { ...dayObj }
25
29
  })
26
30
 
@@ -39,13 +43,18 @@ export function useScheduleData (data) {
39
43
  }
40
44
 
41
45
  /**
42
- * Calcula la duración en horas entre dos horas de inicio y final.
43
- * @param {string} startTime - Hora de inicio en formato 'HH:mm'.
44
- * @param {string} endTime - Hora de fin en formato 'HH:mm'.
45
- * @returns {number|string} Duración en horas con dos decimales.
46
- */
46
+ * Calcula la duración en horas entre dos horas de inicio y final.
47
+ * @param {string} startTime - Hora de inicio en formato 'HH:mm'.
48
+ * @param {string} endTime - Hora de fin en formato 'HH:mm'.
49
+ * @returns {number|string} Duración en horas con dos decimales.
50
+ */
47
51
 
48
52
  // Función para calcular la duración en horas de un horario
53
+ /**
54
+ *
55
+ * @param startTime
56
+ * @param endTime
57
+ */
49
58
  function calculateDurationInHours (startTime, endTime) {
50
59
  const startHour = new Date(`2000-01-01T${startTime}`)
51
60
  const endHour = new Date(`2000-01-01T${endTime}`)
@@ -57,8 +66,8 @@ export function useScheduleData (data) {
57
66
  const columnIndex = 0
58
67
  const lastDay = -1
59
68
  const uniqueHoursSet = new Set([
60
- ...combinedArray.map((item) => item.schHoSta),
61
- ...combinedArray.map((item) => item.schHoEnd)
69
+ ...combinedArray.map((item) => {return item.schHoSta}),
70
+ ...combinedArray.map((item) => {return item.schHoEnd})
62
71
  ])
63
72
 
64
73
  const uniqueHours = []
@@ -88,7 +97,7 @@ export function useScheduleData (data) {
88
97
  }
89
98
 
90
99
  const dayWidth = 120
91
- const daysWithHours = Array.from(new Set(combinedArray.map((item) => (item.schDay !== undefined ? item.schDay : item.day))))
100
+ const daysWithHours = Array.from(new Set(combinedArray.map((item) => {return (item.schDay !== undefined ? item.schDay : item.day)})))
92
101
  const totalDays = daysWithHours.length
93
102
  const totalWidth = totalDays * dayWidth
94
103
 
@@ -101,6 +110,9 @@ export function useScheduleData (data) {
101
110
 
102
111
  const formattedHours = sortedUniqueHours
103
112
 
113
+ /**
114
+ *
115
+ */
104
116
  function calculateTimeLinesHeight () {
105
117
  const totalHours = uniqueHours.length
106
118
  return totalHours * 60 // Cada hora ocupa 60 píxeles de altura
@@ -1,6 +1,8 @@
1
- import { useMutation, useApolloClient } from '@apollo/client'
1
+ import { useMutation, useApolloClient } from '@apollo/client'
2
+
3
+ import { GET_ONE_PRODUCTS_FOOD } from '../useProductsFood/queriesStore'
4
+
2
5
  import { UPDATE_IMAGE_PRODUCT_FOOD } from './queries'
3
- import { GET_ONE_PRODUCTS_FOOD } from '../useProductsFood/queriesStore'
4
6
 
5
7
  /**
6
8
  * Hook to update product image and sync Apollo cache.
@@ -1,13 +1,15 @@
1
1
  import { useEffect, useState } from 'react'
2
+
3
+ import { days as NameDays } from '../../utils'
4
+ import { convertToMilitaryTime } from '../convertToMilitaryTime'
5
+ import { useSchedules, useCreateSchedules } from '../useSchedule'
6
+ import { GET_ONE_SCHEDULE_STORE, GET_SCHEDULE_STORE } from '../useSchedule/queries'
7
+
2
8
  import {
3
9
  dateEnum,
4
10
  initialDays,
5
11
  timeSuggestions
6
12
  } from './helpers'
7
- import { useCreateSchedules, useSchedules } from '../useSchedule'
8
- import { days as NameDays } from '../../utils'
9
- import { convertToMilitaryTime } from '../convertToMilitaryTime'
10
- import { GET_ONE_SCHEDULE_STORE, GET_SCHEDULE_STORE } from '../useSchedule/queries'
11
13
  export * from './helpers/index'
12
14
 
13
15
  export const useSetupSchedule = ({
@@ -18,24 +20,24 @@ export const useSetupSchedule = ({
18
20
  const [days, setDays] = useState(initialDays === null ? [] : initialDays)
19
21
  const [alertModal, setAlertModal] = useState(false)
20
22
  const [selectedDay, setSelectedDay] = useState({})
21
- const [setStoreSchedule, { loading }] = useCreateSchedules()
23
+ const [setStoreSchedule] = useCreateSchedules()
22
24
 
23
- const onCompleted = (data) => {
25
+ const onCompleted = (data: any) => {
24
26
  if (Array.isArray(data) && data?.length > 0) {
25
27
  // Mapeamos los datos recibidos y los convertimos en un objeto con la estructura deseada
26
- const newSchedules = data.map((day) => ({
28
+ const newSchedules = data.map((day) => {return {
27
29
  day: day.schDay,
28
30
  name: NameDays[day.schDay],
29
31
  selected: day.schHoEnd !== '00:00' || day.schHoSta !== '00:00',
30
32
  ...day
31
- }))
33
+ }})
32
34
 
33
35
  // Actualizamos el estado days
34
36
  setDays(prevDays => {
35
37
  // Creamos un nuevo array combinando los elementos existentes en days con los nuevos datos
36
38
  const updatedDays = prevDays?.map(existingDay => {
37
39
  // Buscamos si hay un elemento con el mismo día en los nuevos datos
38
- const newData = newSchedules.find(newDay => newDay.day === existingDay.day)
40
+ const newData = newSchedules.find(newDay => {return newDay.day === existingDay.day})
39
41
  // Si encontramos el día en los nuevos datos, lo fusionamos con el día existente
40
42
  if (newData) {
41
43
  return { ...existingDay, ...newData }
@@ -46,7 +48,7 @@ export const useSetupSchedule = ({
46
48
 
47
49
  // Ahora, buscamos los nuevos días que no están en days y los agregamos al array
48
50
  newSchedules.forEach(newDay => {
49
- if (!updatedDays.some(existingDay => existingDay.day === newDay.day)) {
51
+ if (!updatedDays.some(existingDay => {return existingDay.day === newDay.day})) {
50
52
  updatedDays.push(newDay)
51
53
  }
52
54
  })
@@ -68,7 +70,7 @@ export const useSetupSchedule = ({
68
70
  const duplicateDay = (index) => {
69
71
  const selectedDay = days[index]
70
72
  // Lógica para desplegar el modal y seleccionar los días donde se replicará
71
- const selectedDaysToDuplicate = days.filter((day) => day.checked)
73
+ const selectedDaysToDuplicate = days.filter((day) => {return day.checked})
72
74
  const updatedDays = [...days]
73
75
  selectedDaysToDuplicate.forEach((dayToDuplicate) => {
74
76
  const duplicatedDay = { ...selectedDay, checked: false }
@@ -88,15 +90,20 @@ export const useSetupSchedule = ({
88
90
  const updatedDays = days?.map((d) => {
89
91
  if (d.day === day) {
90
92
  return { ...d, selected: !d.selected }
91
- } else {
92
- return { ...d }
93
- }
93
+ }
94
+ return { ...d }
95
+
94
96
  })
95
97
  setDays(updatedDays)
96
98
  }
97
- const selectedDays = days?.filter((day) => Boolean(day.selected)).map((day) => {
99
+ const selectedDays = days?.filter((day) => {return Boolean(day.selected)}).map((day) => {
98
100
  return day.day
99
101
  })
102
+ /**
103
+ *
104
+ * @param hora1
105
+ * @param hora2
106
+ */
100
107
  function sumHours (hora1, hora2) {
101
108
  const [hora1Horas, hora1Minutos] = hora1.split(':').map(Number)
102
109
  const [hora2Horas, hora2Minutos] = hora2.split(':').map(Number)
@@ -116,6 +123,11 @@ export const useSetupSchedule = ({
116
123
  const horaSumada = `${String(sumaHour).padStart(2, '0')}:${String(sumMinutes).padStart(2, '0')}`
117
124
  return horaSumada
118
125
  }
126
+ /**
127
+ *
128
+ * @param hora1
129
+ * @param hora2
130
+ */
119
131
  function isLessThanOneHour (hora1, hora2) {
120
132
  const suma = sumHours(hora1, hora2)
121
133
  const [sumaHour, sumMinutes] = suma.split(':').map(Number)
@@ -131,9 +143,9 @@ export const useSetupSchedule = ({
131
143
  const updatedDays = prevDays?.map((d) => {
132
144
  if (d.day === day) {
133
145
  return { ...d, [name]: time, loading: Boolean(name === dateEnum.schHoEnd) }
134
- } else {
135
- return { ...d }
136
- }
146
+ }
147
+ return { ...d }
148
+
137
149
  })
138
150
 
139
151
  if (name === dateEnum.schHoEnd) {
@@ -145,7 +157,7 @@ export const useSetupSchedule = ({
145
157
  const startHour = convertToMilitaryTime(schHoSta)
146
158
  const endHour = convertToMilitaryTime(schHoEnd)
147
159
  if (isLessThanOneHour(startHour, endHour)) {
148
- // eslint-disable-next-line consistent-return
160
+
149
161
  sendNotification({
150
162
  description: 'Error, el horario debe ser mayor a una hora',
151
163
  title: 'Error',
@@ -154,7 +166,7 @@ export const useSetupSchedule = ({
154
166
  }
155
167
  // Comparar solo las horas y minutos
156
168
  if (startHour === endHour) {
157
- // eslint-disable-next-line consistent-return
169
+
158
170
  sendNotification({
159
171
  description: 'Error, la hora de salida no debe ser igual a la hora final',
160
172
  title: 'Error',
@@ -162,7 +174,7 @@ export const useSetupSchedule = ({
162
174
  })
163
175
  }
164
176
  if (startHour > endHour) {
165
- // eslint-disable-next-line consistent-return
177
+
166
178
  sendNotification({
167
179
  description: 'Error, la hora de salida debe ser mayor que la de entrada',
168
180
  title: 'Error',
@@ -197,9 +209,9 @@ export const useSetupSchedule = ({
197
209
  const newUpdatedDays = updatedDays.map((d) => {
198
210
  if (d.day === day) {
199
211
  return { ...d, loading: false }
200
- } else {
201
- return { ...d }
202
- }
212
+ }
213
+ return { ...d }
214
+
203
215
  })
204
216
  // Devolver el nuevo estado actualizado
205
217
  return newUpdatedDays
@@ -243,9 +255,9 @@ export const useSetupSchedule = ({
243
255
  [dateEnum.schHoSta]: dateEnum?.schHoSta,
244
256
  selected: false
245
257
  }
246
- } else {
247
- return { ...d }
248
- }
258
+ }
259
+ return { ...d }
260
+
249
261
  })
250
262
  return updatedDays
251
263
  })
@@ -266,7 +278,7 @@ export const useSetupSchedule = ({
266
278
  selectedDays,
267
279
  selectedDay,
268
280
  alertModal,
269
- loading: lsc || loading,
281
+ loading: lsc,
270
282
  times: timeSuggestions
271
283
  }
272
284
  }
@@ -12,10 +12,17 @@ export const getDayFromOpeningKey = (key) => {
12
12
  }
13
13
 
14
14
  // Función para convertir el objeto de tiempo en una cadena de tiempo
15
+ /**
16
+ *
17
+ * @param timeStr
18
+ */
15
19
  export function getTimeString (timeStr) {
16
20
  return timeStr || '00:00' // Return '00:00' for empty time strings
17
21
  }
18
22
 
23
+ /**
24
+ *
25
+ */
19
26
  export function getCurrentDayAndTime () {
20
27
  try {
21
28
  const date = new Date()
@@ -29,18 +36,26 @@ export function getCurrentDayAndTime () {
29
36
  }
30
37
  }
31
38
 
39
+ /**
40
+ *
41
+ * @param timeStr
42
+ */
32
43
  export function getTimeObject (timeStr) {
33
44
  try {
34
45
  if (!timeStr || !/\d{2}:\d{2}/.test(timeStr)) {
35
46
  return { hours: 0, minutes: 0 } // Return default values for invalid input
36
47
  }
37
- const [hours, minutes] = timeStr.split(':').map(str => parseInt(str))
48
+ const [hours, minutes] = timeStr.split(':').map(str => {return parseInt(str)})
38
49
  return { hours, minutes }
39
50
  } catch (e) {
40
51
  return { hours: 0, minutes: 0 } // Return default values on error
41
52
  }
42
53
  }
43
54
 
55
+ /**
56
+ *
57
+ * @param openings
58
+ */
44
59
  export function sortOpeningsByDay (openings) {
45
60
  const days = [
46
61
  'openingSun',
@@ -61,6 +76,10 @@ export function sortOpeningsByDay (openings) {
61
76
  }
62
77
 
63
78
  // Función para obtener la clave de openings a partir del día de la semana
79
+ /**
80
+ *
81
+ * @param day
82
+ */
64
83
  export function getOpeningKeyFromDay (day) {
65
84
  const days = {
66
85
  0: 'openingSun',
@@ -84,6 +103,10 @@ export const weekDays = [
84
103
  'Sábado'
85
104
  ]
86
105
 
106
+ /**
107
+ *
108
+ * @param text
109
+ */
87
110
  export function timeToInt (text) {
88
111
  const hour = parseInt(text.substring(0, 2))
89
112
  const minute = parseInt(text.substring(3))
@@ -1,4 +1,7 @@
1
- import { useEffect, useState } from 'react'
1
+ import { useEffect, useState } from 'react'
2
+
3
+ import { useFormatDate } from '../useFormatDate'
4
+
2
5
  import {
3
6
  getDayFromOpeningKey,
4
7
  getCurrentDayAndTime,
@@ -10,8 +13,6 @@ import {
10
13
  days,
11
14
  getTimeObject
12
15
  } from './helpers'
13
- import { useFormatDate } from '../useFormatDate'
14
- import { convertToMilitaryTime } from '../convertToMilitaryTime'
15
16
 
16
17
  export const useStatusOpenStore = ({ dataSchedules = [] } = {}) => {
17
18
  const [open, setOpen] = useState('')
@@ -25,6 +26,11 @@ export const useStatusOpenStore = ({ dataSchedules = [] } = {}) => {
25
26
  setOpenNow(open)
26
27
  }
27
28
 
29
+ /**
30
+ *
31
+ * @param dataSchedules
32
+ * @param currentDayOfWeek
33
+ */
28
34
  function getNextDaySchedule (dataSchedules, currentDayOfWeek) {
29
35
  const today = new Date()
30
36
  const tomorrow = new Date(today)
@@ -32,16 +38,22 @@ export const useStatusOpenStore = ({ dataSchedules = [] } = {}) => {
32
38
  const dayOfWeekTomorrow = tomorrow.getDay()
33
39
 
34
40
  const findNextDay = dataSchedules?.length
35
- ? dataSchedules?.some((schedule) => schedule?.schDay === dayOfWeekTomorrow)
41
+ ? dataSchedules?.some((schedule) => {return schedule?.schDay === dayOfWeekTomorrow})
36
42
  : false
37
43
 
38
44
  const findDataNextDay = dataSchedules?.length
39
- ? dataSchedules?.find((schedule) => schedule?.schDay === dayOfWeekTomorrow)
45
+ ? dataSchedules?.find((schedule) => {return schedule?.schDay === dayOfWeekTomorrow})
40
46
  : {}
41
47
 
42
48
  return { findNextDay, findDataNextDay, dayOfWeekTomorrow }
43
49
  }
44
50
 
51
+ /**
52
+ *
53
+ * @param openings
54
+ * @param currentTime
55
+ * @param currentDayOfWeek
56
+ */
45
57
  function getOpeningStatus (openings, currentTime, currentDayOfWeek) {
46
58
  const weekDayLookup = [
47
59
  'Sunday',
@@ -59,10 +71,10 @@ export const useStatusOpenStore = ({ dataSchedules = [] } = {}) => {
59
71
  for (let i = 0; i < 7; i++) {
60
72
  const dayName = weekDayLookup[dayOfWeek % 7]
61
73
  const opening = openings && openings['opening' + dayName.substring(0, 3)]
62
- const timeSpans = opening?.split(';').map((item) => item.trim())
74
+ const timeSpans = opening?.split(';').map((item) => {return item.trim()})
63
75
 
64
76
  for (const span of timeSpans) {
65
- const hours = span.split('-').map((item) => item.trim())
77
+ const hours = span.split('-').map((item) => {return item.trim()})
66
78
  const openTime = timeToInt(hours[0])
67
79
  const closeTime = timeToInt(hours[1])
68
80
 
@@ -99,16 +111,16 @@ export const useStatusOpenStore = ({ dataSchedules = [] } = {}) => {
99
111
  if (findNextDay && findDataNextDay?.schHoSta) {
100
112
  const nameOfDayTomorrow = weekDays[dayOfWeekTomorrow]
101
113
  return handleMessageHour(
102
- `Cerrado abre Mañana ${nameOfDayTomorrow} ${!!findDataNextDay?.schHoSta && 'a las'} ${
103
- handleHourPmAM(findDataNextDay?.schHoSta) ?? ''
104
- }`,
105
- false
114
+ `Cerrado abre Mañana ${nameOfDayTomorrow} ${Boolean(findDataNextDay?.schHoSta) && 'a las'} ${
115
+ handleHourPmAM(findDataNextDay?.schHoSta) ?? ''
116
+ }`,
117
+ false
106
118
  )
107
119
  }
108
120
 
109
121
  const nextDayName = weekDayLookup[(dayOfWeek + 1) % 7]
110
122
  const nextOpening = openings?.['opening' + nextDayName.substring(0, 3)]
111
- const nextHours = nextOpening?.split(';')?.map((item) => item?.trim())
123
+ const nextHours = nextOpening?.split(';')?.map((item) => {return item?.trim()})
112
124
 
113
125
  if (nextHours[0] !== ceroHours) {
114
126
  return handleMessageHour(
@@ -124,6 +136,10 @@ export const useStatusOpenStore = ({ dataSchedules = [] } = {}) => {
124
136
  return handleMessageHour('Cerrado', false)
125
137
  }
126
138
 
139
+ /**
140
+ *
141
+ * @param openings
142
+ */
127
143
  function getIsOpening (openings) {
128
144
  const { currentTime, currentDayOfWeek } = getCurrentDayAndTime()
129
145
  return getOpeningStatus(openings, currentTime, currentDayOfWeek)
@@ -154,10 +170,10 @@ export const useStatusOpenStore = ({ dataSchedules = [] } = {}) => {
154
170
  const sortedOpenings = sortOpeningsByDay(openings)
155
171
 
156
172
  // Crear el array completo con objetos de tiempo
157
- // eslint-disable-next-line no-unused-vars
173
+
158
174
  const fullArray = Object.keys(sortedOpenings).map((key) => {
159
175
  const day = getDayFromOpeningKey(key)
160
- const [schHoSta, schHoEnd] = openings[key].split(' - ').map(timeStr => getTimeObject(timeStr))
176
+ const [schHoSta, schHoEnd] = openings[key].split(' - ').map(timeStr => {return getTimeObject(timeStr)})
161
177
  return {
162
178
  __typename: 'StoreSchedule',
163
179
  schId: '',
@@ -1,6 +1,7 @@
1
- import { useQuery } from '@apollo/client'
2
- import { GET_ALL_PEDIDOS_STATUS } from './queries'
1
+ import { useQuery } from '@apollo/client'
2
+
3
3
  import { filterOrders } from './helpers'
4
+ import { GET_ALL_PEDIDOS_STATUS } from './queries'
4
5
 
5
6
  export const useStatusOrdersClient = () => {
6
7
  const { data, loading, error } = useQuery(GET_ALL_PEDIDOS_STATUS, {
@@ -6,7 +6,7 @@ export const GET_ALL_PEDIDOS_STATUS = gql`
6
6
  pdpId
7
7
  idStore
8
8
  pCodeRef
9
- payMethodPState
9
+ payId
10
10
  pPRecoger
11
11
  totalProductsPrice
12
12
  pSState
@@ -48,7 +48,7 @@ export const GET_ALL_PEDIDOS_STATUS = gql`
48
48
  ShoppingCard
49
49
  pCodeRef
50
50
  pPStateP
51
- payMethodPState
51
+ payId
52
52
  pPRecoger
53
53
  pDatCre
54
54
  pDatMod
@@ -0,0 +1 @@
1
+ export { useStockUpdatedAllSubscription } from './useStockUpdatedAllSubscription'
@@ -0,0 +1,40 @@
1
+
2
+ import { useSubscription, gql } from '@apollo/client'
3
+
4
+ const NEW_STORE_ORDER_SUBSCRIPTION = gql`
5
+ subscription StockUpdatedAll($idStore: String) {
6
+ StockUpdatedAll(idStore: $idStore) {
7
+ pId
8
+ newStock
9
+ previousStock
10
+ event
11
+ meta
12
+ }
13
+ }
14
+ `
15
+
16
+ interface StockUpdatedAllData {
17
+ StockUpdatedAll: {
18
+ pId: string
19
+ newStock: number
20
+ previousStock: number
21
+ event: string
22
+ meta: any
23
+ }
24
+ }
25
+
26
+ export const useStockUpdatedAllSubscription = (
27
+ idStore: string,
28
+ onStockUpdated: (data: StockUpdatedAllData['StockUpdatedAll']) => void
29
+ ) => {
30
+ return useSubscription<StockUpdatedAllData>(NEW_STORE_ORDER_SUBSCRIPTION, {
31
+ variables: { idStore },
32
+ skip: !idStore,
33
+ onSubscriptionData: ({ subscriptionData }) => {
34
+ const data = subscriptionData.data?.StockUpdatedAll
35
+ if (!data) return
36
+ onStockUpdated(data)
37
+ }
38
+ })
39
+ }
40
+
@@ -7,7 +7,7 @@ export const fillMissingDates = (data, days = 7) => {
7
7
  date.setDate(today.getDate() - i)
8
8
 
9
9
  const formattedDate = date.toISOString().split('T')[0] // "YYYY-MM-DD"
10
- const existingData = data.find(item => item.date === formattedDate)
10
+ const existingData = data.find(item => {return item.date === formattedDate})
11
11
 
12
12
  filledData.push(existingData || { date: formattedDate, TotalIn: 0, TotalOut: 0, TotalAdjustment: 0 })
13
13
  }
@@ -1,5 +1,6 @@
1
- import { useState, useEffect } from 'react'
2
1
  import { useQuery, gql } from '@apollo/client'
2
+ import { useState, useEffect } from 'react'
3
+
3
4
  import { fillMissingDates } from './helpers'
4
5
 
5
6
  const GET_STOCK_MOVEMENTS = gql`
@@ -24,12 +25,12 @@ export const useStockMovements = () => {
24
25
  useEffect(() => {
25
26
  if (data && data.getStockMovementsByDay) {
26
27
  // Transform data to be compatible with Recharts
27
- const formattedData = data.getStockMovementsByDay.map(entry => ({
28
+ const formattedData = data.getStockMovementsByDay.map(entry => {return {
28
29
  date: entry.date,
29
30
  TotalIn: entry.total_in ?? 0,
30
31
  TotalOut: entry.total_out ?? 0,
31
32
  TotalAdjustment: entry.total_adjustment ?? 0
32
- }))
33
+ }})
33
34
  setChartData(formattedData)
34
35
  }
35
36
  }, [data])
@@ -1,8 +1,11 @@
1
- import { useState, useEffect } from 'react'
2
1
  import { useApolloClient, useQuery } from '@apollo/client'
3
- import { GET_ONE_STORE, GET_ONE_STORE_BY_ID } from './queries' // Reemplaza con la importación correcta de tu consulta
2
+ import { useState, useEffect } from 'react'
3
+
4
+
4
5
  import { errorHandler } from '../../config/client'
5
- import { useLogout } from '../useLogout'
6
+ import { useLogout } from '../useLogout'
7
+
8
+ import { GET_ONE_STORE, GET_ONE_STORE_BY_ID } from './queries' // Reemplaza con la importación correcta de tu consulta
6
9
 
7
10
  export const useStore = ({
8
11
  isClient = false,
@@ -31,7 +34,7 @@ export const useStore = ({
31
34
  callback(store)
32
35
  }, [cachedData, store])
33
36
 
34
- if (isClient && !!idStore) {
37
+ if (isClient && Boolean(idStore)) {
35
38
  const {
36
39
  data,
37
40
  refetch,
@@ -51,30 +54,30 @@ export const useStore = ({
51
54
  loading: loadingClient,
52
55
  error: errorStoreClient
53
56
  }]
54
- } else {
55
- const { loading: loadingServer } = useQuery(GET_ONE_STORE, {
56
- skip: isClient && !idStore,
57
- variables: {
58
- idStore
59
- },
60
- fetchPolicy: 'cache-first',
61
- onCompleted: (data) => {
62
- const { getStore } = data || {}
63
- setStore(getStore)
64
- setLoading(false)
65
- },
66
- onError: (err) => {
67
- if (err.networkError && err.networkError.result) {
68
- const response = errorHandler(err.networkError.result)
69
- if (response) {
70
- onClickLogout()
71
- }
57
+ }
58
+ const { loading: loadingServer } = useQuery(GET_ONE_STORE, {
59
+ skip: isClient && !idStore,
60
+ variables: {
61
+ idStore
62
+ },
63
+ fetchPolicy: 'cache-first',
64
+ onCompleted: (data) => {
65
+ const { getStore } = data || {}
66
+ setStore(getStore)
67
+ setLoading(false)
68
+ },
69
+ onError: (err) => {
70
+ if (err.networkError && err.networkError.result) {
71
+ const response = errorHandler(err.networkError.result)
72
+ if (response) {
73
+ onClickLogout()
72
74
  }
73
- setError(err)
74
- setLoading(false)
75
75
  }
76
- })
76
+ setError(err)
77
+ setLoading(false)
78
+ }
79
+ })
77
80
 
78
- return [store, { loading: load || loadingServer || loading, error }]
79
- }
81
+ return [store, { loading: load || loadingServer || loading, error }]
82
+
80
83
  }
@@ -1,5 +1,6 @@
1
1
  import { useQuery, useMutation, useLazyQuery } from '@apollo/client'
2
- import { useState } from 'react'
2
+ import { useState } from 'react'
3
+
3
4
  import {
4
5
  GET_ALL_CONTACTS,
5
6
  EDIT_ONE_CONTACT,
@@ -7,22 +8,27 @@ import {
7
8
  GET_ONE_CONTACT
8
9
  } from './queries'
9
10
 
11
+ interface UseStoreContactsParams {
12
+ sendNotification?: (message: string, type?: 'error' | 'success') => void
13
+ max?: number
14
+ search?: string
15
+ }
10
16
  export const useGetStoreContacts = ({
11
17
  sendNotification = () => { },
12
18
  max,
13
19
  search = ''
14
- } = {}) => {
15
- const [clientes, setUseStoreContacts] = useState([])
20
+ }: UseStoreContactsParams = {}) => {
21
+ const [clientes, setClientes] = useState<{ getAllContacts?: any[] } | undefined>(undefined)
16
22
  const { loading, error, fetchMore, called } = useQuery(GET_ALL_CONTACTS, {
17
23
  variables: {
18
24
  max,
19
25
  search
20
26
  },
21
27
  onCompleted: (data) => {
22
- setUseStoreContacts(data)
28
+ setClientes(data)
23
29
  }
24
30
  })
25
- return [clientes?.getAllContacts || [], { loading: called ? false : loading, error, fetchMore }]
31
+ return [clientes?.getAllContacts ?? [], { loading: called ? false : loading, error, fetchMore }]
26
32
  }
27
33
 
28
34
  export const useDeleteUseStoreContacts = ({ sendNotification = () => { } } = {}) => {
@@ -1,5 +1,6 @@
1
- import { useState } from 'react'
2
- import { gql, useMutation } from '@apollo/client'
1
+ import { useMutation } from '@apollo/client'
2
+ import { useState } from 'react'
3
+
3
4
  import { CREATE_TABLE_MUTATION } from './queries'
4
5
 
5
6
  /**
@@ -1,4 +1,5 @@
1
- import { useQuery } from '@apollo/client'
1
+ import { useQuery } from '@apollo/client'
2
+
2
3
  import { STORE_TABLES_QUERY } from './queries' // Ajusta la ruta a tu archivo de queries
3
4
 
4
5
  /**