@redacto.io/consent-sdk-react 7.1.0 → 7.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
 
2
2
  
3
- > @redacto.io/consent-sdk-react@7.0.0 build /Users/sadanmianredacto/Developer/redacto/consent-sdk/packages/consent-sdk-react
3
+ > @redacto.io/consent-sdk-react@7.1.0 build /Users/sadanmianredacto/Developer/redacto/consent-sdk/packages/consent-sdk-react
4
4
  > tsup
5
5
 
6
6
  CLI Building entry: {"index":"src/index.ts","privacy-center":"src/privacy-center.ts"}
@@ -12,13 +12,13 @@
12
12
  ESM Build start
13
13
  CJS Build start
14
14
  ESM dist/index.mjs 227.81 KB
15
- ESM dist/privacy-center.mjs 1.99 MB
16
- ESM ⚡️ Build success in 178ms
15
+ ESM dist/privacy-center.mjs 1.98 MB
16
+ ESM ⚡️ Build success in 69ms
17
17
  CJS dist/index.js 237.08 KB
18
18
  CJS dist/privacy-center.js 2.02 MB
19
- CJS ⚡️ Build success in 177ms
19
+ CJS ⚡️ Build success in 69ms
20
20
  DTS Build start
21
- DTS ⚡️ Build success in 3889ms
21
+ DTS ⚡️ Build success in 2460ms
22
22
  DTS dist/index.d.mts 6.12 KB
23
23
  DTS dist/privacy-center.d.mts 28.46 KB
24
24
  DTS dist/index.d.ts 6.12 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # @redacto.io/consent-sdk-react
2
2
 
3
+ ## 7.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - change branding path
8
+
9
+ ## 7.2.0
10
+
11
+ ### Minor Changes
12
+
13
+ - bugs fix
14
+
15
+ ### Patch Changes
16
+
17
+ - 7df3e20: Thread the clicked card's `product_uuid` through the privacy center's revoke/regrant/renew flow so purposes shared across multiple product cards mutate the correct card instead of falling back to action-implied scoping (which is ambiguous when two cards share the same state). Adds an optional `productUuid` parameter to the public `manageConsent` API; existing callers that omit it keep the prior server-side fallback behaviour.
18
+
3
19
  ## 7.1.0
4
20
 
5
21
  ### Minor Changes
@@ -94,7 +94,7 @@ declare function createConsentClient(baseUrl: string): {
94
94
  /**
95
95
  * Manage consent (privacy center) - revoke, regrant, or renew
96
96
  */
97
- manageConsent(baseRequest: BaseRequest, purposeId: string, contact: string, status: "revoke" | "regrant" | "renew", authToken?: string, options?: Omit<ApiFetchOptions, "getAuthToken">, nominatorContact?: string, dataElementUuids?: string[]): Promise<unknown>;
97
+ manageConsent(baseRequest: BaseRequest, purposeId: string, contact: string, status: "revoke" | "regrant" | "renew", authToken?: string, options?: Omit<ApiFetchOptions, "getAuthToken">, nominatorContact?: string, dataElementUuids?: string[], productUuid?: string): Promise<unknown>;
98
98
  /**
99
99
  * Get activities (privacy center)
100
100
  */
@@ -747,7 +747,7 @@ type FetchGroupPurposesParams = {
747
747
  consentClient?: BaseUrlContextValue['consentClient'];
748
748
  };
749
749
  declare const fetchGroupPurposes: (params: FetchGroupPurposesParams) => Promise<GroupPurposesOut | null>;
750
- declare const manageConsent: ({ organizationId, workspaceId, purposeId, contact, action, authContext, consentClient, nominatorContact, dataElementUuids, }: {
750
+ declare const manageConsent: ({ organizationId, workspaceId, purposeId, contact, action, authContext, consentClient, nominatorContact, dataElementUuids, productUuid, }: {
751
751
  organizationId: string;
752
752
  workspaceId: string;
753
753
  purposeId: string;
@@ -757,6 +757,7 @@ declare const manageConsent: ({ organizationId, workspaceId, purposeId, contact,
757
757
  consentClient?: BaseUrlContextValue["consentClient"];
758
758
  nominatorContact?: string;
759
759
  dataElementUuids?: string[];
760
+ productUuid?: string;
760
761
  }) => Promise<boolean | null>;
761
762
  declare const fetchActivities: (organizationId: string, workspaceId: string, offset?: number, limit?: number, authContext?: AuthContext, consentClient?: BaseUrlContextValue["consentClient"], language?: string) => Promise<ActivityDetail | null>;
762
763
  declare const fetchCaseHistory: (organizationId: string, workspaceId: string, contact: string, offset?: number, limit?: number, authContext?: AuthContext, consentClient?: BaseUrlContextValue["consentClient"], language?: string) => Promise<CaseHistoryDetail | null>;
@@ -94,7 +94,7 @@ declare function createConsentClient(baseUrl: string): {
94
94
  /**
95
95
  * Manage consent (privacy center) - revoke, regrant, or renew
96
96
  */
97
- manageConsent(baseRequest: BaseRequest, purposeId: string, contact: string, status: "revoke" | "regrant" | "renew", authToken?: string, options?: Omit<ApiFetchOptions, "getAuthToken">, nominatorContact?: string, dataElementUuids?: string[]): Promise<unknown>;
97
+ manageConsent(baseRequest: BaseRequest, purposeId: string, contact: string, status: "revoke" | "regrant" | "renew", authToken?: string, options?: Omit<ApiFetchOptions, "getAuthToken">, nominatorContact?: string, dataElementUuids?: string[], productUuid?: string): Promise<unknown>;
98
98
  /**
99
99
  * Get activities (privacy center)
100
100
  */
@@ -747,7 +747,7 @@ type FetchGroupPurposesParams = {
747
747
  consentClient?: BaseUrlContextValue['consentClient'];
748
748
  };
749
749
  declare const fetchGroupPurposes: (params: FetchGroupPurposesParams) => Promise<GroupPurposesOut | null>;
750
- declare const manageConsent: ({ organizationId, workspaceId, purposeId, contact, action, authContext, consentClient, nominatorContact, dataElementUuids, }: {
750
+ declare const manageConsent: ({ organizationId, workspaceId, purposeId, contact, action, authContext, consentClient, nominatorContact, dataElementUuids, productUuid, }: {
751
751
  organizationId: string;
752
752
  workspaceId: string;
753
753
  purposeId: string;
@@ -757,6 +757,7 @@ declare const manageConsent: ({ organizationId, workspaceId, purposeId, contact,
757
757
  consentClient?: BaseUrlContextValue["consentClient"];
758
758
  nominatorContact?: string;
759
759
  dataElementUuids?: string[];
760
+ productUuid?: string;
760
761
  }) => Promise<boolean | null>;
761
762
  declare const fetchActivities: (organizationId: string, workspaceId: string, offset?: number, limit?: number, authContext?: AuthContext, consentClient?: BaseUrlContextValue["consentClient"], language?: string) => Promise<ActivityDetail | null>;
762
763
  declare const fetchCaseHistory: (organizationId: string, workspaceId: string, contact: string, offset?: number, limit?: number, authContext?: AuthContext, consentClient?: BaseUrlContextValue["consentClient"], language?: string) => Promise<CaseHistoryDetail | null>;
@@ -7480,7 +7480,8 @@ async function manageConsentServer(params) {
7480
7480
  params.authToken,
7481
7481
  void 0,
7482
7482
  params.nominatorContact,
7483
- params.dataElementUuids
7483
+ params.dataElementUuids,
7484
+ params.productUuid
7484
7485
  );
7485
7486
  return (_a = result == null ? void 0 : result.success) != null ? _a : null;
7486
7487
  } catch (error) {
@@ -7845,7 +7846,8 @@ var manageConsent = async ({
7845
7846
  authContext,
7846
7847
  consentClient,
7847
7848
  nominatorContact,
7848
- dataElementUuids
7849
+ dataElementUuids,
7850
+ productUuid
7849
7851
  }) => {
7850
7852
  try {
7851
7853
  const accessToken = await ensureValidToken(organizationId, workspaceId, void 0, authContext, consentClient);
@@ -7861,7 +7863,8 @@ var manageConsent = async ({
7861
7863
  authToken: accessToken,
7862
7864
  consentClient,
7863
7865
  nominatorContact,
7864
- dataElementUuids
7866
+ dataElementUuids,
7867
+ productUuid
7865
7868
  });
7866
7869
  return result;
7867
7870
  } catch (error) {
@@ -7880,7 +7883,8 @@ var manageConsent = async ({
7880
7883
  authToken: newAccessToken || void 0,
7881
7884
  consentClient,
7882
7885
  nominatorContact,
7883
- dataElementUuids
7886
+ dataElementUuids,
7887
+ productUuid
7884
7888
  });
7885
7889
  }
7886
7890
  console.error(`Error ${action} consent:`, error);
@@ -8756,7 +8760,7 @@ function createConsentClient(baseUrl) {
8756
8760
  /**
8757
8761
  * Manage consent (privacy center) - revoke, regrant, or renew
8758
8762
  */
8759
- async manageConsent(baseRequest, purposeId, contact, status, authToken, options, nominatorContact, dataElementUuids) {
8763
+ async manageConsent(baseRequest, purposeId, contact, status, authToken, options, nominatorContact, dataElementUuids, productUuid) {
8760
8764
  const url = privacyCenterUrl(baseRequest, `/manage-consent?status=${status}`);
8761
8765
  const body = { purpose_uuid: purposeId, contact };
8762
8766
  if (nominatorContact) {
@@ -8765,6 +8769,9 @@ function createConsentClient(baseUrl) {
8765
8769
  if (Array.isArray(dataElementUuids) && dataElementUuids.length > 0) {
8766
8770
  body.data_element_uuids = dataElementUuids;
8767
8771
  }
8772
+ if (productUuid) {
8773
+ body.product_uuid = productUuid;
8774
+ }
8768
8775
  return privacyCenterApiFetch(url, {
8769
8776
  ...options,
8770
8777
  method: "POST",
@@ -11940,9 +11947,11 @@ var CASE_DETAILS_PREFIX = "/case-details/";
11940
11947
  var import_react13 = require("react");
11941
11948
 
11942
11949
  // src/RedactoPrivacyCenter/api/orgBranding.ts
11943
- var USER_SERVER_BASE_URL = "https://api.redacto.tech/user/api/0";
11944
- async function fetchOrgBranding(slug) {
11945
- const url = `${USER_SERVER_BASE_URL}/public/org-branding/by-slug/${encodeURIComponent(slug)}`;
11950
+ function getUserServerBaseUrl(baseUrl) {
11951
+ return baseUrl.includes(".io") ? "https://api.redacto.io/user/api/0" : "https://api.redacto.tech/user/api/0";
11952
+ }
11953
+ async function fetchOrgBranding(slug, baseUrl) {
11954
+ const url = `${getUserServerBaseUrl(baseUrl)}/public/org-branding/by-slug/${encodeURIComponent(slug)}`;
11946
11955
  return apiFetch(url, { method: "GET" });
11947
11956
  }
11948
11957
 
@@ -12005,12 +12014,16 @@ function clearBrandingTheme() {
12005
12014
  // src/RedactoPrivacyCenter/context/BrandingContext.tsx
12006
12015
  var import_jsx_runtime27 = require("react/jsx-runtime");
12007
12016
  var BrandingContext = (0, import_react13.createContext)(null);
12008
- var BrandingProvider = ({ children, slug }) => {
12017
+ var BrandingProvider = ({
12018
+ children,
12019
+ slug,
12020
+ baseUrl
12021
+ }) => {
12009
12022
  const [branding, setBranding] = (0, import_react13.useState)(null);
12010
12023
  (0, import_react13.useEffect)(() => {
12011
12024
  if (!slug) return;
12012
12025
  let cancelled = false;
12013
- fetchOrgBranding(slug).then((data) => {
12026
+ fetchOrgBranding(slug, baseUrl).then((data) => {
12014
12027
  if (!cancelled) setBranding(data);
12015
12028
  }).catch((error) => {
12016
12029
  console.warn("[RedactoPrivacyCenter] org branding fetch failed:", error);
@@ -12018,7 +12031,7 @@ var BrandingProvider = ({ children, slug }) => {
12018
12031
  return () => {
12019
12032
  cancelled = true;
12020
12033
  };
12021
- }, [slug]);
12034
+ }, [slug, baseUrl]);
12022
12035
  (0, import_react13.useEffect)(() => {
12023
12036
  if (!branding) return;
12024
12037
  applyBrandingTheme(branding.theme);
@@ -13515,7 +13528,7 @@ function AdvancedTable({
13515
13528
  /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(PCTable.Body, { className: classNames == null ? void 0 : classNames.bodyClassName, children: table.getRowModel().rows.map((row) => {
13516
13529
  const meta = table.options.meta || {};
13517
13530
  const onRowClick = meta.onRowClick;
13518
- const handleRowClick = onRowClick ? (e) => {
13531
+ const handleRowClick = onRowClick ? () => {
13519
13532
  onRowClick(row.original, row);
13520
13533
  } : void 0;
13521
13534
  const rowExpandedComponent = expandedComponent || meta.expandedComponent;
@@ -14766,7 +14779,8 @@ var ModifyConsentModal = ({
14766
14779
  selectedRecord.purpose_uuid,
14767
14780
  actionConfig.action,
14768
14781
  nomContact,
14769
- isRegrantAction ? selectedDataElementUuids : void 0
14782
+ isRegrantAction ? selectedDataElementUuids : void 0,
14783
+ selectedRecord.product_uuid
14770
14784
  );
14771
14785
  }
14772
14786
  },
@@ -16164,9 +16178,6 @@ function ConsentManager({ variant }) {
16164
16178
  (0, import_react28.useEffect)(() => {
16165
16179
  fetchData();
16166
16180
  }, [fetchData]);
16167
- const hasActiveFilters = Boolean(
16168
- debouncedSearch.trim() || (statusFilter == null ? void 0 : statusFilter.value) || (productFilter == null ? void 0 : productFilter.value)
16169
- );
16170
16181
  const groupedPurposeCount = (0, import_react28.useMemo)(
16171
16182
  () => consentGroups.reduce((sum, group) => sum + group.purposes.length, 0),
16172
16183
  [consentGroups]
@@ -16366,7 +16377,7 @@ function ConsentManager({ variant }) {
16366
16377
  ]
16367
16378
  );
16368
16379
  const handleManageConsent = (0, import_react28.useCallback)(
16369
- async (purposeId, action, nominatorContact, dataElementUuids) => {
16380
+ async (purposeId, action, nominatorContact, dataElementUuids, productUuid) => {
16370
16381
  if (!organizationId || !workspaceId || !contact) {
16371
16382
  toast.error(t("missingInfoToManage"));
16372
16383
  return;
@@ -16392,7 +16403,8 @@ function ConsentManager({ variant }) {
16392
16403
  authContext,
16393
16404
  consentClient,
16394
16405
  nominatorContact,
16395
- dataElementUuids
16406
+ dataElementUuids,
16407
+ productUuid
16396
16408
  });
16397
16409
  if (response) {
16398
16410
  toast.success(successMessages[action]);
@@ -24302,7 +24314,7 @@ function RedactoPrivacyCenter({
24302
24314
  initialPage = "consent-manager",
24303
24315
  onBack
24304
24316
  }) {
24305
- return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(import_react_i18next44.I18nextProvider, { i18n: i18n_default, children: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(BrandingProvider, { slug, children: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(BaseUrlProvider, { baseUrl, children: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
24317
+ return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(import_react_i18next44.I18nextProvider, { i18n: i18n_default, children: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(BrandingProvider, { slug, baseUrl, children: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(BaseUrlProvider, { baseUrl, children: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
24306
24318
  AuthProvider,
24307
24319
  {
24308
24320
  accessToken,
@@ -7402,7 +7402,8 @@ async function manageConsentServer(params) {
7402
7402
  params.authToken,
7403
7403
  void 0,
7404
7404
  params.nominatorContact,
7405
- params.dataElementUuids
7405
+ params.dataElementUuids,
7406
+ params.productUuid
7406
7407
  );
7407
7408
  return (_a = result == null ? void 0 : result.success) != null ? _a : null;
7408
7409
  } catch (error) {
@@ -7767,7 +7768,8 @@ var manageConsent = async ({
7767
7768
  authContext,
7768
7769
  consentClient,
7769
7770
  nominatorContact,
7770
- dataElementUuids
7771
+ dataElementUuids,
7772
+ productUuid
7771
7773
  }) => {
7772
7774
  try {
7773
7775
  const accessToken = await ensureValidToken(organizationId, workspaceId, void 0, authContext, consentClient);
@@ -7783,7 +7785,8 @@ var manageConsent = async ({
7783
7785
  authToken: accessToken,
7784
7786
  consentClient,
7785
7787
  nominatorContact,
7786
- dataElementUuids
7788
+ dataElementUuids,
7789
+ productUuid
7787
7790
  });
7788
7791
  return result;
7789
7792
  } catch (error) {
@@ -7802,7 +7805,8 @@ var manageConsent = async ({
7802
7805
  authToken: newAccessToken || void 0,
7803
7806
  consentClient,
7804
7807
  nominatorContact,
7805
- dataElementUuids
7808
+ dataElementUuids,
7809
+ productUuid
7806
7810
  });
7807
7811
  }
7808
7812
  console.error(`Error ${action} consent:`, error);
@@ -8678,7 +8682,7 @@ function createConsentClient(baseUrl) {
8678
8682
  /**
8679
8683
  * Manage consent (privacy center) - revoke, regrant, or renew
8680
8684
  */
8681
- async manageConsent(baseRequest, purposeId, contact, status, authToken, options, nominatorContact, dataElementUuids) {
8685
+ async manageConsent(baseRequest, purposeId, contact, status, authToken, options, nominatorContact, dataElementUuids, productUuid) {
8682
8686
  const url = privacyCenterUrl(baseRequest, `/manage-consent?status=${status}`);
8683
8687
  const body = { purpose_uuid: purposeId, contact };
8684
8688
  if (nominatorContact) {
@@ -8687,6 +8691,9 @@ function createConsentClient(baseUrl) {
8687
8691
  if (Array.isArray(dataElementUuids) && dataElementUuids.length > 0) {
8688
8692
  body.data_element_uuids = dataElementUuids;
8689
8693
  }
8694
+ if (productUuid) {
8695
+ body.product_uuid = productUuid;
8696
+ }
8690
8697
  return privacyCenterApiFetch(url, {
8691
8698
  ...options,
8692
8699
  method: "POST",
@@ -11878,9 +11885,11 @@ var CASE_DETAILS_PREFIX = "/case-details/";
11878
11885
  import { createContext as createContext6, useContext as useContext5, useEffect as useEffect7, useState as useState8 } from "react";
11879
11886
 
11880
11887
  // src/RedactoPrivacyCenter/api/orgBranding.ts
11881
- var USER_SERVER_BASE_URL = "https://api.redacto.tech/user/api/0";
11882
- async function fetchOrgBranding(slug) {
11883
- const url = `${USER_SERVER_BASE_URL}/public/org-branding/by-slug/${encodeURIComponent(slug)}`;
11888
+ function getUserServerBaseUrl(baseUrl) {
11889
+ return baseUrl.includes(".io") ? "https://api.redacto.io/user/api/0" : "https://api.redacto.tech/user/api/0";
11890
+ }
11891
+ async function fetchOrgBranding(slug, baseUrl) {
11892
+ const url = `${getUserServerBaseUrl(baseUrl)}/public/org-branding/by-slug/${encodeURIComponent(slug)}`;
11884
11893
  return apiFetch(url, { method: "GET" });
11885
11894
  }
11886
11895
 
@@ -11943,12 +11952,16 @@ function clearBrandingTheme() {
11943
11952
  // src/RedactoPrivacyCenter/context/BrandingContext.tsx
11944
11953
  import { jsx as jsx27 } from "react/jsx-runtime";
11945
11954
  var BrandingContext = createContext6(null);
11946
- var BrandingProvider = ({ children, slug }) => {
11955
+ var BrandingProvider = ({
11956
+ children,
11957
+ slug,
11958
+ baseUrl
11959
+ }) => {
11947
11960
  const [branding, setBranding] = useState8(null);
11948
11961
  useEffect7(() => {
11949
11962
  if (!slug) return;
11950
11963
  let cancelled = false;
11951
- fetchOrgBranding(slug).then((data) => {
11964
+ fetchOrgBranding(slug, baseUrl).then((data) => {
11952
11965
  if (!cancelled) setBranding(data);
11953
11966
  }).catch((error) => {
11954
11967
  console.warn("[RedactoPrivacyCenter] org branding fetch failed:", error);
@@ -11956,7 +11969,7 @@ var BrandingProvider = ({ children, slug }) => {
11956
11969
  return () => {
11957
11970
  cancelled = true;
11958
11971
  };
11959
- }, [slug]);
11972
+ }, [slug, baseUrl]);
11960
11973
  useEffect7(() => {
11961
11974
  if (!branding) return;
11962
11975
  applyBrandingTheme(branding.theme);
@@ -13459,7 +13472,7 @@ function AdvancedTable({
13459
13472
  /* @__PURE__ */ jsx39(PCTable.Body, { className: classNames == null ? void 0 : classNames.bodyClassName, children: table.getRowModel().rows.map((row) => {
13460
13473
  const meta = table.options.meta || {};
13461
13474
  const onRowClick = meta.onRowClick;
13462
- const handleRowClick = onRowClick ? (e) => {
13475
+ const handleRowClick = onRowClick ? () => {
13463
13476
  onRowClick(row.original, row);
13464
13477
  } : void 0;
13465
13478
  const rowExpandedComponent = expandedComponent || meta.expandedComponent;
@@ -14719,7 +14732,8 @@ var ModifyConsentModal = ({
14719
14732
  selectedRecord.purpose_uuid,
14720
14733
  actionConfig.action,
14721
14734
  nomContact,
14722
- isRegrantAction ? selectedDataElementUuids : void 0
14735
+ isRegrantAction ? selectedDataElementUuids : void 0,
14736
+ selectedRecord.product_uuid
14723
14737
  );
14724
14738
  }
14725
14739
  },
@@ -16117,9 +16131,6 @@ function ConsentManager({ variant }) {
16117
16131
  useEffect13(() => {
16118
16132
  fetchData();
16119
16133
  }, [fetchData]);
16120
- const hasActiveFilters = Boolean(
16121
- debouncedSearch.trim() || (statusFilter == null ? void 0 : statusFilter.value) || (productFilter == null ? void 0 : productFilter.value)
16122
- );
16123
16134
  const groupedPurposeCount = useMemo11(
16124
16135
  () => consentGroups.reduce((sum, group) => sum + group.purposes.length, 0),
16125
16136
  [consentGroups]
@@ -16319,7 +16330,7 @@ function ConsentManager({ variant }) {
16319
16330
  ]
16320
16331
  );
16321
16332
  const handleManageConsent = useCallback9(
16322
- async (purposeId, action, nominatorContact, dataElementUuids) => {
16333
+ async (purposeId, action, nominatorContact, dataElementUuids, productUuid) => {
16323
16334
  if (!organizationId || !workspaceId || !contact) {
16324
16335
  toast.error(t("missingInfoToManage"));
16325
16336
  return;
@@ -16345,7 +16356,8 @@ function ConsentManager({ variant }) {
16345
16356
  authContext,
16346
16357
  consentClient,
16347
16358
  nominatorContact,
16348
- dataElementUuids
16359
+ dataElementUuids,
16360
+ productUuid
16349
16361
  });
16350
16362
  if (response) {
16351
16363
  toast.success(successMessages[action]);
@@ -24264,7 +24276,7 @@ function RedactoPrivacyCenter({
24264
24276
  initialPage = "consent-manager",
24265
24277
  onBack
24266
24278
  }) {
24267
- return /* @__PURE__ */ jsx80(I18nextProvider, { i18n: i18n_default, children: /* @__PURE__ */ jsx80(BrandingProvider, { slug, children: /* @__PURE__ */ jsx80(BaseUrlProvider, { baseUrl, children: /* @__PURE__ */ jsx80(
24279
+ return /* @__PURE__ */ jsx80(I18nextProvider, { i18n: i18n_default, children: /* @__PURE__ */ jsx80(BrandingProvider, { slug, baseUrl, children: /* @__PURE__ */ jsx80(BaseUrlProvider, { baseUrl, children: /* @__PURE__ */ jsx80(
24268
24280
  AuthProvider,
24269
24281
  {
24270
24282
  accessToken,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redacto.io/consent-sdk-react",
3
- "version": "7.1.0",
3
+ "version": "7.3.0",
4
4
  "main": "dist/index.cjs",
5
5
  "module": "dist/index.mjs",
6
6
  "types": "dist/index.d.ts",
@@ -34,7 +34,7 @@ export function RedactoPrivacyCenter({
34
34
  }: RedactoPrivacyCenterProps) {
35
35
  return (
36
36
  <I18nextProvider i18n={i18n}>
37
- <BrandingProvider slug={slug}>
37
+ <BrandingProvider slug={slug} baseUrl={baseUrl}>
38
38
  <BaseUrlProvider baseUrl={baseUrl}>
39
39
  <AuthProvider
40
40
  accessToken={accessToken}
@@ -355,6 +355,7 @@ export async function manageConsentServer(params: {
355
355
  consentClient?: ReturnType<typeof import('./client').createConsentClient>;
356
356
  nominatorContact?: string;
357
357
  dataElementUuids?: string[];
358
+ productUuid?: string;
358
359
  }): Promise<boolean | null> {
359
360
  try {
360
361
  if (!params.consentClient) {
@@ -371,7 +372,8 @@ export async function manageConsentServer(params: {
371
372
  params.authToken,
372
373
  undefined,
373
374
  params.nominatorContact,
374
- params.dataElementUuids
375
+ params.dataElementUuids,
376
+ params.productUuid
375
377
  );
376
378
  return (result as { success: boolean })?.success ?? null;
377
379
  } catch (error: any) {
@@ -419,7 +419,8 @@ export function createConsentClient(baseUrl: string) {
419
419
  authToken?: string,
420
420
  options?: Omit<ApiFetchOptions, "getAuthToken">,
421
421
  nominatorContact?: string,
422
- dataElementUuids?: string[]
422
+ dataElementUuids?: string[],
423
+ productUuid?: string
423
424
  ): Promise<unknown> {
424
425
  const url = privacyCenterUrl(baseRequest, `/manage-consent?status=${status}`);
425
426
  const body: Record<string, unknown> = { purpose_uuid: purposeId, contact };
@@ -429,6 +430,9 @@ export function createConsentClient(baseUrl: string) {
429
430
  if (Array.isArray(dataElementUuids) && dataElementUuids.length > 0) {
430
431
  body.data_element_uuids = dataElementUuids;
431
432
  }
433
+ if (productUuid) {
434
+ body.product_uuid = productUuid;
435
+ }
432
436
  return privacyCenterApiFetch(url, {
433
437
  ...options,
434
438
  method: "POST",
@@ -1,9 +1,16 @@
1
1
  import { apiFetch } from './fetcher';
2
2
  import type { OrgBrandingDetail } from '../lib/types';
3
3
 
4
- const USER_SERVER_BASE_URL = 'https://api.redacto.tech/user/api/0';
4
+ function getUserServerBaseUrl(baseUrl: string): string {
5
+ return baseUrl.includes('.io')
6
+ ? 'https://api.redacto.io/user/api/0'
7
+ : 'https://api.redacto.tech/user/api/0';
8
+ }
5
9
 
6
- export async function fetchOrgBranding(slug: string): Promise<OrgBrandingDetail> {
7
- const url = `${USER_SERVER_BASE_URL}/public/org-branding/by-slug/${encodeURIComponent(slug)}`;
10
+ export async function fetchOrgBranding(
11
+ slug: string,
12
+ baseUrl: string,
13
+ ): Promise<OrgBrandingDetail> {
14
+ const url = `${getUserServerBaseUrl(baseUrl)}/public/org-branding/by-slug/${encodeURIComponent(slug)}`;
8
15
  return apiFetch<OrgBrandingDetail>(url, { method: 'GET' });
9
16
  }
@@ -495,10 +495,6 @@ export default function ConsentManager({ variant }: ConsentManagerProps) {
495
495
  fetchData();
496
496
  }, [fetchData]);
497
497
 
498
- const hasActiveFilters = Boolean(
499
- debouncedSearch.trim() || statusFilter?.value || productFilter?.value
500
- );
501
-
502
498
  const groupedPurposeCount = useMemo(
503
499
  () => consentGroups.reduce((sum, group) => sum + group.purposes.length, 0),
504
500
  [consentGroups]
@@ -729,7 +725,8 @@ export default function ConsentManager({ variant }: ConsentManagerProps) {
729
725
  purposeId: string,
730
726
  action: ConsentAction,
731
727
  nominatorContact?: string,
732
- dataElementUuids?: string[]
728
+ dataElementUuids?: string[],
729
+ productUuid?: string
733
730
  ) => {
734
731
  if (!organizationId || !workspaceId || !contact) {
735
732
  toast.error(t('missingInfoToManage'));
@@ -761,6 +758,7 @@ export default function ConsentManager({ variant }: ConsentManagerProps) {
761
758
  consentClient,
762
759
  nominatorContact,
763
760
  dataElementUuids,
761
+ productUuid,
764
762
  });
765
763
 
766
764
  if (response) {
@@ -317,7 +317,8 @@ export const ModifyConsentModal = ({
317
317
  selectedRecord.purpose_uuid,
318
318
  actionConfig.action,
319
319
  nomContact,
320
- isRegrantAction ? selectedDataElementUuids : undefined
320
+ isRegrantAction ? selectedDataElementUuids : undefined,
321
+ selectedRecord.product_uuid
321
322
  );
322
323
  }
323
324
  }}
@@ -67,7 +67,8 @@ export type ModifyConsentModalProps = {
67
67
  purposeId: string,
68
68
  action: import('../lib/types').ConsentAction,
69
69
  nominatorContact?: string,
70
- dataElementUuids?: string[]
70
+ dataElementUuids?: string[],
71
+ productUuid?: string
71
72
  ) => void;
72
73
  };
73
74
 
@@ -7,13 +7,21 @@ type BrandingContextValue = { branding: OrgBrandingDetail | null };
7
7
 
8
8
  const BrandingContext = createContext<BrandingContextValue | null>(null);
9
9
 
10
- export const BrandingProvider = ({ children, slug }: { children: ReactNode; slug: string }) => {
10
+ export const BrandingProvider = ({
11
+ children,
12
+ slug,
13
+ baseUrl,
14
+ }: {
15
+ children: ReactNode;
16
+ slug: string;
17
+ baseUrl: string;
18
+ }) => {
11
19
  const [branding, setBranding] = useState<OrgBrandingDetail | null>(null);
12
20
 
13
21
  useEffect(() => {
14
22
  if (!slug) return;
15
23
  let cancelled = false;
16
- fetchOrgBranding(slug)
24
+ fetchOrgBranding(slug, baseUrl)
17
25
  .then((data) => {
18
26
  if (!cancelled) setBranding(data);
19
27
  })
@@ -23,7 +31,7 @@ export const BrandingProvider = ({ children, slug }: { children: ReactNode; slug
23
31
  return () => {
24
32
  cancelled = true;
25
33
  };
26
- }, [slug]);
34
+ }, [slug, baseUrl]);
27
35
 
28
36
  useEffect(() => {
29
37
  if (!branding) return;
@@ -371,6 +371,7 @@ export const manageConsent = async ({
371
371
  consentClient,
372
372
  nominatorContact,
373
373
  dataElementUuids,
374
+ productUuid,
374
375
  }: {
375
376
  organizationId: string;
376
377
  workspaceId: string;
@@ -381,6 +382,7 @@ export const manageConsent = async ({
381
382
  consentClient?: BaseUrlContextValue['consentClient'];
382
383
  nominatorContact?: string;
383
384
  dataElementUuids?: string[];
385
+ productUuid?: string;
384
386
  }): Promise<boolean | null> => {
385
387
  try {
386
388
  // Ensure we have a valid token before making the API call
@@ -400,6 +402,7 @@ export const manageConsent = async ({
400
402
  consentClient,
401
403
  nominatorContact,
402
404
  dataElementUuids,
405
+ productUuid,
403
406
  });
404
407
  return result;
405
408
  } catch (error: any) {
@@ -421,6 +424,7 @@ export const manageConsent = async ({
421
424
  consentClient,
422
425
  nominatorContact,
423
426
  dataElementUuids,
427
+ productUuid,
424
428
  });
425
429
  }
426
430
  console.error(`Error ${action} consent:`, error);
@@ -111,7 +111,7 @@ export default function AdvancedTable<TData extends Record<string, any>>({
111
111
  const meta = (table.options.meta as any) || {};
112
112
  const onRowClick = meta.onRowClick;
113
113
  const handleRowClick = onRowClick
114
- ? (e: React.MouseEvent) => {
114
+ ? () => {
115
115
  onRowClick(row.original, row);
116
116
  }
117
117
  : undefined;