@redacto.io/consent-sdk-react 10.0.0-beta.9 → 10.0.0

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 (264) hide show
  1. package/NOTICE.md +17 -0
  2. package/README.md +141 -3
  3. package/dist/chunk-FEGTW73Q.mjs +182 -0
  4. package/dist/fonts.d.mts +35 -0
  5. package/dist/fonts.d.ts +35 -0
  6. package/dist/fonts.js +183 -0
  7. package/dist/fonts.mjs +10 -0
  8. package/dist/index.d.mts +12 -1
  9. package/dist/index.d.ts +12 -1
  10. package/dist/index.js +724 -365
  11. package/dist/index.mjs +346 -201
  12. package/dist/montserrat.generated-NBTECYRW.mjs +22 -0
  13. package/dist/privacy-center.d.mts +0 -1
  14. package/dist/privacy-center.d.ts +0 -1
  15. package/dist/privacy-center.js +2 -66
  16. package/dist/privacy-center.mjs +2 -66
  17. package/dist/types-6Aj7faxL.d.mts +57 -0
  18. package/dist/types-6Aj7faxL.d.ts +57 -0
  19. package/package.json +10 -1
  20. package/.turbo/turbo-build.log +0 -22
  21. package/.turbo/turbo-test.log +0 -203
  22. package/.turbo/turbo-verify-pack.log +0 -6
  23. package/CHANGELOG.md +0 -353
  24. package/src/RedactoNoticeAssisted/RedactoNoticeAssisted.test.tsx +0 -934
  25. package/src/RedactoNoticeAssisted/RedactoNoticeAssisted.tsx +0 -2160
  26. package/src/RedactoNoticeAssisted/api/index.ts +0 -275
  27. package/src/RedactoNoticeAssisted/api/types.ts +0 -182
  28. package/src/RedactoNoticeAssisted/assets/redacto-logo.png +0 -0
  29. package/src/RedactoNoticeAssisted/constants.ts +0 -51
  30. package/src/RedactoNoticeAssisted/i18n.ts +0 -1408
  31. package/src/RedactoNoticeAssisted/index.ts +0 -1
  32. package/src/RedactoNoticeAssisted/injectStyles.ts +0 -251
  33. package/src/RedactoNoticeAssisted/styles.ts +0 -730
  34. package/src/RedactoNoticeAssisted/types.ts +0 -26
  35. package/src/RedactoNoticeAssisted/useMediaQuery.ts +0 -36
  36. package/src/RedactoNoticeConsent/RedactoNoticeConsent.test.tsx +0 -1152
  37. package/src/RedactoNoticeConsent/RedactoNoticeConsent.tsx +0 -4308
  38. package/src/RedactoNoticeConsent/api/index.ts +0 -542
  39. package/src/RedactoNoticeConsent/api/sandbox.ts +0 -150
  40. package/src/RedactoNoticeConsent/api/types.ts +0 -515
  41. package/src/RedactoNoticeConsent/assets/redacto-logo.png +0 -0
  42. package/src/RedactoNoticeConsent/components/DigiLockerCallback.tsx +0 -602
  43. package/src/RedactoNoticeConsent/components/index.ts +0 -7
  44. package/src/RedactoNoticeConsent/constants.ts +0 -20
  45. package/src/RedactoNoticeConsent/index.ts +0 -1
  46. package/src/RedactoNoticeConsent/injectStyles.ts +0 -151
  47. package/src/RedactoNoticeConsent/language-codes.ts +0 -95
  48. package/src/RedactoNoticeConsent/services/storage.ts +0 -122
  49. package/src/RedactoNoticeConsent/styles.ts +0 -409
  50. package/src/RedactoNoticeConsent/types.ts +0 -80
  51. package/src/RedactoNoticeConsent/useMediaQuery.ts +0 -36
  52. package/src/RedactoNoticeConsentInline/RedactoNoticeConsentInline.test.tsx +0 -369
  53. package/src/RedactoNoticeConsentInline/RedactoNoticeConsentInline.tsx +0 -687
  54. package/src/RedactoNoticeConsentInline/api/index.ts +0 -106
  55. package/src/RedactoNoticeConsentInline/api/types.ts +0 -183
  56. package/src/RedactoNoticeConsentInline/assets/redacto-logo.png +0 -0
  57. package/src/RedactoNoticeConsentInline/index.ts +0 -1
  58. package/src/RedactoNoticeConsentInline/injectStyles.ts +0 -40
  59. package/src/RedactoNoticeConsentInline/styles.ts +0 -397
  60. package/src/RedactoNoticeConsentInline/types.ts +0 -51
  61. package/src/RedactoNoticeConsentInline/useMediaQuery.ts +0 -36
  62. package/src/RedactoPrivacyCenter/NotificationsPage.tsx +0 -182
  63. package/src/RedactoPrivacyCenter/PrivacyCenterActivityPage.tsx +0 -19
  64. package/src/RedactoPrivacyCenter/PrivacyCenterCaseDetailsPage.tsx +0 -156
  65. package/src/RedactoPrivacyCenter/PrivacyCenterConsentManagerPage.tsx +0 -17
  66. package/src/RedactoPrivacyCenter/PrivacyCenterFormPage.tsx +0 -79
  67. package/src/RedactoPrivacyCenter/PrivacyCenterHomePage.tsx +0 -36
  68. package/src/RedactoPrivacyCenter/PrivacyCenterLayout.tsx +0 -177
  69. package/src/RedactoPrivacyCenter/PrivacyCenterMyReceiptPage.tsx +0 -26
  70. package/src/RedactoPrivacyCenter/RedactoPrivacyCenter.tsx +0 -93
  71. package/src/RedactoPrivacyCenter/api/actions.ts +0 -695
  72. package/src/RedactoPrivacyCenter/api/client.ts +0 -1003
  73. package/src/RedactoPrivacyCenter/api/config.ts +0 -33
  74. package/src/RedactoPrivacyCenter/api/fetcher.ts +0 -275
  75. package/src/RedactoPrivacyCenter/api/orgBranding.ts +0 -16
  76. package/src/RedactoPrivacyCenter/api/upload.ts +0 -93
  77. package/src/RedactoPrivacyCenter/assets/character.svg +0 -31
  78. package/src/RedactoPrivacyCenter/assets/fileAttach.svg +0 -9
  79. package/src/RedactoPrivacyCenter/assets/greenTick.svg +0 -4
  80. package/src/RedactoPrivacyCenter/assets/mail.svg +0 -3
  81. package/src/RedactoPrivacyCenter/assets/poweredByRedacto.svg +0 -9
  82. package/src/RedactoPrivacyCenter/assets/sentImg.svg +0 -9
  83. package/src/RedactoPrivacyCenter/assets/uploadFileIcon.svg +0 -9
  84. package/src/RedactoPrivacyCenter/components/ActivitiesList.tsx +0 -252
  85. package/src/RedactoPrivacyCenter/components/ActivityTimeline.tsx +0 -239
  86. package/src/RedactoPrivacyCenter/components/AppShell/AppShell.tsx +0 -268
  87. package/src/RedactoPrivacyCenter/components/AppShell/MobileNavDrawer.tsx +0 -218
  88. package/src/RedactoPrivacyCenter/components/AppShell/NavItem.tsx +0 -205
  89. package/src/RedactoPrivacyCenter/components/AppShell/PageHeader.tsx +0 -107
  90. package/src/RedactoPrivacyCenter/components/AppShell/SidebarNav.tsx +0 -100
  91. package/src/RedactoPrivacyCenter/components/AppShell/TopAppBar.tsx +0 -339
  92. package/src/RedactoPrivacyCenter/components/AppShell/UserMenu.tsx +0 -245
  93. package/src/RedactoPrivacyCenter/components/AppShell/hooks/useIsTruncated.ts +0 -28
  94. package/src/RedactoPrivacyCenter/components/AppShell/hooks/useKeyboardShortcut.ts +0 -40
  95. package/src/RedactoPrivacyCenter/components/AppShell/hooks/useSidebarState.ts +0 -62
  96. package/src/RedactoPrivacyCenter/components/AppShell/usePrivacyCenterExitAction.ts +0 -36
  97. package/src/RedactoPrivacyCenter/components/CaseDetails/AttachmentCard.tsx +0 -38
  98. package/src/RedactoPrivacyCenter/components/CaseDetails/ChatBubble.tsx +0 -31
  99. package/src/RedactoPrivacyCenter/components/CaseDetails/DocumentRequestCard.tsx +0 -79
  100. package/src/RedactoPrivacyCenter/components/CaseDetails/FinalizedTooltipWrapper.tsx +0 -25
  101. package/src/RedactoPrivacyCenter/components/CaseDetails/MessageComposer.tsx +0 -96
  102. package/src/RedactoPrivacyCenter/components/CaseDetails/MessageItem.tsx +0 -97
  103. package/src/RedactoPrivacyCenter/components/CaseDetails/MessagesTab.tsx +0 -156
  104. package/src/RedactoPrivacyCenter/components/CaseDetails/RequestDetailsTab.tsx +0 -171
  105. package/src/RedactoPrivacyCenter/components/CaseDetails/StatusEvent.tsx +0 -23
  106. package/src/RedactoPrivacyCenter/components/CaseDetails/useFileUpload.ts +0 -116
  107. package/src/RedactoPrivacyCenter/components/CaseDetails/useMessagePolling.ts +0 -43
  108. package/src/RedactoPrivacyCenter/components/CaseDetails/utils.ts +0 -71
  109. package/src/RedactoPrivacyCenter/components/CaseDetailsModal.tsx +0 -469
  110. package/src/RedactoPrivacyCenter/components/CaseHistory.tsx +0 -426
  111. package/src/RedactoPrivacyCenter/components/ConsentManager.tsx +0 -1206
  112. package/src/RedactoPrivacyCenter/components/ConsentManagerCells.tsx +0 -218
  113. package/src/RedactoPrivacyCenter/components/ConsentManagerColumns.tsx +0 -138
  114. package/src/RedactoPrivacyCenter/components/ConsentManagerConstants.ts +0 -7
  115. package/src/RedactoPrivacyCenter/components/ConsentManagerExpandedRow.tsx +0 -179
  116. package/src/RedactoPrivacyCenter/components/ConsentManagerGroupedColumns.tsx +0 -318
  117. package/src/RedactoPrivacyCenter/components/ConsentManagerProductCards.tsx +0 -333
  118. package/src/RedactoPrivacyCenter/components/ConsentManagerPurposeCards.tsx +0 -102
  119. package/src/RedactoPrivacyCenter/components/ConsentManagerTableSkeleton.tsx +0 -159
  120. package/src/RedactoPrivacyCenter/components/DataRequest/CorrectionDataSection.tsx +0 -189
  121. package/src/RedactoPrivacyCenter/components/DataRequest/GrievanceDataSection.tsx +0 -118
  122. package/src/RedactoPrivacyCenter/components/DataRequest/NominationDataSection.tsx +0 -66
  123. package/src/RedactoPrivacyCenter/components/DataRequest/ProductSelectionSection.tsx +0 -222
  124. package/src/RedactoPrivacyCenter/components/DataRequest/PurposeSelectionSection.tsx +0 -331
  125. package/src/RedactoPrivacyCenter/components/Form.tsx +0 -1821
  126. package/src/RedactoPrivacyCenter/components/GrievanceTable.tsx +0 -174
  127. package/src/RedactoPrivacyCenter/components/GrievanceTablePagination.tsx +0 -337
  128. package/src/RedactoPrivacyCenter/components/ModifyConsentModal.tsx +0 -334
  129. package/src/RedactoPrivacyCenter/components/NotificationHub/NotificationBell.tsx +0 -173
  130. package/src/RedactoPrivacyCenter/components/NotificationHub/NotificationCTAButton.tsx +0 -18
  131. package/src/RedactoPrivacyCenter/components/NotificationHub/NotificationDropdown.tsx +0 -54
  132. package/src/RedactoPrivacyCenter/components/NotificationHub/NotificationDropdownItem.tsx +0 -57
  133. package/src/RedactoPrivacyCenter/components/NotificationHub/NotificationIcon.tsx +0 -19
  134. package/src/RedactoPrivacyCenter/components/NotificationHub/NotificationListPanel.tsx +0 -92
  135. package/src/RedactoPrivacyCenter/components/NotificationHub/NotificationRefreshButton.tsx +0 -20
  136. package/src/RedactoPrivacyCenter/components/NotificationHub/NotificationRow.tsx +0 -58
  137. package/src/RedactoPrivacyCenter/components/NotificationHub/StatCard.tsx +0 -10
  138. package/src/RedactoPrivacyCenter/components/NotificationHub/useNotificationActions.ts +0 -112
  139. package/src/RedactoPrivacyCenter/components/NotificationHub/utils.ts +0 -27
  140. package/src/RedactoPrivacyCenter/components/Pagination.tsx +0 -140
  141. package/src/RedactoPrivacyCenter/components/PrivacyCenterEmptyState.tsx +0 -76
  142. package/src/RedactoPrivacyCenter/components/PrivacyCenterSessionExpired.tsx +0 -97
  143. package/src/RedactoPrivacyCenter/components/ReceiptsList.tsx +0 -454
  144. package/src/RedactoPrivacyCenter/components/RequestSubmit.tsx +0 -270
  145. package/src/RedactoPrivacyCenter/components/SelectUser.tsx +0 -95
  146. package/src/RedactoPrivacyCenter/components/SelectUserGate.tsx +0 -195
  147. package/src/RedactoPrivacyCenter/components/SideMenuBarPC/constants.tsx +0 -25
  148. package/src/RedactoPrivacyCenter/components/SideMenuBarPC/types.ts +0 -21
  149. package/src/RedactoPrivacyCenter/components/caseHistoryColumns.tsx +0 -159
  150. package/src/RedactoPrivacyCenter/components/constant.ts +0 -52
  151. package/src/RedactoPrivacyCenter/components/groupHelpers.ts +0 -155
  152. package/src/RedactoPrivacyCenter/components/receiptColumns.tsx +0 -203
  153. package/src/RedactoPrivacyCenter/components/types.ts +0 -123
  154. package/src/RedactoPrivacyCenter/components/utils.tsx +0 -10
  155. package/src/RedactoPrivacyCenter/config/routes.ts +0 -9
  156. package/src/RedactoPrivacyCenter/config/table.ts +0 -25
  157. package/src/RedactoPrivacyCenter/context/AuthContext.tsx +0 -252
  158. package/src/RedactoPrivacyCenter/context/BaseUrlContext.tsx +0 -47
  159. package/src/RedactoPrivacyCenter/context/BrandingContext.tsx +0 -52
  160. package/src/RedactoPrivacyCenter/context/DataAvailabilityContext.session-expired.test.tsx +0 -92
  161. package/src/RedactoPrivacyCenter/context/DataAvailabilityContext.tsx +0 -181
  162. package/src/RedactoPrivacyCenter/context/LocaleContext.tsx +0 -11
  163. package/src/RedactoPrivacyCenter/context/NavigationContext.tsx +0 -96
  164. package/src/RedactoPrivacyCenter/context/OrganizationContext.tsx +0 -30
  165. package/src/RedactoPrivacyCenter/context/PageChromeContext.tsx +0 -80
  166. package/src/RedactoPrivacyCenter/context/ProfileSwitchContext.tsx +0 -15
  167. package/src/RedactoPrivacyCenter/context/types.ts +0 -57
  168. package/src/RedactoPrivacyCenter/lib/api.ts +0 -759
  169. package/src/RedactoPrivacyCenter/lib/consent-manager/utils.tsx +0 -67
  170. package/src/RedactoPrivacyCenter/lib/constants.ts +0 -283
  171. package/src/RedactoPrivacyCenter/lib/i18n.ts +0 -81
  172. package/src/RedactoPrivacyCenter/lib/locales.ts +0 -102
  173. package/src/RedactoPrivacyCenter/lib/queries.ts +0 -141
  174. package/src/RedactoPrivacyCenter/lib/sandbox.ts +0 -104
  175. package/src/RedactoPrivacyCenter/lib/types.ts +0 -896
  176. package/src/RedactoPrivacyCenter/lib/useCurrentLanguage.ts +0 -37
  177. package/src/RedactoPrivacyCenter/lib/utils.refresh-circuit.test.ts +0 -127
  178. package/src/RedactoPrivacyCenter/lib/utils.refresh-storage.test.ts +0 -85
  179. package/src/RedactoPrivacyCenter/lib/utils.session-expired.test.ts +0 -109
  180. package/src/RedactoPrivacyCenter/lib/utils.ts +0 -798
  181. package/src/RedactoPrivacyCenter/locales/as/translation.json +0 -342
  182. package/src/RedactoPrivacyCenter/locales/bn/translation.json +0 -342
  183. package/src/RedactoPrivacyCenter/locales/brx/translation.json +0 -342
  184. package/src/RedactoPrivacyCenter/locales/doi/translation.json +0 -342
  185. package/src/RedactoPrivacyCenter/locales/en/translation.json +0 -357
  186. package/src/RedactoPrivacyCenter/locales/gom/translation.json +0 -342
  187. package/src/RedactoPrivacyCenter/locales/gu/translation.json +0 -342
  188. package/src/RedactoPrivacyCenter/locales/hi/translation.json +0 -345
  189. package/src/RedactoPrivacyCenter/locales/kn/translation.json +0 -342
  190. package/src/RedactoPrivacyCenter/locales/ks/translation.json +0 -342
  191. package/src/RedactoPrivacyCenter/locales/mai/translation.json +0 -342
  192. package/src/RedactoPrivacyCenter/locales/ml/translation.json +0 -342
  193. package/src/RedactoPrivacyCenter/locales/mni-Mtei/translation.json +0 -342
  194. package/src/RedactoPrivacyCenter/locales/mr/translation.json +0 -342
  195. package/src/RedactoPrivacyCenter/locales/ne/translation.json +0 -342
  196. package/src/RedactoPrivacyCenter/locales/or/translation.json +0 -342
  197. package/src/RedactoPrivacyCenter/locales/pa/translation.json +0 -342
  198. package/src/RedactoPrivacyCenter/locales/sa/translation.json +0 -342
  199. package/src/RedactoPrivacyCenter/locales/sat/translation.json +0 -342
  200. package/src/RedactoPrivacyCenter/locales/sd/translation.json +0 -342
  201. package/src/RedactoPrivacyCenter/locales/ta/translation.json +0 -342
  202. package/src/RedactoPrivacyCenter/locales/te/translation.json +0 -342
  203. package/src/RedactoPrivacyCenter/locales/ur/translation.json +0 -342
  204. package/src/RedactoPrivacyCenter/styles/applyBrandingTheme.ts +0 -66
  205. package/src/RedactoPrivacyCenter/styles/base.css +0 -117
  206. package/src/RedactoPrivacyCenter/styles/injectStyles.ts +0 -3108
  207. package/src/RedactoPrivacyCenter/styles/pcStyles.ts +0 -831
  208. package/src/RedactoPrivacyCenter/styles/responsive.ts +0 -138
  209. package/src/RedactoPrivacyCenter/styles/variables.css +0 -96
  210. package/src/RedactoPrivacyCenter/table/AdvancedTable.tsx +0 -387
  211. package/src/RedactoPrivacyCenter/table/AdvancedTablePagination.tsx +0 -468
  212. package/src/RedactoPrivacyCenter/table/index.ts +0 -2
  213. package/src/RedactoPrivacyCenter/types/images.d.ts +0 -29
  214. package/src/RedactoPrivacyCenter/ui/Footer.tsx +0 -69
  215. package/src/RedactoPrivacyCenter/ui/FormBlockWrapper.tsx +0 -54
  216. package/src/RedactoPrivacyCenter/ui/PCAccordion.tsx +0 -93
  217. package/src/RedactoPrivacyCenter/ui/PCActionIcon.tsx +0 -47
  218. package/src/RedactoPrivacyCenter/ui/PCAvatar.test.tsx +0 -83
  219. package/src/RedactoPrivacyCenter/ui/PCAvatar.tsx +0 -93
  220. package/src/RedactoPrivacyCenter/ui/PCBadge.tsx +0 -48
  221. package/src/RedactoPrivacyCenter/ui/PCButton.tsx +0 -77
  222. package/src/RedactoPrivacyCenter/ui/PCCheckbox.tsx +0 -55
  223. package/src/RedactoPrivacyCenter/ui/PCCollapse.tsx +0 -107
  224. package/src/RedactoPrivacyCenter/ui/PCEmpty.tsx +0 -35
  225. package/src/RedactoPrivacyCenter/ui/PCInput.tsx +0 -132
  226. package/src/RedactoPrivacyCenter/ui/PCLoader.tsx +0 -31
  227. package/src/RedactoPrivacyCenter/ui/PCModal.tsx +0 -106
  228. package/src/RedactoPrivacyCenter/ui/PCPopover.tsx +0 -206
  229. package/src/RedactoPrivacyCenter/ui/PCSelect.tsx +0 -433
  230. package/src/RedactoPrivacyCenter/ui/PCTable.tsx +0 -149
  231. package/src/RedactoPrivacyCenter/ui/PCText.tsx +0 -41
  232. package/src/RedactoPrivacyCenter/ui/PCTextarea.tsx +0 -43
  233. package/src/RedactoPrivacyCenter/ui/PCTitle.tsx +0 -37
  234. package/src/RedactoPrivacyCenter/ui/PCTooltip.tsx +0 -121
  235. package/src/RedactoPrivacyCenter/ui/SimpleBar.tsx +0 -25
  236. package/src/RedactoPrivacyCenter/ui/StatusBadge.tsx +0 -53
  237. package/src/RedactoPrivacyCenter/ui/index.ts +0 -18
  238. package/src/RedactoPrivacyCenter/utils/cn.ts +0 -28
  239. package/src/RedactoPrivacyCenter/utils/date.ts +0 -48
  240. package/src/RedactoPrivacyCenter/utils/status.ts +0 -111
  241. package/src/RedactoPrivacyCenter/utils/toast.ts +0 -130
  242. package/src/index.ts +0 -19
  243. package/src/privacy-center.ts +0 -113
  244. package/src/shared/api-errors.ts +0 -180
  245. package/src/shared/notice-consent-status.ts +0 -190
  246. package/src/shared/sandbox.ts +0 -6
  247. package/src/types/css.d.ts +0 -4
  248. package/src/types/images.d.ts +0 -19
  249. package/src/types/react-jsx.d.ts +0 -26
  250. package/tests/DataAvailabilityContext.test.tsx +0 -123
  251. package/tests/Form.test.tsx +0 -1424
  252. package/tests/ManageConsentErrorMapping.test.tsx +0 -85
  253. package/tests/ProductSelectionSection.test.tsx +0 -328
  254. package/tests/RequestSubmit.test.tsx +0 -135
  255. package/tests/RevocablePurpose.test.tsx +0 -146
  256. package/tests/RevokeWarningMessage.test.tsx +0 -151
  257. package/tests/consentClient.test.ts +0 -217
  258. package/tests/manageConsentServer.test.ts +0 -38
  259. package/tests/mocks.ts +0 -257
  260. package/tests/resolveContactFromJwt.test.ts +0 -44
  261. package/tests/setup.ts +0 -16
  262. package/tsconfig.json +0 -16
  263. package/tsup.config.ts +0 -31
  264. package/vitest.config.ts +0 -16
@@ -1,268 +0,0 @@
1
- import {
2
- Suspense,
3
- useCallback,
4
- useEffect,
5
- useRef,
6
- useState,
7
- type CSSProperties,
8
- } from 'react';
9
- import { useTranslation } from 'react-i18next';
10
- import { LocaleContext } from '../../context/LocaleContext';
11
- import { pcStyles } from '../../styles/pcStyles';
12
- import { getVar } from '../../lib/utils';
13
- import Footer from '../../ui/Footer';
14
- import i18n from '../../lib/i18n';
15
- import { useMediaQuery } from '../../../RedactoNoticeConsent/useMediaQuery';
16
- import { useSidebarState } from './hooks/useSidebarState';
17
- import { useKeyboardShortcut } from './hooks/useKeyboardShortcut';
18
- import { TopAppBar } from './TopAppBar';
19
- import { SidebarNav } from './SidebarNav';
20
- import { MobileNavDrawer } from './MobileNavDrawer';
21
- import { PageHeader } from './PageHeader';
22
- import { PCLoader } from '../../ui';
23
- import { useDataAvailability } from '../../context/DataAvailabilityContext';
24
- import { PrivacyCenterEmptyState } from '../PrivacyCenterEmptyState';
25
- import { PrivacyCenterSessionExpired } from '../PrivacyCenterSessionExpired';
26
- import type { PrivacyCenterLayoutProps } from '../types';
27
-
28
- export default function AppShell({
29
- children,
30
- sidebarClassName,
31
- contentClassName,
32
- onBack,
33
- }: PrivacyCenterLayoutProps) {
34
- const { t } = useTranslation();
35
- const sidebar = useSidebarState();
36
- const [locale, setLocale] = useState(i18n.language);
37
- const [isMobileNavOpen, setMobileNavOpen] = useState(false);
38
- const hamburgerRef = useRef<HTMLButtonElement>(null);
39
-
40
- const isMobile = useMediaQuery('(max-width: 639px)');
41
-
42
- // Keep the shell minimal — top bar + a content spinner — until we've CONFIRMED
43
- // the user has data. Hiding the sidebar/tabs/bell during 'checking' (not just
44
- // 'empty') stops the nav from flashing in on refresh only to disappear when
45
- // the API resolves to "no data". The branded top bar stays visible throughout.
46
- const { status } = useDataAvailability();
47
- const hideNav = status !== 'has-data';
48
-
49
- // Close mobile drawer when crossing the breakpoint
50
- useEffect(() => {
51
- if (!isMobile && isMobileNavOpen) setMobileNavOpen(false);
52
- }, [isMobile, isMobileNavOpen]);
53
-
54
- useEffect(() => {
55
- const onChange = () => setLocale(i18n.language);
56
- i18n.on('languageChanged', onChange);
57
- return () => i18n.off('languageChanged', onChange);
58
- }, []);
59
-
60
- const handleSidebarToggle = useCallback(() => {
61
- sidebar.toggle();
62
- }, [sidebar]);
63
-
64
- // Cmd/Ctrl+B toggles sidebar (or mobile drawer on small screens)
65
- useKeyboardShortcut(
66
- { key: 'b', mod: true },
67
- useCallback(() => {
68
- if (isMobile) setMobileNavOpen((prev) => !prev);
69
- else sidebar.toggle();
70
- }, [isMobile, sidebar]),
71
- );
72
-
73
- const rootStyle: CSSProperties = {
74
- display: 'flex',
75
- flexDirection: 'column',
76
- minHeight: '100vh',
77
- background: getVar('--pc-bg-shell'),
78
- position: 'relative',
79
- };
80
-
81
- const bodyStyle: CSSProperties = {
82
- display: 'flex',
83
- flex: 1,
84
- minHeight: 0,
85
- position: 'relative',
86
- };
87
-
88
- const mainStyle: CSSProperties = {
89
- flex: 1,
90
- minWidth: 0,
91
- display: 'flex',
92
- flexDirection: 'column',
93
- background: getVar('--pc-bg-shell'),
94
- };
95
-
96
- const contentWrapperStyle: CSSProperties = {
97
- flex: 1,
98
- display: 'flex',
99
- flexDirection: 'column',
100
- minHeight: 0,
101
- padding: 'var(--pc-shell-content-padding, 0 24px)',
102
- boxSizing: 'border-box',
103
- };
104
-
105
- return (
106
- <LocaleContext.Provider value={{ locale, setLocale }}>
107
- <Suspense
108
- fallback={
109
- <div
110
- style={{
111
- ...pcStyles.flex,
112
- ...pcStyles.itemsCenter,
113
- ...pcStyles.justifyCenter,
114
- minHeight: '100vh',
115
- }}
116
- >
117
- {t('loadingEllipsis')}
118
- </div>
119
- }
120
- >
121
- <main className="pc-root pc-shell-root" style={rootStyle}>
122
- <TopAppBar
123
- ref={hamburgerRef}
124
- showHamburger={isMobile && !hideNav}
125
- onOpenMobileNav={() => setMobileNavOpen(true)}
126
- locale={locale}
127
- onLocaleChange={setLocale}
128
- onBack={onBack}
129
- showNotifications={!hideNav}
130
- />
131
- <div className="pc-shell-body" style={bodyStyle}>
132
- {!isMobile && !hideNav && (
133
- <SidebarNav
134
- className={sidebarClassName}
135
- isExpanded={sidebar.isExpanded}
136
- onToggle={handleSidebarToggle}
137
- />
138
- )}
139
- <section className="pc-shell-content" style={mainStyle}>
140
- <div className={contentClassName} style={contentWrapperStyle}>
141
- {status === 'checking' ? (
142
- <div
143
- style={{
144
- ...pcStyles.flex,
145
- ...pcStyles.itemsCenter,
146
- ...pcStyles.justifyCenter,
147
- flex: 1,
148
- minHeight: 240,
149
- }}
150
- >
151
- <PCLoader variant="spinner" color="info" size="lg" />
152
- </div>
153
- ) : status === 'session-expired' ? (
154
- <div style={{ flex: 1, minWidth: 0, width: '100%' }}>
155
- <PrivacyCenterSessionExpired onBack={onBack} />
156
- </div>
157
- ) : status === 'empty' ? (
158
- <div style={{ flex: 1, minWidth: 0, width: '100%' }}>
159
- <PrivacyCenterEmptyState />
160
- </div>
161
- ) : (
162
- <>
163
- <PageHeader />
164
- <div style={{ flex: 1, minWidth: 0, width: '100%' }}>{children}</div>
165
- </>
166
- )}
167
- <div
168
- style={{
169
- ...pcStyles.flex,
170
- width: '100%',
171
- ...pcStyles.itemsCenter,
172
- ...pcStyles.justifyCenter,
173
- paddingTop: 12,
174
- paddingBottom: 12,
175
- }}
176
- >
177
- <Footer />
178
- </div>
179
- </div>
180
- </section>
181
- </div>
182
- {isMobile && !hideNav && (
183
- <MobileNavDrawer
184
- isOpen={isMobileNavOpen}
185
- onClose={() => setMobileNavOpen(false)}
186
- returnFocusRef={hamburgerRef}
187
- />
188
- )}
189
- </main>
190
- <style>{`
191
- .pc-shell-sidebar {
192
- transition: width 200ms cubic-bezier(0.4, 0, 0.2, 1);
193
- }
194
- .pc-shell-nav-item:focus-visible {
195
- box-shadow: 0 0 0 2px var(--pc-border-color-focus);
196
- }
197
- .pc-shell-sidebar-toggle {
198
- opacity: 0;
199
- transition: opacity 200ms ease;
200
- }
201
- .pc-shell-sidebar:hover .pc-shell-sidebar-toggle,
202
- .pc-shell-sidebar-toggle:hover,
203
- .pc-shell-sidebar-toggle:focus-visible {
204
- opacity: 1;
205
- }
206
- @media (prefers-reduced-motion: reduce) {
207
- .pc-shell-sidebar-toggle { transition: none !important; }
208
- }
209
- .pc-shell-user-menu-header {
210
- background: linear-gradient(135deg, var(--pc-bg-secondary) 0%, var(--pc-bg-shell) 100%);
211
- background: linear-gradient(
212
- 135deg,
213
- color-mix(in srgb, var(--pc-primary) 6%, var(--pc-bg-shell)) 0%,
214
- var(--pc-bg-shell) 100%
215
- );
216
- }
217
- .pc-shell-user-menu-identity {
218
- display: flex;
219
- flex-direction: column;
220
- gap: 2px;
221
- min-width: 0;
222
- flex: 1;
223
- }
224
- .pc-shell-user-menu-identity-email {
225
- font-size: 13px;
226
- font-weight: 600;
227
- color: var(--pc-text-primary);
228
- line-height: 1.3;
229
- overflow: hidden;
230
- text-overflow: ellipsis;
231
- white-space: nowrap;
232
- min-width: 0;
233
- }
234
- .pc-shell-user-menu-identity-id {
235
- font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
236
- font-size: 11px;
237
- font-weight: 500;
238
- color: var(--pc-text-secondary);
239
- line-height: 1.3;
240
- overflow: hidden;
241
- text-overflow: ellipsis;
242
- white-space: nowrap;
243
- min-width: 0;
244
- }
245
- .pc-popover.pc-shell-user-menu-popover {
246
- border-radius: 12px !important;
247
- overflow: hidden !important;
248
- padding: 0 !important;
249
- background: var(--pc-bg-primary) !important;
250
- }
251
- @media (prefers-reduced-motion: reduce) {
252
- .pc-shell-sidebar { transition: none !important; }
253
- .pc-shell-nav-item-icon { transform: none !important; transition: none !important; }
254
- }
255
- @media (max-width: 639px) {
256
- :root { --pc-shell-content-padding: 0 12px; --pc-shell-pageheader-padding: 14px 0 12px; }
257
- }
258
- @media (min-width: 640px) and (max-width: 1023px) {
259
- :root { --pc-shell-content-padding: 0 20px; --pc-shell-pageheader-padding: 18px 0 14px; }
260
- }
261
- @media (min-width: 1024px) {
262
- :root { --pc-shell-content-padding: 0 32px; --pc-shell-pageheader-padding: 22px 0 16px; }
263
- }
264
- `}</style>
265
- </Suspense>
266
- </LocaleContext.Provider>
267
- );
268
- }
@@ -1,218 +0,0 @@
1
- import {
2
- useCallback,
3
- useEffect,
4
- useMemo,
5
- useRef,
6
- type CSSProperties,
7
- type RefObject,
8
- } from 'react';
9
- import { createPortal } from 'react-dom';
10
- import { useTranslation } from 'react-i18next';
11
- import { X } from 'lucide-react';
12
- import { PCActionIcon, PCAvatar } from '../../ui';
13
- import { useMenuItemsPC } from '../../lib/constants';
14
- import { useBranding } from '../../context/BrandingContext';
15
- import { useOrganization } from '../../context/OrganizationContext';
16
- import { getVar } from '../../lib/utils';
17
- import { NavItem } from './NavItem';
18
-
19
- type MobileNavDrawerProps = {
20
- isOpen: boolean;
21
- onClose: () => void;
22
- returnFocusRef?: RefObject<HTMLElement>;
23
- };
24
-
25
- export function MobileNavDrawer({ isOpen, onClose, returnFocusRef }: MobileNavDrawerProps) {
26
- const { t } = useTranslation();
27
- const menuItems = useMenuItemsPC();
28
- const branding = useBranding();
29
- const { organization } = useOrganization();
30
- const displayName = branding?.brand_name || organization?.name || '';
31
- const drawerRef = useRef<HTMLDivElement>(null);
32
- const firstNavRef = useRef<HTMLDivElement>(null);
33
-
34
- const flatNavItems = useMemo(
35
- () => menuItems.filter((item) => Boolean(item.href)),
36
- [menuItems],
37
- );
38
-
39
- // body scroll lock
40
- useEffect(() => {
41
- if (typeof document === 'undefined') return;
42
- if (!isOpen) return;
43
- const previous = document.body.style.overflow;
44
- document.body.style.overflow = 'hidden';
45
- return () => {
46
- document.body.style.overflow = previous;
47
- };
48
- }, [isOpen]);
49
-
50
- // Esc to close + focus management
51
- useEffect(() => {
52
- if (!isOpen || typeof window === 'undefined') return;
53
-
54
- const onKey = (event: KeyboardEvent) => {
55
- if (event.key === 'Escape') {
56
- event.preventDefault();
57
- onClose();
58
- }
59
- };
60
- window.addEventListener('keydown', onKey);
61
-
62
- // Move focus into drawer
63
- const focusTimer = window.setTimeout(() => {
64
- firstNavRef.current?.focus();
65
- // If the wrapper isn't focusable, focus the first focusable child
66
- const target = firstNavRef.current?.querySelector<HTMLElement>(
67
- 'button, [href], [tabindex]:not([tabindex="-1"])',
68
- );
69
- target?.focus();
70
- }, 30);
71
-
72
- return () => {
73
- window.removeEventListener('keydown', onKey);
74
- window.clearTimeout(focusTimer);
75
- };
76
- }, [isOpen, onClose]);
77
-
78
- // return focus to trigger on close
79
- useEffect(() => {
80
- if (isOpen) return;
81
- if (typeof window === 'undefined') return;
82
- const node = returnFocusRef?.current;
83
- if (!node) return;
84
- const t = window.setTimeout(() => node.focus(), 0);
85
- return () => window.clearTimeout(t);
86
- }, [isOpen, returnFocusRef]);
87
-
88
- const handleNavigate = useCallback(() => {
89
- onClose();
90
- }, [onClose]);
91
-
92
- const overlayStyle: CSSProperties = {
93
- position: 'fixed',
94
- inset: 0,
95
- zIndex: 1190,
96
- background: getVar('--pc-bg-overlay'),
97
- opacity: isOpen ? 1 : 0,
98
- pointerEvents: isOpen ? 'auto' : 'none',
99
- transition: 'opacity 200ms ease',
100
- };
101
-
102
- const drawerStyle: CSSProperties = {
103
- position: 'fixed',
104
- top: 0,
105
- left: 0,
106
- bottom: 0,
107
- width: 280,
108
- maxWidth: '85vw',
109
- zIndex: 1195,
110
- background: getVar('--pc-bg-shell'),
111
- borderRight: `1px solid ${getVar('--pc-border-color')}`,
112
- boxShadow: '12px 0 32px rgba(15, 23, 42, 0.18)',
113
- transform: isOpen ? 'translateX(0)' : 'translateX(-100%)',
114
- transition: 'transform 220ms cubic-bezier(0.4, 0, 0.2, 1)',
115
- display: 'flex',
116
- flexDirection: 'column',
117
- };
118
-
119
- if (typeof document === 'undefined') return null;
120
-
121
- return createPortal(
122
- <>
123
- <div
124
- style={overlayStyle}
125
- onClick={onClose}
126
- aria-hidden="true"
127
- />
128
- <aside
129
- ref={drawerRef}
130
- role="dialog"
131
- aria-modal="true"
132
- aria-label={t('openSidebarMenu')}
133
- aria-hidden={!isOpen}
134
- style={drawerStyle}
135
- >
136
- <div
137
- style={{
138
- display: 'flex',
139
- alignItems: 'center',
140
- justifyContent: 'space-between',
141
- gap: 12,
142
- height: 56,
143
- padding: '0 12px 0 16px',
144
- borderBottom: `1px solid ${getVar('--pc-border-color')}`,
145
- flexShrink: 0,
146
- }}
147
- >
148
- <div
149
- style={{
150
- display: 'flex',
151
- alignItems: 'center',
152
- minWidth: 0,
153
- flex: 1,
154
- }}
155
- >
156
- {branding?.logo_url ? (
157
- <img
158
- src={branding.logo_url}
159
- alt={displayName}
160
- style={{
161
- height: 36,
162
- width: 'auto',
163
- maxWidth: 160,
164
- objectFit: 'contain',
165
- display: 'block',
166
- }}
167
- />
168
- ) : branding?.icon_url ? (
169
- <PCAvatar src={branding.icon_url} name={displayName} size="md" color="info" />
170
- ) : (
171
- <PCAvatar name={displayName || '?'} size="md" color="info" />
172
- )}
173
- </div>
174
- <PCActionIcon
175
- variant="default"
176
- aria-label={t('closeSidebarMenu')}
177
- onClick={onClose}
178
- style={{
179
- width: 36,
180
- height: 36,
181
- padding: 0,
182
- color: getVar('--pc-text-primary'),
183
- flexShrink: 0,
184
- }}
185
- >
186
- <X size={20} />
187
- </PCActionIcon>
188
- </div>
189
- <nav
190
- role="navigation"
191
- aria-label="Privacy center primary navigation"
192
- ref={firstNavRef}
193
- tabIndex={-1}
194
- style={{
195
- flex: 1,
196
- overflowY: 'auto',
197
- overflowX: 'hidden',
198
- padding: '12px 12px 24px',
199
- display: 'flex',
200
- flexDirection: 'column',
201
- gap: 4,
202
- outline: 'none',
203
- }}
204
- >
205
- {flatNavItems.map((item) => (
206
- <NavItem
207
- key={item.href ?? item.name}
208
- item={item}
209
- mode="expanded"
210
- onNavigate={handleNavigate}
211
- />
212
- ))}
213
- </nav>
214
- </aside>
215
- </>,
216
- document.body,
217
- );
218
- }
@@ -1,205 +0,0 @@
1
- import { useState, type CSSProperties, type KeyboardEvent } from 'react';
2
- import { PCTooltip } from '../../ui';
3
- import { useInternalNavigation, type InternalPage } from '../../context/NavigationContext';
4
- import { getVar } from '../../lib/utils';
5
- import type { MenuItem } from '../SideMenuBarPC/types';
6
-
7
- type NavItemProps = {
8
- item: MenuItem;
9
- mode: 'expanded' | 'collapsed';
10
- onNavigate?: () => void;
11
- };
12
-
13
- export function NavItem({ item, mode, onNavigate }: NavItemProps) {
14
- const { currentPage, navigateTo } = useInternalNavigation();
15
- const [hover, setHover] = useState(false);
16
-
17
- const isCollapsed = mode === 'collapsed';
18
- const isActive = item.href ? currentPage === (item.href as InternalPage) : false;
19
- const isDisabled = !!item.isComingSoon;
20
- const accent = getVar('--pc-primary');
21
-
22
- const handleActivate = () => {
23
- if (isDisabled || !item.href) return;
24
- navigateTo(item.href as InternalPage);
25
- onNavigate?.();
26
- };
27
-
28
- const handleKeyDown = (event: KeyboardEvent<HTMLButtonElement>) => {
29
- if (event.key === 'Enter' || event.key === ' ') {
30
- event.preventDefault();
31
- handleActivate();
32
- }
33
- };
34
-
35
- const labelColor = isDisabled
36
- ? getVar('--pc-text-disabled')
37
- : isActive
38
- ? accent
39
- : getVar('--pc-text-primary');
40
-
41
- // Icon container styling — distinct from row, gives each item a tactile feel.
42
- const containerBg = isDisabled
43
- ? 'transparent'
44
- : isActive
45
- ? getVar('--pc-bg-tertiary')
46
- : hover
47
- ? getVar('--pc-bg-tertiary')
48
- : getVar('--pc-bg-secondary');
49
-
50
- const containerColor = isDisabled
51
- ? getVar('--pc-text-disabled')
52
- : isActive
53
- ? accent
54
- : hover
55
- ? getVar('--pc-text-primary')
56
- : getVar('--pc-text-secondary');
57
-
58
- const containerTransform =
59
- !isDisabled && !isActive && hover ? 'translateX(1px)' : 'translateX(0)';
60
-
61
- const buttonStyle: CSSProperties = isCollapsed
62
- ? {
63
- position: 'relative',
64
- display: 'flex',
65
- alignItems: 'center',
66
- justifyContent: 'center',
67
- width: 40,
68
- height: 40,
69
- padding: 0,
70
- margin: 0,
71
- background: 'transparent',
72
- color: labelColor,
73
- border: 'none',
74
- cursor: isDisabled ? 'not-allowed' : 'pointer',
75
- opacity: isDisabled ? 0.5 : 1,
76
- outline: 'none',
77
- borderRadius: 8,
78
- transition: 'background-color 150ms ease',
79
- fontFamily: 'inherit',
80
- }
81
- : {
82
- position: 'relative',
83
- display: 'flex',
84
- alignItems: 'center',
85
- width: '100%',
86
- height: 44,
87
- padding: '0 12px 0 14px',
88
- gap: 10,
89
- borderRadius: 10,
90
- background: isActive ? getVar('--pc-bg-hover') : 'transparent',
91
- color: labelColor,
92
- border: 'none',
93
- cursor: isDisabled ? 'not-allowed' : 'pointer',
94
- opacity: isDisabled ? 0.5 : 1,
95
- outline: 'none',
96
- transition: 'background-color 150ms ease, color 150ms ease, box-shadow 150ms ease',
97
- fontFamily: 'inherit',
98
- fontSize: 14,
99
- fontWeight: isActive ? 600 : 500,
100
- lineHeight: 1,
101
- textAlign: 'left',
102
- };
103
-
104
- const accentBar = isActive && !isCollapsed ? (
105
- <span
106
- aria-hidden="true"
107
- style={{
108
- position: 'absolute',
109
- left: 0,
110
- top: 8,
111
- bottom: 8,
112
- width: 4,
113
- borderRadius: '0 4px 4px 0',
114
- background: accent,
115
- }}
116
- />
117
- ) : null;
118
-
119
- const iconContainer = item.icon ? (
120
- <span
121
- className="pc-shell-nav-item-icon"
122
- aria-hidden="true"
123
- style={{
124
- display: 'inline-flex',
125
- alignItems: 'center',
126
- justifyContent: 'center',
127
- width: 32,
128
- height: 32,
129
- borderRadius: 8,
130
- background: containerBg,
131
- color: containerColor,
132
- flexShrink: 0,
133
- transition: 'background-color 150ms ease, color 150ms ease, transform 150ms ease',
134
- transform: containerTransform,
135
- }}
136
- >
137
- {item.icon}
138
- </span>
139
- ) : null;
140
-
141
- const label = !isCollapsed ? (
142
- <span
143
- style={{
144
- flex: 1,
145
- minWidth: 0,
146
- overflow: 'hidden',
147
- textOverflow: 'ellipsis',
148
- whiteSpace: 'nowrap',
149
- }}
150
- >
151
- {item.name}
152
- </span>
153
- ) : null;
154
-
155
- const badge = item.isNew && !isCollapsed && !isDisabled ? (
156
- <span
157
- style={{
158
- display: 'inline-flex',
159
- alignItems: 'center',
160
- flexShrink: 0,
161
- padding: '2px 8px',
162
- borderRadius: 9999,
163
- background: getVar('--pc-bg-hover'),
164
- color: accent,
165
- fontSize: 11,
166
- fontWeight: 600,
167
- lineHeight: 1.2,
168
- }}
169
- >
170
- New
171
- </span>
172
- ) : null;
173
-
174
- const button = (
175
- <button
176
- type="button"
177
- className="pc-shell-nav-item"
178
- role="link"
179
- aria-current={isActive ? 'page' : undefined}
180
- aria-disabled={isDisabled || undefined}
181
- aria-label={isCollapsed ? item.name : undefined}
182
- disabled={isDisabled}
183
- onClick={handleActivate}
184
- onKeyDown={handleKeyDown}
185
- onMouseEnter={() => setHover(true)}
186
- onMouseLeave={() => setHover(false)}
187
- style={buttonStyle}
188
- >
189
- {accentBar}
190
- {iconContainer}
191
- {label}
192
- {badge}
193
- </button>
194
- );
195
-
196
- if (isCollapsed) {
197
- return (
198
- <PCTooltip content={item.name} placement="right" color="invert">
199
- <div style={{ width: 40, height: 40, margin: '0 auto' }}>{button}</div>
200
- </PCTooltip>
201
- );
202
- }
203
-
204
- return button;
205
- }