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

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 (258) hide show
  1. package/NOTICE.md +17 -0
  2. package/README.md +145 -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 +44 -5
  10. package/dist/index.d.ts +44 -5
  11. package/dist/index.js +950 -476
  12. package/dist/index.mjs +572 -314
  13. package/dist/montserrat.generated-NBTECYRW.mjs +22 -0
  14. package/dist/privacy-center.d.mts +55 -12
  15. package/dist/privacy-center.d.ts +55 -12
  16. package/dist/privacy-center.js +848 -950
  17. package/dist/privacy-center.mjs +698 -802
  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 -274
  25. package/src/RedactoNoticeAssisted/RedactoNoticeAssisted.test.tsx +0 -847
  26. package/src/RedactoNoticeAssisted/RedactoNoticeAssisted.tsx +0 -2133
  27. package/src/RedactoNoticeAssisted/api/index.ts +0 -269
  28. package/src/RedactoNoticeAssisted/api/types.ts +0 -180
  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 -1463
  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 -24
  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 -573
  40. package/src/RedactoNoticeConsent/api/types.ts +0 -490
  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 -97
  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 -629
  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 -680
  72. package/src/RedactoPrivacyCenter/api/client.ts +0 -906
  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 -240
  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 -243
  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 -1198
  112. package/src/RedactoPrivacyCenter/components/ConsentManagerCells.tsx +0 -201
  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 -83
  146. package/src/RedactoPrivacyCenter/components/SelectUserGate.tsx +0 -193
  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 -756
  169. package/src/RedactoPrivacyCenter/lib/consent-manager/utils.tsx +0 -67
  170. package/src/RedactoPrivacyCenter/lib/constants.ts +0 -277
  171. package/src/RedactoPrivacyCenter/lib/i18n.ts +0 -81
  172. package/src/RedactoPrivacyCenter/lib/locales.ts +0 -105
  173. package/src/RedactoPrivacyCenter/lib/queries.ts +0 -141
  174. package/src/RedactoPrivacyCenter/lib/types.ts +0 -868
  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 -340
  181. package/src/RedactoPrivacyCenter/locales/bho/translation.json +0 -340
  182. package/src/RedactoPrivacyCenter/locales/bn/translation.json +0 -340
  183. package/src/RedactoPrivacyCenter/locales/brx/translation.json +0 -340
  184. package/src/RedactoPrivacyCenter/locales/doi/translation.json +0 -340
  185. package/src/RedactoPrivacyCenter/locales/en/translation.json +0 -354
  186. package/src/RedactoPrivacyCenter/locales/gom/translation.json +0 -340
  187. package/src/RedactoPrivacyCenter/locales/gu/translation.json +0 -340
  188. package/src/RedactoPrivacyCenter/locales/hi/translation.json +0 -343
  189. package/src/RedactoPrivacyCenter/locales/kn/translation.json +0 -340
  190. package/src/RedactoPrivacyCenter/locales/ks/translation.json +0 -340
  191. package/src/RedactoPrivacyCenter/locales/mai/translation.json +0 -340
  192. package/src/RedactoPrivacyCenter/locales/ml/translation.json +0 -340
  193. package/src/RedactoPrivacyCenter/locales/mni-Mtei/translation.json +0 -340
  194. package/src/RedactoPrivacyCenter/locales/mr/translation.json +0 -340
  195. package/src/RedactoPrivacyCenter/locales/ne/translation.json +0 -340
  196. package/src/RedactoPrivacyCenter/locales/or/translation.json +0 -340
  197. package/src/RedactoPrivacyCenter/locales/pa/translation.json +0 -340
  198. package/src/RedactoPrivacyCenter/locales/sa/translation.json +0 -340
  199. package/src/RedactoPrivacyCenter/locales/sat/translation.json +0 -340
  200. package/src/RedactoPrivacyCenter/locales/sd/translation.json +0 -340
  201. package/src/RedactoPrivacyCenter/locales/ta/translation.json +0 -340
  202. package/src/RedactoPrivacyCenter/locales/te/translation.json +0 -340
  203. package/src/RedactoPrivacyCenter/locales/ur/translation.json +0 -340
  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 -3103
  207. package/src/RedactoPrivacyCenter/styles/pcStyles.ts +0 -814
  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.tsx +0 -69
  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/types/css.d.ts +0 -4
  245. package/src/types/images.d.ts +0 -19
  246. package/src/types/react-jsx.d.ts +0 -26
  247. package/tests/DataAvailabilityContext.test.tsx +0 -123
  248. package/tests/Form.test.tsx +0 -1287
  249. package/tests/ProductSelectionSection.test.tsx +0 -328
  250. package/tests/RequestSubmit.test.tsx +0 -135
  251. package/tests/consentClient.test.ts +0 -171
  252. package/tests/manageConsentServer.test.ts +0 -38
  253. package/tests/mocks.ts +0 -257
  254. package/tests/resolveContactFromJwt.test.ts +0 -44
  255. package/tests/setup.ts +0 -16
  256. package/tsconfig.json +0 -16
  257. package/tsup.config.ts +0 -31
  258. 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 / emailLinkedToMultipleProfiles /
51
- // contactLinkedToMultipleProfiles / signingInEllipsis / couldNotSwitchProfile /
52
- // switchProfile keys in locales/*/translation.json.
@@ -1,119 +0,0 @@
1
- import type {
2
- ConsentDataElement,
3
- ConsentGroup,
4
- DataElement,
5
- FormProductGroup,
6
- Purpose,
7
- PurposeItem,
8
- } from '../lib/types';
9
-
10
- /**
11
- * Map a Go-ledger `ConsentGroup` (from the user-consents endpoint) onto the
12
- * DSAR request form's `FormProductGroup`. Approach A: the request-form product
13
- * picker is now sourced from the ledger instead of Python's `form/data`, since
14
- * consents live in the ledger after the cutover.
15
- *
16
- * The shapes are near-identical; the only adaptations are:
17
- * - purpose id rename: ledger `purpose_uuid` -> form `uuid` (which the picker
18
- * keys on and the submit payload sends back as `purpose_uuid`),
19
- * - the ledger data-element's `selected` stands in for the form's
20
- * `given_consent`,
21
- * - fields the picker never reads (industries, validity, descriptions) are
22
- * defaulted.
23
- *
24
- * NOTE: the ledger caps inline purposes at 50 per group (`has_more_purposes`).
25
- * A product with more than 50 purposes would need the per-group purposes
26
- * endpoint to assemble a complete CORRECTION data-element list (follow-up).
27
- */
28
- export const consentGroupToFormProductGroup = (
29
- group: ConsentGroup,
30
- ): FormProductGroup => ({
31
- product_uuid: group.product_uuid,
32
- product_name: group.product_name,
33
- product_description: group.product_description,
34
- nominator: group.nominator,
35
- purposes: (group.purposes ?? []).map(purposeItemToFormPurpose),
36
- });
37
-
38
- const purposeItemToFormPurpose = (purpose: PurposeItem): Purpose => ({
39
- uuid: purpose.purpose_uuid,
40
- purpose_uuid: purpose.purpose_uuid,
41
- name: purpose.name,
42
- description: purpose.description ?? '',
43
- industries: '',
44
- selected: false,
45
- given_consent: false,
46
- status: purpose.status,
47
- validity: null,
48
- enabled: true,
49
- data_elements: (purpose.data_elements ?? []).map(
50
- consentDataElementToFormDataElement,
51
- ),
52
- });
53
-
54
- const consentDataElementToFormDataElement = (
55
- element: ConsentDataElement,
56
- ): DataElement => ({
57
- uuid: element.uuid,
58
- name: element.name,
59
- description: '',
60
- enabled: element.enabled,
61
- required: element.required,
62
- given_consent: element.selected,
63
- selected: element.selected,
64
- });
65
-
66
- /**
67
- * Build the per-purpose state used by `PurposeSelectionSection` for a single
68
- * product group. Mirrors the legacy `data.purposes`-derived shape so the
69
- * existing checkbox component works unchanged: data-elements default to
70
- * `selected: false` and purposes are filtered to those with at least one
71
- * data element.
72
- *
73
- * Lives in its own module so both `Form.tsx` (which seeds the per-group
74
- * state Map) and `ProductSelectionSection.tsx` (which computes the
75
- * activeCount shown on each product card) can share the same filter —
76
- * otherwise the card header drifts from the list-body it summarises.
77
- */
78
- export const buildGroupPurposes = (group: FormProductGroup): Purpose[] =>
79
- group.purposes
80
- .filter((p): p is Purpose => p !== null && p !== undefined)
81
- .map((p) => {
82
- const validDataElements = Array.isArray(p.data_elements)
83
- ? p.data_elements
84
- .filter((de) => de !== null && de !== undefined && Boolean(de.uuid))
85
- .map((de) => ({ ...de, selected: false }))
86
- : [];
87
- return {
88
- ...p,
89
- selected: false,
90
- data_elements: validDataElements,
91
- };
92
- })
93
- .filter((p) => p.data_elements.length > 0);
94
-
95
- export type GroupCorrectionDataElement = DataElement & { purposeName: string };
96
-
97
- /**
98
- * Build a product-scoped deduped data-element list for grouped CORRECTION.
99
- * Dedup is done by data-element UUID within the product group.
100
- */
101
- export const buildGroupDataElements = (
102
- group: FormProductGroup,
103
- ): GroupCorrectionDataElement[] => {
104
- const byUuid = new Map<string, GroupCorrectionDataElement>();
105
- for (const purpose of group.purposes) {
106
- if (!purpose) {
107
- continue;
108
- }
109
- const dataElements = Array.isArray(purpose.data_elements)
110
- ? purpose.data_elements
111
- : [];
112
- for (const de of dataElements) {
113
- if (de && de.uuid && !byUuid.has(de.uuid)) {
114
- byUuid.set(de.uuid, { ...de, purposeName: purpose.name });
115
- }
116
- }
117
- }
118
- return Array.from(byUuid.values());
119
- };
@@ -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
-
@@ -1,10 +0,0 @@
1
- import { getStatusColor as getSharedStatusColor } from '../utils/status';
2
- import { formatDateShort } from '../utils/date';
3
-
4
- // Re-export shared utilities with case-specific naming
5
- export const getStatusColor = (status: string) => {
6
- return getSharedStatusColor({ status });
7
- };
8
-
9
- // Re-export shared date formatting
10
- export const formatDate = formatDateShort;
@@ -1,9 +0,0 @@
1
- export const routes = {
2
- cmp: {
3
- privacyCenter: {
4
- home: '/privacy-center',
5
- signIn: (slug: string) => `/privacy-center/${slug}/sign-in`,
6
- dashboard: (slug: string) => `/privacy-center/${slug}/home`,
7
- },
8
- },
9
- };