@redacto.io/consent-sdk-react 9.3.0 → 9.4.0-beta.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.
Files changed (48) hide show
  1. package/.turbo/turbo-build.log +10 -10
  2. package/CHANGELOG.md +6 -0
  3. package/README.md +93 -12
  4. package/dist/index.d.mts +39 -1
  5. package/dist/index.d.ts +39 -1
  6. package/dist/index.js +4454 -334
  7. package/dist/index.mjs +4454 -335
  8. package/dist/privacy-center.d.mts +4 -1
  9. package/dist/privacy-center.d.ts +4 -1
  10. package/dist/privacy-center.js +3905 -3660
  11. package/dist/privacy-center.mjs +4172 -3921
  12. package/package.json +1 -1
  13. package/src/RedactoNoticeAssisted/RedactoNoticeAssisted.test.tsx +847 -0
  14. package/src/RedactoNoticeAssisted/RedactoNoticeAssisted.tsx +2133 -0
  15. package/src/RedactoNoticeAssisted/api/index.ts +269 -0
  16. package/src/RedactoNoticeAssisted/api/types.ts +180 -0
  17. package/src/RedactoNoticeAssisted/assets/redacto-logo.png +0 -0
  18. package/src/RedactoNoticeAssisted/constants.ts +51 -0
  19. package/src/RedactoNoticeAssisted/i18n.ts +1463 -0
  20. package/src/RedactoNoticeAssisted/index.ts +1 -0
  21. package/src/RedactoNoticeAssisted/injectStyles.ts +251 -0
  22. package/src/RedactoNoticeAssisted/styles.ts +730 -0
  23. package/src/RedactoNoticeAssisted/types.ts +24 -0
  24. package/src/RedactoNoticeAssisted/useMediaQuery.ts +36 -0
  25. package/src/RedactoPrivacyCenter/NotificationsPage.tsx +8 -0
  26. package/src/RedactoPrivacyCenter/api/actions.ts +6 -11
  27. package/src/RedactoPrivacyCenter/api/client.ts +15 -3
  28. package/src/RedactoPrivacyCenter/api/fetcher.ts +80 -1
  29. package/src/RedactoPrivacyCenter/components/ActivitiesList.tsx +193 -213
  30. package/src/RedactoPrivacyCenter/components/ActivityTimeline.tsx +239 -0
  31. package/src/RedactoPrivacyCenter/components/CaseDetails/MessagesTab.tsx +3 -1
  32. package/src/RedactoPrivacyCenter/components/CaseDetails/useMessagePolling.ts +8 -1
  33. package/src/RedactoPrivacyCenter/components/ConsentManager.tsx +23 -17
  34. package/src/RedactoPrivacyCenter/components/ConsentManagerCells.tsx +24 -10
  35. package/src/RedactoPrivacyCenter/components/NotificationHub/NotificationBell.tsx +16 -3
  36. package/src/RedactoPrivacyCenter/components/constant.ts +25 -0
  37. package/src/RedactoPrivacyCenter/components/types.ts +32 -1
  38. package/src/RedactoPrivacyCenter/lib/consent-manager/utils.tsx +25 -23
  39. package/src/RedactoPrivacyCenter/lib/constants.ts +23 -10
  40. package/src/RedactoPrivacyCenter/lib/queries.ts +9 -2
  41. package/src/RedactoPrivacyCenter/lib/utils.refresh-circuit.test.ts +127 -0
  42. package/src/RedactoPrivacyCenter/lib/utils.refresh-storage.test.ts +85 -0
  43. package/src/RedactoPrivacyCenter/lib/utils.ts +213 -63
  44. package/src/RedactoPrivacyCenter/locales/en/translation.json +3 -0
  45. package/src/RedactoPrivacyCenter/styles/injectStyles.ts +16 -0
  46. package/src/index.ts +2 -0
  47. package/src/shared/api-errors.ts +9 -0
  48. package/src/RedactoPrivacyCenter/components/activitiesColumns.tsx +0 -141
@@ -1,5 +1,5 @@
1
1
 
2
- > @redacto.io/consent-sdk-react@9.2.0 build /Users/sadanmianredacto/Developer/redacto/consent-sdk/packages/consent-sdk-react
2
+ > @redacto.io/consent-sdk-react@9.3.0 build /Users/sadanmianredacto/Developer/redacto/consent-sdk/packages/consent-sdk-react
3
3
  > tsup
4
4
 
5
5
  CLI Building entry: {"index":"src/index.ts","privacy-center":"src/privacy-center.ts"}
@@ -10,16 +10,16 @@ CLI Target: es2019
10
10
  CLI Cleaning output folder
11
11
  ESM Build start
12
12
  CJS Build start
13
- CJS dist/index.js 237.00 KB
14
- CJS dist/privacy-center.js 2.16 MB
15
- CJS ⚡️ Build success in 59ms
13
+ CJS dist/index.js 319.92 KB
14
+ CJS dist/privacy-center.js 2.17 MB
15
+ CJS ⚡️ Build success in 447ms
16
+ ESM dist/index.mjs 306.43 KB
16
17
  ESM dist/chunk-6A665OPR.mjs 841.00 B
17
- ESM dist/index.mjs 226.91 KB
18
- ESM dist/privacy-center.mjs 2.12 MB
19
- ESM ⚡️ Build success in 65ms
18
+ ESM dist/privacy-center.mjs 2.13 MB
19
+ ESM ⚡️ Build success in 453ms
20
20
  DTS Build start
21
- DTS ⚡️ Build success in 2407ms
22
- DTS dist/index.d.mts 6.12 KB
21
+ DTS ⚡️ Build success in 5383ms
22
+ DTS dist/index.d.mts 7.72 KB
23
23
  DTS dist/privacy-center.d.mts 30.45 KB
24
- DTS dist/index.d.ts 6.12 KB
24
+ DTS dist/index.d.ts 7.72 KB
25
25
  DTS dist/privacy-center.d.ts 30.45 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @redacto.io/consent-sdk-react
2
2
 
3
+ ## 9.4.0-beta.0
4
+
5
+ ### Minor Changes
6
+
7
+ - feat(consent-sdk-react): add RedactoNoticeAssisted (agent-assisted OTP consent) + starter loan demo
8
+
3
9
  ## 9.3.0
4
10
 
5
11
  ### Minor Changes
package/README.md CHANGED
@@ -12,7 +12,7 @@ The package ships two import paths so consumers only pull in what they need:
12
12
 
13
13
  | Import path | What you get |
14
14
  | ------------------------------------------------- | --------------------------------------------------------------------------------------------------------- |
15
- | `@redacto.io/consent-sdk-react` | Consent notice components: `RedactoNoticeConsent`, `RedactoNoticeConsentInline`, and `DigiLockerCallback` |
15
+ | `@redacto.io/consent-sdk-react` | Consent notice components: `RedactoNoticeConsent`, `RedactoNoticeConsentInline`, `RedactoNoticeAssisted`, and `DigiLockerCallback` |
16
16
  | `@redacto.io/consent-sdk-react/privacy-center` | Privacy Center: certified `RedactoPrivacyCenter`, composable pages, headless API client, hooks, contexts |
17
17
 
18
18
  The notice entry point has minimal dependencies. The Privacy Center entry point depends on the optional peers listed under [Peer Dependencies](#peer-dependencies).
@@ -68,9 +68,14 @@ The SDK follows a client-server architecture pattern:
68
68
 
69
69
  - **Consent Notice Display**
70
70
  - Customizable consent notices
71
- - Multiple display formats (modal popup, inline form)
71
+ - Multiple display formats (modal popup, inline form, assisted/OTP-verified)
72
72
  - Responsive design
73
73
 
74
+ - **Assisted / OTP-Verified Consent**
75
+ - Agent-assisted collection for end-users with no app session or token
76
+ - Built-in identity verification via OTP (SMS or email)
77
+ - Optional text-to-speech narration of the notice
78
+
74
79
  - **Consent Collection**
75
80
  - User consent choices (accept, reject, manage preferences)
76
81
  - Granular consent management
@@ -338,6 +343,41 @@ The component automatically submits consent when all of the following conditions
338
343
  | `onError` | `(error: Error) => void` | No | - | Error handler callback |
339
344
  | `onValidationChange` | `(isValid: boolean) => void` | No | - | Callback when validation state changes |
340
345
 
346
+ ### `RedactoNoticeAssisted`
347
+
348
+ A modal, agent-assisted consent widget for collecting consent from an end-user who has **no app session and no token** — for example, a support agent walking a customer through consent in person or over a call. It fetches the notice from the **public** notice endpoint using only the org/workspace/notice UUIDs, then proves the end-user's identity inline via a one-time passcode (OTP) before submitting consent. No backend token plumbing is required.
349
+
350
+ **Key Characteristics:**
351
+
352
+ - No tokens required to render or submit — identity is proven inline via OTP (unlike `RedactoNoticeConsent`, which needs tokens upfront, and `RedactoNoticeConsentInline`, which needs a token to submit)
353
+ - Built-in end-user verification: 6-digit OTP over **SMS (`+91` mobile) or email**, with a 30-second resend timer
354
+ - Language picker (English pinned first) plus optional **text-to-speech narration** of the notice
355
+ - Purpose and data-element checkboxes with two-way binding; the **Confirm** CTA is gated until every required data element is selected
356
+ - Self-contained modal that blocks the UI — the host only supplies the three UUIDs and reacts to `onDecline` / `onComplete`
357
+ - Localized (English plus Indian languages) and accessible (dialog role, ARIA labelling, honors `prefers-reduced-motion`)
358
+ - Best for: agent-assisted, in-person or remote consent collection where the end-user is not signed in
359
+
360
+ **Props:**
361
+
362
+ | Prop | Type | Required | Default | Description |
363
+ | ------------------ | ------------ | -------- | ------------------------ | --------------------------------------------------------------------- |
364
+ | `organisationUuid` | `string` | Yes | - | Organisation UUID (path segment of the public notice endpoint) |
365
+ | `workspaceUuid` | `string` | Yes | - | Workspace UUID (path segment of the public notice endpoint) |
366
+ | `noticeUuid` | `string` | Yes | - | Notice UUID to fetch and render |
367
+ | `baseUrl` | `string` | No | Production consent API | Base URL for the consent API |
368
+ | `onDecline` | `() => void` | No | Logs and resets the flow | Called when the agent/customer declines (host should unmount the modal) |
369
+ | `onComplete` | `() => void` | No | Logs and resets the flow | Called when the agent clicks "Proceed" on the confirmed screen |
370
+
371
+ **Flow:**
372
+
373
+ The component renders a single modal that progresses through three screens:
374
+
375
+ 1. **Notice** — the notice is shown with the language picker, optional audio narration, and purpose/data-element checkboxes. The agent makes selections; the **Confirm** button stays disabled until all required data elements are checked.
376
+ 2. **Verify (OTP)** — the end-user's contact is entered as either a `+91` **mobile** number (SMS) or an **email** address, and a 6-digit OTP is sent. The agent enters the code to verify; the code can be resent after a 30-second countdown.
377
+ 3. **Confirmed** — on successful verification the consent is submitted and a confirmation screen is shown. Clicking **Proceed** fires `onComplete`.
378
+
379
+ Declining at any step fires `onDecline`. Both callbacks are optional; when omitted the component logs the outcome and resets to the notice screen.
380
+
341
381
  ## Usage Examples
342
382
 
343
383
  ### Example 1: Using `RedactoNoticeConsent` (Modal Popup)
@@ -587,9 +627,50 @@ function RegistrationForm() {
587
627
  }
588
628
  ```
589
629
 
630
+ ### Example 3: Using `RedactoNoticeAssisted` (Assisted / OTP-Verified)
631
+
632
+ This example shows an agent-facing screen that collects consent from a customer who is not signed in. No tokens are fetched — the component renders straight from the three UUIDs and verifies the customer inline via OTP before submitting.
633
+
634
+ ```tsx
635
+ import { useState } from "react";
636
+ import { RedactoNoticeAssisted } from "@redacto.io/consent-sdk-react";
637
+
638
+ const ORG_UUID = "your-organisation-uuid";
639
+ const WORKSPACE_UUID = "your-workspace-uuid";
640
+ const NOTICE_UUID = "your-notice-uuid";
641
+ const BASE_URL = "https://api.redacto.io/consent"; // Optional: override the consent API
642
+
643
+ export function AssistedConsent() {
644
+ const [open, setOpen] = useState(false);
645
+
646
+ return (
647
+ <>
648
+ <button onClick={() => setOpen(true)}>Start assisted consent</button>
649
+
650
+ {open && (
651
+ <RedactoNoticeAssisted
652
+ organisationUuid={ORG_UUID}
653
+ workspaceUuid={WORKSPACE_UUID}
654
+ noticeUuid={NOTICE_UUID}
655
+ baseUrl={BASE_URL}
656
+ // Fired when the agent/customer declines — unmount the modal.
657
+ onDecline={() => setOpen(false)}
658
+ // Fired after OTP verification + consent submission, when the agent
659
+ // clicks "Proceed" on the confirmed screen.
660
+ onComplete={() => {
661
+ console.log("consent recorded");
662
+ setOpen(false);
663
+ }}
664
+ />
665
+ )}
666
+ </>
667
+ );
668
+ }
669
+ ```
670
+
590
671
  ### Custom Styling
591
672
 
592
- Both components support extensive styling customization:
673
+ `RedactoNoticeConsent` and `RedactoNoticeConsentInline` support extensive styling customization via the `settings` prop. (`RedactoNoticeAssisted` does not take a `settings` prop — it themes itself from the notice's API configuration, such as primary/secondary colour and font.)
593
674
 
594
675
  ```tsx
595
676
  const customSettings = {
@@ -640,15 +721,15 @@ const customSettings = {
640
721
 
641
722
  ## Component Comparison
642
723
 
643
- | Feature | `RedactoNoticeConsent` | `RedactoNoticeConsentInline` |
644
- | ----------------------- | ----------------------------------------- | ------------------------------------------- |
645
- | **Display Type** | Modal popup overlay | Inline form component |
646
- | **Token Requirement** | Required upfront | Optional (can load without) |
647
- | **Use Case** | Initial consent, standalone flows | Embedded in forms, multi-step processes |
648
- | **Auto-Submit** | No (user clicks accept/decline) | Yes (when token provided + validated) |
649
- | **Validation Callback** | No | Yes (`onValidationChange`) |
650
- | **UI Blocking** | Yes (by default) | No (inline) |
651
- | **Props Required** | `noticeId`, `accessToken`, `refreshToken` | `org_uuid`, `workspace_uuid`, `notice_uuid` |
724
+ | Feature | `RedactoNoticeConsent` | `RedactoNoticeConsentInline` | `RedactoNoticeAssisted` |
725
+ | ----------------------- | ----------------------------------------- | ------------------------------------------- | ------------------------------------------------ |
726
+ | **Display Type** | Modal popup overlay | Inline form component | Modal popup overlay |
727
+ | **Token Requirement** | Required upfront | Optional (can load without) | None — identity proven inline via OTP |
728
+ | **Use Case** | Initial consent, standalone flows | Embedded in forms, multi-step processes | Agent-assisted, in-person/remote collection |
729
+ | **Auto-Submit** | No (user clicks accept/decline) | Yes (when token provided + validated) | No (submits after OTP verification) |
730
+ | **Validation Callback** | No | Yes (`onValidationChange`) | No |
731
+ | **UI Blocking** | Yes (by default) | No (inline) | Yes |
732
+ | **Props Required** | `noticeId`, `accessToken`, `refreshToken` | `org_uuid`, `workspace_uuid`, `notice_uuid` | `organisationUuid`, `workspaceUuid`, `noticeUuid` |
652
733
 
653
734
  ## Privacy Center
654
735
 
package/dist/index.d.mts CHANGED
@@ -116,6 +116,42 @@ declare const RedactoConsentInline: react.MemoExoticComponent<{
116
116
  displayName: string;
117
117
  }>;
118
118
 
119
+ /**
120
+ * Public props. The notice is fetched from the PUBLIC notice endpoint, so the
121
+ * organisation / workspace / notice UUIDs and base URL are supplied by the host
122
+ * (typically read from the frontend URL) — there is no auth token.
123
+ */
124
+ type RedactoNoticeAssistedProps = {
125
+ /** Organisation UUID (path segment of the public notice endpoint). */
126
+ organisationUuid: string;
127
+ /** Workspace UUID (path segment of the public notice endpoint). */
128
+ workspaceUuid: string;
129
+ /** Notice UUID to fetch and render. */
130
+ noticeUuid: string;
131
+ /** API base URL (defaults to the production consent API). */
132
+ baseUrl?: string;
133
+ /** Called when the agent/customer declines (host should unmount the modal). */
134
+ onDecline?: () => void;
135
+ /** Called when the agent clicks "Proceed" on the confirmed screen. */
136
+ onComplete?: () => void;
137
+ };
138
+
139
+ /**
140
+ * RedactoNoticeAssisted — agent-assisted consent collection.
141
+ *
142
+ * Fetches a consent notice from the PUBLIC notice endpoint (org/workspace/notice
143
+ * UUIDs + baseUrl come from props — no auth) and renders it exactly like
144
+ * RedactoNoticeConsent: logo + title, language pill, privacy text, "Manage What You
145
+ * Share" accordion purposes, DPO footer, themed Confirm/Decline.
146
+ *
147
+ * Single progressive screen: the notice stays mounted throughout. Clicking the
148
+ * primary CTA reveals an inline mobile/OTP panel below the (now locked) notice and
149
+ * advances the CTA — Confirm → Send OTP → Confirm OTP. On successful verify +
150
+ * submit, `onComplete` fires immediately with no confirmation screen (mirroring
151
+ * RedactoNoticeConsent's `onAccept`). Steps: `notice` → `verify` (with `otpSent`).
152
+ */
153
+ declare const RedactoNoticeAssisted: ({ organisationUuid, workspaceUuid, noticeUuid, baseUrl, onDecline, onComplete, }: RedactoNoticeAssistedProps) => react_jsx_runtime.JSX.Element;
154
+
119
155
  /**
120
156
  * DigiLockerCallback Component
121
157
  *
@@ -162,11 +198,13 @@ type ApiErrorCodeLike = ApiErrorCode | (string & {});
162
198
  declare class ApiError extends Error {
163
199
  readonly status: number;
164
200
  readonly code?: ApiErrorCodeLike;
201
+ readonly shouldRequestNew?: boolean;
165
202
  constructor(opts: {
166
203
  status: number;
167
204
  code?: ApiErrorCodeLike;
168
205
  message: string;
206
+ shouldRequestNew?: boolean;
169
207
  });
170
208
  }
171
209
 
172
- export { ApiError, type ApiErrorCode, type ConsentFlowState, DigiLockerCallback, type DigiLockerCallbackProps, type GuardianVerificationErrorCode, RedactoNoticeConsent, RedactoConsentInline as RedactoNoticeConsentInline };
210
+ export { ApiError, type ApiErrorCode, type ConsentFlowState, DigiLockerCallback, type DigiLockerCallbackProps, type GuardianVerificationErrorCode, RedactoNoticeAssisted, type RedactoNoticeAssistedProps, RedactoNoticeConsent, RedactoConsentInline as RedactoNoticeConsentInline };
package/dist/index.d.ts CHANGED
@@ -116,6 +116,42 @@ declare const RedactoConsentInline: react.MemoExoticComponent<{
116
116
  displayName: string;
117
117
  }>;
118
118
 
119
+ /**
120
+ * Public props. The notice is fetched from the PUBLIC notice endpoint, so the
121
+ * organisation / workspace / notice UUIDs and base URL are supplied by the host
122
+ * (typically read from the frontend URL) — there is no auth token.
123
+ */
124
+ type RedactoNoticeAssistedProps = {
125
+ /** Organisation UUID (path segment of the public notice endpoint). */
126
+ organisationUuid: string;
127
+ /** Workspace UUID (path segment of the public notice endpoint). */
128
+ workspaceUuid: string;
129
+ /** Notice UUID to fetch and render. */
130
+ noticeUuid: string;
131
+ /** API base URL (defaults to the production consent API). */
132
+ baseUrl?: string;
133
+ /** Called when the agent/customer declines (host should unmount the modal). */
134
+ onDecline?: () => void;
135
+ /** Called when the agent clicks "Proceed" on the confirmed screen. */
136
+ onComplete?: () => void;
137
+ };
138
+
139
+ /**
140
+ * RedactoNoticeAssisted — agent-assisted consent collection.
141
+ *
142
+ * Fetches a consent notice from the PUBLIC notice endpoint (org/workspace/notice
143
+ * UUIDs + baseUrl come from props — no auth) and renders it exactly like
144
+ * RedactoNoticeConsent: logo + title, language pill, privacy text, "Manage What You
145
+ * Share" accordion purposes, DPO footer, themed Confirm/Decline.
146
+ *
147
+ * Single progressive screen: the notice stays mounted throughout. Clicking the
148
+ * primary CTA reveals an inline mobile/OTP panel below the (now locked) notice and
149
+ * advances the CTA — Confirm → Send OTP → Confirm OTP. On successful verify +
150
+ * submit, `onComplete` fires immediately with no confirmation screen (mirroring
151
+ * RedactoNoticeConsent's `onAccept`). Steps: `notice` → `verify` (with `otpSent`).
152
+ */
153
+ declare const RedactoNoticeAssisted: ({ organisationUuid, workspaceUuid, noticeUuid, baseUrl, onDecline, onComplete, }: RedactoNoticeAssistedProps) => react_jsx_runtime.JSX.Element;
154
+
119
155
  /**
120
156
  * DigiLockerCallback Component
121
157
  *
@@ -162,11 +198,13 @@ type ApiErrorCodeLike = ApiErrorCode | (string & {});
162
198
  declare class ApiError extends Error {
163
199
  readonly status: number;
164
200
  readonly code?: ApiErrorCodeLike;
201
+ readonly shouldRequestNew?: boolean;
165
202
  constructor(opts: {
166
203
  status: number;
167
204
  code?: ApiErrorCodeLike;
168
205
  message: string;
206
+ shouldRequestNew?: boolean;
169
207
  });
170
208
  }
171
209
 
172
- export { ApiError, type ApiErrorCode, type ConsentFlowState, DigiLockerCallback, type DigiLockerCallbackProps, type GuardianVerificationErrorCode, RedactoNoticeConsent, RedactoConsentInline as RedactoNoticeConsentInline };
210
+ export { ApiError, type ApiErrorCode, type ConsentFlowState, DigiLockerCallback, type DigiLockerCallbackProps, type GuardianVerificationErrorCode, RedactoNoticeAssisted, type RedactoNoticeAssistedProps, RedactoNoticeConsent, RedactoConsentInline as RedactoNoticeConsentInline };