@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,270 +0,0 @@
1
- import character from '../assets/character.svg';
2
- import greenTick from '../assets/greenTick.svg';
3
- import sentImg from '../assets/sentImg.svg';
4
- import { useTranslation } from 'react-i18next';
5
- import { PCButton, PCText } from '../ui';
6
- import { pcStyles } from '../styles/pcStyles';
7
- import type { RequestSubmitProps } from './types';
8
- import { Mail } from 'lucide-react';
9
-
10
- const getVar = (varName: string): string => `var(${varName})`;
11
-
12
- /**
13
- * Success surface shown after a case is submitted. Always renders a
14
- * single Case-ID card — the form's 1-form -> 1-case contract means
15
- * there is no fan-out and no partial-failure surface to maintain.
16
- *
17
- * The product label above the case ID is rendered only when the
18
- * result carries one (product-scoped request types: ACCESS / ERASURE
19
- * / CORRECTION). Nomination and grievance leave the field empty and
20
- * the label is omitted.
21
- */
22
- export default function RequestSubmit({
23
- result,
24
- contact,
25
- onCreateRequest,
26
- revokeConsentOnFulfilment,
27
- revokedPurposeNames,
28
- }: RequestSubmitProps) {
29
- const { t } = useTranslation();
30
-
31
- return (
32
- <div style={{ marginTop: pcStyles.mtMd.marginTop, position: 'relative' }}>
33
- <img
34
- src={sentImg}
35
- alt="sent"
36
- className="pc-hidden-xs"
37
- style={{
38
- position: 'absolute',
39
- right: '0.75rem',
40
- top: '0.75rem',
41
- height: '3rem',
42
- width: '3rem',
43
- opacity: 0.65,
44
- filter: 'brightness(0) saturate(100%) invert(var(--pc-icon-filter, 0))',
45
- }}
46
- />
47
- <div
48
- style={{
49
- ...pcStyles.card,
50
- borderRadius: pcStyles.borderRadiusXl,
51
- padding: pcStyles.pLg.padding,
52
- position: 'relative',
53
- ...pcStyles.bgPrimary,
54
- border: `1px solid ${pcStyles.borderColor}`,
55
- }}
56
- className="pc-padding-responsive"
57
- >
58
- <div
59
- style={{
60
- ...pcStyles.flex,
61
- ...pcStyles.flexCol,
62
- ...pcStyles.itemsStart,
63
- ...pcStyles.gapMd,
64
- }}
65
- className="pc-flex-responsive"
66
- >
67
- <div
68
- style={{
69
- ...pcStyles.flex,
70
- ...pcStyles.itemsStart,
71
- ...pcStyles.gapMd,
72
- width: '100%',
73
- }}
74
- >
75
- <div
76
- style={{
77
- height: '2.5rem',
78
- width: '2.5rem',
79
- flexShrink: 0,
80
- display: 'flex',
81
- alignItems: 'center',
82
- justifyContent: 'center',
83
- borderRadius: '50%',
84
- backgroundColor: `${getVar('--pc-success')}33`,
85
- padding: '0.375rem',
86
- }}
87
- >
88
- <img
89
- src={greenTick}
90
- alt="success"
91
- style={{
92
- height: '1.5rem',
93
- width: '1.5rem',
94
- }}
95
- />
96
- </div>
97
- <div style={{ minWidth: 0, flex: 1 }}>
98
- <PCText
99
- size="base"
100
- weight="semibold"
101
- style={{
102
- marginBottom: pcStyles.mbXs.marginBottom,
103
- }}
104
- className="pc-text-responsive"
105
- >
106
- {t('requestSubmittedSuccessfully')}
107
- </PCText>
108
- <PCText
109
- size="sm"
110
- weight="medium"
111
- color="secondary"
112
- style={{
113
- marginBottom: pcStyles.mbMd.marginBottom,
114
- }}
115
- >
116
- {t('thankYouForSubmittingYourRequest')}.
117
- </PCText>
118
- <div
119
- style={{
120
- marginTop: pcStyles.mtMd.marginTop,
121
- padding: pcStyles.pSm.padding,
122
- ...pcStyles.bgSecondary,
123
- borderRadius: pcStyles.borderRadiusMd,
124
- border: `1px solid ${pcStyles.borderColor}`,
125
- }}
126
- >
127
- {result.product_name !== '' && (
128
- <PCText
129
- size="sm"
130
- weight="medium"
131
- style={{
132
- marginBottom: pcStyles.mbXs.marginBottom,
133
- wordBreak: 'break-word',
134
- }}
135
- >
136
- {result.product_name}
137
- </PCText>
138
- )}
139
- <PCText
140
- size="base"
141
- weight="bold"
142
- style={{
143
- color: pcStyles.primary,
144
- wordBreak: 'break-word',
145
- marginBottom: pcStyles.mbXs.marginBottom,
146
- }}
147
- className="pc-text-responsive"
148
- >
149
- {t('caseID')}: {result.case_id}
150
- </PCText>
151
- <PCText size="xs" weight="medium" color="secondary">
152
- {t('saveThisID')}.
153
- </PCText>
154
- </div>
155
- <div
156
- style={{
157
- ...pcStyles.flex,
158
- ...pcStyles.itemsStart,
159
- ...pcStyles.gapSm,
160
- marginTop: pcStyles.mtMd.marginTop,
161
- padding: '0.5rem 0.625rem',
162
- ...pcStyles.bgSecondary,
163
- borderRadius: pcStyles.borderRadiusMd,
164
- }}
165
- >
166
- <Mail
167
- size={16}
168
- style={{
169
- flexShrink: 0,
170
- color: getVar('--pc-text-secondary'),
171
- marginTop: '2px',
172
- }}
173
- />
174
- <PCText
175
- size="xs"
176
- weight="medium"
177
- color="secondary"
178
- style={{
179
- wordBreak: 'break-word',
180
- }}
181
- >
182
- {t('confirmationSentTo')}: {contact}
183
- </PCText>
184
- </div>
185
- <PCText
186
- size="xs"
187
- weight="medium"
188
- color="secondary"
189
- style={{
190
- marginTop: pcStyles.mtMd.marginTop,
191
- }}
192
- >
193
- {t('processRequest')}.
194
- </PCText>
195
- {revokeConsentOnFulfilment && (
196
- <div className="pc-request-submit-revoke-notice">
197
- <PCText
198
- size="xs"
199
- weight="medium"
200
- className="pc-request-submit-revoke-notice-text"
201
- >
202
- {t('erasureConsentRevokeNotice', {
203
- purposes: revokedPurposeNames,
204
- })}
205
- </PCText>
206
- </div>
207
- )}
208
- </div>
209
- </div>
210
- <div className="pc-hidden-xs pc-block-md" style={{ width: '100%' }}>
211
- <img
212
- src={character}
213
- alt="character"
214
- style={{
215
- margin: '0 auto',
216
- height: '6rem',
217
- width: '6rem',
218
- display: 'block',
219
- filter: 'brightness(0) saturate(100%) invert(var(--pc-icon-filter, 0))',
220
- opacity: 0.9,
221
- }}
222
- />
223
- <div
224
- style={{
225
- marginTop: pcStyles.mtMd.marginTop,
226
- ...pcStyles.flex,
227
- ...pcStyles.justifyCenter,
228
- }}
229
- >
230
- <PCButton
231
- variant="primary"
232
- size="sm"
233
- onClick={onCreateRequest}
234
- className="pc-w-full-mobile"
235
- >
236
- {t('backToHome')}
237
- </PCButton>
238
- </div>
239
- </div>
240
- </div>
241
- <div
242
- className="pc-block-xs pc-hidden-md"
243
- style={{ marginTop: pcStyles.mtMd.marginTop }}
244
- >
245
- <div style={{ ...pcStyles.flex, ...pcStyles.justifyCenter }}>
246
- <PCButton
247
- variant="primary"
248
- size="sm"
249
- onClick={onCreateRequest}
250
- style={{ width: '100%' }}
251
- >
252
- {t('backToHome')}
253
- </PCButton>
254
- </div>
255
- </div>
256
- </div>
257
- <PCText
258
- size="xs"
259
- weight="medium"
260
- color="tertiary"
261
- style={{
262
- marginTop: pcStyles.mtLg.marginTop,
263
- textAlign: 'center',
264
- }}
265
- >
266
- {t('yourDataIsSafeWithUs')}.
267
- </PCText>
268
- </div>
269
- );
270
- }
@@ -1,95 +0,0 @@
1
- import { ChevronRight } from 'lucide-react';
2
- import { useTranslation } from 'react-i18next';
3
- import { PCText, PCTitle } from '../ui';
4
- import type { SelectUserProps } from '../lib/types';
5
-
6
- /**
7
- * "Choose your profile" picker, shown when the signed-in contact maps to more
8
- * than one data principal (shared contact). Selecting one re-scopes the session
9
- * to that principal uuid. Purely presentational — SelectUserGate owns the fetch
10
- * and the re-scope. Structural styles live in styles/injectStyles.ts
11
- * (.pc-select-user*).
12
- */
13
- export const SelectUser = ({
14
- candidates,
15
- onSelect,
16
- busyOrgUserId,
17
- error,
18
- }: SelectUserProps) => {
19
- const { t } = useTranslation();
20
-
21
- // A candidate with no uuid can't be selected (it's the value we submit),
22
- // so drop it rather than render an unclickable row.
23
- const selectable = candidates.filter((candidate) => candidate.uuid);
24
-
25
- return (
26
- <div className="pc-select-user">
27
- <div className="pc-select-user__header">
28
- <PCTitle as="h2">{t('chooseYourProfile')}</PCTitle>
29
- <PCText as="p" size="base" color="secondary" align="center">
30
- {t('loginIdentifierLinkedToMultipleProfiles')}
31
- </PCText>
32
- </div>
33
-
34
- <div className="pc-select-user__list">
35
- {selectable.map((candidate) => {
36
- const principalUuid = candidate.uuid || '';
37
- const email = candidate.primary_email || '';
38
- const mobile = candidate.primary_mobile || '';
39
- const orgUserId = candidate.org_user_id || '';
40
- // org_user_id is unique per principal (ledger-enforced within the
41
- // org/workspace), so it leads the row as the reliable way to tell
42
- // shared-contact profiles apart when the email/mobile are identical.
43
- // Fall back to a contact when a principal has no org_user_id, so the
44
- // row still shows something identifiable.
45
- const primaryLabel = orgUserId
46
- ? t('userIdLabel', { id: orgUserId })
47
- : email || mobile || candidate.uuid;
48
- // Email and mobile drop below the id. Skip any value that already
49
- // surfaced as the primary label (the fallback case) or duplicates the
50
- // other contact, so we never echo the same value twice.
51
- const secondaryLabels = [email, mobile].filter(
52
- (value, index, all) =>
53
- value !== '' &&
54
- value !== primaryLabel &&
55
- all.indexOf(value) === index
56
- );
57
- const isBusy = busyOrgUserId === principalUuid;
58
- return (
59
- <button
60
- key={candidate.uuid}
61
- type="button"
62
- className="pc-select-user__item"
63
- onClick={() => onSelect(principalUuid)}
64
- disabled={!principalUuid || busyOrgUserId !== null}
65
- >
66
- <span className="pc-select-user__item-text">
67
- <span className="pc-select-user__item-primary">
68
- {primaryLabel}
69
- </span>
70
- {secondaryLabels.map((label) => (
71
- <span key={label} className="pc-select-user__item-secondary">
72
- {label}
73
- </span>
74
- ))}
75
- </span>
76
- {isBusy ? (
77
- <span className="pc-select-user__item-status">
78
- {t('signingInEllipsis')}
79
- </span>
80
- ) : (
81
- <ChevronRight size={18} className="pc-select-user__item-chevron" />
82
- )}
83
- </button>
84
- );
85
- })}
86
- </div>
87
-
88
- {error ? (
89
- <p className="pc-select-user__error" role="alert">
90
- {error}
91
- </p>
92
- ) : null}
93
- </div>
94
- );
95
- };
@@ -1,187 +0,0 @@
1
- import {
2
- useCallback,
3
- useEffect,
4
- useMemo,
5
- useState,
6
- type ReactNode,
7
- } from 'react';
8
- import { useTranslation } from 'react-i18next';
9
- import { useOrganization } from '../context/OrganizationContext';
10
- import { useBaseUrl } from '../context/BaseUrlContext';
11
- import { useAuth } from '../context/AuthContext';
12
- import { ProfileSwitchProvider } from '../context/ProfileSwitchContext';
13
- import { PCLoader } from '../ui';
14
- import { decodeJwtToken } from '../lib/utils';
15
- import type {
16
- GatePhase,
17
- IdentityCandidate,
18
- SelectUserGateProps,
19
- } from '../lib/types';
20
- import { PICKED_ORG_USER_KEY } from './constant';
21
- import { SelectUser } from './SelectUser';
22
-
23
- /**
24
- * Shared-contact profile gate. On mount it asks the backend which principals
25
- * share the signed-in contact; when more than one exists (and the session isn't
26
- * already pinned to a chosen one), it renders the "choose your profile" picker
27
- * instead of the consent view. Picking re-scopes the session via updateTokens,
28
- * then renders children. It sits OUTSIDE DataAvailabilityProvider so no consent
29
- * fetch runs against an unscoped token, and degrades to children on any error.
30
- *
31
- * Once resolved it also exposes `switchProfile` via ProfileSwitchContext, so a
32
- * signed-in shared contact can re-open the picker and move to another profile.
33
- */
34
- export const SelectUserGate = ({ children }: SelectUserGateProps) => {
35
- const { t } = useTranslation();
36
- const { organization } = useOrganization();
37
- const organizationId = organization?.uuid || '';
38
- const workspaceId = organization?.workspaces?.[0]?.uuid || '';
39
- const { consentClient } = useBaseUrl();
40
- const { accessToken, updateTokens } = useAuth();
41
-
42
- const [phase, setPhase] = useState<GatePhase>('checking');
43
- const [candidates, setCandidates] = useState<IdentityCandidate[]>([]);
44
- const [busyOrgUserId, setBusyOrgUserId] = useState<string | null>(null);
45
- const [selectError, setSelectError] = useState<string | null>(null);
46
-
47
- // The token's principal. Routine refreshes (checkAndRefreshAuth,
48
- // refreshOtpToken) hand back a fresh token string for the SAME principal;
49
- // keying the gate check off this decoded id rather than the raw token keeps
50
- // those refreshes from re-running the check and flashing the picker/spinner.
51
- const tokenOrgUserId =
52
- (decodeJwtToken(accessToken)?.user_data?.org_user_id as string) || '';
53
-
54
- useEffect(() => {
55
- let cancelled = false;
56
-
57
- if (!organizationId || !workspaceId || !accessToken) {
58
- setPhase('resolved');
59
- return;
60
- }
61
-
62
- // Already pinned to a chosen principal this session? Pass straight through
63
- // to children — but STILL resolve the sibling list in the background so the
64
- // user menu can offer "switch profile". The default/unscoped token has
65
- // org_user_id = the contact and no stored pick, so the picker still shows.
66
- const picked =
67
- typeof window !== 'undefined'
68
- ? sessionStorage.getItem(PICKED_ORG_USER_KEY)
69
- : null;
70
- const isPinned = Boolean(picked) && picked === tokenOrgUserId;
71
-
72
- // Only block on the spinner when the picker might actually open; a pinned
73
- // session renders children immediately and resolves siblings quietly.
74
- setPhase(isPinned ? 'resolved' : 'checking');
75
- (async () => {
76
- try {
77
- const res = await consentClient.listIdentities({
78
- organisationUuid: organizationId,
79
- workspaceUuid: workspaceId,
80
- authToken: accessToken,
81
- });
82
- if (cancelled) {
83
- return;
84
- }
85
- const list = res?.identities ?? [];
86
- setCandidates(list);
87
- if (list.length > 1 && !isPinned) {
88
- setPhase('picking');
89
- } else {
90
- setPhase('resolved');
91
- }
92
- } catch {
93
- // Ledger/endpoint unavailable — never block the Privacy Center.
94
- if (!cancelled) {
95
- setCandidates([]);
96
- setPhase('resolved');
97
- }
98
- }
99
- })();
100
-
101
- return () => {
102
- cancelled = true;
103
- };
104
- // consentClient is a stable factory result; re-running on its identity would
105
- // risk a loop. Re-evaluate only when the tenant or the token's principal
106
- // changes — not on every raw-token refresh. accessToken is read inside for
107
- // the fetch but intentionally omitted so same-principal refreshes are no-ops.
108
- // eslint-disable-next-line react-hooks/exhaustive-deps
109
- }, [organizationId, workspaceId, tokenOrgUserId]);
110
-
111
- const handleSelect = async (principalUuid: string) => {
112
- if (!principalUuid || busyOrgUserId) {
113
- return;
114
- }
115
- setBusyOrgUserId(principalUuid);
116
- setSelectError(null);
117
- try {
118
- const res = await consentClient.selectPrincipal(
119
- {
120
- organisationUuid: organizationId,
121
- workspaceUuid: workspaceId,
122
- authToken: accessToken,
123
- },
124
- principalUuid,
125
- );
126
- if (!res?.token || !res?.refresh_token) {
127
- throw new Error('select-principal returned no tokens');
128
- }
129
- // The picker selects by opaque uuid, but the "already pinned" check
130
- // compares against the token's own org_user_id. Derive the pin from the
131
- // NEW token so it matches on later reloads — it's the signed-in
132
- // principal's own id, not a co-principal's, so nothing leaks.
133
- if (typeof window !== 'undefined') {
134
- const pinnedOrgUserId = decodeJwtToken(res.token)?.user_data
135
- ?.org_user_id as string | undefined;
136
- if (pinnedOrgUserId) {
137
- sessionStorage.setItem(PICKED_ORG_USER_KEY, pinnedOrgUserId);
138
- }
139
- }
140
- // Resolve before swapping the token so the picker doesn't flash back.
141
- setPhase('resolved');
142
- updateTokens(res.token, res.refresh_token);
143
- } catch {
144
- setBusyOrgUserId(null);
145
- setSelectError(t('couldNotSwitchProfile'));
146
- }
147
- };
148
-
149
- // Re-open the picker so a shared contact can move to another of its profiles.
150
- // Drops the session pin and shows the picker with the already-loaded
151
- // candidates; picking re-scopes the token exactly like the first choice.
152
- const switchProfile = useCallback(() => {
153
- if (typeof window !== 'undefined') {
154
- sessionStorage.removeItem(PICKED_ORG_USER_KEY);
155
- }
156
- setSelectError(null);
157
- setBusyOrgUserId(null);
158
- setPhase('picking');
159
- }, []);
160
-
161
- const switchValue = useMemo(
162
- () => ({ canSwitch: candidates.length > 1, switchProfile }),
163
- [candidates.length, switchProfile],
164
- );
165
-
166
- let inner: ReactNode;
167
- if (phase === 'checking') {
168
- inner = (
169
- <div className="pc-select-user-loading">
170
- <PCLoader variant="spinner" color="info" size="lg" />
171
- </div>
172
- );
173
- } else if (phase === 'picking') {
174
- inner = (
175
- <SelectUser
176
- candidates={candidates}
177
- onSelect={handleSelect}
178
- busyOrgUserId={busyOrgUserId}
179
- error={selectError}
180
- />
181
- );
182
- } else {
183
- inner = <>{children}</>;
184
- }
185
-
186
- return <ProfileSwitchProvider value={switchValue}>{inner}</ProfileSwitchProvider>;
187
- };
@@ -1,25 +0,0 @@
1
- import { Activity, MessageCircleWarning, ReceiptText, ShieldCheck } from 'lucide-react';
2
- import type { MenuItem } from './types';
3
-
4
- export const menuItemsPC: MenuItem[] = [
5
- {
6
- name: 'Consent Manager',
7
- href: 'consent-manager',
8
- icon: <ShieldCheck size={18} strokeWidth={1.75} />,
9
- },
10
- {
11
- name: 'Grievance',
12
- href: 'form',
13
- icon: <MessageCircleWarning size={18} strokeWidth={1.75} />,
14
- },
15
- {
16
- name: 'Activity',
17
- href: 'activity',
18
- icon: <Activity size={18} strokeWidth={1.75} />,
19
- },
20
- {
21
- name: 'My Receipt',
22
- href: 'receipts',
23
- icon: <ReceiptText size={18} strokeWidth={1.75} />,
24
- },
25
- ];
@@ -1,21 +0,0 @@
1
- import type { ReactElement } from 'react';
2
-
3
- export type DropdownItem = {
4
- name: string;
5
- href: string;
6
- badge?: string;
7
- isNew?: boolean;
8
- isComingSoon?: boolean;
9
- icon?: ReactElement;
10
- };
11
-
12
- export type MenuItem = {
13
- name: string;
14
- href?: string;
15
- icon?: ReactElement;
16
- isBatch?: boolean;
17
- isNew?: boolean;
18
- isComingSoon?: boolean;
19
- badge?: string;
20
- dropdownItems?: DropdownItem[];
21
- };