@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,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,195 +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 { isSandboxMode } from '../lib/sandbox';
16
- import type {
17
- GatePhase,
18
- IdentityCandidate,
19
- SelectUserGateProps,
20
- } from '../lib/types';
21
- import { PICKED_ORG_USER_KEY } from './constant';
22
- import { SelectUser } from './SelectUser';
23
-
24
- /**
25
- * Shared-contact profile gate. On mount it asks the backend which principals
26
- * share the signed-in contact; when more than one exists (and the session isn't
27
- * already pinned to a chosen one), it renders the "choose your profile" picker
28
- * instead of the consent view. Picking re-scopes the session via updateTokens,
29
- * then renders children. It sits OUTSIDE DataAvailabilityProvider so no consent
30
- * fetch runs against an unscoped token, and degrades to children on any error.
31
- *
32
- * Once resolved it also exposes `switchProfile` via ProfileSwitchContext, so a
33
- * signed-in shared contact can re-open the picker and move to another profile.
34
- */
35
- export const SelectUserGate = ({ children }: SelectUserGateProps) => {
36
- const { t } = useTranslation();
37
- const { organization } = useOrganization();
38
- const organizationId = organization?.uuid || '';
39
- const workspaceId = organization?.workspaces?.[0]?.uuid || '';
40
- const { consentClient } = useBaseUrl();
41
- const { accessToken, updateTokens } = useAuth();
42
-
43
- const [phase, setPhase] = useState<GatePhase>('checking');
44
- const [candidates, setCandidates] = useState<IdentityCandidate[]>([]);
45
- const [busyOrgUserId, setBusyOrgUserId] = useState<string | null>(null);
46
- const [selectError, setSelectError] = useState<string | null>(null);
47
-
48
- // The token's principal. Routine refreshes (checkAndRefreshAuth,
49
- // refreshOtpToken) hand back a fresh token string for the SAME principal;
50
- // keying the gate check off this decoded id rather than the raw token keeps
51
- // those refreshes from re-running the check and flashing the picker/spinner.
52
- const tokenOrgUserId =
53
- (decodeJwtToken(accessToken)?.user_data?.org_user_id as string) || '';
54
-
55
- useEffect(() => {
56
- let cancelled = false;
57
-
58
- // Sandbox PoC: there is no JWT and no shared-contact concept — the subject is
59
- // fixed by props. Skip the identity lookup and render children directly.
60
- if (isSandboxMode()) {
61
- setPhase('resolved');
62
- return;
63
- }
64
-
65
- if (!organizationId || !workspaceId || !accessToken) {
66
- setPhase('resolved');
67
- return;
68
- }
69
-
70
- // Already pinned to a chosen principal this session? Pass straight through
71
- // to children — but STILL resolve the sibling list in the background so the
72
- // user menu can offer "switch profile". The default/unscoped token has
73
- // org_user_id = the contact and no stored pick, so the picker still shows.
74
- const picked =
75
- typeof window !== 'undefined'
76
- ? sessionStorage.getItem(PICKED_ORG_USER_KEY)
77
- : null;
78
- const isPinned = Boolean(picked) && picked === tokenOrgUserId;
79
-
80
- // Only block on the spinner when the picker might actually open; a pinned
81
- // session renders children immediately and resolves siblings quietly.
82
- setPhase(isPinned ? 'resolved' : 'checking');
83
- (async () => {
84
- try {
85
- const res = await consentClient.listIdentities({
86
- organisationUuid: organizationId,
87
- workspaceUuid: workspaceId,
88
- authToken: accessToken,
89
- });
90
- if (cancelled) {
91
- return;
92
- }
93
- const list = res?.identities ?? [];
94
- setCandidates(list);
95
- if (list.length > 1 && !isPinned) {
96
- setPhase('picking');
97
- } else {
98
- setPhase('resolved');
99
- }
100
- } catch {
101
- // Ledger/endpoint unavailable — never block the Privacy Center.
102
- if (!cancelled) {
103
- setCandidates([]);
104
- setPhase('resolved');
105
- }
106
- }
107
- })();
108
-
109
- return () => {
110
- cancelled = true;
111
- };
112
- // consentClient is a stable factory result; re-running on its identity would
113
- // risk a loop. Re-evaluate only when the tenant or the token's principal
114
- // changes — not on every raw-token refresh. accessToken is read inside for
115
- // the fetch but intentionally omitted so same-principal refreshes are no-ops.
116
- // eslint-disable-next-line react-hooks/exhaustive-deps
117
- }, [organizationId, workspaceId, tokenOrgUserId]);
118
-
119
- const handleSelect = async (principalUuid: string) => {
120
- if (!principalUuid || busyOrgUserId) {
121
- return;
122
- }
123
- setBusyOrgUserId(principalUuid);
124
- setSelectError(null);
125
- try {
126
- const res = await consentClient.selectPrincipal(
127
- {
128
- organisationUuid: organizationId,
129
- workspaceUuid: workspaceId,
130
- authToken: accessToken,
131
- },
132
- principalUuid,
133
- );
134
- if (!res?.token || !res?.refresh_token) {
135
- throw new Error('select-principal returned no tokens');
136
- }
137
- // The picker selects by opaque uuid, but the "already pinned" check
138
- // compares against the token's own org_user_id. Derive the pin from the
139
- // NEW token so it matches on later reloads — it's the signed-in
140
- // principal's own id, not a co-principal's, so nothing leaks.
141
- if (typeof window !== 'undefined') {
142
- const pinnedOrgUserId = decodeJwtToken(res.token)?.user_data
143
- ?.org_user_id as string | undefined;
144
- if (pinnedOrgUserId) {
145
- sessionStorage.setItem(PICKED_ORG_USER_KEY, pinnedOrgUserId);
146
- }
147
- }
148
- // Resolve before swapping the token so the picker doesn't flash back.
149
- setPhase('resolved');
150
- updateTokens(res.token, res.refresh_token);
151
- } catch {
152
- setBusyOrgUserId(null);
153
- setSelectError(t('couldNotSwitchProfile'));
154
- }
155
- };
156
-
157
- // Re-open the picker so a shared contact can move to another of its profiles.
158
- // Drops the session pin and shows the picker with the already-loaded
159
- // candidates; picking re-scopes the token exactly like the first choice.
160
- const switchProfile = useCallback(() => {
161
- if (typeof window !== 'undefined') {
162
- sessionStorage.removeItem(PICKED_ORG_USER_KEY);
163
- }
164
- setSelectError(null);
165
- setBusyOrgUserId(null);
166
- setPhase('picking');
167
- }, []);
168
-
169
- const switchValue = useMemo(
170
- () => ({ canSwitch: candidates.length > 1, switchProfile }),
171
- [candidates.length, switchProfile],
172
- );
173
-
174
- let inner: ReactNode;
175
- if (phase === 'checking') {
176
- inner = (
177
- <div className="pc-select-user-loading">
178
- <PCLoader variant="spinner" color="info" size="lg" />
179
- </div>
180
- );
181
- } else if (phase === 'picking') {
182
- inner = (
183
- <SelectUser
184
- candidates={candidates}
185
- onSelect={handleSelect}
186
- busyOrgUserId={busyOrgUserId}
187
- error={selectError}
188
- />
189
- );
190
- } else {
191
- inner = <>{children}</>;
192
- }
193
-
194
- return <ProfileSwitchProvider value={switchValue}>{inner}</ProfileSwitchProvider>;
195
- };
@@ -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
- };