@redacto.io/consent-sdk-react 3.4.0 → 3.6.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 (155) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/LICENSE +176 -0
  3. package/dist/index.d.mts +51 -4
  4. package/dist/index.d.ts +51 -4
  5. package/dist/index.js +1912 -345
  6. package/dist/index.mjs +1911 -345
  7. package/dist/privacy-center.d.mts +566 -0
  8. package/dist/privacy-center.d.ts +566 -0
  9. package/dist/privacy-center.js +17174 -0
  10. package/dist/privacy-center.mjs +17136 -0
  11. package/package.json +47 -3
  12. package/src/RedactoNoticeConsent/RedactoNoticeConsent.test.tsx +201 -118
  13. package/src/RedactoNoticeConsent/RedactoNoticeConsent.tsx +1194 -93
  14. package/src/RedactoNoticeConsent/api/index.ts +337 -246
  15. package/src/RedactoNoticeConsent/api/types.ts +140 -41
  16. package/src/RedactoNoticeConsent/components/DigiLockerCallback.tsx +602 -0
  17. package/src/RedactoNoticeConsent/components/index.ts +7 -0
  18. package/src/RedactoNoticeConsent/injectStyles.ts +11 -0
  19. package/src/RedactoNoticeConsent/language-codes.ts +61 -0
  20. package/src/RedactoNoticeConsent/services/storage.ts +122 -0
  21. package/src/RedactoNoticeConsent/types.ts +2 -0
  22. package/src/RedactoNoticeConsentInline/api/index.ts +26 -64
  23. package/src/RedactoNoticeConsentInline/api/types.ts +0 -25
  24. package/src/RedactoPrivacyCenter/PrivacyCenterActivityPage.tsx +19 -0
  25. package/src/RedactoPrivacyCenter/PrivacyCenterConsentManagerPage.tsx +17 -0
  26. package/src/RedactoPrivacyCenter/PrivacyCenterFormPage.tsx +79 -0
  27. package/src/RedactoPrivacyCenter/PrivacyCenterHomePage.tsx +27 -0
  28. package/src/RedactoPrivacyCenter/PrivacyCenterLayout.tsx +142 -0
  29. package/src/RedactoPrivacyCenter/RedactoPrivacyCenter.tsx +51 -0
  30. package/src/RedactoPrivacyCenter/api/actions.ts +444 -0
  31. package/src/RedactoPrivacyCenter/api/client.ts +413 -0
  32. package/src/RedactoPrivacyCenter/api/config.ts +33 -0
  33. package/src/RedactoPrivacyCenter/api/fetcher.ts +181 -0
  34. package/src/RedactoPrivacyCenter/api/upload.ts +93 -0
  35. package/src/RedactoPrivacyCenter/assets/character.svg +31 -0
  36. package/src/RedactoPrivacyCenter/assets/fileAttach.svg +9 -0
  37. package/src/RedactoPrivacyCenter/assets/greenTick.svg +4 -0
  38. package/src/RedactoPrivacyCenter/assets/mail.svg +3 -0
  39. package/src/RedactoPrivacyCenter/assets/poweredByRedacto.svg +9 -0
  40. package/src/RedactoPrivacyCenter/assets/sentImg.svg +9 -0
  41. package/src/RedactoPrivacyCenter/assets/uploadFileIcon.svg +9 -0
  42. package/src/RedactoPrivacyCenter/components/ActivitiesList.tsx +272 -0
  43. package/src/RedactoPrivacyCenter/components/CaseDetailsModal.tsx +468 -0
  44. package/src/RedactoPrivacyCenter/components/CaseHistory.tsx +433 -0
  45. package/src/RedactoPrivacyCenter/components/ConsentManager.tsx +726 -0
  46. package/src/RedactoPrivacyCenter/components/ConsentManagerColumns.tsx +239 -0
  47. package/src/RedactoPrivacyCenter/components/ConsentManagerConstants.ts +7 -0
  48. package/src/RedactoPrivacyCenter/components/ConsentManagerTableSkeleton.tsx +155 -0
  49. package/src/RedactoPrivacyCenter/components/DataRequest/CorrectionDataSection.tsx +189 -0
  50. package/src/RedactoPrivacyCenter/components/DataRequest/GrievanceDataSection.tsx +118 -0
  51. package/src/RedactoPrivacyCenter/components/DataRequest/NominationDataSection.tsx +66 -0
  52. package/src/RedactoPrivacyCenter/components/DataRequest/PurposeSelectionSection.tsx +305 -0
  53. package/src/RedactoPrivacyCenter/components/Form.tsx +1455 -0
  54. package/src/RedactoPrivacyCenter/components/GrievanceTable.tsx +176 -0
  55. package/src/RedactoPrivacyCenter/components/GrievanceTablePagination.tsx +330 -0
  56. package/src/RedactoPrivacyCenter/components/ModifyConsentModal.tsx +329 -0
  57. package/src/RedactoPrivacyCenter/components/Pagination.tsx +140 -0
  58. package/src/RedactoPrivacyCenter/components/PrivacyCenterLayout.tsx +302 -0
  59. package/src/RedactoPrivacyCenter/components/RequestSubmit.tsx +218 -0
  60. package/src/RedactoPrivacyCenter/components/SideMenuBarPC/SideBarPC.tsx +475 -0
  61. package/src/RedactoPrivacyCenter/components/SideMenuBarPC/SideMenuPC.tsx +412 -0
  62. package/src/RedactoPrivacyCenter/components/SideMenuBarPC/constants.tsx +42 -0
  63. package/src/RedactoPrivacyCenter/components/SideMenuBarPC/menuItemsPC.tsx +1 -0
  64. package/src/RedactoPrivacyCenter/components/SideMenuBarPC/types.ts +40 -0
  65. package/src/RedactoPrivacyCenter/components/SideMenuBarPC/utils.ts +38 -0
  66. package/src/RedactoPrivacyCenter/components/ThemeTransitionOverlay.tsx +85 -0
  67. package/src/RedactoPrivacyCenter/components/activitiesColumns.tsx +141 -0
  68. package/src/RedactoPrivacyCenter/components/caseHistoryColumns.tsx +179 -0
  69. package/src/RedactoPrivacyCenter/components/constant.ts +20 -0
  70. package/src/RedactoPrivacyCenter/components/types.ts +68 -0
  71. package/src/RedactoPrivacyCenter/components/utils.tsx +10 -0
  72. package/src/RedactoPrivacyCenter/config/routes.ts +9 -0
  73. package/src/RedactoPrivacyCenter/config/table.ts +25 -0
  74. package/src/RedactoPrivacyCenter/context/AuthContext.tsx +123 -0
  75. package/src/RedactoPrivacyCenter/context/BaseUrlContext.tsx +44 -0
  76. package/src/RedactoPrivacyCenter/context/LocaleContext.tsx +11 -0
  77. package/src/RedactoPrivacyCenter/context/NavigationContext.tsx +64 -0
  78. package/src/RedactoPrivacyCenter/context/OrganizationContext.tsx +30 -0
  79. package/src/RedactoPrivacyCenter/context/PageChromeContext.tsx +60 -0
  80. package/src/RedactoPrivacyCenter/context/theme.tsx +127 -0
  81. package/src/RedactoPrivacyCenter/lib/api.ts +468 -0
  82. package/src/RedactoPrivacyCenter/lib/consent-manager/utils.tsx +63 -0
  83. package/src/RedactoPrivacyCenter/lib/constants.ts +116 -0
  84. package/src/RedactoPrivacyCenter/lib/i18n.ts +81 -0
  85. package/src/RedactoPrivacyCenter/lib/locales.ts +105 -0
  86. package/src/RedactoPrivacyCenter/lib/queries.ts +30 -0
  87. package/src/RedactoPrivacyCenter/lib/types.ts +346 -0
  88. package/src/RedactoPrivacyCenter/lib/useCurrentLanguage.ts +37 -0
  89. package/src/RedactoPrivacyCenter/lib/utils.ts +625 -0
  90. package/src/RedactoPrivacyCenter/locales/as/translation.json +188 -0
  91. package/src/RedactoPrivacyCenter/locales/bho/translation.json +188 -0
  92. package/src/RedactoPrivacyCenter/locales/bn/translation.json +188 -0
  93. package/src/RedactoPrivacyCenter/locales/brx/translation.json +188 -0
  94. package/src/RedactoPrivacyCenter/locales/doi/translation.json +188 -0
  95. package/src/RedactoPrivacyCenter/locales/en/translation.json +188 -0
  96. package/src/RedactoPrivacyCenter/locales/gom/translation.json +188 -0
  97. package/src/RedactoPrivacyCenter/locales/gu/translation.json +188 -0
  98. package/src/RedactoPrivacyCenter/locales/hi/translation.json +188 -0
  99. package/src/RedactoPrivacyCenter/locales/kn/translation.json +188 -0
  100. package/src/RedactoPrivacyCenter/locales/ks/translation.json +188 -0
  101. package/src/RedactoPrivacyCenter/locales/mai/translation.json +188 -0
  102. package/src/RedactoPrivacyCenter/locales/ml/translation.json +188 -0
  103. package/src/RedactoPrivacyCenter/locales/mni-Mtei/translation.json +188 -0
  104. package/src/RedactoPrivacyCenter/locales/mr/translation.json +188 -0
  105. package/src/RedactoPrivacyCenter/locales/ne/translation.json +188 -0
  106. package/src/RedactoPrivacyCenter/locales/or/translation.json +188 -0
  107. package/src/RedactoPrivacyCenter/locales/pa/translation.json +188 -0
  108. package/src/RedactoPrivacyCenter/locales/sa/translation.json +188 -0
  109. package/src/RedactoPrivacyCenter/locales/sat/translation.json +188 -0
  110. package/src/RedactoPrivacyCenter/locales/sd/translation.json +188 -0
  111. package/src/RedactoPrivacyCenter/locales/ta/translation.json +188 -0
  112. package/src/RedactoPrivacyCenter/locales/te/translation.json +188 -0
  113. package/src/RedactoPrivacyCenter/locales/ur/translation.json +188 -0
  114. package/src/RedactoPrivacyCenter/styles/base.css +117 -0
  115. package/src/RedactoPrivacyCenter/styles/injectStyles.ts +1000 -0
  116. package/src/RedactoPrivacyCenter/styles/pcStyles.ts +819 -0
  117. package/src/RedactoPrivacyCenter/styles/responsive.ts +138 -0
  118. package/src/RedactoPrivacyCenter/styles/variables.css +133 -0
  119. package/src/RedactoPrivacyCenter/table/AdvancedTable.tsx +365 -0
  120. package/src/RedactoPrivacyCenter/table/AdvancedTablePagination.tsx +479 -0
  121. package/src/RedactoPrivacyCenter/table/index.ts +2 -0
  122. package/src/RedactoPrivacyCenter/types/images.d.ts +29 -0
  123. package/src/RedactoPrivacyCenter/ui/Footer.tsx +73 -0
  124. package/src/RedactoPrivacyCenter/ui/FormBlockWrapper.tsx +54 -0
  125. package/src/RedactoPrivacyCenter/ui/PCAccordion.tsx +87 -0
  126. package/src/RedactoPrivacyCenter/ui/PCActionIcon.tsx +47 -0
  127. package/src/RedactoPrivacyCenter/ui/PCAvatar.tsx +69 -0
  128. package/src/RedactoPrivacyCenter/ui/PCBadge.tsx +48 -0
  129. package/src/RedactoPrivacyCenter/ui/PCButton.tsx +77 -0
  130. package/src/RedactoPrivacyCenter/ui/PCCheckbox.tsx +55 -0
  131. package/src/RedactoPrivacyCenter/ui/PCCollapse.tsx +97 -0
  132. package/src/RedactoPrivacyCenter/ui/PCEmpty.tsx +35 -0
  133. package/src/RedactoPrivacyCenter/ui/PCInput.tsx +128 -0
  134. package/src/RedactoPrivacyCenter/ui/PCLoader.tsx +30 -0
  135. package/src/RedactoPrivacyCenter/ui/PCModal.tsx +104 -0
  136. package/src/RedactoPrivacyCenter/ui/PCPopover.tsx +175 -0
  137. package/src/RedactoPrivacyCenter/ui/PCSelect.tsx +381 -0
  138. package/src/RedactoPrivacyCenter/ui/PCTable.tsx +137 -0
  139. package/src/RedactoPrivacyCenter/ui/PCText.tsx +39 -0
  140. package/src/RedactoPrivacyCenter/ui/PCTextarea.tsx +43 -0
  141. package/src/RedactoPrivacyCenter/ui/PCTitle.tsx +37 -0
  142. package/src/RedactoPrivacyCenter/ui/PCTooltip.tsx +119 -0
  143. package/src/RedactoPrivacyCenter/ui/SimpleBar.tsx +25 -0
  144. package/src/RedactoPrivacyCenter/ui/StatusBadge.tsx +55 -0
  145. package/src/RedactoPrivacyCenter/ui/ThemeToggle.tsx +70 -0
  146. package/src/RedactoPrivacyCenter/ui/index.ts +18 -0
  147. package/src/RedactoPrivacyCenter/utils/cn.ts +28 -0
  148. package/src/RedactoPrivacyCenter/utils/date.ts +48 -0
  149. package/src/RedactoPrivacyCenter/utils/status.ts +111 -0
  150. package/src/RedactoPrivacyCenter/utils/toast.ts +130 -0
  151. package/src/index.ts +10 -0
  152. package/src/privacy-center.ts +107 -0
  153. package/tsconfig.json +2 -0
  154. package/tsup.config.ts +16 -1
  155. package/src/utils/isLegacyApi.ts +0 -12
@@ -0,0 +1,111 @@
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
+ };
@@ -0,0 +1,130 @@
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 CHANGED
@@ -1,2 +1,12 @@
1
1
  export { default as RedactoNoticeConsent } from "./RedactoNoticeConsent";
2
2
  export { default as RedactoNoticeConsentInline } from "./RedactoNoticeConsentInline";
3
+
4
+ // Guardian Verification Components
5
+ export { DigiLockerCallback } from "./RedactoNoticeConsent/components/DigiLockerCallback";
6
+
7
+ // Types for Guardian Verification
8
+ export type {
9
+ DigiLockerCallbackProps,
10
+ ConsentFlowState,
11
+ GuardianVerificationErrorCode,
12
+ } from "./RedactoNoticeConsent/api/types";
@@ -0,0 +1,107 @@
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
+
9
+ // Privacy Center - Headless Core (API client & types)
10
+ export { createConsentClient } from './RedactoPrivacyCenter/api/client';
11
+ export type { BaseRequest } from './RedactoPrivacyCenter/api/client';
12
+ export type { ApiFetchOptions, ApiResponse } from './RedactoPrivacyCenter/api/fetcher';
13
+
14
+ // Privacy Center - Headless Core (types)
15
+ export type {
16
+ Workspace,
17
+ OrganizationDetail,
18
+ OrganizationResponse,
19
+ DataElement,
20
+ Purpose,
21
+ RawPurposeWrapper,
22
+ GrievanceValue,
23
+ GrievanceOptions,
24
+ FormData,
25
+ FormDataResponse,
26
+ NominationData,
27
+ UpdatePurpose,
28
+ UpdateCorrectionDataItem,
29
+ GrievanceTypeElement,
30
+ UpdateRequestDetails,
31
+ UserDataRequest,
32
+ CreateCaseResponse,
33
+ OtpResponse,
34
+ OtpVerificationResponse,
35
+ TokenExchangeResponse,
36
+ FetchOrgParams,
37
+ ConsentDataElement,
38
+ UserConsent,
39
+ NominatorInfo,
40
+ ConsentHistoryStatusSummary,
41
+ ProductConsentHistoryGroup,
42
+ NominatedPurposesGroup,
43
+ Pagination,
44
+ UserConsentDetail,
45
+ UserConsentResponse,
46
+ ManageConsentResponse,
47
+ ManageConsentParams,
48
+ Activity,
49
+ ActivityDetail,
50
+ ActivityResponse,
51
+ ActivityBadgeStatus,
52
+ CaseRequest,
53
+ CaseHistoryDetail,
54
+ CaseHistoryResponse,
55
+ } from './RedactoPrivacyCenter/lib/types';
56
+
57
+ export {
58
+ RequestTypeEnum,
59
+ GrievanceTypeEnum,
60
+ ConsentStatusEnum,
61
+ } from './RedactoPrivacyCenter/lib/types';
62
+
63
+ export type { ConsentAction } from './RedactoPrivacyCenter/lib/types';
64
+
65
+ // Privacy Center - Headless Core (API orchestration with auth retry)
66
+ export {
67
+ getFormData,
68
+ createCaseRequest,
69
+ fetchProducts,
70
+ fetchUserConsents,
71
+ manageConsent,
72
+ fetchActivities,
73
+ fetchCaseHistory,
74
+ createOtp,
75
+ verifyOtp,
76
+ exchangeToken,
77
+ } from './RedactoPrivacyCenter/lib/api';
78
+
79
+ export type { AuthContext } from './RedactoPrivacyCenter/lib/api';
80
+
81
+ // Privacy Center - Headless Core (auth utilities)
82
+ export {
83
+ decodeJwtToken,
84
+ isJwtExpired,
85
+ ensureValidToken,
86
+ signOutPrivacyCenter,
87
+ getCookieValue,
88
+ setRefreshTokenCookie,
89
+ checkAndRefreshAuth,
90
+ compareEmails,
91
+ isUserAuthenticated,
92
+ getInitialState,
93
+ getActivityTypeStatus,
94
+ formatActivityType,
95
+ } from './RedactoPrivacyCenter/lib/utils';
96
+
97
+ // Privacy Center - Headless Hook (React Query)
98
+ export { useCaseHistory } from './RedactoPrivacyCenter/lib/queries';
99
+
100
+ // Privacy Center - Context providers (for custom compositions)
101
+ export { AuthProvider, useAuth } from './RedactoPrivacyCenter/context/AuthContext';
102
+ export { BaseUrlProvider, useBaseUrl } from './RedactoPrivacyCenter/context/BaseUrlContext';
103
+ export { NavigationProvider, useInternalNavigation } from './RedactoPrivacyCenter/context/NavigationContext';
104
+ export type { InternalPage } from './RedactoPrivacyCenter/context/NavigationContext';
105
+
106
+ // Privacy Center - Style injection
107
+ export { injectPCStyles } from './RedactoPrivacyCenter/styles/injectStyles';
package/tsconfig.json CHANGED
@@ -8,6 +8,8 @@
8
8
  "moduleResolution": "node",
9
9
  "esModuleInterop": true,
10
10
  "skipLibCheck": true,
11
+ "resolveJsonModule": true,
12
+ "types": ["react", "react-dom"],
11
13
  "plugins": [{ "name": "typescript-plugin-css-modules" }]
12
14
  },
13
15
  "include": ["src"]
package/tsup.config.ts CHANGED
@@ -3,14 +3,29 @@ import { defineConfig } from "tsup";
3
3
  export default defineConfig({
4
4
  entry: {
5
5
  index: "src/index.ts",
6
+ "privacy-center": "src/privacy-center.ts",
6
7
  },
7
8
  format: ["esm", "cjs"],
8
9
  dts: true,
9
- external: ["react", "react-dom", "jwt-decode"],
10
+ external: [
11
+ "react",
12
+ "react-dom",
13
+ "jwt-decode",
14
+ "@tanstack/react-query",
15
+ "@tanstack/react-table",
16
+ "i18next",
17
+ "i18next-browser-languagedetector",
18
+ "react-i18next",
19
+ "lucide-react",
20
+ "react-icons",
21
+ "dayjs",
22
+ "lodash",
23
+ ],
10
24
  clean: true,
11
25
  loader: {
12
26
  ".png": "dataurl",
13
27
  ".jpg": "dataurl",
14
28
  ".svg": "dataurl",
29
+ ".css": "local-css",
15
30
  },
16
31
  });
@@ -1,12 +0,0 @@
1
- // @deprecated Remove when production backend supports the new payload format.
2
- export function isLegacyApi(baseUrl: string): boolean {
3
- try {
4
- return new URL(baseUrl).hostname.endsWith(".redacto.io");
5
- } catch {
6
- try {
7
- return new URL(`https://${baseUrl}`).hostname.endsWith(".redacto.io");
8
- } catch {
9
- return false;
10
- }
11
- }
12
- }