@redacto.io/consent-sdk-react 10.0.0-beta.8 → 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 (262) 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/{chunk-6A665OPR.mjs → chunk-OGL6OC3A.mjs} +4 -0
  5. package/dist/fonts.d.mts +35 -0
  6. package/dist/fonts.d.ts +35 -0
  7. package/dist/fonts.js +183 -0
  8. package/dist/fonts.mjs +10 -0
  9. package/dist/index.d.mts +41 -4
  10. package/dist/index.d.ts +41 -4
  11. package/dist/index.js +881 -416
  12. package/dist/index.mjs +502 -253
  13. package/dist/montserrat.generated-NBTECYRW.mjs +22 -0
  14. package/dist/privacy-center.d.mts +51 -11
  15. package/dist/privacy-center.d.ts +51 -11
  16. package/dist/privacy-center.js +252 -136
  17. package/dist/privacy-center.mjs +251 -137
  18. package/dist/types-6Aj7faxL.d.mts +57 -0
  19. package/dist/types-6Aj7faxL.d.ts +57 -0
  20. package/package.json +10 -1
  21. package/.turbo/turbo-build.log +0 -22
  22. package/.turbo/turbo-test.log +0 -203
  23. package/.turbo/turbo-verify-pack.log +0 -6
  24. package/CHANGELOG.md +0 -343
  25. package/src/RedactoNoticeAssisted/RedactoNoticeAssisted.test.tsx +0 -934
  26. package/src/RedactoNoticeAssisted/RedactoNoticeAssisted.tsx +0 -2160
  27. package/src/RedactoNoticeAssisted/api/index.ts +0 -275
  28. package/src/RedactoNoticeAssisted/api/types.ts +0 -182
  29. package/src/RedactoNoticeAssisted/assets/redacto-logo.png +0 -0
  30. package/src/RedactoNoticeAssisted/constants.ts +0 -51
  31. package/src/RedactoNoticeAssisted/i18n.ts +0 -1408
  32. package/src/RedactoNoticeAssisted/index.ts +0 -1
  33. package/src/RedactoNoticeAssisted/injectStyles.ts +0 -251
  34. package/src/RedactoNoticeAssisted/styles.ts +0 -730
  35. package/src/RedactoNoticeAssisted/types.ts +0 -26
  36. package/src/RedactoNoticeAssisted/useMediaQuery.ts +0 -36
  37. package/src/RedactoNoticeConsent/RedactoNoticeConsent.test.tsx +0 -1152
  38. package/src/RedactoNoticeConsent/RedactoNoticeConsent.tsx +0 -4258
  39. package/src/RedactoNoticeConsent/api/index.ts +0 -512
  40. package/src/RedactoNoticeConsent/api/types.ts +0 -469
  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 -54
  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 -58
  71. package/src/RedactoPrivacyCenter/api/actions.ts +0 -695
  72. package/src/RedactoPrivacyCenter/api/client.ts +0 -911
  73. package/src/RedactoPrivacyCenter/api/config.ts +0 -33
  74. package/src/RedactoPrivacyCenter/api/fetcher.ts +0 -260
  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 -1796
  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 -187
  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 -119
  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 -160
  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 -19
  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 -276
  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/types.ts +0 -876
  175. package/src/RedactoPrivacyCenter/lib/useCurrentLanguage.ts +0 -37
  176. package/src/RedactoPrivacyCenter/lib/utils.refresh-circuit.test.ts +0 -127
  177. package/src/RedactoPrivacyCenter/lib/utils.refresh-storage.test.ts +0 -85
  178. package/src/RedactoPrivacyCenter/lib/utils.session-expired.test.ts +0 -109
  179. package/src/RedactoPrivacyCenter/lib/utils.ts +0 -783
  180. package/src/RedactoPrivacyCenter/locales/as/translation.json +0 -342
  181. package/src/RedactoPrivacyCenter/locales/bn/translation.json +0 -342
  182. package/src/RedactoPrivacyCenter/locales/brx/translation.json +0 -342
  183. package/src/RedactoPrivacyCenter/locales/doi/translation.json +0 -342
  184. package/src/RedactoPrivacyCenter/locales/en/translation.json +0 -357
  185. package/src/RedactoPrivacyCenter/locales/gom/translation.json +0 -342
  186. package/src/RedactoPrivacyCenter/locales/gu/translation.json +0 -342
  187. package/src/RedactoPrivacyCenter/locales/hi/translation.json +0 -345
  188. package/src/RedactoPrivacyCenter/locales/kn/translation.json +0 -342
  189. package/src/RedactoPrivacyCenter/locales/ks/translation.json +0 -342
  190. package/src/RedactoPrivacyCenter/locales/mai/translation.json +0 -342
  191. package/src/RedactoPrivacyCenter/locales/ml/translation.json +0 -342
  192. package/src/RedactoPrivacyCenter/locales/mni-Mtei/translation.json +0 -342
  193. package/src/RedactoPrivacyCenter/locales/mr/translation.json +0 -342
  194. package/src/RedactoPrivacyCenter/locales/ne/translation.json +0 -342
  195. package/src/RedactoPrivacyCenter/locales/or/translation.json +0 -342
  196. package/src/RedactoPrivacyCenter/locales/pa/translation.json +0 -342
  197. package/src/RedactoPrivacyCenter/locales/sa/translation.json +0 -342
  198. package/src/RedactoPrivacyCenter/locales/sat/translation.json +0 -342
  199. package/src/RedactoPrivacyCenter/locales/sd/translation.json +0 -342
  200. package/src/RedactoPrivacyCenter/locales/ta/translation.json +0 -342
  201. package/src/RedactoPrivacyCenter/locales/te/translation.json +0 -342
  202. package/src/RedactoPrivacyCenter/locales/ur/translation.json +0 -342
  203. package/src/RedactoPrivacyCenter/styles/applyBrandingTheme.ts +0 -66
  204. package/src/RedactoPrivacyCenter/styles/base.css +0 -117
  205. package/src/RedactoPrivacyCenter/styles/injectStyles.ts +0 -3108
  206. package/src/RedactoPrivacyCenter/styles/pcStyles.ts +0 -831
  207. package/src/RedactoPrivacyCenter/styles/responsive.ts +0 -138
  208. package/src/RedactoPrivacyCenter/styles/variables.css +0 -96
  209. package/src/RedactoPrivacyCenter/table/AdvancedTable.tsx +0 -387
  210. package/src/RedactoPrivacyCenter/table/AdvancedTablePagination.tsx +0 -468
  211. package/src/RedactoPrivacyCenter/table/index.ts +0 -2
  212. package/src/RedactoPrivacyCenter/types/images.d.ts +0 -29
  213. package/src/RedactoPrivacyCenter/ui/Footer.tsx +0 -69
  214. package/src/RedactoPrivacyCenter/ui/FormBlockWrapper.tsx +0 -54
  215. package/src/RedactoPrivacyCenter/ui/PCAccordion.tsx +0 -93
  216. package/src/RedactoPrivacyCenter/ui/PCActionIcon.tsx +0 -47
  217. package/src/RedactoPrivacyCenter/ui/PCAvatar.test.tsx +0 -83
  218. package/src/RedactoPrivacyCenter/ui/PCAvatar.tsx +0 -93
  219. package/src/RedactoPrivacyCenter/ui/PCBadge.tsx +0 -48
  220. package/src/RedactoPrivacyCenter/ui/PCButton.tsx +0 -77
  221. package/src/RedactoPrivacyCenter/ui/PCCheckbox.tsx +0 -55
  222. package/src/RedactoPrivacyCenter/ui/PCCollapse.tsx +0 -107
  223. package/src/RedactoPrivacyCenter/ui/PCEmpty.tsx +0 -35
  224. package/src/RedactoPrivacyCenter/ui/PCInput.tsx +0 -132
  225. package/src/RedactoPrivacyCenter/ui/PCLoader.tsx +0 -31
  226. package/src/RedactoPrivacyCenter/ui/PCModal.tsx +0 -106
  227. package/src/RedactoPrivacyCenter/ui/PCPopover.tsx +0 -206
  228. package/src/RedactoPrivacyCenter/ui/PCSelect.tsx +0 -433
  229. package/src/RedactoPrivacyCenter/ui/PCTable.tsx +0 -149
  230. package/src/RedactoPrivacyCenter/ui/PCText.tsx +0 -41
  231. package/src/RedactoPrivacyCenter/ui/PCTextarea.tsx +0 -43
  232. package/src/RedactoPrivacyCenter/ui/PCTitle.tsx +0 -37
  233. package/src/RedactoPrivacyCenter/ui/PCTooltip.tsx +0 -121
  234. package/src/RedactoPrivacyCenter/ui/SimpleBar.tsx +0 -25
  235. package/src/RedactoPrivacyCenter/ui/StatusBadge.tsx +0 -53
  236. package/src/RedactoPrivacyCenter/ui/index.ts +0 -18
  237. package/src/RedactoPrivacyCenter/utils/cn.ts +0 -28
  238. package/src/RedactoPrivacyCenter/utils/date.ts +0 -48
  239. package/src/RedactoPrivacyCenter/utils/status.ts +0 -111
  240. package/src/RedactoPrivacyCenter/utils/toast.ts +0 -130
  241. package/src/index.ts +0 -19
  242. package/src/privacy-center.ts +0 -113
  243. package/src/shared/api-errors.ts +0 -180
  244. package/src/shared/notice-consent-status.ts +0 -190
  245. package/src/types/css.d.ts +0 -4
  246. package/src/types/images.d.ts +0 -19
  247. package/src/types/react-jsx.d.ts +0 -26
  248. package/tests/DataAvailabilityContext.test.tsx +0 -123
  249. package/tests/Form.test.tsx +0 -1287
  250. package/tests/ManageConsentErrorMapping.test.tsx +0 -85
  251. package/tests/ProductSelectionSection.test.tsx +0 -328
  252. package/tests/RequestSubmit.test.tsx +0 -135
  253. package/tests/RevocablePurpose.test.tsx +0 -146
  254. package/tests/RevokeWarningMessage.test.tsx +0 -151
  255. package/tests/consentClient.test.ts +0 -217
  256. package/tests/manageConsentServer.test.ts +0 -38
  257. package/tests/mocks.ts +0 -257
  258. package/tests/resolveContactFromJwt.test.ts +0 -44
  259. package/tests/setup.ts +0 -16
  260. package/tsconfig.json +0 -16
  261. package/tsup.config.ts +0 -31
  262. package/vitest.config.ts +0 -16
@@ -1,107 +0,0 @@
1
- import { type CSSProperties } from 'react';
2
- import { useTranslation } from 'react-i18next';
3
- import { useInternalNavigation } from '../../context/NavigationContext';
4
- import { usePageChrome } from '../../context/PageChromeContext';
5
- import { PAGE_CHROME_BY_PAGE } from '../../lib/constants';
6
- import { getVar } from '../../lib/utils';
7
-
8
- export function PageHeader() {
9
- const { t } = useTranslation();
10
- const { currentPage } = useInternalNavigation();
11
- const { pageChromeOverride, headerStatus } = usePageChrome();
12
- const pageChrome = pageChromeOverride ?? PAGE_CHROME_BY_PAGE[currentPage];
13
-
14
- if (!pageChrome) return null;
15
-
16
- const title = t(pageChrome.titleKey);
17
- const description = pageChrome.descriptionKey ? t(pageChrome.descriptionKey) : null;
18
-
19
- const wrapperStyle: CSSProperties = {
20
- display: 'flex',
21
- flexDirection: 'column',
22
- gap: 4,
23
- padding: 'var(--pc-shell-pageheader-padding, 20px 0 16px)',
24
- borderBottom: `1px solid ${getVar('--pc-border-color')}`,
25
- marginBottom: 16,
26
- };
27
-
28
- const titleRowStyle: CSSProperties = {
29
- display: 'flex',
30
- alignItems: 'center',
31
- gap: 10,
32
- minWidth: 0,
33
- };
34
-
35
- const titleStyle: CSSProperties = {
36
- margin: 0,
37
- color: getVar('--pc-text-primary'),
38
- fontSize: 18,
39
- fontWeight: 700,
40
- lineHeight: 1.25,
41
- overflow: 'hidden',
42
- textOverflow: 'ellipsis',
43
- whiteSpace: 'nowrap',
44
- minWidth: 0,
45
- };
46
-
47
- const descriptionStyle: CSSProperties = {
48
- margin: 0,
49
- color: getVar('--pc-text-secondary'),
50
- fontSize: 13,
51
- lineHeight: 1.4,
52
- overflow: 'hidden',
53
- textOverflow: 'ellipsis',
54
- whiteSpace: 'nowrap',
55
- };
56
-
57
- return (
58
- <div className="pc-shell-page-header" style={wrapperStyle}>
59
- <div style={titleRowStyle}>
60
- <h1 style={titleStyle}>{title}</h1>
61
- {headerStatus && (
62
- <span
63
- style={{
64
- display: 'inline-flex',
65
- alignItems: 'center',
66
- flexShrink: 0,
67
- borderRadius: 9999,
68
- gap: 6,
69
- padding: '4px 10px',
70
- fontSize: 11,
71
- fontWeight: 600,
72
- lineHeight: 1.2,
73
- border: `1px solid ${
74
- headerStatus.variant === 'success'
75
- ? 'rgba(16, 185, 129, 0.35)'
76
- : getVar('--pc-warning-border')
77
- }`,
78
- background:
79
- headerStatus.variant === 'success'
80
- ? 'rgba(16, 185, 129, 0.10)'
81
- : getVar('--pc-warning-bg'),
82
- color:
83
- headerStatus.variant === 'success'
84
- ? getVar('--pc-success')
85
- : getVar('--pc-warning-text'),
86
- }}
87
- >
88
- <span
89
- aria-hidden="true"
90
- style={{
91
- width: 7,
92
- height: 7,
93
- borderRadius: 9999,
94
- background:
95
- headerStatus.variant === 'success'
96
- ? getVar('--pc-success')
97
- : getVar('--pc-warning'),
98
- }}
99
- />
100
- {headerStatus.label}
101
- </span>
102
- )}
103
- </div>
104
- {description && <p style={descriptionStyle}>{description}</p>}
105
- </div>
106
- );
107
- }
@@ -1,100 +0,0 @@
1
- import { useMemo, type CSSProperties } from 'react';
2
- import { useTranslation } from 'react-i18next';
3
- import { PanelLeftClose, PanelLeftOpen } from 'lucide-react';
4
- import { PCActionIcon } from '../../ui';
5
- import { useMenuItemsPC } from '../../lib/constants';
6
- import { getVar } from '../../lib/utils';
7
- import { NavItem } from './NavItem';
8
-
9
- type SidebarNavProps = {
10
- isExpanded: boolean;
11
- onToggle: () => void;
12
- className?: string;
13
- };
14
-
15
- const SIDEBAR_WIDTH_EXPANDED = 240;
16
- const SIDEBAR_WIDTH_COLLAPSED = 64;
17
- const TOP_BAR_HEIGHT = 56;
18
-
19
- export function SidebarNav({ isExpanded, onToggle, className }: SidebarNavProps) {
20
- const { t } = useTranslation();
21
- const menuItems = useMenuItemsPC();
22
- const mode = isExpanded ? 'expanded' : 'collapsed';
23
-
24
- const asideStyle = useMemo<CSSProperties>(
25
- () => ({
26
- position: 'sticky',
27
- top: TOP_BAR_HEIGHT,
28
- alignSelf: 'flex-start',
29
- flexShrink: 0,
30
- height: `calc(100vh - ${TOP_BAR_HEIGHT}px)`,
31
- width: isExpanded ? SIDEBAR_WIDTH_EXPANDED : SIDEBAR_WIDTH_COLLAPSED,
32
- background: getVar('--pc-bg-shell'),
33
- borderRight: `1px solid ${getVar('--pc-border-color')}`,
34
- overflow: 'visible',
35
- zIndex: 5,
36
- display: 'flex',
37
- flexDirection: 'column',
38
- }),
39
- [isExpanded],
40
- );
41
-
42
- const flatNavItems = useMemo(
43
- () => menuItems.filter((item) => Boolean(item.href)),
44
- [menuItems],
45
- );
46
-
47
- return (
48
- <aside
49
- className={['pc-shell-sidebar', className].filter(Boolean).join(' ')}
50
- data-expanded={isExpanded ? 'true' : 'false'}
51
- style={asideStyle}
52
- >
53
- <PCActionIcon
54
- variant="outline"
55
- className="pc-shell-sidebar-toggle"
56
- aria-label={isExpanded ? t('collapseSidebar') : t('expandSidebar')}
57
- aria-expanded={isExpanded}
58
- aria-controls="pc-shell-sidebar-nav"
59
- onClick={onToggle}
60
- style={{
61
- position: 'absolute',
62
- top: 12,
63
- right: -14,
64
- width: 28,
65
- height: 28,
66
- borderRadius: 9999,
67
- background: getVar('--pc-bg-shell'),
68
- borderColor: getVar('--pc-border-color'),
69
- color: getVar('--pc-text-secondary'),
70
- boxShadow: '0 4px 12px rgba(15, 23, 42, 0.08)',
71
- zIndex: 10,
72
- padding: 0,
73
- }}
74
- >
75
- {isExpanded ? <PanelLeftClose size={14} /> : <PanelLeftOpen size={14} />}
76
- </PCActionIcon>
77
-
78
- <nav
79
- id="pc-shell-sidebar-nav"
80
- role="navigation"
81
- aria-label="Privacy center primary navigation"
82
- style={{
83
- flex: 1,
84
- minHeight: 0,
85
- overflowY: 'auto',
86
- overflowX: 'hidden',
87
- padding: '24px 12px',
88
- display: 'flex',
89
- flexDirection: 'column',
90
- gap: 4,
91
- boxSizing: 'border-box',
92
- }}
93
- >
94
- {flatNavItems.map((item) => (
95
- <NavItem key={item.href ?? item.name} item={item} mode={mode} />
96
- ))}
97
- </nav>
98
- </aside>
99
- );
100
- }
@@ -1,339 +0,0 @@
1
- import {
2
- forwardRef,
3
- useCallback,
4
- useEffect,
5
- useRef,
6
- useState,
7
- type CSSProperties,
8
- type ForwardedRef,
9
- type Ref,
10
- } from 'react';
11
- import { useTranslation } from 'react-i18next';
12
- import { Check, ChevronDown, Globe2, Menu } from 'lucide-react';
13
- import { PCActionIcon, PCAvatar, PCSelect } from '../../ui';
14
- import { useBranding } from '../../context/BrandingContext';
15
- import { useOrganization } from '../../context/OrganizationContext';
16
- import { useInternalNavigation } from '../../context/NavigationContext';
17
- import { getVar } from '../../lib/utils';
18
- import { languageOptions } from '../../lib/constants';
19
- import i18n from '../../lib/i18n';
20
- import { NotificationBell } from '../NotificationHub/NotificationBell';
21
- import { UserMenu } from './UserMenu';
22
-
23
- type TopAppBarProps = {
24
- onOpenMobileNav: () => void;
25
- showHamburger: boolean;
26
- locale: string;
27
- onLocaleChange: (next: string) => void;
28
- onBack?: 'back' | 'signout';
29
- showNotifications?: boolean;
30
- };
31
-
32
- export const TopAppBar = forwardRef<HTMLButtonElement, TopAppBarProps>(function TopAppBar(
33
- { onOpenMobileNav, showHamburger, locale, onLocaleChange, onBack, showNotifications = true },
34
- hamburgerRef,
35
- ) {
36
- const { t } = useTranslation();
37
- const branding = useBranding();
38
- const { organization } = useOrganization();
39
- const { navigateTo } = useInternalNavigation();
40
-
41
- const displayName = branding?.brand_name || organization?.name || '';
42
- const hasLogoImage = Boolean(branding?.logo_url);
43
-
44
- const handleLanguageChange = useCallback(
45
- (value: unknown) => {
46
- const langValue = value as { value: string; label: string } | null;
47
- if (!langValue) return;
48
- void i18n.changeLanguage(langValue.value);
49
- onLocaleChange(langValue.value);
50
- },
51
- [onLocaleChange],
52
- );
53
-
54
- const headerStyle: CSSProperties = {
55
- position: 'sticky',
56
- top: 0,
57
- left: 0,
58
- right: 0,
59
- zIndex: 50,
60
- display: 'flex',
61
- alignItems: 'center',
62
- justifyContent: 'space-between',
63
- gap: 16,
64
- height: 56,
65
- paddingLeft: 16,
66
- paddingRight: 16,
67
- background: getVar('--pc-bg-shell'),
68
- borderBottom: `1px solid ${getVar('--pc-border-color')}`,
69
- boxSizing: 'border-box',
70
- };
71
-
72
- const brandButtonStyle: CSSProperties = {
73
- display: 'inline-flex',
74
- alignItems: 'center',
75
- padding: 4,
76
- margin: 0,
77
- border: 'none',
78
- background: 'transparent',
79
- color: getVar('--pc-text-primary'),
80
- cursor: 'pointer',
81
- borderRadius: 8,
82
- fontFamily: 'inherit',
83
- flexShrink: 0,
84
- };
85
-
86
- return (
87
- <>
88
- <header role="banner" className="pc-shell-topbar" style={headerStyle}>
89
- <div style={{ display: 'flex', alignItems: 'center', gap: 8, minWidth: 0 }}>
90
- {showHamburger && (
91
- <HamburgerButton
92
- ref={hamburgerRef as Ref<HTMLButtonElement>}
93
- onClick={onOpenMobileNav}
94
- label={t('openSidebarMenu')}
95
- />
96
- )}
97
- <button
98
- type="button"
99
- onClick={() => navigateTo('consent-manager')}
100
- aria-label={displayName ? `Go to ${displayName} privacy center` : 'Go to privacy center'}
101
- style={brandButtonStyle}
102
- onMouseEnter={(e) => {
103
- e.currentTarget.style.background = getVar('--pc-bg-hover');
104
- }}
105
- onMouseLeave={(e) => {
106
- e.currentTarget.style.background = 'transparent';
107
- }}
108
- >
109
- <span
110
- style={{
111
- display: 'inline-flex',
112
- alignItems: 'center',
113
- justifyContent: 'center',
114
- flexShrink: 0,
115
- height: 32,
116
- }}
117
- >
118
- {hasLogoImage ? (
119
- <img
120
- src={branding!.logo_url!}
121
- alt={displayName}
122
- style={{
123
- height: 32,
124
- width: 'auto',
125
- maxWidth: 200,
126
- objectFit: 'contain',
127
- display: 'block',
128
- }}
129
- />
130
- ) : branding?.icon_url ? (
131
- <PCAvatar src={branding.icon_url} name={displayName} size="md" color="info" />
132
- ) : (
133
- <PCAvatar name={displayName} size="md" color="info" />
134
- )}
135
- </span>
136
- </button>
137
- </div>
138
-
139
- <div
140
- style={{
141
- display: 'flex',
142
- alignItems: 'center',
143
- gap: 8,
144
- flexShrink: 0,
145
- }}
146
- className="pc-shell-topbar-actions"
147
- >
148
- {showHamburger ? (
149
- <CompactLanguageMenu
150
- locale={locale}
151
- onChange={(value) => {
152
- void i18n.changeLanguage(value);
153
- onLocaleChange(value);
154
- }}
155
- />
156
- ) : (
157
- <PCSelect
158
- size="sm"
159
- searchable
160
- prefix={<Globe2 size={12} strokeWidth={1.8} />}
161
- searchPlaceholder={t('searchPlaceholder')}
162
- noOptionsMessage={t('noOptionsFound')}
163
- style={{
164
- width: 'auto',
165
- minWidth: 120,
166
- maxWidth: 'min(60vw, 280px)',
167
- flexShrink: 0,
168
- }}
169
- options={languageOptions}
170
- value={languageOptions.find((opt) => opt.value === locale) || null}
171
- onChange={handleLanguageChange}
172
- />
173
- )}
174
- {showNotifications && <NotificationBell />}
175
- <UserMenu onBack={onBack} />
176
- </div>
177
- </header>
178
- <style>{`
179
- @media (max-width: 639px) {
180
- .pc-shell-topbar { padding-left: 8px !important; padding-right: 8px !important; gap: 8px !important; }
181
- .pc-shell-topbar-actions { gap: 4px !important; }
182
- }
183
- `}</style>
184
- </>
185
- );
186
- });
187
-
188
- type CompactLanguageMenuProps = {
189
- locale: string;
190
- onChange: (value: string) => void;
191
- };
192
-
193
- function CompactLanguageMenu({ locale, onChange }: CompactLanguageMenuProps) {
194
- const containerRef = useRef<HTMLDivElement>(null);
195
- const [open, setOpen] = useState(false);
196
-
197
- useEffect(() => {
198
- if (!open) return;
199
- const onDocMouseDown = (event: MouseEvent) => {
200
- if (!containerRef.current?.contains(event.target as Node)) {
201
- setOpen(false);
202
- }
203
- };
204
- const onKey = (event: KeyboardEvent) => {
205
- if (event.key === 'Escape') setOpen(false);
206
- };
207
- document.addEventListener('mousedown', onDocMouseDown);
208
- document.addEventListener('keydown', onKey);
209
- return () => {
210
- document.removeEventListener('mousedown', onDocMouseDown);
211
- document.removeEventListener('keydown', onKey);
212
- };
213
- }, [open]);
214
-
215
- const code = (locale || 'en').split('-')[0]!.toUpperCase();
216
- const selectedLabel =
217
- languageOptions.find((opt) => opt.value === locale)?.label ?? locale;
218
-
219
- return (
220
- <div ref={containerRef} style={{ position: 'relative', flexShrink: 0 }}>
221
- <button
222
- type="button"
223
- aria-haspopup="listbox"
224
- aria-expanded={open}
225
- aria-label={`Language: ${selectedLabel}`}
226
- onClick={() => setOpen((v) => !v)}
227
- style={{
228
- display: 'inline-flex',
229
- alignItems: 'center',
230
- gap: 4,
231
- height: 32,
232
- padding: '0 8px 0 10px',
233
- borderRadius: 9999,
234
- background: getVar('--pc-bg-shell'),
235
- border: `1px solid ${getVar('--pc-border-color')}`,
236
- color: getVar('--pc-text-primary'),
237
- cursor: 'pointer',
238
- fontFamily: 'inherit',
239
- fontSize: 12,
240
- fontWeight: 600,
241
- letterSpacing: '0.02em',
242
- lineHeight: 1,
243
- }}
244
- >
245
- {code}
246
- <ChevronDown size={12} strokeWidth={2} />
247
- </button>
248
- {open && (
249
- <div
250
- role="listbox"
251
- aria-label="Language"
252
- style={{
253
- position: 'absolute',
254
- top: 'calc(100% + 6px)',
255
- right: 0,
256
- minWidth: 200,
257
- maxHeight: 320,
258
- overflowY: 'auto',
259
- background: getVar('--pc-bg-primary'),
260
- border: `1px solid ${getVar('--pc-border-color')}`,
261
- borderRadius: 12,
262
- boxShadow: '0 8px 24px rgba(15, 23, 42, 0.15)',
263
- padding: 6,
264
- zIndex: 1060,
265
- }}
266
- >
267
- {languageOptions.map((opt) => {
268
- const selected = opt.value === locale;
269
- return (
270
- <button
271
- key={opt.value}
272
- type="button"
273
- role="option"
274
- aria-selected={selected}
275
- onClick={() => {
276
- onChange(opt.value);
277
- setOpen(false);
278
- }}
279
- onMouseEnter={(e) => {
280
- if (!selected) {
281
- e.currentTarget.style.background = getVar('--pc-bg-hover');
282
- }
283
- }}
284
- onMouseLeave={(e) => {
285
- if (!selected) {
286
- e.currentTarget.style.background = 'transparent';
287
- }
288
- }}
289
- style={{
290
- display: 'flex',
291
- alignItems: 'center',
292
- justifyContent: 'space-between',
293
- width: '100%',
294
- padding: '8px 10px',
295
- background: selected ? getVar('--pc-bg-hover') : 'transparent',
296
- color: selected
297
- ? getVar('--pc-primary')
298
- : getVar('--pc-text-primary'),
299
- border: 'none',
300
- borderRadius: 8,
301
- fontFamily: 'inherit',
302
- fontSize: 13,
303
- fontWeight: selected ? 600 : 500,
304
- cursor: 'pointer',
305
- textAlign: 'left',
306
- transition: 'background 150ms ease',
307
- }}
308
- >
309
- <span>{opt.label}</span>
310
- {selected && <Check size={14} strokeWidth={2} />}
311
- </button>
312
- );
313
- })}
314
- </div>
315
- )}
316
- </div>
317
- );
318
- }
319
-
320
- const HamburgerButton = forwardRef<HTMLButtonElement, { onClick: () => void; label: string }>(
321
- function HamburgerButton({ onClick, label }, ref: ForwardedRef<HTMLButtonElement>) {
322
- return (
323
- <PCActionIcon
324
- ref={ref}
325
- variant="default"
326
- aria-label={label}
327
- onClick={onClick}
328
- style={{
329
- width: 40,
330
- height: 40,
331
- padding: 0,
332
- color: getVar('--pc-text-primary'),
333
- }}
334
- >
335
- <Menu size={20} />
336
- </PCActionIcon>
337
- );
338
- },
339
- );