@redacto.io/consent-sdk-react 10.0.0-beta.1 → 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.
Files changed (84) hide show
  1. package/.turbo/turbo-build.log +11 -11
  2. package/CHANGELOG.md +109 -0
  3. package/README.md +78 -0
  4. package/dist/{chunk-6A665OPR.mjs → chunk-OGL6OC3A.mjs} +4 -0
  5. package/dist/index.d.mts +32 -4
  6. package/dist/index.d.ts +32 -4
  7. package/dist/index.js +340 -230
  8. package/dist/index.mjs +339 -231
  9. package/dist/privacy-center.d.mts +55 -12
  10. package/dist/privacy-center.d.ts +55 -12
  11. package/dist/privacy-center.js +848 -950
  12. package/dist/privacy-center.mjs +698 -802
  13. package/package.json +1 -1
  14. package/src/RedactoNoticeAssisted/RedactoNoticeAssisted.test.tsx +87 -0
  15. package/src/RedactoNoticeAssisted/RedactoNoticeAssisted.tsx +27 -0
  16. package/src/RedactoNoticeAssisted/api/index.ts +7 -1
  17. package/src/RedactoNoticeAssisted/api/types.ts +2 -0
  18. package/src/RedactoNoticeAssisted/i18n.ts +0 -55
  19. package/src/RedactoNoticeAssisted/types.ts +2 -0
  20. package/src/RedactoNoticeConsent/RedactoNoticeConsent.test.tsx +42 -8
  21. package/src/RedactoNoticeConsent/RedactoNoticeConsent.tsx +74 -33
  22. package/src/RedactoNoticeConsent/api/index.ts +88 -175
  23. package/src/RedactoNoticeConsent/api/sandbox.ts +150 -0
  24. package/src/RedactoNoticeConsent/api/types.ts +58 -43
  25. package/src/RedactoNoticeConsent/language-codes.ts +0 -2
  26. package/src/RedactoNoticeConsent/types.ts +28 -2
  27. package/src/RedactoNoticeConsentInline/RedactoNoticeConsentInline.tsx +85 -5
  28. package/src/RedactoNoticeConsentInline/api/index.ts +10 -1
  29. package/src/RedactoNoticeConsentInline/api/notice-read-routing.test.ts +72 -0
  30. package/src/RedactoNoticeConsentInline/api/types.ts +2 -0
  31. package/src/RedactoPrivacyCenter/RedactoPrivacyCenter.tsx +37 -2
  32. package/src/RedactoPrivacyCenter/api/actions.ts +3 -1
  33. package/src/RedactoPrivacyCenter/api/client.ts +122 -25
  34. package/src/RedactoPrivacyCenter/api/fetcher.ts +24 -9
  35. package/src/RedactoPrivacyCenter/components/AppShell/AppShell.tsx +28 -0
  36. package/src/RedactoPrivacyCenter/components/AppShell/UserMenu.tsx +47 -45
  37. package/src/RedactoPrivacyCenter/components/ConsentManager.tsx +2 -1
  38. package/src/RedactoPrivacyCenter/components/Form.tsx +55 -30
  39. package/src/RedactoPrivacyCenter/components/ModifyConsentModal.tsx +1 -1
  40. package/src/RedactoPrivacyCenter/components/SelectUser.tsx +25 -13
  41. package/src/RedactoPrivacyCenter/components/SelectUserGate.tsx +8 -6
  42. package/src/RedactoPrivacyCenter/components/constant.ts +3 -3
  43. package/src/RedactoPrivacyCenter/components/groupHelpers.ts +42 -6
  44. package/src/RedactoPrivacyCenter/context/AuthContext.tsx +131 -39
  45. package/src/RedactoPrivacyCenter/context/types.ts +38 -0
  46. package/src/RedactoPrivacyCenter/lib/api.ts +3 -0
  47. package/src/RedactoPrivacyCenter/lib/constants.ts +12 -6
  48. package/src/RedactoPrivacyCenter/lib/locales.ts +0 -3
  49. package/src/RedactoPrivacyCenter/lib/sandbox.ts +104 -0
  50. package/src/RedactoPrivacyCenter/lib/types.ts +25 -1
  51. package/src/RedactoPrivacyCenter/lib/utils.ts +15 -0
  52. package/src/RedactoPrivacyCenter/locales/as/translation.json +3 -3
  53. package/src/RedactoPrivacyCenter/locales/bn/translation.json +3 -3
  54. package/src/RedactoPrivacyCenter/locales/brx/translation.json +3 -3
  55. package/src/RedactoPrivacyCenter/locales/doi/translation.json +3 -3
  56. package/src/RedactoPrivacyCenter/locales/en/translation.json +4 -3
  57. package/src/RedactoPrivacyCenter/locales/gom/translation.json +3 -3
  58. package/src/RedactoPrivacyCenter/locales/gu/translation.json +3 -3
  59. package/src/RedactoPrivacyCenter/locales/hi/translation.json +3 -3
  60. package/src/RedactoPrivacyCenter/locales/kn/translation.json +3 -3
  61. package/src/RedactoPrivacyCenter/locales/ks/translation.json +3 -3
  62. package/src/RedactoPrivacyCenter/locales/mai/translation.json +3 -3
  63. package/src/RedactoPrivacyCenter/locales/ml/translation.json +3 -3
  64. package/src/RedactoPrivacyCenter/locales/mni-Mtei/translation.json +3 -3
  65. package/src/RedactoPrivacyCenter/locales/mr/translation.json +3 -3
  66. package/src/RedactoPrivacyCenter/locales/ne/translation.json +3 -3
  67. package/src/RedactoPrivacyCenter/locales/or/translation.json +3 -3
  68. package/src/RedactoPrivacyCenter/locales/pa/translation.json +3 -3
  69. package/src/RedactoPrivacyCenter/locales/sa/translation.json +3 -3
  70. package/src/RedactoPrivacyCenter/locales/sat/translation.json +3 -3
  71. package/src/RedactoPrivacyCenter/locales/sd/translation.json +3 -3
  72. package/src/RedactoPrivacyCenter/locales/ta/translation.json +3 -3
  73. package/src/RedactoPrivacyCenter/locales/te/translation.json +3 -3
  74. package/src/RedactoPrivacyCenter/locales/ur/translation.json +3 -3
  75. package/src/RedactoPrivacyCenter/styles/injectStyles.ts +7 -2
  76. package/src/RedactoPrivacyCenter/styles/pcStyles.ts +17 -0
  77. package/src/RedactoPrivacyCenter/ui/PCAvatar.test.tsx +83 -0
  78. package/src/RedactoPrivacyCenter/ui/PCAvatar.tsx +33 -9
  79. package/src/shared/notice-consent-status.ts +190 -0
  80. package/src/shared/sandbox.ts +6 -0
  81. package/tests/Form.test.tsx +142 -5
  82. package/tests/RevokeWarningMessage.test.tsx +151 -0
  83. package/tests/consentClient.test.ts +46 -0
  84. package/src/RedactoPrivacyCenter/locales/bho/translation.json +0 -340
package/dist/index.mjs CHANGED
@@ -1,12 +1,13 @@
1
1
  import {
2
+ SANDBOX_TOKEN_HEADER,
2
3
  useMediaQuery
3
- } from "./chunk-6A665OPR.mjs";
4
+ } from "./chunk-OGL6OC3A.mjs";
4
5
 
5
6
  // src/RedactoNoticeConsent/RedactoNoticeConsent.tsx
6
7
  import { useCallback, useEffect, useMemo, useRef, useState } from "react";
7
8
 
8
9
  // src/RedactoNoticeConsent/api/index.ts
9
- import { jwtDecode } from "jwt-decode";
10
+ import { jwtDecode as jwtDecode2 } from "jwt-decode";
10
11
 
11
12
  // src/shared/api-errors.ts
12
13
  var ApiError = class extends Error {
@@ -66,6 +67,141 @@ async function parseApiError(response, fallbackMessage) {
66
67
  });
67
68
  }
68
69
 
70
+ // src/RedactoNoticeConsent/api/sandbox.ts
71
+ var resolveSandboxAuth = (params) => {
72
+ var _a, _b, _c, _d, _e;
73
+ const token = (_a = params.token) == null ? void 0 : _a.trim();
74
+ if (!token) {
75
+ return null;
76
+ }
77
+ const organisationUuid = (_b = params.organisationUuid) == null ? void 0 : _b.trim();
78
+ const workspaceUuid = (_c = params.workspaceUuid) == null ? void 0 : _c.trim();
79
+ const ucic = (_d = params.sandboxUcic) == null ? void 0 : _d.trim();
80
+ const subject = (_e = params.sandboxSubject) == null ? void 0 : _e.trim();
81
+ if (!organisationUuid || !workspaceUuid) {
82
+ throw new Error(
83
+ "Sandbox mode requires organisationUuid and workspaceUuid props"
84
+ );
85
+ }
86
+ if (!ucic && !subject) {
87
+ throw new Error("Sandbox mode requires a UCIC, email, or mobile");
88
+ }
89
+ return { token, ucic, subject: subject != null ? subject : "", organisationUuid, workspaceUuid };
90
+ };
91
+ var resolveRequestAuth = (accessToken, sandboxParams, decodeTokenSafely2) => {
92
+ const sandbox = resolveSandboxAuth(sandboxParams);
93
+ if (sandbox) {
94
+ return {
95
+ organisationUuid: sandbox.organisationUuid,
96
+ workspaceUuid: sandbox.workspaceUuid,
97
+ sandbox
98
+ };
99
+ }
100
+ const decodedToken = accessToken ? decodeTokenSafely2(accessToken) : null;
101
+ if (!decodedToken) {
102
+ throw new Error("Invalid access token");
103
+ }
104
+ const { organisation_uuid, workspace_uuid } = decodedToken;
105
+ if (!organisation_uuid || !workspace_uuid) {
106
+ throw new Error("Invalid token: missing organization or workspace UUID");
107
+ }
108
+ return {
109
+ organisationUuid: organisation_uuid,
110
+ workspaceUuid: workspace_uuid,
111
+ sandbox: null
112
+ };
113
+ };
114
+ var buildAuthHeaders = (accessToken, sandbox) => {
115
+ if (sandbox) {
116
+ return { [SANDBOX_TOKEN_HEADER]: sandbox.token };
117
+ }
118
+ return { Authorization: `Bearer ${accessToken}` };
119
+ };
120
+ var sandboxBodyIdentity = (sandbox) => {
121
+ if (sandbox.ucic) {
122
+ return { org_user_id: sandbox.ucic };
123
+ }
124
+ return sandbox.subject.includes("@") ? { primary_email: sandbox.subject } : { primary_mobile: sandbox.subject };
125
+ };
126
+ var sandboxQueryIdentity = (sandbox) => sandboxBodyIdentity(sandbox);
127
+
128
+ // src/shared/notice-consent-status.ts
129
+ import { jwtDecode } from "jwt-decode";
130
+ var decodeNoticeConsentToken = (token) => {
131
+ try {
132
+ return jwtDecode(token);
133
+ } catch {
134
+ return null;
135
+ }
136
+ };
137
+ var fetchNoticeConsentStatusForScope = async ({
138
+ accessToken,
139
+ ledgerBaseUrl,
140
+ organisationUuid,
141
+ workspaceUuid,
142
+ noticeUuid,
143
+ signal
144
+ }) => {
145
+ if (!accessToken || !ledgerBaseUrl || !organisationUuid || !workspaceUuid || !noticeUuid) {
146
+ return null;
147
+ }
148
+ try {
149
+ const response = await fetch(
150
+ `${ledgerBaseUrl}/public/organisations/${organisationUuid}/workspaces/${workspaceUuid}/notices/${noticeUuid}/check-consent`,
151
+ {
152
+ method: "POST",
153
+ headers: {
154
+ Authorization: `Bearer ${accessToken}`,
155
+ "Content-Type": "application/json"
156
+ },
157
+ body: "{}",
158
+ signal
159
+ }
160
+ );
161
+ if (!response.ok) {
162
+ return null;
163
+ }
164
+ const data = await response.json();
165
+ const body = data && typeof data === "object" && "detail" in data && data.detail ? data.detail : data;
166
+ if (!body || !Array.isArray(body.purposes)) {
167
+ return null;
168
+ }
169
+ return body;
170
+ } catch {
171
+ return null;
172
+ }
173
+ };
174
+ var fetchNoticeConsentStatus = async ({
175
+ accessToken,
176
+ ledgerBaseUrl,
177
+ noticeUuid,
178
+ signal
179
+ }) => {
180
+ if (!accessToken || !ledgerBaseUrl || !noticeUuid) {
181
+ return null;
182
+ }
183
+ const decodedToken = decodeNoticeConsentToken(accessToken);
184
+ if (!decodedToken) {
185
+ return null;
186
+ }
187
+ const {
188
+ organisation_uuid: ORGANISATION_UUID,
189
+ workspace_uuid: WORKSPACE_UUID
190
+ } = decodedToken;
191
+ if (!ORGANISATION_UUID || !WORKSPACE_UUID) {
192
+ return null;
193
+ }
194
+ return fetchNoticeConsentStatusForScope({
195
+ accessToken,
196
+ ledgerBaseUrl,
197
+ organisationUuid: ORGANISATION_UUID,
198
+ workspaceUuid: WORKSPACE_UUID,
199
+ noticeUuid,
200
+ signal
201
+ });
202
+ };
203
+ var isNoticeFullyConsented = (status) => status.consented && status.all_mandatory_active;
204
+
69
205
  // src/RedactoNoticeConsent/api/index.ts
70
206
  var BASE_URL = "https://api.redacto.io/consent";
71
207
  var apiCache = /* @__PURE__ */ new Map();
@@ -85,7 +221,7 @@ function setCachedData(key, data, ttl = CACHE_TTL) {
85
221
  }
86
222
  function decodeTokenSafely(token) {
87
223
  try {
88
- return jwtDecode(token);
224
+ return jwtDecode2(token);
89
225
  } catch (error) {
90
226
  console.warn("Failed to decode JWT token:", error);
91
227
  return null;
@@ -102,21 +238,19 @@ var fetchConsentContent = async ({
102
238
  specific_uuid,
103
239
  validate_against = "all",
104
240
  include_fully_consented_data = false,
105
- signal
241
+ signal,
242
+ ...sandboxParams
106
243
  }) => {
107
- if (!noticeId || !accessToken || !validate_against) {
108
- throw new Error("noticeId and accessToken are required");
109
- }
110
- const decodedToken = decodeTokenSafely(accessToken);
111
- if (!decodedToken) {
112
- throw new Error("Invalid access token");
244
+ if (!noticeId || !validate_against) {
245
+ throw new Error("noticeId is required");
113
246
  }
114
- const { organisation_uuid: ORGANISATION_UUID, workspace_uuid: WORKSPACE_UUID } = decodedToken;
115
- if (!ORGANISATION_UUID || !WORKSPACE_UUID) {
116
- throw new Error("Invalid token: missing organization or workspace UUID");
247
+ if (!accessToken && !sandboxParams.token) {
248
+ throw new Error("accessToken or token is required");
117
249
  }
250
+ const { organisationUuid: ORGANISATION_UUID, workspaceUuid: WORKSPACE_UUID, sandbox } = resolveRequestAuth(accessToken, sandboxParams, decodeTokenSafely);
118
251
  const apiBaseUrl = baseUrl || BASE_URL;
119
- const cacheKey = `${accessToken}-${noticeId}-${validate_against}-${language}-${specific_uuid || ""}-${include_fully_consented_data}`;
252
+ const cacheIdentity = sandbox ? `sandbox:${sandbox.organisationUuid}:${sandbox.workspaceUuid}:${sandbox.ucic || sandbox.subject}` : accessToken;
253
+ const cacheKey = `${cacheIdentity}-${noticeId}-${validate_against}-${language}-${specific_uuid || ""}-${include_fully_consented_data}`;
120
254
  if (validate_against === "all" && !specific_uuid) {
121
255
  const cachedData = getCachedData(cacheKey);
122
256
  if (cachedData) {
@@ -133,10 +267,15 @@ var fetchConsentContent = async ({
133
267
  if (include_fully_consented_data) {
134
268
  url.searchParams.append("include_fully_consented_data", "true");
135
269
  }
270
+ if (sandbox) {
271
+ for (const [key, value] of Object.entries(sandboxQueryIdentity(sandbox))) {
272
+ url.searchParams.append(key, value);
273
+ }
274
+ }
136
275
  const response = await fetch(url.toString(), {
137
276
  method: "GET",
138
277
  headers: {
139
- Authorization: `Bearer ${accessToken}`,
278
+ ...buildAuthHeaders(accessToken, sandbox),
140
279
  "Accept-Language": language
141
280
  },
142
281
  signal
@@ -164,20 +303,17 @@ var submitConsentEvent = async ({
164
303
  meta_data,
165
304
  guardianVerificationReference,
166
305
  selfDeclaredAdult,
167
- signal
306
+ signal,
307
+ ...sandboxParams
168
308
  }) => {
169
- if (!noticeUuid || !accessToken || !Array.isArray(purposes)) {
170
- throw new Error("noticeUuid, accessToken, and purposes array are required");
171
- }
172
- const decodedToken = decodeTokenSafely(accessToken);
173
- if (!decodedToken) {
174
- throw new Error("Invalid access token");
309
+ if (!noticeUuid || !Array.isArray(purposes)) {
310
+ throw new Error("noticeUuid and purposes array are required");
175
311
  }
176
- const { organisation_uuid: ORGANISATION_UUID, workspace_uuid: WORKSPACE_UUID } = decodedToken;
177
- if (!ORGANISATION_UUID || !WORKSPACE_UUID) {
178
- throw new Error("Invalid token: missing organization or workspace UUID");
312
+ if (!accessToken && !sandboxParams.token) {
313
+ throw new Error("accessToken or token is required");
179
314
  }
180
- const apiBaseUrl = ledgerBaseUrl || baseUrl || BASE_URL;
315
+ const { organisationUuid: ORGANISATION_UUID, workspaceUuid: WORKSPACE_UUID, sandbox } = resolveRequestAuth(accessToken, sandboxParams, decodeTokenSafely);
316
+ const apiBaseUrl = (sandbox ? null : ledgerBaseUrl) || baseUrl || BASE_URL;
181
317
  const validatedPurposes = purposes.map((purpose) => {
182
318
  if (!purpose.uuid) {
183
319
  throw new Error(`Invalid purpose data: missing uuid`);
@@ -203,15 +339,16 @@ var submitConsentEvent = async ({
203
339
  guardian_verification_reference: guardianVerificationReference,
204
340
  self_declared_adult: selfDeclaredAdult
205
341
  };
342
+ const requestBody = sandbox ? { ...payload, ...sandboxBodyIdentity(sandbox) } : payload;
206
343
  const response = await fetch(
207
344
  `${apiBaseUrl}/public/organisations/${ORGANISATION_UUID}/workspaces/${WORKSPACE_UUID}/submit-consent`,
208
345
  {
209
346
  method: "POST",
210
347
  headers: {
211
- Authorization: `Bearer ${accessToken}`,
348
+ ...buildAuthHeaders(accessToken, sandbox),
212
349
  "Content-Type": "application/json"
213
350
  },
214
- body: JSON.stringify(payload),
351
+ body: JSON.stringify(requestBody),
215
352
  signal
216
353
  }
217
354
  );
@@ -223,112 +360,32 @@ var submitConsentEvent = async ({
223
360
  }
224
361
  apiCache.clear();
225
362
  };
226
- var fetchNoticeConsentStatus = async ({
227
- accessToken,
228
- ledgerBaseUrl,
229
- noticeUuid,
230
- signal
231
- }) => {
232
- if (!accessToken || !ledgerBaseUrl || !noticeUuid) {
233
- return null;
234
- }
235
- const decodedToken = decodeTokenSafely(accessToken);
236
- if (!decodedToken) {
237
- return null;
238
- }
239
- const { organisation_uuid: ORGANISATION_UUID, workspace_uuid: WORKSPACE_UUID } = decodedToken;
240
- if (!ORGANISATION_UUID || !WORKSPACE_UUID) {
241
- return null;
242
- }
243
- try {
244
- const response = await fetch(
245
- `${ledgerBaseUrl}/public/organisations/${ORGANISATION_UUID}/workspaces/${WORKSPACE_UUID}/notices/${noticeUuid}/check-consent`,
246
- {
247
- method: "POST",
248
- headers: {
249
- Authorization: `Bearer ${accessToken}`,
250
- "Content-Type": "application/json"
251
- },
252
- body: "{}",
253
- signal
254
- }
255
- );
256
- if (!response.ok) {
257
- return null;
258
- }
259
- const data = await response.json();
260
- const body = data && typeof data === "object" && "detail" in data && data.detail ? data.detail : data;
261
- if (!body || !Array.isArray(body.purposes)) {
262
- return null;
263
- }
264
- return body;
265
- } catch {
266
- return null;
267
- }
268
- };
269
- var buildLedgerConsentOverlay = (status, configPurposes) => {
270
- var _a, _b;
271
- const byUuid = new Map(status.purposes.map((p) => [p.uuid, p]));
272
- const hasHistory = status.purposes.some(
273
- (p) => (p.status || "INACTIVE") !== "INACTIVE"
274
- );
275
- if (!hasHistory) {
276
- return null;
277
- }
278
- const purpose_selections = {};
279
- for (const cp of configPurposes) {
280
- const lp = byUuid.get(cp.uuid);
281
- const purposeStatus = (lp == null ? void 0 : lp.status) || "INACTIVE";
282
- const selectedByUuid = new Map(
283
- ((lp == null ? void 0 : lp.data_elements) || []).map((de) => [de.uuid, de.selected])
284
- );
285
- const data_elements = {};
286
- for (const de of cp.data_elements) {
287
- data_elements[de.uuid] = {
288
- selected: (_a = selectedByUuid.get(de.uuid)) != null ? _a : false,
289
- enabled: de.enabled,
290
- required: de.required
291
- };
292
- }
293
- purpose_selections[cp.uuid] = {
294
- selected: (_b = lp == null ? void 0 : lp.selected) != null ? _b : false,
295
- status: purposeStatus,
296
- needs_reconsent: purposeStatus !== "ACTIVE",
297
- data_elements
298
- };
299
- }
300
- const reconsent_required = configPurposes.some(
301
- (cp) => {
302
- var _a2;
303
- return (((_a2 = purpose_selections[cp.uuid]) == null ? void 0 : _a2.status) || "INACTIVE") !== "ACTIVE";
304
- }
305
- );
306
- return { reconsent_required, purpose_selections };
307
- };
308
363
  var fetchTTSAudioUrls = async ({
309
364
  accessToken,
310
365
  baseUrl,
366
+ ledgerBaseUrl,
311
367
  noticeUuid,
312
368
  language,
313
- signal
369
+ signal,
370
+ ...sandboxParams
314
371
  }) => {
315
- if (!accessToken || !noticeUuid || !language) {
316
- throw new Error("accessToken, noticeUuid, and language are required");
317
- }
318
- const decodedToken = decodeTokenSafely(accessToken);
319
- if (!decodedToken) {
320
- throw new Error("Invalid access token");
372
+ if (!accessToken && !sandboxParams.token || !noticeUuid || !language) {
373
+ throw new Error("accessToken (or token), noticeUuid, and language are required");
321
374
  }
322
- const { organisation_uuid: ORGANISATION_UUID, workspace_uuid: WORKSPACE_UUID } = decodedToken;
323
- if (!ORGANISATION_UUID || !WORKSPACE_UUID) {
324
- throw new Error("Invalid token: missing organization or workspace UUID");
375
+ const { organisationUuid: ORGANISATION_UUID, workspaceUuid: WORKSPACE_UUID, sandbox } = resolveRequestAuth(accessToken, sandboxParams, decodeTokenSafely);
376
+ const apiBaseUrl = (sandbox ? null : ledgerBaseUrl) || baseUrl || BASE_URL;
377
+ const url = new URL(
378
+ `${apiBaseUrl}/public/organisations/${ORGANISATION_UUID}/workspaces/${WORKSPACE_UUID}/notices/${noticeUuid}/audio/${language}`
379
+ );
380
+ if (sandbox) {
381
+ for (const [key, value] of Object.entries(sandboxQueryIdentity(sandbox))) {
382
+ url.searchParams.append(key, value);
383
+ }
325
384
  }
326
- const apiBaseUrl = baseUrl || BASE_URL;
327
- const url = `${apiBaseUrl}/public/organisations/${ORGANISATION_UUID}/workspaces/${WORKSPACE_UUID}/notices/${noticeUuid}/audio/${language}`;
328
- const response = await fetch(url, {
385
+ const response = await fetch(url.toString(), {
329
386
  method: "GET",
330
387
  headers: {
331
- Authorization: `Bearer ${accessToken}`,
388
+ ...buildAuthHeaders(accessToken, sandbox),
332
389
  Accept: "application/json"
333
390
  },
334
391
  signal
@@ -370,7 +427,10 @@ var initiateGuardianVerification = async ({
370
427
  if (!decodedToken) {
371
428
  throw new Error("Invalid access token");
372
429
  }
373
- const { organisation_uuid: ORGANISATION_UUID, workspace_uuid: WORKSPACE_UUID } = decodedToken;
430
+ const {
431
+ organisation_uuid: ORGANISATION_UUID,
432
+ workspace_uuid: WORKSPACE_UUID
433
+ } = decodedToken;
374
434
  if (!ORGANISATION_UUID || !WORKSPACE_UUID) {
375
435
  throw new Error("Invalid token: missing organization or workspace UUID");
376
436
  }
@@ -444,7 +504,10 @@ var verifyGuardianStatus = async ({
444
504
  if (!decodedToken) {
445
505
  throw new Error("Invalid access token");
446
506
  }
447
- const { organisation_uuid: ORGANISATION_UUID, workspace_uuid: WORKSPACE_UUID } = decodedToken;
507
+ const {
508
+ organisation_uuid: ORGANISATION_UUID,
509
+ workspace_uuid: WORKSPACE_UUID
510
+ } = decodedToken;
448
511
  if (!ORGANISATION_UUID || !WORKSPACE_UUID) {
449
512
  throw new Error("Invalid token: missing organization or workspace UUID");
450
513
  }
@@ -457,9 +520,7 @@ var verifyGuardianStatus = async ({
457
520
  Authorization: `Bearer ${accessToken}`,
458
521
  "Content-Type": "application/json"
459
522
  },
460
- body: JSON.stringify({
461
- session_token: sessionToken
462
- }),
523
+ body: JSON.stringify({ session_token: sessionToken }),
463
524
  signal
464
525
  }
465
526
  );
@@ -502,7 +563,6 @@ var LANGUAGE_NATIVE_LABELS = {
502
563
  English: "English",
503
564
  Assamese: "\u0985\u09B8\u09AE\u09C0\u09AF\u09BC\u09BE (Assamese)",
504
565
  Bengali: "\u09AC\u09BE\u0982\u09B2\u09BE (Bengali)",
505
- Bhojpuri: "\u092D\u094B\u091C\u092A\u0941\u0930\u0940 (Bhojpuri)",
506
566
  Bodo: "\u092C\u0921\u093C\u094B (Bodo)",
507
567
  Dogri: "\u0921\u094B\u0917\u0930\u0940 (Dogri)",
508
568
  Gujarati: "\u0A97\u0AC1\u0A9C\u0AB0\u0ABE\u0AA4\u0AC0 (Gujarati)",
@@ -532,7 +592,6 @@ var LANGUAGE_NAME_TO_BCP47 = {
532
592
  English: "en",
533
593
  Assamese: "as",
534
594
  Bengali: "bn",
535
- Bhojpuri: "bho",
536
595
  Bodo: "brx",
537
596
  Dogri: "doi",
538
597
  Gujarati: "gu",
@@ -2323,6 +2382,12 @@ var RedactoNoticeConsent = ({
2323
2382
  noticeId,
2324
2383
  accessToken,
2325
2384
  refreshToken,
2385
+ token,
2386
+ email,
2387
+ mobile,
2388
+ ucic,
2389
+ organisationUuid,
2390
+ workspaceUuid,
2326
2391
  baseUrl,
2327
2392
  ledgerBaseUrl,
2328
2393
  language = "en",
@@ -2341,15 +2406,43 @@ var RedactoNoticeConsent = ({
2341
2406
  reviewModeButtonText = "Continue"
2342
2407
  }) => {
2343
2408
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q;
2409
+ const sandboxParams = useMemo(
2410
+ () => ({
2411
+ token,
2412
+ sandboxUcic: ucic,
2413
+ sandboxSubject: email || mobile,
2414
+ organisationUuid,
2415
+ workspaceUuid
2416
+ }),
2417
+ [token, ucic, email, mobile, organisationUuid, workspaceUuid]
2418
+ );
2344
2419
  const propValidationError = useMemo(() => {
2345
2420
  if (!(noticeId == null ? void 0 : noticeId.trim())) {
2346
2421
  return "RedactoNoticeConsent: 'noticeId' prop is required and cannot be empty";
2347
2422
  }
2423
+ if (token == null ? void 0 : token.trim()) {
2424
+ if (!(organisationUuid == null ? void 0 : organisationUuid.trim()) || !(workspaceUuid == null ? void 0 : workspaceUuid.trim())) {
2425
+ return "RedactoNoticeConsent: sandbox mode requires 'organisationUuid' and 'workspaceUuid'";
2426
+ }
2427
+ if (!(email == null ? void 0 : email.trim()) && !(mobile == null ? void 0 : mobile.trim()) && !(ucic == null ? void 0 : ucic.trim())) {
2428
+ return "RedactoNoticeConsent: sandbox mode requires 'email', 'mobile', or 'ucic'";
2429
+ }
2430
+ return null;
2431
+ }
2348
2432
  if (!(accessToken == null ? void 0 : accessToken.trim())) {
2349
2433
  return "RedactoNoticeConsent: 'accessToken' prop is required and cannot be empty";
2350
2434
  }
2351
2435
  return null;
2352
- }, [noticeId, accessToken]);
2436
+ }, [
2437
+ noticeId,
2438
+ accessToken,
2439
+ token,
2440
+ organisationUuid,
2441
+ workspaceUuid,
2442
+ email,
2443
+ mobile,
2444
+ ucic
2445
+ ]);
2353
2446
  if (propValidationError) {
2354
2447
  return /* @__PURE__ */ jsxs(
2355
2448
  "div",
@@ -2679,7 +2772,7 @@ var RedactoNoticeConsent = ({
2679
2772
  return content.dpo_info[key] || defaultText;
2680
2773
  };
2681
2774
  const fetchNotice = async () => {
2682
- var _a2, _b2, _c2;
2775
+ var _a2;
2683
2776
  if (isRequestInProgressRef.current) {
2684
2777
  return;
2685
2778
  }
@@ -2693,16 +2786,18 @@ var RedactoNoticeConsent = ({
2693
2786
  setShowAgeVerification(false);
2694
2787
  setShowGuardianForm(false);
2695
2788
  try {
2789
+ const noticeBaseUrl = ledgerBaseUrl && !applicationId && !token ? ledgerBaseUrl : baseUrl;
2696
2790
  const consentContentData = await fetchConsentContent({
2697
2791
  noticeId,
2698
2792
  accessToken,
2699
2793
  refreshToken,
2700
- baseUrl,
2794
+ baseUrl: noticeBaseUrl,
2701
2795
  language,
2702
2796
  specific_uuid: applicationId,
2703
2797
  validate_against: validateAgainst,
2704
2798
  include_fully_consented_data: includeFullyConsentedData,
2705
- signal: (_a2 = abortControllerRef.current) == null ? void 0 : _a2.signal
2799
+ signal: (_a2 = abortControllerRef.current) == null ? void 0 : _a2.signal,
2800
+ ...sandboxParams
2706
2801
  });
2707
2802
  const activeConfig = consentContentData.detail.active_config;
2708
2803
  setContent(activeConfig);
@@ -2720,24 +2815,8 @@ var RedactoNoticeConsent = ({
2720
2815
  {}
2721
2816
  );
2722
2817
  setCollapsedPurposes(initialCollapsedState);
2723
- let isReconsentRequired = consentContentData.detail.reconsent_required;
2724
- let purposeSelections = consentContentData.detail.purpose_selections;
2725
- if (ledgerBaseUrl && !applicationId) {
2726
- const ledgerStatus = await fetchNoticeConsentStatus({
2727
- accessToken,
2728
- ledgerBaseUrl,
2729
- noticeUuid: noticeId,
2730
- signal: (_b2 = abortControllerRef.current) == null ? void 0 : _b2.signal
2731
- });
2732
- if (ledgerStatus) {
2733
- const overlay = buildLedgerConsentOverlay(
2734
- ledgerStatus,
2735
- activeConfig.purposes
2736
- );
2737
- isReconsentRequired = (_c2 = overlay == null ? void 0 : overlay.reconsent_required) != null ? _c2 : false;
2738
- purposeSelections = overlay == null ? void 0 : overlay.purpose_selections;
2739
- }
2740
- }
2818
+ const isReconsentRequired = consentContentData.detail.reconsent_required;
2819
+ const purposeSelections = consentContentData.detail.purpose_selections;
2741
2820
  const newCategorizedPurposes = isReconsentRequired ? {
2742
2821
  alreadyConsented: activeConfig.purposes.filter(
2743
2822
  (purpose) => {
@@ -2768,9 +2847,9 @@ var RedactoNoticeConsent = ({
2768
2847
  const initialDataElementState = activeConfig.purposes.reduce(
2769
2848
  (acc, purpose) => {
2770
2849
  purpose.data_elements.forEach((element) => {
2771
- var _a3, _b3;
2850
+ var _a3, _b2;
2772
2851
  const combinedId = `${purpose.uuid}-${element.uuid}`;
2773
- if ((_b3 = (_a3 = purposeSelections == null ? void 0 : purposeSelections[purpose.uuid]) == null ? void 0 : _a3.data_elements) == null ? void 0 : _b3[element.uuid]) {
2852
+ if ((_b2 = (_a3 = purposeSelections == null ? void 0 : purposeSelections[purpose.uuid]) == null ? void 0 : _a3.data_elements) == null ? void 0 : _b2[element.uuid]) {
2774
2853
  acc[combinedId] = purposeSelections[purpose.uuid].data_elements[element.uuid].selected;
2775
2854
  } else {
2776
2855
  acc[combinedId] = false;
@@ -2786,9 +2865,9 @@ var RedactoNoticeConsent = ({
2786
2865
  const initialSelections = {};
2787
2866
  newCategorizedPurposes.alreadyConsented.forEach((purpose) => {
2788
2867
  purpose.data_elements.forEach((element) => {
2789
- var _a3, _b3;
2868
+ var _a3, _b2;
2790
2869
  const combinedId = `${purpose.uuid}-${element.uuid}`;
2791
- if ((_b3 = (_a3 = purposeSelections == null ? void 0 : purposeSelections[purpose.uuid]) == null ? void 0 : _a3.data_elements) == null ? void 0 : _b3[element.uuid]) {
2870
+ if ((_b2 = (_a3 = purposeSelections == null ? void 0 : purposeSelections[purpose.uuid]) == null ? void 0 : _a3.data_elements) == null ? void 0 : _b2[element.uuid]) {
2792
2871
  initialSelections[combinedId] = purposeSelections[purpose.uuid].data_elements[element.uuid].selected;
2793
2872
  } else {
2794
2873
  initialSelections[combinedId] = false;
@@ -2809,9 +2888,9 @@ var RedactoNoticeConsent = ({
2809
2888
  activeConfig.purposes.forEach(
2810
2889
  (purpose) => {
2811
2890
  purpose.data_elements.forEach((element) => {
2812
- var _a3, _b3;
2891
+ var _a3, _b2;
2813
2892
  const combinedId = `${purpose.uuid}-${element.uuid}`;
2814
- if ((_b3 = (_a3 = purposeSelections[purpose.uuid]) == null ? void 0 : _a3.data_elements) == null ? void 0 : _b3[element.uuid]) {
2893
+ if ((_b2 = (_a3 = purposeSelections[purpose.uuid]) == null ? void 0 : _a3.data_elements) == null ? void 0 : _b2[element.uuid]) {
2815
2894
  initialSelections[combinedId] = purposeSelections[purpose.uuid].data_elements[element.uuid].selected;
2816
2895
  } else {
2817
2896
  initialSelections[combinedId] = false;
@@ -2859,8 +2938,10 @@ var RedactoNoticeConsent = ({
2859
2938
  noticeId,
2860
2939
  accessToken,
2861
2940
  refreshToken,
2941
+ sandboxParams,
2862
2942
  language,
2863
2943
  applicationId,
2944
+ ledgerBaseUrl,
2864
2945
  validateAgainst,
2865
2946
  includeFullyConsentedData
2866
2947
  // Removed onError and isRefreshingToken from dependencies to prevent duplicate API calls
@@ -2975,7 +3056,8 @@ var RedactoNoticeConsent = ({
2975
3056
  meta_data: applicationId ? { specific_uuid: applicationId } : void 0,
2976
3057
  guardianVerificationReference: verificationReference || void 0,
2977
3058
  selfDeclaredAdult: selfDeclaredAdult || void 0,
2978
- signal: submitController.signal
3059
+ signal: submitController.signal,
3060
+ ...sandboxParams
2979
3061
  });
2980
3062
  }
2981
3063
  onAccept == null ? void 0 : onAccept();
@@ -3158,7 +3240,7 @@ var RedactoNoticeConsent = ({
3158
3240
  } finally {
3159
3241
  setIsSubmittingGuardian(false);
3160
3242
  }
3161
- }, [accessToken, baseUrl, guardianFormData, digilockerMode, digilockerCallbackUrl, selectedPurposes, selectedDataElements, noticeId, onError]);
3243
+ }, [accessToken, sandboxParams, baseUrl, guardianFormData, digilockerMode, digilockerCallbackUrl, selectedPurposes, selectedDataElements, noticeId, onError]);
3162
3244
  const handleAgeVerificationYes = useCallback(() => {
3163
3245
  setShowAgeVerification(false);
3164
3246
  setIsMinorFlow(false);
@@ -3215,7 +3297,7 @@ var RedactoNoticeConsent = ({
3215
3297
  setIsPollingStatus(false);
3216
3298
  isPollingStatusRef.current = false;
3217
3299
  setIsInitiatingVerification(false);
3218
- }, [accessToken, baseUrl]);
3300
+ }, [accessToken, sandboxParams, baseUrl]);
3219
3301
  const startPopupMonitoring = useCallback((popup) => {
3220
3302
  popupCheckIntervalRef.current = window.setInterval(() => {
3221
3303
  if (popup.closed) {
@@ -3243,8 +3325,8 @@ var RedactoNoticeConsent = ({
3243
3325
  []
3244
3326
  );
3245
3327
  const startStatusPolling = useCallback(
3246
- (token) => {
3247
- verificationSessionTokenRef.current = token;
3328
+ (token2) => {
3329
+ verificationSessionTokenRef.current = token2;
3248
3330
  setIsPollingStatus(true);
3249
3331
  isPollingStatusRef.current = true;
3250
3332
  setVerificationError(null);
@@ -3296,7 +3378,7 @@ var RedactoNoticeConsent = ({
3296
3378
  const response = await verifyGuardianStatus({
3297
3379
  accessToken,
3298
3380
  baseUrl,
3299
- sessionToken: token
3381
+ sessionToken: token2
3300
3382
  });
3301
3383
  consecutiveErrors = 0;
3302
3384
  if (response.status === "verified") {
@@ -3366,7 +3448,7 @@ var RedactoNoticeConsent = ({
3366
3448
  };
3367
3449
  statusPollIntervalRef.current = window.setTimeout(poll, POLL_INTERVAL);
3368
3450
  },
3369
- [accessToken, baseUrl, getVerificationErrorMessage]
3451
+ [accessToken, sandboxParams, baseUrl, getVerificationErrorMessage]
3370
3452
  );
3371
3453
  const handleBackToGuardianForm = useCallback((clearName = false) => {
3372
3454
  var _a2, _b2;
@@ -3706,9 +3788,11 @@ var RedactoNoticeConsent = ({
3706
3788
  fetchTTSAudioUrls({
3707
3789
  accessToken,
3708
3790
  baseUrl,
3791
+ ledgerBaseUrl,
3709
3792
  noticeUuid: content.notice_uuid,
3710
3793
  language: languageCode,
3711
- signal: ttsAbortController.signal
3794
+ signal: ttsAbortController.signal,
3795
+ ...sandboxParams
3712
3796
  }).then((response) => {
3713
3797
  setTtsAudioUrls(response.detail);
3714
3798
  setIsTTSAvailable(true);
@@ -3721,7 +3805,7 @@ var RedactoNoticeConsent = ({
3721
3805
  return () => {
3722
3806
  ttsAbortController.abort();
3723
3807
  };
3724
- }, [content, selectedLanguage, accessToken, baseUrl, getLanguageCode]);
3808
+ }, [content, selectedLanguage, accessToken, sandboxParams, baseUrl, ledgerBaseUrl, getLanguageCode]);
3725
3809
  const modalStyle = {
3726
3810
  borderRadius: (settings == null ? void 0 : settings.borderRadius) || "8px",
3727
3811
  backgroundColor: (settings == null ? void 0 : settings.backgroundColor) || "#ffffff"
@@ -4695,12 +4779,16 @@ var fetchConsentContent2 = async ({
4695
4779
  org_uuid,
4696
4780
  workspace_uuid,
4697
4781
  notice_uuid,
4782
+ accessToken,
4698
4783
  baseUrl,
4699
- specific_uuid
4784
+ language,
4785
+ specific_uuid,
4786
+ signal
4700
4787
  }) => {
4701
4788
  const apiBaseUrl = baseUrl || BASE_URL2;
4789
+ const noticesUrl = `${apiBaseUrl}/public/organisations/${org_uuid}/workspaces/${workspace_uuid}/notices`;
4702
4790
  const url = new URL(
4703
- `${apiBaseUrl}/public/organisations/${org_uuid}/workspaces/${workspace_uuid}/notices/get-notice/${notice_uuid}`
4791
+ accessToken ? `${noticesUrl}/${notice_uuid}` : `${noticesUrl}/get-notice/${notice_uuid}`
4704
4792
  );
4705
4793
  if (specific_uuid) {
4706
4794
  url.searchParams.append("specific_uuid", specific_uuid);
@@ -4708,8 +4796,11 @@ var fetchConsentContent2 = async ({
4708
4796
  const response = await fetch(url.toString(), {
4709
4797
  method: "GET",
4710
4798
  headers: {
4711
- "Content-Type": "application/json"
4712
- }
4799
+ "Content-Type": "application/json",
4800
+ "Accept-Language": language || "en",
4801
+ ...accessToken ? { Authorization: `Bearer ${accessToken}` } : {}
4802
+ },
4803
+ signal
4713
4804
  });
4714
4805
  if (!response.ok) {
4715
4806
  throw await parseApiError(
@@ -5199,6 +5290,9 @@ var RedactoConsentInlineComponent = ({
5199
5290
  const [selectedPurposes, setSelectedPurposes] = useState3({});
5200
5291
  const [selectedDataElements, setSelectedDataElements] = useState3({});
5201
5292
  const [hasAlreadyConsented, setHasAlreadyConsented] = useState3(false);
5293
+ const [isCheckingConsent, setIsCheckingConsent] = useState3(
5294
+ Boolean(ledgerBaseUrl) && !applicationId
5295
+ );
5202
5296
  const [fetchError, setFetchError] = useState3(null);
5203
5297
  const [errorMessage, setErrorMessage] = useState3(null);
5204
5298
  const hasSubmittedRef = useRef2(false);
@@ -5280,18 +5374,24 @@ var RedactoConsentInlineComponent = ({
5280
5374
  }
5281
5375
  return defaultText;
5282
5376
  };
5283
- const fetchNotice = async () => {
5377
+ const fetchNotice = async (signal) => {
5284
5378
  setIsLoading(true);
5285
5379
  setFetchError(null);
5380
+ setHasAlreadyConsented(false);
5286
5381
  try {
5287
5382
  const consentContentData = await fetchConsentContent2({
5288
5383
  org_uuid,
5289
5384
  workspace_uuid,
5290
5385
  notice_uuid,
5386
+ accessToken,
5291
5387
  baseUrl,
5292
5388
  language,
5293
- specific_uuid: applicationId
5389
+ specific_uuid: applicationId,
5390
+ signal
5294
5391
  });
5392
+ if (signal == null ? void 0 : signal.aborted) {
5393
+ return;
5394
+ }
5295
5395
  const activeConfig = consentContentData.detail.active_config;
5296
5396
  setContent(activeConfig);
5297
5397
  if (activeConfig.default_language) {
@@ -5327,6 +5427,9 @@ var RedactoConsentInlineComponent = ({
5327
5427
  );
5328
5428
  setSelectedPurposes(initialPurposeState);
5329
5429
  } catch (err) {
5430
+ if ((signal == null ? void 0 : signal.aborted) || err instanceof Error && err.name === "AbortError") {
5431
+ return;
5432
+ }
5330
5433
  const error = err;
5331
5434
  setFetchError(error);
5332
5435
  if (error.status === 409) {
@@ -5335,12 +5438,50 @@ var RedactoConsentInlineComponent = ({
5335
5438
  onError == null ? void 0 : onError(error);
5336
5439
  }
5337
5440
  } finally {
5338
- setIsLoading(false);
5441
+ if (!(signal == null ? void 0 : signal.aborted)) {
5442
+ setIsLoading(false);
5443
+ }
5339
5444
  }
5340
5445
  };
5341
5446
  useEffect3(() => {
5342
- fetchNotice();
5343
- }, [org_uuid, workspace_uuid, notice_uuid, language, applicationId]);
5447
+ const controller = new AbortController();
5448
+ void fetchNotice(controller.signal);
5449
+ return () => {
5450
+ controller.abort();
5451
+ };
5452
+ }, [org_uuid, workspace_uuid, notice_uuid, language, applicationId, accessToken]);
5453
+ useEffect3(() => {
5454
+ if (!ledgerBaseUrl || applicationId) {
5455
+ return;
5456
+ }
5457
+ if (!accessToken || !content) {
5458
+ return;
5459
+ }
5460
+ let active = true;
5461
+ const controller = new AbortController();
5462
+ const checkLedgerConsent = async () => {
5463
+ try {
5464
+ const ledgerStatus = await fetchNoticeConsentStatus({
5465
+ accessToken,
5466
+ ledgerBaseUrl,
5467
+ noticeUuid: notice_uuid,
5468
+ signal: controller.signal
5469
+ });
5470
+ if (active && ledgerStatus && isNoticeFullyConsented(ledgerStatus)) {
5471
+ setHasAlreadyConsented(true);
5472
+ }
5473
+ } finally {
5474
+ if (active) {
5475
+ setIsCheckingConsent(false);
5476
+ }
5477
+ }
5478
+ };
5479
+ checkLedgerConsent();
5480
+ return () => {
5481
+ active = false;
5482
+ controller.abort();
5483
+ };
5484
+ }, [ledgerBaseUrl, applicationId, accessToken, content, notice_uuid]);
5344
5485
  const togglePurposeCollapse = (purposeUuid) => {
5345
5486
  setCollapsedPurposes((prev) => ({
5346
5487
  ...prev,
@@ -5464,7 +5605,7 @@ var RedactoConsentInlineComponent = ({
5464
5605
  ]
5465
5606
  );
5466
5607
  useEffect3(() => {
5467
- if (accessToken && content && areAllRequiredElementsChecked && !isSubmitting && !hasSubmittedRef.current) {
5608
+ if (accessToken && content && areAllRequiredElementsChecked && !isSubmitting && !isCheckingConsent && !hasAlreadyConsented && !hasSubmittedRef.current) {
5468
5609
  hasSubmittedRef.current = true;
5469
5610
  const autoSubmit = async () => {
5470
5611
  try {
@@ -5481,6 +5622,8 @@ var RedactoConsentInlineComponent = ({
5481
5622
  content,
5482
5623
  areAllRequiredElementsChecked,
5483
5624
  isSubmitting,
5625
+ isCheckingConsent,
5626
+ hasAlreadyConsented,
5484
5627
  handleAcceptWithToken
5485
5628
  ]);
5486
5629
  useEffect3(() => {
@@ -6741,6 +6884,7 @@ var submitAssistedConsent = async ({
6741
6884
  organisationUuid,
6742
6885
  workspaceUuid,
6743
6886
  baseUrl,
6887
+ ledgerBaseUrl,
6744
6888
  noticeUuid,
6745
6889
  purposes,
6746
6890
  language,
@@ -6771,7 +6915,7 @@ var submitAssistedConsent = async ({
6771
6915
  declined: false,
6772
6916
  language: language || void 0
6773
6917
  };
6774
- const url = `${publicScope(baseUrl, organisationUuid, workspaceUuid)}/submit-consent`;
6918
+ const url = `${publicScope(ledgerBaseUrl || baseUrl, organisationUuid, workspaceUuid)}/submit-consent`;
6775
6919
  const response = await fetch(url, {
6776
6920
  method: "POST",
6777
6921
  headers: {
@@ -7898,57 +8042,6 @@ var as = {
7898
8042
  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",
7899
8043
  close: "\u09AC\u09A8\u09CD\u09A7 \u0995\u09F0\u0995"
7900
8044
  };
7901
- var bho = {
7902
- useEmailInstead: "\u0908\u092E\u0947\u0932 \u0907\u0938\u094D\u0924\u0947\u092E\u093E\u0932 \u0915\u0930\u0940\u0902",
7903
- useMobileInstead: "\u092E\u094B\u092C\u093E\u0907\u0932 \u0907\u0938\u094D\u0924\u0947\u092E\u093E\u0932 \u0915\u0930\u0940\u0902",
7904
- emailAddress: "\u0908\u092E\u0947\u0932 \u092A\u0924\u093E",
7905
- 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",
7906
- changeEmail: "\u0908\u092E\u0947\u0932 \u092C\u0926\u0932\u0940\u0902",
7907
- expandDetails: "{name} \u0915\u0947 \u0935\u093F\u0935\u0930\u0923 \u092B\u0948\u0932\u093E\u0908\u0902",
7908
- collapseDetails: "{name} \u0915\u0947 \u0935\u093F\u0935\u0930\u0923 \u0938\u092E\u0947\u091F\u0940\u0902",
7909
- selectAllFor: "{name} \u0916\u093E\u0924\u093F\u0930 \u0938\u092D \u0921\u0947\u091F\u093E \u0924\u0924\u094D\u0935 \u091A\u0941\u0928\u0940\u0902",
7910
- selectElement: "{name} \u091A\u0941\u0928\u0940\u0902",
7911
- selectElementRequired: "{name} \u091A\u0941\u0928\u0940\u0902 (\u091C\u0930\u0942\u0930\u0940)",
7912
- required: "\u091C\u0930\u0942\u0930\u0940",
7913
- logoAlt: "\u0932\u094B\u0917\u094B",
7914
- selectLanguage: "\u092D\u093E\u0937\u093E \u091A\u0941\u0928\u0940\u0902",
7915
- selectLanguageCurrent: "\u092D\u093E\u0937\u093E \u091A\u0941\u0928\u0940\u0902. \u092E\u094C\u091C\u0942\u0926\u093E \u092D\u093E\u0937\u093E: {lang}",
7916
- opensInNewTab: "\u0928\u092F\u093E \u091F\u0948\u092C \u092E\u0947\u0902 \u0916\u0941\u0932\u0947\u0932\u093E",
7917
- audioStart: "\u0911\u0921\u093F\u092F\u094B \u092A\u094D\u0932\u0947\u092C\u0948\u0915 \u0936\u0941\u0930\u0942 \u0915\u0930\u0940\u0902",
7918
- audioPause: "\u0911\u0921\u093F\u092F\u094B \u092A\u094D\u0932\u0947\u092C\u0948\u0915 \u0930\u094B\u0915\u0940\u0902",
7919
- talkbackStart: "\u091F\u0949\u0915\u092C\u0948\u0915 \u0936\u0941\u0930\u0942 \u0915\u0930\u0940\u0902",
7920
- talkbackPause: "\u091F\u0949\u0915\u092C\u0948\u0915 \u0930\u094B\u0915\u0940\u0902",
7921
- mobileNumber: "\u092E\u094B\u092C\u093E\u0907\u0932 \u0928\u0902\u092C\u0930",
7922
- 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",
7923
- otpSentTo: "\u0913\u091F\u0940\u092A\u0940 (OTP) \u092D\u0947\u091C\u0932 \u0917\u0907\u0932",
7924
- changeMobile: "\u092E\u094B\u092C\u093E\u0907\u0932 \u0928\u0902\u092C\u0930 \u092C\u0926\u0932\u0940\u0902",
7925
- enterNDigitOtp: "{count}-\u0905\u0902\u0915 \u0915\u0947 \u0913\u091F\u0940\u092A\u0940 (OTP) \u0921\u093E\u0932\u0940\u0902",
7926
- otpDigit: "\u0913\u091F\u0940\u092A\u0940 (OTP) \u0905\u0902\u0915 {index}",
7927
- 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",
7928
- sending: "\u092D\u0947\u091C\u0932 \u091C\u093E \u0930\u0939\u0932 \u092C\u093E\u2026",
7929
- resendOtp: "\u0913\u091F\u0940\u092A\u0940 (OTP) \u092B\u0947\u0930 \u0938\u0947 \u092D\u0947\u091C\u0940\u0902",
7930
- getOtp: "\u0913\u091F\u0940\u092A\u0940 (OTP) \u092A\u093E\u0908\u0902",
7931
- verifying: "\u0938\u0924\u094D\u092F\u093E\u092A\u093F\u0924 \u0915\u0907\u0932 \u091C\u093E \u0930\u0939\u0932 \u092C\u093E\u2026",
7932
- verifyOtp: "\u0913\u091F\u0940\u092A\u0940 (OTP) \u0938\u0924\u094D\u092F\u093E\u092A\u093F\u0924 \u0915\u0930\u0940\u0902",
7933
- sendOtp: "\u0913\u091F\u0940\u092A\u0940 (OTP) \u092D\u0947\u091C\u0940\u0902",
7934
- confirmOtp: "\u0913\u091F\u0940\u092A\u0940 (OTP) \u0915\u0947 \u092A\u0941\u0937\u094D\u091F\u093F \u0915\u0930\u0940\u0902",
7935
- verifyWithOtp: "\u0913\u091F\u0940\u092A\u0940 (OTP) \u0938\u0947 \u0938\u0924\u094D\u092F\u093E\u092A\u093F\u0924 \u0915\u0930\u0940\u0902",
7936
- editSelections: "\u091A\u0941\u0928\u093E\u0935 \u092E\u0947\u0902 \u092C\u0926\u0932\u093E\u0935 \u0915\u0930\u0940\u0902",
7937
- 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",
7938
- 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",
7939
- 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",
7940
- 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",
7941
- 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",
7942
- consentConfirmed: "\u0938\u0939\u092E\u0924\u093F \u0915\u0947 \u092A\u0941\u0937\u094D\u091F\u093F \u092D\u0907\u0932",
7943
- 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",
7944
- 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",
7945
- consentReferenceId: "\u0938\u0939\u092E\u0924\u093F \u0938\u0902\u0926\u0930\u094D\u092D \u0906\u0908\u0921\u0940",
7946
- proceed: "\u0906\u0917\u0947 \u092C\u0922\u093C\u0940\u0902",
7947
- loadingNotice: "\u0928\u094B\u091F\u093F\u0938 \u0932\u094B\u0921 \u0939\u094B \u0930\u0939\u0932 \u092C\u093E",
7948
- loadFailedTitle: "\u0938\u0939\u092E\u0924\u093F \u0928\u094B\u091F\u093F\u0938 \u0932\u094B\u0921 \u0928\u093E \u0939\u094B \u0938\u0915\u0932",
7949
- tryAgain: "\u0915\u0943\u092A\u092F\u093E \u092B\u0947\u0930 \u0938\u0947 \u0915\u094B\u0938\u093F\u0938 \u0915\u0930\u0940\u0902\u0964",
7950
- close: "\u092C\u0902\u0926 \u0915\u0930\u0940\u0902"
7951
- };
7952
8045
  var brx = {
7953
8046
  useEmailInstead: "\u0907\u092E\u0947\u0932 \u092C\u093E\u0939\u093E\u092F",
7954
8047
  useMobileInstead: "\u092E\u092C\u093E\u0907\u0932 \u092C\u093E\u0939\u093E\u092F",
@@ -8073,7 +8166,6 @@ var STATIC_STRINGS = {
8073
8166
  te,
8074
8167
  ur,
8075
8168
  as,
8076
- bho,
8077
8169
  brx,
8078
8170
  doi
8079
8171
  };
@@ -8258,6 +8350,7 @@ var RedactoNoticeAssisted = ({
8258
8350
  workspaceUuid,
8259
8351
  noticeUuid,
8260
8352
  baseUrl,
8353
+ ledgerBaseUrl,
8261
8354
  onDecline,
8262
8355
  onComplete
8263
8356
  }) => {
@@ -8993,6 +9086,19 @@ var RedactoNoticeAssisted = ({
8993
9086
  return;
8994
9087
  }
8995
9088
  const token = verifyDetail.access_token;
9089
+ if (ledgerBaseUrl) {
9090
+ const ledgerStatus = await fetchNoticeConsentStatusForScope({
9091
+ accessToken: token,
9092
+ ledgerBaseUrl,
9093
+ organisationUuid,
9094
+ workspaceUuid,
9095
+ noticeUuid: content.notice_uuid
9096
+ });
9097
+ if (ledgerStatus && isNoticeFullyConsented(ledgerStatus)) {
9098
+ handleSuccess();
9099
+ return;
9100
+ }
9101
+ }
8996
9102
  const submitPurposes = content.purposes.map((purpose) => ({
8997
9103
  ...purpose,
8998
9104
  selected: selectedPurposes[purpose.uuid] || false,
@@ -9006,6 +9112,7 @@ var RedactoNoticeAssisted = ({
9006
9112
  organisationUuid,
9007
9113
  workspaceUuid,
9008
9114
  baseUrl,
9115
+ ledgerBaseUrl,
9009
9116
  noticeUuid: content.notice_uuid,
9010
9117
  purposes: submitPurposes,
9011
9118
  language: toBcp47Code(selectedLanguage)
@@ -9029,6 +9136,7 @@ var RedactoNoticeAssisted = ({
9029
9136
  otpUuid,
9030
9137
  otpValue,
9031
9138
  baseUrl,
9139
+ ledgerBaseUrl,
9032
9140
  selectedPurposes,
9033
9141
  selectedDataElements,
9034
9142
  selectedLanguage,