npm-pkg-hook 1.13.0 → 1.13.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (347) hide show
  1. package/dist/index.js +8 -2
  2. package/dist/index.js.map +1 -1
  3. package/dist/index.mjs +8 -2
  4. package/dist/index.mjs.map +1 -1
  5. package/package.json +8 -2
  6. package/.babelrc +0 -0
  7. package/.github/pull_request_template.md +0 -18
  8. package/.github/workflows/pepeline.yaml +0 -30
  9. package/eslint.config.mts +0 -153
  10. package/expire.json +0 -1
  11. package/jsconfig.json +0 -28
  12. package/script.txt +0 -7
  13. package/src/config/client/errors.ts +0 -39
  14. package/src/config/client/index.ts +0 -1
  15. package/src/config/content/en.json +0 -5
  16. package/src/config/content/es.json +0 -5
  17. package/src/config/content/index.ts +0 -16
  18. package/src/cookies/index.ts +0 -3
  19. package/src/hooks/addTenMinutes/index.ts +0 -14
  20. package/src/hooks/calculateLogLatHaversine/index.ts +0 -41
  21. package/src/hooks/completeSchedules/index.ts +0 -22
  22. package/src/hooks/convertToMilitaryTime/index.ts +0 -18
  23. package/src/hooks/generateStoreURL/index.ts +0 -41
  24. package/src/hooks/generateTemplate/index.ts +0 -66
  25. package/src/hooks/getCardType/index.ts +0 -24
  26. package/src/hooks/getCategoriesWithProduct/helpers/index.ts +0 -7
  27. package/src/hooks/getCategoriesWithProduct/index.ts +0 -62
  28. package/src/hooks/getGlobalSession/index.ts +0 -69
  29. package/src/hooks/getSession/index.ts +0 -72
  30. package/src/hooks/getTodayTimestamps/index.ts +0 -70
  31. package/src/hooks/getTotalHours/index.ts +0 -76
  32. package/src/hooks/handleLogin/index.ts +0 -14
  33. package/src/hooks/index.ts +0 -154
  34. package/src/hooks/isTokenExpired/index.ts +0 -17
  35. package/src/hooks/newMessageSubscription/index.ts +0 -28
  36. package/src/hooks/newStoreOrderSubscription/index.ts +0 -26
  37. package/src/hooks/statusOpenStores/helpers/index.ts +0 -124
  38. package/src/hooks/statusOpenStores/index.ts +0 -221
  39. package/src/hooks/updateExtProductFoodsOptional/index.ts +0 -49
  40. package/src/hooks/useAcumulateDate/index.ts +0 -18
  41. package/src/hooks/useAllStoresPendingToRegister/index.ts +0 -37
  42. package/src/hooks/useAmountInput/index.ts +0 -127
  43. package/src/hooks/useAnimationFrame/index.ts +0 -45
  44. package/src/hooks/useAnimationText/index.ts +0 -31
  45. package/src/hooks/useAsideCart/helpers/index.ts +0 -22
  46. package/src/hooks/useAsideCart/index.ts +0 -217
  47. package/src/hooks/useAsideCart/queries.ts +0 -10
  48. package/src/hooks/useBanner/index.ts +0 -20
  49. package/src/hooks/useCart/index.ts +0 -2
  50. package/src/hooks/useCart/queries.ts +0 -174
  51. package/src/hooks/useCart/useCart/helpers/index.ts +0 -79
  52. package/src/hooks/useCart/useCart/index.ts +0 -424
  53. package/src/hooks/useCart/useGetCart/index.ts +0 -34
  54. package/src/hooks/useCatWithProduct/index.ts +0 -54
  55. package/src/hooks/useCatWithProduct/queries.ts +0 -200
  56. package/src/hooks/useCatWithProduct/types/index.ts +0 -104
  57. package/src/hooks/useCatWithProductClient/index.ts +0 -57
  58. package/src/hooks/useCatWithProductClient/queries.ts +0 -56
  59. package/src/hooks/useCategoriesProduct/index.ts +0 -14
  60. package/src/hooks/useCategoriesProduct/queries.ts +0 -16
  61. package/src/hooks/useCategoryInStore/index.ts +0 -167
  62. package/src/hooks/useCategoryInStore/queries.ts +0 -78
  63. package/src/hooks/useCategoryStore/index.ts +0 -8
  64. package/src/hooks/useCategoryStore/queries.ts +0 -16
  65. package/src/hooks/useChartData/index.ts +0 -171
  66. package/src/hooks/useChartData/useChartData/index.ts +0 -200
  67. package/src/hooks/useChartData/useChartDataAllOrders/index.ts +0 -94
  68. package/src/hooks/useChatRoomSubscription/index.ts +0 -28
  69. package/src/hooks/useCheckbox/index.ts +0 -115
  70. package/src/hooks/useCities/index.ts +0 -14
  71. package/src/hooks/useCities/queries.ts +0 -12
  72. package/src/hooks/useClients/index.ts +0 -97
  73. package/src/hooks/useClients/queries.ts +0 -215
  74. package/src/hooks/useColorByLetters/helpers/alea.ts +0 -73
  75. package/src/hooks/useColorByLetters/helpers/colors.ts +0 -45
  76. package/src/hooks/useColorByLetters/helpers/index.ts +0 -24
  77. package/src/hooks/useColorByLetters/helpers/mersenne_twister.ts +0 -118
  78. package/src/hooks/useColorByLetters/index.ts +0 -24
  79. package/src/hooks/useConnection/index.ts +0 -24
  80. package/src/hooks/useCountries/index.ts +0 -20
  81. package/src/hooks/useCountries/queries.ts +0 -12
  82. package/src/hooks/useCreateDeliveryTime/index.ts +0 -51
  83. package/src/hooks/useCreateOrderStatusType/index.ts +0 -134
  84. package/src/hooks/useCreateProduct/helpers/index.ts +0 -23
  85. package/src/hooks/useCreateProduct/helpers/manageCacheDataCatProduct/index.ts +0 -52
  86. package/src/hooks/useCreateProduct/helpers/useEditImageProduct/index.ts +0 -182
  87. package/src/hooks/useCreateProduct/index.ts +0 -337
  88. package/src/hooks/useCreateStorePendingToRegister/index.ts +0 -17
  89. package/src/hooks/useCreateStorePendingToRegister/queries.ts +0 -10
  90. package/src/hooks/useDashboardComponents/index.ts +0 -50
  91. package/src/hooks/useDeleteExtraProductFoods/index.ts +0 -13
  92. package/src/hooks/useDeleteSubProductOptional/index.ts +0 -32
  93. package/src/hooks/useDeleteSubProductOptional/queries.ts +0 -10
  94. package/src/hooks/useDeliveryTime/index.ts +0 -29
  95. package/src/hooks/useDepartments/index.ts +0 -14
  96. package/src/hooks/useDepartments/queries.ts +0 -13
  97. package/src/hooks/useDessert/helpers/index.ts +0 -51
  98. package/src/hooks/useDessert/index.ts +0 -529
  99. package/src/hooks/useDessertWithPrice/helpers/index.ts +0 -76
  100. package/src/hooks/useDessertWithPrice/index.ts +0 -381
  101. package/src/hooks/useDessertWithPrice/queries.ts +0 -18
  102. package/src/hooks/useDevWS/index.ts +0 -53
  103. package/src/hooks/useDevices/index.ts +0 -2
  104. package/src/hooks/useDevices/queries.ts +0 -28
  105. package/src/hooks/useDevices/useGetDevices.ts +0 -28
  106. package/src/hooks/useDevices/useRegisterDevices.ts +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 -105
  110. package/src/hooks/useDownloadReports/useGetReportByDateRange/index.ts +0 -116
  111. package/src/hooks/useDrag/index.ts +0 -79
  112. package/src/hooks/useDropzone/index.ts +0 -94
  113. package/src/hooks/useDynamicAuth/index.ts +0 -14
  114. package/src/hooks/useDynamicAuth/queries.ts +0 -24
  115. package/src/hooks/useEditCategory/index.ts +0 -41
  116. package/src/hooks/useEditOneExtProductFoodOptional/index.ts +0 -28
  117. package/src/hooks/useEditOneExtProductFoodOptional/queries.ts +0 -16
  118. package/src/hooks/useEditSubProductOptional/index.ts +0 -12
  119. package/src/hooks/useEditSubProductOptional/queries.ts +0 -10
  120. package/src/hooks/useEmployee/index.ts +0 -18
  121. package/src/hooks/useEmployee/queries.ts +0 -85
  122. package/src/hooks/useEmployee/useCreateEmployee.ts +0 -90
  123. package/src/hooks/useEvent/index.ts +0 -34
  124. package/src/hooks/useFavoriteStores/index.ts +0 -31
  125. package/src/hooks/useFavoriteStores/queries.ts +0 -54
  126. package/src/hooks/useFetchJson/index.ts +0 -25
  127. package/src/hooks/useFetchMoreInteractions/index.jsx +0 -39
  128. package/src/hooks/useFilterConfigs/index.ts +0 -173
  129. package/src/hooks/useFingerprintjs/index.ts +0 -197
  130. package/src/hooks/useFormTools/index.ts +0 -143
  131. package/src/hooks/useFormatDate/index.ts +0 -91
  132. package/src/hooks/useFormatNumberPhone/index.ts +0 -23
  133. package/src/hooks/useFullScreenMode/index.ts +0 -61
  134. package/src/hooks/useGenerateNumberArray/index.ts +0 -17
  135. package/src/hooks/useGetAllLocationUser/index.ts +0 -13
  136. package/src/hooks/useGetAllLocationUser/queries.ts +0 -44
  137. package/src/hooks/useGetAllSales/index.ts +0 -26
  138. package/src/hooks/useGetCookies/index.ts +0 -43
  139. package/src/hooks/useGetExtProductFoodsSubOptionalAll/index.ts +0 -15
  140. package/src/hooks/useGetFoodRecomended/index.ts +0 -33
  141. package/src/hooks/useGetFoodRecomended/queries.ts +0 -47
  142. package/src/hooks/useGetMessagesToRoom/index.ts +0 -23
  143. package/src/hooks/useGetMinPrice/index.ts +0 -13
  144. package/src/hooks/useGetMinPrice/queries.ts +0 -7
  145. package/src/hooks/useGetOneStoreRating/index.ts +0 -41
  146. package/src/hooks/useGetOneStoreRating/queries.ts +0 -18
  147. package/src/hooks/useGetSalesAmountToday/index.ts +0 -31
  148. package/src/hooks/useGetStoreCookie/index.ts +0 -21
  149. package/src/hooks/useGoogleLogin/index.ts +0 -169
  150. package/src/hooks/useGoogleLogin/loadScript.ts +0 -15
  151. package/src/hooks/useGoogleLogin/removeScript.ts +0 -7
  152. package/src/hooks/useHover/index.ts +0 -32
  153. package/src/hooks/useImageOptimization/index.ts +0 -32
  154. package/src/hooks/useImageUploaderProduct/helper/canvasUtils.ts +0 -146
  155. package/src/hooks/useImageUploaderProduct/helper/getOrientation.ts +0 -54
  156. package/src/hooks/useImageUploaderProduct/helper/index.ts +0 -5
  157. package/src/hooks/useImageUploaderProduct/index.ts +0 -295
  158. package/src/hooks/useImageWeight/index.ts +0 -55
  159. package/src/hooks/useImagesStore/index.ts +0 -227
  160. package/src/hooks/useImagesStore/queries.ts +0 -193
  161. package/src/hooks/useImagesStore/utils/index.ts +0 -4
  162. package/src/hooks/useIncomingOrders/index.ts +0 -11
  163. package/src/hooks/useIncomingOrders/queries.ts +0 -87
  164. package/src/hooks/useInnerHtml/index.ts +0 -39
  165. package/src/hooks/useIntersection/index.ts +0 -84
  166. package/src/hooks/useInventory/index.ts +0 -2
  167. package/src/hooks/useInventory/queries.ts +0 -58
  168. package/src/hooks/useInventory/useGetProductsInStock.ts +0 -16
  169. package/src/hooks/useInventory/useUpdateManageStock.ts +0 -41
  170. package/src/hooks/useKeypress/index.ts +0 -28
  171. package/src/hooks/useLazyScript/index.ts +0 -74
  172. package/src/hooks/useLocalBackendIp/index.ts +0 -34
  173. package/src/hooks/useLocalSorage/index.ts +0 -36
  174. package/src/hooks/useLocationManager/index.ts +0 -63
  175. package/src/hooks/useLocationNavigate/index.ts +0 -54
  176. package/src/hooks/useLoginEmployeeInStore/index.ts +0 -38
  177. package/src/hooks/useLogout/helpers/BroadcastChannel.ts +0 -74
  178. package/src/hooks/useLogout/helpers/apiBaseUrl.ts +0 -12
  179. package/src/hooks/useLogout/helpers/fetchData.ts +0 -37
  180. package/src/hooks/useLogout/helpers/getCsrfToken.ts +0 -37
  181. package/src/hooks/useLogout/helpers/index.ts +0 -65
  182. package/src/hooks/useLogout/helpers/logger.ts +0 -88
  183. package/src/hooks/useLogout/helpers/parseUrl.ts +0 -39
  184. package/src/hooks/useLogout/index.ts +0 -105
  185. package/src/hooks/useManageNewOrder/helpers/index.ts +0 -45
  186. package/src/hooks/useManageNewOrder/helpers/mock.ts +0 -0
  187. package/src/hooks/useManageNewOrder/index.ts +0 -104
  188. package/src/hooks/useManageQueryParams/index.ts +0 -120
  189. package/src/hooks/useMobile/index.ts +0 -65
  190. package/src/hooks/useModules/helpers/index.ts +0 -1
  191. package/src/hooks/useModules/helpers/validateModules.ts +0 -43
  192. package/src/hooks/useModules/index.ts +0 -124
  193. package/src/hooks/useMouse/index.ts +0 -55
  194. package/src/hooks/useMutateHeight/index.ts +0 -36
  195. package/src/hooks/useOrderClient/index.ts +0 -5
  196. package/src/hooks/useOrderStatusTypes/index.ts +0 -2
  197. package/src/hooks/useOrderStatusTypes/useOrderStatusTypes/index.ts +0 -133
  198. package/src/hooks/useOrderStatusTypes/useUpdateOrderStatusPriorities/index.ts +0 -99
  199. package/src/hooks/useOrders/index.ts +0 -3
  200. package/src/hooks/useOrders/queries.ts +0 -99
  201. package/src/hooks/useOrders/useChangeOrderState/index.ts +0 -128
  202. package/src/hooks/useOrders/useOrdersFromStore/index.ts +0 -77
  203. package/src/hooks/usePWAInstall/index.ts +0 -38
  204. package/src/hooks/usePaymentMethod/index.ts +0 -3
  205. package/src/hooks/usePaymentMethod/paymentMethod.gql.ts +0 -62
  206. package/src/hooks/usePaymentMethod/paymentMethod.types.ts +0 -28
  207. package/src/hooks/usePaymentMethod/useCreatePaymentMethod/index.ts +0 -25
  208. package/src/hooks/usePaymentMethod/useGetAllPaymentMethods/index.ts +0 -19
  209. package/src/hooks/usePaymentMethod/useGetPaymentMethod/index.ts +0 -26
  210. package/src/hooks/usePortFetcher/index.ts +0 -33
  211. package/src/hooks/usePrintSaleTicket/index.ts +0 -68
  212. package/src/hooks/useProductsFood/index.ts +0 -341
  213. package/src/hooks/useProductsFood/queriesStore.ts +0 -964
  214. package/src/hooks/useProductsFood/types/index.ts +0 -0
  215. package/src/hooks/useProductsFood/useEditProduct.ts +0 -49
  216. package/src/hooks/useProductsFood/usetagsProducts.ts +0 -101
  217. package/src/hooks/useProviders/index.ts +0 -3
  218. package/src/hooks/useProviders/queries.ts +0 -31
  219. package/src/hooks/useProviders/useProvidersCreateStore/index.ts +0 -13
  220. package/src/hooks/useProviders/useProvidersDataStore/index.ts +0 -25
  221. package/src/hooks/useProvidersStore/index.ts +0 -25
  222. package/src/hooks/useProvidersStore/queries.ts +0 -31
  223. package/src/hooks/usePushNotificationOrder/index.ts +0 -52
  224. package/src/hooks/usePushNotifications/helpers/index.ts +0 -123
  225. package/src/hooks/usePushNotifications/index.ts +0 -150
  226. package/src/hooks/useQueryLocationsMap/index.ts +0 -20
  227. package/src/hooks/useQueryLocationsMap/queries.ts +0 -40
  228. package/src/hooks/useRatingArrayData/index.ts +0 -54
  229. package/src/hooks/useRatingArrayData/queries.ts +0 -19
  230. package/src/hooks/useReactToPrint/index.ts +0 -4
  231. package/src/hooks/useReactToPrint/index.txt +0 -1223
  232. package/src/hooks/useRemoveExtraProductFoodsOptional/index.ts +0 -24
  233. package/src/hooks/useRemoveExtraProductFoodsOptional/queries.ts +0 -48
  234. package/src/hooks/useReport/index.ts +0 -48
  235. package/src/hooks/useReport/queries.ts +0 -72
  236. package/src/hooks/useRestaurant/helpers/index.ts +0 -28
  237. package/src/hooks/useRestaurant/helpers/manageStatusOpen.ts +0 -26
  238. package/src/hooks/useRestaurant/index.ts +0 -71
  239. package/src/hooks/useRestaurant/queries.ts +0 -81
  240. package/src/hooks/useRoads/index.ts +0 -20
  241. package/src/hooks/useRoads/queries.ts +0 -13
  242. package/src/hooks/useRoles/index.ts +0 -4
  243. package/src/hooks/useRoles/queries.ts +0 -70
  244. package/src/hooks/useRoles/useCreateRole.ts +0 -40
  245. package/src/hooks/useRoles/useGetRoles.ts +0 -37
  246. package/src/hooks/useRoles/useRemoveRoles.ts +0 -40
  247. package/src/hooks/useRoles/useUpdateRolesPriority.ts +0 -44
  248. package/src/hooks/useSales/helpers/add-product.utils.ts +0 -120
  249. package/src/hooks/useSales/helpers/apply-discount-to-cart.utils.ts +0 -292
  250. package/src/hooks/useSales/helpers/comment-product.utils.ts +0 -41
  251. package/src/hooks/useSales/helpers/constants/index.ts +0 -38
  252. package/src/hooks/useSales/helpers/extras.utils.ts +0 -42
  253. package/src/hooks/useSales/helpers/filterProductsByCarProId.utils.ts +0 -17
  254. package/src/hooks/useSales/helpers/increment-product-quantity.utils.ts +0 -76
  255. package/src/hooks/useSales/helpers/index.ts +0 -3
  256. package/src/hooks/useSales/helpers/initializer.utils.ts +0 -22
  257. package/src/hooks/useSales/helpers/isStockInsufficient.ts +0 -3
  258. package/src/hooks/useSales/helpers/remove-product.utils.test.ts +0 -49
  259. package/src/hooks/useSales/helpers/remove-product.utils.ts +0 -34
  260. package/src/hooks/useSales/helpers/resolveProduct.ts +0 -29
  261. package/src/hooks/useSales/helpers/useAddToCart.ts +0 -64
  262. package/src/hooks/useSales/index.ts +0 -1418
  263. package/src/hooks/useSales/queries.ts +0 -532
  264. package/src/hooks/useSales/types/index.ts +0 -206
  265. package/src/hooks/useSales/types/use-sales.types.ts +0 -8
  266. package/src/hooks/useSales/useGetSale.ts +0 -21
  267. package/src/hooks/useSales/useTotalSales.ts +0 -24
  268. package/src/hooks/useSaveAvailableProduct/helpers/index.ts +0 -38
  269. package/src/hooks/useSaveAvailableProduct/index.ts +0 -32
  270. package/src/hooks/useSaveAvailableProduct/queries.ts +0 -10
  271. package/src/hooks/useSaveLocation/index.ts +0 -17
  272. package/src/hooks/useSaveLocation/queries.ts +0 -19
  273. package/src/hooks/useSchedule/index.ts +0 -35
  274. package/src/hooks/useSchedule/queries.ts +0 -43
  275. package/src/hooks/useSchedule/schedule.ts +0 -79
  276. package/src/hooks/useScheduleData/index.ts +0 -135
  277. package/src/hooks/useScroll/index.ts +0 -56
  278. package/src/hooks/useScrollRotate/index.ts +0 -16
  279. package/src/hooks/useSetImageProducts/index.ts +0 -59
  280. package/src/hooks/useSetImageProducts/queries.ts +0 -18
  281. package/src/hooks/useSetSession/index.ts +0 -44
  282. package/src/hooks/useSetState/index.ts +0 -24
  283. package/src/hooks/useSetupSchedule/helpers/index.ts +0 -85
  284. package/src/hooks/useSetupSchedule/index.ts +0 -284
  285. package/src/hooks/useStatusOpenStore/helpers/index.ts +0 -124
  286. package/src/hooks/useStatusOpenStore/index.ts +0 -195
  287. package/src/hooks/useStatusOrdersClient/helpers/index.ts +0 -14
  288. package/src/hooks/useStatusOrdersClient/index.ts +0 -18
  289. package/src/hooks/useStatusOrdersClient/queries.ts +0 -80
  290. package/src/hooks/useStock/index.ts +0 -1
  291. package/src/hooks/useStock/useStockUpdatedAllSubscription.ts +0 -40
  292. package/src/hooks/useStockMovements/helpers/index.ts +0 -16
  293. package/src/hooks/useStockMovements/index.ts +0 -39
  294. package/src/hooks/useStore/index.ts +0 -83
  295. package/src/hooks/useStore/queries.ts +0 -163
  296. package/src/hooks/useStoreCalendar/index.ts +0 -5
  297. package/src/hooks/useStoreContacts/index.ts +0 -53
  298. package/src/hooks/useStoreContacts/queries.ts +0 -48
  299. package/src/hooks/useStoreTable/index.ts +0 -2
  300. package/src/hooks/useStoreTable/queries.ts +0 -47
  301. package/src/hooks/useStoreTable/useStoreTableCreate.ts +0 -77
  302. package/src/hooks/useStoreTable/useStoreTables.ts +0 -15
  303. package/src/hooks/useSubscriptionValidation/index.ts +0 -112
  304. package/src/hooks/useTagProducts/index.ts +0 -3
  305. package/src/hooks/useTagProducts/useDeleteOneTag.ts +0 -106
  306. package/src/hooks/useTagProducts/useGetAllTags.ts +0 -68
  307. package/src/hooks/useTagProducts/useRegisterMultipleTags.ts +0 -157
  308. package/src/hooks/useTheme/index.ts +0 -65
  309. package/src/hooks/useTimeAgo/useTimeAgo.ts +0 -39
  310. package/src/hooks/useTokenCards/index.ts +0 -45
  311. package/src/hooks/useTopProductsMovements/index.ts +0 -27
  312. package/src/hooks/useTotalAllSales/index.ts +0 -25
  313. package/src/hooks/useTotalProductsInStock/index.ts +0 -23
  314. package/src/hooks/useTotalProductsSold/index.ts +0 -23
  315. package/src/hooks/useTotalProductsSolded/index.ts +0 -20
  316. package/src/hooks/useUpdateCart/index.ts +0 -131
  317. package/src/hooks/useUpdateCartCookie/index.ts +0 -60
  318. package/src/hooks/useUpdateDashboardComponent/index.ts +0 -91
  319. package/src/hooks/useUpdateExistingOrders/index.ts +0 -85
  320. package/src/hooks/useUpdateExtProductFoodsSubOptional/index.ts +0 -61
  321. package/src/hooks/useUpdateModuleOrder/index.ts +0 -37
  322. package/src/hooks/useUpdateMultipleExtProduct/index.ts +0 -34
  323. package/src/hooks/useUpdateMultipleExtProduct/queries.ts +0 -33
  324. package/src/hooks/useUpdateMultipleProducts/index.ts +0 -117
  325. package/src/hooks/useUpdateMultipleProducts/queries.ts +0 -51
  326. package/src/hooks/useUploadProducts/helpers/index.ts +0 -1
  327. package/src/hooks/useUploadProducts/helpers/parseNumber.ts +0 -37
  328. package/src/hooks/useUploadProducts/helpers/validateProductDataExcel.ts +0 -73
  329. package/src/hooks/useUploadProducts/index.ts +0 -442
  330. package/src/hooks/useUpsertGoal/index.ts +0 -68
  331. package/src/hooks/useUser/index.ts +0 -24
  332. package/src/hooks/useUser/queries.ts +0 -131
  333. package/src/hooks/useWeeklyStockMovement/helpers/index.ts +0 -32
  334. package/src/hooks/useWeeklyStockMovement/index.ts +0 -52
  335. package/src/hooks/useWindowSize/index.ts +0 -45
  336. package/src/index.ts +0 -11
  337. package/src/mock/dessert/index.ts +0 -16
  338. package/src/mock/index.ts +0 -1
  339. package/src/security/index.ts +0 -1
  340. package/src/services/index.ts +0 -1
  341. package/src/utils/UtilDateRange.ts +0 -56
  342. package/src/utils/generateCode.ts +0 -222
  343. package/src/utils/index.ts +0 -2
  344. package/src/utils/utils.ts +0 -344
  345. package/tsconfig.eslint.json +0 -16
  346. package/tsconfig.json +0 -21
  347. package/tsup.config.ts +0 -24
@@ -1,424 +0,0 @@
1
- import { useMutation } from '@apollo/client'
2
- import { useState, useCallback, useEffect } from 'react'
3
-
4
- import { RandomCode, updateCacheMod, numberFormat } from '../../../utils'
5
- import { useGetExtProductFoodsSubOptionalAll } from '../../useGetExtProductFoodsSubOptionalAll'
6
- import { useManageQueryParams } from '../../useManageQueryParams'
7
- import { useExtProductFoodsAll, useGetOneProductsFood } from '../../useProductsFood'
8
- import { CREATE_SHOPPING_CARD, GET_ALL_SHOPPING_CARD } from '../queries'
9
- import { useGetCart } from '../useGetCart'
10
-
11
- import {
12
- filterDataOptional,
13
- filterExtra,
14
- validateExtraProducts,
15
- validateRequirements
16
- } from './helpers'
17
-
18
-
19
- export const useCart = ({
20
- location = {
21
- push: (props, state, { shallow }) => {
22
- return { ...props, state, shallow }
23
- },
24
- query: {
25
- plato: ''
26
- }
27
- },
28
- openModalProduct = false,
29
- handleMenu = (number) => { return number },
30
- setOpenModalProduct = (boolean) => { return boolean },
31
- setAlertBox = (args) => { return args }
32
- } = {}) => {
33
- // sub products
34
- const { handleCleanQuery } = useManageQueryParams({
35
- location
36
- })
37
- const [loadingButton, setLoadingButton] = useState(false)
38
- const [dataOptional, setDataOptional] = useState([])
39
- const [dataExtra, setDataExtra] = useState([])
40
- const [quantity, setQuantity] = useState(1)
41
- const [comments, setComments] = useState('')
42
- const queryParamProduct = location.query.plato
43
- const [registerShoppingCard] = useMutation(CREATE_SHOPPING_CARD, {
44
- onError: (error) => {
45
- console.error('Error registering shopping card:', error)
46
- }
47
- })
48
- // CUSTOM HOOKS
49
- const [dataShoppingCard, { loading }] = useGetCart()
50
- const [handleExtProductFoodsAll] = useExtProductFoodsAll()
51
-
52
- const [ExtProductFoodsSubOptionalAll] = useGetExtProductFoodsSubOptionalAll()
53
- const [dataOneProduct, setDataOneProduct] = useState({})
54
- const [handleGetOneProduct,
55
- {
56
- loading: loadingProduct
57
- }
58
- ] = useGetOneProductsFood({ fetchOnlyProduct: true })
59
-
60
- const getOneProduct = async food => {
61
- const { pId } = food || {}
62
-
63
- if (!pId) return {}
64
- setOpenModalProduct(true)
65
- const product = await handleGetOneProduct({ variables: { pId } })
66
- const productFoodsOne = product?.data?.productFoodsOne || {}
67
- setDataOneProduct(productFoodsOne)
68
-
69
- const matchingItemInShoppingCart = dataShoppingCard?.find((item) => {
70
- return item?.productFood && item?.productFood?.pId === pId
71
- })
72
- const matchingItemInShoppingCartOptional = matchingItemInShoppingCart?.salesExtProductFoodOptional || []
73
- if (matchingItemInShoppingCart && queryParamProduct) {
74
- setDataOneProduct({
75
- ...productFoodsOne,
76
- intoCart: true
77
- })
78
- const comments = matchingItemInShoppingCart?.comments
79
- if (comments) {
80
- setComments(comments)
81
- }
82
- const quantityProduct = matchingItemInShoppingCart?.cantProducts
83
- if (quantityProduct) {
84
- setQuantity(quantityProduct || 1)
85
- }
86
- }
87
- const optionalAll = await ExtProductFoodsSubOptionalAll({
88
- variables: { pId }
89
- })
90
- const optionalFetch = optionalAll?.data?.ExtProductFoodsOptionalAll
91
- const shoppingCartOptionalAll = matchingItemInShoppingCart?.ExtProductFoodsAll || []
92
- if (Array.isArray(optionalFetch)) {
93
- // Filtra y procesa los objetos de optionalFetch
94
- const filteredDataOptional = optionalFetch
95
- .map((obj) => {
96
- const filteredSubOptions = (obj.ExtProductFoodsSubOptionalAll || []).filter(
97
- (subObj) => {return subObj.check !== false}
98
- )
99
-
100
- if (filteredSubOptions.length === 0) {
101
- return null
102
- }
103
-
104
- return {
105
- ...obj,
106
- ExtProductFoodsSubOptionalAll: filteredSubOptions
107
- }
108
- })
109
- .filter((obj) => {return obj !== null})
110
-
111
- if (matchingItemInShoppingCartOptional?.length === 0) {
112
- setDataOptional(filteredDataOptional || [])
113
- }
114
-
115
- if (matchingItemInShoppingCartOptional?.length) {
116
- // Actualiza los objetos de filteredDataOptional con información de matchingItemInShoppingCartOptional
117
- const updateOption = filteredDataOptional?.map((obj) => {
118
- const matchingArray = matchingItemInShoppingCartOptional?.find(
119
- (o) => {return o && o.opExPid === obj.opExPid}
120
- )
121
-
122
- if (!matchingArray) {
123
- return obj
124
- }
125
-
126
- // Actualiza las propiedades específicas
127
- const updatedExtProductFoodsSubOptionalAll = (obj.ExtProductFoodsSubOptionalAll || []).map((subObj) => {
128
- const newItem = matchingArray.saleExtProductFoodsSubOptionalAll?.find((newItem) => {return newItem && newItem.opSubExPid === subObj.opSubExPid})
129
-
130
- if (newItem) {
131
- return {
132
- ...subObj,
133
- check: true
134
- }
135
- }
136
-
137
- return subObj
138
- })
139
-
140
- return {
141
- ...obj,
142
- ExtProductFoodsSubOptionalAll: updatedExtProductFoodsSubOptionalAll
143
- }
144
- }).filter((obj) => {return obj})
145
-
146
- setDataOptional(updateOption || [])
147
- }
148
- }
149
- if (!pId || pId === '') return
150
- const resultExtra = await handleExtProductFoodsAll(pId)
151
- const originalArray = resultExtra?.data?.ExtProductFoodsAll
152
-
153
- if (Array.isArray(originalArray) && originalArray?.length) {
154
- const fetchedDataExtra = originalArray?.map(extra => {
155
- const updatedExtra = shoppingCartOptionalAll?.find(updatedItem => {return updatedItem.exPid === extra.exPid})
156
- if (updatedExtra) {
157
- return {
158
- ...extra,
159
- quantity: updatedExtra?.quantity || 0,
160
- newExtraPrice: updatedExtra?.newExtraPrice || 0
161
- }
162
- }
163
- return {
164
- ...extra,
165
- quantity: 0
166
- }
167
- })
168
-
169
- setDataExtra(fetchedDataExtra)
170
- }
171
- }
172
-
173
- /**
174
- * The function `handleIncrementExtra` updates the quantity and price of a specific extra product in
175
- * an array based on the provided index and product ID.
176
- * @param root0
177
- * @param root0.extra
178
- * @param root0.index
179
- */
180
- function handleIncrementExtra ({ extra, index }) {
181
- // Desestructura las propiedades necesarias de dataOneProduct
182
- const { pId } = dataOneProduct || {}
183
-
184
- // Desestructura exPid de extra o establece un valor predeterminado si no existe
185
- const { exPid = null } = extra
186
-
187
- if (exPid && pId) {
188
- const newExtra = dataExtra.map((producto) => {
189
- if (exPid === producto.exPid) {
190
- // Desestructura la cantidad y el precio extra del producto o establece valores predeterminados
191
- const { quantity = 0, extraPrice = 0 } = producto
192
-
193
- // Calcula la nueva cantidad y el nuevo precio extra
194
- const newQuantity = quantity + 1
195
- const newExtraPrice = extraPrice * newQuantity
196
-
197
- return {
198
- ...producto,
199
- quantity: newQuantity,
200
- newExtraPrice
201
- }
202
- }
203
- return producto
204
- })
205
-
206
- // Actualiza el estado de dataExtra con el nuevo array
207
- setDataExtra(newExtra)
208
- }
209
- }
210
-
211
- /**
212
- *
213
- * @param root0
214
- * @param root0.extra
215
- * @param root0.index
216
- */
217
- function handleDecrementExtra ({ extra, index }) {
218
- // Desestructura las propiedades necesarias de dataOneProduct
219
- const { pId } = dataOneProduct || {}
220
-
221
- // Desestructura exPid de extra o establece un valor predeterminado si no existe
222
- const { exPid = null } = extra
223
-
224
- // Encuentra el índice del objeto extra en dataExtra
225
- const extraIndex = dataExtra.findIndex((item) => {return item.exPid === exPid})
226
-
227
- if (pId && exPid && extraIndex !== -1) {
228
- const newExtra = dataExtra.map((producto, i) => {
229
- if (exPid === producto.exPid) {
230
- // Desestructura la cantidad y el precio extra del producto o establece valores predeterminados
231
- const { quantity = 0, extraPrice = 0 } = producto
232
-
233
- // Calcula la nueva cantidad, evitando que sea negativa
234
- const newQuantity = Math.max(quantity - 1, 0)
235
-
236
- // Calcula el nuevo precio extra
237
- const newExtraPrice = newQuantity === 0 ? extraPrice : extraPrice * newQuantity
238
-
239
- return {
240
- ...producto,
241
- quantity: newQuantity,
242
- newExtraPrice
243
- }
244
- }
245
- return producto
246
- })
247
-
248
- // Actualiza el estado de dataExtra con el nuevo array
249
- setDataExtra(newExtra)
250
- }
251
- }
252
-
253
- const handleIncrease = () => {
254
- return setQuantity((prev) => { return prev + 1 })
255
- }
256
-
257
- const handleDecrease = () => {
258
- return setQuantity((prev) => { return prev - 1 })
259
- }
260
-
261
- const handleCountProducts = useCallback((ProPrice, quantity) => {
262
- if (!ProPrice || !quantity) {
263
- return 0 // Manejo de valores nulos o no numéricos
264
- }
265
-
266
- const price = parseFloat(ProPrice)
267
- const numericQuantity = parseInt(quantity, 10)
268
-
269
- if (isNaN(price) || isNaN(numericQuantity)) {
270
- return 0 // Manejo de valores no numéricos
271
- }
272
-
273
- if (numericQuantity <= 0 || price <= 0) {
274
- return price // Manejo de cantidades o precios no positivos
275
- }
276
-
277
- const totalPrice = Math.abs(numericQuantity * price)
278
- return numberFormat(totalPrice) // Si es necesario, aplicar formateo aquí
279
- }, [dataOneProduct])
280
-
281
- const handleAddOptional = ({ exOptional = null, codeCategory = null }) => {
282
- if (!exOptional || !codeCategory) return
283
- const item = dataOptional.find((item) => {return item.code === codeCategory})
284
- if (!item) return
285
- const idx = item.ExtProductFoodsSubOptionalAll.findIndex(
286
- (el) => {return el.opSubExPid === exOptional}
287
- )
288
- if (item && idx !== -1) {
289
- const updatedItem = {
290
- ...item,
291
- ExtProductFoodsSubOptionalAll: [
292
- ...item.ExtProductFoodsSubOptionalAll.slice(0, idx),
293
- {
294
- ...item.ExtProductFoodsSubOptionalAll[idx],
295
- check: !item.ExtProductFoodsSubOptionalAll[idx].check
296
- },
297
- ...item.ExtProductFoodsSubOptionalAll.slice(idx + 1)
298
- ]
299
- }
300
- const newData = dataOptional.map((el) =>
301
- {return el.code === codeCategory ? updatedItem : el}
302
- )
303
- setDataOptional((prevData) => {return [...newData]})
304
- }
305
- }
306
-
307
- const isValidDataExtra = (!dataExtra.length && !dataOneProduct?.pId) ? false : !validateExtraProducts(dataExtra)
308
-
309
- const isValid = (!dataOptional.length && !dataOneProduct?.pId) ? false : validateRequirements(dataOptional)
310
-
311
- const disabled = isValid || isValidDataExtra
312
-
313
- /**
314
- * Handles the addition of products to the cart.
315
- *
316
- * @param {Object} food - The selected food item.
317
- */
318
- const handleAddProducts = async (food) => {
319
- if (!food) return
320
- const idStore = food?.getStore?.idStore
321
- if (!idStore) {
322
- return
323
- }
324
- setLoadingButton(true)
325
- const isExistItemInShoppingCart = dataShoppingCard?.find((item) => {
326
- return item?.productFood && item?.productFood?.pId === food.pId
327
- }) ?? null
328
- if (!isExistItemInShoppingCart) handleMenu(1)
329
- const filteredDataOptional = filterDataOptional(dataOptional)
330
-
331
- const dataExtraFiltered = filterExtra(dataExtra)
332
-
333
- const refCodePid = RandomCode(20)
334
-
335
- const idShoppingCart = isExistItemInShoppingCart?.ShoppingCard
336
- try {
337
- const idStore = food?.getStore?.idStore
338
- const response = await registerShoppingCard({
339
- variables: {
340
- input: {
341
- ShoppingCard: idShoppingCart ?? null,
342
- cState: 1,
343
- pId: food.pId,
344
- idStore,
345
- refCodePid: idShoppingCart ? null : refCodePid,
346
- comments,
347
- cName: '',
348
- cantProducts: quantity,
349
- csDescription: '',
350
- dataExtra: dataExtraFiltered || [],
351
- dataOptional: filteredDataOptional || []
352
- },
353
- idSubArray: {
354
- setID: []
355
- }
356
- },
357
- update: (cache, { data: { getAllShoppingCard } }) => {
358
- return updateCacheMod({
359
- cache,
360
- query: GET_ALL_SHOPPING_CARD,
361
- nameFun: 'getAllShoppingCard',
362
- dataNew: getAllShoppingCard
363
- })
364
- }
365
- })
366
-
367
- if (response?.data) {
368
- if (!idShoppingCart) {
369
- setAlertBox({ message: 'producto agregado al carrito' })
370
- }
371
- if (idShoppingCart) {
372
- setAlertBox({ message: 'producto actualizado' })
373
- }
374
- // Perform actions after adding products to cart
375
- }
376
- } catch (error) {
377
- setAlertBox({ message: 'Ocurrió un error al añadir el producto al carrito' })
378
- }
379
- setLoadingButton(false)
380
- }
381
-
382
- const handleShowModalProduct = () => {
383
- if (openModalProduct) {
384
- setDataExtra([])
385
- setDataOneProduct({})
386
- setQuantity(1)
387
- setComments('')
388
- setDataOptional([])
389
- }
390
- if (queryParamProduct && openModalProduct) {
391
- handleCleanQuery('plato')
392
- }
393
- return setOpenModalProduct(!openModalProduct)
394
- }
395
-
396
- useEffect(() => {
397
- if (queryParamProduct) {
398
- const product = { pId: queryParamProduct }
399
- getOneProduct(product)
400
- }
401
- }, [queryParamProduct])
402
-
403
- return {
404
- quantity,
405
- disabled,
406
- comments,
407
- loading: loadingProduct || loading,
408
- dataOneProduct,
409
- loadingButton,
410
- dataExtra,
411
- dataOptional,
412
- setQuantity,
413
- handleShowModalProduct,
414
- handleDecrease,
415
- handleIncrease,
416
- getOneProduct,
417
- handleIncrementExtra,
418
- handleDecrementExtra,
419
- handleAddOptional,
420
- setComments,
421
- handleCountProducts,
422
- handleAddProducts
423
- }
424
- }
@@ -1,34 +0,0 @@
1
- import { useQuery } from '@apollo/client'
2
-
3
- import { GET_ALL_SHOPPING_CARD } from '../queries'
4
-
5
- export const useGetCart = ({
6
- setAlertBox = ({
7
- message
8
- }) => { return { message } },
9
- setCountItemProduct = (number) => { return number }
10
- } = {}) => {
11
- const {
12
- data,
13
- loading,
14
- error,
15
- called
16
- } = useQuery(GET_ALL_SHOPPING_CARD, {
17
- onCompleted: data => {
18
- if (Array.isArray(data?.getAllShoppingCard) && Number(data?.getAllShoppingCard?.length)) {
19
- setCountItemProduct(data?.getAllShoppingCard?.length)
20
- }
21
- },
22
- fetchPolicy: 'cache-and-network',
23
- onError: () => {
24
- setAlertBox({ message: 'No pudimos cargar el carrito...' })
25
- }
26
- })
27
- const cart = data?.getAllShoppingCard || []
28
- return [cart, {
29
- data,
30
- called,
31
- loading,
32
- error
33
- }]
34
- }
@@ -1,54 +0,0 @@
1
- import { useQuery } from '@apollo/client'
2
-
3
- import { GET_ALL_CATEGORIES_WITH_PRODUCT } from './queries'
4
- import { GetCatProductsWithProductResponse, ICatWithProduct } from './types'
5
-
6
- export const useCatWithProduct = ({
7
- max = 400,
8
- min = 0,
9
- search = null,
10
- productName = null,
11
- searchFilter = {},
12
- callback = () => {}
13
- }: ICatWithProduct) => {
14
- const {
15
- gender,
16
- desc,
17
- speciality
18
- } = searchFilter ?? {
19
- gender: [],
20
- desc: null,
21
- speciality: []
22
- }
23
- const {
24
- data,
25
- loading,
26
- error,
27
- fetchMore
28
- } = useQuery(GET_ALL_CATEGORIES_WITH_PRODUCT, {
29
- onCompleted: (data) => {
30
- callback(data as GetCatProductsWithProductResponse)
31
- },
32
- fetchPolicy: 'network-only',
33
- variables:
34
- {
35
- search,
36
- productName,
37
- gender,
38
- min,
39
- max,
40
- desc,
41
- categories: speciality
42
- }
43
- })
44
- const totalCount = data?.getCatProductsWithProduct?.totalCount
45
- return [
46
- data?.getCatProductsWithProduct?.catProductsWithProduct,
47
- {
48
- loading,
49
- error,
50
- fetchMore,
51
- totalCount
52
- }
53
- ]
54
- }
@@ -1,200 +0,0 @@
1
- import { gql } from '@apollo/client'
2
-
3
- export const CREATE_FOOD_PRODUCT = gql`
4
- mutation newRegisterFoodProduct($input: FoodProductInput){
5
- newRegisterFoodProduct(input: $input){
6
- success
7
- message
8
- }
9
- }
10
- `
11
- export const GET_BANNER_PROMO_DASHBOARD = gql`
12
- query getPromoStoreAdmin($min: Int, $max: Int){
13
- getPromoStoreAdmin(min: $min, max: $max){
14
- pSoId
15
- comments
16
- mainName
17
- metaTags
18
- urlImage
19
- bPromoState
20
- createAt
21
- updateAt
22
- }
23
- }
24
- `
25
-
26
- export const CREATE_STORE_CALENDAR = gql`
27
- mutation setStoreSchedule($input: ITstoreSchedule!){
28
- setStoreSchedule(input: $input){
29
- message
30
- success
31
- }
32
- }
33
- `
34
- export const DELETE_ONE_CAT_PRODUCTS = gql`
35
- mutation deleteCatOfProducts($idPc: ID!, $pState: Int){
36
- deleteCatOfProducts(idPc: $idPc, pState: $pState){
37
- success
38
- message
39
- }
40
- }
41
- `
42
- export const DELETE_ONE_CAT_PRODUCTS_FINAL = gql`
43
-
44
- mutation deleteCatFinalOfProducts($idPc: ID, $withProduct: Boolean) {
45
- deleteCatFinalOfProducts(idPc: $idPc, withProduct: $withProduct) {
46
- success
47
- message
48
- }
49
- }
50
- `
51
- export const DELETE_EXTRA_PRODUCTS = gql`
52
- mutation deleteExtraProduct($id: ID, $state: Int){
53
- deleteExtraProduct(id: $id, state: $state){
54
- success,
55
- message
56
- }
57
- }
58
- `
59
- export const EDIT_EXTRA_PRODUCTS = gql`
60
- mutation editExtProductFoods($input: InputExtProductFood!) {
61
- editExtProductFoods(input: $input) {
62
- success
63
- message
64
- }
65
- }
66
- `
67
- export const DELETE_CAT_EXTRA_PRODUCTS = gql`
68
- mutation DeleteExtProductFoodsOptional($opExPid: ID, $state: Int){
69
- DeleteExtProductFoodsOptional(opExPid: $opExPid, state: $state){
70
- success,
71
- message
72
- }
73
- }
74
- `
75
- export const DELETE_CAT_EXTRA_SUB_OPTIONAL_PRODUCTS = gql`
76
- mutation DeleteExtFoodSubsOptional($opSubExPid: ID, $state: Int){
77
- DeleteExtFoodSubsOptional(opSubExPid: $opSubExPid, state: $state){
78
- success,
79
- message
80
- }
81
- }
82
- `
83
- export const UPDATE_CAT_IN_PRODUCT = gql`
84
- mutation updatedCatWithProducts($input: LineItemsIdPro){
85
- updatedCatWithProducts(input: $input){
86
- success
87
- message
88
- }
89
- }
90
- `
91
- export const GET_ULTIMATE_CATEGORY_PRODUCTS = gql`
92
- query catProductsAll($search: String, $min: Int, $max: Int, $gender: [String], $desc: [String], $categories: [ID], ) {
93
- catProductsAll(search: $search, min: $min, max: $max, gender: $gender, desc: $desc, categories: $categories,) {
94
- carProId
95
- idStore
96
- pName
97
- ProDescription
98
- ProImage
99
- pState
100
- pDatCre
101
- pDatMod
102
- }
103
- }
104
- `
105
- export const GET_ALL_EXTRA_PRODUCT = gql`
106
- query ExtProductFoodsAll($search: String, $min: Int, $max: Int, $pId: ID) {
107
- ExtProductFoodsAll(search: $search, min: $min, max: $max, pId: $pId) {
108
- pId
109
- exPid
110
- exState
111
- extraName
112
- extraPrice
113
- state
114
- pDatCre
115
- pDatMod
116
- }
117
- }
118
- `
119
- export const GET_ALL_CATEGORIES_WITH_PRODUCT = gql`
120
- query getCatProductsWithProduct(
121
- $search: String
122
- $productName: String
123
- $min: Int
124
- $max: Int
125
- $gender: [String]
126
- $desc: [String]
127
- $categories: [ID]
128
- ) {
129
- getCatProductsWithProduct(
130
- search: $search
131
- min: $min
132
- productName: $productName
133
- max: $max
134
- gender: $gender
135
- desc: $desc
136
- categories: $categories
137
- ) {
138
- totalCount
139
- catProductsWithProduct {
140
- carProId
141
- pState
142
- pState
143
- ProImage
144
- idStore
145
- pName
146
- totalCount
147
- ProDescription
148
- ProImage
149
- pState
150
- createdAt
151
- updatedAt
152
- productFoodsAll {
153
- pId
154
- stock
155
- manageStock
156
- sizeId
157
- colorId
158
- carProId
159
- cId
160
- dId
161
- ctId
162
- idStore
163
- caId
164
- fId
165
- pName
166
- ProPrice
167
- ProDescuento
168
- ProUniDisponibles
169
- ProDescription
170
- ProProtegido
171
- ProAssurance
172
- ProImage
173
- ProStar
174
- ProWidth
175
- ProHeight
176
- ProLength
177
- ProWeight
178
- ProQuantity
179
- ProOutstanding
180
- ProDelivery
181
- ProVoltaje
182
- pState
183
- sTateLogistic
184
- createdAt
185
- updatedAt
186
- product_availables {
187
- availableProductId
188
- pId
189
- idStore
190
- dayAvailable
191
- startDate
192
- endDate
193
- createdAt
194
- updatedAt
195
- }
196
- }
197
- }
198
- }
199
- }
200
- `