@redacto.io/consent-sdk-react-native 5.0.0-beta.7 → 5.0.0-beta.8

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/dist/index.js CHANGED
@@ -334,6 +334,7 @@ var submitConsentEvent = async ({
334
334
  var fetchTTSAudioUrls = async ({
335
335
  accessToken,
336
336
  baseUrl,
337
+ ledgerBaseUrl,
337
338
  noticeUuid,
338
339
  language,
339
340
  signal,
@@ -343,7 +344,7 @@ var fetchTTSAudioUrls = async ({
343
344
  throw new Error("accessToken (or token), noticeUuid, and language are required");
344
345
  }
345
346
  const { organisationUuid: ORGANISATION_UUID, workspaceUuid: WORKSPACE_UUID, sandbox } = resolveRequestAuth(accessToken, sandboxParams, decodeTokenSafely);
346
- const apiBaseUrl = baseUrl || DEFAULT_CONSENT_API_BASE_URL;
347
+ const apiBaseUrl = (sandbox ? null : ledgerBaseUrl) || baseUrl || DEFAULT_CONSENT_API_BASE_URL;
347
348
  const normalizedLanguage = language === "en" || language === "EN" ? "English" : language;
348
349
  const url = new URL(
349
350
  `${apiBaseUrl}/public/organisations/${ORGANISATION_UUID}/workspaces/${WORKSPACE_UUID}/notices/${noticeUuid}/audio/${encodeURIComponent(normalizedLanguage)}`
@@ -1948,10 +1949,11 @@ var RedactoNoticeConsent = ({
1948
1949
  setIsLoading(true);
1949
1950
  setErrorMessage(null);
1950
1951
  try {
1952
+ const noticeBaseUrl = ledgerBaseUrl && !applicationId && !token ? ledgerBaseUrl : baseUrl;
1951
1953
  const data = await fetchConsentContent({
1952
1954
  noticeId,
1953
1955
  accessToken,
1954
- baseUrl,
1956
+ baseUrl: noticeBaseUrl,
1955
1957
  language: "English",
1956
1958
  validate_against: validateAgainst,
1957
1959
  include_fully_consented_data: includeFullyConsentedData,
@@ -2060,6 +2062,7 @@ var RedactoNoticeConsent = ({
2060
2062
  const data = await fetchTTSAudioUrls({
2061
2063
  accessToken,
2062
2064
  baseUrl,
2065
+ ledgerBaseUrl,
2063
2066
  noticeUuid: content.detail.active_config.notice_uuid,
2064
2067
  language: selectedLanguage,
2065
2068
  ...sandboxParams
@@ -2116,7 +2119,7 @@ var RedactoNoticeConsent = ({
2116
2119
  setTtsAudioUrls({});
2117
2120
  setIsTTSAvailable(false);
2118
2121
  }
2119
- }, [content, accessToken, sandboxParams, baseUrl, selectedLanguage]);
2122
+ }, [content, accessToken, sandboxParams, baseUrl, ledgerBaseUrl, selectedLanguage]);
2120
2123
  const clearPlaybackWatchers = (0, import_react2.useCallback)(() => {
2121
2124
  if (playbackSubscriptionRef.current) {
2122
2125
  playbackSubscriptionRef.current.remove();
package/dist/index.mjs CHANGED
@@ -274,6 +274,7 @@ var submitConsentEvent = async ({
274
274
  var fetchTTSAudioUrls = async ({
275
275
  accessToken,
276
276
  baseUrl,
277
+ ledgerBaseUrl,
277
278
  noticeUuid,
278
279
  language,
279
280
  signal,
@@ -283,7 +284,7 @@ var fetchTTSAudioUrls = async ({
283
284
  throw new Error("accessToken (or token), noticeUuid, and language are required");
284
285
  }
285
286
  const { organisationUuid: ORGANISATION_UUID, workspaceUuid: WORKSPACE_UUID, sandbox } = resolveRequestAuth(accessToken, sandboxParams, decodeTokenSafely);
286
- const apiBaseUrl = baseUrl || DEFAULT_CONSENT_API_BASE_URL;
287
+ const apiBaseUrl = (sandbox ? null : ledgerBaseUrl) || baseUrl || DEFAULT_CONSENT_API_BASE_URL;
287
288
  const normalizedLanguage = language === "en" || language === "EN" ? "English" : language;
288
289
  const url = new URL(
289
290
  `${apiBaseUrl}/public/organisations/${ORGANISATION_UUID}/workspaces/${WORKSPACE_UUID}/notices/${noticeUuid}/audio/${encodeURIComponent(normalizedLanguage)}`
@@ -1895,10 +1896,11 @@ var RedactoNoticeConsent = ({
1895
1896
  setIsLoading(true);
1896
1897
  setErrorMessage(null);
1897
1898
  try {
1899
+ const noticeBaseUrl = ledgerBaseUrl && !applicationId && !token ? ledgerBaseUrl : baseUrl;
1898
1900
  const data = await fetchConsentContent({
1899
1901
  noticeId,
1900
1902
  accessToken,
1901
- baseUrl,
1903
+ baseUrl: noticeBaseUrl,
1902
1904
  language: "English",
1903
1905
  validate_against: validateAgainst,
1904
1906
  include_fully_consented_data: includeFullyConsentedData,
@@ -2007,6 +2009,7 @@ var RedactoNoticeConsent = ({
2007
2009
  const data = await fetchTTSAudioUrls({
2008
2010
  accessToken,
2009
2011
  baseUrl,
2012
+ ledgerBaseUrl,
2010
2013
  noticeUuid: content.detail.active_config.notice_uuid,
2011
2014
  language: selectedLanguage,
2012
2015
  ...sandboxParams
@@ -2063,7 +2066,7 @@ var RedactoNoticeConsent = ({
2063
2066
  setTtsAudioUrls({});
2064
2067
  setIsTTSAvailable(false);
2065
2068
  }
2066
- }, [content, accessToken, sandboxParams, baseUrl, selectedLanguage]);
2069
+ }, [content, accessToken, sandboxParams, baseUrl, ledgerBaseUrl, selectedLanguage]);
2067
2070
  const clearPlaybackWatchers = useCallback(() => {
2068
2071
  if (playbackSubscriptionRef.current) {
2069
2072
  playbackSubscriptionRef.current.remove();
@@ -486,6 +486,29 @@ type CaseDetailsTab = Readonly<{
486
486
  id: TabId;
487
487
  label: string;
488
488
  }>;
489
+ /**
490
+ * One data principal sharing this session's contact.
491
+ *
492
+ * `org_user_id` is unique per principal within the org/workspace, so it is the
493
+ * reliable way to tell profiles apart when the email and mobile are identical —
494
+ * which is the whole point of a shared contact.
495
+ */
496
+ type IdentityCandidate = Readonly<{
497
+ uuid: string;
498
+ org_user_id?: string | null;
499
+ primary_email?: string | null;
500
+ primary_mobile?: string | null;
501
+ created_at?: string | null;
502
+ }>;
503
+ type IdentityListResponse = Readonly<{
504
+ identities: IdentityCandidate[];
505
+ }>;
506
+ /** Fresh tokens scoped to the chosen principal. */
507
+ type SelectPrincipalResponse = Readonly<{
508
+ token: string;
509
+ refresh_token: string;
510
+ expires_at?: string;
511
+ }>;
489
512
 
490
513
  type InternalPage = 'home' | 'consent-manager' | 'form' | 'activity' | 'receipts' | 'case-details' | 'notifications';
491
514
  interface NavigationContextType {
@@ -729,6 +752,18 @@ declare function createConsentClient(baseUrl: string, ledgerBaseUrl?: string): {
729
752
  * Get activities (privacy center)
730
753
  */
731
754
  getActivities(baseRequest: BaseRequest, offset?: number, limit?: number, language?: string, authToken?: string, options?: Omit<ApiFetchOptions, "getAuthToken">): Promise<unknown>;
755
+ /**
756
+ * List all data principals that share this session's contact
757
+ * (shared-contact profile picker). Identity is derived server-side from the
758
+ * JWT — the caller sends nothing but its bearer token.
759
+ */
760
+ listIdentities(baseRequest: BaseRequest, authToken?: string, options?: Omit<ApiFetchOptions, "getAuthToken">): Promise<IdentityListResponse>;
761
+ /**
762
+ * Re-scope the session to a chosen principal uuid (must be one of the
763
+ * principals sharing this session's contact). Returns fresh access/refresh
764
+ * tokens scoped to that principal.
765
+ */
766
+ selectPrincipal(baseRequest: BaseRequest, principalUuid: string, authToken?: string, options?: Omit<ApiFetchOptions, "getAuthToken">): Promise<SelectPrincipalResponse>;
732
767
  /**
733
768
  * Get receipts (privacy center)
734
769
  */
@@ -486,6 +486,29 @@ type CaseDetailsTab = Readonly<{
486
486
  id: TabId;
487
487
  label: string;
488
488
  }>;
489
+ /**
490
+ * One data principal sharing this session's contact.
491
+ *
492
+ * `org_user_id` is unique per principal within the org/workspace, so it is the
493
+ * reliable way to tell profiles apart when the email and mobile are identical —
494
+ * which is the whole point of a shared contact.
495
+ */
496
+ type IdentityCandidate = Readonly<{
497
+ uuid: string;
498
+ org_user_id?: string | null;
499
+ primary_email?: string | null;
500
+ primary_mobile?: string | null;
501
+ created_at?: string | null;
502
+ }>;
503
+ type IdentityListResponse = Readonly<{
504
+ identities: IdentityCandidate[];
505
+ }>;
506
+ /** Fresh tokens scoped to the chosen principal. */
507
+ type SelectPrincipalResponse = Readonly<{
508
+ token: string;
509
+ refresh_token: string;
510
+ expires_at?: string;
511
+ }>;
489
512
 
490
513
  type InternalPage = 'home' | 'consent-manager' | 'form' | 'activity' | 'receipts' | 'case-details' | 'notifications';
491
514
  interface NavigationContextType {
@@ -729,6 +752,18 @@ declare function createConsentClient(baseUrl: string, ledgerBaseUrl?: string): {
729
752
  * Get activities (privacy center)
730
753
  */
731
754
  getActivities(baseRequest: BaseRequest, offset?: number, limit?: number, language?: string, authToken?: string, options?: Omit<ApiFetchOptions, "getAuthToken">): Promise<unknown>;
755
+ /**
756
+ * List all data principals that share this session's contact
757
+ * (shared-contact profile picker). Identity is derived server-side from the
758
+ * JWT — the caller sends nothing but its bearer token.
759
+ */
760
+ listIdentities(baseRequest: BaseRequest, authToken?: string, options?: Omit<ApiFetchOptions, "getAuthToken">): Promise<IdentityListResponse>;
761
+ /**
762
+ * Re-scope the session to a chosen principal uuid (must be one of the
763
+ * principals sharing this session's contact). Returns fresh access/refresh
764
+ * tokens scoped to that principal.
765
+ */
766
+ selectPrincipal(baseRequest: BaseRequest, principalUuid: string, authToken?: string, options?: Omit<ApiFetchOptions, "getAuthToken">): Promise<SelectPrincipalResponse>;
732
767
  /**
733
768
  * Get receipts (privacy center)
734
769
  */