@redacto.io/consent-sdk-react-native 1.0.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.
package/README.md ADDED
@@ -0,0 +1,106 @@
1
+ # @redacto.io/consent-sdk-react-native
2
+
3
+ React Native SDK for Redacto consent management. Port of [`@redacto.io/consent-sdk-react`](../consent-sdk-react) with the same API surface.
4
+
5
+ ## Installation
6
+
7
+ ```sh
8
+ pnpm add @redacto.io/consent-sdk-react-native react-native-svg
9
+ # Optional – required for TTS audio playback
10
+ pnpm add expo-av
11
+ ```
12
+
13
+ > **Note:** `react-native-svg` must be linked for native builds. Follow the [react-native-svg setup guide](https://github.com/software-mansion/react-native-svg#installation).
14
+
15
+ ## Components
16
+
17
+ ### `RedactoNoticeConsent`
18
+
19
+ Modal consent component. Supports initial consent, reconsent, age verification, guardian form, and TTS playback.
20
+
21
+ ```tsx
22
+ import { RedactoNoticeConsent } from "@redacto.io/consent-sdk-react-native";
23
+
24
+ <RedactoNoticeConsent
25
+ noticeId="your-notice-uuid"
26
+ accessToken={accessToken}
27
+ refreshToken={refreshToken}
28
+ onAccept={() => navigation.navigate("Dashboard")}
29
+ onDecline={() => console.log("declined")}
30
+ />
31
+ ```
32
+
33
+ #### Props
34
+
35
+ | Prop | Type | Required | Description |
36
+ |------|------|----------|-------------|
37
+ | `noticeId` | `string` | ✓ | UUID of the consent notice |
38
+ | `accessToken` | `string` | ✓ | JWT access token |
39
+ | `refreshToken` | `string` | ✓ | JWT refresh token |
40
+ | `baseUrl` | `string` | | Override API base URL |
41
+ | `settings` | `Partial<Settings>` | | UI customisation (colours, border radius, fonts) |
42
+ | `language` | `string` | | Initial language code (e.g. `"en"`) |
43
+ | `blockUI` | `boolean` | | Block the modal from being dismissed |
44
+ | `applicationId` | `string` | | Application-specific UUID |
45
+ | `validateAgainst` | `"all" \| "required"` | | Validation mode |
46
+ | `includeFullyConsentedData` | `boolean` | | Include already-consented items |
47
+ | `reviewModeButtonText` | `string` | | CTA text in review mode |
48
+ | `onAccept` | `() => void` | ✓ | Called on successful consent |
49
+ | `onDecline` | `() => void` | ✓ | Called when user declines |
50
+ | `onError` | `(error: Error) => void` | | Called on API errors |
51
+
52
+ ---
53
+
54
+ ### `RedactoNoticeConsentInline`
55
+
56
+ Inline consent component. Auto-submits when all required elements are checked and an access token is available.
57
+
58
+ ```tsx
59
+ import { RedactoNoticeConsentInline } from "@redacto.io/consent-sdk-react-native";
60
+
61
+ <RedactoNoticeConsentInline
62
+ org_uuid="org-uuid"
63
+ workspace_uuid="workspace-uuid"
64
+ notice_uuid="notice-uuid"
65
+ accessToken={accessToken}
66
+ onAccept={() => console.log("accepted")}
67
+ onValidationChange={(isValid) => setCanProceed(isValid)}
68
+ />
69
+ ```
70
+
71
+ #### Props
72
+
73
+ | Prop | Type | Required | Description |
74
+ |------|------|----------|-------------|
75
+ | `org_uuid` | `string` | ✓ | Organisation UUID |
76
+ | `workspace_uuid` | `string` | ✓ | Workspace UUID |
77
+ | `notice_uuid` | `string` | ✓ | Notice UUID |
78
+ | `accessToken` | `string` | | JWT access token (triggers auto-submit when set) |
79
+ | `baseUrl` | `string` | | Override API base URL |
80
+ | `language` | `string` | | Language code |
81
+ | `settings` | `Partial<Settings>` | | UI customisation |
82
+ | `applicationId` | `string` | | Application-specific UUID |
83
+ | `onAccept` | `() => void` | | Called on successful consent |
84
+ | `onDecline` | `() => void` | | Called when user declines |
85
+ | `onError` | `(error: Error) => void` | | Called on errors |
86
+ | `onValidationChange` | `(isValid: boolean) => void` | | Fires when validation state changes |
87
+
88
+ ## TTS Audio
89
+
90
+ If `expo-av` is installed, TTS playback is automatically enabled. Install it and configure audio mode in your app entry point:
91
+
92
+ ```ts
93
+ import { Audio } from "expo-av";
94
+ await Audio.setAudioModeAsync({ playsInSilentModeIOS: true });
95
+ ```
96
+
97
+ ## Configuration and env best practices
98
+
99
+ - The SDK is runtime-configured via props and does not read from `.env` directly.
100
+ - Keep API keys and server secrets on your backend only.
101
+ - In Expo apps, values read from `EXPO_PUBLIC_*` are bundled into the app and should only contain non-sensitive config like UUIDs and URLs.
102
+ - If you do not pass `baseUrl`, the SDK defaults to `https://api.redacto.io/consent` for both modal and inline components.
103
+
104
+ ## License
105
+
106
+ Apache-2.0
@@ -0,0 +1,105 @@
1
+ import React from 'react';
2
+
3
+ type Settings$1 = {
4
+ button: {
5
+ accept: {
6
+ backgroundColor: string;
7
+ textColor: string;
8
+ };
9
+ decline: {
10
+ backgroundColor: string;
11
+ textColor: string;
12
+ };
13
+ language: {
14
+ backgroundColor: string;
15
+ textColor: string;
16
+ selectedBackgroundColor?: string;
17
+ selectedTextColor?: string;
18
+ };
19
+ };
20
+ link: string;
21
+ borderRadius?: string;
22
+ backgroundColor?: string;
23
+ headingColor?: string;
24
+ textColor?: string;
25
+ borderColor?: string;
26
+ font?: string;
27
+ };
28
+
29
+ type Props$1 = Readonly<{
30
+ noticeId: string;
31
+ accessToken: string;
32
+ refreshToken: string;
33
+ baseUrl?: string;
34
+ settings?: Partial<Settings$1>;
35
+ language?: string;
36
+ blockUI?: boolean;
37
+ onAccept: () => void;
38
+ onDecline: () => void;
39
+ onError?: (error: Error) => void;
40
+ applicationId?: string;
41
+ validateAgainst?: "all" | "required";
42
+ includeFullyConsentedData?: boolean;
43
+ reviewModeButtonText?: string;
44
+ }>;
45
+
46
+ declare const RedactoNoticeConsent: React.FC<Props$1>;
47
+
48
+ type Settings = {
49
+ button: {
50
+ accept: {
51
+ backgroundColor: string;
52
+ textColor: string;
53
+ };
54
+ decline: {
55
+ backgroundColor: string;
56
+ textColor: string;
57
+ };
58
+ language: {
59
+ backgroundColor: string;
60
+ textColor: string;
61
+ selectedBackgroundColor?: string;
62
+ selectedTextColor?: string;
63
+ };
64
+ };
65
+ link: string;
66
+ borderRadius?: string;
67
+ backgroundColor?: string;
68
+ headingColor?: string;
69
+ textColor?: string;
70
+ borderColor?: string;
71
+ };
72
+
73
+ declare const RedactoConsentInline: React.NamedExoticComponent<Readonly<{
74
+ org_uuid: string;
75
+ workspace_uuid: string;
76
+ notice_uuid: string;
77
+ accessToken?: string;
78
+ refreshToken?: string;
79
+ baseUrl?: string;
80
+ settings?: Partial<Settings>;
81
+ language?: string;
82
+ onAccept?: () => void;
83
+ onDecline?: () => void;
84
+ onError?: (error: Error) => void;
85
+ onValidationChange?: (isValid: boolean) => void;
86
+ applicationId?: string;
87
+ }>>;
88
+
89
+ type Props = Readonly<{
90
+ org_uuid: string;
91
+ workspace_uuid: string;
92
+ notice_uuid: string;
93
+ accessToken?: string;
94
+ refreshToken?: string;
95
+ baseUrl?: string;
96
+ settings?: Partial<Settings>;
97
+ language?: string;
98
+ onAccept?: () => void;
99
+ onDecline?: () => void;
100
+ onError?: (error: Error) => void;
101
+ onValidationChange?: (isValid: boolean) => void;
102
+ applicationId?: string;
103
+ }>;
104
+
105
+ export { RedactoNoticeConsent, RedactoConsentInline as RedactoNoticeConsentInline, type Props as RedactoNoticeConsentInlineProps, type Props$1 as RedactoNoticeConsentProps, type Settings$1 as Settings };
@@ -0,0 +1,105 @@
1
+ import React from 'react';
2
+
3
+ type Settings$1 = {
4
+ button: {
5
+ accept: {
6
+ backgroundColor: string;
7
+ textColor: string;
8
+ };
9
+ decline: {
10
+ backgroundColor: string;
11
+ textColor: string;
12
+ };
13
+ language: {
14
+ backgroundColor: string;
15
+ textColor: string;
16
+ selectedBackgroundColor?: string;
17
+ selectedTextColor?: string;
18
+ };
19
+ };
20
+ link: string;
21
+ borderRadius?: string;
22
+ backgroundColor?: string;
23
+ headingColor?: string;
24
+ textColor?: string;
25
+ borderColor?: string;
26
+ font?: string;
27
+ };
28
+
29
+ type Props$1 = Readonly<{
30
+ noticeId: string;
31
+ accessToken: string;
32
+ refreshToken: string;
33
+ baseUrl?: string;
34
+ settings?: Partial<Settings$1>;
35
+ language?: string;
36
+ blockUI?: boolean;
37
+ onAccept: () => void;
38
+ onDecline: () => void;
39
+ onError?: (error: Error) => void;
40
+ applicationId?: string;
41
+ validateAgainst?: "all" | "required";
42
+ includeFullyConsentedData?: boolean;
43
+ reviewModeButtonText?: string;
44
+ }>;
45
+
46
+ declare const RedactoNoticeConsent: React.FC<Props$1>;
47
+
48
+ type Settings = {
49
+ button: {
50
+ accept: {
51
+ backgroundColor: string;
52
+ textColor: string;
53
+ };
54
+ decline: {
55
+ backgroundColor: string;
56
+ textColor: string;
57
+ };
58
+ language: {
59
+ backgroundColor: string;
60
+ textColor: string;
61
+ selectedBackgroundColor?: string;
62
+ selectedTextColor?: string;
63
+ };
64
+ };
65
+ link: string;
66
+ borderRadius?: string;
67
+ backgroundColor?: string;
68
+ headingColor?: string;
69
+ textColor?: string;
70
+ borderColor?: string;
71
+ };
72
+
73
+ declare const RedactoConsentInline: React.NamedExoticComponent<Readonly<{
74
+ org_uuid: string;
75
+ workspace_uuid: string;
76
+ notice_uuid: string;
77
+ accessToken?: string;
78
+ refreshToken?: string;
79
+ baseUrl?: string;
80
+ settings?: Partial<Settings>;
81
+ language?: string;
82
+ onAccept?: () => void;
83
+ onDecline?: () => void;
84
+ onError?: (error: Error) => void;
85
+ onValidationChange?: (isValid: boolean) => void;
86
+ applicationId?: string;
87
+ }>>;
88
+
89
+ type Props = Readonly<{
90
+ org_uuid: string;
91
+ workspace_uuid: string;
92
+ notice_uuid: string;
93
+ accessToken?: string;
94
+ refreshToken?: string;
95
+ baseUrl?: string;
96
+ settings?: Partial<Settings>;
97
+ language?: string;
98
+ onAccept?: () => void;
99
+ onDecline?: () => void;
100
+ onError?: (error: Error) => void;
101
+ onValidationChange?: (isValid: boolean) => void;
102
+ applicationId?: string;
103
+ }>;
104
+
105
+ export { RedactoNoticeConsent, RedactoConsentInline as RedactoNoticeConsentInline, type Props as RedactoNoticeConsentInlineProps, type Props$1 as RedactoNoticeConsentProps, type Settings$1 as Settings };