@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,121 +0,0 @@
1
- import { type ReactNode, type CSSProperties, useState, useRef, useEffect } from 'react';
2
- import { createPortal } from 'react-dom';
3
- import { pcStyles } from '../styles/pcStyles';
4
-
5
- export interface PCTooltipProps {
6
- content: ReactNode;
7
- children: ReactNode;
8
- placement?: 'top' | 'bottom' | 'left' | 'right';
9
- className?: string;
10
- style?: CSSProperties;
11
- color?: 'default' | 'invert';
12
- triggerStyle?: CSSProperties;
13
- }
14
-
15
- export function PCTooltip({
16
- content,
17
- children,
18
- placement = 'top',
19
- className = '',
20
- style = {},
21
- color = 'default',
22
- triggerStyle,
23
- }: PCTooltipProps) {
24
- const [isVisible, setIsVisible] = useState(false);
25
- const [position, setPosition] = useState({ top: 0, left: 0 });
26
- const triggerRef = useRef<HTMLDivElement>(null);
27
- const tooltipRef = useRef<HTMLDivElement>(null);
28
-
29
- const updatePosition = () => {
30
- if (!triggerRef.current || !tooltipRef.current) return;
31
-
32
- const triggerRect = triggerRef.current.getBoundingClientRect();
33
- const tooltipRect = tooltipRef.current.getBoundingClientRect();
34
- const gap = 2;
35
- const viewportGutter = 12;
36
-
37
- let top = 0;
38
- let left = 0;
39
-
40
- switch (placement) {
41
- case 'top':
42
- top = triggerRect.top - tooltipRect.height - gap;
43
- left = triggerRect.left + (triggerRect.width - tooltipRect.width) / 2;
44
- break;
45
- case 'bottom':
46
- top = triggerRect.bottom + gap;
47
- left = triggerRect.left + (triggerRect.width - tooltipRect.width) / 2;
48
- break;
49
- case 'left':
50
- top = triggerRect.top + (triggerRect.height - tooltipRect.height) / 2;
51
- left = triggerRect.left - tooltipRect.width - gap;
52
- break;
53
- case 'right':
54
- top = triggerRect.top + (triggerRect.height - tooltipRect.height) / 2;
55
- left = triggerRect.right + gap;
56
- break;
57
- }
58
-
59
- const maxLeft = window.innerWidth - tooltipRect.width - viewportGutter;
60
- const maxTop = window.innerHeight - tooltipRect.height - viewportGutter;
61
-
62
- left = Math.min(Math.max(left, viewportGutter), Math.max(viewportGutter, maxLeft));
63
- top = Math.min(Math.max(top, viewportGutter), Math.max(viewportGutter, maxTop));
64
-
65
- setPosition({ top, left });
66
- };
67
-
68
- useEffect(() => {
69
- if (isVisible) {
70
- updatePosition();
71
- window.addEventListener('scroll', updatePosition, true);
72
- window.addEventListener('resize', updatePosition);
73
- return () => {
74
- window.removeEventListener('scroll', updatePosition, true);
75
- window.removeEventListener('resize', updatePosition);
76
- };
77
- }
78
- }, [isVisible, placement]);
79
-
80
- const tooltipStyle: CSSProperties = {
81
- ...pcStyles.tooltip,
82
- ...(color === 'invert' && {
83
- backgroundColor: '#ffffff',
84
- color: '#1f2937',
85
- border: '1px solid #e5e7eb',
86
- boxShadow: '0 8px 18px rgba(15, 23, 42, 0.10)',
87
- }),
88
- position: 'fixed',
89
- top: `${position.top}px`,
90
- left: `${position.left}px`,
91
- display: isVisible ? 'block' : 'none',
92
- padding: '0.375rem 0.625rem',
93
- fontSize: '0.8125rem',
94
- lineHeight: 1.2,
95
- borderRadius: '0.75rem',
96
- ...style,
97
- };
98
-
99
- return (
100
- <>
101
- <div
102
- ref={triggerRef}
103
- onMouseEnter={() => setIsVisible(true)}
104
- onMouseLeave={() => setIsVisible(false)}
105
- style={{ display: 'inline-block', width: '100%', ...triggerStyle }}
106
- >
107
- {children}
108
- </div>
109
- {isVisible && typeof document !== 'undefined' && createPortal(
110
- <div
111
- ref={tooltipRef}
112
- className={`pc-tooltip ${className}`}
113
- style={tooltipStyle}
114
- >
115
- {content}
116
- </div>,
117
- document.body
118
- )}
119
- </>
120
- );
121
- }
@@ -1,25 +0,0 @@
1
- import { pcStyles } from '../styles/pcStyles';
2
-
3
- type SimpleBarProps = {
4
- children: React.ReactNode;
5
- className?: string;
6
- style?: React.CSSProperties;
7
- };
8
-
9
- export default function SimpleBar({
10
- children,
11
- className,
12
- style,
13
- }: SimpleBarProps) {
14
- return (
15
- <div
16
- className={`pc-scrollbar ${className || ''}`}
17
- style={{
18
- ...pcStyles.overflowYAuto,
19
- ...style,
20
- }}
21
- >
22
- {children}
23
- </div>
24
- );
25
- }
@@ -1,53 +0,0 @@
1
- import { PCBadge } from './index';
2
-
3
- type StatusBadgeProps = {
4
- status?: 'success' | 'warning' | 'error' | 'info' | 'pending' | string;
5
- children?: React.ReactNode;
6
- className?: string;
7
- };
8
-
9
- const predefinedStatusMap: Record<string, 'success' | 'warning' | 'error' | 'info' | 'pending'> = {
10
- success: 'success',
11
- warning: 'warning',
12
- error: 'error',
13
- info: 'info',
14
- pending: 'pending',
15
- active: 'success',
16
- completed: 'success',
17
- processing: 'warning',
18
- in_progress: 'warning',
19
- rejected: 'error',
20
- declined: 'error',
21
- expired: 'warning',
22
- suspended: 'error',
23
- revoked: 'error',
24
- withdrawn: 'error',
25
- };
26
-
27
- export default function StatusBadge({
28
- status = 'info',
29
- children,
30
- className,
31
- }: StatusBadgeProps) {
32
- // Check if it's a predefined status
33
- const normalizedStatus = status.toLowerCase();
34
- const mappedStatus = predefinedStatusMap[normalizedStatus] || status;
35
-
36
- let badgeVariant: 'success' | 'error' | 'warning' | 'info' | 'secondary' = 'secondary';
37
-
38
- if (mappedStatus === 'success') {
39
- badgeVariant = 'success';
40
- } else if (mappedStatus === 'error') {
41
- badgeVariant = 'error';
42
- } else if (mappedStatus === 'warning') {
43
- badgeVariant = 'warning';
44
- } else if (mappedStatus === 'info') {
45
- badgeVariant = 'info';
46
- }
47
-
48
- return (
49
- <PCBadge variant={badgeVariant} className={className}>
50
- {children || status}
51
- </PCBadge>
52
- );
53
- }
@@ -1,18 +0,0 @@
1
- export { PCText, type PCTextProps } from './PCText';
2
- export { PCTitle, type PCTitleProps } from './PCTitle';
3
- export { PCButton, type PCButtonProps } from './PCButton';
4
- export { PCActionIcon, type PCActionIconProps } from './PCActionIcon';
5
- export { PCInput, type PCInputProps } from './PCInput';
6
- export { PCTextarea, type PCTextareaProps } from './PCTextarea';
7
- export { PCCheckbox, type PCCheckboxProps } from './PCCheckbox';
8
- export { PCSelect, type PCSelectProps, type SelectOption } from './PCSelect';
9
- export { PCModal, type PCModalProps } from './PCModal';
10
- export { PCTable, PCTableHeader, PCTableBody, PCTableRow, PCTableHead, PCTableCell, type PCTableProps, type PCTableHeaderProps, type PCTableBodyProps, type PCTableRowProps, type PCTableHeadProps, type PCTableCellProps } from './PCTable';
11
- export { PCLoader, type PCLoaderProps } from './PCLoader';
12
- export { PCBadge, type PCBadgeProps } from './PCBadge';
13
- export { PCTooltip, type PCTooltipProps } from './PCTooltip';
14
- export { PCPopover, type PCPopoverProps } from './PCPopover';
15
- export { PCAccordion, PCAccordionHeader, PCAccordionBody, type PCAccordionProps, type PCAccordionHeaderProps, type PCAccordionBodyProps } from './PCAccordion';
16
- export { PCCollapse, PCCollapseHeader, PCCollapseBody, type PCCollapseProps, type PCCollapseHeaderProps, type PCCollapseBodyProps } from './PCCollapse';
17
- export { PCAvatar, type PCAvatarProps } from './PCAvatar';
18
- export { PCEmpty, type PCEmptyProps } from './PCEmpty';
@@ -1,28 +0,0 @@
1
- // Simple className utility - replaces clsx and tailwind-merge
2
- // Accepts strings, objects, arrays, and undefined/null values
3
- type ClassValue = string | number | boolean | undefined | null | Record<string, boolean> | ClassValue[];
4
-
5
- export function cn(...inputs: ClassValue[]): string {
6
- const classes: string[] = [];
7
-
8
- for (const input of inputs) {
9
- if (!input) continue;
10
-
11
- if (typeof input === 'string') {
12
- classes.push(input);
13
- } else if (typeof input === 'number') {
14
- classes.push(String(input));
15
- } else if (Array.isArray(input)) {
16
- const inner = cn(...input);
17
- if (inner) classes.push(inner);
18
- } else if (typeof input === 'object') {
19
- for (const key in input) {
20
- if (input[key]) {
21
- classes.push(key);
22
- }
23
- }
24
- }
25
- }
26
-
27
- return classes.filter(Boolean).join(' ');
28
- }
@@ -1,48 +0,0 @@
1
- /**
2
- * Unified date formatting utilities for privacy center app
3
- */
4
-
5
- export type FormatDateParams = {
6
- date: string | Date;
7
- };
8
-
9
- /**
10
- * Format date for display in consent records (with time)
11
- * Format: "January 15, 2025 at 2:30 PM"
12
- */
13
- export const formatDate = ({ date }: FormatDateParams): string => {
14
- return new Date(date).toLocaleDateString('en-US', {
15
- year: 'numeric',
16
- month: 'long',
17
- day: 'numeric',
18
- hour: '2-digit',
19
- minute: '2-digit',
20
- });
21
- };
22
-
23
- /**
24
- * Format date for display in case history (short format)
25
- * Format: "15 Jan 2025"
26
- */
27
- export const formatDateShort = (dateString: string): string => {
28
- if (!dateString) return '-';
29
- return new Date(dateString).toLocaleDateString('en-GB', {
30
- day: 'numeric',
31
- month: 'short',
32
- year: 'numeric'
33
- });
34
- };
35
-
36
- /**
37
- * Format date time for consent manager (with day/month/year)
38
- * Format: "15 Jan 2025"
39
- */
40
- export const formatDateTime = (timestamp: string): string => {
41
- const date = new Date(timestamp);
42
- const options: Intl.DateTimeFormatOptions = {
43
- day: '2-digit',
44
- month: 'short',
45
- year: 'numeric',
46
- };
47
- return date.toLocaleString('en-US', options);
48
- };
@@ -1,111 +0,0 @@
1
- /**
2
- * Unified status color utilities for privacy center app
3
- * Handles both consent statuses and case/request statuses
4
- */
5
-
6
- export const STATUS_COLORS = {
7
- // Consent/Purpose statuses (uppercase)
8
- ACTIVE: 'bg-green-100 text-green-800 border border-green-200',
9
- INACTIVE: 'bg-gray-100 text-gray-800 border border-gray-200',
10
- EXPIRED: 'bg-orange-50 text-orange-700 border border-orange-200',
11
- PENDING: 'bg-yellow-50 text-yellow-800 border border-yellow-200',
12
- SUSPENDED: 'bg-red-50 text-red-700 border border-red-200',
13
- WITHDRAWN: 'bg-red-50 text-red-700 border border-red-200',
14
- DECLINED: 'bg-red-50 text-red-700 border border-red-200',
15
- REVOKED: 'bg-red-50 text-red-700 border border-red-200',
16
-
17
- // User statuses (capitalized)
18
- Active: 'bg-green-100 text-green-800 border border-green-200',
19
- Revoked: 'bg-red-50 text-red-700 border border-red-200',
20
- Expired: 'bg-orange-50 text-orange-700 border border-orange-200',
21
-
22
- // Data element statuses (lowercase)
23
- enabled: 'bg-green-100 text-green-800 border border-green-200',
24
- disabled: 'bg-gray-100 text-gray-800 border border-gray-200',
25
- required: 'bg-blue-100 text-blue-800 border border-blue-200',
26
-
27
- // Case/Request statuses (lowercase)
28
- completed: 'bg-[#00B41D1A] text-[#00B41D]',
29
- processing: 'bg-[#FF9A001A] text-[#FF9A00]',
30
- 'in_progress': 'bg-[#FF9A001A] text-[#FF9A00]',
31
- initiated: 'bg-[#4F87FF1A] text-[#4F87FF]',
32
- rejected: 'bg-[#FF47471A] text-[#FF4747]',
33
- declined: 'bg-[#FF47471A] text-[#FF4747]',
34
-
35
- default: 'bg-gray-100 text-gray-800 border border-gray-200',
36
- } as const;
37
-
38
- export type StatusColorParams = {
39
- status: string | boolean;
40
- };
41
-
42
- export type FormatDateParams = {
43
- date: string | Date;
44
- };
45
-
46
- /**
47
- * Get status color class string for a given status
48
- * Handles various status formats (uppercase, lowercase, capitalized, boolean)
49
- */
50
- export const getStatusColor = ({ status }: StatusColorParams): string => {
51
- // Handle boolean values for enabled/disabled
52
- if (typeof status === 'boolean') {
53
- return status ? STATUS_COLORS.enabled : STATUS_COLORS.disabled;
54
- }
55
-
56
- const statusStr = String(status);
57
- const normalizedStatus = statusStr.toUpperCase();
58
- const lowerStatus = statusStr.toLowerCase();
59
-
60
- // Direct mapping for known statuses (try uppercase first)
61
- if (STATUS_COLORS[normalizedStatus as keyof typeof STATUS_COLORS]) {
62
- return STATUS_COLORS[normalizedStatus as keyof typeof STATUS_COLORS];
63
- }
64
-
65
- // Try lowercase for case statuses
66
- if (STATUS_COLORS[lowerStatus as keyof typeof STATUS_COLORS]) {
67
- return STATUS_COLORS[lowerStatus as keyof typeof STATUS_COLORS];
68
- }
69
-
70
- // Try capitalized (first letter uppercase)
71
- const capitalizedStatus = statusStr.charAt(0).toUpperCase() + statusStr.slice(1).toLowerCase();
72
- if (STATUS_COLORS[capitalizedStatus as keyof typeof STATUS_COLORS]) {
73
- return STATUS_COLORS[capitalizedStatus as keyof typeof STATUS_COLORS];
74
- }
75
-
76
- // Handle common status patterns
77
- if (normalizedStatus.includes('ACTIVE')) {
78
- return STATUS_COLORS.ACTIVE;
79
- }
80
-
81
- if (normalizedStatus.includes('INACTIVE') || normalizedStatus.includes('DISABLED')) {
82
- return STATUS_COLORS.INACTIVE;
83
- }
84
-
85
- if (normalizedStatus.includes('EXPIRED')) {
86
- return STATUS_COLORS.EXPIRED;
87
- }
88
-
89
- if (normalizedStatus.includes('PENDING')) {
90
- return STATUS_COLORS.PENDING;
91
- }
92
-
93
- if (normalizedStatus.includes('SUSPENDED') || normalizedStatus.includes('REVOKED') || normalizedStatus.includes('WITHDRAWN')) {
94
- return STATUS_COLORS.SUSPENDED;
95
- }
96
-
97
- if (lowerStatus.includes('completed')) {
98
- return STATUS_COLORS.completed;
99
- }
100
-
101
- if (lowerStatus.includes('processing') || lowerStatus.includes('in_progress')) {
102
- return STATUS_COLORS.processing;
103
- }
104
-
105
- if (lowerStatus.includes('rejected') || lowerStatus.includes('declined')) {
106
- return STATUS_COLORS.rejected;
107
- }
108
-
109
- // Default fallback
110
- return STATUS_COLORS.default;
111
- };
@@ -1,130 +0,0 @@
1
- /**
2
- * Simple Toast Utility
3
- * Replaces react-toastify with a lightweight inline-styled solution
4
- */
5
-
6
- type ToastType = 'success' | 'error' | 'info' | 'warning';
7
-
8
- interface ToastOptions {
9
- duration?: number;
10
- }
11
-
12
- let toastContainer: HTMLDivElement | null = null;
13
- const activeToastKeys = new Set<string>();
14
-
15
- const createToastContainer = () => {
16
- if (typeof document === 'undefined') return null;
17
-
18
- if (!toastContainer) {
19
- toastContainer = document.createElement('div');
20
- toastContainer.id = 'pc-toast-container';
21
- toastContainer.style.cssText = `
22
- position: fixed;
23
- top: 20px;
24
- right: 20px;
25
- z-index: 10000;
26
- display: flex;
27
- flex-direction: column;
28
- gap: 12px;
29
- pointer-events: none;
30
- `;
31
- document.body.appendChild(toastContainer);
32
- }
33
-
34
- return toastContainer;
35
- };
36
-
37
- const showToast = (message: string, type: ToastType, options: ToastOptions = {}) => {
38
- if (typeof document === 'undefined') {
39
- // Fallback to console in SSR
40
- console[type === 'error' ? 'error' : 'log'](`[${type.toUpperCase()}] ${message}`);
41
- return;
42
- }
43
-
44
- const container = createToastContainer();
45
- if (!container) return;
46
-
47
- const toastKey = `${type}:${message}`;
48
- if (activeToastKeys.has(toastKey)) {
49
- return;
50
- }
51
- activeToastKeys.add(toastKey);
52
-
53
- const toast = document.createElement('div');
54
- const duration = options.duration || 3000;
55
-
56
- const colors = {
57
- success: { bg: '#10b981', text: '#ffffff' },
58
- error: { bg: '#ef4444', text: '#ffffff' },
59
- info: { bg: '#3b82f6', text: '#ffffff' },
60
- warning: { bg: '#f59e0b', text: '#ffffff' },
61
- };
62
-
63
- const color = colors[type];
64
-
65
- toast.style.cssText = `
66
- background-color: ${color.bg};
67
- color: ${color.text};
68
- padding: 12px 16px;
69
- border-radius: 8px;
70
- box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
71
- font-size: 14px;
72
- font-weight: 500;
73
- min-width: 200px;
74
- max-width: 400px;
75
- pointer-events: auto;
76
- animation: pc-slideInRight 0.3s ease-out;
77
- display: flex;
78
- align-items: center;
79
- gap: 8px;
80
- `;
81
-
82
- toast.textContent = message;
83
- container.appendChild(toast);
84
-
85
- // Add animation keyframes if not already present
86
- if (!document.getElementById('pc-toast-animations')) {
87
- const style = document.createElement('style');
88
- style.id = 'pc-toast-animations';
89
- style.textContent = `
90
- @keyframes pc-slideInRight {
91
- from {
92
- transform: translateX(100%);
93
- opacity: 0;
94
- }
95
- to {
96
- transform: translateX(0);
97
- opacity: 1;
98
- }
99
- }
100
- @keyframes pc-slideOutRight {
101
- from {
102
- transform: translateX(0);
103
- opacity: 1;
104
- }
105
- to {
106
- transform: translateX(100%);
107
- opacity: 0;
108
- }
109
- }
110
- `;
111
- document.head.appendChild(style);
112
- }
113
-
114
- setTimeout(() => {
115
- toast.style.animation = 'pc-slideOutRight 0.3s ease-out';
116
- setTimeout(() => {
117
- activeToastKeys.delete(toastKey);
118
- if (toast.parentNode) {
119
- toast.parentNode.removeChild(toast);
120
- }
121
- }, 300);
122
- }, duration);
123
- };
124
-
125
- export const toast = {
126
- success: (message: string, options?: ToastOptions) => showToast(message, 'success', options),
127
- error: (message: string, options?: ToastOptions) => showToast(message, 'error', options),
128
- info: (message: string, options?: ToastOptions) => showToast(message, 'info', options),
129
- warning: (message: string, options?: ToastOptions) => showToast(message, 'warning', options),
130
- };
package/src/index.ts DELETED
@@ -1,19 +0,0 @@
1
- export { default as RedactoNoticeConsent } from "./RedactoNoticeConsent";
2
- export { default as RedactoNoticeConsentInline } from "./RedactoNoticeConsentInline";
3
- export { default as RedactoNoticeAssisted } from "./RedactoNoticeAssisted";
4
- export type { RedactoNoticeAssistedProps } from "./RedactoNoticeAssisted/RedactoNoticeAssisted";
5
-
6
- // Guardian Verification Components
7
- export { DigiLockerCallback } from "./RedactoNoticeConsent/components/DigiLockerCallback";
8
-
9
- // Types for Guardian Verification
10
- export type {
11
- DigiLockerCallbackProps,
12
- ConsentFlowState,
13
- GuardianVerificationErrorCode,
14
- } from "./RedactoNoticeConsent/api/types";
15
-
16
- // API errors — consumers can narrow caught errors to ApiError to read
17
- // the typed error code, status, or developer-facing server message.
18
- export { ApiError } from "./shared/api-errors";
19
- export type { ApiErrorCode } from "./shared/api-errors";
@@ -1,113 +0,0 @@
1
- // Privacy Center - Certified UI
2
- export { RedactoPrivacyCenter } from './RedactoPrivacyCenter/RedactoPrivacyCenter';
3
- export { PrivacyCenterLayout } from './RedactoPrivacyCenter/PrivacyCenterLayout';
4
- export { PrivacyCenterHomePage } from './RedactoPrivacyCenter/PrivacyCenterHomePage';
5
- export { PrivacyCenterConsentManagerPage } from './RedactoPrivacyCenter/PrivacyCenterConsentManagerPage';
6
- export { PrivacyCenterFormPage } from './RedactoPrivacyCenter/PrivacyCenterFormPage';
7
- export { PrivacyCenterActivityPage } from './RedactoPrivacyCenter/PrivacyCenterActivityPage';
8
- export { PrivacyCenterCaseDetailsPage } from './RedactoPrivacyCenter/PrivacyCenterCaseDetailsPage';
9
- export { NotificationsPage } from './RedactoPrivacyCenter/NotificationsPage';
10
-
11
- // Privacy Center - Headless Core (API client & types)
12
- export { createConsentClient } from './RedactoPrivacyCenter/api/client';
13
- export type { BaseRequest } from './RedactoPrivacyCenter/api/client';
14
- export type { ApiFetchOptions, ApiResponse } from './RedactoPrivacyCenter/api/fetcher';
15
-
16
- // Privacy Center - Headless Core (types)
17
- export type {
18
- Workspace,
19
- OrganizationDetail,
20
- OrganizationResponse,
21
- DataElement,
22
- Purpose,
23
- RawPurposeWrapper,
24
- GrievanceValue,
25
- GrievanceOptions,
26
- FormData,
27
- FormDataResponse,
28
- NominationData,
29
- UpdatePurpose,
30
- UpdateCorrectionDataItem,
31
- GrievanceTypeElement,
32
- UpdateRequestDetails,
33
- UserDataRequest,
34
- CreateCaseResponse,
35
- OtpResponse,
36
- OtpVerificationResponse,
37
- TokenExchangeResponse,
38
- FetchOrgParams,
39
- ConsentDataElement,
40
- PurposeItem,
41
- ConsentGroup,
42
- DisplayPurposeRow,
43
- ConsentModalRecord,
44
- GroupPurposesOut,
45
- PaginationMeta,
46
- NominatorInfo,
47
- ConsentHistoryStatusSummary,
48
- Pagination,
49
- UserConsentDetail,
50
- UserConsentResponse,
51
- ManageConsentResponse,
52
- ManageConsentParams,
53
- Activity,
54
- ActivityDetail,
55
- ActivityResponse,
56
- ActivityBadgeStatus,
57
- CaseRequest,
58
- CaseHistoryDetail,
59
- CaseHistoryResponse,
60
- } from './RedactoPrivacyCenter/lib/types';
61
-
62
- export {
63
- RequestTypeEnum,
64
- GrievanceTypeEnum,
65
- ConsentStatusEnum,
66
- } from './RedactoPrivacyCenter/lib/types';
67
-
68
- export type { ConsentAction } from './RedactoPrivacyCenter/lib/types';
69
-
70
- // Privacy Center - Headless Core (API orchestration with auth retry)
71
- export {
72
- getFormData,
73
- createCaseRequest,
74
- fetchProducts,
75
- fetchUserConsents,
76
- fetchGroupPurposes,
77
- manageConsent,
78
- fetchActivities,
79
- fetchCaseHistory,
80
- createOtp,
81
- verifyOtp,
82
- exchangeToken,
83
- } from './RedactoPrivacyCenter/lib/api';
84
-
85
- export type { AuthContext } from './RedactoPrivacyCenter/lib/api';
86
-
87
- // Privacy Center - Headless Core (auth utilities)
88
- export {
89
- decodeJwtToken,
90
- isJwtExpired,
91
- ensureValidToken,
92
- signOutPrivacyCenter,
93
- getCookieValue,
94
- setRefreshTokenCookie,
95
- checkAndRefreshAuth,
96
- compareEmails,
97
- isUserAuthenticated,
98
- getInitialState,
99
- getActivityTypeStatus,
100
- formatActivityType,
101
- } from './RedactoPrivacyCenter/lib/utils';
102
-
103
- // Privacy Center - Headless Hook (React Query)
104
- export { useCaseHistory } from './RedactoPrivacyCenter/lib/queries';
105
-
106
- // Privacy Center - Context providers (for custom compositions)
107
- export { AuthProvider, useAuth } from './RedactoPrivacyCenter/context/AuthContext';
108
- export { BaseUrlProvider, useBaseUrl } from './RedactoPrivacyCenter/context/BaseUrlContext';
109
- export { NavigationProvider, useInternalNavigation } from './RedactoPrivacyCenter/context/NavigationContext';
110
- export type { InternalPage } from './RedactoPrivacyCenter/context/NavigationContext';
111
-
112
- // Privacy Center - Style injection
113
- export { injectPCStyles } from './RedactoPrivacyCenter/styles/injectStyles';