@redacto.io/consent-sdk-react 3.4.0 → 4.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/.turbo/turbo-build.log +21 -0
- package/CHANGELOG.md +12 -0
- package/dist/index.d.mts +49 -2
- package/dist/index.d.ts +49 -2
- package/dist/index.js +1806 -345
- package/dist/index.mjs +1805 -345
- package/package.json +1 -1
- package/src/RedactoNoticeConsent/RedactoNoticeConsent.test.tsx +201 -118
- package/src/RedactoNoticeConsent/RedactoNoticeConsent.tsx +1192 -93
- package/src/RedactoNoticeConsent/api/index.ts +335 -246
- package/src/RedactoNoticeConsent/api/types.ts +138 -41
- package/src/RedactoNoticeConsent/components/DigiLockerCallback.tsx +536 -0
- package/src/RedactoNoticeConsent/components/index.ts +7 -0
- package/src/RedactoNoticeConsent/injectStyles.ts +11 -0
- package/src/RedactoNoticeConsent/services/storage.ts +122 -0
- package/src/RedactoNoticeConsent/types.ts +2 -0
- package/src/RedactoNoticeConsentInline/api/index.ts +26 -64
- package/src/RedactoNoticeConsentInline/api/types.ts +0 -25
- package/src/index.ts +10 -0
- package/src/utils/isLegacyApi.ts +0 -12
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
> @redacto.io/consent-sdk-react@3.5.0 build /Users/abhishekashyap/Documents/consent-sdk/packages/consent-sdk-react
|
|
4
|
+
> tsup
|
|
5
|
+
|
|
6
|
+
[34mCLI[39m Building entry: {"index":"src/index.ts"}
|
|
7
|
+
[34mCLI[39m Using tsconfig: tsconfig.json
|
|
8
|
+
[34mCLI[39m tsup v8.5.1
|
|
9
|
+
[34mCLI[39m Using tsup config: /Users/abhishekashyap/Documents/consent-sdk/packages/consent-sdk-react/tsup.config.ts
|
|
10
|
+
[34mCLI[39m Target: es2019
|
|
11
|
+
[34mCLI[39m Cleaning output folder
|
|
12
|
+
[34mESM[39m Build start
|
|
13
|
+
[34mCJS[39m Build start
|
|
14
|
+
[32mESM[39m [1mdist/index.mjs [22m[32m165.70 KB[39m
|
|
15
|
+
[32mESM[39m ⚡️ Build success in 66ms
|
|
16
|
+
[32mCJS[39m [1mdist/index.js [22m[32m172.18 KB[39m
|
|
17
|
+
[32mCJS[39m ⚡️ Build success in 68ms
|
|
18
|
+
DTS Build start
|
|
19
|
+
DTS ⚡️ Build success in 819ms
|
|
20
|
+
DTS dist/index.d.mts 2.92 KB
|
|
21
|
+
DTS dist/index.d.ts 2.92 KB
|
package/CHANGELOG.md
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import * as react from 'react';
|
|
3
|
+
import react__default from 'react';
|
|
3
4
|
|
|
4
5
|
type Settings$1 = {
|
|
5
6
|
button: {
|
|
@@ -26,6 +27,20 @@ type Settings$1 = {
|
|
|
26
27
|
borderColor?: string;
|
|
27
28
|
font?: string;
|
|
28
29
|
};
|
|
30
|
+
/**
|
|
31
|
+
* Error codes from guardian verification
|
|
32
|
+
*/
|
|
33
|
+
type GuardianVerificationErrorCode = "SESSION_EXPIRED" | "GUARDIAN_UNDER_18" | "TOKEN_FAILED" | "DIGILOCKER_AUTH_FAILED" | "NO_AUTH_CODE";
|
|
34
|
+
type ConsentFlowState = "age-check" | "guardian-details" | "digilocker-pending" | "consent-form" | "submitting" | "success" | "error";
|
|
35
|
+
/**
|
|
36
|
+
* Props for DigiLockerCallback component
|
|
37
|
+
*/
|
|
38
|
+
type DigiLockerCallbackProps = {
|
|
39
|
+
accessToken: string;
|
|
40
|
+
baseUrl?: string;
|
|
41
|
+
onSuccess?: (verificationReference: string) => void;
|
|
42
|
+
onError?: (error: Error, errorCode?: GuardianVerificationErrorCode) => void;
|
|
43
|
+
};
|
|
29
44
|
|
|
30
45
|
type Props$1 = Readonly<{
|
|
31
46
|
noticeId: string;
|
|
@@ -40,6 +55,8 @@ type Props$1 = Readonly<{
|
|
|
40
55
|
onError?: (error: Error) => void;
|
|
41
56
|
applicationId?: string;
|
|
42
57
|
validateAgainst?: "all" | "required";
|
|
58
|
+
digilockerMode?: "popup" | "redirect";
|
|
59
|
+
digilockerCallbackUrl?: string;
|
|
43
60
|
includeFullyConsentedData?: boolean;
|
|
44
61
|
reviewModeButtonText?: string;
|
|
45
62
|
}>;
|
|
@@ -51,7 +68,7 @@ type Props$1 = Readonly<{
|
|
|
51
68
|
* to view and manage their consent preferences. Supports both initial consent
|
|
52
69
|
* collection and reconsent flows.
|
|
53
70
|
*/
|
|
54
|
-
declare const RedactoNoticeConsent: ({ noticeId, accessToken, refreshToken, baseUrl, language, blockUI, onAccept, onDecline, onError, settings, applicationId, validateAgainst, includeFullyConsentedData, reviewModeButtonText, }: Props$1) => react_jsx_runtime.JSX.Element;
|
|
71
|
+
declare const RedactoNoticeConsent: ({ noticeId, accessToken, refreshToken, baseUrl, language, blockUI, onAccept, onDecline, onError, settings, applicationId, validateAgainst, digilockerMode, digilockerCallbackUrl, includeFullyConsentedData, reviewModeButtonText, }: Props$1) => react_jsx_runtime.JSX.Element;
|
|
55
72
|
|
|
56
73
|
type Settings = {
|
|
57
74
|
button: {
|
|
@@ -99,4 +116,34 @@ declare const RedactoConsentInline: react.MemoExoticComponent<{
|
|
|
99
116
|
displayName: string;
|
|
100
117
|
}>;
|
|
101
118
|
|
|
102
|
-
|
|
119
|
+
/**
|
|
120
|
+
* DigiLockerCallback Component
|
|
121
|
+
*
|
|
122
|
+
* Standalone component for handling DigiLocker redirect callbacks.
|
|
123
|
+
* Clients should add this to their routing (e.g., /digilocker-callback page).
|
|
124
|
+
*
|
|
125
|
+
* Usage in Next.js:
|
|
126
|
+
* ```tsx
|
|
127
|
+
* // pages/digilocker-callback.tsx
|
|
128
|
+
* import { DigiLockerCallback } from '@redacto.io/consent-sdk-react';
|
|
129
|
+
*
|
|
130
|
+
* export default function DigiLockerCallbackPage() {
|
|
131
|
+
* return <DigiLockerCallback accessToken={"<token>"} />;
|
|
132
|
+
* }
|
|
133
|
+
* ```
|
|
134
|
+
*
|
|
135
|
+
* Usage in React Router:
|
|
136
|
+
* ```tsx
|
|
137
|
+
* <Route path="/digilocker-callback" element={<DigiLockerCallback accessToken={"<token>"} />} />
|
|
138
|
+
* ```
|
|
139
|
+
*
|
|
140
|
+
* URL Parameters expected from redirect:
|
|
141
|
+
* - session_token: The verification session token
|
|
142
|
+
* - status: "verified" | "failed" | "expired"
|
|
143
|
+
* - verification_reference: (if verified) Reference for consent submission
|
|
144
|
+
* - error_code: (if failed) Error code like GUARDIAN_UNDER_18, SESSION_EXPIRED, etc.
|
|
145
|
+
*/
|
|
146
|
+
|
|
147
|
+
declare const DigiLockerCallback: react__default.FC<DigiLockerCallbackProps>;
|
|
148
|
+
|
|
149
|
+
export { type ConsentFlowState, DigiLockerCallback, type DigiLockerCallbackProps, type GuardianVerificationErrorCode, RedactoNoticeConsent, RedactoConsentInline as RedactoNoticeConsentInline };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import * as react from 'react';
|
|
3
|
+
import react__default from 'react';
|
|
3
4
|
|
|
4
5
|
type Settings$1 = {
|
|
5
6
|
button: {
|
|
@@ -26,6 +27,20 @@ type Settings$1 = {
|
|
|
26
27
|
borderColor?: string;
|
|
27
28
|
font?: string;
|
|
28
29
|
};
|
|
30
|
+
/**
|
|
31
|
+
* Error codes from guardian verification
|
|
32
|
+
*/
|
|
33
|
+
type GuardianVerificationErrorCode = "SESSION_EXPIRED" | "GUARDIAN_UNDER_18" | "TOKEN_FAILED" | "DIGILOCKER_AUTH_FAILED" | "NO_AUTH_CODE";
|
|
34
|
+
type ConsentFlowState = "age-check" | "guardian-details" | "digilocker-pending" | "consent-form" | "submitting" | "success" | "error";
|
|
35
|
+
/**
|
|
36
|
+
* Props for DigiLockerCallback component
|
|
37
|
+
*/
|
|
38
|
+
type DigiLockerCallbackProps = {
|
|
39
|
+
accessToken: string;
|
|
40
|
+
baseUrl?: string;
|
|
41
|
+
onSuccess?: (verificationReference: string) => void;
|
|
42
|
+
onError?: (error: Error, errorCode?: GuardianVerificationErrorCode) => void;
|
|
43
|
+
};
|
|
29
44
|
|
|
30
45
|
type Props$1 = Readonly<{
|
|
31
46
|
noticeId: string;
|
|
@@ -40,6 +55,8 @@ type Props$1 = Readonly<{
|
|
|
40
55
|
onError?: (error: Error) => void;
|
|
41
56
|
applicationId?: string;
|
|
42
57
|
validateAgainst?: "all" | "required";
|
|
58
|
+
digilockerMode?: "popup" | "redirect";
|
|
59
|
+
digilockerCallbackUrl?: string;
|
|
43
60
|
includeFullyConsentedData?: boolean;
|
|
44
61
|
reviewModeButtonText?: string;
|
|
45
62
|
}>;
|
|
@@ -51,7 +68,7 @@ type Props$1 = Readonly<{
|
|
|
51
68
|
* to view and manage their consent preferences. Supports both initial consent
|
|
52
69
|
* collection and reconsent flows.
|
|
53
70
|
*/
|
|
54
|
-
declare const RedactoNoticeConsent: ({ noticeId, accessToken, refreshToken, baseUrl, language, blockUI, onAccept, onDecline, onError, settings, applicationId, validateAgainst, includeFullyConsentedData, reviewModeButtonText, }: Props$1) => react_jsx_runtime.JSX.Element;
|
|
71
|
+
declare const RedactoNoticeConsent: ({ noticeId, accessToken, refreshToken, baseUrl, language, blockUI, onAccept, onDecline, onError, settings, applicationId, validateAgainst, digilockerMode, digilockerCallbackUrl, includeFullyConsentedData, reviewModeButtonText, }: Props$1) => react_jsx_runtime.JSX.Element;
|
|
55
72
|
|
|
56
73
|
type Settings = {
|
|
57
74
|
button: {
|
|
@@ -99,4 +116,34 @@ declare const RedactoConsentInline: react.MemoExoticComponent<{
|
|
|
99
116
|
displayName: string;
|
|
100
117
|
}>;
|
|
101
118
|
|
|
102
|
-
|
|
119
|
+
/**
|
|
120
|
+
* DigiLockerCallback Component
|
|
121
|
+
*
|
|
122
|
+
* Standalone component for handling DigiLocker redirect callbacks.
|
|
123
|
+
* Clients should add this to their routing (e.g., /digilocker-callback page).
|
|
124
|
+
*
|
|
125
|
+
* Usage in Next.js:
|
|
126
|
+
* ```tsx
|
|
127
|
+
* // pages/digilocker-callback.tsx
|
|
128
|
+
* import { DigiLockerCallback } from '@redacto.io/consent-sdk-react';
|
|
129
|
+
*
|
|
130
|
+
* export default function DigiLockerCallbackPage() {
|
|
131
|
+
* return <DigiLockerCallback accessToken={"<token>"} />;
|
|
132
|
+
* }
|
|
133
|
+
* ```
|
|
134
|
+
*
|
|
135
|
+
* Usage in React Router:
|
|
136
|
+
* ```tsx
|
|
137
|
+
* <Route path="/digilocker-callback" element={<DigiLockerCallback accessToken={"<token>"} />} />
|
|
138
|
+
* ```
|
|
139
|
+
*
|
|
140
|
+
* URL Parameters expected from redirect:
|
|
141
|
+
* - session_token: The verification session token
|
|
142
|
+
* - status: "verified" | "failed" | "expired"
|
|
143
|
+
* - verification_reference: (if verified) Reference for consent submission
|
|
144
|
+
* - error_code: (if failed) Error code like GUARDIAN_UNDER_18, SESSION_EXPIRED, etc.
|
|
145
|
+
*/
|
|
146
|
+
|
|
147
|
+
declare const DigiLockerCallback: react__default.FC<DigiLockerCallbackProps>;
|
|
148
|
+
|
|
149
|
+
export { type ConsentFlowState, DigiLockerCallback, type DigiLockerCallbackProps, type GuardianVerificationErrorCode, RedactoNoticeConsent, RedactoConsentInline as RedactoNoticeConsentInline };
|