@vtex/faststore-plugin-buyer-portal 1.1.116-poc-9 → 1.2.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 (41) hide show
  1. package/package.json +42 -42
  2. package/src/features/addresses/layouts/AddressDetailsLayout/AddressDetailsLayout.tsx +0 -1
  3. package/src/features/addresses/layouts/AddressesLayout/AddressesLayout.tsx +0 -1
  4. package/src/features/budgets/layouts/BudgetsDetailsLayout/BudgetsDetailsLayout.tsx +0 -1
  5. package/src/features/collections/layouts/CollectionsLayout/CollectionsLayout.tsx +0 -1
  6. package/src/features/contracts/hooks/index.ts +0 -2
  7. package/src/features/contracts/services/get-contract-details.service.ts +0 -4
  8. package/src/features/credit-cards/layouts/CreditCardsLayout/CreditCardLayout.tsx +0 -1
  9. package/src/features/custom-fields/layouts/CustomFieldsLayout/CustomFieldsLayout.tsx +0 -1
  10. package/src/features/org-units/clients/OrgUnitClient.ts +15 -2
  11. package/src/features/org-units/components/OrgUnitBreadcrumb/OrgUnitBreadcrumbLink.tsx +0 -1
  12. package/src/features/org-units/hooks/index.ts +0 -1
  13. package/src/features/org-units/layouts/OrgUnitDetailsLayout/OrgUnitDetailsLayout.tsx +29 -32
  14. package/src/features/org-units/services/get-org-unit-basic-data.service.ts +0 -4
  15. package/src/features/org-units/services/get-org-unit-by-user-id.service.ts +0 -4
  16. package/src/features/org-units/types/OrgUnitSummaryData.ts +0 -18
  17. package/src/features/org-units/types/index.ts +0 -2
  18. package/src/features/payment-methods/layouts/PaymentMethodsLayout/PaymentMethodsLayout.tsx +0 -1
  19. package/src/features/profile/layouts/ProfileLayout/ProfileLayout.tsx +16 -46
  20. package/src/features/shared/components/Error/Error.tsx +13 -12
  21. package/src/features/shared/components/index.ts +0 -1
  22. package/src/features/shared/components/withErrorBoundary/withErrorBoundary.tsx +1 -0
  23. package/src/features/shared/hooks/index.ts +0 -2
  24. package/src/features/shared/layouts/ContractTabsLayout/ContractTabsLayout.tsx +9 -14
  25. package/src/features/shared/layouts/ErrorTabsLayout/ErrorTabsLayout.tsx +0 -1
  26. package/src/features/shared/layouts/LoadingTabsLayout/LoadingTabsLayout.tsx +27 -6
  27. package/src/features/shared/utils/withAuthLoader.ts +1 -1
  28. package/src/features/shared/utils/withAuthProvider.tsx +0 -1
  29. package/src/features/shared/utils/withProviders.tsx +2 -1
  30. package/src/features/users/services/get-user-by-id.service.ts +0 -4
  31. package/src/pages/org-unit-details.tsx +62 -42
  32. package/src/pages/profile.tsx +64 -48
  33. package/src/themes/index.scss +0 -1
  34. package/src/features/contracts/hooks/useContractDetails.ts +0 -22
  35. package/src/features/contracts/hooks/useContractsByOrgUnitId.ts +0 -20
  36. package/src/features/org-units/hooks/useOrgUnitBasicData.ts +0 -20
  37. package/src/features/shared/components/PageLoader/PageLoader.tsx +0 -47
  38. package/src/features/shared/components/PageLoader/index.ts +0 -1
  39. package/src/features/shared/components/PageLoader/page-loader.scss +0 -22
  40. package/src/features/shared/hooks/useAuth.ts +0 -50
  41. package/src/features/shared/hooks/useCookieMonitor.ts +0 -73
@@ -1,73 +0,0 @@
1
- import { useEffect, useState } from "react";
2
-
3
- import storeConfig from "discovery.config";
4
-
5
- import { AUT_COOKIE_KEY } from "../utils/constants";
6
-
7
- /**
8
- * Hook to monitor when authentication cookie becomes available.
9
- * Used to detect when cookies load after pre-fetch scenarios.
10
- *
11
- * @returns boolean indicating if auth cookie is present
12
- */
13
- export const useCookieMonitor = () => {
14
- const [hasCookie, setHasCookie] = useState(false);
15
-
16
- useEffect(() => {
17
- const checkCookie = () => {
18
- if (typeof document === "undefined") return false;
19
-
20
- const cookieName = `${AUT_COOKIE_KEY}_${storeConfig?.api.storeId}`;
21
- const cookies = document.cookie.split(";");
22
-
23
- const authCookie = cookies.find((cookie) =>
24
- cookie.trim().startsWith(`${cookieName}=`)
25
- );
26
-
27
- const hasCookieValue =
28
- !!authCookie && authCookie.split("=")[1]?.trim() !== "";
29
-
30
- console.log("[useCookieMonitor] Checking cookie:", {
31
- cookieName,
32
- hasCookie: hasCookieValue,
33
- cookieValue: authCookie
34
- ? authCookie.split("=")[1]?.substring(0, 10) + "..."
35
- : "none",
36
- });
37
-
38
- return hasCookieValue;
39
- };
40
-
41
- // Check immediately
42
- const initialCheck = checkCookie();
43
- console.log("[useCookieMonitor] Initial check:", initialCheck);
44
- setHasCookie(initialCheck);
45
-
46
- // If no cookie yet, poll for it
47
- if (!initialCheck) {
48
- console.log("[useCookieMonitor] Starting cookie polling...");
49
- const interval = setInterval(() => {
50
- const hasAuthCookie = checkCookie();
51
-
52
- if (hasAuthCookie) {
53
- console.log("[useCookieMonitor] Cookie found! Stopping poll.");
54
- setHasCookie(true);
55
- clearInterval(interval);
56
- }
57
- }, 100); // Check every 100ms
58
-
59
- // Cleanup after 5 seconds max
60
- const timeout = setTimeout(() => {
61
- console.log("[useCookieMonitor] Polling timeout reached (5s)");
62
- clearInterval(interval);
63
- }, 5000);
64
-
65
- return () => {
66
- clearInterval(interval);
67
- clearTimeout(timeout);
68
- };
69
- }
70
- }, []);
71
-
72
- return hasCookie;
73
- };