@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,159 +0,0 @@
1
- import { useMemo } from 'react';
2
- import { useTranslation } from 'react-i18next';
3
- import { PCText, PCActionIcon, PCTooltip, PCBadge } from '../ui';
4
- import { pcStyles } from '../styles/pcStyles';
5
- import { FiDownload } from 'react-icons/fi';
6
- import { createColumnHelper } from '@tanstack/react-table';
7
- import type { CaseRequest } from '../lib/types';
8
- import { formatDate } from './utils';
9
-
10
- const getVar = (varName: string): string => `var(${varName})`;
11
- const columnHelper = createColumnHelper<CaseRequest>();
12
-
13
- const getCaseStatusVariant = (status: string): 'success' | 'error' | 'warning' | 'info' | 'secondary' => {
14
- const n = status.toLowerCase().replace(/_/g, '');
15
- if (n === 'completed') return 'success';
16
- if (n === 'rejected' || n === 'declined') return 'error';
17
- if (n === 'processing' || n === 'inprogress' || n === 'expired') return 'warning';
18
- if (n === 'initiated') return 'info';
19
- return 'secondary';
20
- };
21
- const formatCaseStatus = (s: string) =>
22
- s.replace(/_/g, ' ').replace(/\b\w/g, (c) => c.toUpperCase());
23
-
24
- export const useCaseHistoryColumns = () => {
25
- const { t } = useTranslation();
26
- return useMemo(
27
- () => [
28
- columnHelper.accessor('case_id', {
29
- id: 'case_id',
30
- size: 150,
31
- minSize: 120,
32
- header: t('caseID'),
33
- meta: { align: 'left' },
34
- cell: (info) => (
35
- <div style={{ width: '100%', minWidth: '100px', textAlign: 'left' }}>
36
- <PCText size="sm" weight="medium" color="primary">
37
- {info.getValue()}
38
- </PCText>
39
- <PCText
40
- size="sm"
41
- color="secondary"
42
- style={{
43
- marginTop: pcStyles.mtXs.marginTop,
44
- display: 'block',
45
- fontSize: '0.75rem',
46
- }}
47
- >
48
- {formatDate(info.row.original.created_at)}
49
- </PCText>
50
- </div>
51
- ),
52
- enableSorting: false,
53
- enableColumnFilter: false,
54
- }),
55
- columnHelper.accessor('request_type', {
56
- id: 'request_type',
57
- size: 150,
58
- minSize: 120,
59
- header: t('requestType'),
60
- meta: { align: 'left' },
61
- cell: (info) => {
62
- const row = info.row.original;
63
- const displayValue = row.request_type_display || info.getValue().replace('_', ' ');
64
- return (
65
- <PCText
66
- size="sm"
67
- style={{
68
- textAlign: 'left',
69
- textTransform: row.request_type_display ? 'none' : 'capitalize',
70
- width: '100%',
71
- }}
72
- >
73
- {displayValue}
74
- </PCText>
75
- );
76
- },
77
- enableSorting: false,
78
- enableColumnFilter: false,
79
- }),
80
- columnHelper.accessor('status', {
81
- id: 'status',
82
- size: 120,
83
- minSize: 100,
84
- header: t('status'),
85
- meta: { align: 'left' },
86
- cell: (info) => {
87
- const row = info.row.original;
88
- const displayStatus = row.status_display || formatCaseStatus(info.getValue());
89
- return (
90
- <div style={{ ...pcStyles.flex, ...pcStyles.itemsCenter, ...pcStyles.justifyStart, width: '100%' }}>
91
- <PCBadge variant={getCaseStatusVariant(info.getValue())} size="sm" className="pc-status-badge">
92
- {displayStatus}
93
- </PCBadge>
94
- </div>
95
- );
96
- },
97
- enableSorting: false,
98
- enableColumnFilter: false,
99
- }),
100
- columnHelper.accessor('created_at', {
101
- id: 'created_at',
102
- size: 180,
103
- minSize: 140,
104
- header: t('submittedOn'),
105
- meta: { align: 'left' },
106
- cell: (info) => (
107
- <PCText
108
- size="sm"
109
- color="secondary"
110
- style={{
111
- textAlign: 'left',
112
- fontSize: '0.875rem',
113
- width: '100%',
114
- }}
115
- >
116
- {formatDate(info.getValue())}
117
- </PCText>
118
- ),
119
- enableSorting: false,
120
- enableColumnFilter: false,
121
- }),
122
- columnHelper.display({
123
- id: 'action',
124
- size: 100,
125
- minSize: 80,
126
- header: t('action'),
127
- meta: { align: 'right' },
128
- enableSorting: false,
129
- enableColumnFilter: false,
130
- cell: () => {
131
- return (
132
- <div style={{
133
- ...pcStyles.flex,
134
- ...pcStyles.justifyEnd,
135
- ...pcStyles.gapXs,
136
- width: '100%',
137
- }}>
138
- <PCTooltip content={t('downloadResponse')}>
139
- <PCActionIcon
140
- variant="outline"
141
- size="sm"
142
- disabled={true}
143
- style={{
144
- color: getVar('--pc-text-secondary'),
145
- opacity: 0.5,
146
- }}
147
- aria-label={t('downloadResponse')}
148
- >
149
- <FiDownload size={16} />
150
- </PCActionIcon>
151
- </PCTooltip>
152
- </div>
153
- );
154
- },
155
- }),
156
- ],
157
- [t]
158
- );
159
- };
@@ -1,52 +0,0 @@
1
- import type { BadgeVariant, MarkerTint } from './types';
2
-
3
- export const GRIEVANCE_TAB_IDS = {
4
- ALL: 'all',
5
- PROCESSING: 'processing',
6
- COMPLETED: 'completed',
7
- REJECTED: 'rejected',
8
- } as const;
9
-
10
- // Re-export shared table configuration
11
- export {
12
- PAGE_SIZE_OPTIONS,
13
- INITIAL_PAGE,
14
- INITIAL_PAGE_SIZE,
15
- } from '../config/table';
16
-
17
-
18
- export const MAX_DISPLAYED_PURPOSE_NAMES_IN_ERASURE_MODAL = 3;
19
-
20
- // ─── Activity timeline ──────────────────────────────────────────────────────
21
-
22
- export const TIMELINE_MARKER_SIZE = 30;
23
- export const TIMELINE_TIME_COL = '64px';
24
- export const TIMELINE_MARKER_COL = '34px';
25
- export const TIMELINE_COL_GAP = 12;
26
- // Rail sits at the centre of the marker column: time col + gap + half marker col.
27
- export const TIMELINE_RAIL_LEFT = 64 + TIMELINE_COL_GAP + 17;
28
-
29
- // Marker tint per variant — mirrors the PCBadge palette so tag + marker match.
30
- // Literal `var(--…)` strings (same as getVar) avoid a constants↔utils import cycle.
31
- export const MARKER_TINT: Record<BadgeVariant, MarkerTint> = {
32
- success: { color: 'var(--pc-success)', bg: 'rgba(16, 185, 129, 0.12)' },
33
- error: { color: 'var(--pc-error)', bg: 'rgba(239, 68, 68, 0.12)' },
34
- warning: { color: 'var(--pc-warning)', bg: 'rgba(245, 158, 11, 0.13)' },
35
- info: { color: 'var(--pc-info)', bg: 'rgba(59, 130, 246, 0.12)' },
36
- secondary: { color: 'var(--pc-text-secondary)', bg: 'var(--pc-bg-tertiary)' },
37
- };
38
-
39
- // Internal error thrown when an activity page fails to load (surfaced to the
40
- // user via the i18n `failedToFetchActivityData` toast).
41
- export const ACTIVITY_FETCH_ERROR_MESSAGE = 'Failed to fetch activity data';
42
-
43
- // ─── Shared-contact profile picker ───────────────────────────────────────────
44
-
45
- // sessionStorage key pinning the principal the user chose this session, so
46
- // routine token refreshes skip the picker.
47
- export const PICKED_ORG_USER_KEY = 'pc_picked_org_user_id';
48
-
49
- // The shared-contact picker/switch user-facing strings are localized via i18n —
50
- // see the chooseYourProfile / loginIdentifierLinkedToMultipleProfiles /
51
- // signingInEllipsis / couldNotSwitchProfile / switchProfile keys in
52
- // locales/*/translation.json.
@@ -1,155 +0,0 @@
1
- import { LEGACY_PRODUCT_GROUP_UUID } from '../lib/constants';
2
- import type {
3
- ConsentDataElement,
4
- ConsentGroup,
5
- DataElement,
6
- FormData,
7
- FormProductGroup,
8
- Purpose,
9
- PurposeItem,
10
- } from '../lib/types';
11
-
12
- /**
13
- * Map a `ConsentGroup` (from the user-consents endpoint — served by the Go
14
- * ledger, or by Python's `/dsar/privacy-center/user-consents` when no
15
- * ledgerBaseUrl is configured) onto the DSAR request form's
16
- * `FormProductGroup`. Approach A: the request-form product picker is sourced
17
- * from user-consents instead of Python's `form/data`, since after the cutover
18
- * `form/data` no longer emits product groups.
19
- *
20
- * The shapes are near-identical; the only adaptations are:
21
- * - purpose id rename: ledger `purpose_uuid` -> form `uuid` (which the picker
22
- * keys on and the submit payload sends back as `purpose_uuid`),
23
- * - the ledger data-element's `selected` stands in for the form's
24
- * `given_consent`,
25
- * - fields the picker never reads (industries, validity, descriptions) are
26
- * defaulted.
27
- *
28
- * NOTE: the ledger caps inline purposes at 50 per group (`has_more_purposes`).
29
- * A product with more than 50 purposes would need the per-group purposes
30
- * endpoint to assemble a complete CORRECTION data-element list (follow-up).
31
- */
32
- export const consentGroupToFormProductGroup = (
33
- group: ConsentGroup,
34
- ): FormProductGroup => ({
35
- product_uuid: group.product_uuid,
36
- product_name: group.product_name,
37
- product_description: group.product_description,
38
- nominator: group.nominator,
39
- purposes: (group.purposes ?? []).map(purposeItemToFormPurpose),
40
- });
41
-
42
- const purposeItemToFormPurpose = (purpose: PurposeItem): Purpose => ({
43
- // The ledger keys purposes as `purpose_uuid`; the legacy Python
44
- // user-consents payload keys some of them as `uuid`. Accept either so the
45
- // picker and the submitted `purpose_uuid` resolve on both backends.
46
- uuid: purpose.purpose_uuid ?? purpose.uuid ?? '',
47
- purpose_uuid: purpose.purpose_uuid ?? purpose.uuid ?? '',
48
- name: purpose.name,
49
- description: purpose.description ?? '',
50
- industries: '',
51
- selected: false,
52
- given_consent: false,
53
- status: purpose.status,
54
- validity: null,
55
- enabled: true,
56
- data_elements: (purpose.data_elements ?? []).map(
57
- consentDataElementToFormDataElement,
58
- ),
59
- });
60
-
61
- /**
62
- * Build a single synthetic product group from a backend's legacy flat
63
- * `form/data.purposes` list.
64
- *
65
- * Used as the last fallback for the DSAR picker: pre-grouping Python
66
- * deployments (and the popup / case-management contexts, which resolve an
67
- * arbitrary contact that the JWT-scoped user-consents endpoint cannot serve)
68
- * return purposes without any product grouping. Rendering them under one
69
- * group keeps the picker usable instead of showing "No products available"
70
- * while the response actually carries consents — it is the lone group, so the
71
- * product-selection step is skipped and the purpose list renders directly,
72
- * matching the pre-grouping UX.
73
- *
74
- * The group carries `LEGACY_PRODUCT_GROUP_UUID`, which the submit path uses to
75
- * omit the product anchor (there is no real product to scope the case to).
76
- */
77
- export const legacyFlatGroup = (
78
- form: FormData,
79
- label: string,
80
- ): FormProductGroup => ({
81
- product_uuid: LEGACY_PRODUCT_GROUP_UUID,
82
- product_name: label,
83
- product_description: null,
84
- nominator: null,
85
- purposes: (form.purposes ?? [])
86
- .map((wrapper) => wrapper?.purpose)
87
- .filter((purpose): purpose is Purpose => Boolean(purpose)),
88
- });
89
-
90
- const consentDataElementToFormDataElement = (
91
- element: ConsentDataElement,
92
- ): DataElement => ({
93
- uuid: element.uuid,
94
- name: element.name,
95
- description: '',
96
- enabled: element.enabled,
97
- required: element.required,
98
- given_consent: element.selected,
99
- selected: element.selected,
100
- });
101
-
102
- /**
103
- * Build the per-purpose state used by `PurposeSelectionSection` for a single
104
- * product group. Mirrors the legacy `data.purposes`-derived shape so the
105
- * existing checkbox component works unchanged: data-elements default to
106
- * `selected: false` and purposes are filtered to those with at least one
107
- * data element.
108
- *
109
- * Lives in its own module so both `Form.tsx` (which seeds the per-group
110
- * state Map) and `ProductSelectionSection.tsx` (which computes the
111
- * activeCount shown on each product card) can share the same filter —
112
- * otherwise the card header drifts from the list-body it summarises.
113
- */
114
- export const buildGroupPurposes = (group: FormProductGroup): Purpose[] =>
115
- group.purposes
116
- .filter((p): p is Purpose => p !== null && p !== undefined)
117
- .map((p) => {
118
- const validDataElements = Array.isArray(p.data_elements)
119
- ? p.data_elements
120
- .filter((de) => de !== null && de !== undefined && Boolean(de.uuid))
121
- .map((de) => ({ ...de, selected: false }))
122
- : [];
123
- return {
124
- ...p,
125
- selected: false,
126
- data_elements: validDataElements,
127
- };
128
- })
129
- .filter((p) => p.data_elements.length > 0);
130
-
131
- export type GroupCorrectionDataElement = DataElement & { purposeName: string };
132
-
133
- /**
134
- * Build a product-scoped deduped data-element list for grouped CORRECTION.
135
- * Dedup is done by data-element UUID within the product group.
136
- */
137
- export const buildGroupDataElements = (
138
- group: FormProductGroup,
139
- ): GroupCorrectionDataElement[] => {
140
- const byUuid = new Map<string, GroupCorrectionDataElement>();
141
- for (const purpose of group.purposes) {
142
- if (!purpose) {
143
- continue;
144
- }
145
- const dataElements = Array.isArray(purpose.data_elements)
146
- ? purpose.data_elements
147
- : [];
148
- for (const de of dataElements) {
149
- if (de && de.uuid && !byUuid.has(de.uuid)) {
150
- byUuid.set(de.uuid, { ...de, purposeName: purpose.name });
151
- }
152
- }
153
- }
154
- return Array.from(byUuid.values());
155
- };
@@ -1,203 +0,0 @@
1
- import { useMemo } from 'react';
2
- import { useTranslation } from 'react-i18next';
3
- import { createColumnHelper } from '@tanstack/react-table';
4
- import dayjs from 'dayjs';
5
- import { Download } from 'lucide-react';
6
- import { PCText, PCButton, PCBadge } from '../ui';
7
- import { pcStyles } from '../styles/pcStyles';
8
- import { STATUS_COLORS } from '../lib/constants';
9
- import { getVar } from '../lib/utils';
10
- import type { Receipt } from '../lib/types';
11
-
12
- const columnHelper = createColumnHelper<Receipt>();
13
-
14
- type EventPalette = { color: string; bg: string };
15
- type BadgeVariant = 'success' | 'error' | 'warning' | 'info';
16
-
17
- // Map the raw event_type enum to a status palette + a fallback i18n label.
18
- // The localized `event_type_display` from the API is preferred when present.
19
- const EVENT_PALETTE: Record<string, EventPalette> = {
20
- GRANTED: STATUS_COLORS.success,
21
- WITHDRAWN: STATUS_COLORS.warning,
22
- DECLINED: STATUS_COLORS.error,
23
- EXPIRED: STATUS_COLORS.warning,
24
- };
25
-
26
- const EVENT_LABEL_KEY: Record<string, string> = {
27
- GRANTED: 'consentGranted',
28
- WITHDRAWN: 'consentRevoked',
29
- DECLINED: 'consentDeclined',
30
- EXPIRED: 'consentExpired',
31
- };
32
-
33
- const FALLBACK_PALETTE: EventPalette = STATUS_COLORS.info;
34
- const EVENT_BADGE_VARIANT: Record<string, BadgeVariant> = {
35
- GRANTED: 'success',
36
- WITHDRAWN: 'warning',
37
- DECLINED: 'error',
38
- EXPIRED: 'warning',
39
- };
40
-
41
- // First two alphanumerics of the product name, e.g. "Website" → "WE", "Mobile App" → "MO".
42
- function getProductInitials(name: string): string {
43
- const cleaned = name.replace(/[^a-zA-Z0-9]/g, '');
44
- return cleaned.slice(0, 2).toUpperCase() || '?';
45
- }
46
-
47
- const cellPad = { paddingTop: pcStyles.pySm.paddingTop, paddingBottom: pcStyles.pySm.paddingBottom };
48
-
49
- export const useReceiptColumns = ({
50
- onDownload,
51
- downloadingUuid,
52
- }: {
53
- onDownload: (receipt: Receipt) => void;
54
- downloadingUuid: string | null;
55
- }) => {
56
- const { t } = useTranslation();
57
- return useMemo(
58
- () => [
59
- columnHelper.accessor('event_type', {
60
- id: 'event',
61
- header: t('event'),
62
- cell: (info) => {
63
- const row = info.row.original;
64
- const raw = String(row.event_type ?? '').toUpperCase();
65
- const palette = EVENT_PALETTE[raw] ?? FALLBACK_PALETTE;
66
- const badgeVariant = EVENT_BADGE_VARIANT[raw] ?? 'info';
67
- const labelKey = EVENT_LABEL_KEY[raw];
68
- const label = row.event_type_display || (labelKey ? t(labelKey) : row.event_type || '—');
69
- return (
70
- <div style={cellPad}>
71
- <PCBadge
72
- variant={badgeVariant}
73
- size="sm"
74
- style={{
75
- display: 'inline-flex',
76
- alignItems: 'center',
77
- gap: '0.4375rem',
78
- fontWeight: 600,
79
- whiteSpace: 'nowrap',
80
- }}
81
- >
82
- <span
83
- aria-hidden="true"
84
- style={{
85
- width: 7,
86
- height: 7,
87
- borderRadius: '50%',
88
- backgroundColor: palette.color,
89
- flexShrink: 0,
90
- }}
91
- />
92
- {label}
93
- </PCBadge>
94
- </div>
95
- );
96
- },
97
- enableSorting: false,
98
- enableColumnFilter: false,
99
- }),
100
- columnHelper.accessor('product_name', {
101
- id: 'product',
102
- header: t('product'),
103
- cell: (info) => {
104
- const row = info.row.original;
105
- const name = row.product_name_display || row.product_name || '—';
106
- return (
107
- <div style={{ ...cellPad, display: 'flex', alignItems: 'center', gap: '0.625rem' }}>
108
- <span
109
- aria-hidden="true"
110
- style={{
111
- display: 'inline-flex',
112
- alignItems: 'center',
113
- justifyContent: 'center',
114
- width: 32,
115
- height: 32,
116
- borderRadius: 8,
117
- backgroundColor: getVar('--pc-bg-tertiary'),
118
- color: getVar('--pc-text-secondary'),
119
- border: `1px solid ${getVar('--pc-border-color')}`,
120
- fontSize: '0.6875rem',
121
- fontWeight: 600,
122
- flexShrink: 0,
123
- }}
124
- >
125
- {getProductInitials(name)}
126
- </span>
127
- <PCText size="sm" weight="medium" color="primary">
128
- {name}
129
- </PCText>
130
- </div>
131
- );
132
- },
133
- enableSorting: false,
134
- enableColumnFilter: false,
135
- }),
136
- columnHelper.accessor('created_at', {
137
- id: 'date',
138
- header: t('date'),
139
- cell: (info) => {
140
- const d = dayjs(info.getValue());
141
- return (
142
- <div style={cellPad}>
143
- <PCText size="sm" color="primary" weight="medium">
144
- {d.isValid() ? d.format('MMM D, YYYY') : '—'}
145
- </PCText>
146
- </div>
147
- );
148
- },
149
- enableSorting: false,
150
- enableColumnFilter: false,
151
- }),
152
- columnHelper.display({
153
- id: 'time',
154
- header: t('time'),
155
- cell: (info) => {
156
- const d = dayjs(info.row.original.created_at);
157
- return (
158
- <div style={cellPad}>
159
- <PCText size="sm" color="secondary">
160
- {d.isValid() ? d.format('h:mm A') : '—'}
161
- </PCText>
162
- </div>
163
- );
164
- },
165
- enableSorting: false,
166
- enableColumnFilter: false,
167
- }),
168
- columnHelper.display({
169
- id: 'download',
170
- header: t('download'),
171
- meta: { align: 'right' },
172
- cell: (info) => {
173
- const row = info.row.original;
174
- const isDownloading = downloadingUuid === row.uuid;
175
- return (
176
- <div style={{ ...cellPad, display: 'flex', justifyContent: 'flex-end' }}>
177
- <PCButton
178
- variant="outline"
179
- size="sm"
180
- isLoading={isDownloading}
181
- disabled={isDownloading || !row.uuid}
182
- onClick={() => onDownload(row)}
183
- style={{
184
- display: 'inline-flex',
185
- alignItems: 'center',
186
- gap: '0.375rem',
187
- minWidth: '6.75rem',
188
- justifyContent: 'center',
189
- }}
190
- >
191
- {!isDownloading && <Download size={15} strokeWidth={1.9} />}
192
- {t('download')}
193
- </PCButton>
194
- </div>
195
- );
196
- },
197
- enableSorting: false,
198
- enableColumnFilter: false,
199
- }),
200
- ],
201
- [t, onDownload, downloadingUuid]
202
- );
203
- };
@@ -1,123 +0,0 @@
1
- import type { ComponentType, ReactNode } from 'react';
2
- import type { LucideProps } from 'lucide-react';
3
- import type {
4
- Activity,
5
- CaseRequest,
6
- ConsentModalRecord,
7
- } from '../lib/types';
8
-
9
- export type TableColumnAlign = 'left' | 'center' | 'right';
10
-
11
- export type TableColumnMeta = {
12
- align?: TableColumnAlign;
13
- };
14
-
15
- export type PrivacyCenterLayoutProps = {
16
- children: ReactNode;
17
- sidebarClassName?: string;
18
- contentClassName?: string;
19
- onBack?: 'back' | 'signout';
20
- };
21
-
22
- export type CaseHistoryProps = {
23
- onCreateRequest: () => void;
24
- isPopup?: boolean;
25
- onClose?: () => void;
26
- };
27
-
28
- export type CaseDetailsModalProps = {
29
- isOpen: boolean;
30
- onClose: () => void;
31
- selectedCase: CaseRequest | null;
32
- };
33
-
34
- /**
35
- * Single-case success surface. The Form's 1-form -> 1-case contract
36
- * means there is no fan-out and no partial-failure UI — every submit
37
- * produces exactly one `case_id`. `product_name` / `product_uuid` are
38
- * populated for product-scoped request types (ACCESS / ERASURE /
39
- * CORRECTION) and empty strings for org-level types (NOMINATION /
40
- * GRIEVANCE), in which case the success card omits the product label.
41
- */
42
- export type RequestSubmitResult = Readonly<{
43
- case_id: string;
44
- uuid: string;
45
- product_name: string;
46
- product_uuid: string;
47
- }>;
48
-
49
- export type RequestSubmitProps = Readonly<{
50
- result: RequestSubmitResult;
51
- contact: string;
52
- onCreateRequest: () => void;
53
- revokeConsentOnFulfilment?: boolean;
54
- revokedPurposeNames?: string;
55
- }>;
56
-
57
- export type PaginationProps = {
58
- currentPage: number;
59
- totalPages: number;
60
- totalRecords: number;
61
- pageSize: number;
62
- onPageChange: (page: number) => void;
63
- onPageSizeChange: (size: number) => void;
64
- className?: string;
65
- };
66
-
67
- export type StatusFilterOption = {
68
- label: string;
69
- value: string;
70
- };
71
-
72
- export type ProductFilterOption = {
73
- label: string;
74
- value: string;
75
- };
76
-
77
- export type ConsentManagerProps = {
78
- variant?: 'modern' | 'minimal';
79
- };
80
-
81
- export type ModifyConsentModalProps = {
82
- isOpen: boolean;
83
- onClose: () => void;
84
- selectedRecord: ConsentModalRecord | null;
85
- isLoading: boolean;
86
- onManageConsent: (
87
- purposeId: string,
88
- action: import('../lib/types').ConsentAction,
89
- nominatorContact?: string,
90
- dataElementUuids?: string[],
91
- productUuid?: string
92
- ) => void;
93
- };
94
-
95
- // ─── Activity timeline ──────────────────────────────────────────────────────
96
-
97
- export type BadgeVariant = 'success' | 'error' | 'warning' | 'info' | 'secondary';
98
-
99
- export type ActivityCategory = {
100
- variant: BadgeVariant;
101
- Icon: ComponentType<LucideProps>;
102
- };
103
-
104
- export type MarkerTint = Readonly<{
105
- color: string;
106
- bg: string;
107
- }>;
108
-
109
- export type ActivityDateGroup = {
110
- key: string;
111
- label: string;
112
- newest: string;
113
- items: Activity[];
114
- };
115
-
116
- export type ActivityTimelineProps = Readonly<{
117
- activities: Activity[];
118
- }>;
119
-
120
- export type TimelineRowProps = Readonly<{
121
- activity: Activity;
122
- }>;
123
-