@redacto.io/consent-sdk-react 7.1.0 → 7.2.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,15 @@
1
1
  # @redacto.io/consent-sdk-react
2
2
 
3
+ ## 7.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - bugs fix
8
+
9
+ ### Patch Changes
10
+
11
+ - 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.
12
+
3
13
  ## 7.1.0
4
14
 
5
15
  ### 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",
@@ -13515,7 +13522,7 @@ function AdvancedTable({
13515
13522
  /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(PCTable.Body, { className: classNames == null ? void 0 : classNames.bodyClassName, children: table.getRowModel().rows.map((row) => {
13516
13523
  const meta = table.options.meta || {};
13517
13524
  const onRowClick = meta.onRowClick;
13518
- const handleRowClick = onRowClick ? (e) => {
13525
+ const handleRowClick = onRowClick ? () => {
13519
13526
  onRowClick(row.original, row);
13520
13527
  } : void 0;
13521
13528
  const rowExpandedComponent = expandedComponent || meta.expandedComponent;
@@ -14766,7 +14773,8 @@ var ModifyConsentModal = ({
14766
14773
  selectedRecord.purpose_uuid,
14767
14774
  actionConfig.action,
14768
14775
  nomContact,
14769
- isRegrantAction ? selectedDataElementUuids : void 0
14776
+ isRegrantAction ? selectedDataElementUuids : void 0,
14777
+ selectedRecord.product_uuid
14770
14778
  );
14771
14779
  }
14772
14780
  },
@@ -16164,9 +16172,6 @@ function ConsentManager({ variant }) {
16164
16172
  (0, import_react28.useEffect)(() => {
16165
16173
  fetchData();
16166
16174
  }, [fetchData]);
16167
- const hasActiveFilters = Boolean(
16168
- debouncedSearch.trim() || (statusFilter == null ? void 0 : statusFilter.value) || (productFilter == null ? void 0 : productFilter.value)
16169
- );
16170
16175
  const groupedPurposeCount = (0, import_react28.useMemo)(
16171
16176
  () => consentGroups.reduce((sum, group) => sum + group.purposes.length, 0),
16172
16177
  [consentGroups]
@@ -16366,7 +16371,7 @@ function ConsentManager({ variant }) {
16366
16371
  ]
16367
16372
  );
16368
16373
  const handleManageConsent = (0, import_react28.useCallback)(
16369
- async (purposeId, action, nominatorContact, dataElementUuids) => {
16374
+ async (purposeId, action, nominatorContact, dataElementUuids, productUuid) => {
16370
16375
  if (!organizationId || !workspaceId || !contact) {
16371
16376
  toast.error(t("missingInfoToManage"));
16372
16377
  return;
@@ -16392,7 +16397,8 @@ function ConsentManager({ variant }) {
16392
16397
  authContext,
16393
16398
  consentClient,
16394
16399
  nominatorContact,
16395
- dataElementUuids
16400
+ dataElementUuids,
16401
+ productUuid
16396
16402
  });
16397
16403
  if (response) {
16398
16404
  toast.success(successMessages[action]);
@@ -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",
@@ -13459,7 +13466,7 @@ function AdvancedTable({
13459
13466
  /* @__PURE__ */ jsx39(PCTable.Body, { className: classNames == null ? void 0 : classNames.bodyClassName, children: table.getRowModel().rows.map((row) => {
13460
13467
  const meta = table.options.meta || {};
13461
13468
  const onRowClick = meta.onRowClick;
13462
- const handleRowClick = onRowClick ? (e) => {
13469
+ const handleRowClick = onRowClick ? () => {
13463
13470
  onRowClick(row.original, row);
13464
13471
  } : void 0;
13465
13472
  const rowExpandedComponent = expandedComponent || meta.expandedComponent;
@@ -14719,7 +14726,8 @@ var ModifyConsentModal = ({
14719
14726
  selectedRecord.purpose_uuid,
14720
14727
  actionConfig.action,
14721
14728
  nomContact,
14722
- isRegrantAction ? selectedDataElementUuids : void 0
14729
+ isRegrantAction ? selectedDataElementUuids : void 0,
14730
+ selectedRecord.product_uuid
14723
14731
  );
14724
14732
  }
14725
14733
  },
@@ -16117,9 +16125,6 @@ function ConsentManager({ variant }) {
16117
16125
  useEffect13(() => {
16118
16126
  fetchData();
16119
16127
  }, [fetchData]);
16120
- const hasActiveFilters = Boolean(
16121
- debouncedSearch.trim() || (statusFilter == null ? void 0 : statusFilter.value) || (productFilter == null ? void 0 : productFilter.value)
16122
- );
16123
16128
  const groupedPurposeCount = useMemo11(
16124
16129
  () => consentGroups.reduce((sum, group) => sum + group.purposes.length, 0),
16125
16130
  [consentGroups]
@@ -16319,7 +16324,7 @@ function ConsentManager({ variant }) {
16319
16324
  ]
16320
16325
  );
16321
16326
  const handleManageConsent = useCallback9(
16322
- async (purposeId, action, nominatorContact, dataElementUuids) => {
16327
+ async (purposeId, action, nominatorContact, dataElementUuids, productUuid) => {
16323
16328
  if (!organizationId || !workspaceId || !contact) {
16324
16329
  toast.error(t("missingInfoToManage"));
16325
16330
  return;
@@ -16345,7 +16350,8 @@ function ConsentManager({ variant }) {
16345
16350
  authContext,
16346
16351
  consentClient,
16347
16352
  nominatorContact,
16348
- dataElementUuids
16353
+ dataElementUuids,
16354
+ productUuid
16349
16355
  });
16350
16356
  if (response) {
16351
16357
  toast.success(successMessages[action]);
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.2.0",
4
4
  "main": "dist/index.cjs",
5
5
  "module": "dist/index.mjs",
6
6
  "types": "dist/index.d.ts",
@@ -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",
@@ -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
 
@@ -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;