npm-pkg-hook 1.12.7 → 1.12.9

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 (348) hide show
  1. package/.babelrc +0 -0
  2. package/.env +5 -0
  3. package/.github/pull_request_template.md +18 -0
  4. package/.github/workflows/pepeline.yaml +30 -0
  5. package/dist/index.js +47752 -10080
  6. package/dist/index.js.map +1 -0
  7. package/dist/index.mjs +47068 -9612
  8. package/dist/index.mjs.map +1 -0
  9. package/eslint.config.mts +153 -0
  10. package/expire.json +1 -0
  11. package/jsconfig.json +28 -0
  12. package/package.json +24 -61
  13. package/script.txt +7 -0
  14. package/src/config/client/errors.ts +39 -0
  15. package/src/config/client/index.ts +1 -0
  16. package/src/config/content/en.json +5 -0
  17. package/src/config/content/es.json +5 -0
  18. package/src/config/content/index.ts +16 -0
  19. package/src/cookies/index.ts +3 -0
  20. package/src/hooks/addTenMinutes/index.ts +14 -0
  21. package/src/hooks/calculateLogLatHaversine/index.ts +41 -0
  22. package/src/hooks/completeSchedules/index.ts +22 -0
  23. package/src/hooks/convertToMilitaryTime/index.ts +18 -0
  24. package/src/hooks/generateStoreURL/index.ts +41 -0
  25. package/src/hooks/generateTemplate/index.ts +66 -0
  26. package/src/hooks/getCardType/index.ts +24 -0
  27. package/src/hooks/getCategoriesWithProduct/helpers/index.ts +7 -0
  28. package/src/hooks/getCategoriesWithProduct/index.ts +62 -0
  29. package/src/hooks/getGlobalSession/index.ts +69 -0
  30. package/src/hooks/getSession/index.ts +72 -0
  31. package/src/hooks/getTodayTimestamps/index.ts +70 -0
  32. package/src/hooks/getTotalHours/index.ts +76 -0
  33. package/src/hooks/handleLogin/index.ts +14 -0
  34. package/src/hooks/index.ts +153 -0
  35. package/src/hooks/isTokenExpired/index.ts +17 -0
  36. package/src/hooks/newMessageSubscription/index.ts +28 -0
  37. package/src/hooks/newStoreOrderSubscription/index.ts +26 -0
  38. package/src/hooks/statusOpenStores/helpers/index.ts +124 -0
  39. package/src/hooks/statusOpenStores/index.ts +221 -0
  40. package/src/hooks/updateExtProductFoodsOptional/index.ts +49 -0
  41. package/src/hooks/useAcumulateDate/index.ts +18 -0
  42. package/src/hooks/useAllStoresPendingToRegister/index.ts +37 -0
  43. package/src/hooks/useAmountInput/index.ts +127 -0
  44. package/src/hooks/useAnimationFrame/index.ts +45 -0
  45. package/src/hooks/useAnimationText/index.ts +31 -0
  46. package/src/hooks/useAsideCart/helpers/index.ts +22 -0
  47. package/src/hooks/useAsideCart/index.ts +217 -0
  48. package/src/hooks/useAsideCart/queries.ts +10 -0
  49. package/src/hooks/useBanner/index.ts +20 -0
  50. package/src/hooks/useCart/index.ts +2 -0
  51. package/src/hooks/useCart/queries.ts +174 -0
  52. package/src/hooks/useCart/useCart/helpers/index.ts +79 -0
  53. package/src/hooks/useCart/useCart/index.ts +424 -0
  54. package/src/hooks/useCart/useGetCart/index.ts +34 -0
  55. package/src/hooks/useCatWithProduct/index.ts +54 -0
  56. package/src/hooks/useCatWithProduct/queries.ts +200 -0
  57. package/src/hooks/useCatWithProduct/types/index.ts +104 -0
  58. package/src/hooks/useCatWithProductClient/index.ts +57 -0
  59. package/src/hooks/useCatWithProductClient/queries.ts +56 -0
  60. package/src/hooks/useCategoriesProduct/index.ts +14 -0
  61. package/src/hooks/useCategoriesProduct/queries.ts +16 -0
  62. package/src/hooks/useCategoryInStore/index.ts +167 -0
  63. package/src/hooks/useCategoryInStore/queries.ts +78 -0
  64. package/src/hooks/useCategoryStore/index.ts +8 -0
  65. package/src/hooks/useCategoryStore/queries.ts +16 -0
  66. package/src/hooks/useChartData/index.ts +171 -0
  67. package/src/hooks/useChartData/useChartData/index.ts +200 -0
  68. package/src/hooks/useChartData/useChartDataAllOrders/index.ts +94 -0
  69. package/src/hooks/useChatRoomSubscription/index.ts +28 -0
  70. package/src/hooks/useCheckbox/index.ts +115 -0
  71. package/src/hooks/useCities/index.ts +14 -0
  72. package/src/hooks/useCities/queries.ts +12 -0
  73. package/src/hooks/useClients/index.ts +97 -0
  74. package/src/hooks/useClients/queries.ts +215 -0
  75. package/src/hooks/useColorByLetters/helpers/alea.ts +73 -0
  76. package/src/hooks/useColorByLetters/helpers/colors.ts +45 -0
  77. package/src/hooks/useColorByLetters/helpers/index.ts +22 -0
  78. package/src/hooks/useColorByLetters/helpers/mersenne_twister.ts +118 -0
  79. package/src/hooks/useColorByLetters/index.ts +24 -0
  80. package/src/hooks/useConnection/index.ts +24 -0
  81. package/src/hooks/useCountries/index.ts +20 -0
  82. package/src/hooks/useCountries/queries.ts +12 -0
  83. package/src/hooks/useCreateDeliveryTime/index.ts +51 -0
  84. package/src/hooks/useCreateOrderStatusType/index.ts +134 -0
  85. package/src/hooks/useCreateProduct/helpers/index.ts +23 -0
  86. package/src/hooks/useCreateProduct/helpers/manageCacheDataCatProduct/index.ts +52 -0
  87. package/src/hooks/useCreateProduct/helpers/useEditImageProduct/index.ts +182 -0
  88. package/src/hooks/useCreateProduct/index.ts +337 -0
  89. package/src/hooks/useCreateStorePendingToRegister/index.ts +17 -0
  90. package/src/hooks/useCreateStorePendingToRegister/queries.ts +10 -0
  91. package/src/hooks/useDashboardComponents/index.ts +50 -0
  92. package/src/hooks/useDeleteExtraProductFoods/index.ts +13 -0
  93. package/src/hooks/useDeleteSubProductOptional/index.ts +32 -0
  94. package/src/hooks/useDeleteSubProductOptional/queries.ts +10 -0
  95. package/src/hooks/useDeliveryTime/index.ts +29 -0
  96. package/src/hooks/useDepartments/index.ts +14 -0
  97. package/src/hooks/useDepartments/queries.ts +13 -0
  98. package/src/hooks/useDessert/helpers/index.ts +51 -0
  99. package/src/hooks/useDessert/index.ts +529 -0
  100. package/src/hooks/useDessertWithPrice/helpers/index.ts +76 -0
  101. package/src/hooks/useDessertWithPrice/index.ts +381 -0
  102. package/src/hooks/useDessertWithPrice/queries.ts +18 -0
  103. package/src/hooks/useDevWS/index.ts +53 -0
  104. package/src/hooks/useDevices/index.ts +2 -0
  105. package/src/hooks/useDevices/queries.ts +28 -0
  106. package/src/hooks/useDevices/useGetDevices.ts +28 -0
  107. package/src/hooks/useDevices/useRegisterDevices.ts +75 -0
  108. package/src/hooks/useDownloadReports/helpers/downloadFileFromResponse.ts +21 -0
  109. package/src/hooks/useDownloadReports/index.ts +2 -0
  110. package/src/hooks/useDownloadReports/useDownloadReportByDay/index.ts +105 -0
  111. package/src/hooks/useDownloadReports/useGetReportByDateRange/index.ts +116 -0
  112. package/src/hooks/useDrag/index.ts +79 -0
  113. package/src/hooks/useDropzone/index.ts +94 -0
  114. package/src/hooks/useDynamicAuth/index.ts +14 -0
  115. package/src/hooks/useDynamicAuth/queries.ts +24 -0
  116. package/src/hooks/useEditCategory/index.ts +41 -0
  117. package/src/hooks/useEditOneExtProductFoodOptional/index.ts +28 -0
  118. package/src/hooks/useEditOneExtProductFoodOptional/queries.ts +16 -0
  119. package/src/hooks/useEditSubProductOptional/index.ts +12 -0
  120. package/src/hooks/useEditSubProductOptional/queries.ts +10 -0
  121. package/src/hooks/useEmployee/index.ts +18 -0
  122. package/src/hooks/useEmployee/queries.ts +85 -0
  123. package/src/hooks/useEmployee/useCreateEmployee.ts +90 -0
  124. package/src/hooks/useEvent/index.ts +34 -0
  125. package/src/hooks/useFavoriteStores/index.ts +31 -0
  126. package/src/hooks/useFavoriteStores/queries.ts +54 -0
  127. package/src/hooks/useFetchJson/index.ts +25 -0
  128. package/src/hooks/useFetchMoreInteractions/index.jsx +39 -0
  129. package/src/hooks/useFilterConfigs/index.ts +173 -0
  130. package/src/hooks/useFingerprintjs/index.ts +197 -0
  131. package/src/hooks/useFormTools/index.ts +143 -0
  132. package/src/hooks/useFormatDate/index.ts +91 -0
  133. package/src/hooks/useFormatNumberPhone/index.ts +23 -0
  134. package/src/hooks/useFullScreenMode/index.ts +61 -0
  135. package/src/hooks/useGenerateNumberArray/index.ts +17 -0
  136. package/src/hooks/useGetAllLocationUser/index.ts +13 -0
  137. package/src/hooks/useGetAllLocationUser/queries.ts +44 -0
  138. package/src/hooks/useGetAllSales/index.ts +26 -0
  139. package/src/hooks/useGetCookies/index.ts +43 -0
  140. package/src/hooks/useGetExtProductFoodsSubOptionalAll/index.ts +15 -0
  141. package/src/hooks/useGetFoodRecomended/index.ts +33 -0
  142. package/src/hooks/useGetFoodRecomended/queries.ts +47 -0
  143. package/src/hooks/useGetMessagesToRoom/index.ts +23 -0
  144. package/src/hooks/useGetMinPrice/index.ts +13 -0
  145. package/src/hooks/useGetMinPrice/queries.ts +7 -0
  146. package/src/hooks/useGetOneStoreRating/index.ts +41 -0
  147. package/src/hooks/useGetOneStoreRating/queries.ts +18 -0
  148. package/src/hooks/useGetSalesAmountToday/index.ts +31 -0
  149. package/src/hooks/useGetStoreCookie/index.ts +21 -0
  150. package/src/hooks/useGoogleLogin/index.ts +169 -0
  151. package/src/hooks/useGoogleLogin/loadScript.ts +15 -0
  152. package/src/hooks/useGoogleLogin/removeScript.ts +7 -0
  153. package/src/hooks/useHover/index.ts +32 -0
  154. package/src/hooks/useImageOptimization/index.ts +32 -0
  155. package/src/hooks/useImageUploaderProduct/helper/canvasUtils.ts +146 -0
  156. package/src/hooks/useImageUploaderProduct/helper/getOrientation.ts +54 -0
  157. package/src/hooks/useImageUploaderProduct/helper/index.ts +5 -0
  158. package/src/hooks/useImageUploaderProduct/index.ts +295 -0
  159. package/src/hooks/useImageWeight/index.ts +55 -0
  160. package/src/hooks/useImagesStore/index.ts +227 -0
  161. package/src/hooks/useImagesStore/queries.ts +193 -0
  162. package/src/hooks/useImagesStore/utils/index.ts +4 -0
  163. package/src/hooks/useIncomingOrders/index.ts +11 -0
  164. package/src/hooks/useIncomingOrders/queries.ts +87 -0
  165. package/src/hooks/useInnerHtml/index.ts +39 -0
  166. package/src/hooks/useIntersection/index.ts +84 -0
  167. package/src/hooks/useInventory/index.ts +2 -0
  168. package/src/hooks/useInventory/queries.ts +58 -0
  169. package/src/hooks/useInventory/useGetProductsInStock.ts +16 -0
  170. package/src/hooks/useInventory/useUpdateManageStock.ts +41 -0
  171. package/src/hooks/useKeypress/index.ts +28 -0
  172. package/src/hooks/useLazyScript/index.ts +74 -0
  173. package/src/hooks/useLocalBackendIp/index.ts +34 -0
  174. package/src/hooks/useLocalSorage/index.ts +36 -0
  175. package/src/hooks/useLocationManager/index.ts +63 -0
  176. package/src/hooks/useLocationNavigate/index.ts +54 -0
  177. package/src/hooks/useLoginEmployeeInStore/index.ts +38 -0
  178. package/src/hooks/useLogout/helpers/BroadcastChannel.ts +74 -0
  179. package/src/hooks/useLogout/helpers/apiBaseUrl.ts +12 -0
  180. package/src/hooks/useLogout/helpers/fetchData.ts +37 -0
  181. package/src/hooks/useLogout/helpers/getCsrfToken.ts +37 -0
  182. package/src/hooks/useLogout/helpers/index.ts +65 -0
  183. package/src/hooks/useLogout/helpers/logger.ts +88 -0
  184. package/src/hooks/useLogout/helpers/parseUrl.ts +39 -0
  185. package/src/hooks/useLogout/index.ts +105 -0
  186. package/src/hooks/useManageNewOrder/helpers/index.ts +45 -0
  187. package/src/hooks/useManageNewOrder/helpers/mock.ts +0 -0
  188. package/src/hooks/useManageNewOrder/index.ts +104 -0
  189. package/src/hooks/useManageQueryParams/index.ts +120 -0
  190. package/src/hooks/useMobile/index.ts +65 -0
  191. package/src/hooks/useModules/helpers/index.ts +1 -0
  192. package/src/hooks/useModules/helpers/validateModules.ts +29 -0
  193. package/src/hooks/useModules/index.ts +124 -0
  194. package/src/hooks/useMouse/index.ts +55 -0
  195. package/src/hooks/useMutateHeight/index.ts +36 -0
  196. package/src/hooks/useOrderClient/index.ts +5 -0
  197. package/src/hooks/useOrderStatusTypes/index.ts +2 -0
  198. package/src/hooks/useOrderStatusTypes/useOrderStatusTypes/index.ts +133 -0
  199. package/src/hooks/useOrderStatusTypes/useUpdateOrderStatusPriorities/index.ts +99 -0
  200. package/src/hooks/useOrders/index.ts +3 -0
  201. package/src/hooks/useOrders/queries.ts +99 -0
  202. package/src/hooks/useOrders/useChangeOrderState/index.ts +128 -0
  203. package/src/hooks/useOrders/useOrdersFromStore/index.ts +78 -0
  204. package/src/hooks/usePWAInstall/index.ts +38 -0
  205. package/src/hooks/usePaymentMethod/index.ts +3 -0
  206. package/src/hooks/usePaymentMethod/paymentMethod.gql.ts +62 -0
  207. package/src/hooks/usePaymentMethod/paymentMethod.types.ts +28 -0
  208. package/src/hooks/usePaymentMethod/useCreatePaymentMethod/index.ts +25 -0
  209. package/src/hooks/usePaymentMethod/useGetAllPaymentMethods/index.ts +19 -0
  210. package/src/hooks/usePaymentMethod/useGetPaymentMethod/index.ts +26 -0
  211. package/src/hooks/usePortFetcher/index.ts +33 -0
  212. package/src/hooks/usePrintSaleTicket/index.ts +68 -0
  213. package/src/hooks/useProductsFood/index.ts +341 -0
  214. package/src/hooks/useProductsFood/queriesStore.ts +964 -0
  215. package/src/hooks/useProductsFood/types/index.ts +0 -0
  216. package/src/hooks/useProductsFood/useEditProduct.ts +49 -0
  217. package/src/hooks/useProductsFood/usetagsProducts.ts +101 -0
  218. package/src/hooks/useProviders/index.ts +3 -0
  219. package/src/hooks/useProviders/queries.ts +31 -0
  220. package/src/hooks/useProviders/useProvidersCreateStore/index.ts +13 -0
  221. package/src/hooks/useProviders/useProvidersDataStore/index.ts +25 -0
  222. package/src/hooks/useProvidersStore/index.ts +25 -0
  223. package/src/hooks/useProvidersStore/queries.ts +31 -0
  224. package/src/hooks/usePushNotificationOrder/index.ts +52 -0
  225. package/src/hooks/usePushNotifications/helpers/index.ts +123 -0
  226. package/src/hooks/usePushNotifications/index.ts +150 -0
  227. package/src/hooks/useQueryLocationsMap/index.ts +20 -0
  228. package/src/hooks/useQueryLocationsMap/queries.ts +40 -0
  229. package/src/hooks/useRatingArrayData/index.ts +54 -0
  230. package/src/hooks/useRatingArrayData/queries.ts +19 -0
  231. package/src/hooks/useReactToPrint/index.txt +1223 -0
  232. package/src/hooks/useRemoveExtraProductFoodsOptional/index.ts +24 -0
  233. package/src/hooks/useRemoveExtraProductFoodsOptional/queries.ts +48 -0
  234. package/src/hooks/useReport/index.ts +48 -0
  235. package/src/hooks/useReport/queries.ts +72 -0
  236. package/src/hooks/useRestaurant/helpers/index.ts +28 -0
  237. package/src/hooks/useRestaurant/helpers/manageStatusOpen.ts +26 -0
  238. package/src/hooks/useRestaurant/index.ts +71 -0
  239. package/src/hooks/useRestaurant/queries.ts +81 -0
  240. package/src/hooks/useRoads/index.ts +20 -0
  241. package/src/hooks/useRoads/queries.ts +13 -0
  242. package/src/hooks/useRoles/index.ts +4 -0
  243. package/src/hooks/useRoles/queries.ts +70 -0
  244. package/src/hooks/useRoles/useCreateRole.ts +40 -0
  245. package/src/hooks/useRoles/useGetRoles.ts +37 -0
  246. package/src/hooks/useRoles/useRemoveRoles.ts +40 -0
  247. package/src/hooks/useRoles/useUpdateRolesPriority.ts +44 -0
  248. package/src/hooks/useSales/helpers/add-product.utils.ts +120 -0
  249. package/src/hooks/useSales/helpers/apply-discount-to-cart.utils.ts +292 -0
  250. package/src/hooks/useSales/helpers/comment-product.utils.ts +41 -0
  251. package/src/hooks/useSales/helpers/constants/index.ts +38 -0
  252. package/src/hooks/useSales/helpers/extras.utils.ts +42 -0
  253. package/src/hooks/useSales/helpers/filterProductsByCarProId.utils.ts +17 -0
  254. package/src/hooks/useSales/helpers/increment-product-quantity.utils.ts +76 -0
  255. package/src/hooks/useSales/helpers/index.ts +3 -0
  256. package/src/hooks/useSales/helpers/initializer.utils.ts +22 -0
  257. package/src/hooks/useSales/helpers/isStockInsufficient.ts +3 -0
  258. package/src/hooks/useSales/helpers/remove-product.utils.test.ts +49 -0
  259. package/src/hooks/useSales/helpers/remove-product.utils.ts +34 -0
  260. package/src/hooks/useSales/helpers/resolveProduct.ts +29 -0
  261. package/src/hooks/useSales/helpers/useAddToCart.ts +64 -0
  262. package/src/hooks/useSales/index.ts +1418 -0
  263. package/src/hooks/useSales/queries.ts +532 -0
  264. package/src/hooks/useSales/types/index.ts +206 -0
  265. package/src/hooks/useSales/types/use-sales.types.ts +8 -0
  266. package/src/hooks/useSales/useGetSale.ts +21 -0
  267. package/src/hooks/useSales/useTotalSales.ts +24 -0
  268. package/src/hooks/useSaveAvailableProduct/helpers/index.ts +38 -0
  269. package/src/hooks/useSaveAvailableProduct/index.ts +32 -0
  270. package/src/hooks/useSaveAvailableProduct/queries.ts +10 -0
  271. package/src/hooks/useSaveLocation/index.ts +17 -0
  272. package/src/hooks/useSaveLocation/queries.ts +19 -0
  273. package/src/hooks/useSchedule/index.ts +35 -0
  274. package/src/hooks/useSchedule/queries.ts +43 -0
  275. package/src/hooks/useSchedule/schedule.ts +79 -0
  276. package/src/hooks/useScheduleData/index.ts +135 -0
  277. package/src/hooks/useScroll/index.ts +56 -0
  278. package/src/hooks/useScrollRotate/index.ts +16 -0
  279. package/src/hooks/useSetImageProducts/index.ts +59 -0
  280. package/src/hooks/useSetImageProducts/queries.ts +18 -0
  281. package/src/hooks/useSetSession/index.ts +44 -0
  282. package/src/hooks/useSetState/index.ts +24 -0
  283. package/src/hooks/useSetupSchedule/helpers/index.ts +85 -0
  284. package/src/hooks/useSetupSchedule/index.ts +284 -0
  285. package/src/hooks/useStatusOpenStore/helpers/index.ts +124 -0
  286. package/src/hooks/useStatusOpenStore/index.ts +195 -0
  287. package/src/hooks/useStatusOrdersClient/helpers/index.ts +14 -0
  288. package/src/hooks/useStatusOrdersClient/index.ts +18 -0
  289. package/src/hooks/useStatusOrdersClient/queries.ts +80 -0
  290. package/src/hooks/useStock/index.ts +1 -0
  291. package/src/hooks/useStock/useStockUpdatedAllSubscription.ts +40 -0
  292. package/src/hooks/useStockMovements/helpers/index.ts +16 -0
  293. package/src/hooks/useStockMovements/index.ts +39 -0
  294. package/src/hooks/useStore/index.ts +83 -0
  295. package/src/hooks/useStore/queries.ts +163 -0
  296. package/src/hooks/useStoreCalendar/index.ts +5 -0
  297. package/src/hooks/useStoreContacts/index.ts +53 -0
  298. package/src/hooks/useStoreContacts/queries.ts +48 -0
  299. package/src/hooks/useStoreTable/index.ts +2 -0
  300. package/src/hooks/useStoreTable/queries.ts +47 -0
  301. package/src/hooks/useStoreTable/useStoreTableCreate.ts +77 -0
  302. package/src/hooks/useStoreTable/useStoreTables.ts +15 -0
  303. package/src/hooks/useSubscriptionValidation/index.ts +112 -0
  304. package/src/hooks/useTagProducts/index.ts +3 -0
  305. package/src/hooks/useTagProducts/useDeleteOneTag.ts +106 -0
  306. package/src/hooks/useTagProducts/useGetAllTags.ts +68 -0
  307. package/src/hooks/useTagProducts/useRegisterMultipleTags.ts +157 -0
  308. package/src/hooks/useTheme/index.ts +65 -0
  309. package/src/hooks/useTimeAgo/useTimeAgo.ts +39 -0
  310. package/src/hooks/useTokenCards/index.ts +45 -0
  311. package/src/hooks/useTopProductsMovements/index.ts +27 -0
  312. package/src/hooks/useTotalAllSales/index.ts +25 -0
  313. package/src/hooks/useTotalProductsInStock/index.ts +23 -0
  314. package/src/hooks/useTotalProductsSold/index.ts +23 -0
  315. package/src/hooks/useTotalProductsSolded/index.ts +20 -0
  316. package/src/hooks/useUpdateCart/index.ts +131 -0
  317. package/src/hooks/useUpdateCartCookie/index.ts +60 -0
  318. package/src/hooks/useUpdateDashboardComponent/index.ts +91 -0
  319. package/src/hooks/useUpdateExistingOrders/index.ts +85 -0
  320. package/src/hooks/useUpdateExtProductFoodsSubOptional/index.ts +61 -0
  321. package/src/hooks/useUpdateModuleOrder/index.ts +37 -0
  322. package/src/hooks/useUpdateMultipleExtProduct/index.ts +34 -0
  323. package/src/hooks/useUpdateMultipleExtProduct/queries.ts +33 -0
  324. package/src/hooks/useUpdateMultipleProducts/index.ts +117 -0
  325. package/src/hooks/useUpdateMultipleProducts/queries.ts +51 -0
  326. package/src/hooks/useUploadProducts/helpers/index.ts +1 -0
  327. package/src/hooks/useUploadProducts/helpers/parseNumber.ts +37 -0
  328. package/src/hooks/useUploadProducts/helpers/validateProductDataExcel.ts +73 -0
  329. package/src/hooks/useUploadProducts/index.ts +442 -0
  330. package/src/hooks/useUpsertGoal/index.ts +68 -0
  331. package/src/hooks/useUser/index.ts +24 -0
  332. package/src/hooks/useUser/queries.ts +131 -0
  333. package/src/hooks/useWeeklyStockMovement/helpers/index.ts +32 -0
  334. package/src/hooks/useWeeklyStockMovement/index.ts +52 -0
  335. package/src/hooks/useWindowSize/index.ts +45 -0
  336. package/src/index.ts +8 -0
  337. package/src/mock/dessert/index.ts +16 -0
  338. package/src/mock/index.ts +1 -0
  339. package/src/security/index.ts +1 -0
  340. package/src/services/index.ts +1 -0
  341. package/src/utils/UtilDateRange.ts +56 -0
  342. package/src/utils/generateCode.ts +222 -0
  343. package/src/utils/index.ts +2 -0
  344. package/src/utils/utils.ts +344 -0
  345. package/tsconfig.eslint.json +16 -0
  346. package/tsconfig.json +21 -0
  347. package/tsup.config.ts +24 -0
  348. package/dist/index.cjs +0 -20089
@@ -0,0 +1,1223 @@
1
+ /* eslint-disable no-proto */
2
+ /* eslint-disable no-undef */
3
+ /* eslint-disable promise/param-names */
4
+ /* eslint-disable no-cond-assign */
5
+ /* eslint-disable no-use-before-define */
6
+ /* eslint-disable no-unsafe-finally */
7
+ /* eslint-disable no-redeclare */
8
+ /* eslint-disable new-cap */
9
+ /* eslint-disable no-var */
10
+ /* eslint-disable no-void */
11
+ /* eslint-disable no-sequences */
12
+ /* eslint-disable no-unused-expressions */
13
+ !(function (e, t) {
14
+ typeof exports === 'object' && typeof module === 'object'
15
+ ? (module.exports = t(require('react'), require('react-dom')))
16
+ : typeof define === 'function' && define.amd
17
+ ? define('lib', ['react', 'react-dom'], t)
18
+ : typeof exports === 'object'
19
+ ? (exports.lib = t(require('react'), require('react-dom')))
20
+ : (e.lib = t(e.react, e['react-dom']))
21
+ })(typeof self !== 'undefined' ? self : this, function (e, t) {
22
+ return (function () {
23
+ 'use strict'
24
+ const n = {
25
+ 655: function (e, t, n) {
26
+ n.r(t),
27
+ n.d(t, {
28
+ __assign: function () {
29
+ return i
30
+ },
31
+ __asyncDelegator: function () {
32
+ return E
33
+ },
34
+ __asyncGenerator: function () {
35
+ return x
36
+ },
37
+ __asyncValues: function () {
38
+ return S
39
+ },
40
+ __await: function () {
41
+ return O
42
+ },
43
+ __awaiter: function () {
44
+ return h
45
+ },
46
+ __classPrivateFieldGet: function () {
47
+ return k
48
+ },
49
+ __classPrivateFieldIn: function () {
50
+ return R
51
+ },
52
+ __classPrivateFieldSet: function () {
53
+ return M
54
+ },
55
+ __createBinding: function () {
56
+ return g
57
+ },
58
+ __decorate: function () {
59
+ return c
60
+ },
61
+ __esDecorate: function () {
62
+ return u
63
+ },
64
+ __exportStar: function () {
65
+ return b
66
+ },
67
+ __extends: function () {
68
+ return o
69
+ },
70
+ __generator: function () {
71
+ return y
72
+ },
73
+ __importDefault: function () {
74
+ return C
75
+ },
76
+ __importStar: function () {
77
+ return A
78
+ },
79
+ __makeTemplateObject: function () {
80
+ return j
81
+ },
82
+ __metadata: function () {
83
+ return p
84
+ },
85
+ __param: function () {
86
+ return l
87
+ },
88
+ __propKey: function () {
89
+ return f
90
+ },
91
+ __read: function () {
92
+ return m
93
+ },
94
+ __rest: function () {
95
+ return a
96
+ },
97
+ __runInitializers: function () {
98
+ return s
99
+ },
100
+ __setFunctionName: function () {
101
+ return d
102
+ },
103
+ __spread: function () {
104
+ return w
105
+ },
106
+ __spreadArray: function () {
107
+ return P
108
+ },
109
+ __spreadArrays: function () {
110
+ return _
111
+ },
112
+ __values: function () {
113
+ return v
114
+ }
115
+ })
116
+ let r = function (e, t) {
117
+ return (
118
+ (r =
119
+ Object.setPrototypeOf ||
120
+ ({ __proto__: [] } instanceof Array &&
121
+ function (e, t) {
122
+ e.__proto__ = t
123
+ }) ||
124
+ function (e, t) {
125
+ for (const n in t) { Object.prototype.hasOwnProperty.call(t, n) && (e[n] = t[n]) }
126
+ }),
127
+ r(e, t)
128
+ )
129
+ }
130
+ function o (e, t) {
131
+ if (typeof t !== 'function' && t !== null) {
132
+ throw new TypeError(
133
+ 'Class extends value ' +
134
+ String(t) +
135
+ ' is not a constructor or null'
136
+ )
137
+ }
138
+ function n () {
139
+ this.constructor = e
140
+ }
141
+ r(e, t),
142
+ (e.prototype =
143
+ t === null
144
+ ? Object.create(t)
145
+ : ((n.prototype = t.prototype), new n()))
146
+ }
147
+ var i = function () {
148
+ return (
149
+ (i =
150
+ Object.assign ||
151
+ function (e) {
152
+ for (var t, n = 1, r = arguments.length; n < r; n++) {
153
+ for (const o in (t = arguments[n])) {
154
+ Object.prototype.hasOwnProperty.call(t, o) &&
155
+ (e[o] = t[o])
156
+ }
157
+ }
158
+ return e
159
+ }),
160
+ i.apply(this, arguments)
161
+ )
162
+ }
163
+ function a (e, t) {
164
+ const n = {}
165
+ for (var r in e) {
166
+ Object.prototype.hasOwnProperty.call(e, r) &&
167
+ t.indexOf(r) < 0 &&
168
+ (n[r] = e[r])
169
+ }
170
+ if (
171
+ e != null &&
172
+ typeof Object.getOwnPropertySymbols === 'function'
173
+ ) {
174
+ let o = 0
175
+ for (r = Object.getOwnPropertySymbols(e); o < r.length; o++) {
176
+ t.indexOf(r[o]) < 0 &&
177
+ Object.prototype.propertyIsEnumerable.call(e, r[o]) &&
178
+ (n[r[o]] = e[r[o]])
179
+ }
180
+ }
181
+ return n
182
+ }
183
+ function c (e, t, n, r) {
184
+ let o
185
+ const i = arguments.length
186
+ let a =
187
+ i < 3
188
+ ? t
189
+ : r === null
190
+ ? (r = Object.getOwnPropertyDescriptor(t, n))
191
+ : r
192
+ if (
193
+ typeof Reflect === 'object' &&
194
+ typeof Reflect.decorate === 'function'
195
+ ) { a = Reflect.decorate(e, t, n, r) } else {
196
+ for (let c = e.length - 1; c >= 0; c--) {
197
+ (o = e[c]) &&
198
+ (a = (i < 3 ? o(a) : i > 3 ? o(t, n, a) : o(t, n)) || a)
199
+ }
200
+ }
201
+ return i > 3 && a && Object.defineProperty(t, n, a), a
202
+ }
203
+ function l (e, t) {
204
+ return function (n, r) {
205
+ t(n, r, e)
206
+ }
207
+ }
208
+ function u (e, t, n, r, o, i) {
209
+ function a (e) {
210
+ if (void 0 !== e && typeof e !== 'function') { throw new TypeError('Function expected') }
211
+ return e
212
+ }
213
+ for (
214
+ var c,
215
+ l = r.kind,
216
+ u = l === 'getter' ? 'get' : l === 'setter' ? 'set' : 'value',
217
+ s = !t && e ? (r.static ? e : e.prototype) : null,
218
+ f = t || (s ? Object.getOwnPropertyDescriptor(s, r.name) : {}),
219
+ d = !1,
220
+ p = n.length - 1;
221
+ p >= 0;
222
+ p--
223
+ ) {
224
+ const h = {}
225
+ for (var y in r) h[y] = y === 'access' ? {} : r[y]
226
+ for (var y in r.access) h.access[y] = r.access[y]
227
+ h.addInitializer = function (e) {
228
+ if (d) {
229
+ throw new TypeError(
230
+ 'Cannot add initializers after decoration has completed'
231
+ )
232
+ }
233
+ i.push(a(e || null))
234
+ }
235
+ const g = (0, n[p])(
236
+ l === 'accessor' ? { get: f.get, set: f.set } : f[u],
237
+ h
238
+ )
239
+ if (l === 'accessor') {
240
+ if (void 0 === g) continue
241
+ if (g === null || typeof g !== 'object') { throw new TypeError('Object expected') }
242
+ (c = a(g.get)) && (f.get = c),
243
+ (c = a(g.set)) && (f.set = c),
244
+ (c = a(g.init)) && o.push(c)
245
+ } else (c = a(g)) && (l === 'field' ? o.push(c) : (f[u] = c))
246
+ }
247
+ s && Object.defineProperty(s, r.name, f), (d = !0)
248
+ }
249
+ function s (e, t, n) {
250
+ for (var r = arguments.length > 2, o = 0; o < t.length; o++) { n = r ? t[o].call(e, n) : t[o].call(e) }
251
+ return r ? n : void 0
252
+ }
253
+ function f (e) {
254
+ return typeof e === 'symbol' ? e : ''.concat(e)
255
+ }
256
+ function d (e, t, n) {
257
+ return (
258
+ typeof t === 'symbol' &&
259
+ (t = t.description ? '['.concat(t.description, ']') : ''),
260
+ Object.defineProperty(e, 'name', {
261
+ configurable: !0,
262
+ value: n ? ''.concat(n, ' ', t) : t
263
+ })
264
+ )
265
+ }
266
+ function p (e, t) {
267
+ if (
268
+ typeof Reflect === 'object' &&
269
+ typeof Reflect.metadata === 'function'
270
+ ) { return Reflect.metadata(e, t) }
271
+ }
272
+ function h (e, t, n, r) {
273
+ return new (n || (n = Promise))(function (o, i) {
274
+ function a (e) {
275
+ try {
276
+ l(r.next(e))
277
+ } catch (e) {
278
+ i(e)
279
+ }
280
+ }
281
+ function c (e) {
282
+ try {
283
+ l(r.throw(e))
284
+ } catch (e) {
285
+ i(e)
286
+ }
287
+ }
288
+ function l (e) {
289
+ let t
290
+ e.done
291
+ ? o(e.value)
292
+ : ((t = e.value),
293
+ t instanceof n
294
+ ? t
295
+ : new n(function (e) {
296
+ e(t)
297
+ })).then(a, c)
298
+ }
299
+ l((r = r.apply(e, t || [])).next())
300
+ })
301
+ }
302
+ function y (e, t) {
303
+ let n
304
+ let r
305
+ let o
306
+ let i
307
+ let a = {
308
+ label: 0,
309
+ sent: function () {
310
+ if (1 & o[0]) throw o[1]
311
+ return o[1]
312
+ },
313
+ trys: [],
314
+ ops: []
315
+ }
316
+ return (
317
+ (i = { next: c(0), throw: c(1), return: c(2) }),
318
+ typeof Symbol === 'function' &&
319
+ (i[Symbol.iterator] = function () {
320
+ return this
321
+ }),
322
+ i
323
+ )
324
+ function c (c) {
325
+ return function (l) {
326
+ return (function (c) {
327
+ if (n) throw new TypeError('Generator is already executing.')
328
+ for (; i && ((i = 0), c[0] && (a = 0)), a;) {
329
+ try {
330
+ if (
331
+ ((n = 1),
332
+ r &&
333
+ (o =
334
+ 2 & c[0]
335
+ ? r.return
336
+ : c[0]
337
+ ? r.throw || ((o = r.return) && o.call(r), 0)
338
+ : r.next) &&
339
+ !(o = o.call(r, c[1])).done)
340
+ ) { return o }
341
+ switch (((r = 0), o && (c = [2 & c[0], o.value]), c[0])) {
342
+ case 0:
343
+ case 1:
344
+ o = c
345
+ break
346
+ case 4:
347
+ return a.label++, { value: c[1], done: !1 }
348
+ case 5:
349
+ a.label++, (r = c[1]), (c = [0])
350
+ continue
351
+ case 7:
352
+ (c = a.ops.pop()), a.trys.pop()
353
+ continue
354
+ default:
355
+ if (
356
+ !(
357
+ (o =
358
+ (o = a.trys).length > 0 && o[o.length - 1]) ||
359
+ (c[0] !== 6 && c[0] !== 2)
360
+ )
361
+ ) {
362
+ a = 0
363
+ continue
364
+ }
365
+ if (
366
+ c[0] === 3 &&
367
+ (!o || (c[1] > o[0] && c[1] < o[3]))
368
+ ) {
369
+ a.label = c[1]
370
+ break
371
+ }
372
+ if (c[0] === 6 && a.label < o[1]) {
373
+ (a.label = o[1]), (o = c)
374
+ break
375
+ }
376
+ if (o && a.label < o[2]) {
377
+ (a.label = o[2]), a.ops.push(c)
378
+ break
379
+ }
380
+ o[2] && a.ops.pop(), a.trys.pop()
381
+ continue
382
+ }
383
+ c = t.call(e, a)
384
+ } catch (e) {
385
+ (c = [6, e]), (r = 0)
386
+ } finally {
387
+ n = o = 0
388
+ }
389
+ }
390
+ if (5 & c[0]) throw c[1]
391
+ return { value: c[0] ? c[1] : void 0, done: !0 }
392
+ })([c, l])
393
+ }
394
+ }
395
+ }
396
+ var g = Object.create
397
+ ? function (e, t, n, r) {
398
+ void 0 === r && (r = n)
399
+ let o = Object.getOwnPropertyDescriptor(t, n);
400
+ (o &&
401
+ !('get' in o
402
+ ? !t.__esModule
403
+ : o.writable || o.configurable)) ||
404
+ (o = {
405
+ enumerable: !0,
406
+ get: function () {
407
+ return t[n]
408
+ }
409
+ }),
410
+ Object.defineProperty(e, r, o)
411
+ }
412
+ : function (e, t, n, r) {
413
+ void 0 === r && (r = n), (e[r] = t[n])
414
+ }
415
+ function b (e, t) {
416
+ for (const n in e) {
417
+ n === 'default' ||
418
+ Object.prototype.hasOwnProperty.call(t, n) ||
419
+ g(t, e, n)
420
+ }
421
+ }
422
+ function v (e) {
423
+ const t = typeof Symbol === 'function' && Symbol.iterator
424
+ const n = t && e[t]
425
+ let r = 0
426
+ if (n) return n.call(e)
427
+ if (e && typeof e.length === 'number') {
428
+ return {
429
+ next: function () {
430
+ return (
431
+ e && r >= e.length && (e = void 0),
432
+ { value: e && e[r++], done: !e }
433
+ )
434
+ }
435
+ }
436
+ }
437
+ throw new TypeError(
438
+ t ? 'Object is not iterable.' : 'Symbol.iterator is not defined.'
439
+ )
440
+ }
441
+ function m (e, t) {
442
+ let n = typeof Symbol === 'function' && e[Symbol.iterator]
443
+ if (!n) return e
444
+ let r
445
+ let o
446
+ const i = n.call(e)
447
+ const a = []
448
+ try {
449
+ for (; (void 0 === t || t-- > 0) && !(r = i.next()).done;) { a.push(r.value) }
450
+ } catch (e) {
451
+ o = { error: e }
452
+ } finally {
453
+ try {
454
+ r && !r.done && (n = i.return) && n.call(i)
455
+ } finally {
456
+ if (o) throw o.error
457
+ }
458
+ }
459
+ return a
460
+ }
461
+ function w () {
462
+ for (var e = [], t = 0; t < arguments.length; t++) { e = e.concat(m(arguments[t])) }
463
+ return e
464
+ }
465
+ function _ () {
466
+ for (var e = 0, t = 0, n = arguments.length; t < n; t++) { e += arguments[t].length }
467
+ const r = Array(e)
468
+ let o = 0
469
+ for (t = 0; t < n; t++) {
470
+ for (let i = arguments[t], a = 0, c = i.length; a < c; a++, o++) { r[o] = i[a] }
471
+ }
472
+ return r
473
+ }
474
+ function P (e, t, n) {
475
+ if (n || arguments.length === 2) {
476
+ for (var r, o = 0, i = t.length; o < i; o++) {
477
+ (!r && o in t) ||
478
+ (r || (r = Array.prototype.slice.call(t, 0, o)),
479
+ (r[o] = t[o]))
480
+ }
481
+ }
482
+ return e.concat(r || Array.prototype.slice.call(t))
483
+ }
484
+ function O (e) {
485
+ return this instanceof O ? ((this.v = e), this) : new O(e)
486
+ }
487
+ function x (e, t, n) {
488
+ if (!Symbol.asyncIterator) { throw new TypeError('Symbol.asyncIterator is not defined.') }
489
+ let r
490
+ const o = n.apply(e, t || [])
491
+ const i = []
492
+ return (
493
+ (r = {}),
494
+ a('next'),
495
+ a('throw'),
496
+ a('return'),
497
+ (r[Symbol.asyncIterator] = function () {
498
+ return this
499
+ }),
500
+ r
501
+ )
502
+ function a (e) {
503
+ o[e] &&
504
+ (r[e] = function (t) {
505
+ return new Promise(function (n, r) {
506
+ i.push([e, t, n, r]) > 1 || c(e, t)
507
+ })
508
+ })
509
+ }
510
+ function c (e, t) {
511
+ try {
512
+ (n = o[e](t)).value instanceof O
513
+ ? Promise.resolve(n.value.v).then(l, u)
514
+ : s(i[0][2], n)
515
+ } catch (e) {
516
+ s(i[0][3], e)
517
+ }
518
+ let n
519
+ }
520
+ function l (e) {
521
+ c('next', e)
522
+ }
523
+ function u (e) {
524
+ c('throw', e)
525
+ }
526
+ function s (e, t) {
527
+ e(t), i.shift(), i.length && c(i[0][0], i[0][1])
528
+ }
529
+ }
530
+ function E (e) {
531
+ let t, n
532
+ return (
533
+ (t = {}),
534
+ r('next'),
535
+ r('throw', function (e) {
536
+ throw e
537
+ }),
538
+ r('return'),
539
+ (t[Symbol.iterator] = function () {
540
+ return this
541
+ }),
542
+ t
543
+ )
544
+ function r (r, o) {
545
+ t[r] = e[r]
546
+ ? function (t) {
547
+ return (n = !n)
548
+ ? { value: O(e[r](t)), done: !1 }
549
+ : o
550
+ ? o(t)
551
+ : t
552
+ }
553
+ : o
554
+ }
555
+ }
556
+ function S (e) {
557
+ if (!Symbol.asyncIterator) { throw new TypeError('Symbol.asyncIterator is not defined.') }
558
+ let t
559
+ const n = e[Symbol.asyncIterator]
560
+ return n
561
+ ? n.call(e)
562
+ : ((e = v(e)),
563
+ (t = {}),
564
+ r('next'),
565
+ r('throw'),
566
+ r('return'),
567
+ (t[Symbol.asyncIterator] = function () {
568
+ return this
569
+ }),
570
+ t)
571
+ function r (n) {
572
+ t[n] =
573
+ e[n] &&
574
+ function (t) {
575
+ return new Promise(function (r, o) {
576
+ !(function (e, t, n, r) {
577
+ Promise.resolve(r).then(function (t) {
578
+ e({ value: t, done: n })
579
+ }, t)
580
+ })(r, o, (t = e[n](t)).done, t.value)
581
+ })
582
+ }
583
+ }
584
+ }
585
+ function j (e, t) {
586
+ return (
587
+ Object.defineProperty
588
+ ? Object.defineProperty(e, 'raw', { value: t })
589
+ : (e.raw = t),
590
+ e
591
+ )
592
+ }
593
+ const T = Object.create
594
+ ? function (e, t) {
595
+ Object.defineProperty(e, 'default', {
596
+ enumerable: !0,
597
+ value: t
598
+ })
599
+ }
600
+ : function (e, t) {
601
+ e.default = t
602
+ }
603
+ function A (e) {
604
+ if (e && e.__esModule) return e
605
+ const t = {}
606
+ if (e != null) {
607
+ for (const n in e) {
608
+ n !== 'default' &&
609
+ Object.prototype.hasOwnProperty.call(e, n) &&
610
+ g(t, e, n)
611
+ }
612
+ }
613
+ return T(t, e), t
614
+ }
615
+ function C (e) {
616
+ return e && e.__esModule ? e : { default: e }
617
+ }
618
+ function k (e, t, n, r) {
619
+ if (n === 'a' && !r) {
620
+ throw new TypeError(
621
+ 'Private accessor was defined without a getter'
622
+ )
623
+ }
624
+ if (typeof t === 'function' ? e !== t || !r : !t.has(e)) {
625
+ throw new TypeError(
626
+ 'Cannot read private member from an object whose class did not declare it'
627
+ )
628
+ }
629
+ return n === 'm'
630
+ ? r
631
+ : n === 'a'
632
+ ? r.call(e)
633
+ : r
634
+ ? r.value
635
+ : t.get(e)
636
+ }
637
+ function M (e, t, n, r, o) {
638
+ if (r === 'm') { throw new TypeError('Private method is not writable') }
639
+ if (r === 'a' && !o) {
640
+ throw new TypeError(
641
+ 'Private accessor was defined without a setter'
642
+ )
643
+ }
644
+ if (typeof t === 'function' ? e !== t || !o : !t.has(e)) {
645
+ throw new TypeError(
646
+ 'Cannot write private member to an object whose class did not declare it'
647
+ )
648
+ }
649
+ return (
650
+ r === 'a' ? o.call(e, n) : o ? (o.value = n) : t.set(e, n), n
651
+ )
652
+ }
653
+ function R (e, t) {
654
+ if (t === null || (typeof t !== 'object' && typeof t !== 'function')) { throw new TypeError("Cannot use 'in' operator on non-object") }
655
+ return typeof e === 'function' ? t === e : e.has(t)
656
+ }
657
+ },
658
+ 156: function (t) {
659
+ t.exports = e
660
+ },
661
+ 111: function (e) {
662
+ e.exports = t
663
+ }
664
+ }
665
+ const r = {}
666
+ function o (e) {
667
+ const t = r[e]
668
+ if (void 0 !== t) return t.exports
669
+ const i = (r[e] = { exports: {} })
670
+ return n[e](i, i.exports, o), i.exports
671
+ }
672
+ (o.d = function (e, t) {
673
+ for (const n in t) {
674
+ o.o(t, n) &&
675
+ !o.o(e, n) &&
676
+ Object.defineProperty(e, n, { enumerable: !0, get: t[n] })
677
+ }
678
+ }),
679
+ (o.o = function (e, t) {
680
+ return Object.prototype.hasOwnProperty.call(e, t)
681
+ }),
682
+ (o.r = function (e) {
683
+ typeof Symbol !== 'undefined' &&
684
+ Symbol.toStringTag &&
685
+ Object.defineProperty(e, Symbol.toStringTag, { value: 'Module' }),
686
+ Object.defineProperty(e, '__esModule', { value: !0 })
687
+ })
688
+ const i = {}
689
+ return (
690
+ (function () {
691
+ const e = i
692
+ Object.defineProperty(e, '__esModule', { value: !0 }),
693
+ (e.useReactToPrint = e.PrintContextConsumer = void 0)
694
+ const t = o(655)
695
+ const n = o(156)
696
+ const r = o(111)
697
+ const a = Object.prototype.hasOwnProperty.call(n, 'createContext')
698
+ const c =
699
+ Object.prototype.hasOwnProperty.call(n, 'useMemo') &&
700
+ Object.prototype.hasOwnProperty.call(n, 'useCallback')
701
+ const l = a ? n.createContext({}) : null
702
+ e.PrintContextConsumer = l
703
+ ? l.Consumer
704
+ : function () {
705
+ return null
706
+ }
707
+ const u = {
708
+ copyStyles: !0,
709
+ pageStyle:
710
+ '\n @page {\n /* Remove browser default header (title) and footer (url) */\n padding: 10px;\n }\n @media print {\n body {\n /* Tell browsers to print background colors */\n -webkit-print-color-adjust: exact; /* Chrome/Safari/Edge/Opera */\n color-adjust: exact; /* Firefox */\n }\n }\n ',
711
+ removeAfterPrint: !1,
712
+ suppressErrors: !1
713
+ }
714
+ const s = (function (e) {
715
+ function o () {
716
+ const n = (e !== null && e.apply(this, arguments)) || this
717
+ return (
718
+ (n.startPrint = function (e) {
719
+ const t = n.props
720
+ const r = t.onAfterPrint
721
+ const o = t.onPrintError
722
+ const i = t.print
723
+ const a = t.documentTitle
724
+ setTimeout(function () {
725
+ let t, c
726
+ if (e.contentWindow) {
727
+ if ((e.contentWindow.focus(), i)) {
728
+ i(e)
729
+ .then(n.handleRemoveIframe)
730
+ .catch(function (e) {
731
+ o
732
+ ? o('print', e)
733
+ : n.logMessages([
734
+ 'An error was thrown by the specified `print` function'
735
+ ])
736
+ })
737
+ } else if (e.contentWindow.print) {
738
+ const l =
739
+ (c =
740
+ (t = e.contentDocument) === null || void 0 === t
741
+ ? void 0
742
+ : t.title) !==
743
+ null && void 0 !== c
744
+ ? c
745
+ : ''
746
+ const u = e.ownerDocument.title
747
+ a &&
748
+ ((e.ownerDocument.title = a),
749
+ e.contentDocument && (e.contentDocument.title = a)),
750
+ e.contentWindow.print(),
751
+ a &&
752
+ ((e.ownerDocument.title = u),
753
+ e.contentDocument && (e.contentDocument.title = l))
754
+ } else {
755
+ n.logMessages([
756
+ 'Printing for this browser is not currently possible: the browser does not have a `print` method available for iframes.'
757
+ ])
758
+ }
759
+ r && r(), n.handleRemoveIframe()
760
+ } else n.logMessages(['Printing failed because the `contentWindow` of the print iframe did not load. This is possibly an error with `react-to-print`. Please file an issue: https://github.com/gregnb/react-to-print/issues/'])
761
+ }, 500)
762
+ }),
763
+ (n.triggerPrint = function (e) {
764
+ const t = n.props
765
+ const r = t.onBeforePrint
766
+ const o = t.onPrintError
767
+ if (r) {
768
+ const i = r()
769
+ i && typeof i.then === 'function'
770
+ ? i
771
+ .then(function () {
772
+ n.startPrint(e)
773
+ })
774
+ .catch(function (e) {
775
+ o && o('onBeforePrint', e)
776
+ })
777
+ : n.startPrint(e)
778
+ } else n.startPrint(e)
779
+ }),
780
+ (n.handleClick = function () {
781
+ const e = n.props
782
+ const t = e.onBeforeGetContent
783
+ const r = e.onPrintError
784
+ if (t) {
785
+ const o = t()
786
+ o && typeof o.then === 'function'
787
+ ? o.then(n.handlePrint).catch(function (e) {
788
+ r && r('onBeforeGetContent', e)
789
+ })
790
+ : n.handlePrint()
791
+ } else n.handlePrint()
792
+ }),
793
+ (n.handlePrint = function () {
794
+ const e = n.props
795
+ const o = e.bodyClass
796
+ const i = e.content
797
+ const a = e.copyStyles
798
+ const c = e.fonts
799
+ const l = e.pageStyle
800
+ const u = e.nonce
801
+ const s = i()
802
+ if (void 0 !== s) {
803
+ if (s !== null) {
804
+ const f = document.createElement('iframe');
805
+ (f.width = ''.concat(
806
+ document.documentElement.clientWidth,
807
+ 'px'
808
+ )),
809
+ (f.height = ''.concat(
810
+ document.documentElement.clientHeight,
811
+ 'px'
812
+ )),
813
+ (f.style.position = 'absolute'),
814
+ (f.style.top = '-'.concat(
815
+ document.documentElement.clientHeight + 100,
816
+ 'px'
817
+ )),
818
+ (f.style.left = '-'.concat(
819
+ document.documentElement.clientWidth + 100,
820
+ 'px'
821
+ )),
822
+ (f.id = 'printWindow'),
823
+ (f.srcdoc = '<!DOCTYPE html>')
824
+ const d = (0, r.findDOMNode)(s)
825
+ if (d) {
826
+ const p = d.cloneNode(!0)
827
+ const h = p instanceof Text
828
+ const y = document.querySelectorAll(
829
+ "link[rel='stylesheet']"
830
+ )
831
+ const g = h ? [] : p.querySelectorAll('img')
832
+ const b = h ? [] : p.querySelectorAll('video')
833
+ const v = c ? c.length : 0;
834
+ (n.numResourcesToLoad =
835
+ y.length + g.length + b.length + v),
836
+ (n.resourcesLoaded = []),
837
+ (n.resourcesErrored = [])
838
+ const m = function (e, r) {
839
+ n.resourcesLoaded.includes(e)
840
+ ? n.logMessages(
841
+ [
842
+ 'Tried to mark a resource that has already been handled',
843
+ e
844
+ ],
845
+ 'debug'
846
+ )
847
+ : (r
848
+ ? (n.logMessages(
849
+ t.__spreadArray(
850
+ [
851
+ '"react-to-print" was unable to load a resource but will continue attempting to print the page'
852
+ ],
853
+ t.__read(r),
854
+ !1
855
+ )
856
+ ),
857
+ n.resourcesErrored.push(e))
858
+ : n.resourcesLoaded.push(e),
859
+ n.resourcesLoaded.length +
860
+ n.resourcesErrored.length ===
861
+ n.numResourcesToLoad && n.triggerPrint(f))
862
+ };
863
+ (f.onload = function () {
864
+ let e, r, i, s
865
+ f.onload = null
866
+ const y =
867
+ f.contentDocument ||
868
+ ((r = f.contentWindow) === null || void 0 === r
869
+ ? void 0
870
+ : r.document)
871
+ if (y) {
872
+ y.body.appendChild(p),
873
+ c &&
874
+ (((i = f.contentDocument) === null ||
875
+ void 0 === i
876
+ ? void 0
877
+ : i.fonts) &&
878
+ ((s = f.contentWindow) === null || void 0 === s
879
+ ? void 0
880
+ : s.FontFace)
881
+ ? c.forEach(function (e) {
882
+ const t = new FontFace(e.family, e.source, {
883
+ weight: e.weight,
884
+ style: e.style
885
+ })
886
+ f.contentDocument.fonts.add(t),
887
+ t.loaded
888
+ .then(function () {
889
+ m(t)
890
+ })
891
+ .catch(function (e) {
892
+ m(t, [
893
+ 'Failed loading the font:',
894
+ t,
895
+ 'Load error:',
896
+ e
897
+ ])
898
+ })
899
+ })
900
+ : (c.forEach(function (e) {
901
+ return m(e)
902
+ }),
903
+ n.logMessages([
904
+ '"react-to-print" is not able to load custom fonts because the browser does not support the FontFace API but will continue attempting to print the page'
905
+ ])))
906
+ const v = typeof l === 'function' ? l() : l
907
+ if (typeof v !== 'string') {
908
+ n.logMessages([
909
+ '"react-to-print" expected a "string" from `pageStyle` but received "'.concat(
910
+ typeof v,
911
+ '". Styles from `pageStyle` will not be applied.'
912
+ )
913
+ ])
914
+ } else {
915
+ const w = y.createElement('style')
916
+ u &&
917
+ (w.setAttribute('nonce', u),
918
+ y.head.setAttribute('nonce', u)),
919
+ w.appendChild(y.createTextNode(v)),
920
+ y.head.appendChild(w)
921
+ }
922
+ if (
923
+ (o &&
924
+ (e = y.body.classList).add.apply(
925
+ e,
926
+ t.__spreadArray(
927
+ [],
928
+ t.__read(o.split(' ')),
929
+ !1
930
+ )
931
+ ),
932
+ !h)
933
+ ) {
934
+ for (
935
+ var _ = h ? [] : d.querySelectorAll('canvas'),
936
+ P = y.querySelectorAll('canvas'),
937
+ O = 0;
938
+ O < _.length;
939
+ ++O
940
+ ) {
941
+ const x = _[O]
942
+ const E = P[O].getContext('2d')
943
+ E && E.drawImage(x, 0, 0)
944
+ }
945
+ const S = function (e) {
946
+ const t = g[e]
947
+ const n = t.getAttribute('src')
948
+ if (n) {
949
+ const r = new Image();
950
+ (r.onload = function () {
951
+ return m(t)
952
+ }),
953
+ (r.onerror = function (e, n, r, o, i) {
954
+ return m(t, [
955
+ 'Error loading <img>',
956
+ t,
957
+ 'Error',
958
+ i
959
+ ])
960
+ }),
961
+ (r.src = n)
962
+ } else {
963
+ m(t, [
964
+ 'Found an <img> tag with an empty "src" attribute. This prevents pre-loading it. The <img> is:',
965
+ t
966
+ ])
967
+ }
968
+ }
969
+ for (O = 0; O < g.length; O++) S(O)
970
+ const j = function (e) {
971
+ const t = b[e]
972
+ t.preload = 'auto'
973
+ const n = t.getAttribute('poster')
974
+ if (n) {
975
+ const r = new Image();
976
+ (r.onload = function () {
977
+ return m(t)
978
+ }),
979
+ (r.onerror = function (e, r, o, i, a) {
980
+ return m(t, [
981
+ 'Error loading video poster',
982
+ n,
983
+ 'for video',
984
+ t,
985
+ 'Error:',
986
+ a
987
+ ])
988
+ }),
989
+ (r.src = n)
990
+ } else {
991
+ t.readyState >= 2
992
+ ? m(t)
993
+ : ((t.onloadeddata = function () {
994
+ return m(t)
995
+ }),
996
+ (t.onerror = function (e, n, r, o, i) {
997
+ return m(t, [
998
+ 'Error loading video',
999
+ t,
1000
+ 'Error',
1001
+ i
1002
+ ])
1003
+ }),
1004
+ (t.onstalled = function () {
1005
+ return m(t, [
1006
+ 'Loading video stalled, skipping',
1007
+ t
1008
+ ])
1009
+ }))
1010
+ }
1011
+ }
1012
+ for (O = 0; O < b.length; O++) j(O)
1013
+ const T = 'input'
1014
+ const A = d.querySelectorAll(T)
1015
+ const C = y.querySelectorAll(T)
1016
+ for (O = 0; O < A.length; O++) { C[O].value = A[O].value }
1017
+ const k = 'input[type=checkbox],input[type=radio]'
1018
+ const M = d.querySelectorAll(k)
1019
+ const R = y.querySelectorAll(k)
1020
+ for (O = 0; O < M.length; O++) { R[O].checked = M[O].checked }
1021
+ const D = 'select'
1022
+ const I = d.querySelectorAll(D)
1023
+ const q = y.querySelectorAll(D)
1024
+ for (O = 0; O < I.length; O++) { q[O].value = I[O].value }
1025
+ }
1026
+ if (a) {
1027
+ for (
1028
+ var F = document.querySelectorAll(
1029
+ "style, link[rel='stylesheet']"
1030
+ ),
1031
+ L = function (e, t) {
1032
+ const r = F[e]
1033
+ if (r.tagName.toLowerCase() === 'style') {
1034
+ const o = y.createElement(r.tagName)
1035
+ const i = r.sheet
1036
+ if (i) {
1037
+ let a = ''
1038
+ try {
1039
+ for (
1040
+ var c = i.cssRules.length, l = 0;
1041
+ l < c;
1042
+ ++l
1043
+ ) {
1044
+ typeof i.cssRules[l].cssText ===
1045
+ 'string' &&
1046
+ (a += ''.concat(
1047
+ i.cssRules[l].cssText,
1048
+ '\r\n'
1049
+ ))
1050
+ }
1051
+ } catch (e) {
1052
+ n.logMessages(
1053
+ [
1054
+ 'A stylesheet could not be accessed. This is likely due to the stylesheet having cross-origin imports, and many browsers block script access to cross-origin stylesheets. See https://github.com/gregnb/react-to-print/issues/429 for details. You may be able to load the sheet by both marking the stylesheet with the cross `crossorigin` attribute, and setting the `Access-Control-Allow-Origin` header on the server serving the stylesheet. Alternatively, host the stylesheet on your domain to avoid this issue entirely.',
1055
+ r
1056
+ ],
1057
+ 'warning'
1058
+ )
1059
+ }
1060
+ o.setAttribute(
1061
+ 'id',
1062
+ 'react-to-print-'.concat(e)
1063
+ ),
1064
+ u && o.setAttribute('nonce', u),
1065
+ o.appendChild(y.createTextNode(a)),
1066
+ y.head.appendChild(o)
1067
+ }
1068
+ } else if (r.getAttribute('href')) {
1069
+ if (r.hasAttribute('disabled')) {
1070
+ n.logMessages(
1071
+ [
1072
+ '`react-to-print` encountered a <link> tag with a `disabled` attribute and will ignore it. Note that the `disabled` attribute is deprecated, and some browsers ignore it. You should stop using it. https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link#attr-disabled. The <link> is:',
1073
+ r
1074
+ ],
1075
+ 'warning'
1076
+ ),
1077
+ m(r)
1078
+ } else {
1079
+ for (
1080
+ var s = y.createElement(r.tagName),
1081
+ f = ((l = 0), r.attributes.length);
1082
+ l < f;
1083
+ ++l
1084
+ ) {
1085
+ const d = r.attributes[l]
1086
+ d &&
1087
+ s.setAttribute(
1088
+ d.nodeName,
1089
+ d.nodeValue || ''
1090
+ )
1091
+ }
1092
+ (s.onload = function () {
1093
+ return m(s)
1094
+ }),
1095
+ (s.onerror = function (
1096
+ e,
1097
+ t,
1098
+ n,
1099
+ r,
1100
+ o
1101
+ ) {
1102
+ return m(s, [
1103
+ 'Failed to load',
1104
+ s,
1105
+ 'Error:',
1106
+ o
1107
+ ])
1108
+ }),
1109
+ u && s.setAttribute('nonce', u),
1110
+ y.head.appendChild(s)
1111
+ }
1112
+ } else {
1113
+ n.logMessages(
1114
+ [
1115
+ '`react-to-print` encountered a <link> tag with an empty `href` attribute. In addition to being invalid HTML, this can cause problems in many browsers, and so the <link> was not loaded. The <link> is:',
1116
+ r
1117
+ ],
1118
+ 'warning'
1119
+ ),
1120
+ m(r)
1121
+ }
1122
+ },
1123
+ W = ((O = 0), F.length);
1124
+ O < W;
1125
+ ++O
1126
+ ) { L(O) }
1127
+ }
1128
+ }
1129
+ (n.numResourcesToLoad !== 0 && a) ||
1130
+ n.triggerPrint(f)
1131
+ }),
1132
+ n.handleRemoveIframe(!0),
1133
+ document.body.appendChild(f)
1134
+ } else {
1135
+ n.logMessages([
1136
+ '"react-to-print" could not locate the DOM node corresponding with the `content` prop'
1137
+ ])
1138
+ }
1139
+ } else {
1140
+ n.logMessages([
1141
+ 'There is nothing to print because the "content" prop returned "null". Please ensure "content" is renderable before allowing "react-to-print" to be called.'
1142
+ ])
1143
+ }
1144
+ } else {
1145
+ n.logMessages([
1146
+ 'To print a functional component ensure it is wrapped with `React.forwardRef`, and ensure the forwarded ref is used. See the README for an example: https://github.com/gregnb/react-to-print#examples'
1147
+ ])
1148
+ }
1149
+ }),
1150
+ (n.handleRemoveIframe = function (e) {
1151
+ const t = n.props.removeAfterPrint
1152
+ if (e || t) {
1153
+ const r = document.getElementById('printWindow')
1154
+ r && document.body.removeChild(r)
1155
+ }
1156
+ }),
1157
+ (n.logMessages = function (e, t) {
1158
+ void 0 === t && (t = 'error'),
1159
+ n.props.suppressErrors ||
1160
+ (t === 'error'
1161
+ ? console.error(e)
1162
+ : t === 'warning'
1163
+ ? console.warn(e)
1164
+ : t === 'debug' && console.debug(e))
1165
+ }),
1166
+ n
1167
+ )
1168
+ }
1169
+ return (
1170
+ t.__extends(o, e),
1171
+ (o.prototype.render = function () {
1172
+ const e = this.props
1173
+ const t = e.children
1174
+ const r = e.trigger
1175
+ if (r) { return n.cloneElement(r(), { onClick: this.handleClick }) }
1176
+ if (!l) {
1177
+ return (
1178
+ this.logMessages([
1179
+ '"react-to-print" requires React ^16.3.0 to be able to use "PrintContext"'
1180
+ ]),
1181
+ null
1182
+ )
1183
+ }
1184
+ const o = { handlePrint: this.handleClick }
1185
+ return n.createElement(l.Provider, { value: o }, t)
1186
+ }),
1187
+ (o.defaultProps = u),
1188
+ o
1189
+ )
1190
+ })(n.Component);
1191
+ (e.default = s),
1192
+ (e.useReactToPrint = function (e) {
1193
+ if (!c) {
1194
+ return (
1195
+ e.suppressErrors ||
1196
+ console.error(
1197
+ '"react-to-print" requires React ^16.8.0 to be able to use "useReactToPrint"'
1198
+ ),
1199
+ function () {
1200
+ throw new Error(
1201
+ '"react-to-print" requires React ^16.8.0 to be able to use "useReactToPrint"'
1202
+ )
1203
+ }
1204
+ )
1205
+ }
1206
+ const r = n.useMemo(
1207
+ function () {
1208
+ return new s(t.__assign(t.__assign({}, u), e))
1209
+ },
1210
+ [e]
1211
+ )
1212
+ return n.useCallback(
1213
+ function () {
1214
+ return r.handleClick()
1215
+ },
1216
+ [r]
1217
+ )
1218
+ })
1219
+ })(),
1220
+ i
1221
+ )
1222
+ })()
1223
+ })