@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,566 @@
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
+ type InternalPage = 'consent-manager' | 'form' | 'activity';
6
+ interface NavigationContextType {
7
+ currentPage: InternalPage;
8
+ navigateTo: (page: InternalPage) => void;
9
+ }
10
+ declare const NavigationProvider: ({ children, initialPage }: {
11
+ children: ReactNode;
12
+ initialPage?: InternalPage;
13
+ }) => react_jsx_runtime.JSX.Element;
14
+ declare const useInternalNavigation: () => NavigationContextType;
15
+
16
+ interface RedactoPrivacyCenterProps {
17
+ baseUrl: string;
18
+ slug: string;
19
+ theme?: 'light' | 'dark';
20
+ accessToken: string;
21
+ refreshToken: string;
22
+ onError: (error: Error) => boolean;
23
+ initialPage?: InternalPage;
24
+ onBack?: 'back' | 'signout';
25
+ }
26
+ declare function RedactoPrivacyCenter({ baseUrl, slug, theme, accessToken, refreshToken, onError, initialPage, onBack, }: RedactoPrivacyCenterProps): react_jsx_runtime.JSX.Element;
27
+
28
+ interface PrivacyCenterLayoutProps {
29
+ children: ReactNode;
30
+ defaultTheme?: 'light' | 'dark';
31
+ slug: string;
32
+ onBack?: 'back' | 'signout';
33
+ }
34
+ declare function PrivacyCenterLayout({ children, defaultTheme, slug, onBack }: PrivacyCenterLayoutProps): react_jsx_runtime.JSX.Element;
35
+
36
+ declare function PrivacyCenterHomePage(): react_jsx_runtime.JSX.Element;
37
+
38
+ declare function PrivacyCenterConsentManagerPage(): react_jsx_runtime.JSX.Element;
39
+
40
+ declare function PrivacyCenterFormPage(): react_jsx_runtime.JSX.Element;
41
+
42
+ declare function PrivacyCenterActivityPage(): react_jsx_runtime.JSX.Element;
43
+
44
+ /**
45
+ * Options for apiFetch function
46
+ */
47
+ type ApiFetchOptions = RequestInit & {
48
+ /**
49
+ * Auth token getter function
50
+ */
51
+ getAuthToken?: () => Promise<string | null>;
52
+ };
53
+ /**
54
+ * Standard API response wrapper
55
+ */
56
+ type ApiResponse<T> = {
57
+ code: number;
58
+ status: string;
59
+ detail: T;
60
+ };
61
+
62
+ /**
63
+ * Base request parameters for consent service calls
64
+ */
65
+ type BaseRequest = {
66
+ organisationUuid: string;
67
+ workspaceUuid: string;
68
+ authToken: string;
69
+ };
70
+ /**
71
+ * Consent service client factory.
72
+ * Creates a client instance with a specific base URL.
73
+ * @param baseUrl - Consent server base URL
74
+ */
75
+ declare function createConsentClient(baseUrl: string): {
76
+ /**
77
+ * Get form data (privacy center)
78
+ */
79
+ getFormData(baseRequest: BaseRequest, contact: string, authToken?: string, options?: ApiFetchOptions & {
80
+ useSessionAuth?: boolean;
81
+ }, language?: string): Promise<unknown>;
82
+ /**
83
+ * Create case request (privacy center or case management)
84
+ */
85
+ createCaseRequest(baseRequest: BaseRequest, payload: unknown, authToken?: string, options?: ApiFetchOptions & {
86
+ useSessionAuth?: boolean;
87
+ }): Promise<unknown>;
88
+ /**
89
+ * Create OTP (public)
90
+ */
91
+ createOtp(organisationId: string, workspaceId: string, email: string, options?: Omit<ApiFetchOptions, "getAuthToken">): Promise<unknown>;
92
+ /**
93
+ * Verify OTP (public)
94
+ */
95
+ verifyOtp(organisationId: string, workspaceId: string, otpId: string, otp: string, options?: Omit<ApiFetchOptions, "getAuthToken">): Promise<unknown>;
96
+ /**
97
+ * Exchange one-time token for JWT tokens (public)
98
+ */
99
+ exchangeToken(token: string): Promise<unknown>;
100
+ /**
101
+ * Refresh OTP token (public)
102
+ */
103
+ refreshOtpToken(organisationId: string, workspaceId: string, refreshToken: string, options?: Omit<ApiFetchOptions, "getAuthToken">): Promise<unknown>;
104
+ /**
105
+ * Get products
106
+ */
107
+ getProducts(baseRequest: BaseRequest, skip?: number, limit?: number, options?: Omit<ApiFetchOptions, "getAuthToken">): Promise<unknown>;
108
+ /**
109
+ * Get user consents (privacy center)
110
+ */
111
+ 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>;
112
+ /**
113
+ * Manage consent (privacy center) - revoke, regrant, or renew
114
+ */
115
+ manageConsent(baseRequest: BaseRequest, purposeId: string, contact: string, status: "revoke" | "regrant" | "renew", authToken?: string, options?: Omit<ApiFetchOptions, "getAuthToken">, nominatorContact?: string, dataElementUuids?: string[]): Promise<unknown>;
116
+ /**
117
+ * Get activities (privacy center)
118
+ */
119
+ getActivities(baseRequest: BaseRequest, offset?: number, limit?: number, language?: string, authToken?: string, options?: Omit<ApiFetchOptions, "getAuthToken">): Promise<unknown>;
120
+ /**
121
+ * Get case history (privacy center)
122
+ */
123
+ getCaseHistory(baseRequest: BaseRequest, contact: string, offset?: number, limit?: number, language?: string, authToken?: string, options?: Omit<ApiFetchOptions, "getAuthToken">): Promise<unknown>;
124
+ };
125
+
126
+ type Workspace = {
127
+ uuid: string;
128
+ suid: string;
129
+ name: string;
130
+ description: string;
131
+ workspace_type: string;
132
+ status: string;
133
+ };
134
+ type OrganizationDetail = {
135
+ uuid: string;
136
+ suid: string;
137
+ name: string;
138
+ slug: string;
139
+ description: string;
140
+ domain: string;
141
+ workspaces: Workspace[];
142
+ ai_summary: Record<string, unknown>;
143
+ icon_url: string | null;
144
+ activated: boolean;
145
+ allowed_domains: string[];
146
+ };
147
+ type OrganizationResponse = {
148
+ code: number;
149
+ status: string;
150
+ detail: OrganizationDetail;
151
+ };
152
+ type DataElement = {
153
+ uuid: string;
154
+ name: string;
155
+ description: string;
156
+ enabled: boolean;
157
+ required: boolean;
158
+ given_consent: boolean;
159
+ selected: boolean;
160
+ };
161
+ type Purpose = {
162
+ uuid: string;
163
+ name: string;
164
+ description: string;
165
+ industries: string;
166
+ selected: boolean;
167
+ given_consent: boolean;
168
+ data_elements: DataElement[];
169
+ status?: string;
170
+ validity?: number | null;
171
+ purpose_uuid?: string;
172
+ enabled?: boolean;
173
+ };
174
+ type RawPurposeWrapper = {
175
+ purpose: Purpose;
176
+ };
177
+ type GrievanceValue = 'consent_violation' | 'unlawful_processing' | 'data_breach';
178
+ type GrievanceOptions = {
179
+ value: GrievanceValue;
180
+ label: string;
181
+ };
182
+ type FormData = {
183
+ uuid: string;
184
+ name: string;
185
+ contact: string;
186
+ grievance_options: GrievanceOptions[];
187
+ purposes: RawPurposeWrapper[];
188
+ };
189
+ type FormDataResponse = {
190
+ code: number;
191
+ detail: FormData;
192
+ };
193
+ declare enum RequestTypeEnum {
194
+ ACCESS = "ACCESS",
195
+ CORRECTION = "CORRECTION",
196
+ ERASURE = "erasure",
197
+ GRIEVANCE = "grievance",
198
+ NOMINATION = "nomination"
199
+ }
200
+ type NominationData = {
201
+ nominee_email: string;
202
+ nominee_mobile?: string;
203
+ };
204
+ type UpdatePurpose = {
205
+ purpose_uuid: string;
206
+ data_element_uuids: string[];
207
+ };
208
+ type UpdateCorrectionDataItem = {
209
+ name: string;
210
+ curr_value: string;
211
+ new_value: string;
212
+ };
213
+ declare enum GrievanceTypeEnum {
214
+ CONSENT_VIOLATION = "consent_violation",
215
+ UNLAWFUL_PROCESSING = "unlawful_processing",
216
+ DATA_BREACH = "data_breach"
217
+ }
218
+ type GrievanceTypeElement = {
219
+ grievance: GrievanceValue;
220
+ };
221
+ type UpdateRequestDetails = {
222
+ purposes: UpdatePurpose[];
223
+ correction_data: UpdateCorrectionDataItem[];
224
+ grievance_types?: GrievanceTypeElement[];
225
+ nomination_data?: NominationData;
226
+ };
227
+ type UserDataRequest = {
228
+ uuid: string;
229
+ name: string;
230
+ contact: string;
231
+ request_type: RequestTypeEnum;
232
+ supporting_docs_uuids: string[];
233
+ request_details: {
234
+ purposes: UpdatePurpose[];
235
+ correction_data: UpdateCorrectionDataItem[];
236
+ grievance_types: GrievanceTypeElement[];
237
+ nomination_data?: NominationData;
238
+ };
239
+ time_period: number | null;
240
+ requestor_note: string;
241
+ };
242
+ type CreateCaseResponse = {
243
+ code: number;
244
+ status: string;
245
+ detail: {
246
+ uuid: string;
247
+ case_id: string;
248
+ };
249
+ };
250
+ type OtpResponse = {
251
+ uuid: string;
252
+ to: string;
253
+ channel: string;
254
+ expire_at: string;
255
+ success: boolean;
256
+ message: string;
257
+ };
258
+ type OtpVerificationResponse = {
259
+ token: string;
260
+ success: boolean;
261
+ message: string;
262
+ };
263
+ type TokenExchangeResponse = {
264
+ token: string;
265
+ refresh_token: string;
266
+ expires_at: string;
267
+ notice_uuid: string;
268
+ };
269
+ type FetchOrgParams = {
270
+ slug?: string;
271
+ name?: string;
272
+ };
273
+ type ConsentDataElement = {
274
+ uuid: string;
275
+ name: string;
276
+ enabled: boolean;
277
+ required: boolean;
278
+ selected: boolean;
279
+ };
280
+ type UserConsent = {
281
+ purpose_uuid?: string;
282
+ purpose: string;
283
+ purpose_description: string;
284
+ status: ConsentStatusEnum;
285
+ given_date: string;
286
+ valid_till: string;
287
+ method: string;
288
+ data_elements: ConsentDataElement[];
289
+ product_uuid?: string;
290
+ product_name?: string;
291
+ product_description?: string | null;
292
+ nominator_info?: NominatorInfo;
293
+ };
294
+ type NominatorInfo = {
295
+ org_user_id: string;
296
+ name: string | null;
297
+ uuid: string;
298
+ email: string | null;
299
+ };
300
+ type ConsentHistoryStatusSummary = {
301
+ total_purposes: number;
302
+ direct_purposes: number;
303
+ nominated_purposes: number;
304
+ nominee_purposes?: number;
305
+ active_purposes: number;
306
+ inactive_purposes: number;
307
+ };
308
+ type ProductConsentHistoryGroup = {
309
+ product_uuid: string;
310
+ product_name: string;
311
+ product_description: string | null;
312
+ purposes: UserConsent[];
313
+ total_purposes: number;
314
+ active_purposes: number;
315
+ };
316
+ type NominatedPurposesGroup = {
317
+ nominator_info: NominatorInfo;
318
+ product_groups: ProductConsentHistoryGroup[];
319
+ };
320
+ type Pagination = {
321
+ total_count: number;
322
+ offset: number;
323
+ limit: number;
324
+ };
325
+ type UserConsentDetail = {
326
+ data?: UserConsent[];
327
+ product_purpose_groups?: ProductConsentHistoryGroup[];
328
+ pagination: Pagination;
329
+ direct_product_groups?: ProductConsentHistoryGroup[];
330
+ user_status?: 'ACTIVE' | 'TRANSFERRED' | null;
331
+ nominated_purposes?: NominatedPurposesGroup[];
332
+ nominators?: NominatorInfo[];
333
+ status_summary?: ConsentHistoryStatusSummary | null;
334
+ };
335
+ type UserConsentResponse = {
336
+ code: number;
337
+ status: string;
338
+ detail: UserConsentDetail;
339
+ };
340
+ declare enum ConsentStatusEnum {
341
+ ACTIVE = "ACTIVE",
342
+ WITHDRAWN = "WITHDRAW",
343
+ EXPIRED = "EXPIRED",
344
+ DECLINED = "DECLINED"
345
+ }
346
+ type ConsentAction = 'revoke' | 'regrant' | 'renew';
347
+ type ManageConsentResponse = {
348
+ code: number;
349
+ status: string;
350
+ detail: {
351
+ success: boolean;
352
+ };
353
+ };
354
+ type ManageConsentParams = {
355
+ organizationId: string;
356
+ workspaceId: string;
357
+ purposeId: string;
358
+ contact: string;
359
+ action: ConsentAction;
360
+ nominatorContact?: string;
361
+ dataElementUuids?: string[];
362
+ };
363
+ type Activity = {
364
+ activity_type: string;
365
+ activity_type_display?: string;
366
+ timestamp: string;
367
+ title: string;
368
+ title_display?: string;
369
+ description: string;
370
+ description_display?: string;
371
+ case_id?: string;
372
+ status?: 'Processing' | 'Completed' | 'Rejected';
373
+ status_display?: string;
374
+ };
375
+ type ActivityDetail = {
376
+ data: Activity[];
377
+ pagination: Pagination;
378
+ };
379
+ type ActivityResponse = {
380
+ code: number;
381
+ status: string;
382
+ detail: ActivityDetail;
383
+ };
384
+ type ActivityBadgeStatus$1 = 'success' | 'warning' | 'error' | 'info' | 'pending';
385
+ type CaseRequest = {
386
+ uuid: string;
387
+ case_id: string;
388
+ status: string;
389
+ status_display?: string;
390
+ request_type: string;
391
+ request_type_display?: string;
392
+ description: string;
393
+ description_display?: string;
394
+ created_at: string;
395
+ completed_at?: string;
396
+ due_date?: string;
397
+ request_details?: any;
398
+ };
399
+ type CaseHistoryDetail = {
400
+ data: CaseRequest[];
401
+ pagination: Pagination;
402
+ };
403
+ type CaseHistoryResponse = {
404
+ code: number;
405
+ status: string;
406
+ detail: CaseRequest[];
407
+ };
408
+
409
+ interface BaseUrlContextValue {
410
+ baseUrl: string;
411
+ consentClient: ReturnType<typeof createConsentClient>;
412
+ }
413
+ declare const BaseUrlProvider: ({ children, baseUrl, }: {
414
+ children: ReactNode;
415
+ baseUrl: string;
416
+ }) => react_jsx_runtime.JSX.Element;
417
+ declare const useBaseUrl: () => BaseUrlContextValue;
418
+
419
+ declare function createOtpServer(email: string, organizationId: string, workspaceId: string, consentClient?: ReturnType<typeof createConsentClient>): Promise<OtpResponse>;
420
+ declare function verifyOtpServer(otpId: string, otp: string, organizationId: string, workspaceId: string, consentClient?: ReturnType<typeof createConsentClient>): Promise<OtpVerificationResponse>;
421
+ declare function exchangeTokenServer(token: string, consentClient?: ReturnType<typeof createConsentClient>): Promise<TokenExchangeResponse>;
422
+
423
+ declare const getCookieValue: (name: string) => string | null;
424
+ /**
425
+ * Set refresh token cookie with proper attributes
426
+ * @param refreshToken - The refresh token value to set
427
+ */
428
+ declare const setRefreshTokenCookie: (refreshToken: string) => void;
429
+ /**
430
+ * Decode JWT token and extract payload
431
+ * @param token - JWT token string
432
+ * @returns Decoded JWT payload or null if decoding fails
433
+ */
434
+ declare const decodeJwtToken: (token: string) => {
435
+ organisation_uuid?: string;
436
+ organisation_name?: string;
437
+ workspace_uuid?: string;
438
+ [key: string]: any;
439
+ } | null;
440
+ /**
441
+ * Decode JWT payload and check if token is expired or will expire soon
442
+ * @param token - JWT token string
443
+ * @param bufferSeconds - Buffer time in seconds before expiration to consider token expired (default: 5 minutes)
444
+ * @returns true if token is expired, invalid, or will expire within buffer time; false if valid
445
+ */
446
+ declare const isJwtExpired: (token: string, bufferSeconds?: number) => boolean;
447
+ /**
448
+ * Check if user is authenticated in privacy center
449
+ * User is considered authenticated if both access_token and email exist in sessionStorage
450
+ */
451
+ declare const isUserAuthenticated: (expectedSlug: string) => boolean;
452
+ /**
453
+ * Get initial state for sign-in form visibility
454
+ * Returns true if window is undefined (SSR) or user is not authenticated
455
+ * @param slug - The organization slug to check authentication against
456
+ * @returns true if sign-in form should be shown, false otherwise
457
+ */
458
+ declare const getInitialState: (slug: string) => boolean;
459
+ /**
460
+ * Check authentication status and attempt token refresh if needed
461
+ * This function checks if the user is authenticated, validates JWT expiration,
462
+ * and attempts to refresh using the refresh token cookie if the token is expired or missing.
463
+ * @param expectedSlug - The organization slug to verify against
464
+ * @param organizationId - Optional organization ID (will be read from sessionStorage if not provided)
465
+ * @param workspaceId - Optional workspace ID (will be read from sessionStorage if not provided)
466
+ * @returns Promise<boolean> - true if authenticated with valid non-expired token, false otherwise
467
+ */
468
+ declare const checkAndRefreshAuth: (expectedSlug: string, organizationId?: string, workspaceId?: string, consentClient?: BaseUrlContextValue["consentClient"]) => Promise<boolean>;
469
+ /**
470
+ * Compare two email addresses (case-insensitive, handles URL encoding)
471
+ * @param email1 - First email (can be URL-encoded)
472
+ * @param email2 - Second email
473
+ * @returns true if emails match (case-insensitive), false otherwise
474
+ */
475
+ declare const compareEmails: (email1: string | null, email2: string | null) => boolean;
476
+ /**
477
+ * Sign out from privacy center only
478
+ * Clears privacy-center specific storage and cookies without touching Supabase auth
479
+ */
480
+ declare const signOutPrivacyCenter: () => void;
481
+ /**
482
+ * Ensure a valid access token is available before making API calls.
483
+ * This function checks if the current token is valid (not expired).
484
+ * If expired or missing, it attempts to refresh using the refresh token.
485
+ * If refresh fails (refresh token expired), it signs out and redirects to sign-in.
486
+ *
487
+ * @param organizationId - The organization UUID
488
+ * @param workspaceId - The workspace UUID
489
+ * @param slug - The organization slug for redirect
490
+ * @param authContext - Optional auth context values (accessToken, refreshToken, onError, updateTokens)
491
+ * @returns Promise<string | null> - Valid access token or null if auth failed
492
+ */
493
+ declare const ensureValidToken: (organizationId?: string, workspaceId?: string, slug?: string, authContext?: {
494
+ accessToken?: string;
495
+ refreshToken?: string;
496
+ onError?: (error: Error) => boolean;
497
+ updateTokens?: (accessToken: string, refreshToken?: string) => void;
498
+ }, consentClient?: BaseUrlContextValue["consentClient"]) => Promise<string | null>;
499
+ type ActivityBadgeStatus = 'success' | 'warning' | 'error' | 'info' | 'pending';
500
+ /**
501
+ * Get badge status based on activity type
502
+ */
503
+ declare const getActivityTypeStatus: (activityType: string) => ActivityBadgeStatus;
504
+ /**
505
+ * Format activity type for display
506
+ */
507
+ declare const formatActivityType: (activityType: string) => string;
508
+
509
+ interface AuthContext {
510
+ accessToken?: string;
511
+ refreshToken?: string;
512
+ onError?: (error: Error) => boolean;
513
+ updateTokens?: (accessToken: string, refreshToken?: string) => void;
514
+ }
515
+
516
+ declare const getFormData: (organizationId: string, workspaceId: string, contact: string, _isPopup?: boolean, useSessionAuth?: boolean, authContext?: AuthContext, consentClient?: BaseUrlContextValue["consentClient"], language?: string) => Promise<FormData | null>;
517
+ declare const createCaseRequest: (organizationId: string, workspaceId: string, data: UserDataRequest, _isPopup?: boolean, useSessionAuth?: boolean, authContext?: AuthContext, consentClient?: BaseUrlContextValue["consentClient"]) => Promise<CreateCaseResponse | null>;
518
+ declare const fetchProducts: (organizationId: string, workspaceId: string, skip?: number, limit?: number, authContext?: AuthContext, consentClient?: BaseUrlContextValue["consentClient"]) => Promise<Array<{
519
+ uuid: string;
520
+ name: string;
521
+ description?: string;
522
+ }> | null>;
523
+ 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>;
524
+ declare const manageConsent: ({ organizationId, workspaceId, purposeId, contact, action, authContext, consentClient, nominatorContact, dataElementUuids, }: {
525
+ organizationId: string;
526
+ workspaceId: string;
527
+ purposeId: string;
528
+ contact: string;
529
+ action: "revoke" | "regrant" | "renew";
530
+ authContext?: AuthContext;
531
+ consentClient?: BaseUrlContextValue["consentClient"];
532
+ nominatorContact?: string;
533
+ dataElementUuids?: string[];
534
+ }) => Promise<boolean | null>;
535
+ declare const fetchActivities: (organizationId: string, workspaceId: string, offset?: number, limit?: number, authContext?: AuthContext, consentClient?: BaseUrlContextValue["consentClient"], language?: string) => Promise<ActivityDetail | null>;
536
+ declare const fetchCaseHistory: (organizationId: string, workspaceId: string, contact: string, offset?: number, limit?: number, authContext?: AuthContext, consentClient?: BaseUrlContextValue["consentClient"], language?: string) => Promise<CaseHistoryDetail | null>;
537
+
538
+ declare const useCaseHistory: (organizationId: string | undefined, workspaceId: string | undefined, contact: string | undefined, authContext?: AuthContext) => _tanstack_react_query.UseQueryResult<CaseRequest[], Error>;
539
+
540
+ interface AuthContextValue {
541
+ accessToken: string;
542
+ refreshToken: string;
543
+ onError: (error: Error) => boolean;
544
+ updateTokens: (accessToken: string, refreshToken?: string) => void;
545
+ }
546
+ interface AuthProviderProps {
547
+ children: ReactNode;
548
+ accessToken: string;
549
+ refreshToken: string;
550
+ onError: (error: Error) => boolean;
551
+ }
552
+ declare const AuthProvider: ({ children, accessToken: initialAccessToken, refreshToken: initialRefreshToken, onError, }: AuthProviderProps) => react_jsx_runtime.JSX.Element;
553
+ declare const useAuth: () => AuthContextValue;
554
+
555
+ /**
556
+ * CSS Injection Utility for Privacy Center SDK
557
+ *
558
+ * Injects CSS that cannot be done with inline styles:
559
+ * - Keyframe animations
560
+ * - Pseudo-elements (::after, ::before)
561
+ * - Checkbox checked states
562
+ * - Focus states for form elements
563
+ */
564
+ declare const injectPCStyles: () => void;
565
+
566
+ 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, 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 };