@redacto.io/consent-sdk-react 4.0.0 → 5.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 (160) hide show
  1. package/CHANGELOG.md +13 -1
  2. package/LICENSE +176 -0
  3. package/dist/index.js +231 -96
  4. package/dist/index.mjs +231 -96
  5. package/dist/privacy-center.d.mts +649 -0
  6. package/dist/privacy-center.d.ts +649 -0
  7. package/dist/privacy-center.js +20824 -0
  8. package/dist/privacy-center.mjs +20789 -0
  9. package/package.json +47 -3
  10. package/src/RedactoNoticeConsent/RedactoNoticeConsent.tsx +6 -4
  11. package/src/RedactoNoticeConsent/api/index.ts +2 -0
  12. package/src/RedactoNoticeConsent/api/types.ts +2 -0
  13. package/src/RedactoNoticeConsent/components/DigiLockerCallback.tsx +128 -62
  14. package/src/RedactoNoticeConsent/language-codes.ts +97 -0
  15. package/src/RedactoNoticeConsentInline/RedactoNoticeConsentInline.tsx +0 -3
  16. package/src/RedactoNoticeConsentInline/api/index.ts +0 -1
  17. package/src/RedactoPrivacyCenter/PrivacyCenterActivityPage.tsx +19 -0
  18. package/src/RedactoPrivacyCenter/PrivacyCenterCaseDetailsPage.tsx +154 -0
  19. package/src/RedactoPrivacyCenter/PrivacyCenterConsentManagerPage.tsx +17 -0
  20. package/src/RedactoPrivacyCenter/PrivacyCenterFormPage.tsx +79 -0
  21. package/src/RedactoPrivacyCenter/PrivacyCenterHomePage.tsx +30 -0
  22. package/src/RedactoPrivacyCenter/PrivacyCenterLayout.tsx +173 -0
  23. package/src/RedactoPrivacyCenter/RedactoPrivacyCenter.tsx +55 -0
  24. package/src/RedactoPrivacyCenter/api/actions.ts +476 -0
  25. package/src/RedactoPrivacyCenter/api/client.ts +524 -0
  26. package/src/RedactoPrivacyCenter/api/config.ts +33 -0
  27. package/src/RedactoPrivacyCenter/api/fetcher.ts +181 -0
  28. package/src/RedactoPrivacyCenter/api/upload.ts +93 -0
  29. package/src/RedactoPrivacyCenter/assets/character.svg +31 -0
  30. package/src/RedactoPrivacyCenter/assets/fileAttach.svg +9 -0
  31. package/src/RedactoPrivacyCenter/assets/greenTick.svg +4 -0
  32. package/src/RedactoPrivacyCenter/assets/mail.svg +3 -0
  33. package/src/RedactoPrivacyCenter/assets/poweredByRedacto.svg +9 -0
  34. package/src/RedactoPrivacyCenter/assets/sentImg.svg +9 -0
  35. package/src/RedactoPrivacyCenter/assets/uploadFileIcon.svg +9 -0
  36. package/src/RedactoPrivacyCenter/components/ActivitiesList.tsx +272 -0
  37. package/src/RedactoPrivacyCenter/components/CaseDetails/AttachmentCard.tsx +38 -0
  38. package/src/RedactoPrivacyCenter/components/CaseDetails/ChatBubble.tsx +31 -0
  39. package/src/RedactoPrivacyCenter/components/CaseDetails/DocumentRequestCard.tsx +73 -0
  40. package/src/RedactoPrivacyCenter/components/CaseDetails/MessageComposer.tsx +87 -0
  41. package/src/RedactoPrivacyCenter/components/CaseDetails/MessageItem.tsx +95 -0
  42. package/src/RedactoPrivacyCenter/components/CaseDetails/MessagesTab.tsx +147 -0
  43. package/src/RedactoPrivacyCenter/components/CaseDetails/RequestDetailsTab.tsx +171 -0
  44. package/src/RedactoPrivacyCenter/components/CaseDetails/StatusEvent.tsx +23 -0
  45. package/src/RedactoPrivacyCenter/components/CaseDetails/useFileUpload.ts +116 -0
  46. package/src/RedactoPrivacyCenter/components/CaseDetails/useMessagePolling.ts +36 -0
  47. package/src/RedactoPrivacyCenter/components/CaseDetails/utils.ts +56 -0
  48. package/src/RedactoPrivacyCenter/components/CaseDetailsModal.tsx +469 -0
  49. package/src/RedactoPrivacyCenter/components/CaseHistory.tsx +426 -0
  50. package/src/RedactoPrivacyCenter/components/ConsentManager.tsx +732 -0
  51. package/src/RedactoPrivacyCenter/components/ConsentManagerColumns.tsx +238 -0
  52. package/src/RedactoPrivacyCenter/components/ConsentManagerConstants.ts +7 -0
  53. package/src/RedactoPrivacyCenter/components/ConsentManagerTableSkeleton.tsx +155 -0
  54. package/src/RedactoPrivacyCenter/components/DataRequest/CorrectionDataSection.tsx +189 -0
  55. package/src/RedactoPrivacyCenter/components/DataRequest/GrievanceDataSection.tsx +118 -0
  56. package/src/RedactoPrivacyCenter/components/DataRequest/NominationDataSection.tsx +66 -0
  57. package/src/RedactoPrivacyCenter/components/DataRequest/PurposeSelectionSection.tsx +304 -0
  58. package/src/RedactoPrivacyCenter/components/Form.tsx +1596 -0
  59. package/src/RedactoPrivacyCenter/components/GrievanceTable.tsx +174 -0
  60. package/src/RedactoPrivacyCenter/components/GrievanceTablePagination.tsx +337 -0
  61. package/src/RedactoPrivacyCenter/components/ModifyConsentModal.tsx +330 -0
  62. package/src/RedactoPrivacyCenter/components/Pagination.tsx +140 -0
  63. package/src/RedactoPrivacyCenter/components/PrivacyCenterLayout.tsx +304 -0
  64. package/src/RedactoPrivacyCenter/components/RequestSubmit.tsx +232 -0
  65. package/src/RedactoPrivacyCenter/components/SideMenuBarPC/SideBarPC.tsx +475 -0
  66. package/src/RedactoPrivacyCenter/components/SideMenuBarPC/SideMenuPC.tsx +408 -0
  67. package/src/RedactoPrivacyCenter/components/SideMenuBarPC/constants.tsx +42 -0
  68. package/src/RedactoPrivacyCenter/components/SideMenuBarPC/menuItemsPC.tsx +1 -0
  69. package/src/RedactoPrivacyCenter/components/SideMenuBarPC/types.ts +40 -0
  70. package/src/RedactoPrivacyCenter/components/SideMenuBarPC/utils.ts +38 -0
  71. package/src/RedactoPrivacyCenter/components/ThemeTransitionOverlay.tsx +85 -0
  72. package/src/RedactoPrivacyCenter/components/activitiesColumns.tsx +141 -0
  73. package/src/RedactoPrivacyCenter/components/caseHistoryColumns.tsx +159 -0
  74. package/src/RedactoPrivacyCenter/components/constant.ts +16 -0
  75. package/src/RedactoPrivacyCenter/components/types.ts +76 -0
  76. package/src/RedactoPrivacyCenter/components/utils.tsx +10 -0
  77. package/src/RedactoPrivacyCenter/config/routes.ts +9 -0
  78. package/src/RedactoPrivacyCenter/config/table.ts +25 -0
  79. package/src/RedactoPrivacyCenter/context/AuthContext.tsx +137 -0
  80. package/src/RedactoPrivacyCenter/context/BaseUrlContext.tsx +41 -0
  81. package/src/RedactoPrivacyCenter/context/LocaleContext.tsx +11 -0
  82. package/src/RedactoPrivacyCenter/context/NavigationContext.tsx +96 -0
  83. package/src/RedactoPrivacyCenter/context/OrganizationContext.tsx +30 -0
  84. package/src/RedactoPrivacyCenter/context/PageChromeContext.tsx +60 -0
  85. package/src/RedactoPrivacyCenter/context/theme.tsx +127 -0
  86. package/src/RedactoPrivacyCenter/context/types.ts +14 -0
  87. package/src/RedactoPrivacyCenter/lib/api.ts +566 -0
  88. package/src/RedactoPrivacyCenter/lib/consent-manager/utils.tsx +63 -0
  89. package/src/RedactoPrivacyCenter/lib/constants.ts +161 -0
  90. package/src/RedactoPrivacyCenter/lib/i18n.ts +81 -0
  91. package/src/RedactoPrivacyCenter/lib/locales.ts +105 -0
  92. package/src/RedactoPrivacyCenter/lib/queries.ts +134 -0
  93. package/src/RedactoPrivacyCenter/lib/types.ts +531 -0
  94. package/src/RedactoPrivacyCenter/lib/useCurrentLanguage.ts +37 -0
  95. package/src/RedactoPrivacyCenter/lib/utils.ts +626 -0
  96. package/src/RedactoPrivacyCenter/locales/as/translation.json +280 -0
  97. package/src/RedactoPrivacyCenter/locales/bho/translation.json +280 -0
  98. package/src/RedactoPrivacyCenter/locales/bn/translation.json +280 -0
  99. package/src/RedactoPrivacyCenter/locales/brx/translation.json +280 -0
  100. package/src/RedactoPrivacyCenter/locales/doi/translation.json +280 -0
  101. package/src/RedactoPrivacyCenter/locales/en/translation.json +255 -0
  102. package/src/RedactoPrivacyCenter/locales/gom/translation.json +280 -0
  103. package/src/RedactoPrivacyCenter/locales/gu/translation.json +280 -0
  104. package/src/RedactoPrivacyCenter/locales/hi/translation.json +280 -0
  105. package/src/RedactoPrivacyCenter/locales/kn/translation.json +280 -0
  106. package/src/RedactoPrivacyCenter/locales/ks/translation.json +280 -0
  107. package/src/RedactoPrivacyCenter/locales/mai/translation.json +280 -0
  108. package/src/RedactoPrivacyCenter/locales/ml/translation.json +280 -0
  109. package/src/RedactoPrivacyCenter/locales/mni-Mtei/translation.json +280 -0
  110. package/src/RedactoPrivacyCenter/locales/mr/translation.json +280 -0
  111. package/src/RedactoPrivacyCenter/locales/ne/translation.json +280 -0
  112. package/src/RedactoPrivacyCenter/locales/or/translation.json +280 -0
  113. package/src/RedactoPrivacyCenter/locales/pa/translation.json +280 -0
  114. package/src/RedactoPrivacyCenter/locales/sa/translation.json +280 -0
  115. package/src/RedactoPrivacyCenter/locales/sat/translation.json +280 -0
  116. package/src/RedactoPrivacyCenter/locales/sd/translation.json +280 -0
  117. package/src/RedactoPrivacyCenter/locales/ta/translation.json +280 -0
  118. package/src/RedactoPrivacyCenter/locales/te/translation.json +280 -0
  119. package/src/RedactoPrivacyCenter/locales/ur/translation.json +280 -0
  120. package/src/RedactoPrivacyCenter/styles/base.css +117 -0
  121. package/src/RedactoPrivacyCenter/styles/injectStyles.ts +1725 -0
  122. package/src/RedactoPrivacyCenter/styles/pcStyles.ts +813 -0
  123. package/src/RedactoPrivacyCenter/styles/responsive.ts +138 -0
  124. package/src/RedactoPrivacyCenter/styles/variables.css +133 -0
  125. package/src/RedactoPrivacyCenter/table/AdvancedTable.tsx +367 -0
  126. package/src/RedactoPrivacyCenter/table/AdvancedTablePagination.tsx +476 -0
  127. package/src/RedactoPrivacyCenter/table/index.ts +2 -0
  128. package/src/RedactoPrivacyCenter/types/images.d.ts +29 -0
  129. package/src/RedactoPrivacyCenter/ui/Footer.tsx +75 -0
  130. package/src/RedactoPrivacyCenter/ui/FormBlockWrapper.tsx +54 -0
  131. package/src/RedactoPrivacyCenter/ui/PCAccordion.tsx +93 -0
  132. package/src/RedactoPrivacyCenter/ui/PCActionIcon.tsx +47 -0
  133. package/src/RedactoPrivacyCenter/ui/PCAvatar.tsx +69 -0
  134. package/src/RedactoPrivacyCenter/ui/PCBadge.tsx +48 -0
  135. package/src/RedactoPrivacyCenter/ui/PCButton.tsx +77 -0
  136. package/src/RedactoPrivacyCenter/ui/PCCheckbox.tsx +55 -0
  137. package/src/RedactoPrivacyCenter/ui/PCCollapse.tsx +107 -0
  138. package/src/RedactoPrivacyCenter/ui/PCEmpty.tsx +35 -0
  139. package/src/RedactoPrivacyCenter/ui/PCInput.tsx +132 -0
  140. package/src/RedactoPrivacyCenter/ui/PCLoader.tsx +31 -0
  141. package/src/RedactoPrivacyCenter/ui/PCModal.tsx +106 -0
  142. package/src/RedactoPrivacyCenter/ui/PCPopover.tsx +173 -0
  143. package/src/RedactoPrivacyCenter/ui/PCSelect.tsx +387 -0
  144. package/src/RedactoPrivacyCenter/ui/PCTable.tsx +149 -0
  145. package/src/RedactoPrivacyCenter/ui/PCText.tsx +41 -0
  146. package/src/RedactoPrivacyCenter/ui/PCTextarea.tsx +43 -0
  147. package/src/RedactoPrivacyCenter/ui/PCTitle.tsx +37 -0
  148. package/src/RedactoPrivacyCenter/ui/PCTooltip.tsx +119 -0
  149. package/src/RedactoPrivacyCenter/ui/SimpleBar.tsx +25 -0
  150. package/src/RedactoPrivacyCenter/ui/StatusBadge.tsx +53 -0
  151. package/src/RedactoPrivacyCenter/ui/ThemeToggle.tsx +72 -0
  152. package/src/RedactoPrivacyCenter/ui/index.ts +18 -0
  153. package/src/RedactoPrivacyCenter/utils/cn.ts +28 -0
  154. package/src/RedactoPrivacyCenter/utils/date.ts +48 -0
  155. package/src/RedactoPrivacyCenter/utils/status.ts +111 -0
  156. package/src/RedactoPrivacyCenter/utils/toast.ts +130 -0
  157. package/src/privacy-center.ts +108 -0
  158. package/tsconfig.json +2 -0
  159. package/tsup.config.ts +16 -1
  160. package/.turbo/turbo-build.log +0 -21
@@ -0,0 +1,649 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { ReactNode } from 'react';
3
+ import * as _tanstack_react_query from '@tanstack/react-query';
4
+
5
+ /**
6
+ * Options for apiFetch function
7
+ */
8
+ type ApiFetchOptions = RequestInit & {
9
+ /**
10
+ * Auth token getter function
11
+ */
12
+ getAuthToken?: () => Promise<string | null>;
13
+ };
14
+ /**
15
+ * Standard API response wrapper
16
+ */
17
+ type ApiResponse<T> = {
18
+ code: number;
19
+ status: string;
20
+ detail: T;
21
+ };
22
+
23
+ /**
24
+ * Base request parameters for consent service calls
25
+ */
26
+ type BaseRequest = {
27
+ organisationUuid: string;
28
+ workspaceUuid: string;
29
+ authToken: string;
30
+ };
31
+ /**
32
+ * Consent service client factory.
33
+ * Creates a client instance with a specific base URL.
34
+ * @param baseUrl - Consent server base URL
35
+ */
36
+ declare function createConsentClient(baseUrl: string): {
37
+ /**
38
+ * Get form data (privacy center)
39
+ */
40
+ getFormData(baseRequest: BaseRequest, contact: string, authToken?: string, options?: ApiFetchOptions & {
41
+ useSessionAuth?: boolean;
42
+ }, language?: string): Promise<unknown>;
43
+ /**
44
+ * Create case request (privacy center or case management)
45
+ */
46
+ createCaseRequest(baseRequest: BaseRequest, payload: unknown, authToken?: string, options?: ApiFetchOptions & {
47
+ useSessionAuth?: boolean;
48
+ }): Promise<unknown>;
49
+ /**
50
+ * Create OTP (public)
51
+ */
52
+ createOtp(organisationId: string, workspaceId: string, email: string, options?: Omit<ApiFetchOptions, "getAuthToken">): Promise<unknown>;
53
+ /**
54
+ * Verify OTP (public)
55
+ */
56
+ verifyOtp(organisationId: string, workspaceId: string, otpId: string, otp: string, options?: Omit<ApiFetchOptions, "getAuthToken">): Promise<unknown>;
57
+ /**
58
+ * Exchange one-time token for JWT tokens (public)
59
+ */
60
+ exchangeToken(token: string): Promise<unknown>;
61
+ /**
62
+ * Refresh OTP token (public)
63
+ */
64
+ refreshOtpToken(organisationId: string, workspaceId: string, refreshToken: string, options?: Omit<ApiFetchOptions, "getAuthToken">): Promise<unknown>;
65
+ /**
66
+ * Get products
67
+ */
68
+ getProducts(baseRequest: BaseRequest, skip?: number, limit?: number, options?: Omit<ApiFetchOptions, "getAuthToken">): Promise<unknown>;
69
+ /**
70
+ * Get user consents (privacy center)
71
+ */
72
+ getUserConsents(baseRequest: BaseRequest, contact: string, offset?: number, limit?: number, search?: string, status?: string, product_uuid?: string, language?: string, authToken?: string, options?: Omit<ApiFetchOptions, "getAuthToken">): Promise<unknown>;
73
+ /**
74
+ * Manage consent (privacy center) - revoke, regrant, or renew
75
+ */
76
+ manageConsent(baseRequest: BaseRequest, purposeId: string, contact: string, status: "revoke" | "regrant" | "renew", authToken?: string, options?: Omit<ApiFetchOptions, "getAuthToken">, nominatorContact?: string, dataElementUuids?: string[]): Promise<unknown>;
77
+ /**
78
+ * Get activities (privacy center)
79
+ */
80
+ getActivities(baseRequest: BaseRequest, offset?: number, limit?: number, language?: string, authToken?: string, options?: Omit<ApiFetchOptions, "getAuthToken">): Promise<unknown>;
81
+ /**
82
+ * Get case history (privacy center)
83
+ */
84
+ getCaseHistory(baseRequest: BaseRequest, _contact: string, offset?: number, limit?: number, language?: string, authToken?: string, options?: Omit<ApiFetchOptions, "getAuthToken">): Promise<unknown>;
85
+ /**
86
+ * Get messages for a case (privacy center)
87
+ */
88
+ getCaseMessages(baseRequest: BaseRequest, caseUuid: string, authToken?: string): Promise<CaseMessage[]>;
89
+ /**
90
+ * Send a message on a case (privacy center)
91
+ */
92
+ sendCaseMessage(baseRequest: BaseRequest, caseUuid: string, body: string, documentUuids: string[], authToken?: string): Promise<CaseMessage>;
93
+ /**
94
+ * Upload a document on a case (multipart/form-data, privacy center)
95
+ */
96
+ uploadCaseDocument(baseRequest: BaseRequest, caseUuid: string, file: File, authToken?: string): Promise<UploadDocumentResponse>;
97
+ /**
98
+ * Submit a document against a handler document request (privacy center)
99
+ */
100
+ submitDocumentForRequest(baseRequest: BaseRequest, caseUuid: string, requestEventUuid: string, documentUuid: string, body: string, authToken?: string): Promise<CaseMessage>;
101
+ /**
102
+ * Get document info/download URL for a case document (privacy center)
103
+ */
104
+ getCaseDocument(baseRequest: BaseRequest, caseUuid: string, documentUuid: string, authToken?: string): Promise<MessageDocument>;
105
+ };
106
+
107
+ type Workspace = {
108
+ uuid: string;
109
+ suid: string;
110
+ name: string;
111
+ description: string;
112
+ workspace_type: string;
113
+ status: string;
114
+ };
115
+ type OrganizationDetail = {
116
+ uuid: string;
117
+ suid: string;
118
+ name: string;
119
+ slug: string;
120
+ description: string;
121
+ domain: string;
122
+ workspaces: Workspace[];
123
+ ai_summary: Record<string, unknown>;
124
+ icon_url: string | null;
125
+ activated: boolean;
126
+ allowed_domains: string[];
127
+ };
128
+ type OrganizationResponse = {
129
+ code: number;
130
+ status: string;
131
+ detail: OrganizationDetail;
132
+ };
133
+ type DataElement = {
134
+ uuid: string;
135
+ name: string;
136
+ description: string;
137
+ enabled: boolean;
138
+ required: boolean;
139
+ given_consent: boolean;
140
+ selected: boolean;
141
+ };
142
+ type Purpose = {
143
+ uuid: string;
144
+ name: string;
145
+ description: string;
146
+ industries: string;
147
+ selected: boolean;
148
+ given_consent: boolean;
149
+ data_elements: DataElement[];
150
+ status?: string;
151
+ validity?: number | null;
152
+ purpose_uuid?: string;
153
+ enabled?: boolean;
154
+ };
155
+ type RawPurposeWrapper = {
156
+ purpose: Purpose;
157
+ };
158
+ type GrievanceValue = 'consent_violation' | 'unlawful_processing' | 'data_breach';
159
+ type GrievanceOptions = {
160
+ value: GrievanceValue;
161
+ label: string;
162
+ };
163
+ type FormData = {
164
+ uuid: string;
165
+ name: string;
166
+ contact: string;
167
+ grievance_options: GrievanceOptions[];
168
+ purposes: RawPurposeWrapper[];
169
+ };
170
+ type FormDataResponse = {
171
+ code: number;
172
+ detail: FormData;
173
+ };
174
+ declare enum RequestTypeEnum {
175
+ ACCESS = "ACCESS",
176
+ CORRECTION = "CORRECTION",
177
+ ERASURE = "erasure",
178
+ GRIEVANCE = "grievance",
179
+ NOMINATION = "nomination"
180
+ }
181
+ type NominationData = {
182
+ nominee_email: string;
183
+ nominee_mobile?: string;
184
+ };
185
+ type UpdatePurpose = {
186
+ purpose_uuid: string;
187
+ data_element_uuids: string[];
188
+ };
189
+ type UpdateCorrectionDataItem = {
190
+ name: string;
191
+ curr_value: string;
192
+ new_value: string;
193
+ };
194
+ declare enum GrievanceTypeEnum {
195
+ CONSENT_VIOLATION = "consent_violation",
196
+ UNLAWFUL_PROCESSING = "unlawful_processing",
197
+ DATA_BREACH = "data_breach"
198
+ }
199
+ type GrievanceTypeElement = {
200
+ grievance: GrievanceValue;
201
+ };
202
+ type UpdateRequestDetails = {
203
+ purposes: UpdatePurpose[];
204
+ correction_data: UpdateCorrectionDataItem[];
205
+ grievance_types?: GrievanceTypeElement[];
206
+ nomination_data?: NominationData;
207
+ };
208
+ type UserDataRequest = {
209
+ uuid: string;
210
+ name: string;
211
+ contact: string;
212
+ request_type: RequestTypeEnum;
213
+ supporting_docs_uuids: string[];
214
+ request_details: {
215
+ purposes: UpdatePurpose[];
216
+ correction_data: UpdateCorrectionDataItem[];
217
+ grievance_types: GrievanceTypeElement[];
218
+ nomination_data?: NominationData;
219
+ };
220
+ time_period: number | null;
221
+ requestor_note: string;
222
+ revoke_consent_on_fulfilment?: boolean;
223
+ };
224
+ type CreateCaseResponse = {
225
+ code: number;
226
+ status: string;
227
+ detail: {
228
+ uuid: string;
229
+ case_id: string;
230
+ };
231
+ };
232
+ type OtpResponse = {
233
+ uuid: string;
234
+ to: string;
235
+ channel: string;
236
+ expire_at: string;
237
+ success: boolean;
238
+ message: string;
239
+ };
240
+ type OtpVerificationResponse = {
241
+ token: string;
242
+ success: boolean;
243
+ message: string;
244
+ };
245
+ type TokenExchangeResponse = {
246
+ token: string;
247
+ refresh_token: string;
248
+ expires_at: string;
249
+ notice_uuid: string;
250
+ };
251
+ type FetchOrgParams = {
252
+ slug?: string;
253
+ name?: string;
254
+ };
255
+ type ConsentDataElement = {
256
+ uuid: string;
257
+ name: string;
258
+ enabled: boolean;
259
+ required: boolean;
260
+ selected: boolean;
261
+ };
262
+ type UserConsent = {
263
+ purpose_uuid?: string;
264
+ purpose: string;
265
+ purpose_description: string;
266
+ status: ConsentStatusEnum;
267
+ given_date: string;
268
+ valid_till: string;
269
+ method: string;
270
+ data_elements: ConsentDataElement[];
271
+ product_uuid?: string;
272
+ product_name?: string;
273
+ product_description?: string | null;
274
+ nominator_info?: NominatorInfo;
275
+ };
276
+ type NominatorInfo = {
277
+ org_user_id: string;
278
+ name: string | null;
279
+ uuid: string;
280
+ email: string | null;
281
+ };
282
+ type ConsentHistoryStatusSummary = {
283
+ total_purposes: number;
284
+ direct_purposes: number;
285
+ nominated_purposes: number;
286
+ nominee_purposes?: number;
287
+ active_purposes: number;
288
+ inactive_purposes: number;
289
+ };
290
+ type ProductConsentHistoryGroup = {
291
+ product_uuid: string;
292
+ product_name: string;
293
+ product_description: string | null;
294
+ purposes: UserConsent[];
295
+ total_purposes: number;
296
+ active_purposes: number;
297
+ };
298
+ type NominatedPurposesGroup = {
299
+ nominator_info: NominatorInfo;
300
+ product_groups: ProductConsentHistoryGroup[];
301
+ };
302
+ type Pagination = {
303
+ total_count: number;
304
+ offset: number;
305
+ limit: number;
306
+ };
307
+ type UserConsentDetail = {
308
+ data?: UserConsent[];
309
+ product_purpose_groups?: ProductConsentHistoryGroup[];
310
+ pagination: Pagination;
311
+ direct_product_groups?: ProductConsentHistoryGroup[];
312
+ user_status?: 'ACTIVE' | 'TRANSFERRED' | null;
313
+ nominated_purposes?: NominatedPurposesGroup[];
314
+ nominators?: NominatorInfo[];
315
+ status_summary?: ConsentHistoryStatusSummary | null;
316
+ };
317
+ type UserConsentResponse = {
318
+ code: number;
319
+ status: string;
320
+ detail: UserConsentDetail;
321
+ };
322
+ declare enum ConsentStatusEnum {
323
+ ACTIVE = "ACTIVE",
324
+ WITHDRAWN = "WITHDRAW",
325
+ EXPIRED = "EXPIRED",
326
+ DECLINED = "DECLINED"
327
+ }
328
+ type ConsentAction = 'revoke' | 'regrant' | 'renew';
329
+ type ManageConsentResponse = {
330
+ code: number;
331
+ status: string;
332
+ detail: {
333
+ success: boolean;
334
+ };
335
+ };
336
+ type ManageConsentParams = {
337
+ organizationId: string;
338
+ workspaceId: string;
339
+ purposeId: string;
340
+ contact: string;
341
+ action: ConsentAction;
342
+ nominatorContact?: string;
343
+ dataElementUuids?: string[];
344
+ };
345
+ type Activity = {
346
+ activity_type: string;
347
+ activity_type_display?: string;
348
+ timestamp: string;
349
+ title: string;
350
+ title_display?: string;
351
+ description: string;
352
+ description_display?: string;
353
+ case_id?: string;
354
+ status?: 'Processing' | 'Completed' | 'Rejected';
355
+ status_display?: string;
356
+ };
357
+ type ActivityDetail = {
358
+ data: Activity[];
359
+ pagination: Pagination;
360
+ };
361
+ type ActivityResponse = {
362
+ code: number;
363
+ status: string;
364
+ detail: ActivityDetail;
365
+ };
366
+ type ActivityBadgeStatus$1 = 'success' | 'warning' | 'error' | 'info' | 'pending';
367
+ type CaseRequestDetails = {
368
+ purposes: RawPurposeWrapper[];
369
+ correction_data: UpdateCorrectionDataItem[];
370
+ grievance_types?: GrievanceTypeElement[];
371
+ nomination_data?: NominationData;
372
+ };
373
+ type CaseRequest = {
374
+ uuid: string;
375
+ case_id: string;
376
+ status: string;
377
+ status_display?: string;
378
+ request_type: string;
379
+ request_type_display?: string;
380
+ description: string;
381
+ description_display?: string;
382
+ created_at: string;
383
+ completed_at?: string;
384
+ due_date?: string;
385
+ request_details?: CaseRequestDetails;
386
+ };
387
+ type CaseHistoryDetail = {
388
+ data: CaseRequest[];
389
+ pagination: Pagination;
390
+ };
391
+ type CaseHistoryResponse = {
392
+ code: number;
393
+ status: string;
394
+ detail: CaseRequest[];
395
+ };
396
+ type MessageType = 'message_sent' | 'document_requested' | 'document_submitted' | 'document_replaced' | 'document_replacement_requested' | 'document_approved' | 'document_rejected';
397
+ type DocumentRequestStatus = 'pending' | 'under_review' | 'approved' | 'rejected' | 'replacement_requested';
398
+ type FileUrlMap = {
399
+ url?: string;
400
+ download_url?: string;
401
+ };
402
+ type MessageDocument = {
403
+ uuid: string;
404
+ file_name: string | null;
405
+ content_type: string | null;
406
+ file_size: number | null;
407
+ file_url: FileUrlMap | null;
408
+ };
409
+ type DocumentRequestMetadata = {
410
+ title: string;
411
+ accepted_document: string;
412
+ document_request_status: DocumentRequestStatus;
413
+ document_request_uuid: string | null;
414
+ rejection_reason: string;
415
+ };
416
+ type CaseMessage = {
417
+ uuid: string;
418
+ case_uuid: string;
419
+ sender_role: 'data_fiduciary' | 'data_principal';
420
+ triggered_by_email: string;
421
+ created_at: string;
422
+ body: string;
423
+ document_uuids: string[];
424
+ documents: MessageDocument[];
425
+ message_type: MessageType;
426
+ document_request_metadata: DocumentRequestMetadata | null;
427
+ };
428
+ type UploadDocumentResponse = {
429
+ uuid: string;
430
+ suid: string;
431
+ file_name: string;
432
+ file_type: string;
433
+ content_type: string;
434
+ file_size: number;
435
+ created_at: string;
436
+ is_public: boolean;
437
+ file: string;
438
+ file_hash: string | null;
439
+ status: string;
440
+ allow_ai_processing: boolean;
441
+ metadata: Record<string, string> | null;
442
+ };
443
+
444
+ type InternalPage = 'consent-manager' | 'form' | 'activity' | 'case-details';
445
+ interface NavigationContextType {
446
+ currentPage: InternalPage;
447
+ navigateTo: (page: InternalPage) => void;
448
+ selectedCase: CaseRequest | null;
449
+ setSelectedCase: (c: CaseRequest | null) => void;
450
+ pendingCaseUuid: string | null;
451
+ }
452
+ declare const NavigationProvider: ({ children, initialPage }: {
453
+ children: ReactNode;
454
+ initialPage?: InternalPage;
455
+ }) => react_jsx_runtime.JSX.Element;
456
+ declare const useInternalNavigation: () => NavigationContextType;
457
+
458
+ interface RedactoPrivacyCenterProps {
459
+ baseUrl: string;
460
+ slug: string;
461
+ theme?: 'light' | 'dark';
462
+ accessToken: string;
463
+ refreshToken: string;
464
+ onError: (error: Error) => boolean;
465
+ initialPage?: InternalPage;
466
+ onBack?: 'back' | 'signout';
467
+ }
468
+ declare function RedactoPrivacyCenter({ baseUrl, slug, theme, accessToken, refreshToken, onError, initialPage, onBack, }: RedactoPrivacyCenterProps): react_jsx_runtime.JSX.Element;
469
+
470
+ interface PrivacyCenterLayoutProps {
471
+ children: ReactNode;
472
+ defaultTheme?: 'light' | 'dark';
473
+ slug: string;
474
+ onBack?: 'back' | 'signout';
475
+ }
476
+ declare function PrivacyCenterLayout({ children, defaultTheme, slug, onBack }: PrivacyCenterLayoutProps): react_jsx_runtime.JSX.Element;
477
+
478
+ declare function PrivacyCenterHomePage(): react_jsx_runtime.JSX.Element;
479
+
480
+ declare function PrivacyCenterConsentManagerPage(): react_jsx_runtime.JSX.Element;
481
+
482
+ declare function PrivacyCenterFormPage(): react_jsx_runtime.JSX.Element;
483
+
484
+ declare function PrivacyCenterActivityPage(): react_jsx_runtime.JSX.Element;
485
+
486
+ declare const PrivacyCenterCaseDetailsPage: () => react_jsx_runtime.JSX.Element | null;
487
+
488
+ type AuthContextValue = Readonly<{
489
+ accessToken: string;
490
+ refreshToken: string;
491
+ onError: (error: Error) => boolean;
492
+ updateTokens: (accessToken: string, refreshToken?: string) => void;
493
+ }>;
494
+ type BaseUrlContextValue = Readonly<{
495
+ baseUrl: string;
496
+ consentClient: ReturnType<typeof createConsentClient>;
497
+ }>;
498
+
499
+ declare const BaseUrlProvider: ({ children, baseUrl, }: {
500
+ children: ReactNode;
501
+ baseUrl: string;
502
+ }) => react_jsx_runtime.JSX.Element;
503
+ declare const useBaseUrl: () => Readonly<{
504
+ baseUrl: string;
505
+ consentClient: ReturnType<typeof createConsentClient>;
506
+ }>;
507
+
508
+ declare function createOtpServer(email: string, organizationId: string, workspaceId: string, consentClient?: ReturnType<typeof createConsentClient>): Promise<OtpResponse>;
509
+ declare function verifyOtpServer(otpId: string, otp: string, organizationId: string, workspaceId: string, consentClient?: ReturnType<typeof createConsentClient>): Promise<OtpVerificationResponse>;
510
+ declare function exchangeTokenServer(token: string, consentClient?: ReturnType<typeof createConsentClient>): Promise<TokenExchangeResponse>;
511
+
512
+ declare const getCookieValue: (name: string) => string | null;
513
+ /**
514
+ * Set refresh token cookie with proper attributes
515
+ * @param refreshToken - The refresh token value to set
516
+ */
517
+ declare const setRefreshTokenCookie: (refreshToken: string) => void;
518
+ /**
519
+ * Decode JWT token and extract payload
520
+ * @param token - JWT token string
521
+ * @returns Decoded JWT payload or null if decoding fails
522
+ */
523
+ declare const decodeJwtToken: (token: string) => {
524
+ organisation_uuid?: string;
525
+ organisation_name?: string;
526
+ workspace_uuid?: string;
527
+ [key: string]: any;
528
+ } | null;
529
+ /**
530
+ * Decode JWT payload and check if token is expired or will expire soon
531
+ * @param token - JWT token string
532
+ * @param bufferSeconds - Buffer time in seconds before expiration to consider token expired (default: 5 minutes)
533
+ * @returns true if token is expired, invalid, or will expire within buffer time; false if valid
534
+ */
535
+ declare const isJwtExpired: (token: string, bufferSeconds?: number) => boolean;
536
+ /**
537
+ * Check if user is authenticated in privacy center
538
+ * User is considered authenticated if both access_token and email exist in sessionStorage
539
+ */
540
+ declare const isUserAuthenticated: (expectedSlug: string) => boolean;
541
+ /**
542
+ * Get initial state for sign-in form visibility
543
+ * Returns true if window is undefined (SSR) or user is not authenticated
544
+ * @param slug - The organization slug to check authentication against
545
+ * @returns true if sign-in form should be shown, false otherwise
546
+ */
547
+ declare const getInitialState: (slug: string) => boolean;
548
+ /**
549
+ * Check authentication status and attempt token refresh if needed
550
+ * This function checks if the user is authenticated, validates JWT expiration,
551
+ * and attempts to refresh using the refresh token cookie if the token is expired or missing.
552
+ * @param expectedSlug - The organization slug to verify against
553
+ * @param organizationId - Optional organization ID (will be read from sessionStorage if not provided)
554
+ * @param workspaceId - Optional workspace ID (will be read from sessionStorage if not provided)
555
+ * @returns Promise<boolean> - true if authenticated with valid non-expired token, false otherwise
556
+ */
557
+ declare const checkAndRefreshAuth: (expectedSlug: string, organizationId?: string, workspaceId?: string, consentClient?: BaseUrlContextValue["consentClient"]) => Promise<boolean>;
558
+ /**
559
+ * Compare two email addresses (case-insensitive, handles URL encoding)
560
+ * @param email1 - First email (can be URL-encoded)
561
+ * @param email2 - Second email
562
+ * @returns true if emails match (case-insensitive), false otherwise
563
+ */
564
+ declare const compareEmails: (email1: string | null, email2: string | null) => boolean;
565
+ /**
566
+ * Sign out from privacy center only
567
+ * Clears privacy-center specific storage and cookies without touching Supabase auth
568
+ */
569
+ declare const signOutPrivacyCenter: () => void;
570
+ /**
571
+ * Ensure a valid access token is available before making API calls.
572
+ * This function checks if the current token is valid (not expired).
573
+ * If expired or missing, it attempts to refresh using the refresh token.
574
+ * If refresh fails (refresh token expired), it signs out and redirects to sign-in.
575
+ *
576
+ * @param organizationId - The organization UUID
577
+ * @param workspaceId - The workspace UUID
578
+ * @param slug - The organization slug for redirect
579
+ * @param authContext - Optional auth context values (accessToken, refreshToken, onError, updateTokens)
580
+ * @returns Promise<string | null> - Valid access token or null if auth failed
581
+ */
582
+ declare const ensureValidToken: (organizationId?: string, workspaceId?: string, slug?: string, authContext?: {
583
+ accessToken?: string;
584
+ refreshToken?: string;
585
+ onError?: (error: Error) => boolean;
586
+ updateTokens?: (accessToken: string, refreshToken?: string) => void;
587
+ }, consentClient?: BaseUrlContextValue["consentClient"]) => Promise<string | null>;
588
+ type ActivityBadgeStatus = 'success' | 'warning' | 'error' | 'info' | 'pending';
589
+ /**
590
+ * Get badge status based on activity type
591
+ */
592
+ declare const getActivityTypeStatus: (activityType: string) => ActivityBadgeStatus;
593
+ /**
594
+ * Format activity type for display
595
+ */
596
+ declare const formatActivityType: (activityType: string) => string;
597
+
598
+ interface AuthContext {
599
+ accessToken?: string;
600
+ refreshToken?: string;
601
+ onError?: (error: Error) => boolean;
602
+ updateTokens?: (accessToken: string, refreshToken?: string) => void;
603
+ }
604
+
605
+ declare const getFormData: (organizationId: string, workspaceId: string, contact: string, _isPopup?: boolean, useSessionAuth?: boolean, authContext?: AuthContext, consentClient?: BaseUrlContextValue["consentClient"], language?: string) => Promise<FormData | null>;
606
+ declare const createCaseRequest: (organizationId: string, workspaceId: string, data: UserDataRequest, _isPopup?: boolean, useSessionAuth?: boolean, authContext?: AuthContext, consentClient?: BaseUrlContextValue["consentClient"]) => Promise<CreateCaseResponse | null>;
607
+ declare const fetchProducts: (organizationId: string, workspaceId: string, skip?: number, limit?: number, authContext?: AuthContext, consentClient?: BaseUrlContextValue["consentClient"]) => Promise<Array<{
608
+ uuid: string;
609
+ name: string;
610
+ description?: string;
611
+ }> | null>;
612
+ declare const fetchUserConsents: (organizationId: string, workspaceId: string, contact: string, offset?: number, limit?: number, search?: string, status?: string, product_uuid?: string, authContext?: AuthContext, consentClient?: BaseUrlContextValue["consentClient"], language?: string) => Promise<UserConsentDetail | null>;
613
+ declare const manageConsent: ({ organizationId, workspaceId, purposeId, contact, action, authContext, consentClient, nominatorContact, dataElementUuids, }: {
614
+ organizationId: string;
615
+ workspaceId: string;
616
+ purposeId: string;
617
+ contact: string;
618
+ action: "revoke" | "regrant" | "renew";
619
+ authContext?: AuthContext;
620
+ consentClient?: BaseUrlContextValue["consentClient"];
621
+ nominatorContact?: string;
622
+ dataElementUuids?: string[];
623
+ }) => Promise<boolean | null>;
624
+ declare const fetchActivities: (organizationId: string, workspaceId: string, offset?: number, limit?: number, authContext?: AuthContext, consentClient?: BaseUrlContextValue["consentClient"], language?: string) => Promise<ActivityDetail | null>;
625
+ declare const fetchCaseHistory: (organizationId: string, workspaceId: string, contact: string, offset?: number, limit?: number, authContext?: AuthContext, consentClient?: BaseUrlContextValue["consentClient"], language?: string) => Promise<CaseHistoryDetail | null>;
626
+
627
+ declare const useCaseHistory: (organizationId: string | undefined, workspaceId: string | undefined, contact: string | undefined, authContext?: AuthContext) => _tanstack_react_query.UseQueryResult<CaseRequest[], Error>;
628
+
629
+ interface AuthProviderProps {
630
+ children: ReactNode;
631
+ accessToken: string;
632
+ refreshToken: string;
633
+ onError: (error: Error) => boolean;
634
+ }
635
+ declare const AuthProvider: ({ children, accessToken: initialAccessToken, refreshToken: initialRefreshToken, onError, }: AuthProviderProps) => react_jsx_runtime.JSX.Element;
636
+ declare const useAuth: () => AuthContextValue;
637
+
638
+ /**
639
+ * CSS Injection Utility for Privacy Center SDK
640
+ *
641
+ * Injects CSS that cannot be done with inline styles:
642
+ * - Keyframe animations
643
+ * - Pseudo-elements (::after, ::before)
644
+ * - Checkbox checked states
645
+ * - Focus states for form elements
646
+ */
647
+ declare const injectPCStyles: () => void;
648
+
649
+ export { type Activity, type ActivityBadgeStatus$1 as ActivityBadgeStatus, type ActivityDetail, type ActivityResponse, type ApiFetchOptions, type ApiResponse, type AuthContext, AuthProvider, type BaseRequest, BaseUrlProvider, type CaseHistoryDetail, type CaseHistoryResponse, type CaseRequest, type ConsentAction, type ConsentDataElement, type ConsentHistoryStatusSummary, ConsentStatusEnum, type CreateCaseResponse, type DataElement, type FetchOrgParams, type FormData, type FormDataResponse, type GrievanceOptions, type GrievanceTypeElement, GrievanceTypeEnum, type GrievanceValue, type InternalPage, type ManageConsentParams, type ManageConsentResponse, NavigationProvider, type NominatedPurposesGroup, type NominationData, type NominatorInfo, type OrganizationDetail, type OrganizationResponse, type OtpResponse, type OtpVerificationResponse, type Pagination, PrivacyCenterActivityPage, PrivacyCenterCaseDetailsPage, PrivacyCenterConsentManagerPage, PrivacyCenterFormPage, PrivacyCenterHomePage, PrivacyCenterLayout, type ProductConsentHistoryGroup, type Purpose, type RawPurposeWrapper, RedactoPrivacyCenter, RequestTypeEnum, type TokenExchangeResponse, type UpdateCorrectionDataItem, type UpdatePurpose, type UpdateRequestDetails, type UserConsent, type UserConsentDetail, type UserConsentResponse, type UserDataRequest, type Workspace, checkAndRefreshAuth, compareEmails, createCaseRequest, createConsentClient, createOtpServer as createOtp, decodeJwtToken, ensureValidToken, exchangeTokenServer as exchangeToken, fetchActivities, fetchCaseHistory, fetchProducts, fetchUserConsents, formatActivityType, getActivityTypeStatus, getCookieValue, getFormData, getInitialState, injectPCStyles, isJwtExpired, isUserAuthenticated, manageConsent, setRefreshTokenCookie, signOutPrivacyCenter, useAuth, useBaseUrl, useCaseHistory, useInternalNavigation, verifyOtpServer as verifyOtp };