@redacto.io/consent-sdk-react-native 5.0.0-beta.1 → 5.0.0-beta.3

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.
@@ -0,0 +1,48 @@
1
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
2
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
3
+ }) : x)(function(x) {
4
+ if (typeof require !== "undefined") return require.apply(this, arguments);
5
+ throw Error('Dynamic require of "' + x + '" is not supported');
6
+ });
7
+
8
+ // src/shared/languages.ts
9
+ var languageOptions = [
10
+ { value: "en", label: "English" },
11
+ { value: "hi", label: "\u0939\u093F\u0928\u094D\u0926\u0940 (Hindi)" },
12
+ { value: "te", label: "\u0C24\u0C46\u0C32\u0C41\u0C17\u0C41 (Telugu)" },
13
+ { value: "mr", label: "\u092E\u0930\u093E\u0920\u0940 (Marathi)" },
14
+ { value: "ta", label: "\u0BA4\u0BAE\u0BBF\u0BB4\u0BCD (Tamil)" },
15
+ { value: "ur", label: "\u0627\u0631\u062F\u0648 (Urdu)" },
16
+ { value: "gu", label: "\u0A97\u0AC1\u0A9C\u0AB0\u0ABE\u0AA4\u0AC0 (Gujarati)" },
17
+ { value: "kn", label: "\u0C95\u0CA8\u0CCD\u0CA8\u0CA1 (Kannada)" },
18
+ { value: "ml", label: "\u0D2E\u0D32\u0D2F\u0D3E\u0D33\u0D02 (Malayalam)" },
19
+ { value: "pa", label: "\u0A2A\u0A70\u0A1C\u0A3E\u0A2C\u0A40 (Punjabi)" },
20
+ { value: "or", label: "\u0B13\u0B21\u0B3C\u0B3F\u0B06 (Odia)" },
21
+ { value: "as", label: "\u0985\u09B8\u09AE\u09C0\u09AF\u09BC\u09BE (Assamese)" },
22
+ { value: "bn", label: "\u09AC\u09BE\u0982\u09B2\u09BE (Bengali)" },
23
+ { value: "mai", label: "\u092E\u0948\u0925\u093F\u0932\u0940 (Maithili)" },
24
+ { value: "ne", label: "\u0928\u0947\u092A\u093E\u0932\u0940 (Nepali)" },
25
+ { value: "sd", label: "\u0633\u0646\u068C\u064A (Sindhi)" },
26
+ { value: "doi", label: "\u0921\u094B\u0917\u0930\u0940 (Dogri)" },
27
+ { value: "mni-Mtei", label: "\uABC3\uABE9\uABC7\uABE9\uABC2\uABE3\uABDF (Manipuri)" },
28
+ { value: "gom", label: "\u0915\u094B\u0902\u0915\u0923\u0940 (Goan Konkani)" },
29
+ { value: "sa", label: "\u0938\u0902\u0938\u094D\u0915\u0943\u0924\u092E\u094D (Sanskrit)" },
30
+ { value: "brx", label: "\u092C\u0921\u093C\u094B (Bodo)" },
31
+ { value: "ks", label: "\u0643\u0672\u0634\u064F\u0631 (Kashmiri)" },
32
+ { value: "sat", label: "\u1C65\u1C5F\u1C71\u1C5B\u1C5F\u1C72\u1C64 (Santali)" }
33
+ ];
34
+ var codeByLabel = new Map(languageOptions.map((o) => [o.label, o.value]));
35
+ var codeByLower = new Map(languageOptions.map((o) => [o.value.toLowerCase(), o.value]));
36
+ function toLanguageCode(lang) {
37
+ var _a, _b;
38
+ if (!lang) return void 0;
39
+ const trimmed = lang.trim();
40
+ if (!trimmed) return void 0;
41
+ return (_b = (_a = codeByLabel.get(trimmed)) != null ? _a : codeByLower.get(trimmed.toLowerCase())) != null ? _b : trimmed;
42
+ }
43
+
44
+ export {
45
+ __require,
46
+ languageOptions,
47
+ toLanguageCode
48
+ };
package/dist/index.js CHANGED
@@ -46,6 +46,42 @@ var import_jwt_decode = require("jwt-decode");
46
46
  // src/constants.ts
47
47
  var DEFAULT_CONSENT_API_BASE_URL = "https://api.redacto.io/consent";
48
48
 
49
+ // src/shared/languages.ts
50
+ var languageOptions = [
51
+ { value: "en", label: "English" },
52
+ { value: "hi", label: "\u0939\u093F\u0928\u094D\u0926\u0940 (Hindi)" },
53
+ { value: "te", label: "\u0C24\u0C46\u0C32\u0C41\u0C17\u0C41 (Telugu)" },
54
+ { value: "mr", label: "\u092E\u0930\u093E\u0920\u0940 (Marathi)" },
55
+ { value: "ta", label: "\u0BA4\u0BAE\u0BBF\u0BB4\u0BCD (Tamil)" },
56
+ { value: "ur", label: "\u0627\u0631\u062F\u0648 (Urdu)" },
57
+ { value: "gu", label: "\u0A97\u0AC1\u0A9C\u0AB0\u0ABE\u0AA4\u0AC0 (Gujarati)" },
58
+ { value: "kn", label: "\u0C95\u0CA8\u0CCD\u0CA8\u0CA1 (Kannada)" },
59
+ { value: "ml", label: "\u0D2E\u0D32\u0D2F\u0D3E\u0D33\u0D02 (Malayalam)" },
60
+ { value: "pa", label: "\u0A2A\u0A70\u0A1C\u0A3E\u0A2C\u0A40 (Punjabi)" },
61
+ { value: "or", label: "\u0B13\u0B21\u0B3C\u0B3F\u0B06 (Odia)" },
62
+ { value: "as", label: "\u0985\u09B8\u09AE\u09C0\u09AF\u09BC\u09BE (Assamese)" },
63
+ { value: "bn", label: "\u09AC\u09BE\u0982\u09B2\u09BE (Bengali)" },
64
+ { value: "mai", label: "\u092E\u0948\u0925\u093F\u0932\u0940 (Maithili)" },
65
+ { value: "ne", label: "\u0928\u0947\u092A\u093E\u0932\u0940 (Nepali)" },
66
+ { value: "sd", label: "\u0633\u0646\u068C\u064A (Sindhi)" },
67
+ { value: "doi", label: "\u0921\u094B\u0917\u0930\u0940 (Dogri)" },
68
+ { value: "mni-Mtei", label: "\uABC3\uABE9\uABC7\uABE9\uABC2\uABE3\uABDF (Manipuri)" },
69
+ { value: "gom", label: "\u0915\u094B\u0902\u0915\u0923\u0940 (Goan Konkani)" },
70
+ { value: "sa", label: "\u0938\u0902\u0938\u094D\u0915\u0943\u0924\u092E\u094D (Sanskrit)" },
71
+ { value: "brx", label: "\u092C\u0921\u093C\u094B (Bodo)" },
72
+ { value: "ks", label: "\u0643\u0672\u0634\u064F\u0631 (Kashmiri)" },
73
+ { value: "sat", label: "\u1C65\u1C5F\u1C71\u1C5B\u1C5F\u1C72\u1C64 (Santali)" }
74
+ ];
75
+ var codeByLabel = new Map(languageOptions.map((o) => [o.label, o.value]));
76
+ var codeByLower = new Map(languageOptions.map((o) => [o.value.toLowerCase(), o.value]));
77
+ function toLanguageCode(lang) {
78
+ var _a, _b;
79
+ if (!lang) return void 0;
80
+ const trimmed = lang.trim();
81
+ if (!trimmed) return void 0;
82
+ return (_b = (_a = codeByLabel.get(trimmed)) != null ? _a : codeByLower.get(trimmed.toLowerCase())) != null ? _b : trimmed;
83
+ }
84
+
49
85
  // src/RedactoNoticeConsent/api/index.ts
50
86
  var apiCache = /* @__PURE__ */ new Map();
51
87
  var CACHE_TTL = 5 * 60 * 1e3;
@@ -154,6 +190,7 @@ var submitConsentEvent = async ({
154
190
  meta_data,
155
191
  guardianVerificationReference,
156
192
  selfDeclaredAdult,
193
+ language,
157
194
  signal
158
195
  }) => {
159
196
  if (!noticeUuid || !accessToken || !Array.isArray(purposes)) {
@@ -190,7 +227,8 @@ var submitConsentEvent = async ({
190
227
  declined: Boolean(declined),
191
228
  meta_data: meta_data ? { specific_uuid: meta_data.specific_uuid } : void 0,
192
229
  guardian_verification_reference: guardianVerificationReference,
193
- self_declared_adult: selfDeclaredAdult
230
+ self_declared_adult: selfDeclaredAdult,
231
+ language: toLanguageCode(language)
194
232
  };
195
233
  const response = await fetch(
196
234
  `${apiBaseUrl}/public/organisations/${ORGANISATION_UUID}/workspaces/${WORKSPACE_UUID}/submit-consent`,
@@ -2329,7 +2367,8 @@ var RedactoNoticeConsent = ({
2329
2367
  declined: false,
2330
2368
  meta_data: applicationId ? { specific_uuid: applicationId } : void 0,
2331
2369
  guardianVerificationReference: verificationReferenceRef.current || void 0,
2332
- selfDeclaredAdult: selfDeclaredAdult || void 0
2370
+ selfDeclaredAdult: selfDeclaredAdult || void 0,
2371
+ language: selectedLanguage
2333
2372
  });
2334
2373
  await stopAudio();
2335
2374
  clearApiCache();
@@ -2344,7 +2383,7 @@ var RedactoNoticeConsent = ({
2344
2383
  } finally {
2345
2384
  setIsSubmitting(false);
2346
2385
  }
2347
- }, [content, accessToken, baseUrl, ledgerBaseUrl, applicationId, selectedPurposes, selectedDataElements, stopAudio, onAccept, onError]);
2386
+ }, [content, accessToken, baseUrl, ledgerBaseUrl, applicationId, selectedPurposes, selectedDataElements, selectedLanguage, stopAudio, onAccept, onError]);
2348
2387
  const handleDecline = (0, import_react2.useCallback)(() => {
2349
2388
  stopAudio();
2350
2389
  stopPolling();
@@ -2996,7 +3035,8 @@ var submitConsentEvent2 = async ({
2996
3035
  noticeUuid,
2997
3036
  purposes,
2998
3037
  declined,
2999
- meta_data
3038
+ meta_data,
3039
+ language
3000
3040
  }) => {
3001
3041
  var _a, _b;
3002
3042
  const apiBaseUrl = ledgerBaseUrl || baseUrl || DEFAULT_CONSENT_API_BASE_URL;
@@ -3019,7 +3059,8 @@ var submitConsentEvent2 = async ({
3019
3059
  select_all_mandatory: false,
3020
3060
  source: "MOBILE",
3021
3061
  declined,
3022
- meta_data
3062
+ meta_data,
3063
+ language: toLanguageCode(language)
3023
3064
  };
3024
3065
  const response = await fetch(
3025
3066
  `${apiBaseUrl}/public/organisations/${org_uuid}/workspaces/${workspace_uuid}/submit-consent`,
@@ -3567,7 +3608,8 @@ var RedactoConsentInlineComponent = ({
3567
3608
  };
3568
3609
  }),
3569
3610
  declined: false,
3570
- meta_data: applicationId ? { specific_uuid: applicationId } : void 0
3611
+ meta_data: applicationId ? { specific_uuid: applicationId } : void 0,
3612
+ language: selectedLanguage
3571
3613
  });
3572
3614
  onAccept == null ? void 0 : onAccept();
3573
3615
  hasSubmittedRef.current = false;
@@ -3590,6 +3632,7 @@ var RedactoConsentInlineComponent = ({
3590
3632
  selectedDataElements,
3591
3633
  selectedPurposes,
3592
3634
  applicationId,
3635
+ selectedLanguage,
3593
3636
  onAccept
3594
3637
  ]
3595
3638
  );
package/dist/index.mjs CHANGED
@@ -1,4 +1,6 @@
1
- import "./chunk-Y6FXYEAI.mjs";
1
+ import {
2
+ toLanguageCode
3
+ } from "./chunk-IVOOB4JK.mjs";
2
4
 
3
5
  // src/RedactoNoticeConsent/RedactoNoticeConsent.tsx
4
6
  import {
@@ -138,6 +140,7 @@ var submitConsentEvent = async ({
138
140
  meta_data,
139
141
  guardianVerificationReference,
140
142
  selfDeclaredAdult,
143
+ language,
141
144
  signal
142
145
  }) => {
143
146
  if (!noticeUuid || !accessToken || !Array.isArray(purposes)) {
@@ -174,7 +177,8 @@ var submitConsentEvent = async ({
174
177
  declined: Boolean(declined),
175
178
  meta_data: meta_data ? { specific_uuid: meta_data.specific_uuid } : void 0,
176
179
  guardian_verification_reference: guardianVerificationReference,
177
- self_declared_adult: selfDeclaredAdult
180
+ self_declared_adult: selfDeclaredAdult,
181
+ language: toLanguageCode(language)
178
182
  };
179
183
  const response = await fetch(
180
184
  `${apiBaseUrl}/public/organisations/${ORGANISATION_UUID}/workspaces/${WORKSPACE_UUID}/submit-consent`,
@@ -2320,7 +2324,8 @@ var RedactoNoticeConsent = ({
2320
2324
  declined: false,
2321
2325
  meta_data: applicationId ? { specific_uuid: applicationId } : void 0,
2322
2326
  guardianVerificationReference: verificationReferenceRef.current || void 0,
2323
- selfDeclaredAdult: selfDeclaredAdult || void 0
2327
+ selfDeclaredAdult: selfDeclaredAdult || void 0,
2328
+ language: selectedLanguage
2324
2329
  });
2325
2330
  await stopAudio();
2326
2331
  clearApiCache();
@@ -2335,7 +2340,7 @@ var RedactoNoticeConsent = ({
2335
2340
  } finally {
2336
2341
  setIsSubmitting(false);
2337
2342
  }
2338
- }, [content, accessToken, baseUrl, ledgerBaseUrl, applicationId, selectedPurposes, selectedDataElements, stopAudio, onAccept, onError]);
2343
+ }, [content, accessToken, baseUrl, ledgerBaseUrl, applicationId, selectedPurposes, selectedDataElements, selectedLanguage, stopAudio, onAccept, onError]);
2339
2344
  const handleDecline = useCallback(() => {
2340
2345
  stopAudio();
2341
2346
  stopPolling();
@@ -3000,7 +3005,8 @@ var submitConsentEvent2 = async ({
3000
3005
  noticeUuid,
3001
3006
  purposes,
3002
3007
  declined,
3003
- meta_data
3008
+ meta_data,
3009
+ language
3004
3010
  }) => {
3005
3011
  var _a, _b;
3006
3012
  const apiBaseUrl = ledgerBaseUrl || baseUrl || DEFAULT_CONSENT_API_BASE_URL;
@@ -3023,7 +3029,8 @@ var submitConsentEvent2 = async ({
3023
3029
  select_all_mandatory: false,
3024
3030
  source: "MOBILE",
3025
3031
  declined,
3026
- meta_data
3032
+ meta_data,
3033
+ language: toLanguageCode(language)
3027
3034
  };
3028
3035
  const response = await fetch(
3029
3036
  `${apiBaseUrl}/public/organisations/${org_uuid}/workspaces/${workspace_uuid}/submit-consent`,
@@ -3571,7 +3578,8 @@ var RedactoConsentInlineComponent = ({
3571
3578
  };
3572
3579
  }),
3573
3580
  declined: false,
3574
- meta_data: applicationId ? { specific_uuid: applicationId } : void 0
3581
+ meta_data: applicationId ? { specific_uuid: applicationId } : void 0,
3582
+ language: selectedLanguage
3575
3583
  });
3576
3584
  onAccept == null ? void 0 : onAccept();
3577
3585
  hasSubmittedRef.current = false;
@@ -3594,6 +3602,7 @@ var RedactoConsentInlineComponent = ({
3594
3602
  selectedDataElements,
3595
3603
  selectedPurposes,
3596
3604
  applicationId,
3605
+ selectedLanguage,
3597
3606
  onAccept
3598
3607
  ]
3599
3608
  );
@@ -636,7 +636,7 @@ declare function createConsentClient(baseUrl: string, ledgerBaseUrl?: string): {
636
636
  manageConsent(baseRequest: BaseRequest, purposeId: string, contact: string, status: "revoke" | "regrant" | "renew", authToken?: string, options?: Omit<ApiFetchOptions, "getAuthToken">, nominatorContact?: string, dataElementUuids?: string[], noticeUuid?: string, dataElements?: Array<{
637
637
  uuid: string;
638
638
  selected: boolean;
639
- }>): Promise<unknown>;
639
+ }>, language?: string): Promise<unknown>;
640
640
  /**
641
641
  * Get activities (privacy center)
642
642
  */
@@ -772,7 +772,7 @@ type FetchUserConsentsParams = {
772
772
  consentClient?: BaseUrlContextValue['consentClient'];
773
773
  };
774
774
  declare const fetchUserConsents: (params: FetchUserConsentsParams) => Promise<UserConsentDetail | null>;
775
- declare const manageConsent: ({ organizationId, workspaceId, purposeId, contact, action, authContext, consentClient, nominatorContact, dataElementUuids, noticeUuid, dataElements, }: {
775
+ declare const manageConsent: ({ organizationId, workspaceId, purposeId, contact, action, authContext, consentClient, nominatorContact, dataElementUuids, noticeUuid, dataElements, language, }: {
776
776
  organizationId: string;
777
777
  workspaceId: string;
778
778
  purposeId: string;
@@ -787,6 +787,7 @@ declare const manageConsent: ({ organizationId, workspaceId, purposeId, contact,
787
787
  uuid: string;
788
788
  selected: boolean;
789
789
  }>;
790
+ language?: string;
790
791
  }) => Promise<boolean | null>;
791
792
  declare const fetchActivities: (organizationId: string, workspaceId: string, offset?: number, limit?: number, authContext?: AuthContext, consentClient?: BaseUrlContextValue["consentClient"], language?: string) => Promise<ActivityDetail | null>;
792
793
  declare const fetchCaseHistory: (organizationId: string, workspaceId: string, contact: string, offset?: number, limit?: number, authContext?: AuthContext, consentClient?: BaseUrlContextValue["consentClient"], language?: string) => Promise<CaseHistoryDetail | null>;
@@ -636,7 +636,7 @@ declare function createConsentClient(baseUrl: string, ledgerBaseUrl?: string): {
636
636
  manageConsent(baseRequest: BaseRequest, purposeId: string, contact: string, status: "revoke" | "regrant" | "renew", authToken?: string, options?: Omit<ApiFetchOptions, "getAuthToken">, nominatorContact?: string, dataElementUuids?: string[], noticeUuid?: string, dataElements?: Array<{
637
637
  uuid: string;
638
638
  selected: boolean;
639
- }>): Promise<unknown>;
639
+ }>, language?: string): Promise<unknown>;
640
640
  /**
641
641
  * Get activities (privacy center)
642
642
  */
@@ -772,7 +772,7 @@ type FetchUserConsentsParams = {
772
772
  consentClient?: BaseUrlContextValue['consentClient'];
773
773
  };
774
774
  declare const fetchUserConsents: (params: FetchUserConsentsParams) => Promise<UserConsentDetail | null>;
775
- declare const manageConsent: ({ organizationId, workspaceId, purposeId, contact, action, authContext, consentClient, nominatorContact, dataElementUuids, noticeUuid, dataElements, }: {
775
+ declare const manageConsent: ({ organizationId, workspaceId, purposeId, contact, action, authContext, consentClient, nominatorContact, dataElementUuids, noticeUuid, dataElements, language, }: {
776
776
  organizationId: string;
777
777
  workspaceId: string;
778
778
  purposeId: string;
@@ -787,6 +787,7 @@ declare const manageConsent: ({ organizationId, workspaceId, purposeId, contact,
787
787
  uuid: string;
788
788
  selected: boolean;
789
789
  }>;
790
+ language?: string;
790
791
  }) => Promise<boolean | null>;
791
792
  declare const fetchActivities: (organizationId: string, workspaceId: string, offset?: number, limit?: number, authContext?: AuthContext, consentClient?: BaseUrlContextValue["consentClient"], language?: string) => Promise<ActivityDetail | null>;
792
793
  declare const fetchCaseHistory: (organizationId: string, workspaceId: string, contact: string, offset?: number, limit?: number, authContext?: AuthContext, consentClient?: BaseUrlContextValue["consentClient"], language?: string) => Promise<CaseHistoryDetail | null>;
@@ -10235,7 +10235,7 @@ function createConsentClient(baseUrl, ledgerBaseUrl) {
10235
10235
  * Without a ledger, the legacy Python `/manage-consent?status=` endpoint is
10236
10236
  * used with its `{ purpose_uuid, contact, ... }` payload.
10237
10237
  */
10238
- async manageConsent(baseRequest, purposeId, contact, status, authToken, options, nominatorContact, dataElementUuids, noticeUuid, dataElements) {
10238
+ async manageConsent(baseRequest, purposeId, contact, status, authToken, options, nominatorContact, dataElementUuids, noticeUuid, dataElements, language) {
10239
10239
  if (!useLedger) {
10240
10240
  const url2 = `${baseUrl}/organisations/${baseRequest.organisationUuid}/workspaces/${baseRequest.workspaceUuid}/dsar/privacy-center/manage-consent?status=${status}`;
10241
10241
  const body2 = { purpose_uuid: purposeId, contact };
@@ -10245,6 +10245,9 @@ function createConsentClient(baseUrl, ledgerBaseUrl) {
10245
10245
  if (Array.isArray(dataElementUuids) && dataElementUuids.length > 0) {
10246
10246
  body2.data_element_uuids = dataElementUuids;
10247
10247
  }
10248
+ if (language) {
10249
+ body2.language = language;
10250
+ }
10248
10251
  return privacyCenterApiFetch(url2, {
10249
10252
  ...options,
10250
10253
  method: "POST",
@@ -10279,7 +10282,8 @@ function createConsentClient(baseUrl, ledgerBaseUrl) {
10279
10282
  selected: purposeSelected,
10280
10283
  data_elements: elements
10281
10284
  }
10282
- ]
10285
+ ],
10286
+ ...language ? { language } : {}
10283
10287
  };
10284
10288
  const url = ledgerUrl(baseRequest, "/submit-consent");
10285
10289
  return privacyCenterApiFetch(url, {
@@ -10719,7 +10723,8 @@ async function manageConsentServer(params) {
10719
10723
  params.nominatorContact,
10720
10724
  params.dataElementUuids,
10721
10725
  params.noticeUuid,
10722
- params.dataElements
10726
+ params.dataElements,
10727
+ params.language
10723
10728
  );
10724
10729
  if (result && typeof result === "object" && "success" in result) {
10725
10730
  return Boolean(result.success);
@@ -11210,7 +11215,8 @@ var manageConsent = async ({
11210
11215
  nominatorContact,
11211
11216
  dataElementUuids,
11212
11217
  noticeUuid,
11213
- dataElements
11218
+ dataElements,
11219
+ language
11214
11220
  }) => {
11215
11221
  try {
11216
11222
  const accessToken = await ensureValidToken(organizationId, workspaceId, void 0, authContext, consentClient);
@@ -11228,7 +11234,8 @@ var manageConsent = async ({
11228
11234
  nominatorContact,
11229
11235
  dataElementUuids,
11230
11236
  noticeUuid,
11231
- dataElements
11237
+ dataElements,
11238
+ language
11232
11239
  });
11233
11240
  return result;
11234
11241
  } catch (error) {
@@ -14133,7 +14140,8 @@ function purposeItemToUserConsent(purpose, group) {
14133
14140
  product_uuid: group.product_uuid,
14134
14141
  product_name: group.product_name,
14135
14142
  product_description: group.product_description,
14136
- nominator_info: (_d = group.nominator) != null ? _d : void 0
14143
+ nominator_info: (_d = group.nominator) != null ? _d : void 0,
14144
+ notice_uuid: purpose.notice_uuid
14137
14145
  };
14138
14146
  }
14139
14147
  function getDisplayProductGroups(detail, tab) {
@@ -14211,7 +14219,7 @@ var ConsentStatusEnum = /* @__PURE__ */ ((ConsentStatusEnum2) => {
14211
14219
  return ConsentStatusEnum2;
14212
14220
  })(ConsentStatusEnum || {});
14213
14221
 
14214
- // src/RedactoPrivacyCenter/lib/constants.ts
14222
+ // src/shared/languages.ts
14215
14223
  var languageOptions = [
14216
14224
  { value: "en", label: "English" },
14217
14225
  { value: "hi", label: "\u0939\u093F\u0928\u094D\u0926\u0940 (Hindi)" },
@@ -14237,6 +14245,10 @@ var languageOptions = [
14237
14245
  { value: "ks", label: "\u0643\u0672\u0634\u064F\u0631 (Kashmiri)" },
14238
14246
  { value: "sat", label: "\u1C65\u1C5F\u1C71\u1C5B\u1C5F\u1C72\u1C64 (Santali)" }
14239
14247
  ];
14248
+ var codeByLabel = new Map(languageOptions.map((o) => [o.label, o.value]));
14249
+ var codeByLower = new Map(languageOptions.map((o) => [o.value.toLowerCase(), o.value]));
14250
+
14251
+ // src/RedactoPrivacyCenter/lib/constants.ts
14240
14252
  var PAGE_CHROME_BY_PAGE = {
14241
14253
  home: {
14242
14254
  titleKey: "privacyCenter",
@@ -15089,7 +15101,8 @@ function ConsentManager() {
15089
15101
  dataElements: (_b = selectedRecord == null ? void 0 : selectedRecord.data_elements) == null ? void 0 : _b.map((de) => ({
15090
15102
  uuid: de.uuid,
15091
15103
  selected: de.selected
15092
- }))
15104
+ })),
15105
+ language: langParam
15093
15106
  });
15094
15107
  setIsModalOpen(false);
15095
15108
  setSelectedRecord(null);
@@ -15101,7 +15114,7 @@ function ConsentManager() {
15101
15114
  setIsManageLoading(false);
15102
15115
  }
15103
15116
  },
15104
- [organizationId, workspaceId, email, authContext, consentClient, selectedRecord, fetchData, t]
15117
+ [organizationId, workspaceId, email, authContext, consentClient, selectedRecord, langParam, fetchData, t]
15105
15118
  );
15106
15119
  const handleExport = (0, import_react25.useCallback)(async () => {
15107
15120
  if (!consentData.length) return;
@@ -15464,6 +15477,7 @@ function ActivitiesList() {
15464
15477
  () => ({ accessToken, refreshToken, onError, updateTokens }),
15465
15478
  [accessToken, refreshToken, onError, updateTokens]
15466
15479
  );
15480
+ const { langParam } = useCurrentLanguage();
15467
15481
  const [activities, setActivities] = (0, import_react26.useState)([]);
15468
15482
  const [totalCount, setTotalCount] = (0, import_react26.useState)(0);
15469
15483
  const [isLoading, setIsLoading] = (0, import_react26.useState)(true);
@@ -15475,7 +15489,7 @@ function ActivitiesList() {
15475
15489
  var _a3, _b, _c;
15476
15490
  if (!organizationId || !workspaceId) return;
15477
15491
  try {
15478
- const response = await fetchActivities(organizationId, workspaceId, nextOffset, PAGE_SIZE, authContext, consentClient);
15492
+ const response = await fetchActivities(organizationId, workspaceId, nextOffset, PAGE_SIZE, authContext, consentClient, langParam);
15479
15493
  if (!response) return;
15480
15494
  const rows = (_a3 = response.data) != null ? _a3 : [];
15481
15495
  setActivities((prev) => append ? [...prev, ...rows] : rows);
@@ -15486,7 +15500,7 @@ function ActivitiesList() {
15486
15500
  if (!append) setActivities([]);
15487
15501
  }
15488
15502
  },
15489
- [organizationId, workspaceId, authContext, consentClient]
15503
+ [organizationId, workspaceId, authContext, consentClient, langParam]
15490
15504
  );
15491
15505
  (0, import_react26.useEffect)(() => {
15492
15506
  setIsLoading(true);
@@ -1,6 +1,7 @@
1
1
  import {
2
- __require
3
- } from "./chunk-Y6FXYEAI.mjs";
2
+ __require,
3
+ languageOptions
4
+ } from "./chunk-IVOOB4JK.mjs";
4
5
 
5
6
  // src/RedactoPrivacyCenter/RedactoPrivacyCenter.tsx
6
7
  import { useEffect as useEffect20 } from "react";
@@ -10121,7 +10122,7 @@ function createConsentClient(baseUrl, ledgerBaseUrl) {
10121
10122
  * Without a ledger, the legacy Python `/manage-consent?status=` endpoint is
10122
10123
  * used with its `{ purpose_uuid, contact, ... }` payload.
10123
10124
  */
10124
- async manageConsent(baseRequest, purposeId, contact, status, authToken, options, nominatorContact, dataElementUuids, noticeUuid, dataElements) {
10125
+ async manageConsent(baseRequest, purposeId, contact, status, authToken, options, nominatorContact, dataElementUuids, noticeUuid, dataElements, language) {
10125
10126
  if (!useLedger) {
10126
10127
  const url2 = `${baseUrl}/organisations/${baseRequest.organisationUuid}/workspaces/${baseRequest.workspaceUuid}/dsar/privacy-center/manage-consent?status=${status}`;
10127
10128
  const body2 = { purpose_uuid: purposeId, contact };
@@ -10131,6 +10132,9 @@ function createConsentClient(baseUrl, ledgerBaseUrl) {
10131
10132
  if (Array.isArray(dataElementUuids) && dataElementUuids.length > 0) {
10132
10133
  body2.data_element_uuids = dataElementUuids;
10133
10134
  }
10135
+ if (language) {
10136
+ body2.language = language;
10137
+ }
10134
10138
  return privacyCenterApiFetch(url2, {
10135
10139
  ...options,
10136
10140
  method: "POST",
@@ -10165,7 +10169,8 @@ function createConsentClient(baseUrl, ledgerBaseUrl) {
10165
10169
  selected: purposeSelected,
10166
10170
  data_elements: elements
10167
10171
  }
10168
- ]
10172
+ ],
10173
+ ...language ? { language } : {}
10169
10174
  };
10170
10175
  const url = ledgerUrl(baseRequest, "/submit-consent");
10171
10176
  return privacyCenterApiFetch(url, {
@@ -10605,7 +10610,8 @@ async function manageConsentServer(params) {
10605
10610
  params.nominatorContact,
10606
10611
  params.dataElementUuids,
10607
10612
  params.noticeUuid,
10608
- params.dataElements
10613
+ params.dataElements,
10614
+ params.language
10609
10615
  );
10610
10616
  if (result && typeof result === "object" && "success" in result) {
10611
10617
  return Boolean(result.success);
@@ -11096,7 +11102,8 @@ var manageConsent = async ({
11096
11102
  nominatorContact,
11097
11103
  dataElementUuids,
11098
11104
  noticeUuid,
11099
- dataElements
11105
+ dataElements,
11106
+ language
11100
11107
  }) => {
11101
11108
  try {
11102
11109
  const accessToken = await ensureValidToken(organizationId, workspaceId, void 0, authContext, consentClient);
@@ -11114,7 +11121,8 @@ var manageConsent = async ({
11114
11121
  nominatorContact,
11115
11122
  dataElementUuids,
11116
11123
  noticeUuid,
11117
- dataElements
11124
+ dataElements,
11125
+ language
11118
11126
  });
11119
11127
  return result;
11120
11128
  } catch (error) {
@@ -14142,7 +14150,8 @@ function purposeItemToUserConsent(purpose, group) {
14142
14150
  product_uuid: group.product_uuid,
14143
14151
  product_name: group.product_name,
14144
14152
  product_description: group.product_description,
14145
- nominator_info: (_d = group.nominator) != null ? _d : void 0
14153
+ nominator_info: (_d = group.nominator) != null ? _d : void 0,
14154
+ notice_uuid: purpose.notice_uuid
14146
14155
  };
14147
14156
  }
14148
14157
  function getDisplayProductGroups(detail, tab) {
@@ -14221,31 +14230,6 @@ var ConsentStatusEnum = /* @__PURE__ */ ((ConsentStatusEnum2) => {
14221
14230
  })(ConsentStatusEnum || {});
14222
14231
 
14223
14232
  // src/RedactoPrivacyCenter/lib/constants.ts
14224
- var languageOptions = [
14225
- { value: "en", label: "English" },
14226
- { value: "hi", label: "\u0939\u093F\u0928\u094D\u0926\u0940 (Hindi)" },
14227
- { value: "te", label: "\u0C24\u0C46\u0C32\u0C41\u0C17\u0C41 (Telugu)" },
14228
- { value: "mr", label: "\u092E\u0930\u093E\u0920\u0940 (Marathi)" },
14229
- { value: "ta", label: "\u0BA4\u0BAE\u0BBF\u0BB4\u0BCD (Tamil)" },
14230
- { value: "ur", label: "\u0627\u0631\u062F\u0648 (Urdu)" },
14231
- { value: "gu", label: "\u0A97\u0AC1\u0A9C\u0AB0\u0ABE\u0AA4\u0AC0 (Gujarati)" },
14232
- { value: "kn", label: "\u0C95\u0CA8\u0CCD\u0CA8\u0CA1 (Kannada)" },
14233
- { value: "ml", label: "\u0D2E\u0D32\u0D2F\u0D3E\u0D33\u0D02 (Malayalam)" },
14234
- { value: "pa", label: "\u0A2A\u0A70\u0A1C\u0A3E\u0A2C\u0A40 (Punjabi)" },
14235
- { value: "or", label: "\u0B13\u0B21\u0B3C\u0B3F\u0B06 (Odia)" },
14236
- { value: "as", label: "\u0985\u09B8\u09AE\u09C0\u09AF\u09BC\u09BE (Assamese)" },
14237
- { value: "bn", label: "\u09AC\u09BE\u0982\u09B2\u09BE (Bengali)" },
14238
- { value: "mai", label: "\u092E\u0948\u0925\u093F\u0932\u0940 (Maithili)" },
14239
- { value: "ne", label: "\u0928\u0947\u092A\u093E\u0932\u0940 (Nepali)" },
14240
- { value: "sd", label: "\u0633\u0646\u068C\u064A (Sindhi)" },
14241
- { value: "doi", label: "\u0921\u094B\u0917\u0930\u0940 (Dogri)" },
14242
- { value: "mni-Mtei", label: "\uABC3\uABE9\uABC7\uABE9\uABC2\uABE3\uABDF (Manipuri)" },
14243
- { value: "gom", label: "\u0915\u094B\u0902\u0915\u0923\u0940 (Goan Konkani)" },
14244
- { value: "sa", label: "\u0938\u0902\u0938\u094D\u0915\u0943\u0924\u092E\u094D (Sanskrit)" },
14245
- { value: "brx", label: "\u092C\u0921\u093C\u094B (Bodo)" },
14246
- { value: "ks", label: "\u0643\u0672\u0634\u064F\u0631 (Kashmiri)" },
14247
- { value: "sat", label: "\u1C65\u1C5F\u1C71\u1C5B\u1C5F\u1C72\u1C64 (Santali)" }
14248
- ];
14249
14233
  var PAGE_CHROME_BY_PAGE = {
14250
14234
  home: {
14251
14235
  titleKey: "privacyCenter",
@@ -15104,7 +15088,8 @@ function ConsentManager() {
15104
15088
  dataElements: (_b = selectedRecord == null ? void 0 : selectedRecord.data_elements) == null ? void 0 : _b.map((de) => ({
15105
15089
  uuid: de.uuid,
15106
15090
  selected: de.selected
15107
- }))
15091
+ })),
15092
+ language: langParam
15108
15093
  });
15109
15094
  setIsModalOpen(false);
15110
15095
  setSelectedRecord(null);
@@ -15116,7 +15101,7 @@ function ConsentManager() {
15116
15101
  setIsManageLoading(false);
15117
15102
  }
15118
15103
  },
15119
- [organizationId, workspaceId, email, authContext, consentClient, selectedRecord, fetchData, t]
15104
+ [organizationId, workspaceId, email, authContext, consentClient, selectedRecord, langParam, fetchData, t]
15120
15105
  );
15121
15106
  const handleExport = useCallback6(async () => {
15122
15107
  if (!consentData.length) return;
@@ -15479,6 +15464,7 @@ function ActivitiesList() {
15479
15464
  () => ({ accessToken, refreshToken, onError, updateTokens }),
15480
15465
  [accessToken, refreshToken, onError, updateTokens]
15481
15466
  );
15467
+ const { langParam } = useCurrentLanguage();
15482
15468
  const [activities, setActivities] = useState14([]);
15483
15469
  const [totalCount, setTotalCount] = useState14(0);
15484
15470
  const [isLoading, setIsLoading] = useState14(true);
@@ -15490,7 +15476,7 @@ function ActivitiesList() {
15490
15476
  var _a3, _b, _c;
15491
15477
  if (!organizationId || !workspaceId) return;
15492
15478
  try {
15493
- const response = await fetchActivities(organizationId, workspaceId, nextOffset, PAGE_SIZE, authContext, consentClient);
15479
+ const response = await fetchActivities(organizationId, workspaceId, nextOffset, PAGE_SIZE, authContext, consentClient, langParam);
15494
15480
  if (!response) return;
15495
15481
  const rows = (_a3 = response.data) != null ? _a3 : [];
15496
15482
  setActivities((prev) => append ? [...prev, ...rows] : rows);
@@ -15501,7 +15487,7 @@ function ActivitiesList() {
15501
15487
  if (!append) setActivities([]);
15502
15488
  }
15503
15489
  },
15504
- [organizationId, workspaceId, authContext, consentClient]
15490
+ [organizationId, workspaceId, authContext, consentClient, langParam]
15505
15491
  );
15506
15492
  useEffect12(() => {
15507
15493
  setIsLoading(true);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redacto.io/consent-sdk-react-native",
3
- "version": "5.0.0-beta.1",
3
+ "version": "5.0.0-beta.3",
4
4
  "description": "React Native SDK for integrating Redacto consent notices and privacy center in mobile apps.",
5
5
  "keywords": [
6
6
  "consent",
@@ -1,10 +0,0 @@
1
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
2
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
3
- }) : x)(function(x) {
4
- if (typeof require !== "undefined") return require.apply(this, arguments);
5
- throw Error('Dynamic require of "' + x + '" is not supported');
6
- });
7
-
8
- export {
9
- __require
10
- };