@redacto.io/privacy-center-sdk 1.1.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 (105) hide show
  1. package/.turbo/turbo-build.log +23 -0
  2. package/CHANGELOG.md +7 -0
  3. package/README.md +273 -0
  4. package/dist/index.css +8 -0
  5. package/dist/index.d.mts +17 -0
  6. package/dist/index.d.ts +17 -0
  7. package/dist/index.js +6912 -0
  8. package/dist/index.mjs +6911 -0
  9. package/locales/as/translation.json +70 -0
  10. package/locales/bho/translation.json +70 -0
  11. package/locales/doi/translation.json +71 -0
  12. package/locales/en/translation.json +70 -0
  13. package/locales/gom/translation.json +70 -0
  14. package/locales/gu/translation.json +70 -0
  15. package/locales/hi/translation.json +70 -0
  16. package/locales/kn/translation.json +70 -0
  17. package/locales/mai/translation.json +70 -0
  18. package/locales/ml/translation.json +70 -0
  19. package/locales/mni-Mtei/translation.json +70 -0
  20. package/locales/mr/translation.json +70 -0
  21. package/locales/ne/translation.json +70 -0
  22. package/locales/or/translation.json +70 -0
  23. package/locales/pa/translation.json +70 -0
  24. package/locales/sa/translation.json +70 -0
  25. package/locales/sd/translation.json +70 -0
  26. package/locales/ta/translation.json +70 -0
  27. package/locales/te/translation.json +70 -0
  28. package/locales/ur/translation.json +70 -0
  29. package/package.json +52 -0
  30. package/src/PrivacyCenterActivityPage.tsx +28 -0
  31. package/src/PrivacyCenterConsentManagerPage.tsx +28 -0
  32. package/src/PrivacyCenterFormPage.tsx +52 -0
  33. package/src/PrivacyCenterHomePage.tsx +27 -0
  34. package/src/PrivacyCenterLayout.tsx +134 -0
  35. package/src/RedactoPrivacyCenter.tsx +50 -0
  36. package/src/api/actions.ts +424 -0
  37. package/src/api/client.ts +414 -0
  38. package/src/api/config.ts +33 -0
  39. package/src/api/fetcher.ts +181 -0
  40. package/src/api/upload.ts +70 -0
  41. package/src/assets/character.svg +31 -0
  42. package/src/assets/fileAttach.svg +9 -0
  43. package/src/assets/greenTick.svg +4 -0
  44. package/src/assets/mail.svg +3 -0
  45. package/src/assets/poweredByRedacto.svg +9 -0
  46. package/src/assets/sentImg.svg +9 -0
  47. package/src/assets/uploadFileIcon.svg +9 -0
  48. package/src/components/ActivitiesList.tsx +107 -0
  49. package/src/components/CaseDetailsModal.tsx +134 -0
  50. package/src/components/CaseHistory.tsx +353 -0
  51. package/src/components/ConsentManager.tsx +372 -0
  52. package/src/components/ConsentManagerColumns.tsx +199 -0
  53. package/src/components/ConsentManagerConstants.ts +7 -0
  54. package/src/components/ConsentManagerTableSkeleton.tsx +67 -0
  55. package/src/components/DataRequest/CorrectionDataSection.tsx +138 -0
  56. package/src/components/DataRequest/GrievanceDataSection.tsx +98 -0
  57. package/src/components/DataRequest/PurposeSelectionSection.tsx +229 -0
  58. package/src/components/Form.tsx +1184 -0
  59. package/src/components/ModifyConsentModal.tsx +92 -0
  60. package/src/components/Pagination.tsx +111 -0
  61. package/src/components/PrivacyCenterLayout.tsx +36 -0
  62. package/src/components/RequestSubmit.tsx +84 -0
  63. package/src/components/SideMenuBarPC/SideBarPC.tsx +243 -0
  64. package/src/components/SideMenuBarPC/SideMenuPC.tsx +252 -0
  65. package/src/components/SideMenuBarPC/constants.tsx +42 -0
  66. package/src/components/SideMenuBarPC/menuItemsPC.tsx +1 -0
  67. package/src/components/SideMenuBarPC/types.ts +39 -0
  68. package/src/components/SideMenuBarPC/utils.ts +23 -0
  69. package/src/components/activitiesColumns.tsx +119 -0
  70. package/src/components/constant.ts +13 -0
  71. package/src/components/types.ts +63 -0
  72. package/src/components/utils.tsx +10 -0
  73. package/src/config/routes.ts +9 -0
  74. package/src/config/table.ts +25 -0
  75. package/src/context/AuthContext.tsx +82 -0
  76. package/src/context/BaseUrlContext.tsx +48 -0
  77. package/src/context/LocaleContext.tsx +11 -0
  78. package/src/context/NavigationContext.tsx +38 -0
  79. package/src/context/OrganizationContext.tsx +30 -0
  80. package/src/context/theme.tsx +106 -0
  81. package/src/index.ts +4 -0
  82. package/src/index.tsx +6 -0
  83. package/src/lib/api.ts +516 -0
  84. package/src/lib/consent-manager/utils.tsx +55 -0
  85. package/src/lib/constants.ts +62 -0
  86. package/src/lib/i18n.ts +39 -0
  87. package/src/lib/locales.ts +58 -0
  88. package/src/lib/queries.ts +28 -0
  89. package/src/lib/types.ts +309 -0
  90. package/src/lib/utils.ts +582 -0
  91. package/src/styles.css +9 -0
  92. package/src/table/AdvancedTable.tsx +266 -0
  93. package/src/table/AdvancedTablePagination.tsx +125 -0
  94. package/src/table/index.ts +2 -0
  95. package/src/types/images.d.ts +29 -0
  96. package/src/ui/Footer.tsx +13 -0
  97. package/src/ui/FormBlockWrapper.tsx +39 -0
  98. package/src/ui/SimpleBar.tsx +19 -0
  99. package/src/ui/StatusBadge.tsx +84 -0
  100. package/src/ui/ThemeToggle.tsx +30 -0
  101. package/src/utils/cn.ts +6 -0
  102. package/src/utils/date.ts +48 -0
  103. package/src/utils/status.ts +111 -0
  104. package/tsconfig.json +19 -0
  105. package/tsup.config.ts +37 -0
@@ -0,0 +1,23 @@
1
+
2
+ 
3
+ > @redacto.io/privacy-center-sdk@1.1.0 build /Users/abhishekashyap/Documents/consent-sdk/packages/privacy-center-sdk
4
+ > tsup
5
+
6
+ CLI Building entry: {"index":"src/index.ts"}
7
+ CLI Using tsconfig: tsconfig.json
8
+ CLI tsup v8.5.1
9
+ CLI Using tsup config: /Users/abhishekashyap/Documents/consent-sdk/packages/privacy-center-sdk/tsup.config.ts
10
+ CLI Target: es2019
11
+ CLI Cleaning output folder
12
+ ESM Build start
13
+ CJS Build start
14
+ ESM dist/index.css 205.00 B
15
+ ESM dist/index.mjs 891.90 KB
16
+ ESM ⚡️ Build success in 39ms
17
+ CJS dist/index.css 205.00 B
18
+ CJS dist/index.js 912.72 KB
19
+ CJS ⚡️ Build success in 39ms
20
+ DTS Build start
21
+ DTS ⚡️ Build success in 1114ms
22
+ DTS dist/index.d.mts 618.00 B
23
+ DTS dist/index.d.ts 618.00 B
package/CHANGELOG.md ADDED
@@ -0,0 +1,7 @@
1
+ # @redacto.io/privacy-center-sdk
2
+
3
+ ## 1.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - initial release
package/README.md ADDED
@@ -0,0 +1,273 @@
1
+ # @redacto.io/privacy-center-sdk
2
+
3
+ A standalone Privacy Center SDK for Redacto that provides a comprehensive React component library for building privacy centers with consent management, data request forms, and activity tracking.
4
+
5
+ ## Overview
6
+
7
+ The Redacto Privacy Center SDK enables developers to easily integrate a complete privacy center into their React applications. It provides users with a self-service portal to manage their consents, submit data subject access requests (DSAR), and track their privacy-related activities while maintaining compliance with privacy regulations like GDPR, CCPA, and others.
8
+
9
+ ## Features
10
+
11
+ - **Consent Manager**: View, search, filter, and revoke user consents with a comprehensive table interface
12
+ - **Data Request Forms**: Submit DSAR requests including:
13
+ - Access requests
14
+ - Data correction requests
15
+ - Data erasure requests
16
+ - Grievance/complaint submissions
17
+ - **Activity History**: Track privacy center activities and events with detailed timestamps
18
+ - **Case Management**: View and manage data request cases with status tracking
19
+ - **Multi-language Support**: 20+ languages including Indian regional languages with automatic language detection
20
+ - **Theme Support**: Light and dark mode with customizable themes
21
+ - **Authentication**: JWT-based authentication with automatic token refresh
22
+ - **Responsive Design**: Mobile-first responsive design that works across all devices
23
+
24
+ ## Installation
25
+
26
+ ```bash
27
+ # Using npm
28
+ npm install @redacto.io/privacy-center-sdk
29
+
30
+ # Using pnpm
31
+ pnpm add @redacto.io/privacy-center-sdk
32
+
33
+ # Using yarn
34
+ yarn add @redacto.io/privacy-center-sdk
35
+ ```
36
+
37
+ ### Peer Dependencies
38
+
39
+ This package requires React to be installed in your project:
40
+
41
+ ```bash
42
+ npm install react
43
+ ```
44
+
45
+ See the [Peer Dependencies](#peer-dependencies) section for specific version requirements.
46
+
47
+ ## Quick Start
48
+
49
+ ```tsx
50
+ import { RedactoPrivacyCenter } from '@redacto.io/privacy-center-sdk';
51
+
52
+ function App() {
53
+ const handleError = (error: Error): boolean => {
54
+ console.error('Privacy Center Error:', error);
55
+ // Return true to allow default error handling (signout/redirect)
56
+ // Return false to prevent default handling and let parent handle it
57
+ return true;
58
+ };
59
+
60
+ return (
61
+ <RedactoPrivacyCenter
62
+ baseUrl="https://api.redacto.io"
63
+ slug="your-organization-slug"
64
+ theme="light"
65
+ accessToken="your-access-token"
66
+ refreshToken="your-refresh-token"
67
+ onError={handleError}
68
+ />
69
+ );
70
+ }
71
+ ```
72
+
73
+ ## API Reference
74
+
75
+ ### `RedactoPrivacyCenter`
76
+
77
+ The main component that renders the complete privacy center interface.
78
+
79
+ #### Props
80
+
81
+ | Prop | Type | Required | Default | Description |
82
+ |------|------|----------|---------|-------------|
83
+ | `baseUrl` | `string` | Yes | - | Consent server base URL (e.g., `https://api.redacto.io`) |
84
+ | `slug` | `string` | Yes | - | Organization slug identifier |
85
+ | `theme` | `'light' \| 'dark'` | No | `'light'` | Theme mode for the privacy center |
86
+ | `accessToken` | `string` | Yes | - | JWT access token for API authentication |
87
+ | `refreshToken` | `string` | Yes | - | JWT refresh token for token renewal |
88
+ | `onError` | `(error: Error) => boolean` | Yes | - | Error handler callback. Return `true` to allow default error handling, `false` to handle errors manually |
89
+ | `initialPage` | `'consent-manager' \| 'form' \| 'activity'` | No | `'consent-manager'` | Initial page to display when the component mounts |
90
+ | `onBack` | `'back' \| 'signout'` | No | - | Behavior for the back button. `'back'` navigates to previous page, `'signout'` signs out the user |
91
+
92
+ #### Example
93
+
94
+ ```tsx
95
+ <RedactoPrivacyCenter
96
+ baseUrl={process.env.REACT_APP_CONSENT_SERVER_URL}
97
+ slug="acme-corp"
98
+ theme="dark"
99
+ accessToken={accessToken}
100
+ refreshToken={refreshToken}
101
+ onError={(error) => {
102
+ console.error(error);
103
+ // Handle error (e.g., redirect to login)
104
+ return true;
105
+ }}
106
+ initialPage="consent-manager"
107
+ onBack="signout"
108
+ />
109
+ ```
110
+
111
+ ## Exports
112
+
113
+ The SDK exports the following components and types:
114
+
115
+ ### Components
116
+
117
+ - **`RedactoPrivacyCenter`** - Main component that renders the complete privacy center
118
+ - **`PrivacyCenterLayout`** - Layout wrapper component with sidebar navigation
119
+ - **`PrivacyCenterHomePage`** - Home page component that handles internal routing
120
+ - **`PrivacyCenterConsentManagerPage`** - Consent manager page component
121
+ - **`PrivacyCenterFormPage`** - Data request form page component
122
+ - **`PrivacyCenterActivityPage`** - Activity history page component
123
+
124
+ ### Types
125
+
126
+ - **`InternalPage`** - Type for internal page navigation: `'consent-manager' | 'form' | 'activity'`
127
+
128
+ ### Usage Example with Individual Components
129
+
130
+ ```tsx
131
+ import {
132
+ PrivacyCenterLayout,
133
+ PrivacyCenterConsentManagerPage,
134
+ PrivacyCenterFormPage,
135
+ PrivacyCenterActivityPage,
136
+ } from '@redacto.io/privacy-center-sdk';
137
+
138
+ // Use individual components for custom layouts
139
+ function CustomPrivacyCenter() {
140
+ return (
141
+ <PrivacyCenterLayout slug="acme-corp" theme="light">
142
+ <PrivacyCenterConsentManagerPage />
143
+ </PrivacyCenterLayout>
144
+ );
145
+ }
146
+ ```
147
+
148
+ ## Supported Languages
149
+
150
+ The SDK supports 20+ languages with automatic language detection:
151
+
152
+ - **English** (en)
153
+ - **Hindi** (hi)
154
+ - **Assamese** (as)
155
+ - **Bhojpuri** (bho)
156
+ - **Dogri** (doi)
157
+ - **Konkani** (gom)
158
+ - **Gujarati** (gu)
159
+ - **Kannada** (kn)
160
+ - **Maithili** (mai)
161
+ - **Malayalam** (ml)
162
+ - **Manipuri** (mni-Mtei)
163
+ - **Marathi** (mr)
164
+ - **Nepali** (ne)
165
+ - **Odia** (or)
166
+ - **Punjabi** (pa)
167
+ - **Sanskrit** (sa)
168
+ - **Sindhi** (sd)
169
+ - **Tamil** (ta)
170
+ - **Telugu** (te)
171
+ - **Urdu** (ur)
172
+
173
+ The SDK automatically detects the user's browser language and uses the appropriate translation. Language preferences are stored in localStorage and persist across sessions.
174
+
175
+ ## Architecture
176
+
177
+ The SDK is built with a modular architecture using React Context API for state management:
178
+
179
+ ### Context Providers
180
+
181
+ - **`AuthProvider`**: Manages authentication tokens (access and refresh tokens)
182
+ - **`BaseUrlProvider`**: Provides API base URLs for consent server and user server
183
+ - **`NavigationProvider`**: Handles internal navigation between pages
184
+ - **`OrganizationContext`**: Manages organization and workspace data
185
+ - **`LocaleContext`**: Handles language and locale settings
186
+
187
+ ### Component Hierarchy
188
+
189
+ ```
190
+ RedactoPrivacyCenter
191
+ ├── BaseUrlProvider
192
+ │ └── AuthProvider
193
+ │ └── NavigationProvider
194
+ │ └── PrivacyCenterLayout
195
+ │ └── PrivacyCenterHomePage
196
+ │ ├── PrivacyCenterConsentManagerPage
197
+ │ ├── PrivacyCenterFormPage
198
+ │ └── PrivacyCenterActivityPage
199
+ ```
200
+
201
+ ### API Client
202
+
203
+ The SDK includes a built-in API client (`createConsentClient`) that handles:
204
+ - JWT token authentication with Bearer tokens
205
+ - Automatic error handling and retries
206
+ - Token refresh on expiration
207
+ - Request/response transformation
208
+
209
+ ## Peer Dependencies
210
+
211
+ The following peer dependency is required:
212
+
213
+ | Package | Version | Description |
214
+ |---------|---------|-------------|
215
+ | `react` | `^16.8.0 \|\| ^17 \|\| ^18 \|\| ^19` | React library |
216
+
217
+ ### Included Dependencies
218
+
219
+ The SDK includes the following dependencies (bundled with the package):
220
+
221
+ - `@tanstack/react-query`: Data fetching and caching
222
+ - `@tanstack/react-table`: Table component library
223
+ - `i18next`: Internationalization framework
224
+ - `react-i18next`: React bindings for i18next
225
+ - `rizzui`: UI component library
226
+ - `react-toastify`: Toast notification library
227
+ - `react-icons`: Icon library
228
+ - `clsx`: Utility for constructing className strings
229
+ - `simplebar-react`: Custom scrollbar component
230
+ - `nprogress`: Progress bar library
231
+ - `dayjs`: Date manipulation library
232
+ - `lodash`: Utility functions
233
+ - `tailwind-merge`: Tailwind CSS class merging utility
234
+
235
+ ## Development
236
+
237
+ ### Building the Package
238
+
239
+ ```bash
240
+ # Build the package
241
+ pnpm run build
242
+
243
+ # Build in watch mode
244
+ pnpm run dev
245
+ ```
246
+
247
+ ### Project Structure
248
+
249
+ ```
250
+ privacy-center-sdk/
251
+ ├── src/
252
+ │ ├── api/ # API client and utilities
253
+ │ ├── components/ # React components
254
+ │ ├── context/ # React context providers
255
+ │ ├── lib/ # Utility functions and types
256
+ │ ├── locales/ # Translation files
257
+ │ ├── ui/ # UI components
258
+ │ └── utils/ # Helper utilities
259
+ ├── locales/ # Language translation files
260
+ └── package.json
261
+ ```
262
+
263
+ ### TypeScript Support
264
+
265
+ The package includes full TypeScript support with type definitions. All components and utilities are fully typed.
266
+
267
+ ## License
268
+
269
+ Apache-2.0
270
+
271
+ ## Support
272
+
273
+ For issues, questions, or contributions, please refer to the main project repository.
package/dist/index.css ADDED
@@ -0,0 +1,8 @@
1
+ @import "rizzui/styles.css";
2
+ @import "react-toastify/dist/ReactToastify.css";
3
+ @import "simplebar-react/dist/simplebar.min.css";
4
+
5
+ /* src/styles.css */
6
+ .rizzui-select-options {
7
+ z-index: 9999 !important;
8
+ }
@@ -0,0 +1,17 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+
3
+ type InternalPage = 'consent-manager' | 'form' | 'activity';
4
+
5
+ interface RedactoPrivacyCenterProps {
6
+ baseUrl: string;
7
+ slug: string;
8
+ theme?: 'light' | 'dark';
9
+ accessToken: string;
10
+ refreshToken: string;
11
+ onError: (error: Error) => boolean;
12
+ initialPage?: InternalPage;
13
+ onBack?: 'back' | 'signout';
14
+ }
15
+ declare function RedactoPrivacyCenter({ baseUrl, slug, theme, accessToken, refreshToken, onError, initialPage, onBack, }: RedactoPrivacyCenterProps): react_jsx_runtime.JSX.Element;
16
+
17
+ export { type InternalPage, RedactoPrivacyCenter };
@@ -0,0 +1,17 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+
3
+ type InternalPage = 'consent-manager' | 'form' | 'activity';
4
+
5
+ interface RedactoPrivacyCenterProps {
6
+ baseUrl: string;
7
+ slug: string;
8
+ theme?: 'light' | 'dark';
9
+ accessToken: string;
10
+ refreshToken: string;
11
+ onError: (error: Error) => boolean;
12
+ initialPage?: InternalPage;
13
+ onBack?: 'back' | 'signout';
14
+ }
15
+ declare function RedactoPrivacyCenter({ baseUrl, slug, theme, accessToken, refreshToken, onError, initialPage, onBack, }: RedactoPrivacyCenterProps): react_jsx_runtime.JSX.Element;
16
+
17
+ export { type InternalPage, RedactoPrivacyCenter };