@redacto.io/consent-sdk-react 4.0.0 → 5.1.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.
- package/CHANGELOG.md +19 -1
- package/LICENSE +176 -0
- package/README.md +98 -1
- package/dist/index.js +231 -96
- package/dist/index.mjs +231 -96
- package/dist/privacy-center.d.mts +649 -0
- package/dist/privacy-center.d.ts +649 -0
- package/dist/privacy-center.js +20824 -0
- package/dist/privacy-center.mjs +20789 -0
- package/package.json +47 -3
- package/src/RedactoNoticeConsent/RedactoNoticeConsent.tsx +6 -4
- package/src/RedactoNoticeConsent/api/index.ts +2 -0
- package/src/RedactoNoticeConsent/api/types.ts +2 -0
- package/src/RedactoNoticeConsent/components/DigiLockerCallback.tsx +128 -62
- package/src/RedactoNoticeConsent/language-codes.ts +97 -0
- package/src/RedactoNoticeConsentInline/RedactoNoticeConsentInline.tsx +0 -3
- package/src/RedactoNoticeConsentInline/api/index.ts +0 -1
- package/src/RedactoPrivacyCenter/PrivacyCenterActivityPage.tsx +19 -0
- package/src/RedactoPrivacyCenter/PrivacyCenterCaseDetailsPage.tsx +154 -0
- package/src/RedactoPrivacyCenter/PrivacyCenterConsentManagerPage.tsx +17 -0
- package/src/RedactoPrivacyCenter/PrivacyCenterFormPage.tsx +79 -0
- package/src/RedactoPrivacyCenter/PrivacyCenterHomePage.tsx +30 -0
- package/src/RedactoPrivacyCenter/PrivacyCenterLayout.tsx +173 -0
- package/src/RedactoPrivacyCenter/RedactoPrivacyCenter.tsx +55 -0
- package/src/RedactoPrivacyCenter/api/actions.ts +476 -0
- package/src/RedactoPrivacyCenter/api/client.ts +524 -0
- package/src/RedactoPrivacyCenter/api/config.ts +33 -0
- package/src/RedactoPrivacyCenter/api/fetcher.ts +181 -0
- package/src/RedactoPrivacyCenter/api/upload.ts +93 -0
- package/src/RedactoPrivacyCenter/assets/character.svg +31 -0
- package/src/RedactoPrivacyCenter/assets/fileAttach.svg +9 -0
- package/src/RedactoPrivacyCenter/assets/greenTick.svg +4 -0
- package/src/RedactoPrivacyCenter/assets/mail.svg +3 -0
- package/src/RedactoPrivacyCenter/assets/poweredByRedacto.svg +9 -0
- package/src/RedactoPrivacyCenter/assets/sentImg.svg +9 -0
- package/src/RedactoPrivacyCenter/assets/uploadFileIcon.svg +9 -0
- package/src/RedactoPrivacyCenter/components/ActivitiesList.tsx +272 -0
- package/src/RedactoPrivacyCenter/components/CaseDetails/AttachmentCard.tsx +38 -0
- package/src/RedactoPrivacyCenter/components/CaseDetails/ChatBubble.tsx +31 -0
- package/src/RedactoPrivacyCenter/components/CaseDetails/DocumentRequestCard.tsx +73 -0
- package/src/RedactoPrivacyCenter/components/CaseDetails/MessageComposer.tsx +87 -0
- package/src/RedactoPrivacyCenter/components/CaseDetails/MessageItem.tsx +95 -0
- package/src/RedactoPrivacyCenter/components/CaseDetails/MessagesTab.tsx +147 -0
- package/src/RedactoPrivacyCenter/components/CaseDetails/RequestDetailsTab.tsx +171 -0
- package/src/RedactoPrivacyCenter/components/CaseDetails/StatusEvent.tsx +23 -0
- package/src/RedactoPrivacyCenter/components/CaseDetails/useFileUpload.ts +116 -0
- package/src/RedactoPrivacyCenter/components/CaseDetails/useMessagePolling.ts +36 -0
- package/src/RedactoPrivacyCenter/components/CaseDetails/utils.ts +56 -0
- package/src/RedactoPrivacyCenter/components/CaseDetailsModal.tsx +469 -0
- package/src/RedactoPrivacyCenter/components/CaseHistory.tsx +426 -0
- package/src/RedactoPrivacyCenter/components/ConsentManager.tsx +732 -0
- package/src/RedactoPrivacyCenter/components/ConsentManagerColumns.tsx +238 -0
- package/src/RedactoPrivacyCenter/components/ConsentManagerConstants.ts +7 -0
- package/src/RedactoPrivacyCenter/components/ConsentManagerTableSkeleton.tsx +155 -0
- package/src/RedactoPrivacyCenter/components/DataRequest/CorrectionDataSection.tsx +189 -0
- package/src/RedactoPrivacyCenter/components/DataRequest/GrievanceDataSection.tsx +118 -0
- package/src/RedactoPrivacyCenter/components/DataRequest/NominationDataSection.tsx +66 -0
- package/src/RedactoPrivacyCenter/components/DataRequest/PurposeSelectionSection.tsx +304 -0
- package/src/RedactoPrivacyCenter/components/Form.tsx +1596 -0
- package/src/RedactoPrivacyCenter/components/GrievanceTable.tsx +174 -0
- package/src/RedactoPrivacyCenter/components/GrievanceTablePagination.tsx +337 -0
- package/src/RedactoPrivacyCenter/components/ModifyConsentModal.tsx +330 -0
- package/src/RedactoPrivacyCenter/components/Pagination.tsx +140 -0
- package/src/RedactoPrivacyCenter/components/PrivacyCenterLayout.tsx +304 -0
- package/src/RedactoPrivacyCenter/components/RequestSubmit.tsx +232 -0
- package/src/RedactoPrivacyCenter/components/SideMenuBarPC/SideBarPC.tsx +475 -0
- package/src/RedactoPrivacyCenter/components/SideMenuBarPC/SideMenuPC.tsx +408 -0
- package/src/RedactoPrivacyCenter/components/SideMenuBarPC/constants.tsx +42 -0
- package/src/RedactoPrivacyCenter/components/SideMenuBarPC/menuItemsPC.tsx +1 -0
- package/src/RedactoPrivacyCenter/components/SideMenuBarPC/types.ts +40 -0
- package/src/RedactoPrivacyCenter/components/SideMenuBarPC/utils.ts +38 -0
- package/src/RedactoPrivacyCenter/components/ThemeTransitionOverlay.tsx +85 -0
- package/src/RedactoPrivacyCenter/components/activitiesColumns.tsx +141 -0
- package/src/RedactoPrivacyCenter/components/caseHistoryColumns.tsx +159 -0
- package/src/RedactoPrivacyCenter/components/constant.ts +16 -0
- package/src/RedactoPrivacyCenter/components/types.ts +76 -0
- package/src/RedactoPrivacyCenter/components/utils.tsx +10 -0
- package/src/RedactoPrivacyCenter/config/routes.ts +9 -0
- package/src/RedactoPrivacyCenter/config/table.ts +25 -0
- package/src/RedactoPrivacyCenter/context/AuthContext.tsx +137 -0
- package/src/RedactoPrivacyCenter/context/BaseUrlContext.tsx +41 -0
- package/src/RedactoPrivacyCenter/context/LocaleContext.tsx +11 -0
- package/src/RedactoPrivacyCenter/context/NavigationContext.tsx +96 -0
- package/src/RedactoPrivacyCenter/context/OrganizationContext.tsx +30 -0
- package/src/RedactoPrivacyCenter/context/PageChromeContext.tsx +60 -0
- package/src/RedactoPrivacyCenter/context/theme.tsx +127 -0
- package/src/RedactoPrivacyCenter/context/types.ts +14 -0
- package/src/RedactoPrivacyCenter/lib/api.ts +566 -0
- package/src/RedactoPrivacyCenter/lib/consent-manager/utils.tsx +63 -0
- package/src/RedactoPrivacyCenter/lib/constants.ts +161 -0
- package/src/RedactoPrivacyCenter/lib/i18n.ts +81 -0
- package/src/RedactoPrivacyCenter/lib/locales.ts +105 -0
- package/src/RedactoPrivacyCenter/lib/queries.ts +134 -0
- package/src/RedactoPrivacyCenter/lib/types.ts +531 -0
- package/src/RedactoPrivacyCenter/lib/useCurrentLanguage.ts +37 -0
- package/src/RedactoPrivacyCenter/lib/utils.ts +626 -0
- package/src/RedactoPrivacyCenter/locales/as/translation.json +280 -0
- package/src/RedactoPrivacyCenter/locales/bho/translation.json +280 -0
- package/src/RedactoPrivacyCenter/locales/bn/translation.json +280 -0
- package/src/RedactoPrivacyCenter/locales/brx/translation.json +280 -0
- package/src/RedactoPrivacyCenter/locales/doi/translation.json +280 -0
- package/src/RedactoPrivacyCenter/locales/en/translation.json +255 -0
- package/src/RedactoPrivacyCenter/locales/gom/translation.json +280 -0
- package/src/RedactoPrivacyCenter/locales/gu/translation.json +280 -0
- package/src/RedactoPrivacyCenter/locales/hi/translation.json +280 -0
- package/src/RedactoPrivacyCenter/locales/kn/translation.json +280 -0
- package/src/RedactoPrivacyCenter/locales/ks/translation.json +280 -0
- package/src/RedactoPrivacyCenter/locales/mai/translation.json +280 -0
- package/src/RedactoPrivacyCenter/locales/ml/translation.json +280 -0
- package/src/RedactoPrivacyCenter/locales/mni-Mtei/translation.json +280 -0
- package/src/RedactoPrivacyCenter/locales/mr/translation.json +280 -0
- package/src/RedactoPrivacyCenter/locales/ne/translation.json +280 -0
- package/src/RedactoPrivacyCenter/locales/or/translation.json +280 -0
- package/src/RedactoPrivacyCenter/locales/pa/translation.json +280 -0
- package/src/RedactoPrivacyCenter/locales/sa/translation.json +280 -0
- package/src/RedactoPrivacyCenter/locales/sat/translation.json +280 -0
- package/src/RedactoPrivacyCenter/locales/sd/translation.json +280 -0
- package/src/RedactoPrivacyCenter/locales/ta/translation.json +280 -0
- package/src/RedactoPrivacyCenter/locales/te/translation.json +280 -0
- package/src/RedactoPrivacyCenter/locales/ur/translation.json +280 -0
- package/src/RedactoPrivacyCenter/styles/base.css +117 -0
- package/src/RedactoPrivacyCenter/styles/injectStyles.ts +1725 -0
- package/src/RedactoPrivacyCenter/styles/pcStyles.ts +813 -0
- package/src/RedactoPrivacyCenter/styles/responsive.ts +138 -0
- package/src/RedactoPrivacyCenter/styles/variables.css +133 -0
- package/src/RedactoPrivacyCenter/table/AdvancedTable.tsx +367 -0
- package/src/RedactoPrivacyCenter/table/AdvancedTablePagination.tsx +476 -0
- package/src/RedactoPrivacyCenter/table/index.ts +2 -0
- package/src/RedactoPrivacyCenter/types/images.d.ts +29 -0
- package/src/RedactoPrivacyCenter/ui/Footer.tsx +75 -0
- package/src/RedactoPrivacyCenter/ui/FormBlockWrapper.tsx +54 -0
- package/src/RedactoPrivacyCenter/ui/PCAccordion.tsx +93 -0
- package/src/RedactoPrivacyCenter/ui/PCActionIcon.tsx +47 -0
- package/src/RedactoPrivacyCenter/ui/PCAvatar.tsx +69 -0
- package/src/RedactoPrivacyCenter/ui/PCBadge.tsx +48 -0
- package/src/RedactoPrivacyCenter/ui/PCButton.tsx +77 -0
- package/src/RedactoPrivacyCenter/ui/PCCheckbox.tsx +55 -0
- package/src/RedactoPrivacyCenter/ui/PCCollapse.tsx +107 -0
- package/src/RedactoPrivacyCenter/ui/PCEmpty.tsx +35 -0
- package/src/RedactoPrivacyCenter/ui/PCInput.tsx +132 -0
- package/src/RedactoPrivacyCenter/ui/PCLoader.tsx +31 -0
- package/src/RedactoPrivacyCenter/ui/PCModal.tsx +106 -0
- package/src/RedactoPrivacyCenter/ui/PCPopover.tsx +173 -0
- package/src/RedactoPrivacyCenter/ui/PCSelect.tsx +387 -0
- package/src/RedactoPrivacyCenter/ui/PCTable.tsx +149 -0
- package/src/RedactoPrivacyCenter/ui/PCText.tsx +41 -0
- package/src/RedactoPrivacyCenter/ui/PCTextarea.tsx +43 -0
- package/src/RedactoPrivacyCenter/ui/PCTitle.tsx +37 -0
- package/src/RedactoPrivacyCenter/ui/PCTooltip.tsx +119 -0
- package/src/RedactoPrivacyCenter/ui/SimpleBar.tsx +25 -0
- package/src/RedactoPrivacyCenter/ui/StatusBadge.tsx +53 -0
- package/src/RedactoPrivacyCenter/ui/ThemeToggle.tsx +72 -0
- package/src/RedactoPrivacyCenter/ui/index.ts +18 -0
- package/src/RedactoPrivacyCenter/utils/cn.ts +28 -0
- package/src/RedactoPrivacyCenter/utils/date.ts +48 -0
- package/src/RedactoPrivacyCenter/utils/status.ts +111 -0
- package/src/RedactoPrivacyCenter/utils/toast.ts +130 -0
- package/src/privacy-center.ts +108 -0
- package/tsconfig.json +2 -0
- package/tsup.config.ts +16 -1
- package/.turbo/turbo-build.log +0 -21
|
@@ -0,0 +1,531 @@
|
|
|
1
|
+
export type Workspace = {
|
|
2
|
+
uuid: string;
|
|
3
|
+
suid: string;
|
|
4
|
+
name: string;
|
|
5
|
+
description: string;
|
|
6
|
+
workspace_type: string;
|
|
7
|
+
status: string;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export type OrganizationDetail = {
|
|
11
|
+
uuid: string;
|
|
12
|
+
suid: string;
|
|
13
|
+
name: string;
|
|
14
|
+
slug: string;
|
|
15
|
+
description: string;
|
|
16
|
+
domain: string;
|
|
17
|
+
workspaces: Workspace[];
|
|
18
|
+
ai_summary: Record<string, unknown>;
|
|
19
|
+
icon_url: string | null;
|
|
20
|
+
activated: boolean;
|
|
21
|
+
allowed_domains: string[];
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export type OrganizationResponse = {
|
|
25
|
+
code: number;
|
|
26
|
+
status: string;
|
|
27
|
+
detail: OrganizationDetail;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export type DataElement = {
|
|
31
|
+
uuid: string;
|
|
32
|
+
name: string;
|
|
33
|
+
description: string;
|
|
34
|
+
enabled: boolean;
|
|
35
|
+
required: boolean;
|
|
36
|
+
given_consent: boolean;
|
|
37
|
+
selected: boolean;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export type Purpose = {
|
|
41
|
+
uuid: string;
|
|
42
|
+
name: string;
|
|
43
|
+
description: string;
|
|
44
|
+
industries: string;
|
|
45
|
+
selected: boolean;
|
|
46
|
+
given_consent: boolean;
|
|
47
|
+
data_elements: DataElement[];
|
|
48
|
+
status?: string;
|
|
49
|
+
validity?: number | null;
|
|
50
|
+
purpose_uuid?: string;
|
|
51
|
+
enabled?: boolean;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export type RawPurposeWrapper = {
|
|
55
|
+
purpose: Purpose;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export type GrievanceValue =
|
|
59
|
+
| 'consent_violation'
|
|
60
|
+
| 'unlawful_processing'
|
|
61
|
+
| 'data_breach';
|
|
62
|
+
|
|
63
|
+
export type GrievanceOptions = {
|
|
64
|
+
value: GrievanceValue;
|
|
65
|
+
label: string;
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
export type FormData = {
|
|
69
|
+
uuid: string;
|
|
70
|
+
name: string;
|
|
71
|
+
contact: string;
|
|
72
|
+
grievance_options: GrievanceOptions[];
|
|
73
|
+
purposes: RawPurposeWrapper[];
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
export type FormDataResponse = {
|
|
77
|
+
code: number;
|
|
78
|
+
detail: FormData;
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
export enum RequestTypeEnum {
|
|
82
|
+
ACCESS = 'ACCESS',
|
|
83
|
+
CORRECTION = 'CORRECTION',
|
|
84
|
+
ERASURE = 'erasure',
|
|
85
|
+
GRIEVANCE = 'grievance',
|
|
86
|
+
NOMINATION = 'nomination',
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export type NominationData = {
|
|
90
|
+
nominee_email: string;
|
|
91
|
+
nominee_mobile?: string;
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
export type UpdatePurpose = {
|
|
95
|
+
purpose_uuid: string;
|
|
96
|
+
data_element_uuids: string[];
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
export type UpdateCorrectionDataItem = {
|
|
100
|
+
name: string;
|
|
101
|
+
curr_value: string;
|
|
102
|
+
new_value: string;
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
export enum GrievanceTypeEnum {
|
|
106
|
+
CONSENT_VIOLATION = 'consent_violation',
|
|
107
|
+
UNLAWFUL_PROCESSING = 'unlawful_processing',
|
|
108
|
+
DATA_BREACH = 'data_breach',
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export type GrievanceTypeElement = {
|
|
112
|
+
grievance: GrievanceValue;
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
export type UpdateRequestDetails = {
|
|
116
|
+
purposes: UpdatePurpose[];
|
|
117
|
+
correction_data: UpdateCorrectionDataItem[];
|
|
118
|
+
grievance_types?: GrievanceTypeElement[];
|
|
119
|
+
nomination_data?: NominationData;
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
export type UserDataRequest = {
|
|
123
|
+
uuid: string;
|
|
124
|
+
name: string;
|
|
125
|
+
contact: string;
|
|
126
|
+
request_type: RequestTypeEnum;
|
|
127
|
+
supporting_docs_uuids: string[];
|
|
128
|
+
request_details: {
|
|
129
|
+
purposes: UpdatePurpose[];
|
|
130
|
+
correction_data: UpdateCorrectionDataItem[];
|
|
131
|
+
grievance_types: GrievanceTypeElement[];
|
|
132
|
+
nomination_data?: NominationData;
|
|
133
|
+
};
|
|
134
|
+
time_period: number | null;
|
|
135
|
+
requestor_note: string;
|
|
136
|
+
revoke_consent_on_fulfilment?: boolean;
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
export type CreateCaseResponse = {
|
|
140
|
+
code: number;
|
|
141
|
+
status: string;
|
|
142
|
+
detail: {
|
|
143
|
+
uuid: string;
|
|
144
|
+
case_id: string;
|
|
145
|
+
};
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
export type OtpResponse = {
|
|
149
|
+
uuid: string;
|
|
150
|
+
to: string;
|
|
151
|
+
channel: string;
|
|
152
|
+
expire_at: string;
|
|
153
|
+
success: boolean;
|
|
154
|
+
message: string;
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
export type OtpVerificationResponse = {
|
|
158
|
+
token: string;
|
|
159
|
+
success: boolean;
|
|
160
|
+
message: string;
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
export type TokenExchangeResponse = {
|
|
164
|
+
token: string;
|
|
165
|
+
refresh_token: string;
|
|
166
|
+
expires_at: string;
|
|
167
|
+
notice_uuid: string;
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
export type FetchOrgParams = {
|
|
171
|
+
slug?: string;
|
|
172
|
+
name?: string;
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
export type ConsentDataElement = {
|
|
176
|
+
uuid: string;
|
|
177
|
+
name: string;
|
|
178
|
+
enabled: boolean;
|
|
179
|
+
required: boolean;
|
|
180
|
+
selected: boolean;
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
export type UserConsent = {
|
|
184
|
+
purpose_uuid?: string;
|
|
185
|
+
purpose: string;
|
|
186
|
+
purpose_description: string;
|
|
187
|
+
status: ConsentStatusEnum;
|
|
188
|
+
given_date: string;
|
|
189
|
+
valid_till: string;
|
|
190
|
+
method: string;
|
|
191
|
+
data_elements: ConsentDataElement[];
|
|
192
|
+
product_uuid?: string;
|
|
193
|
+
product_name?: string;
|
|
194
|
+
product_description?: string | null;
|
|
195
|
+
nominator_info?: NominatorInfo;
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
export type NominatorInfo = {
|
|
199
|
+
org_user_id: string;
|
|
200
|
+
name: string | null;
|
|
201
|
+
uuid: string;
|
|
202
|
+
email: string | null;
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
export type ConsentHistoryStatusSummary = {
|
|
206
|
+
total_purposes: number;
|
|
207
|
+
direct_purposes: number;
|
|
208
|
+
nominated_purposes: number;
|
|
209
|
+
nominee_purposes?: number;
|
|
210
|
+
active_purposes: number;
|
|
211
|
+
inactive_purposes: number;
|
|
212
|
+
};
|
|
213
|
+
|
|
214
|
+
export type ProductConsentHistoryGroup = {
|
|
215
|
+
product_uuid: string;
|
|
216
|
+
product_name: string;
|
|
217
|
+
product_description: string | null;
|
|
218
|
+
purposes: UserConsent[];
|
|
219
|
+
total_purposes: number;
|
|
220
|
+
active_purposes: number;
|
|
221
|
+
};
|
|
222
|
+
|
|
223
|
+
export type NominatedPurposesGroup = {
|
|
224
|
+
nominator_info: NominatorInfo;
|
|
225
|
+
product_groups: ProductConsentHistoryGroup[];
|
|
226
|
+
};
|
|
227
|
+
|
|
228
|
+
export type Pagination = {
|
|
229
|
+
total_count: number;
|
|
230
|
+
offset: number;
|
|
231
|
+
limit: number;
|
|
232
|
+
};
|
|
233
|
+
|
|
234
|
+
export type UserConsentDetail = {
|
|
235
|
+
data?: UserConsent[];
|
|
236
|
+
product_purpose_groups?: ProductConsentHistoryGroup[];
|
|
237
|
+
pagination: Pagination;
|
|
238
|
+
direct_product_groups?: ProductConsentHistoryGroup[];
|
|
239
|
+
user_status?: 'ACTIVE' | 'TRANSFERRED' | null;
|
|
240
|
+
nominated_purposes?: NominatedPurposesGroup[];
|
|
241
|
+
nominators?: NominatorInfo[];
|
|
242
|
+
status_summary?: ConsentHistoryStatusSummary | null;
|
|
243
|
+
};
|
|
244
|
+
|
|
245
|
+
export type UserConsentResponse = {
|
|
246
|
+
code: number;
|
|
247
|
+
status: string;
|
|
248
|
+
detail: UserConsentDetail;
|
|
249
|
+
};
|
|
250
|
+
|
|
251
|
+
export enum ConsentStatusEnum {
|
|
252
|
+
ACTIVE = 'ACTIVE',
|
|
253
|
+
WITHDRAWN = 'WITHDRAW',
|
|
254
|
+
EXPIRED = 'EXPIRED',
|
|
255
|
+
DECLINED = 'DECLINED',
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
export type ConsentAction = 'revoke' | 'regrant' | 'renew';
|
|
259
|
+
|
|
260
|
+
export type ManageConsentResponse = {
|
|
261
|
+
code: number;
|
|
262
|
+
status: string;
|
|
263
|
+
detail: {
|
|
264
|
+
success: boolean;
|
|
265
|
+
};
|
|
266
|
+
};
|
|
267
|
+
|
|
268
|
+
export type ManageConsentParams = {
|
|
269
|
+
organizationId: string;
|
|
270
|
+
workspaceId: string;
|
|
271
|
+
purposeId: string;
|
|
272
|
+
contact: string;
|
|
273
|
+
action: ConsentAction;
|
|
274
|
+
nominatorContact?: string;
|
|
275
|
+
dataElementUuids?: string[];
|
|
276
|
+
};
|
|
277
|
+
|
|
278
|
+
export type GrievanceDataSectionProps = {
|
|
279
|
+
grievanceOptions: GrievanceOptions[];
|
|
280
|
+
selectedGrievances: Record<string, boolean>;
|
|
281
|
+
setSelectedGrievances: React.Dispatch<
|
|
282
|
+
React.SetStateAction<Record<string, boolean>>
|
|
283
|
+
>;
|
|
284
|
+
};
|
|
285
|
+
|
|
286
|
+
export type NominationDataSectionProps = {
|
|
287
|
+
nominationData: NominationData;
|
|
288
|
+
setNominationData: React.Dispatch<React.SetStateAction<NominationData>>;
|
|
289
|
+
isTranslating?: boolean;
|
|
290
|
+
};
|
|
291
|
+
|
|
292
|
+
export type Activity = {
|
|
293
|
+
activity_type: string;
|
|
294
|
+
activity_type_display?: string;
|
|
295
|
+
timestamp: string;
|
|
296
|
+
title: string;
|
|
297
|
+
title_display?: string;
|
|
298
|
+
description: string;
|
|
299
|
+
description_display?: string;
|
|
300
|
+
case_id?: string;
|
|
301
|
+
status?: 'Processing' | 'Completed' | 'Rejected';
|
|
302
|
+
status_display?: string;
|
|
303
|
+
};
|
|
304
|
+
|
|
305
|
+
export type ActivityDetail = {
|
|
306
|
+
data: Activity[];
|
|
307
|
+
pagination: Pagination;
|
|
308
|
+
};
|
|
309
|
+
|
|
310
|
+
export type ActivityResponse = {
|
|
311
|
+
code: number;
|
|
312
|
+
status: string;
|
|
313
|
+
detail: ActivityDetail;
|
|
314
|
+
};
|
|
315
|
+
|
|
316
|
+
export type ActivityBadgeStatus =
|
|
317
|
+
| 'success'
|
|
318
|
+
| 'warning'
|
|
319
|
+
| 'error'
|
|
320
|
+
| 'info'
|
|
321
|
+
| 'pending';
|
|
322
|
+
|
|
323
|
+
export type CaseRequestDetails = {
|
|
324
|
+
purposes: RawPurposeWrapper[];
|
|
325
|
+
correction_data: UpdateCorrectionDataItem[];
|
|
326
|
+
grievance_types?: GrievanceTypeElement[];
|
|
327
|
+
nomination_data?: NominationData;
|
|
328
|
+
};
|
|
329
|
+
|
|
330
|
+
export type CaseRequest = {
|
|
331
|
+
uuid: string;
|
|
332
|
+
case_id: string;
|
|
333
|
+
status: string;
|
|
334
|
+
status_display?: string;
|
|
335
|
+
request_type: string;
|
|
336
|
+
request_type_display?: string;
|
|
337
|
+
description: string;
|
|
338
|
+
description_display?: string;
|
|
339
|
+
created_at: string;
|
|
340
|
+
completed_at?: string;
|
|
341
|
+
due_date?: string;
|
|
342
|
+
request_details?: CaseRequestDetails;
|
|
343
|
+
};
|
|
344
|
+
|
|
345
|
+
export type RequestDetailsTabProps = {
|
|
346
|
+
selectedCase: CaseRequest;
|
|
347
|
+
request_details: CaseRequestDetails | undefined;
|
|
348
|
+
requestTypeLabel: string;
|
|
349
|
+
};
|
|
350
|
+
|
|
351
|
+
export type CaseHistoryDetail = {
|
|
352
|
+
data: CaseRequest[];
|
|
353
|
+
pagination: Pagination;
|
|
354
|
+
};
|
|
355
|
+
|
|
356
|
+
export type CaseHistoryResponse = {
|
|
357
|
+
code: number;
|
|
358
|
+
status: string;
|
|
359
|
+
detail: CaseRequest[];
|
|
360
|
+
};
|
|
361
|
+
|
|
362
|
+
// ─── Case Communication ──────────────────────────────────────────────────────
|
|
363
|
+
|
|
364
|
+
export type MessageType =
|
|
365
|
+
| 'message_sent'
|
|
366
|
+
| 'document_requested'
|
|
367
|
+
| 'document_submitted'
|
|
368
|
+
| 'document_replaced'
|
|
369
|
+
| 'document_replacement_requested'
|
|
370
|
+
| 'document_approved'
|
|
371
|
+
| 'document_rejected';
|
|
372
|
+
|
|
373
|
+
export type DocumentRequestStatus =
|
|
374
|
+
| 'pending'
|
|
375
|
+
| 'under_review'
|
|
376
|
+
| 'approved'
|
|
377
|
+
| 'rejected'
|
|
378
|
+
| 'replacement_requested';
|
|
379
|
+
|
|
380
|
+
export type FileUrlMap = {
|
|
381
|
+
url?: string;
|
|
382
|
+
download_url?: string;
|
|
383
|
+
};
|
|
384
|
+
|
|
385
|
+
export type MessageDocument = {
|
|
386
|
+
uuid: string;
|
|
387
|
+
file_name: string | null;
|
|
388
|
+
content_type: string | null;
|
|
389
|
+
file_size: number | null;
|
|
390
|
+
file_url: FileUrlMap | null;
|
|
391
|
+
};
|
|
392
|
+
|
|
393
|
+
export type DocumentRequestMetadata = {
|
|
394
|
+
title: string;
|
|
395
|
+
accepted_document: string;
|
|
396
|
+
document_request_status: DocumentRequestStatus;
|
|
397
|
+
document_request_uuid: string | null;
|
|
398
|
+
rejection_reason: string;
|
|
399
|
+
};
|
|
400
|
+
|
|
401
|
+
export type CaseMessage = {
|
|
402
|
+
uuid: string;
|
|
403
|
+
case_uuid: string;
|
|
404
|
+
sender_role: 'data_fiduciary' | 'data_principal';
|
|
405
|
+
triggered_by_email: string;
|
|
406
|
+
created_at: string;
|
|
407
|
+
body: string;
|
|
408
|
+
document_uuids: string[];
|
|
409
|
+
documents: MessageDocument[];
|
|
410
|
+
message_type: MessageType;
|
|
411
|
+
document_request_metadata: DocumentRequestMetadata | null;
|
|
412
|
+
};
|
|
413
|
+
|
|
414
|
+
export type TabId = 'messages' | 'request-details';
|
|
415
|
+
|
|
416
|
+
export type PendingUpload = { uuid: string; file_name: string; file_size: number };
|
|
417
|
+
|
|
418
|
+
// ─── Case Communication server action params ────────────────────────────────
|
|
419
|
+
|
|
420
|
+
export type CaseActionBaseParams = {
|
|
421
|
+
organizationId: string;
|
|
422
|
+
workspaceId: string;
|
|
423
|
+
caseUuid: string;
|
|
424
|
+
authToken?: string;
|
|
425
|
+
consentClient?: ReturnType<typeof import('../api/client').createConsentClient>;
|
|
426
|
+
};
|
|
427
|
+
|
|
428
|
+
export type GetCaseMessagesParams = CaseActionBaseParams;
|
|
429
|
+
|
|
430
|
+
export type SendCaseMessageParams = CaseActionBaseParams & {
|
|
431
|
+
body: string;
|
|
432
|
+
documentUuids: string[];
|
|
433
|
+
};
|
|
434
|
+
|
|
435
|
+
export type UploadCaseDocumentParams = CaseActionBaseParams & {
|
|
436
|
+
file: File;
|
|
437
|
+
};
|
|
438
|
+
|
|
439
|
+
export type SubmitDocumentForRequestParams = CaseActionBaseParams & {
|
|
440
|
+
requestEventUuid: string;
|
|
441
|
+
documentUuid: string;
|
|
442
|
+
body: string;
|
|
443
|
+
};
|
|
444
|
+
|
|
445
|
+
export type GetCaseDocumentParams = CaseActionBaseParams & {
|
|
446
|
+
documentUuid: string;
|
|
447
|
+
};
|
|
448
|
+
|
|
449
|
+
export type UploadDocumentResponse = {
|
|
450
|
+
uuid: string;
|
|
451
|
+
suid: string;
|
|
452
|
+
file_name: string;
|
|
453
|
+
file_type: string;
|
|
454
|
+
content_type: string;
|
|
455
|
+
file_size: number;
|
|
456
|
+
created_at: string;
|
|
457
|
+
is_public: boolean;
|
|
458
|
+
file: string;
|
|
459
|
+
file_hash: string | null;
|
|
460
|
+
status: string;
|
|
461
|
+
allow_ai_processing: boolean;
|
|
462
|
+
metadata: Record<string, string> | null;
|
|
463
|
+
};
|
|
464
|
+
|
|
465
|
+
export type MessageItemProps = Readonly<{
|
|
466
|
+
message: CaseMessage;
|
|
467
|
+
onUploadForRequest: (requestEventUuid: string) => void;
|
|
468
|
+
isSubmittingForRequest: boolean;
|
|
469
|
+
}>;
|
|
470
|
+
|
|
471
|
+
export type ChatBubbleProps = Readonly<{
|
|
472
|
+
message: CaseMessage;
|
|
473
|
+
isPrincipal: boolean;
|
|
474
|
+
senderLabel: string;
|
|
475
|
+
timestamp: string;
|
|
476
|
+
}>;
|
|
477
|
+
|
|
478
|
+
export type AttachmentCardProps = Readonly<{
|
|
479
|
+
doc: MessageDocument;
|
|
480
|
+
}>
|
|
481
|
+
|
|
482
|
+
export type DocumentRequestCardProps = Readonly<{
|
|
483
|
+
message: CaseMessage;
|
|
484
|
+
onUpload: (requestEventUuid: string) => void;
|
|
485
|
+
isSubmitting: boolean;
|
|
486
|
+
}>
|
|
487
|
+
|
|
488
|
+
export type StatusEventProps = Readonly<{
|
|
489
|
+
icon: React.ReactNode;
|
|
490
|
+
color: string;
|
|
491
|
+
bgColor: string;
|
|
492
|
+
borderColor: string;
|
|
493
|
+
text: string;
|
|
494
|
+
subText?: string;
|
|
495
|
+
timestamp: string;
|
|
496
|
+
}>;
|
|
497
|
+
|
|
498
|
+
export type MessagesTabProps = Readonly<{
|
|
499
|
+
caseUuid: string;
|
|
500
|
+
}>;
|
|
501
|
+
|
|
502
|
+
export type MessageComposerProps = Readonly<{
|
|
503
|
+
messageText: string;
|
|
504
|
+
onMessageTextChange: (text: string) => void;
|
|
505
|
+
pendingUpload: PendingUpload | null;
|
|
506
|
+
onRemovePendingUpload: () => void;
|
|
507
|
+
onAttachClick: () => void;
|
|
508
|
+
onSend: () => void;
|
|
509
|
+
isSending: boolean;
|
|
510
|
+
isUploading: boolean;
|
|
511
|
+
}>;
|
|
512
|
+
|
|
513
|
+
export type CaseStatusVariant =
|
|
514
|
+
| 'success'
|
|
515
|
+
| 'error'
|
|
516
|
+
| 'warning'
|
|
517
|
+
| 'info'
|
|
518
|
+
| 'secondary';
|
|
519
|
+
|
|
520
|
+
|
|
521
|
+
export type SendCaseMessageInput = Readonly<{
|
|
522
|
+
body: string; documentUuids: string[]
|
|
523
|
+
}>;
|
|
524
|
+
|
|
525
|
+
export type SubmitDocumentForRequestInput = Readonly<{
|
|
526
|
+
requestEventUuid: string; documentUuid: string; body: string
|
|
527
|
+
}>;
|
|
528
|
+
|
|
529
|
+
export type DocumentRequestStatusInfo = Readonly<{ labelKey: string; color: string }>;
|
|
530
|
+
|
|
531
|
+
export type CaseDetailsTab = Readonly<{ id: TabId; label: string }>;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { useSyncExternalStore, useCallback } from 'react';
|
|
2
|
+
import i18n from './i18n';
|
|
3
|
+
|
|
4
|
+
const DEFAULT_LANGUAGE = 'en';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Returns the language query param to send to the API.
|
|
8
|
+
* Returns `undefined` for the default language (English) so that
|
|
9
|
+
* existing un-localised behaviour is preserved.
|
|
10
|
+
*/
|
|
11
|
+
export function getLangParam(language: string): string | undefined {
|
|
12
|
+
return language !== DEFAULT_LANGUAGE ? language : undefined;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* React hook that subscribes to i18next language changes.
|
|
17
|
+
* Returns `{ currentLanguage, langParam }` where `langParam`
|
|
18
|
+
* is `undefined` for the default language.
|
|
19
|
+
*
|
|
20
|
+
* Unlike reading `i18n.language` directly, this hook triggers a
|
|
21
|
+
* component re-render whenever the language changes.
|
|
22
|
+
*/
|
|
23
|
+
export function useCurrentLanguage() {
|
|
24
|
+
const subscribe = useCallback((onStoreChange: () => void) => {
|
|
25
|
+
i18n.on('languageChanged', onStoreChange);
|
|
26
|
+
return () => {
|
|
27
|
+
i18n.off('languageChanged', onStoreChange);
|
|
28
|
+
};
|
|
29
|
+
}, []);
|
|
30
|
+
|
|
31
|
+
const getSnapshot = useCallback(() => i18n.language, []);
|
|
32
|
+
|
|
33
|
+
const currentLanguage = useSyncExternalStore(subscribe, getSnapshot, getSnapshot);
|
|
34
|
+
const langParam = getLangParam(currentLanguage);
|
|
35
|
+
|
|
36
|
+
return { currentLanguage, langParam };
|
|
37
|
+
}
|