@redacto.io/consent-sdk-react 10.0.0-beta.0 → 10.0.0-beta.11
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/.turbo/turbo-build.log +22 -25
- package/CHANGELOG.md +123 -0
- package/README.md +78 -0
- package/dist/{chunk-6A665OPR.mjs → chunk-OGL6OC3A.mjs} +4 -0
- package/dist/index.d.mts +43 -8
- package/dist/index.d.ts +43 -8
- package/dist/index.js +345 -237
- package/dist/index.mjs +344 -238
- package/dist/privacy-center.d.mts +113 -37
- package/dist/privacy-center.d.ts +113 -37
- package/dist/privacy-center.js +2317 -1910
- package/dist/privacy-center.mjs +2245 -1835
- package/package.json +1 -1
- package/src/RedactoNoticeAssisted/RedactoNoticeAssisted.test.tsx +87 -0
- package/src/RedactoNoticeAssisted/RedactoNoticeAssisted.tsx +27 -0
- package/src/RedactoNoticeAssisted/api/index.ts +7 -1
- package/src/RedactoNoticeAssisted/api/types.ts +2 -0
- package/src/RedactoNoticeAssisted/i18n.ts +0 -55
- package/src/RedactoNoticeAssisted/types.ts +2 -0
- package/src/RedactoNoticeConsent/RedactoNoticeConsent.test.tsx +42 -8
- package/src/RedactoNoticeConsent/RedactoNoticeConsent.tsx +75 -33
- package/src/RedactoNoticeConsent/api/index.ts +90 -177
- package/src/RedactoNoticeConsent/api/sandbox.ts +150 -0
- package/src/RedactoNoticeConsent/api/types.ts +60 -44
- package/src/RedactoNoticeConsent/language-codes.ts +0 -2
- package/src/RedactoNoticeConsent/types.ts +29 -3
- package/src/RedactoNoticeConsentInline/RedactoNoticeConsentInline.tsx +86 -5
- package/src/RedactoNoticeConsentInline/api/index.ts +14 -5
- package/src/RedactoNoticeConsentInline/api/notice-read-routing.test.ts +72 -0
- package/src/RedactoNoticeConsentInline/api/types.ts +4 -1
- package/src/RedactoNoticeConsentInline/types.ts +1 -1
- package/src/RedactoPrivacyCenter/PrivacyCenterLayout.tsx +8 -5
- package/src/RedactoPrivacyCenter/RedactoPrivacyCenter.tsx +38 -3
- package/src/RedactoPrivacyCenter/api/actions.ts +13 -5
- package/src/RedactoPrivacyCenter/api/client.ts +216 -39
- package/src/RedactoPrivacyCenter/api/fetcher.ts +24 -9
- package/src/RedactoPrivacyCenter/components/AppShell/AppShell.tsx +28 -0
- package/src/RedactoPrivacyCenter/components/AppShell/UserMenu.tsx +107 -76
- package/src/RedactoPrivacyCenter/components/ConsentManager.tsx +2 -1
- package/src/RedactoPrivacyCenter/components/Form.tsx +53 -24
- package/src/RedactoPrivacyCenter/components/ModifyConsentModal.tsx +1 -1
- package/src/RedactoPrivacyCenter/components/SelectUser.tsx +95 -0
- package/src/RedactoPrivacyCenter/components/SelectUserGate.tsx +195 -0
- package/src/RedactoPrivacyCenter/components/constant.ts +11 -0
- package/src/RedactoPrivacyCenter/components/groupHelpers.ts +42 -6
- package/src/RedactoPrivacyCenter/context/AuthContext.tsx +131 -39
- package/src/RedactoPrivacyCenter/context/BaseUrlContext.tsx +1 -1
- package/src/RedactoPrivacyCenter/context/ProfileSwitchContext.tsx +15 -0
- package/src/RedactoPrivacyCenter/context/types.ts +39 -1
- package/src/RedactoPrivacyCenter/lib/api.ts +3 -0
- package/src/RedactoPrivacyCenter/lib/constants.ts +12 -6
- package/src/RedactoPrivacyCenter/lib/locales.ts +0 -3
- package/src/RedactoPrivacyCenter/lib/sandbox.ts +104 -0
- package/src/RedactoPrivacyCenter/lib/types.ts +78 -2
- package/src/RedactoPrivacyCenter/lib/utils.ts +15 -0
- package/src/RedactoPrivacyCenter/locales/as/translation.json +7 -1
- package/src/RedactoPrivacyCenter/locales/bn/translation.json +7 -1
- package/src/RedactoPrivacyCenter/locales/brx/translation.json +7 -1
- package/src/RedactoPrivacyCenter/locales/doi/translation.json +7 -1
- package/src/RedactoPrivacyCenter/locales/en/translation.json +8 -1
- package/src/RedactoPrivacyCenter/locales/gom/translation.json +7 -1
- package/src/RedactoPrivacyCenter/locales/gu/translation.json +7 -1
- package/src/RedactoPrivacyCenter/locales/hi/translation.json +7 -1
- package/src/RedactoPrivacyCenter/locales/kn/translation.json +7 -1
- package/src/RedactoPrivacyCenter/locales/ks/translation.json +7 -1
- package/src/RedactoPrivacyCenter/locales/mai/translation.json +7 -1
- package/src/RedactoPrivacyCenter/locales/ml/translation.json +7 -1
- package/src/RedactoPrivacyCenter/locales/mni-Mtei/translation.json +7 -1
- package/src/RedactoPrivacyCenter/locales/mr/translation.json +7 -1
- package/src/RedactoPrivacyCenter/locales/ne/translation.json +7 -1
- package/src/RedactoPrivacyCenter/locales/or/translation.json +7 -1
- package/src/RedactoPrivacyCenter/locales/pa/translation.json +7 -1
- package/src/RedactoPrivacyCenter/locales/sa/translation.json +7 -1
- package/src/RedactoPrivacyCenter/locales/sat/translation.json +7 -1
- package/src/RedactoPrivacyCenter/locales/sd/translation.json +7 -1
- package/src/RedactoPrivacyCenter/locales/ta/translation.json +7 -1
- package/src/RedactoPrivacyCenter/locales/te/translation.json +7 -1
- package/src/RedactoPrivacyCenter/locales/ur/translation.json +7 -1
- package/src/RedactoPrivacyCenter/styles/injectStyles.ts +112 -2
- package/src/RedactoPrivacyCenter/styles/pcStyles.ts +17 -0
- package/src/RedactoPrivacyCenter/ui/PCAvatar.test.tsx +83 -0
- package/src/RedactoPrivacyCenter/ui/PCAvatar.tsx +33 -9
- package/src/shared/notice-consent-status.ts +190 -0
- package/src/shared/sandbox.ts +6 -0
- package/tests/Form.test.tsx +190 -7
- package/tests/RevokeWarningMessage.test.tsx +151 -0
- package/tests/consentClient.test.ts +217 -0
- package/tests/manageConsentServer.test.ts +38 -0
- package/src/RedactoPrivacyCenter/locales/bho/translation.json +0 -334
package/dist/index.js
CHANGED
|
@@ -32,7 +32,7 @@ module.exports = __toCommonJS(src_exports);
|
|
|
32
32
|
var import_react2 = require("react");
|
|
33
33
|
|
|
34
34
|
// src/RedactoNoticeConsent/api/index.ts
|
|
35
|
-
var
|
|
35
|
+
var import_jwt_decode2 = require("jwt-decode");
|
|
36
36
|
|
|
37
37
|
// src/shared/api-errors.ts
|
|
38
38
|
var ApiError = class extends Error {
|
|
@@ -92,6 +92,144 @@ async function parseApiError(response, fallbackMessage) {
|
|
|
92
92
|
});
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
+
// src/shared/sandbox.ts
|
|
96
|
+
var SANDBOX_TOKEN_HEADER = "X-Consent-Token";
|
|
97
|
+
|
|
98
|
+
// src/RedactoNoticeConsent/api/sandbox.ts
|
|
99
|
+
var resolveSandboxAuth = (params) => {
|
|
100
|
+
var _a, _b, _c, _d, _e;
|
|
101
|
+
const token = (_a = params.token) == null ? void 0 : _a.trim();
|
|
102
|
+
if (!token) {
|
|
103
|
+
return null;
|
|
104
|
+
}
|
|
105
|
+
const organisationUuid = (_b = params.organisationUuid) == null ? void 0 : _b.trim();
|
|
106
|
+
const workspaceUuid = (_c = params.workspaceUuid) == null ? void 0 : _c.trim();
|
|
107
|
+
const ucic = (_d = params.sandboxUcic) == null ? void 0 : _d.trim();
|
|
108
|
+
const subject = (_e = params.sandboxSubject) == null ? void 0 : _e.trim();
|
|
109
|
+
if (!organisationUuid || !workspaceUuid) {
|
|
110
|
+
throw new Error(
|
|
111
|
+
"Sandbox mode requires organisationUuid and workspaceUuid props"
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
if (!ucic && !subject) {
|
|
115
|
+
throw new Error("Sandbox mode requires a UCIC, email, or mobile");
|
|
116
|
+
}
|
|
117
|
+
return { token, ucic, subject: subject != null ? subject : "", organisationUuid, workspaceUuid };
|
|
118
|
+
};
|
|
119
|
+
var resolveRequestAuth = (accessToken, sandboxParams, decodeTokenSafely2) => {
|
|
120
|
+
const sandbox = resolveSandboxAuth(sandboxParams);
|
|
121
|
+
if (sandbox) {
|
|
122
|
+
return {
|
|
123
|
+
organisationUuid: sandbox.organisationUuid,
|
|
124
|
+
workspaceUuid: sandbox.workspaceUuid,
|
|
125
|
+
sandbox
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
const decodedToken = accessToken ? decodeTokenSafely2(accessToken) : null;
|
|
129
|
+
if (!decodedToken) {
|
|
130
|
+
throw new Error("Invalid access token");
|
|
131
|
+
}
|
|
132
|
+
const { organisation_uuid, workspace_uuid } = decodedToken;
|
|
133
|
+
if (!organisation_uuid || !workspace_uuid) {
|
|
134
|
+
throw new Error("Invalid token: missing organization or workspace UUID");
|
|
135
|
+
}
|
|
136
|
+
return {
|
|
137
|
+
organisationUuid: organisation_uuid,
|
|
138
|
+
workspaceUuid: workspace_uuid,
|
|
139
|
+
sandbox: null
|
|
140
|
+
};
|
|
141
|
+
};
|
|
142
|
+
var buildAuthHeaders = (accessToken, sandbox) => {
|
|
143
|
+
if (sandbox) {
|
|
144
|
+
return { [SANDBOX_TOKEN_HEADER]: sandbox.token };
|
|
145
|
+
}
|
|
146
|
+
return { Authorization: `Bearer ${accessToken}` };
|
|
147
|
+
};
|
|
148
|
+
var sandboxBodyIdentity = (sandbox) => {
|
|
149
|
+
if (sandbox.ucic) {
|
|
150
|
+
return { org_user_id: sandbox.ucic };
|
|
151
|
+
}
|
|
152
|
+
return sandbox.subject.includes("@") ? { primary_email: sandbox.subject } : { primary_mobile: sandbox.subject };
|
|
153
|
+
};
|
|
154
|
+
var sandboxQueryIdentity = (sandbox) => sandboxBodyIdentity(sandbox);
|
|
155
|
+
|
|
156
|
+
// src/shared/notice-consent-status.ts
|
|
157
|
+
var import_jwt_decode = require("jwt-decode");
|
|
158
|
+
var decodeNoticeConsentToken = (token) => {
|
|
159
|
+
try {
|
|
160
|
+
return (0, import_jwt_decode.jwtDecode)(token);
|
|
161
|
+
} catch {
|
|
162
|
+
return null;
|
|
163
|
+
}
|
|
164
|
+
};
|
|
165
|
+
var fetchNoticeConsentStatusForScope = async ({
|
|
166
|
+
accessToken,
|
|
167
|
+
ledgerBaseUrl,
|
|
168
|
+
organisationUuid,
|
|
169
|
+
workspaceUuid,
|
|
170
|
+
noticeUuid,
|
|
171
|
+
signal
|
|
172
|
+
}) => {
|
|
173
|
+
if (!accessToken || !ledgerBaseUrl || !organisationUuid || !workspaceUuid || !noticeUuid) {
|
|
174
|
+
return null;
|
|
175
|
+
}
|
|
176
|
+
try {
|
|
177
|
+
const response = await fetch(
|
|
178
|
+
`${ledgerBaseUrl}/public/organisations/${organisationUuid}/workspaces/${workspaceUuid}/notices/${noticeUuid}/check-consent`,
|
|
179
|
+
{
|
|
180
|
+
method: "POST",
|
|
181
|
+
headers: {
|
|
182
|
+
Authorization: `Bearer ${accessToken}`,
|
|
183
|
+
"Content-Type": "application/json"
|
|
184
|
+
},
|
|
185
|
+
body: "{}",
|
|
186
|
+
signal
|
|
187
|
+
}
|
|
188
|
+
);
|
|
189
|
+
if (!response.ok) {
|
|
190
|
+
return null;
|
|
191
|
+
}
|
|
192
|
+
const data = await response.json();
|
|
193
|
+
const body = data && typeof data === "object" && "detail" in data && data.detail ? data.detail : data;
|
|
194
|
+
if (!body || !Array.isArray(body.purposes)) {
|
|
195
|
+
return null;
|
|
196
|
+
}
|
|
197
|
+
return body;
|
|
198
|
+
} catch {
|
|
199
|
+
return null;
|
|
200
|
+
}
|
|
201
|
+
};
|
|
202
|
+
var fetchNoticeConsentStatus = async ({
|
|
203
|
+
accessToken,
|
|
204
|
+
ledgerBaseUrl,
|
|
205
|
+
noticeUuid,
|
|
206
|
+
signal
|
|
207
|
+
}) => {
|
|
208
|
+
if (!accessToken || !ledgerBaseUrl || !noticeUuid) {
|
|
209
|
+
return null;
|
|
210
|
+
}
|
|
211
|
+
const decodedToken = decodeNoticeConsentToken(accessToken);
|
|
212
|
+
if (!decodedToken) {
|
|
213
|
+
return null;
|
|
214
|
+
}
|
|
215
|
+
const {
|
|
216
|
+
organisation_uuid: ORGANISATION_UUID,
|
|
217
|
+
workspace_uuid: WORKSPACE_UUID
|
|
218
|
+
} = decodedToken;
|
|
219
|
+
if (!ORGANISATION_UUID || !WORKSPACE_UUID) {
|
|
220
|
+
return null;
|
|
221
|
+
}
|
|
222
|
+
return fetchNoticeConsentStatusForScope({
|
|
223
|
+
accessToken,
|
|
224
|
+
ledgerBaseUrl,
|
|
225
|
+
organisationUuid: ORGANISATION_UUID,
|
|
226
|
+
workspaceUuid: WORKSPACE_UUID,
|
|
227
|
+
noticeUuid,
|
|
228
|
+
signal
|
|
229
|
+
});
|
|
230
|
+
};
|
|
231
|
+
var isNoticeFullyConsented = (status) => status.consented && status.all_mandatory_active;
|
|
232
|
+
|
|
95
233
|
// src/RedactoNoticeConsent/api/index.ts
|
|
96
234
|
var BASE_URL = "https://api.redacto.io/consent";
|
|
97
235
|
var apiCache = /* @__PURE__ */ new Map();
|
|
@@ -111,7 +249,7 @@ function setCachedData(key, data, ttl = CACHE_TTL) {
|
|
|
111
249
|
}
|
|
112
250
|
function decodeTokenSafely(token) {
|
|
113
251
|
try {
|
|
114
|
-
return (0,
|
|
252
|
+
return (0, import_jwt_decode2.jwtDecode)(token);
|
|
115
253
|
} catch (error) {
|
|
116
254
|
console.warn("Failed to decode JWT token:", error);
|
|
117
255
|
return null;
|
|
@@ -128,21 +266,19 @@ var fetchConsentContent = async ({
|
|
|
128
266
|
specific_uuid,
|
|
129
267
|
validate_against = "all",
|
|
130
268
|
include_fully_consented_data = false,
|
|
131
|
-
signal
|
|
269
|
+
signal,
|
|
270
|
+
...sandboxParams
|
|
132
271
|
}) => {
|
|
133
|
-
if (!noticeId || !
|
|
134
|
-
throw new Error("noticeId
|
|
135
|
-
}
|
|
136
|
-
const decodedToken = decodeTokenSafely(accessToken);
|
|
137
|
-
if (!decodedToken) {
|
|
138
|
-
throw new Error("Invalid access token");
|
|
272
|
+
if (!noticeId || !validate_against) {
|
|
273
|
+
throw new Error("noticeId is required");
|
|
139
274
|
}
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
throw new Error("Invalid token: missing organization or workspace UUID");
|
|
275
|
+
if (!accessToken && !sandboxParams.token) {
|
|
276
|
+
throw new Error("accessToken or token is required");
|
|
143
277
|
}
|
|
278
|
+
const { organisationUuid: ORGANISATION_UUID, workspaceUuid: WORKSPACE_UUID, sandbox } = resolveRequestAuth(accessToken, sandboxParams, decodeTokenSafely);
|
|
144
279
|
const apiBaseUrl = baseUrl || BASE_URL;
|
|
145
|
-
const
|
|
280
|
+
const cacheIdentity = sandbox ? `sandbox:${sandbox.organisationUuid}:${sandbox.workspaceUuid}:${sandbox.ucic || sandbox.subject}` : accessToken;
|
|
281
|
+
const cacheKey = `${cacheIdentity}-${noticeId}-${validate_against}-${language}-${specific_uuid || ""}-${include_fully_consented_data}`;
|
|
146
282
|
if (validate_against === "all" && !specific_uuid) {
|
|
147
283
|
const cachedData = getCachedData(cacheKey);
|
|
148
284
|
if (cachedData) {
|
|
@@ -159,10 +295,15 @@ var fetchConsentContent = async ({
|
|
|
159
295
|
if (include_fully_consented_data) {
|
|
160
296
|
url.searchParams.append("include_fully_consented_data", "true");
|
|
161
297
|
}
|
|
298
|
+
if (sandbox) {
|
|
299
|
+
for (const [key, value] of Object.entries(sandboxQueryIdentity(sandbox))) {
|
|
300
|
+
url.searchParams.append(key, value);
|
|
301
|
+
}
|
|
302
|
+
}
|
|
162
303
|
const response = await fetch(url.toString(), {
|
|
163
304
|
method: "GET",
|
|
164
305
|
headers: {
|
|
165
|
-
|
|
306
|
+
...buildAuthHeaders(accessToken, sandbox),
|
|
166
307
|
"Accept-Language": language
|
|
167
308
|
},
|
|
168
309
|
signal
|
|
@@ -181,6 +322,7 @@ var fetchConsentContent = async ({
|
|
|
181
322
|
};
|
|
182
323
|
var submitConsentEvent = async ({
|
|
183
324
|
accessToken,
|
|
325
|
+
baseUrl,
|
|
184
326
|
ledgerBaseUrl,
|
|
185
327
|
noticeUuid,
|
|
186
328
|
purposes,
|
|
@@ -189,23 +331,17 @@ var submitConsentEvent = async ({
|
|
|
189
331
|
meta_data,
|
|
190
332
|
guardianVerificationReference,
|
|
191
333
|
selfDeclaredAdult,
|
|
192
|
-
signal
|
|
334
|
+
signal,
|
|
335
|
+
...sandboxParams
|
|
193
336
|
}) => {
|
|
194
|
-
if (!noticeUuid || !
|
|
195
|
-
throw new Error("noticeUuid
|
|
337
|
+
if (!noticeUuid || !Array.isArray(purposes)) {
|
|
338
|
+
throw new Error("noticeUuid and purposes array are required");
|
|
196
339
|
}
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
throw new Error("Invalid access token");
|
|
340
|
+
if (!accessToken && !sandboxParams.token) {
|
|
341
|
+
throw new Error("accessToken or token is required");
|
|
200
342
|
}
|
|
201
|
-
const {
|
|
202
|
-
|
|
203
|
-
throw new Error("Invalid token: missing organization or workspace UUID");
|
|
204
|
-
}
|
|
205
|
-
if (!ledgerBaseUrl) {
|
|
206
|
-
throw new Error("ledgerBaseUrl is required to submit consent");
|
|
207
|
-
}
|
|
208
|
-
const apiBaseUrl = ledgerBaseUrl;
|
|
343
|
+
const { organisationUuid: ORGANISATION_UUID, workspaceUuid: WORKSPACE_UUID, sandbox } = resolveRequestAuth(accessToken, sandboxParams, decodeTokenSafely);
|
|
344
|
+
const apiBaseUrl = (sandbox ? null : ledgerBaseUrl) || baseUrl || BASE_URL;
|
|
209
345
|
const validatedPurposes = purposes.map((purpose) => {
|
|
210
346
|
if (!purpose.uuid) {
|
|
211
347
|
throw new Error(`Invalid purpose data: missing uuid`);
|
|
@@ -231,15 +367,16 @@ var submitConsentEvent = async ({
|
|
|
231
367
|
guardian_verification_reference: guardianVerificationReference,
|
|
232
368
|
self_declared_adult: selfDeclaredAdult
|
|
233
369
|
};
|
|
370
|
+
const requestBody = sandbox ? { ...payload, ...sandboxBodyIdentity(sandbox) } : payload;
|
|
234
371
|
const response = await fetch(
|
|
235
372
|
`${apiBaseUrl}/public/organisations/${ORGANISATION_UUID}/workspaces/${WORKSPACE_UUID}/submit-consent`,
|
|
236
373
|
{
|
|
237
374
|
method: "POST",
|
|
238
375
|
headers: {
|
|
239
|
-
|
|
376
|
+
...buildAuthHeaders(accessToken, sandbox),
|
|
240
377
|
"Content-Type": "application/json"
|
|
241
378
|
},
|
|
242
|
-
body: JSON.stringify(
|
|
379
|
+
body: JSON.stringify(requestBody),
|
|
243
380
|
signal
|
|
244
381
|
}
|
|
245
382
|
);
|
|
@@ -251,112 +388,32 @@ var submitConsentEvent = async ({
|
|
|
251
388
|
}
|
|
252
389
|
apiCache.clear();
|
|
253
390
|
};
|
|
254
|
-
var fetchNoticeConsentStatus = async ({
|
|
255
|
-
accessToken,
|
|
256
|
-
ledgerBaseUrl,
|
|
257
|
-
noticeUuid,
|
|
258
|
-
signal
|
|
259
|
-
}) => {
|
|
260
|
-
if (!accessToken || !ledgerBaseUrl || !noticeUuid) {
|
|
261
|
-
return null;
|
|
262
|
-
}
|
|
263
|
-
const decodedToken = decodeTokenSafely(accessToken);
|
|
264
|
-
if (!decodedToken) {
|
|
265
|
-
return null;
|
|
266
|
-
}
|
|
267
|
-
const { organisation_uuid: ORGANISATION_UUID, workspace_uuid: WORKSPACE_UUID } = decodedToken;
|
|
268
|
-
if (!ORGANISATION_UUID || !WORKSPACE_UUID) {
|
|
269
|
-
return null;
|
|
270
|
-
}
|
|
271
|
-
try {
|
|
272
|
-
const response = await fetch(
|
|
273
|
-
`${ledgerBaseUrl}/public/organisations/${ORGANISATION_UUID}/workspaces/${WORKSPACE_UUID}/notices/${noticeUuid}/check-consent`,
|
|
274
|
-
{
|
|
275
|
-
method: "POST",
|
|
276
|
-
headers: {
|
|
277
|
-
Authorization: `Bearer ${accessToken}`,
|
|
278
|
-
"Content-Type": "application/json"
|
|
279
|
-
},
|
|
280
|
-
body: "{}",
|
|
281
|
-
signal
|
|
282
|
-
}
|
|
283
|
-
);
|
|
284
|
-
if (!response.ok) {
|
|
285
|
-
return null;
|
|
286
|
-
}
|
|
287
|
-
const data = await response.json();
|
|
288
|
-
const body = data && typeof data === "object" && "detail" in data && data.detail ? data.detail : data;
|
|
289
|
-
if (!body || !Array.isArray(body.purposes)) {
|
|
290
|
-
return null;
|
|
291
|
-
}
|
|
292
|
-
return body;
|
|
293
|
-
} catch {
|
|
294
|
-
return null;
|
|
295
|
-
}
|
|
296
|
-
};
|
|
297
|
-
var buildLedgerConsentOverlay = (status, configPurposes) => {
|
|
298
|
-
var _a, _b;
|
|
299
|
-
const byUuid = new Map(status.purposes.map((p) => [p.uuid, p]));
|
|
300
|
-
const hasHistory = status.purposes.some(
|
|
301
|
-
(p) => (p.status || "INACTIVE") !== "INACTIVE"
|
|
302
|
-
);
|
|
303
|
-
if (!hasHistory) {
|
|
304
|
-
return null;
|
|
305
|
-
}
|
|
306
|
-
const purpose_selections = {};
|
|
307
|
-
for (const cp of configPurposes) {
|
|
308
|
-
const lp = byUuid.get(cp.uuid);
|
|
309
|
-
const purposeStatus = (lp == null ? void 0 : lp.status) || "INACTIVE";
|
|
310
|
-
const selectedByUuid = new Map(
|
|
311
|
-
((lp == null ? void 0 : lp.data_elements) || []).map((de) => [de.uuid, de.selected])
|
|
312
|
-
);
|
|
313
|
-
const data_elements = {};
|
|
314
|
-
for (const de of cp.data_elements) {
|
|
315
|
-
data_elements[de.uuid] = {
|
|
316
|
-
selected: (_a = selectedByUuid.get(de.uuid)) != null ? _a : false,
|
|
317
|
-
enabled: de.enabled,
|
|
318
|
-
required: de.required
|
|
319
|
-
};
|
|
320
|
-
}
|
|
321
|
-
purpose_selections[cp.uuid] = {
|
|
322
|
-
selected: (_b = lp == null ? void 0 : lp.selected) != null ? _b : false,
|
|
323
|
-
status: purposeStatus,
|
|
324
|
-
needs_reconsent: purposeStatus !== "ACTIVE",
|
|
325
|
-
data_elements
|
|
326
|
-
};
|
|
327
|
-
}
|
|
328
|
-
const reconsent_required = configPurposes.some(
|
|
329
|
-
(cp) => {
|
|
330
|
-
var _a2;
|
|
331
|
-
return (((_a2 = purpose_selections[cp.uuid]) == null ? void 0 : _a2.status) || "INACTIVE") !== "ACTIVE";
|
|
332
|
-
}
|
|
333
|
-
);
|
|
334
|
-
return { reconsent_required, purpose_selections };
|
|
335
|
-
};
|
|
336
391
|
var fetchTTSAudioUrls = async ({
|
|
337
392
|
accessToken,
|
|
338
393
|
baseUrl,
|
|
394
|
+
ledgerBaseUrl,
|
|
339
395
|
noticeUuid,
|
|
340
396
|
language,
|
|
341
|
-
signal
|
|
397
|
+
signal,
|
|
398
|
+
...sandboxParams
|
|
342
399
|
}) => {
|
|
343
|
-
if (!accessToken || !noticeUuid || !language) {
|
|
344
|
-
throw new Error("accessToken, noticeUuid, and language are required");
|
|
345
|
-
}
|
|
346
|
-
const decodedToken = decodeTokenSafely(accessToken);
|
|
347
|
-
if (!decodedToken) {
|
|
348
|
-
throw new Error("Invalid access token");
|
|
400
|
+
if (!accessToken && !sandboxParams.token || !noticeUuid || !language) {
|
|
401
|
+
throw new Error("accessToken (or token), noticeUuid, and language are required");
|
|
349
402
|
}
|
|
350
|
-
const {
|
|
351
|
-
|
|
352
|
-
|
|
403
|
+
const { organisationUuid: ORGANISATION_UUID, workspaceUuid: WORKSPACE_UUID, sandbox } = resolveRequestAuth(accessToken, sandboxParams, decodeTokenSafely);
|
|
404
|
+
const apiBaseUrl = (sandbox ? null : ledgerBaseUrl) || baseUrl || BASE_URL;
|
|
405
|
+
const url = new URL(
|
|
406
|
+
`${apiBaseUrl}/public/organisations/${ORGANISATION_UUID}/workspaces/${WORKSPACE_UUID}/notices/${noticeUuid}/audio/${language}`
|
|
407
|
+
);
|
|
408
|
+
if (sandbox) {
|
|
409
|
+
for (const [key, value] of Object.entries(sandboxQueryIdentity(sandbox))) {
|
|
410
|
+
url.searchParams.append(key, value);
|
|
411
|
+
}
|
|
353
412
|
}
|
|
354
|
-
const
|
|
355
|
-
const url = `${apiBaseUrl}/public/organisations/${ORGANISATION_UUID}/workspaces/${WORKSPACE_UUID}/notices/${noticeUuid}/audio/${language}`;
|
|
356
|
-
const response = await fetch(url, {
|
|
413
|
+
const response = await fetch(url.toString(), {
|
|
357
414
|
method: "GET",
|
|
358
415
|
headers: {
|
|
359
|
-
|
|
416
|
+
...buildAuthHeaders(accessToken, sandbox),
|
|
360
417
|
Accept: "application/json"
|
|
361
418
|
},
|
|
362
419
|
signal
|
|
@@ -398,7 +455,10 @@ var initiateGuardianVerification = async ({
|
|
|
398
455
|
if (!decodedToken) {
|
|
399
456
|
throw new Error("Invalid access token");
|
|
400
457
|
}
|
|
401
|
-
const {
|
|
458
|
+
const {
|
|
459
|
+
organisation_uuid: ORGANISATION_UUID,
|
|
460
|
+
workspace_uuid: WORKSPACE_UUID
|
|
461
|
+
} = decodedToken;
|
|
402
462
|
if (!ORGANISATION_UUID || !WORKSPACE_UUID) {
|
|
403
463
|
throw new Error("Invalid token: missing organization or workspace UUID");
|
|
404
464
|
}
|
|
@@ -472,7 +532,10 @@ var verifyGuardianStatus = async ({
|
|
|
472
532
|
if (!decodedToken) {
|
|
473
533
|
throw new Error("Invalid access token");
|
|
474
534
|
}
|
|
475
|
-
const {
|
|
535
|
+
const {
|
|
536
|
+
organisation_uuid: ORGANISATION_UUID,
|
|
537
|
+
workspace_uuid: WORKSPACE_UUID
|
|
538
|
+
} = decodedToken;
|
|
476
539
|
if (!ORGANISATION_UUID || !WORKSPACE_UUID) {
|
|
477
540
|
throw new Error("Invalid token: missing organization or workspace UUID");
|
|
478
541
|
}
|
|
@@ -485,9 +548,7 @@ var verifyGuardianStatus = async ({
|
|
|
485
548
|
Authorization: `Bearer ${accessToken}`,
|
|
486
549
|
"Content-Type": "application/json"
|
|
487
550
|
},
|
|
488
|
-
body: JSON.stringify({
|
|
489
|
-
session_token: sessionToken
|
|
490
|
-
}),
|
|
551
|
+
body: JSON.stringify({ session_token: sessionToken }),
|
|
491
552
|
signal
|
|
492
553
|
}
|
|
493
554
|
);
|
|
@@ -530,7 +591,6 @@ var LANGUAGE_NATIVE_LABELS = {
|
|
|
530
591
|
English: "English",
|
|
531
592
|
Assamese: "\u0985\u09B8\u09AE\u09C0\u09AF\u09BC\u09BE (Assamese)",
|
|
532
593
|
Bengali: "\u09AC\u09BE\u0982\u09B2\u09BE (Bengali)",
|
|
533
|
-
Bhojpuri: "\u092D\u094B\u091C\u092A\u0941\u0930\u0940 (Bhojpuri)",
|
|
534
594
|
Bodo: "\u092C\u0921\u093C\u094B (Bodo)",
|
|
535
595
|
Dogri: "\u0921\u094B\u0917\u0930\u0940 (Dogri)",
|
|
536
596
|
Gujarati: "\u0A97\u0AC1\u0A9C\u0AB0\u0ABE\u0AA4\u0AC0 (Gujarati)",
|
|
@@ -560,7 +620,6 @@ var LANGUAGE_NAME_TO_BCP47 = {
|
|
|
560
620
|
English: "en",
|
|
561
621
|
Assamese: "as",
|
|
562
622
|
Bengali: "bn",
|
|
563
|
-
Bhojpuri: "bho",
|
|
564
623
|
Bodo: "brx",
|
|
565
624
|
Dogri: "doi",
|
|
566
625
|
Gujarati: "gu",
|
|
@@ -2378,6 +2437,12 @@ var RedactoNoticeConsent = ({
|
|
|
2378
2437
|
noticeId,
|
|
2379
2438
|
accessToken,
|
|
2380
2439
|
refreshToken,
|
|
2440
|
+
token,
|
|
2441
|
+
email,
|
|
2442
|
+
mobile,
|
|
2443
|
+
ucic,
|
|
2444
|
+
organisationUuid,
|
|
2445
|
+
workspaceUuid,
|
|
2381
2446
|
baseUrl,
|
|
2382
2447
|
ledgerBaseUrl,
|
|
2383
2448
|
language = "en",
|
|
@@ -2396,15 +2461,43 @@ var RedactoNoticeConsent = ({
|
|
|
2396
2461
|
reviewModeButtonText = "Continue"
|
|
2397
2462
|
}) => {
|
|
2398
2463
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q;
|
|
2464
|
+
const sandboxParams = (0, import_react2.useMemo)(
|
|
2465
|
+
() => ({
|
|
2466
|
+
token,
|
|
2467
|
+
sandboxUcic: ucic,
|
|
2468
|
+
sandboxSubject: email || mobile,
|
|
2469
|
+
organisationUuid,
|
|
2470
|
+
workspaceUuid
|
|
2471
|
+
}),
|
|
2472
|
+
[token, ucic, email, mobile, organisationUuid, workspaceUuid]
|
|
2473
|
+
);
|
|
2399
2474
|
const propValidationError = (0, import_react2.useMemo)(() => {
|
|
2400
2475
|
if (!(noticeId == null ? void 0 : noticeId.trim())) {
|
|
2401
2476
|
return "RedactoNoticeConsent: 'noticeId' prop is required and cannot be empty";
|
|
2402
2477
|
}
|
|
2478
|
+
if (token == null ? void 0 : token.trim()) {
|
|
2479
|
+
if (!(organisationUuid == null ? void 0 : organisationUuid.trim()) || !(workspaceUuid == null ? void 0 : workspaceUuid.trim())) {
|
|
2480
|
+
return "RedactoNoticeConsent: sandbox mode requires 'organisationUuid' and 'workspaceUuid'";
|
|
2481
|
+
}
|
|
2482
|
+
if (!(email == null ? void 0 : email.trim()) && !(mobile == null ? void 0 : mobile.trim()) && !(ucic == null ? void 0 : ucic.trim())) {
|
|
2483
|
+
return "RedactoNoticeConsent: sandbox mode requires 'email', 'mobile', or 'ucic'";
|
|
2484
|
+
}
|
|
2485
|
+
return null;
|
|
2486
|
+
}
|
|
2403
2487
|
if (!(accessToken == null ? void 0 : accessToken.trim())) {
|
|
2404
2488
|
return "RedactoNoticeConsent: 'accessToken' prop is required and cannot be empty";
|
|
2405
2489
|
}
|
|
2406
2490
|
return null;
|
|
2407
|
-
}, [
|
|
2491
|
+
}, [
|
|
2492
|
+
noticeId,
|
|
2493
|
+
accessToken,
|
|
2494
|
+
token,
|
|
2495
|
+
organisationUuid,
|
|
2496
|
+
workspaceUuid,
|
|
2497
|
+
email,
|
|
2498
|
+
mobile,
|
|
2499
|
+
ucic
|
|
2500
|
+
]);
|
|
2408
2501
|
if (propValidationError) {
|
|
2409
2502
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
2410
2503
|
"div",
|
|
@@ -2734,7 +2827,7 @@ var RedactoNoticeConsent = ({
|
|
|
2734
2827
|
return content.dpo_info[key] || defaultText;
|
|
2735
2828
|
};
|
|
2736
2829
|
const fetchNotice = async () => {
|
|
2737
|
-
var _a2
|
|
2830
|
+
var _a2;
|
|
2738
2831
|
if (isRequestInProgressRef.current) {
|
|
2739
2832
|
return;
|
|
2740
2833
|
}
|
|
@@ -2748,16 +2841,18 @@ var RedactoNoticeConsent = ({
|
|
|
2748
2841
|
setShowAgeVerification(false);
|
|
2749
2842
|
setShowGuardianForm(false);
|
|
2750
2843
|
try {
|
|
2844
|
+
const noticeBaseUrl = ledgerBaseUrl && !applicationId && !token ? ledgerBaseUrl : baseUrl;
|
|
2751
2845
|
const consentContentData = await fetchConsentContent({
|
|
2752
2846
|
noticeId,
|
|
2753
2847
|
accessToken,
|
|
2754
2848
|
refreshToken,
|
|
2755
|
-
baseUrl,
|
|
2849
|
+
baseUrl: noticeBaseUrl,
|
|
2756
2850
|
language,
|
|
2757
2851
|
specific_uuid: applicationId,
|
|
2758
2852
|
validate_against: validateAgainst,
|
|
2759
2853
|
include_fully_consented_data: includeFullyConsentedData,
|
|
2760
|
-
signal: (_a2 = abortControllerRef.current) == null ? void 0 : _a2.signal
|
|
2854
|
+
signal: (_a2 = abortControllerRef.current) == null ? void 0 : _a2.signal,
|
|
2855
|
+
...sandboxParams
|
|
2761
2856
|
});
|
|
2762
2857
|
const activeConfig = consentContentData.detail.active_config;
|
|
2763
2858
|
setContent(activeConfig);
|
|
@@ -2775,24 +2870,8 @@ var RedactoNoticeConsent = ({
|
|
|
2775
2870
|
{}
|
|
2776
2871
|
);
|
|
2777
2872
|
setCollapsedPurposes(initialCollapsedState);
|
|
2778
|
-
|
|
2779
|
-
|
|
2780
|
-
if (ledgerBaseUrl && !applicationId) {
|
|
2781
|
-
const ledgerStatus = await fetchNoticeConsentStatus({
|
|
2782
|
-
accessToken,
|
|
2783
|
-
ledgerBaseUrl,
|
|
2784
|
-
noticeUuid: noticeId,
|
|
2785
|
-
signal: (_b2 = abortControllerRef.current) == null ? void 0 : _b2.signal
|
|
2786
|
-
});
|
|
2787
|
-
if (ledgerStatus) {
|
|
2788
|
-
const overlay = buildLedgerConsentOverlay(
|
|
2789
|
-
ledgerStatus,
|
|
2790
|
-
activeConfig.purposes
|
|
2791
|
-
);
|
|
2792
|
-
isReconsentRequired = (_c2 = overlay == null ? void 0 : overlay.reconsent_required) != null ? _c2 : false;
|
|
2793
|
-
purposeSelections = overlay == null ? void 0 : overlay.purpose_selections;
|
|
2794
|
-
}
|
|
2795
|
-
}
|
|
2873
|
+
const isReconsentRequired = consentContentData.detail.reconsent_required;
|
|
2874
|
+
const purposeSelections = consentContentData.detail.purpose_selections;
|
|
2796
2875
|
const newCategorizedPurposes = isReconsentRequired ? {
|
|
2797
2876
|
alreadyConsented: activeConfig.purposes.filter(
|
|
2798
2877
|
(purpose) => {
|
|
@@ -2823,9 +2902,9 @@ var RedactoNoticeConsent = ({
|
|
|
2823
2902
|
const initialDataElementState = activeConfig.purposes.reduce(
|
|
2824
2903
|
(acc, purpose) => {
|
|
2825
2904
|
purpose.data_elements.forEach((element) => {
|
|
2826
|
-
var _a3,
|
|
2905
|
+
var _a3, _b2;
|
|
2827
2906
|
const combinedId = `${purpose.uuid}-${element.uuid}`;
|
|
2828
|
-
if ((
|
|
2907
|
+
if ((_b2 = (_a3 = purposeSelections == null ? void 0 : purposeSelections[purpose.uuid]) == null ? void 0 : _a3.data_elements) == null ? void 0 : _b2[element.uuid]) {
|
|
2829
2908
|
acc[combinedId] = purposeSelections[purpose.uuid].data_elements[element.uuid].selected;
|
|
2830
2909
|
} else {
|
|
2831
2910
|
acc[combinedId] = false;
|
|
@@ -2841,9 +2920,9 @@ var RedactoNoticeConsent = ({
|
|
|
2841
2920
|
const initialSelections = {};
|
|
2842
2921
|
newCategorizedPurposes.alreadyConsented.forEach((purpose) => {
|
|
2843
2922
|
purpose.data_elements.forEach((element) => {
|
|
2844
|
-
var _a3,
|
|
2923
|
+
var _a3, _b2;
|
|
2845
2924
|
const combinedId = `${purpose.uuid}-${element.uuid}`;
|
|
2846
|
-
if ((
|
|
2925
|
+
if ((_b2 = (_a3 = purposeSelections == null ? void 0 : purposeSelections[purpose.uuid]) == null ? void 0 : _a3.data_elements) == null ? void 0 : _b2[element.uuid]) {
|
|
2847
2926
|
initialSelections[combinedId] = purposeSelections[purpose.uuid].data_elements[element.uuid].selected;
|
|
2848
2927
|
} else {
|
|
2849
2928
|
initialSelections[combinedId] = false;
|
|
@@ -2864,9 +2943,9 @@ var RedactoNoticeConsent = ({
|
|
|
2864
2943
|
activeConfig.purposes.forEach(
|
|
2865
2944
|
(purpose) => {
|
|
2866
2945
|
purpose.data_elements.forEach((element) => {
|
|
2867
|
-
var _a3,
|
|
2946
|
+
var _a3, _b2;
|
|
2868
2947
|
const combinedId = `${purpose.uuid}-${element.uuid}`;
|
|
2869
|
-
if ((
|
|
2948
|
+
if ((_b2 = (_a3 = purposeSelections[purpose.uuid]) == null ? void 0 : _a3.data_elements) == null ? void 0 : _b2[element.uuid]) {
|
|
2870
2949
|
initialSelections[combinedId] = purposeSelections[purpose.uuid].data_elements[element.uuid].selected;
|
|
2871
2950
|
} else {
|
|
2872
2951
|
initialSelections[combinedId] = false;
|
|
@@ -2914,8 +2993,10 @@ var RedactoNoticeConsent = ({
|
|
|
2914
2993
|
noticeId,
|
|
2915
2994
|
accessToken,
|
|
2916
2995
|
refreshToken,
|
|
2996
|
+
sandboxParams,
|
|
2917
2997
|
language,
|
|
2918
2998
|
applicationId,
|
|
2999
|
+
ledgerBaseUrl,
|
|
2919
3000
|
validateAgainst,
|
|
2920
3001
|
includeFullyConsentedData
|
|
2921
3002
|
// Removed onError and isRefreshingToken from dependencies to prevent duplicate API calls
|
|
@@ -2997,6 +3078,7 @@ var RedactoNoticeConsent = ({
|
|
|
2997
3078
|
if (content) {
|
|
2998
3079
|
await submitConsentEvent({
|
|
2999
3080
|
accessToken,
|
|
3081
|
+
baseUrl,
|
|
3000
3082
|
ledgerBaseUrl,
|
|
3001
3083
|
noticeUuid: content.notice_uuid,
|
|
3002
3084
|
purposes: content.purposes.map((purpose) => {
|
|
@@ -3029,7 +3111,8 @@ var RedactoNoticeConsent = ({
|
|
|
3029
3111
|
meta_data: applicationId ? { specific_uuid: applicationId } : void 0,
|
|
3030
3112
|
guardianVerificationReference: verificationReference || void 0,
|
|
3031
3113
|
selfDeclaredAdult: selfDeclaredAdult || void 0,
|
|
3032
|
-
signal: submitController.signal
|
|
3114
|
+
signal: submitController.signal,
|
|
3115
|
+
...sandboxParams
|
|
3033
3116
|
});
|
|
3034
3117
|
}
|
|
3035
3118
|
onAccept == null ? void 0 : onAccept();
|
|
@@ -3212,7 +3295,7 @@ var RedactoNoticeConsent = ({
|
|
|
3212
3295
|
} finally {
|
|
3213
3296
|
setIsSubmittingGuardian(false);
|
|
3214
3297
|
}
|
|
3215
|
-
}, [accessToken, baseUrl, guardianFormData, digilockerMode, digilockerCallbackUrl, selectedPurposes, selectedDataElements, noticeId, onError]);
|
|
3298
|
+
}, [accessToken, sandboxParams, baseUrl, guardianFormData, digilockerMode, digilockerCallbackUrl, selectedPurposes, selectedDataElements, noticeId, onError]);
|
|
3216
3299
|
const handleAgeVerificationYes = (0, import_react2.useCallback)(() => {
|
|
3217
3300
|
setShowAgeVerification(false);
|
|
3218
3301
|
setIsMinorFlow(false);
|
|
@@ -3269,7 +3352,7 @@ var RedactoNoticeConsent = ({
|
|
|
3269
3352
|
setIsPollingStatus(false);
|
|
3270
3353
|
isPollingStatusRef.current = false;
|
|
3271
3354
|
setIsInitiatingVerification(false);
|
|
3272
|
-
}, [accessToken, baseUrl]);
|
|
3355
|
+
}, [accessToken, sandboxParams, baseUrl]);
|
|
3273
3356
|
const startPopupMonitoring = (0, import_react2.useCallback)((popup) => {
|
|
3274
3357
|
popupCheckIntervalRef.current = window.setInterval(() => {
|
|
3275
3358
|
if (popup.closed) {
|
|
@@ -3297,8 +3380,8 @@ var RedactoNoticeConsent = ({
|
|
|
3297
3380
|
[]
|
|
3298
3381
|
);
|
|
3299
3382
|
const startStatusPolling = (0, import_react2.useCallback)(
|
|
3300
|
-
(
|
|
3301
|
-
verificationSessionTokenRef.current =
|
|
3383
|
+
(token2) => {
|
|
3384
|
+
verificationSessionTokenRef.current = token2;
|
|
3302
3385
|
setIsPollingStatus(true);
|
|
3303
3386
|
isPollingStatusRef.current = true;
|
|
3304
3387
|
setVerificationError(null);
|
|
@@ -3350,7 +3433,7 @@ var RedactoNoticeConsent = ({
|
|
|
3350
3433
|
const response = await verifyGuardianStatus({
|
|
3351
3434
|
accessToken,
|
|
3352
3435
|
baseUrl,
|
|
3353
|
-
sessionToken:
|
|
3436
|
+
sessionToken: token2
|
|
3354
3437
|
});
|
|
3355
3438
|
consecutiveErrors = 0;
|
|
3356
3439
|
if (response.status === "verified") {
|
|
@@ -3420,7 +3503,7 @@ var RedactoNoticeConsent = ({
|
|
|
3420
3503
|
};
|
|
3421
3504
|
statusPollIntervalRef.current = window.setTimeout(poll, POLL_INTERVAL);
|
|
3422
3505
|
},
|
|
3423
|
-
[accessToken, baseUrl, getVerificationErrorMessage]
|
|
3506
|
+
[accessToken, sandboxParams, baseUrl, getVerificationErrorMessage]
|
|
3424
3507
|
);
|
|
3425
3508
|
const handleBackToGuardianForm = (0, import_react2.useCallback)((clearName = false) => {
|
|
3426
3509
|
var _a2, _b2;
|
|
@@ -3760,9 +3843,11 @@ var RedactoNoticeConsent = ({
|
|
|
3760
3843
|
fetchTTSAudioUrls({
|
|
3761
3844
|
accessToken,
|
|
3762
3845
|
baseUrl,
|
|
3846
|
+
ledgerBaseUrl,
|
|
3763
3847
|
noticeUuid: content.notice_uuid,
|
|
3764
3848
|
language: languageCode,
|
|
3765
|
-
signal: ttsAbortController.signal
|
|
3849
|
+
signal: ttsAbortController.signal,
|
|
3850
|
+
...sandboxParams
|
|
3766
3851
|
}).then((response) => {
|
|
3767
3852
|
setTtsAudioUrls(response.detail);
|
|
3768
3853
|
setIsTTSAvailable(true);
|
|
@@ -3775,7 +3860,7 @@ var RedactoNoticeConsent = ({
|
|
|
3775
3860
|
return () => {
|
|
3776
3861
|
ttsAbortController.abort();
|
|
3777
3862
|
};
|
|
3778
|
-
}, [content, selectedLanguage, accessToken, baseUrl, getLanguageCode]);
|
|
3863
|
+
}, [content, selectedLanguage, accessToken, sandboxParams, baseUrl, ledgerBaseUrl, getLanguageCode]);
|
|
3779
3864
|
const modalStyle = {
|
|
3780
3865
|
borderRadius: (settings == null ? void 0 : settings.borderRadius) || "8px",
|
|
3781
3866
|
backgroundColor: (settings == null ? void 0 : settings.backgroundColor) || "#ffffff"
|
|
@@ -4749,12 +4834,16 @@ var fetchConsentContent2 = async ({
|
|
|
4749
4834
|
org_uuid,
|
|
4750
4835
|
workspace_uuid,
|
|
4751
4836
|
notice_uuid,
|
|
4837
|
+
accessToken,
|
|
4752
4838
|
baseUrl,
|
|
4753
|
-
|
|
4839
|
+
language,
|
|
4840
|
+
specific_uuid,
|
|
4841
|
+
signal
|
|
4754
4842
|
}) => {
|
|
4755
4843
|
const apiBaseUrl = baseUrl || BASE_URL2;
|
|
4844
|
+
const noticesUrl = `${apiBaseUrl}/public/organisations/${org_uuid}/workspaces/${workspace_uuid}/notices`;
|
|
4756
4845
|
const url = new URL(
|
|
4757
|
-
`${
|
|
4846
|
+
accessToken ? `${noticesUrl}/${notice_uuid}` : `${noticesUrl}/get-notice/${notice_uuid}`
|
|
4758
4847
|
);
|
|
4759
4848
|
if (specific_uuid) {
|
|
4760
4849
|
url.searchParams.append("specific_uuid", specific_uuid);
|
|
@@ -4762,8 +4851,11 @@ var fetchConsentContent2 = async ({
|
|
|
4762
4851
|
const response = await fetch(url.toString(), {
|
|
4763
4852
|
method: "GET",
|
|
4764
4853
|
headers: {
|
|
4765
|
-
"Content-Type": "application/json"
|
|
4766
|
-
|
|
4854
|
+
"Content-Type": "application/json",
|
|
4855
|
+
"Accept-Language": language || "en",
|
|
4856
|
+
...accessToken ? { Authorization: `Bearer ${accessToken}` } : {}
|
|
4857
|
+
},
|
|
4858
|
+
signal
|
|
4767
4859
|
});
|
|
4768
4860
|
if (!response.ok) {
|
|
4769
4861
|
throw await parseApiError(
|
|
@@ -4778,16 +4870,14 @@ var submitConsentEvent2 = async ({
|
|
|
4778
4870
|
org_uuid,
|
|
4779
4871
|
workspace_uuid,
|
|
4780
4872
|
accessToken,
|
|
4873
|
+
baseUrl,
|
|
4781
4874
|
ledgerBaseUrl,
|
|
4782
4875
|
noticeUuid,
|
|
4783
4876
|
purposes,
|
|
4784
4877
|
declined,
|
|
4785
4878
|
meta_data
|
|
4786
4879
|
}) => {
|
|
4787
|
-
|
|
4788
|
-
throw new Error("ledgerBaseUrl is required to submit consent");
|
|
4789
|
-
}
|
|
4790
|
-
const apiBaseUrl = ledgerBaseUrl;
|
|
4880
|
+
const apiBaseUrl = ledgerBaseUrl || baseUrl || BASE_URL2;
|
|
4791
4881
|
const payload = {
|
|
4792
4882
|
notice_uuid: noticeUuid,
|
|
4793
4883
|
purposes: purposes.map((purpose) => {
|
|
@@ -5255,6 +5345,9 @@ var RedactoConsentInlineComponent = ({
|
|
|
5255
5345
|
const [selectedPurposes, setSelectedPurposes] = (0, import_react4.useState)({});
|
|
5256
5346
|
const [selectedDataElements, setSelectedDataElements] = (0, import_react4.useState)({});
|
|
5257
5347
|
const [hasAlreadyConsented, setHasAlreadyConsented] = (0, import_react4.useState)(false);
|
|
5348
|
+
const [isCheckingConsent, setIsCheckingConsent] = (0, import_react4.useState)(
|
|
5349
|
+
Boolean(ledgerBaseUrl) && !applicationId
|
|
5350
|
+
);
|
|
5258
5351
|
const [fetchError, setFetchError] = (0, import_react4.useState)(null);
|
|
5259
5352
|
const [errorMessage, setErrorMessage] = (0, import_react4.useState)(null);
|
|
5260
5353
|
const hasSubmittedRef = (0, import_react4.useRef)(false);
|
|
@@ -5336,18 +5429,24 @@ var RedactoConsentInlineComponent = ({
|
|
|
5336
5429
|
}
|
|
5337
5430
|
return defaultText;
|
|
5338
5431
|
};
|
|
5339
|
-
const fetchNotice = async () => {
|
|
5432
|
+
const fetchNotice = async (signal) => {
|
|
5340
5433
|
setIsLoading(true);
|
|
5341
5434
|
setFetchError(null);
|
|
5435
|
+
setHasAlreadyConsented(false);
|
|
5342
5436
|
try {
|
|
5343
5437
|
const consentContentData = await fetchConsentContent2({
|
|
5344
5438
|
org_uuid,
|
|
5345
5439
|
workspace_uuid,
|
|
5346
5440
|
notice_uuid,
|
|
5441
|
+
accessToken,
|
|
5347
5442
|
baseUrl,
|
|
5348
5443
|
language,
|
|
5349
|
-
specific_uuid: applicationId
|
|
5444
|
+
specific_uuid: applicationId,
|
|
5445
|
+
signal
|
|
5350
5446
|
});
|
|
5447
|
+
if (signal == null ? void 0 : signal.aborted) {
|
|
5448
|
+
return;
|
|
5449
|
+
}
|
|
5351
5450
|
const activeConfig = consentContentData.detail.active_config;
|
|
5352
5451
|
setContent(activeConfig);
|
|
5353
5452
|
if (activeConfig.default_language) {
|
|
@@ -5383,6 +5482,9 @@ var RedactoConsentInlineComponent = ({
|
|
|
5383
5482
|
);
|
|
5384
5483
|
setSelectedPurposes(initialPurposeState);
|
|
5385
5484
|
} catch (err) {
|
|
5485
|
+
if ((signal == null ? void 0 : signal.aborted) || err instanceof Error && err.name === "AbortError") {
|
|
5486
|
+
return;
|
|
5487
|
+
}
|
|
5386
5488
|
const error = err;
|
|
5387
5489
|
setFetchError(error);
|
|
5388
5490
|
if (error.status === 409) {
|
|
@@ -5391,12 +5493,50 @@ var RedactoConsentInlineComponent = ({
|
|
|
5391
5493
|
onError == null ? void 0 : onError(error);
|
|
5392
5494
|
}
|
|
5393
5495
|
} finally {
|
|
5394
|
-
|
|
5496
|
+
if (!(signal == null ? void 0 : signal.aborted)) {
|
|
5497
|
+
setIsLoading(false);
|
|
5498
|
+
}
|
|
5395
5499
|
}
|
|
5396
5500
|
};
|
|
5397
5501
|
(0, import_react4.useEffect)(() => {
|
|
5398
|
-
|
|
5399
|
-
|
|
5502
|
+
const controller = new AbortController();
|
|
5503
|
+
void fetchNotice(controller.signal);
|
|
5504
|
+
return () => {
|
|
5505
|
+
controller.abort();
|
|
5506
|
+
};
|
|
5507
|
+
}, [org_uuid, workspace_uuid, notice_uuid, language, applicationId, accessToken]);
|
|
5508
|
+
(0, import_react4.useEffect)(() => {
|
|
5509
|
+
if (!ledgerBaseUrl || applicationId) {
|
|
5510
|
+
return;
|
|
5511
|
+
}
|
|
5512
|
+
if (!accessToken || !content) {
|
|
5513
|
+
return;
|
|
5514
|
+
}
|
|
5515
|
+
let active = true;
|
|
5516
|
+
const controller = new AbortController();
|
|
5517
|
+
const checkLedgerConsent = async () => {
|
|
5518
|
+
try {
|
|
5519
|
+
const ledgerStatus = await fetchNoticeConsentStatus({
|
|
5520
|
+
accessToken,
|
|
5521
|
+
ledgerBaseUrl,
|
|
5522
|
+
noticeUuid: notice_uuid,
|
|
5523
|
+
signal: controller.signal
|
|
5524
|
+
});
|
|
5525
|
+
if (active && ledgerStatus && isNoticeFullyConsented(ledgerStatus)) {
|
|
5526
|
+
setHasAlreadyConsented(true);
|
|
5527
|
+
}
|
|
5528
|
+
} finally {
|
|
5529
|
+
if (active) {
|
|
5530
|
+
setIsCheckingConsent(false);
|
|
5531
|
+
}
|
|
5532
|
+
}
|
|
5533
|
+
};
|
|
5534
|
+
checkLedgerConsent();
|
|
5535
|
+
return () => {
|
|
5536
|
+
active = false;
|
|
5537
|
+
controller.abort();
|
|
5538
|
+
};
|
|
5539
|
+
}, [ledgerBaseUrl, applicationId, accessToken, content, notice_uuid]);
|
|
5400
5540
|
const togglePurposeCollapse = (purposeUuid) => {
|
|
5401
5541
|
setCollapsedPurposes((prev) => ({
|
|
5402
5542
|
...prev,
|
|
@@ -5472,6 +5612,7 @@ var RedactoConsentInlineComponent = ({
|
|
|
5472
5612
|
org_uuid,
|
|
5473
5613
|
workspace_uuid,
|
|
5474
5614
|
accessToken: tokenToUse,
|
|
5615
|
+
baseUrl,
|
|
5475
5616
|
ledgerBaseUrl,
|
|
5476
5617
|
noticeUuid: content.notice_uuid,
|
|
5477
5618
|
purposes: content.purposes.map((purpose) => {
|
|
@@ -5519,7 +5660,7 @@ var RedactoConsentInlineComponent = ({
|
|
|
5519
5660
|
]
|
|
5520
5661
|
);
|
|
5521
5662
|
(0, import_react4.useEffect)(() => {
|
|
5522
|
-
if (accessToken && content && areAllRequiredElementsChecked && !isSubmitting && !hasSubmittedRef.current) {
|
|
5663
|
+
if (accessToken && content && areAllRequiredElementsChecked && !isSubmitting && !isCheckingConsent && !hasAlreadyConsented && !hasSubmittedRef.current) {
|
|
5523
5664
|
hasSubmittedRef.current = true;
|
|
5524
5665
|
const autoSubmit = async () => {
|
|
5525
5666
|
try {
|
|
@@ -5536,6 +5677,8 @@ var RedactoConsentInlineComponent = ({
|
|
|
5536
5677
|
content,
|
|
5537
5678
|
areAllRequiredElementsChecked,
|
|
5538
5679
|
isSubmitting,
|
|
5680
|
+
isCheckingConsent,
|
|
5681
|
+
hasAlreadyConsented,
|
|
5539
5682
|
handleAcceptWithToken
|
|
5540
5683
|
]);
|
|
5541
5684
|
(0, import_react4.useEffect)(() => {
|
|
@@ -6796,6 +6939,7 @@ var submitAssistedConsent = async ({
|
|
|
6796
6939
|
organisationUuid,
|
|
6797
6940
|
workspaceUuid,
|
|
6798
6941
|
baseUrl,
|
|
6942
|
+
ledgerBaseUrl,
|
|
6799
6943
|
noticeUuid,
|
|
6800
6944
|
purposes,
|
|
6801
6945
|
language,
|
|
@@ -6826,7 +6970,7 @@ var submitAssistedConsent = async ({
|
|
|
6826
6970
|
declined: false,
|
|
6827
6971
|
language: language || void 0
|
|
6828
6972
|
};
|
|
6829
|
-
const url = `${publicScope(baseUrl, organisationUuid, workspaceUuid)}/submit-consent`;
|
|
6973
|
+
const url = `${publicScope(ledgerBaseUrl || baseUrl, organisationUuid, workspaceUuid)}/submit-consent`;
|
|
6830
6974
|
const response = await fetch(url, {
|
|
6831
6975
|
method: "POST",
|
|
6832
6976
|
headers: {
|
|
@@ -7953,57 +8097,6 @@ var as = {
|
|
|
7953
8097
|
tryAgain: "\u0985\u09A8\u09C1\u0997\u09CD\u09F0\u09B9 \u0995\u09F0\u09BF \u09AA\u09C1\u09A8\u09F0 \u099A\u09C7\u09B7\u09CD\u099F\u09BE \u0995\u09F0\u0995\u0964",
|
|
7954
8098
|
close: "\u09AC\u09A8\u09CD\u09A7 \u0995\u09F0\u0995"
|
|
7955
8099
|
};
|
|
7956
|
-
var bho = {
|
|
7957
|
-
useEmailInstead: "\u0908\u092E\u0947\u0932 \u0907\u0938\u094D\u0924\u0947\u092E\u093E\u0932 \u0915\u0930\u0940\u0902",
|
|
7958
|
-
useMobileInstead: "\u092E\u094B\u092C\u093E\u0907\u0932 \u0907\u0938\u094D\u0924\u0947\u092E\u093E\u0932 \u0915\u0930\u0940\u0902",
|
|
7959
|
-
emailAddress: "\u0908\u092E\u0947\u0932 \u092A\u0924\u093E",
|
|
7960
|
-
otpHelperEmail: "\u0939\u092E\u0928\u0940 \u090F\u0939 \u0908\u092E\u0947\u0932 \u092A\u0930 \u090F\u0915 \u092C\u0947\u0930 \u0907\u0938\u094D\u0924\u0947\u092E\u093E\u0932 \u0939\u094B\u0916\u0947 \u0935\u093E\u0932\u093E \u092A\u093E\u0938\u0935\u0930\u094D\u0921 \u092D\u0947\u091C\u092C\u0964",
|
|
7961
|
-
changeEmail: "\u0908\u092E\u0947\u0932 \u092C\u0926\u0932\u0940\u0902",
|
|
7962
|
-
expandDetails: "{name} \u0915\u0947 \u0935\u093F\u0935\u0930\u0923 \u092B\u0948\u0932\u093E\u0908\u0902",
|
|
7963
|
-
collapseDetails: "{name} \u0915\u0947 \u0935\u093F\u0935\u0930\u0923 \u0938\u092E\u0947\u091F\u0940\u0902",
|
|
7964
|
-
selectAllFor: "{name} \u0916\u093E\u0924\u093F\u0930 \u0938\u092D \u0921\u0947\u091F\u093E \u0924\u0924\u094D\u0935 \u091A\u0941\u0928\u0940\u0902",
|
|
7965
|
-
selectElement: "{name} \u091A\u0941\u0928\u0940\u0902",
|
|
7966
|
-
selectElementRequired: "{name} \u091A\u0941\u0928\u0940\u0902 (\u091C\u0930\u0942\u0930\u0940)",
|
|
7967
|
-
required: "\u091C\u0930\u0942\u0930\u0940",
|
|
7968
|
-
logoAlt: "\u0932\u094B\u0917\u094B",
|
|
7969
|
-
selectLanguage: "\u092D\u093E\u0937\u093E \u091A\u0941\u0928\u0940\u0902",
|
|
7970
|
-
selectLanguageCurrent: "\u092D\u093E\u0937\u093E \u091A\u0941\u0928\u0940\u0902. \u092E\u094C\u091C\u0942\u0926\u093E \u092D\u093E\u0937\u093E: {lang}",
|
|
7971
|
-
opensInNewTab: "\u0928\u092F\u093E \u091F\u0948\u092C \u092E\u0947\u0902 \u0916\u0941\u0932\u0947\u0932\u093E",
|
|
7972
|
-
audioStart: "\u0911\u0921\u093F\u092F\u094B \u092A\u094D\u0932\u0947\u092C\u0948\u0915 \u0936\u0941\u0930\u0942 \u0915\u0930\u0940\u0902",
|
|
7973
|
-
audioPause: "\u0911\u0921\u093F\u092F\u094B \u092A\u094D\u0932\u0947\u092C\u0948\u0915 \u0930\u094B\u0915\u0940\u0902",
|
|
7974
|
-
talkbackStart: "\u091F\u0949\u0915\u092C\u0948\u0915 \u0936\u0941\u0930\u0942 \u0915\u0930\u0940\u0902",
|
|
7975
|
-
talkbackPause: "\u091F\u0949\u0915\u092C\u0948\u0915 \u0930\u094B\u0915\u0940\u0902",
|
|
7976
|
-
mobileNumber: "\u092E\u094B\u092C\u093E\u0907\u0932 \u0928\u0902\u092C\u0930",
|
|
7977
|
-
otpHelper: "\u0939\u092E\u0928\u0940 \u090F\u0939 \u0928\u0902\u092C\u0930 \u092A\u0930 \u090F\u0915 \u092C\u0947\u0930 \u0907\u0938\u094D\u0924\u0947\u092E\u093E\u0932 \u0939\u094B\u0916\u0947 \u0935\u093E\u0932\u093E \u092A\u093E\u0938\u0935\u0930\u094D\u0921 \u092D\u0947\u091C\u092C\u0964",
|
|
7978
|
-
otpSentTo: "\u0913\u091F\u0940\u092A\u0940 (OTP) \u092D\u0947\u091C\u0932 \u0917\u0907\u0932",
|
|
7979
|
-
changeMobile: "\u092E\u094B\u092C\u093E\u0907\u0932 \u0928\u0902\u092C\u0930 \u092C\u0926\u0932\u0940\u0902",
|
|
7980
|
-
enterNDigitOtp: "{count}-\u0905\u0902\u0915 \u0915\u0947 \u0913\u091F\u0940\u092A\u0940 (OTP) \u0921\u093E\u0932\u0940\u0902",
|
|
7981
|
-
otpDigit: "\u0913\u091F\u0940\u092A\u0940 (OTP) \u0905\u0902\u0915 {index}",
|
|
7982
|
-
resendIn: "{seconds} \u0938\u0947\u0915\u0902\u0921 \u092E\u0947\u0902 \u0913\u091F\u0940\u092A\u0940 (OTP) \u092B\u0947\u0930 \u0938\u0947 \u092D\u0947\u091C\u0940\u0902",
|
|
7983
|
-
sending: "\u092D\u0947\u091C\u0932 \u091C\u093E \u0930\u0939\u0932 \u092C\u093E\u2026",
|
|
7984
|
-
resendOtp: "\u0913\u091F\u0940\u092A\u0940 (OTP) \u092B\u0947\u0930 \u0938\u0947 \u092D\u0947\u091C\u0940\u0902",
|
|
7985
|
-
getOtp: "\u0913\u091F\u0940\u092A\u0940 (OTP) \u092A\u093E\u0908\u0902",
|
|
7986
|
-
verifying: "\u0938\u0924\u094D\u092F\u093E\u092A\u093F\u0924 \u0915\u0907\u0932 \u091C\u093E \u0930\u0939\u0932 \u092C\u093E\u2026",
|
|
7987
|
-
verifyOtp: "\u0913\u091F\u0940\u092A\u0940 (OTP) \u0938\u0924\u094D\u092F\u093E\u092A\u093F\u0924 \u0915\u0930\u0940\u0902",
|
|
7988
|
-
sendOtp: "\u0913\u091F\u0940\u092A\u0940 (OTP) \u092D\u0947\u091C\u0940\u0902",
|
|
7989
|
-
confirmOtp: "\u0913\u091F\u0940\u092A\u0940 (OTP) \u0915\u0947 \u092A\u0941\u0937\u094D\u091F\u093F \u0915\u0930\u0940\u0902",
|
|
7990
|
-
verifyWithOtp: "\u0913\u091F\u0940\u092A\u0940 (OTP) \u0938\u0947 \u0938\u0924\u094D\u092F\u093E\u092A\u093F\u0924 \u0915\u0930\u0940\u0902",
|
|
7991
|
-
editSelections: "\u091A\u0941\u0928\u093E\u0935 \u092E\u0947\u0902 \u092C\u0926\u0932\u093E\u0935 \u0915\u0930\u0940\u0902",
|
|
7992
|
-
otpIncorrect: "\u0930\u0909\u0930\u093E \u0921\u093E\u0932\u0932 \u0938\u0924\u094D\u092F\u093E\u092A\u0928 \u0915\u094B\u0921 \u0917\u0932\u0924 \u092C\u093E\u0964 \u0915\u0943\u092A\u092F\u093E \u091C\u093E\u0901\u091A \u0915\u0930\u0940\u0902 \u0906 \u092B\u0947\u0930 \u0938\u0947 \u0915\u094B\u0936\u093F\u0936 \u0915\u0930\u0940\u0902\u0964",
|
|
7993
|
-
otpExpired: "\u0930\u0909\u0930\u093E \u0938\u0924\u094D\u092F\u093E\u092A\u0928 \u0915\u094B\u0921 \u0915\u0947 \u092E\u093F\u092F\u093E\u0926 \u0916\u0924\u092E \u0939\u094B \u0917\u0907\u0932 \u092C\u093E\u0964 \u0915\u0943\u092A\u092F\u093E \u0928\u092F\u093E \u0915\u094B\u0921 \u092E\u093E\u0902\u0917\u0940\u0902\u0964",
|
|
7994
|
-
otpNotFound: "\u0938\u0924\u094D\u092F\u093E\u092A\u0928 \u0915\u094B\u0921 \u0928\u093E \u092E\u093F\u0932\u0932\u0964 \u0915\u0943\u092A\u092F\u093E \u0928\u092F\u093E \u0915\u094B\u0921 \u092E\u093E\u0902\u0917\u0940\u0902\u0964",
|
|
7995
|
-
otpVerifyFailed: "\u0913\u091F\u0940\u092A\u0940 (OTP) \u0915\u0947 \u0938\u0924\u094D\u092F\u093E\u092A\u0928 \u0928\u093E \u0939\u094B \u0938\u0915\u0932\u0964 \u0915\u0943\u092A\u092F\u093E \u092B\u0947\u0930 \u0938\u0947 \u0915\u094B\u0936\u093F\u0936 \u0915\u0930\u0940\u0902\u0964",
|
|
7996
|
-
otpSendFailed: "\u0913\u091F\u0940\u092A\u0940 (OTP) \u0928\u093E \u092D\u0947\u091C\u0932 \u091C\u093E \u0938\u0915\u0932\u0964 \u0915\u0943\u092A\u092F\u093E \u092B\u0947\u0930 \u0938\u0947 \u0915\u094B\u0936\u093F\u0936 \u0915\u0930\u0940\u0902\u0964",
|
|
7997
|
-
consentConfirmed: "\u0938\u0939\u092E\u0924\u093F \u0915\u0947 \u092A\u0941\u0937\u094D\u091F\u093F \u092D\u0907\u0932",
|
|
7998
|
-
recordedUnder: "\u0913\u091F\u0940\u092A\u0940 (OTP) \u0938\u0924\u094D\u092F\u093E\u092A\u093F\u0924 \xB7 {regulation} \u0915\u0947 \u0924\u0939\u0924 \u0926\u0930\u094D\u091C \u092D\u0907\u0932",
|
|
7999
|
-
recordedUnderAt: "\u0913\u091F\u0940\u092A\u0940 (OTP) \u0938\u0924\u094D\u092F\u093E\u092A\u093F\u0924 \xB7 {regulation} \u0915\u0947 \u0924\u0939\u0924 {time} \u092C\u091C\u0947 \u0926\u0930\u094D\u091C \u092D\u0907\u0932",
|
|
8000
|
-
consentReferenceId: "\u0938\u0939\u092E\u0924\u093F \u0938\u0902\u0926\u0930\u094D\u092D \u0906\u0908\u0921\u0940",
|
|
8001
|
-
proceed: "\u0906\u0917\u0947 \u092C\u0922\u093C\u0940\u0902",
|
|
8002
|
-
loadingNotice: "\u0928\u094B\u091F\u093F\u0938 \u0932\u094B\u0921 \u0939\u094B \u0930\u0939\u0932 \u092C\u093E",
|
|
8003
|
-
loadFailedTitle: "\u0938\u0939\u092E\u0924\u093F \u0928\u094B\u091F\u093F\u0938 \u0932\u094B\u0921 \u0928\u093E \u0939\u094B \u0938\u0915\u0932",
|
|
8004
|
-
tryAgain: "\u0915\u0943\u092A\u092F\u093E \u092B\u0947\u0930 \u0938\u0947 \u0915\u094B\u0938\u093F\u0938 \u0915\u0930\u0940\u0902\u0964",
|
|
8005
|
-
close: "\u092C\u0902\u0926 \u0915\u0930\u0940\u0902"
|
|
8006
|
-
};
|
|
8007
8100
|
var brx = {
|
|
8008
8101
|
useEmailInstead: "\u0907\u092E\u0947\u0932 \u092C\u093E\u0939\u093E\u092F",
|
|
8009
8102
|
useMobileInstead: "\u092E\u092C\u093E\u0907\u0932 \u092C\u093E\u0939\u093E\u092F",
|
|
@@ -8128,7 +8221,6 @@ var STATIC_STRINGS = {
|
|
|
8128
8221
|
te,
|
|
8129
8222
|
ur,
|
|
8130
8223
|
as,
|
|
8131
|
-
bho,
|
|
8132
8224
|
brx,
|
|
8133
8225
|
doi
|
|
8134
8226
|
};
|
|
@@ -8313,6 +8405,7 @@ var RedactoNoticeAssisted = ({
|
|
|
8313
8405
|
workspaceUuid,
|
|
8314
8406
|
noticeUuid,
|
|
8315
8407
|
baseUrl,
|
|
8408
|
+
ledgerBaseUrl,
|
|
8316
8409
|
onDecline,
|
|
8317
8410
|
onComplete
|
|
8318
8411
|
}) => {
|
|
@@ -9048,6 +9141,19 @@ var RedactoNoticeAssisted = ({
|
|
|
9048
9141
|
return;
|
|
9049
9142
|
}
|
|
9050
9143
|
const token = verifyDetail.access_token;
|
|
9144
|
+
if (ledgerBaseUrl) {
|
|
9145
|
+
const ledgerStatus = await fetchNoticeConsentStatusForScope({
|
|
9146
|
+
accessToken: token,
|
|
9147
|
+
ledgerBaseUrl,
|
|
9148
|
+
organisationUuid,
|
|
9149
|
+
workspaceUuid,
|
|
9150
|
+
noticeUuid: content.notice_uuid
|
|
9151
|
+
});
|
|
9152
|
+
if (ledgerStatus && isNoticeFullyConsented(ledgerStatus)) {
|
|
9153
|
+
handleSuccess();
|
|
9154
|
+
return;
|
|
9155
|
+
}
|
|
9156
|
+
}
|
|
9051
9157
|
const submitPurposes = content.purposes.map((purpose) => ({
|
|
9052
9158
|
...purpose,
|
|
9053
9159
|
selected: selectedPurposes[purpose.uuid] || false,
|
|
@@ -9061,6 +9167,7 @@ var RedactoNoticeAssisted = ({
|
|
|
9061
9167
|
organisationUuid,
|
|
9062
9168
|
workspaceUuid,
|
|
9063
9169
|
baseUrl,
|
|
9170
|
+
ledgerBaseUrl,
|
|
9064
9171
|
noticeUuid: content.notice_uuid,
|
|
9065
9172
|
purposes: submitPurposes,
|
|
9066
9173
|
language: toBcp47Code(selectedLanguage)
|
|
@@ -9084,6 +9191,7 @@ var RedactoNoticeAssisted = ({
|
|
|
9084
9191
|
otpUuid,
|
|
9085
9192
|
otpValue,
|
|
9086
9193
|
baseUrl,
|
|
9194
|
+
ledgerBaseUrl,
|
|
9087
9195
|
selectedPurposes,
|
|
9088
9196
|
selectedDataElements,
|
|
9089
9197
|
selectedLanguage,
|