@tantainnovative/ndpr-toolkit 1.0.5 → 1.0.7
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 +88 -14
- package/dist/components/breach-notification/BreachNotificationForm.d.ts +18 -0
- package/dist/components/breach-notification/BreachNotificationForm.d.ts.map +1 -0
- package/dist/components/consent/ConsentBanner.d.ts +30 -0
- package/dist/components/consent/ConsentBanner.d.ts.map +1 -0
- package/dist/components/consent/ConsentManager.d.ts +51 -0
- package/dist/components/consent/ConsentManager.d.ts.map +1 -0
- package/dist/components/consent/ConsentSettings.d.ts +15 -0
- package/dist/components/consent/ConsentSettings.d.ts.map +1 -0
- package/dist/components/consent/unstyled/UnstyledConsentBanner.d.ts +7 -0
- package/dist/components/consent/unstyled/UnstyledConsentBanner.d.ts.map +1 -0
- package/dist/components/consent/unstyled/UnstyledConsentSettings.d.ts +7 -0
- package/dist/components/consent/unstyled/UnstyledConsentSettings.d.ts.map +1 -0
- package/dist/components/consent/unstyled/UnstyledConsentToggle.d.ts +8 -0
- package/dist/components/consent/unstyled/UnstyledConsentToggle.d.ts.map +1 -0
- package/dist/components/consent/unstyled/index.d.ts +4 -0
- package/dist/components/consent/unstyled/index.d.ts.map +1 -0
- package/dist/components/data-subject-rights/DataSubjectRequestForm.d.ts +14 -0
- package/dist/components/data-subject-rights/DataSubjectRequestForm.d.ts.map +1 -0
- package/dist/components/docs/DocLayout.d.ts +9 -0
- package/dist/components/docs/DocLayout.d.ts.map +1 -0
- package/dist/components/docs/index.d.ts +2 -0
- package/dist/components/docs/index.d.ts.map +1 -0
- package/dist/components/dpia/DPIAQuestionnaire.d.ts +9 -0
- package/dist/components/dpia/DPIAQuestionnaire.d.ts.map +1 -0
- package/dist/components/privacy-policy/PolicyGenerator.d.ts +12 -0
- package/dist/components/privacy-policy/PolicyGenerator.d.ts.map +1 -0
- package/dist/components/privacy-policy/data.d.ts +8 -0
- package/dist/components/privacy-policy/data.d.ts.map +1 -0
- package/dist/components/privacy-policy/shared/CheckboxField.d.ts +13 -0
- package/dist/components/privacy-policy/shared/CheckboxField.d.ts.map +1 -0
- package/dist/components/privacy-policy/shared/CheckboxGroup.d.ts +13 -0
- package/dist/components/privacy-policy/shared/CheckboxGroup.d.ts.map +1 -0
- package/dist/components/privacy-policy/shared/FormField.d.ts +13 -0
- package/dist/components/privacy-policy/shared/FormField.d.ts.map +1 -0
- package/dist/components/privacy-policy/shared/StepIndicator.d.ts +8 -0
- package/dist/components/privacy-policy/shared/StepIndicator.d.ts.map +1 -0
- package/dist/components/privacy-policy/steps/CustomSectionsStep.d.ts +15 -0
- package/dist/components/privacy-policy/steps/CustomSectionsStep.d.ts.map +1 -0
- package/dist/components/privacy-policy/steps/DataCollectionStep.d.ts +20 -0
- package/dist/components/privacy-policy/steps/DataCollectionStep.d.ts.map +1 -0
- package/dist/components/privacy-policy/steps/DataSharingStep.d.ts +34 -0
- package/dist/components/privacy-policy/steps/DataSharingStep.d.ts.map +1 -0
- package/dist/components/privacy-policy/steps/OrganizationInfoStep.d.ts +17 -0
- package/dist/components/privacy-policy/steps/OrganizationInfoStep.d.ts.map +1 -0
- package/dist/components/privacy-policy/steps/PolicyPreviewStep.d.ts +30 -0
- package/dist/components/privacy-policy/steps/PolicyPreviewStep.d.ts.map +1 -0
- package/dist/components/ui/Badge.d.ts +10 -0
- package/dist/components/ui/Badge.d.ts.map +1 -0
- package/dist/components/ui/Button.d.ts +11 -0
- package/dist/components/ui/Button.d.ts.map +1 -0
- package/dist/components/ui/Card.d.ts +10 -0
- package/dist/components/ui/Card.d.ts.map +1 -0
- package/dist/components/ui/Checkbox.d.ts +8 -0
- package/dist/components/ui/Checkbox.d.ts.map +1 -0
- package/dist/components/ui/FormField.d.ts +11 -0
- package/dist/components/ui/FormField.d.ts.map +1 -0
- package/dist/components/ui/Input.d.ts +6 -0
- package/dist/components/ui/Input.d.ts.map +1 -0
- package/dist/components/ui/Select.d.ts +6 -0
- package/dist/components/ui/Select.d.ts.map +1 -0
- package/dist/components/ui/TextArea.d.ts +6 -0
- package/dist/components/ui/TextArea.d.ts.map +1 -0
- package/dist/components/ui/dialog.d.ts +18 -0
- package/dist/components/ui/dialog.d.ts.map +1 -0
- package/dist/components/ui/label.d.ts +5 -0
- package/dist/components/ui/label.d.ts.map +1 -0
- package/dist/components/ui/switch.d.ts +5 -0
- package/dist/components/ui/switch.d.ts.map +1 -0
- package/dist/components/ui/tabs.d.ts +8 -0
- package/dist/components/ui/tabs.d.ts.map +1 -0
- package/dist/contexts/ConsentContext.d.ts +35 -0
- package/dist/contexts/ConsentContext.d.ts.map +1 -0
- package/dist/contexts/GenericConsentContext.d.ts +11 -0
- package/dist/contexts/GenericConsentContext.d.ts.map +1 -0
- package/dist/hooks/useConsent.d.ts +12 -0
- package/dist/hooks/useConsent.d.ts.map +1 -0
- package/dist/hooks/useConsentActions.d.ts +12 -0
- package/dist/hooks/useConsentActions.d.ts.map +1 -0
- package/dist/hooks/useConsentManager.d.ts +14 -0
- package/dist/hooks/useConsentManager.d.ts.map +1 -0
- package/dist/hooks/useConsentState.d.ts +10 -0
- package/dist/hooks/useConsentState.d.ts.map +1 -0
- package/dist/index.d.mts +256 -0
- package/dist/index.d.ts +24 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +2 -0
- package/dist/index.mjs.map +1 -0
- package/dist/lib/consentService.d.ts +11 -0
- package/dist/lib/consentService.d.ts.map +1 -0
- package/dist/lib/dpiaQuestions.d.ts +3 -0
- package/dist/lib/dpiaQuestions.d.ts.map +1 -0
- package/dist/lib/requestService.d.ts +10 -0
- package/dist/lib/requestService.d.ts.map +1 -0
- package/dist/lib/utils.d.ts +3 -0
- package/dist/lib/utils.d.ts.map +1 -0
- package/dist/styles.css +38 -0
- package/dist/types/consent.d.ts +57 -0
- package/dist/types/consent.d.ts.map +1 -0
- package/dist/types/index.d.ts +91 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/unstyled.d.mts +22 -0
- package/dist/unstyled.d.ts +2 -0
- package/dist/unstyled.d.ts.map +1 -0
- package/dist/unstyled.js +2 -0
- package/dist/unstyled.js.map +1 -0
- package/dist/unstyled.mjs +2 -0
- package/dist/unstyled.mjs.map +1 -0
- package/package.json +33 -5
- package/CHANGELOG.md +0 -16
- package/CNAME +0 -1
- package/CONTRIBUTING.md +0 -87
- package/RELEASE-NOTES-v1.0.0.md +0 -140
- package/RELEASE-NOTES-v1.0.1.md +0 -69
- package/SECURITY.md +0 -21
- package/components.json +0 -21
- package/eslint.config.mjs +0 -16
- package/next-env.d.ts +0 -5
- package/next.config.js +0 -15
- package/next.config.ts +0 -62
- package/packages/ndpr-toolkit/README.md +0 -467
- package/packages/ndpr-toolkit/dist/components/breach/BreachNotificationManager.d.ts +0 -62
- package/packages/ndpr-toolkit/dist/components/breach/BreachReportForm.d.ts +0 -66
- package/packages/ndpr-toolkit/dist/components/breach/BreachRiskAssessment.d.ts +0 -50
- package/packages/ndpr-toolkit/dist/components/breach/RegulatoryReportGenerator.d.ts +0 -94
- package/packages/ndpr-toolkit/dist/components/consent/ConsentBanner.d.ts +0 -79
- package/packages/ndpr-toolkit/dist/components/consent/ConsentManager.d.ts +0 -73
- package/packages/ndpr-toolkit/dist/components/consent/ConsentStorage.d.ts +0 -41
- package/packages/ndpr-toolkit/dist/components/dpia/DPIAQuestionnaire.d.ts +0 -70
- package/packages/ndpr-toolkit/dist/components/dpia/DPIAReport.d.ts +0 -40
- package/packages/ndpr-toolkit/dist/components/dpia/StepIndicator.d.ts +0 -64
- package/packages/ndpr-toolkit/dist/components/dsr/DSRDashboard.d.ts +0 -58
- package/packages/ndpr-toolkit/dist/components/dsr/DSRRequestForm.d.ts +0 -74
- package/packages/ndpr-toolkit/dist/components/dsr/DSRTracker.d.ts +0 -56
- package/packages/ndpr-toolkit/dist/components/policy/PolicyExporter.d.ts +0 -65
- package/packages/ndpr-toolkit/dist/components/policy/PolicyGenerator.d.ts +0 -54
- package/packages/ndpr-toolkit/dist/components/policy/PolicyPreview.d.ts +0 -71
- package/packages/ndpr-toolkit/dist/hooks/useBreach.d.ts +0 -97
- package/packages/ndpr-toolkit/dist/hooks/useConsent.d.ts +0 -63
- package/packages/ndpr-toolkit/dist/hooks/useDPIA.d.ts +0 -92
- package/packages/ndpr-toolkit/dist/hooks/useDSR.d.ts +0 -72
- package/packages/ndpr-toolkit/dist/hooks/usePrivacyPolicy.d.ts +0 -87
- package/packages/ndpr-toolkit/dist/index.d.ts +0 -31
- package/packages/ndpr-toolkit/dist/index.esm.js +0 -2
- package/packages/ndpr-toolkit/dist/index.esm.js.map +0 -1
- package/packages/ndpr-toolkit/dist/index.js +0 -2
- package/packages/ndpr-toolkit/dist/index.js.map +0 -1
- package/packages/ndpr-toolkit/dist/setupTests.d.ts +0 -2
- package/packages/ndpr-toolkit/dist/types/breach.d.ts +0 -239
- package/packages/ndpr-toolkit/dist/types/consent.d.ts +0 -95
- package/packages/ndpr-toolkit/dist/types/dpia.d.ts +0 -196
- package/packages/ndpr-toolkit/dist/types/dsr.d.ts +0 -162
- package/packages/ndpr-toolkit/dist/types/privacy.d.ts +0 -204
- package/packages/ndpr-toolkit/dist/utils/breach.d.ts +0 -14
- package/packages/ndpr-toolkit/dist/utils/consent.d.ts +0 -10
- package/packages/ndpr-toolkit/dist/utils/dpia.d.ts +0 -12
- package/packages/ndpr-toolkit/dist/utils/dsr.d.ts +0 -11
- package/packages/ndpr-toolkit/dist/utils/privacy.d.ts +0 -12
- package/packages/ndpr-toolkit/package-lock.json +0 -8197
- package/packages/ndpr-toolkit/package.json +0 -71
- package/packages/ndpr-toolkit/rollup.config.js +0 -34
- package/packages/ndpr-toolkit/src/components/breach/BreachNotificationManager.tsx +0 -701
- package/packages/ndpr-toolkit/src/components/breach/BreachReportForm.tsx +0 -631
- package/packages/ndpr-toolkit/src/components/breach/BreachRiskAssessment.tsx +0 -569
- package/packages/ndpr-toolkit/src/components/breach/RegulatoryReportGenerator.tsx +0 -496
- package/packages/ndpr-toolkit/src/components/consent/ConsentBanner.tsx +0 -270
- package/packages/ndpr-toolkit/src/components/consent/ConsentManager.tsx +0 -217
- package/packages/ndpr-toolkit/src/components/consent/ConsentStorage.tsx +0 -206
- package/packages/ndpr-toolkit/src/components/dpia/DPIAQuestionnaire.tsx +0 -342
- package/packages/ndpr-toolkit/src/components/dpia/DPIAReport.tsx +0 -373
- package/packages/ndpr-toolkit/src/components/dpia/StepIndicator.tsx +0 -174
- package/packages/ndpr-toolkit/src/components/dsr/DSRDashboard.tsx +0 -717
- package/packages/ndpr-toolkit/src/components/dsr/DSRRequestForm.tsx +0 -476
- package/packages/ndpr-toolkit/src/components/dsr/DSRTracker.tsx +0 -620
- package/packages/ndpr-toolkit/src/components/policy/PolicyExporter.tsx +0 -541
- package/packages/ndpr-toolkit/src/components/policy/PolicyGenerator.tsx +0 -454
- package/packages/ndpr-toolkit/src/components/policy/PolicyPreview.tsx +0 -333
- package/packages/ndpr-toolkit/src/hooks/useBreach.ts +0 -409
- package/packages/ndpr-toolkit/src/hooks/useConsent.ts +0 -263
- package/packages/ndpr-toolkit/src/hooks/useDPIA.ts +0 -457
- package/packages/ndpr-toolkit/src/hooks/useDSR.ts +0 -236
- package/packages/ndpr-toolkit/src/hooks/usePrivacyPolicy.ts +0 -428
- package/packages/ndpr-toolkit/src/index.ts +0 -44
- package/packages/ndpr-toolkit/src/setupTests.ts +0 -5
- package/packages/ndpr-toolkit/src/types/breach.ts +0 -283
- package/packages/ndpr-toolkit/src/types/consent.ts +0 -111
- package/packages/ndpr-toolkit/src/types/dpia.ts +0 -236
- package/packages/ndpr-toolkit/src/types/dsr.ts +0 -192
- package/packages/ndpr-toolkit/src/types/index.ts +0 -42
- package/packages/ndpr-toolkit/src/types/privacy.ts +0 -246
- package/packages/ndpr-toolkit/src/utils/breach.ts +0 -122
- package/packages/ndpr-toolkit/src/utils/consent.ts +0 -51
- package/packages/ndpr-toolkit/src/utils/dpia.ts +0 -104
- package/packages/ndpr-toolkit/src/utils/dsr.ts +0 -77
- package/packages/ndpr-toolkit/src/utils/privacy.ts +0 -100
- package/packages/ndpr-toolkit/tsconfig.json +0 -23
- package/postcss.config.mjs +0 -5
- package/public/NDPR TOOLKIT.svg +0 -1
- package/public/favicon/android-chrome-192x192.png +0 -0
- package/public/favicon/android-chrome-512x512.png +0 -0
- package/public/favicon/apple-touch-icon.png +0 -0
- package/public/favicon/favicon-16x16.png +0 -0
- package/public/favicon/favicon-32x32.png +0 -0
- package/public/favicon/site.webmanifest +0 -1
- package/public/file.svg +0 -1
- package/public/globe.svg +0 -1
- package/public/ndpr-toolkit-logo.svg +0 -108
- package/public/next.svg +0 -1
- package/public/vercel.svg +0 -1
- package/public/window.svg +0 -1
- package/src/app/accessibility.css +0 -70
- package/src/app/favicon.ico +0 -0
- package/src/app/globals.css +0 -123
- package/src/app/layout.tsx +0 -37
- package/src/app/ndpr-demos/breach/page.tsx +0 -354
- package/src/app/ndpr-demos/consent/page.tsx +0 -366
- package/src/app/ndpr-demos/dpia/page.tsx +0 -495
- package/src/app/ndpr-demos/dsr/page.tsx +0 -280
- package/src/app/ndpr-demos/page.tsx +0 -73
- package/src/app/ndpr-demos/policy/page.tsx +0 -771
- package/src/app/page.tsx +0 -452
- package/src/components/ErrorBoundary.tsx +0 -90
- package/src/components/breach-notification/BreachNotificationForm.tsx +0 -479
- package/src/components/consent/ConsentBanner.tsx +0 -193
- package/src/components/data-subject-rights/DataSubjectRequestForm.tsx +0 -530
- package/src/components/dpia/DPIAQuestionnaire.tsx +0 -523
- package/src/components/privacy-policy/PolicyGenerator.tsx +0 -1062
- package/src/components/privacy-policy/data.ts +0 -98
- package/src/components/privacy-policy/shared/CheckboxField.tsx +0 -38
- package/src/components/privacy-policy/shared/CheckboxGroup.tsx +0 -85
- package/src/components/privacy-policy/shared/FormField.tsx +0 -79
- package/src/components/privacy-policy/shared/StepIndicator.tsx +0 -86
- package/src/components/privacy-policy/steps/CustomSectionsStep.tsx +0 -361
- package/src/components/privacy-policy/steps/DataCollectionStep.tsx +0 -231
- package/src/components/privacy-policy/steps/DataSharingStep.tsx +0 -418
- package/src/components/privacy-policy/steps/OrganizationInfoStep.tsx +0 -202
- package/src/components/privacy-policy/steps/PolicyPreviewStep.tsx +0 -226
- package/src/components/ui/Badge.tsx +0 -46
- package/src/components/ui/Button.tsx +0 -59
- package/src/components/ui/Card.tsx +0 -92
- package/src/components/ui/Checkbox.tsx +0 -57
- package/src/components/ui/FormField.tsx +0 -50
- package/src/components/ui/Input.tsx +0 -38
- package/src/components/ui/Loading.tsx +0 -201
- package/src/components/ui/Select.tsx +0 -42
- package/src/components/ui/TextArea.tsx +0 -38
- package/src/components/ui/label.tsx +0 -24
- package/src/components/ui/switch.tsx +0 -31
- package/src/components/ui/tabs.tsx +0 -66
- package/src/hooks/useConsent.ts +0 -70
- package/src/hooks/useLoadingState.ts +0 -85
- package/src/lib/consentService.ts +0 -144
- package/src/lib/dpiaQuestions.ts +0 -188
- package/src/lib/requestService.ts +0 -79
- package/src/lib/sanitize.ts +0 -108
- package/src/lib/storage.ts +0 -222
- package/src/lib/utils.ts +0 -6
- package/src/types/html-to-docx.d.ts +0 -30
- package/src/types/index.ts +0 -77
- package/tailwind.config.ts +0 -65
- package/tsconfig.json +0 -41
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base consent categories interface that can be extended
|
|
3
|
+
*/
|
|
4
|
+
export interface BaseConsentCategories {
|
|
5
|
+
necessary: boolean;
|
|
6
|
+
[key: string]: boolean;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Default consent categories provided by the toolkit
|
|
10
|
+
*/
|
|
11
|
+
export interface DefaultConsentCategories extends BaseConsentCategories {
|
|
12
|
+
necessary: boolean;
|
|
13
|
+
analytics: boolean;
|
|
14
|
+
marketing: boolean;
|
|
15
|
+
functional: boolean;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Generic consent state interface
|
|
19
|
+
*/
|
|
20
|
+
export interface ConsentState<T extends BaseConsentCategories = DefaultConsentCategories> {
|
|
21
|
+
hasUserConsented: boolean;
|
|
22
|
+
consentState: T;
|
|
23
|
+
showBanner: boolean;
|
|
24
|
+
showSettings: boolean;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Generic consent actions interface
|
|
28
|
+
*/
|
|
29
|
+
export interface ConsentActions<T extends BaseConsentCategories = DefaultConsentCategories> {
|
|
30
|
+
acceptAll: () => void;
|
|
31
|
+
rejectAll: () => void;
|
|
32
|
+
savePreferences: (preferences: Partial<T>) => void;
|
|
33
|
+
openSettings: () => void;
|
|
34
|
+
closeSettings: () => void;
|
|
35
|
+
updateConsent: (category: keyof T, value: boolean) => void;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Combined consent context value
|
|
39
|
+
*/
|
|
40
|
+
export interface ConsentContextValue<T extends BaseConsentCategories = DefaultConsentCategories> extends ConsentState<T>, ConsentActions<T> {
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Consent provider props with generic support
|
|
44
|
+
*/
|
|
45
|
+
export interface ConsentProviderProps<T extends BaseConsentCategories = DefaultConsentCategories> {
|
|
46
|
+
children: React.ReactNode;
|
|
47
|
+
initialConsent?: Partial<T>;
|
|
48
|
+
onConsentChange?: (consent: T) => void;
|
|
49
|
+
storageKey?: string;
|
|
50
|
+
categories?: Array<{
|
|
51
|
+
id: keyof T;
|
|
52
|
+
name: string;
|
|
53
|
+
description: string;
|
|
54
|
+
required?: boolean;
|
|
55
|
+
}>;
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=consent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"consent.d.ts","sourceRoot":"","sources":["../../src/types/consent.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,SAAS,EAAE,OAAO,CAAC;IACnB,CAAC,GAAG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,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,KAAK,CAAC;QACjB,EAAE,EAAE,MAAM,CAAC,CAAC;QACZ,IAAI,EAAE,MAAM,CAAC;QACb,WAAW,EAAE,MAAM,CAAC;QACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;KACpB,CAAC,CAAC;CACJ"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
export type ConsentType = 'necessary' | 'functional' | 'analytics' | 'marketing';
|
|
2
|
+
export interface ConsentOption {
|
|
3
|
+
id: ConsentType;
|
|
4
|
+
label: string;
|
|
5
|
+
description: string;
|
|
6
|
+
required: boolean;
|
|
7
|
+
defaultValue: boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface ConsentRecord {
|
|
10
|
+
id: string;
|
|
11
|
+
userId?: string;
|
|
12
|
+
consents: Record<ConsentType, boolean>;
|
|
13
|
+
timestamp: string;
|
|
14
|
+
ipAddress?: string;
|
|
15
|
+
userAgent?: string;
|
|
16
|
+
}
|
|
17
|
+
export interface ConsentHistoryEntry extends ConsentRecord {
|
|
18
|
+
changeReason?: string;
|
|
19
|
+
}
|
|
20
|
+
export type RequestStatus = 'pending' | 'in-progress' | 'completed' | 'rejected';
|
|
21
|
+
export type RequestType = 'access' | 'rectification' | 'erasure' | 'restrict-processing' | 'data-portability' | 'object';
|
|
22
|
+
export interface DataSubjectRequest {
|
|
23
|
+
id: string;
|
|
24
|
+
requestType: RequestType;
|
|
25
|
+
requesterId: string;
|
|
26
|
+
requesterEmail: string;
|
|
27
|
+
requesterName: string;
|
|
28
|
+
status: RequestStatus;
|
|
29
|
+
createdAt: string;
|
|
30
|
+
updatedAt: string;
|
|
31
|
+
completedAt?: string;
|
|
32
|
+
notes?: string;
|
|
33
|
+
attachments?: string[];
|
|
34
|
+
responseData?: Record<string, unknown>;
|
|
35
|
+
hasConsent: boolean;
|
|
36
|
+
}
|
|
37
|
+
export interface PolicySection {
|
|
38
|
+
id: string;
|
|
39
|
+
title: string;
|
|
40
|
+
content: string;
|
|
41
|
+
required: boolean;
|
|
42
|
+
order: number;
|
|
43
|
+
}
|
|
44
|
+
export interface PrivacyPolicy {
|
|
45
|
+
id: string;
|
|
46
|
+
organizationName: string;
|
|
47
|
+
organizationContact: string;
|
|
48
|
+
effectiveDate: string;
|
|
49
|
+
lastUpdated: string;
|
|
50
|
+
version: string;
|
|
51
|
+
sections: PolicySection[];
|
|
52
|
+
}
|
|
53
|
+
export interface RiskAssessmentQuestion {
|
|
54
|
+
id: string;
|
|
55
|
+
question: string;
|
|
56
|
+
category: string;
|
|
57
|
+
weight: number;
|
|
58
|
+
options: {
|
|
59
|
+
value: number;
|
|
60
|
+
label: string;
|
|
61
|
+
}[];
|
|
62
|
+
}
|
|
63
|
+
export interface RiskAssessment {
|
|
64
|
+
id: string;
|
|
65
|
+
projectName: string;
|
|
66
|
+
assessmentDate: string;
|
|
67
|
+
completedBy: string;
|
|
68
|
+
answers: Record<string, number>;
|
|
69
|
+
score?: number;
|
|
70
|
+
recommendations?: string[];
|
|
71
|
+
categoryScores?: Record<string, {
|
|
72
|
+
score: number;
|
|
73
|
+
maxScore: number;
|
|
74
|
+
percentage: number;
|
|
75
|
+
}>;
|
|
76
|
+
}
|
|
77
|
+
export type BreachSeverity = 'low' | 'medium' | 'high' | 'critical';
|
|
78
|
+
export interface BreachNotification {
|
|
79
|
+
id: string;
|
|
80
|
+
title: string;
|
|
81
|
+
description: string;
|
|
82
|
+
discoveryDate: string;
|
|
83
|
+
reportDate: string;
|
|
84
|
+
affectedDataSubjects: number;
|
|
85
|
+
dataCategories: string[];
|
|
86
|
+
severity: BreachSeverity;
|
|
87
|
+
mitigationSteps: string[];
|
|
88
|
+
reportedToAuthorities: boolean;
|
|
89
|
+
reportedToDataSubjects: boolean;
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src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AG,MAAM,GAAG,UAAU,CAAC;AAEpE,MAAM,WAAW,kBAAkB;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,QAAQ,EAAE,cAAc,CAAC;IACzB,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,qBAAqB,EAAE,OAAO,CAAC;IAC/B,sBAAsB,EAAE,OAAO,CAAC;CACjC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
interface UnstyledConsentBannerProps {
|
|
4
|
+
className?: string;
|
|
5
|
+
children?: ReactNode;
|
|
6
|
+
}
|
|
7
|
+
declare const UnstyledConsentBanner: React.FC<UnstyledConsentBannerProps>;
|
|
8
|
+
|
|
9
|
+
interface UnstyledConsentSettingsProps {
|
|
10
|
+
className?: string;
|
|
11
|
+
children?: ReactNode;
|
|
12
|
+
}
|
|
13
|
+
declare const UnstyledConsentSettings: React.FC<UnstyledConsentSettingsProps>;
|
|
14
|
+
|
|
15
|
+
interface UnstyledConsentToggleProps {
|
|
16
|
+
category: 'analytics' | 'marketing' | 'functional';
|
|
17
|
+
className?: string;
|
|
18
|
+
label?: string;
|
|
19
|
+
}
|
|
20
|
+
declare const UnstyledConsentToggle: React.FC<UnstyledConsentToggleProps>;
|
|
21
|
+
|
|
22
|
+
export { UnstyledConsentBanner as ConsentBanner, UnstyledConsentSettings as ConsentSettings, UnstyledConsentToggle as ConsentToggle };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unstyled.d.ts","sourceRoot":"","sources":["../src/unstyled.ts"],"names":[],"mappings":"AACA,OAAO,EACL,qBAAqB,IAAI,aAAa,EACtC,uBAAuB,IAAI,eAAe,EAC1C,qBAAqB,IAAI,aAAa,GACvC,MAAM,qCAAqC,CAAC"}
|
package/dist/unstyled.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
'use strict';var e=require('react');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var e__default=/*#__PURE__*/_interopDefault(e);var v=e.createContext(void 0);function i(){let n=e.useContext(v);if(!n)throw new Error("useConsent must be used within a ConsentProvider");return n}var C=({className:n,children:a})=>{let{showBanner:o,acceptAll:r,rejectAll:l,openSettings:c}=i();return o?e__default.default.createElement("div",{className:n,role:"region","aria-label":"Cookie consent"},a||e__default.default.createElement(e__default.default.Fragment,null,e__default.default.createElement("div",null,e__default.default.createElement("h3",null,"Cookie Consent"),e__default.default.createElement("p",null,"We use cookies to enhance your experience. By continuing to visit this site you agree to our use of cookies.")),e__default.default.createElement("div",null,e__default.default.createElement("button",{onClick:r,"aria-label":"Accept all cookies"},"Accept All"),e__default.default.createElement("button",{onClick:l,"aria-label":"Reject non-essential cookies"},"Reject All"),e__default.default.createElement("button",{onClick:c,"aria-label":"Manage cookie preferences"},"Manage Preferences")))):null};var h=[{id:"necessary",name:"Necessary Cookies",description:"These cookies are essential for the website to function properly.",disabled:true},{id:"analytics",name:"Analytics Cookies",description:"These cookies help us understand how visitors interact with our website.",disabled:false},{id:"marketing",name:"Marketing Cookies",description:"These cookies are used to track visitors across websites for marketing purposes.",disabled:false},{id:"functional",name:"Functional Cookies",description:"These cookies enable personalized features and functionality.",disabled:false}],f=({className:n,children:a})=>{let{showSettings:o,consentState:r,updateConsent:l,savePreferences:c,closeSettings:p}=i();if(!o)return null;let g=()=>{c(r);};return e__default.default.createElement("div",{className:n,role:"dialog","aria-label":"Cookie preferences"},a||e__default.default.createElement(e__default.default.Fragment,null,e__default.default.createElement("div",null,e__default.default.createElement("h2",null,"Cookie Preferences"),e__default.default.createElement("p",null,"Manage your cookie preferences. You can enable or disable different categories of cookies below.")),e__default.default.createElement("div",null,h.map(s=>e__default.default.createElement("div",{key:s.id},e__default.default.createElement("div",null,e__default.default.createElement("h4",null,s.name),e__default.default.createElement("p",null,s.description)),e__default.default.createElement("input",{type:"checkbox",checked:r[s.id],onChange:k=>l(s.id,k.target.checked),disabled:s.disabled,"aria-label":`Toggle ${s.name}`})))),e__default.default.createElement("div",null,e__default.default.createElement("button",{onClick:p,"aria-label":"Cancel changes"},"Cancel"),e__default.default.createElement("button",{onClick:g,"aria-label":"Save cookie preferences"},"Save Preferences"))))};var u=({category:n,className:a,label:o})=>{let{consentState:r,updateConsent:l}=i();return e__default.default.createElement("label",{className:a},e__default.default.createElement("input",{type:"checkbox",checked:r[n],onChange:c=>l(n,c.target.checked),"aria-label":o||`Toggle ${n} cookies`}),o&&e__default.default.createElement("span",null,o))};exports.ConsentBanner=C;exports.ConsentSettings=f;exports.ConsentToggle=u;//# sourceMappingURL=unstyled.js.map
|
|
2
|
+
//# sourceMappingURL=unstyled.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/contexts/ConsentContext.tsx","../src/components/consent/unstyled/UnstyledConsentBanner.tsx","../src/components/consent/unstyled/UnstyledConsentSettings.tsx","../src/components/consent/unstyled/UnstyledConsentToggle.tsx"],"names":["ConsentContext","createContext","useConsent","context","useContext","UnstyledConsentBanner","className","children","showBanner","acceptAll","rejectAll","openSettings","React","cookieCategories","UnstyledConsentSettings","showSettings","consentState","updateConsent","savePreferences","closeSettings","handleSave","category","e","UnstyledConsentToggle","label"],"mappings":"oJA4BA,IAAMA,EAAiBC,eAAAA,CAA+C,MAAS,EA0IxE,SAASC,CAAAA,EAAa,CAC3B,IAAMC,CAAAA,CAAUC,aAAWJ,CAAc,CAAA,CACzC,GAAI,CAACG,CAAAA,CACH,MAAM,IAAI,KAAA,CAAM,kDAAkD,CAAA,CAEpE,OAAOA,CACT,CCpKO,IAAME,EAA8D,CAAC,CAC1E,UAAAC,CAAAA,CACA,QAAA,CAAAC,CACF,CAAA,GAAM,C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A,CAAY,UAAUA,CAAAA,CAAS,IAAI,GACrC,CACF,CACD,CACH,CAAA,CAEAT,kBAAAA,CAAA,cAAC,KAAA,CAAA,IAAA,CACCA,kBAAAA,CAAA,cAAC,QAAA,CAAA,CAAO,OAAA,CAASO,EAAe,YAAA,CAAW,gBAAA,CAAA,CAAiB,QAE5D,CAAA,CACAP,kBAAAA,CAAA,cAAC,QAAA,CAAA,CAAO,OAAA,CAASQ,EAAY,YAAA,CAAW,yBAAA,CAAA,CAA0B,kBAElE,CACF,CACF,CAEJ,CAEJ,MC7EaG,CAAAA,CAA8D,CAAC,CAC1E,QAAA,CAAAF,CAAAA,CACA,UAAAf,CAAAA,CACA,KAAA,CAAAkB,CACF,CAAA,GAAM,CACJ,GAAM,CAAE,YAAA,CAAAR,EAAc,aAAA,CAAAC,CAAc,EAAIf,CAAAA,EAAW,CAEnD,OACEU,kBAAAA,CAAA,aAAA,CAAC,SAAM,SAAA,CAAWN,CAAAA,CAAAA,CAChBM,mBAAA,aAAA,CAAC,OAAA,CAAA,CACC,KAAK,UAAA,CACL,OAAA,CAASI,EAAaK,CAAQ,CAAA,CAC9B,SAAWC,CAAAA,EAAML,CAAAA,CAAcI,EAAUC,CAAAA,CAAE,MAAA,CAAO,OAAO,CAAA,CACzD,YAAA,CAAYE,GAAS,CAAA,OAAA,EAAUH,CAAQ,WACzC,CAAA,CACCG,CAAAA,EAASZ,mBAAA,aAAA,CAAC,MAAA,CAAA,IAAA,CAAMY,CAAM,CACzB,CAEJ","file":"unstyled.js","sourcesContent":["import React, { createContext, useContext, useState, useCallback, useEffect, ReactNode } from 'react';\n\nexport interface ConsentCategories {\n necessary: boolean;\n analytics: boolean;\n marketing: boolean;\n functional: boolean;\n [key: string]: boolean;\n}\n\nexport interface ConsentState {\n hasUserConsented: boolean;\n consentState: ConsentCategories;\n showBanner: boolean;\n showSettings: boolean;\n}\n\nexport interface ConsentActions {\n acceptAll: () => void;\n rejectAll: () => void;\n savePreferences: (preferences: Partial<ConsentCategories>) => void;\n openSettings: () => void;\n closeSettings: () => void;\n updateConsent: (category: keyof ConsentCategories, value: boolean) => void;\n}\n\nexport interface ConsentContextValue extends ConsentState, ConsentActions {}\n\nconst ConsentContext = createContext<ConsentContextValue | undefined>(undefined);\n\nexport interface ConsentProviderProps {\n children: ReactNode;\n initialConsent?: Partial<ConsentCategories>;\n onConsentChange?: (consent: ConsentCategories) => void;\n storageKey?: string;\n}\n\nconst defaultConsent: ConsentCategories = {\n necessary: true, // Always true\n analytics: false,\n marketing: false,\n functional: false,\n};\n\nexport function ConsentProvider({\n children,\n initialConsent = {},\n onConsentChange,\n storageKey = 'ndpr-consent',\n}: ConsentProviderProps) {\n const [consentState, setConsentState] = useState<ConsentCategories>(() => {\n // Try to load from localStorage\n if (typeof window !== 'undefined') {\n const stored = localStorage.getItem(storageKey);\n if (stored) {\n try {\n const parsed = JSON.parse(stored);\n return { ...defaultConsent, ...parsed };\n } catch (e) {\n console.error('Failed to parse consent from localStorage', e);\n }\n }\n }\n return { ...defaultConsent, ...initialConsent };\n });\n\n const [hasUserConsented, setHasUserConsented] = useState(() => {\n if (typeof window !== 'undefined') {\n return localStorage.getItem(`${storageKey}-set`) === 'true';\n }\n return false;\n });\n\n const [showBanner, setShowBanner] = useState(!hasUserConsented);\n const [showSettings, setShowSettings] = useState(false);\n\n // Persist consent to localStorage\n useEffect(() => {\n if (typeof window !== 'undefined' && hasUserConsented) {\n localStorage.setItem(storageKey, JSON.stringify(consentState));\n localStorage.setItem(`${storageKey}-set`, 'true');\n }\n }, [consentState, hasUserConsented, storageKey]);\n\n // Notify parent of consent changes\n useEffect(() => {\n if (hasUserConsented && onConsentChange) {\n onConsentChange(consentState);\n }\n }, [consentState, hasUserConsented, onConsentChange]);\n\n const acceptAll = useCallback(() => {\n const newConsent: ConsentCategories = {\n necessary: true,\n analytics: true,\n marketing: true,\n functional: true,\n };\n setConsentState(newConsent);\n setHasUserConsented(true);\n setShowBanner(false);\n setShowSettings(false);\n }, []);\n\n const rejectAll = useCallback(() => {\n const newConsent: ConsentCategories = {\n necessary: true,\n analytics: false,\n marketing: false,\n functional: false,\n };\n setConsentState(newConsent);\n setHasUserConsented(true);\n setShowBanner(false);\n setShowSettings(false);\n }, []);\n\n const savePreferences = useCallback((preferences: Partial<ConsentCategories>) => {\n setConsentState(prev => ({\n ...prev,\n ...preferences,\n necessary: true, // Always keep necessary as true\n }));\n setHasUserConsented(true);\n setShowBanner(false);\n setShowSettings(false);\n }, []);\n\n const updateConsent = useCallback((category: keyof ConsentCategories, value: boolean) => {\n if (category === 'necessary') return; // Can't change necessary cookies\n \n setConsentState(prev => ({\n ...prev,\n [category]: value,\n }));\n }, []);\n\n const openSettings = useCallback(() => {\n setShowSettings(true);\n setShowBanner(false);\n }, []);\n\n const closeSettings = useCallback(() => {\n setShowSettings(false);\n }, []);\n\n const value: ConsentContextValue = {\n hasUserConsented,\n consentState,\n showBanner,\n showSettings,\n acceptAll,\n rejectAll,\n savePreferences,\n openSettings,\n closeSettings,\n updateConsent,\n };\n\n return (\n <ConsentContext.Provider value={value}>\n {children}\n </ConsentContext.Provider>\n );\n}\n\nexport function useConsent() {\n const context = useContext(ConsentContext);\n if (!context) {\n throw new Error('useConsent must be used within a ConsentProvider');\n }\n return context;\n}\n\n// Export for external use\nexport { ConsentContext };","import React, { ReactNode } from 'react';\nimport { useConsent } from '@/contexts/ConsentContext';\n\nexport interface UnstyledConsentBannerProps {\n className?: string;\n children?: ReactNode;\n}\n\nexport const UnstyledConsentBanner: React.FC<UnstyledConsentBannerProps> = ({\n className,\n children,\n}) => {\n const { showBanner, acceptAll, rejectAll, openSettings } = useConsent();\n\n if (!showBanner) return null;\n\n return (\n <div className={className} role=\"region\" aria-label=\"Cookie consent\">\n {children || (\n <>\n <div>\n <h3>Cookie Consent</h3>\n <p>We use cookies to enhance your experience. By continuing to visit this site you agree to our use of cookies.</p>\n </div>\n <div>\n <button onClick={acceptAll} aria-label=\"Accept all cookies\">\n Accept All\n </button>\n <button onClick={rejectAll} aria-label=\"Reject non-essential cookies\">\n Reject All\n </button>\n <button onClick={openSettings} aria-label=\"Manage cookie preferences\">\n Manage Preferences\n </button>\n </div>\n </>\n )}\n </div>\n );\n};","import React, { ReactNode } from 'react';\nimport { useConsent } from '@/contexts/ConsentContext';\n\nexport interface UnstyledConsentSettingsProps {\n className?: string;\n children?: ReactNode;\n}\n\nconst cookieCategories = [\n {\n id: 'necessary',\n name: 'Necessary Cookies',\n description: 'These cookies are essential for the website to function properly.',\n disabled: true,\n },\n {\n id: 'analytics',\n name: 'Analytics Cookies',\n description: 'These cookies help us understand how visitors interact with our website.',\n disabled: false,\n },\n {\n id: 'marketing',\n name: 'Marketing Cookies',\n description: 'These cookies are used to track visitors across websites for marketing purposes.',\n disabled: false,\n },\n {\n id: 'functional',\n name: 'Functional Cookies',\n description: 'These cookies enable personalized features and functionality.',\n disabled: false,\n },\n];\n\nexport const UnstyledConsentSettings: React.FC<UnstyledConsentSettingsProps> = ({\n className,\n children,\n}) => {\n const { showSettings, consentState, updateConsent, savePreferences, closeSettings } = useConsent();\n\n if (!showSettings) return null;\n\n const handleSave = () => {\n savePreferences(consentState);\n };\n\n return (\n <div className={className} role=\"dialog\" aria-label=\"Cookie preferences\">\n {children || (\n <>\n <div>\n <h2>Cookie Preferences</h2>\n <p>Manage your cookie preferences. You can enable or disable different categories of cookies below.</p>\n </div>\n \n <div>\n {cookieCategories.map((category) => (\n <div key={category.id}>\n <div>\n <h4>{category.name}</h4>\n <p>{category.description}</p>\n </div>\n <input\n type=\"checkbox\"\n checked={consentState[category.id as keyof typeof consentState]}\n onChange={(e) => updateConsent(category.id as keyof typeof consentState, e.target.checked)}\n disabled={category.disabled}\n aria-label={`Toggle ${category.name}`}\n />\n </div>\n ))}\n </div>\n\n <div>\n <button onClick={closeSettings} aria-label=\"Cancel changes\">\n Cancel\n </button>\n <button onClick={handleSave} aria-label=\"Save cookie preferences\">\n Save Preferences\n </button>\n </div>\n </>\n )}\n </div>\n );\n};","import React from 'react';\nimport { useConsent } from '@/contexts/ConsentContext';\n\nexport interface UnstyledConsentToggleProps {\n category: 'analytics' | 'marketing' | 'functional';\n className?: string;\n label?: string;\n}\n\nexport const UnstyledConsentToggle: React.FC<UnstyledConsentToggleProps> = ({\n category,\n className,\n label,\n}) => {\n const { consentState, updateConsent } = useConsent();\n\n return (\n <label className={className}>\n <input\n type=\"checkbox\"\n checked={consentState[category]}\n onChange={(e) => updateConsent(category, e.target.checked)}\n aria-label={label || `Toggle ${category} cookies`}\n />\n {label && <span>{label}</span>}\n </label>\n );\n};"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import e,{createContext,useContext}from'react';var v=createContext(void 0);function i(){let n=useContext(v);if(!n)throw new Error("useConsent must be used within a ConsentProvider");return n}var C=({className:n,children:a})=>{let{showBanner:o,acceptAll:r,rejectAll:l,openSettings:c}=i();return o?e.createElement("div",{className:n,role:"region","aria-label":"Cookie consent"},a||e.createElement(e.Fragment,null,e.createElement("div",null,e.createElement("h3",null,"Cookie Consent"),e.createElement("p",null,"We use cookies to enhance your experience. By continuing to visit this site you agree to our use of cookies.")),e.createElement("div",null,e.createElement("button",{onClick:r,"aria-label":"Accept all cookies"},"Accept All"),e.createElement("button",{onClick:l,"aria-label":"Reject non-essential cookies"},"Reject All"),e.createElement("button",{onClick:c,"aria-label":"Manage cookie preferences"},"Manage Preferences")))):null};var h=[{id:"necessary",name:"Necessary Cookies",description:"These cookies are essential for the website to function properly.",disabled:true},{id:"analytics",name:"Analytics Cookies",description:"These cookies help us understand how visitors interact with our website.",disabled:false},{id:"marketing",name:"Marketing Cookies",description:"These cookies are used to track visitors across websites for marketing purposes.",disabled:false},{id:"functional",name:"Functional Cookies",description:"These cookies enable personalized features and functionality.",disabled:false}],f=({className:n,children:a})=>{let{showSettings:o,consentState:r,updateConsent:l,savePreferences:c,closeSettings:p}=i();if(!o)return null;let g=()=>{c(r);};return e.createElement("div",{className:n,role:"dialog","aria-label":"Cookie preferences"},a||e.createElement(e.Fragment,null,e.createElement("div",null,e.createElement("h2",null,"Cookie Preferences"),e.createElement("p",null,"Manage your cookie preferences. You can enable or disable different categories of cookies below.")),e.createElement("div",null,h.map(s=>e.createElement("div",{key:s.id},e.createElement("div",null,e.createElement("h4",null,s.name),e.createElement("p",null,s.description)),e.createElement("input",{type:"checkbox",checked:r[s.id],onChange:k=>l(s.id,k.target.checked),disabled:s.disabled,"aria-label":`Toggle ${s.name}`})))),e.createElement("div",null,e.createElement("button",{onClick:p,"aria-label":"Cancel changes"},"Cancel"),e.createElement("button",{onClick:g,"aria-label":"Save cookie preferences"},"Save Preferences"))))};var u=({category:n,className:a,label:o})=>{let{consentState:r,updateConsent:l}=i();return e.createElement("label",{className:a},e.createElement("input",{type:"checkbox",checked:r[n],onChange:c=>l(n,c.target.checked),"aria-label":o||`Toggle ${n} cookies`}),o&&e.createElement("span",null,o))};export{C as ConsentBanner,f as ConsentSettings,u as ConsentToggle};//# sourceMappingURL=unstyled.mjs.map
|
|
2
|
+
//# sourceMappingURL=unstyled.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/contexts/ConsentContext.tsx","../src/components/consent/unstyled/UnstyledConsentBanner.tsx","../src/components/consent/unstyled/UnstyledConsentSettings.tsx","../src/components/consent/unstyled/UnstyledConsentToggle.tsx"],"names":["ConsentContext","createContext","useConsent","context","useContext","UnstyledConsentBanner","className","children","showBanner","acceptAll","rejectAll","openSettings","React","cookieCategories","UnstyledConsentSettings","showSettings","consentState","updateConsent","savePreferences","closeSettings","handleSave","category","e","UnstyledConsentToggle","label"],"mappings":"+CA4BA,IAAMA,EAAiBC,aAAAA,CAA+C,MAAS,EA0IxE,SAASC,CAAAA,EAAa,CAC3B,IAAMC,CAAAA,CAAUC,WAAWJ,CAAc,CAAA,CACzC,GAAI,CAACG,CAAAA,CACH,MAAM,IAAI,KAAA,CAAM,kDAAkD,CAAA,CAEpE,OAAOA,CACT,CCpKO,IAAME,EAA8D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zF,QAAA,CAAUD,EAAS,QAAA,CACnB,YAAA,CAAY,UAAUA,CAAAA,CAAS,IAAI,GACrC,CACF,CACD,CACH,CAAA,CAEAT,CAAAA,CAAA,cAAC,KAAA,CAAA,IAAA,CACCA,CAAAA,CAAA,cAAC,QAAA,CAAA,CAAO,OAAA,CAASO,EAAe,YAAA,CAAW,gBAAA,CAAA,CAAiB,QAE5D,CAAA,CACAP,CAAAA,CAAA,cAAC,QAAA,CAAA,CAAO,OAAA,CAASQ,EAAY,YAAA,CAAW,yBAAA,CAAA,CAA0B,kBAElE,CACF,CACF,CAEJ,CAEJ,MC7EaG,CAAAA,CAA8D,CAAC,CAC1E,QAAA,CAAAF,CAAAA,CACA,UAAAf,CAAAA,CACA,KAAA,CAAAkB,CACF,CAAA,GAAM,CACJ,GAAM,CAAE,YAAA,CAAAR,EAAc,aAAA,CAAAC,CAAc,EAAIf,CAAAA,EAAW,CAEnD,OACEU,CAAAA,CAAA,aAAA,CAAC,SAAM,SAAA,CAAWN,CAAAA,CAAAA,CAChBM,EAAA,aAAA,CAAC,OAAA,CAAA,CACC,KAAK,UAAA,CACL,OAAA,CAASI,EAAaK,CAAQ,CAAA,CAC9B,SAAWC,CAAAA,EAAML,CAAAA,CAAcI,EAAUC,CAAAA,CAAE,MAAA,CAAO,OAAO,CAAA,CACzD,YAAA,CAAYE,GAAS,CAAA,OAAA,EAAUH,CAAQ,WACzC,CAAA,CACCG,CAAAA,EAASZ,EAAA,aAAA,CAAC,MAAA,CAAA,IAAA,CAAMY,CAAM,CACzB,CAEJ","file":"unstyled.mjs","sourcesContent":["import React, { createContext, useContext, useState, useCallback, useEffect, ReactNode } from 'react';\n\nexport interface ConsentCategories {\n necessary: boolean;\n analytics: boolean;\n marketing: boolean;\n functional: boolean;\n [key: string]: boolean;\n}\n\nexport interface ConsentState {\n hasUserConsented: boolean;\n consentState: ConsentCategories;\n showBanner: boolean;\n showSettings: boolean;\n}\n\nexport interface ConsentActions {\n acceptAll: () => void;\n rejectAll: () => void;\n savePreferences: (preferences: Partial<ConsentCategories>) => void;\n openSettings: () => void;\n closeSettings: () => void;\n updateConsent: (category: keyof ConsentCategories, value: boolean) => void;\n}\n\nexport interface ConsentContextValue extends ConsentState, ConsentActions {}\n\nconst ConsentContext = createContext<ConsentContextValue | undefined>(undefined);\n\nexport interface ConsentProviderProps {\n children: ReactNode;\n initialConsent?: Partial<ConsentCategories>;\n onConsentChange?: (consent: ConsentCategories) => void;\n storageKey?: string;\n}\n\nconst defaultConsent: ConsentCategories = {\n necessary: true, // Always true\n analytics: false,\n marketing: false,\n functional: false,\n};\n\nexport function ConsentProvider({\n children,\n initialConsent = {},\n onConsentChange,\n storageKey = 'ndpr-consent',\n}: ConsentProviderProps) {\n const [consentState, setConsentState] = useState<ConsentCategories>(() => {\n // Try to load from localStorage\n if (typeof window !== 'undefined') {\n const stored = localStorage.getItem(storageKey);\n if (stored) {\n try {\n const parsed = JSON.parse(stored);\n return { ...defaultConsent, ...parsed };\n } catch (e) {\n console.error('Failed to parse consent from localStorage', e);\n }\n }\n }\n return { ...defaultConsent, ...initialConsent };\n });\n\n const [hasUserConsented, setHasUserConsented] = useState(() => {\n if (typeof window !== 'undefined') {\n return localStorage.getItem(`${storageKey}-set`) === 'true';\n }\n return false;\n });\n\n const [showBanner, setShowBanner] = useState(!hasUserConsented);\n const [showSettings, setShowSettings] = useState(false);\n\n // Persist consent to localStorage\n useEffect(() => {\n if (typeof window !== 'undefined' && hasUserConsented) {\n localStorage.setItem(storageKey, JSON.stringify(consentState));\n localStorage.setItem(`${storageKey}-set`, 'true');\n }\n }, [consentState, hasUserConsented, storageKey]);\n\n // Notify parent of consent changes\n useEffect(() => {\n if (hasUserConsented && onConsentChange) {\n onConsentChange(consentState);\n }\n }, [consentState, hasUserConsented, onConsentChange]);\n\n const acceptAll = useCallback(() => {\n const newConsent: ConsentCategories = {\n necessary: true,\n analytics: true,\n marketing: true,\n functional: true,\n };\n setConsentState(newConsent);\n setHasUserConsented(true);\n setShowBanner(false);\n setShowSettings(false);\n }, []);\n\n const rejectAll = useCallback(() => {\n const newConsent: ConsentCategories = {\n necessary: true,\n analytics: false,\n marketing: false,\n functional: false,\n };\n setConsentState(newConsent);\n setHasUserConsented(true);\n setShowBanner(false);\n setShowSettings(false);\n }, []);\n\n const savePreferences = useCallback((preferences: Partial<ConsentCategories>) => {\n setConsentState(prev => ({\n ...prev,\n ...preferences,\n necessary: true, // Always keep necessary as true\n }));\n setHasUserConsented(true);\n setShowBanner(false);\n setShowSettings(false);\n }, []);\n\n const updateConsent = useCallback((category: keyof ConsentCategories, value: boolean) => {\n if (category === 'necessary') return; // Can't change necessary cookies\n \n setConsentState(prev => ({\n ...prev,\n [category]: value,\n }));\n }, []);\n\n const openSettings = useCallback(() => {\n setShowSettings(true);\n setShowBanner(false);\n }, []);\n\n const closeSettings = useCallback(() => {\n setShowSettings(false);\n }, []);\n\n const value: ConsentContextValue = {\n hasUserConsented,\n consentState,\n showBanner,\n showSettings,\n acceptAll,\n rejectAll,\n savePreferences,\n openSettings,\n closeSettings,\n updateConsent,\n };\n\n return (\n <ConsentContext.Provider value={value}>\n {children}\n </ConsentContext.Provider>\n );\n}\n\nexport function useConsent() {\n const context = useContext(ConsentContext);\n if (!context) {\n throw new Error('useConsent must be used within a ConsentProvider');\n }\n return context;\n}\n\n// Export for external use\nexport { ConsentContext };","import React, { ReactNode } from 'react';\nimport { useConsent } from '@/contexts/ConsentContext';\n\nexport interface UnstyledConsentBannerProps {\n className?: string;\n children?: ReactNode;\n}\n\nexport const UnstyledConsentBanner: React.FC<UnstyledConsentBannerProps> = ({\n className,\n children,\n}) => {\n const { showBanner, acceptAll, rejectAll, openSettings } = useConsent();\n\n if (!showBanner) return null;\n\n return (\n <div className={className} role=\"region\" aria-label=\"Cookie consent\">\n {children || (\n <>\n <div>\n <h3>Cookie Consent</h3>\n <p>We use cookies to enhance your experience. By continuing to visit this site you agree to our use of cookies.</p>\n </div>\n <div>\n <button onClick={acceptAll} aria-label=\"Accept all cookies\">\n Accept All\n </button>\n <button onClick={rejectAll} aria-label=\"Reject non-essential cookies\">\n Reject All\n </button>\n <button onClick={openSettings} aria-label=\"Manage cookie preferences\">\n Manage Preferences\n </button>\n </div>\n </>\n )}\n </div>\n );\n};","import React, { ReactNode } from 'react';\nimport { useConsent } from '@/contexts/ConsentContext';\n\nexport interface UnstyledConsentSettingsProps {\n className?: string;\n children?: ReactNode;\n}\n\nconst cookieCategories = [\n {\n id: 'necessary',\n name: 'Necessary Cookies',\n description: 'These cookies are essential for the website to function properly.',\n disabled: true,\n },\n {\n id: 'analytics',\n name: 'Analytics Cookies',\n description: 'These cookies help us understand how visitors interact with our website.',\n disabled: false,\n },\n {\n id: 'marketing',\n name: 'Marketing Cookies',\n description: 'These cookies are used to track visitors across websites for marketing purposes.',\n disabled: false,\n },\n {\n id: 'functional',\n name: 'Functional Cookies',\n description: 'These cookies enable personalized features and functionality.',\n disabled: false,\n },\n];\n\nexport const UnstyledConsentSettings: React.FC<UnstyledConsentSettingsProps> = ({\n className,\n children,\n}) => {\n const { showSettings, consentState, updateConsent, savePreferences, closeSettings } = useConsent();\n\n if (!showSettings) return null;\n\n const handleSave = () => {\n savePreferences(consentState);\n };\n\n return (\n <div className={className} role=\"dialog\" aria-label=\"Cookie preferences\">\n {children || (\n <>\n <div>\n <h2>Cookie Preferences</h2>\n <p>Manage your cookie preferences. You can enable or disable different categories of cookies below.</p>\n </div>\n \n <div>\n {cookieCategories.map((category) => (\n <div key={category.id}>\n <div>\n <h4>{category.name}</h4>\n <p>{category.description}</p>\n </div>\n <input\n type=\"checkbox\"\n checked={consentState[category.id as keyof typeof consentState]}\n onChange={(e) => updateConsent(category.id as keyof typeof consentState, e.target.checked)}\n disabled={category.disabled}\n aria-label={`Toggle ${category.name}`}\n />\n </div>\n ))}\n </div>\n\n <div>\n <button onClick={closeSettings} aria-label=\"Cancel changes\">\n Cancel\n </button>\n <button onClick={handleSave} aria-label=\"Save cookie preferences\">\n Save Preferences\n </button>\n </div>\n </>\n )}\n </div>\n );\n};","import React from 'react';\nimport { useConsent } from '@/contexts/ConsentContext';\n\nexport interface UnstyledConsentToggleProps {\n category: 'analytics' | 'marketing' | 'functional';\n className?: string;\n label?: string;\n}\n\nexport const UnstyledConsentToggle: React.FC<UnstyledConsentToggleProps> = ({\n category,\n className,\n label,\n}) => {\n const { consentState, updateConsent } = useConsent();\n\n return (\n <label className={className}>\n <input\n type=\"checkbox\"\n checked={consentState[category]}\n onChange={(e) => updateConsent(category, e.target.checked)}\n aria-label={label || `Toggle ${category} cookies`}\n />\n {label && <span>{label}</span>}\n </label>\n );\n};"]}
|
package/package.json
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tantainnovative/ndpr-toolkit",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.7",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Nigerian Data Protection Compliance Toolkit for implementing NDPR and DPA compliant features",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"dev": "next dev --turbopack",
|
|
8
8
|
"build": "next build",
|
|
9
|
+
"build:lib": "tsup && pnpm build:types",
|
|
10
|
+
"build:types": "tsc -p tsconfig.lib.json",
|
|
11
|
+
"prepublishOnly": "pnpm build:lib",
|
|
9
12
|
"start": "next start",
|
|
10
13
|
"lint": "next lint",
|
|
11
14
|
"test": "jest --passWithNoTests",
|
|
@@ -37,12 +40,35 @@
|
|
|
37
40
|
"url": "https://github.com/tantainnovative/ndpr-toolkit/issues"
|
|
38
41
|
},
|
|
39
42
|
"homepage": "https://github.com/tantainnovative/ndpr-toolkit#readme",
|
|
43
|
+
"main": "./dist/index.js",
|
|
44
|
+
"module": "./dist/index.mjs",
|
|
45
|
+
"types": "./dist/index.d.ts",
|
|
46
|
+
"exports": {
|
|
47
|
+
".": {
|
|
48
|
+
"types": "./dist/index.d.ts",
|
|
49
|
+
"import": "./dist/index.mjs",
|
|
50
|
+
"require": "./dist/index.js"
|
|
51
|
+
},
|
|
52
|
+
"./unstyled": {
|
|
53
|
+
"types": "./dist/unstyled.d.ts",
|
|
54
|
+
"import": "./dist/unstyled.mjs",
|
|
55
|
+
"require": "./dist/unstyled.js"
|
|
56
|
+
},
|
|
57
|
+
"./styles": {
|
|
58
|
+
"import": "./dist/styles.css",
|
|
59
|
+
"require": "./dist/styles.css"
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
"files": [
|
|
63
|
+
"dist",
|
|
64
|
+
"README.md",
|
|
65
|
+
"LICENSE"
|
|
66
|
+
],
|
|
40
67
|
"dependencies": {
|
|
41
68
|
"@radix-ui/react-label": "^2.1.4",
|
|
42
69
|
"@radix-ui/react-slot": "^1.2.0",
|
|
43
70
|
"@radix-ui/react-switch": "^1.2.2",
|
|
44
71
|
"@radix-ui/react-tabs": "^1.1.9",
|
|
45
|
-
"@tantainnovative/ndpr-toolkit": "^1.0.1",
|
|
46
72
|
"class-variance-authority": "^0.7.1",
|
|
47
73
|
"clsx": "^2.1.1",
|
|
48
74
|
"docx": "^9.4.1",
|
|
@@ -55,12 +81,14 @@
|
|
|
55
81
|
"next-mdx-remote": "^5.0.0",
|
|
56
82
|
"nextra": "^4.2.17",
|
|
57
83
|
"nextra-theme-docs": "^4.2.17",
|
|
58
|
-
"react": "^19.0.0",
|
|
59
|
-
"react-dom": "^19.0.0",
|
|
60
84
|
"react-markdown": "^10.1.0",
|
|
61
85
|
"tailwind-merge": "^2.6.0",
|
|
62
86
|
"uuid": "^11.1.0"
|
|
63
87
|
},
|
|
88
|
+
"peerDependencies": {
|
|
89
|
+
"react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
90
|
+
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
|
|
91
|
+
},
|
|
64
92
|
"devDependencies": {
|
|
65
93
|
"@commitlint/cli": "^19.0.0",
|
|
66
94
|
"@commitlint/config-conventional": "^19.0.0",
|
|
@@ -80,9 +108,9 @@
|
|
|
80
108
|
"husky": "^9.0.0",
|
|
81
109
|
"jest": "^29.5.0",
|
|
82
110
|
"jest-environment-jsdom": "^29.5.0",
|
|
83
|
-
"prettier": "^3.6.2",
|
|
84
111
|
"standard-version": "^9.5.0",
|
|
85
112
|
"tailwindcss": "^4",
|
|
113
|
+
"tsup": "^8.5.0",
|
|
86
114
|
"tw-animate-css": "^1.2.9",
|
|
87
115
|
"typescript": "^5"
|
|
88
116
|
}
|
package/CHANGELOG.md
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
|
|
3
|
-
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
|
-
|
|
5
|
-
## 1.0.0 (2025-05-02)
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
### Features
|
|
9
|
-
|
|
10
|
-
* initial implementation of NDPR-Toolkit with all key components ([b41aeef](https://github.com/tantainnovative/ndpr-toolkit/commit/b41aeefe3184ce69ed09f3d8c0fdacb860a98427))
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
### Bug Fixes
|
|
14
|
-
|
|
15
|
-
* resolve ESLint errors for successful build ([3f78939](https://github.com/tantainnovative/ndpr-toolkit/commit/3f7893902cc7ec67913a7e19f6a804d01e69896e))
|
|
16
|
-
* resolve type errors for successful build ([b827186](https://github.com/tantainnovative/ndpr-toolkit/commit/b8271865a77b097f0ce839ad13555b4bfe12fe2e))
|
package/CNAME
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
ndprtoolkit.com.ng
|
package/CONTRIBUTING.md
DELETED
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
# Contributing to NDPR-Toolkit
|
|
2
|
-
|
|
3
|
-
Thank you for considering contributing to the Nigerian Data Protection Compliance Toolkit! This document outlines the process for contributing to this project.
|
|
4
|
-
|
|
5
|
-
## Code of Conduct
|
|
6
|
-
|
|
7
|
-
By participating in this project, you agree to abide by our Code of Conduct. Please be respectful and considerate of others.
|
|
8
|
-
|
|
9
|
-
## How to Contribute
|
|
10
|
-
|
|
11
|
-
### Reporting Bugs
|
|
12
|
-
|
|
13
|
-
If you find a bug, please create an issue in the GitHub repository with the following information:
|
|
14
|
-
|
|
15
|
-
1. A clear, descriptive title
|
|
16
|
-
2. Steps to reproduce the bug
|
|
17
|
-
3. Expected behavior
|
|
18
|
-
4. Actual behavior
|
|
19
|
-
5. Screenshots (if applicable)
|
|
20
|
-
6. Environment information (browser, OS, etc.)
|
|
21
|
-
|
|
22
|
-
### Suggesting Features
|
|
23
|
-
|
|
24
|
-
We welcome feature suggestions! Please create an issue with:
|
|
25
|
-
|
|
26
|
-
1. A clear, descriptive title
|
|
27
|
-
2. Detailed description of the proposed feature
|
|
28
|
-
3. Any relevant examples or mockups
|
|
29
|
-
4. Explanation of why this feature would be useful to the project
|
|
30
|
-
|
|
31
|
-
### Pull Requests
|
|
32
|
-
|
|
33
|
-
We follow a standard GitHub workflow:
|
|
34
|
-
|
|
35
|
-
1. Fork the repository
|
|
36
|
-
2. Create a new branch for your feature or bug fix
|
|
37
|
-
3. Make your changes
|
|
38
|
-
4. Write or update tests as needed
|
|
39
|
-
5. Ensure all tests pass
|
|
40
|
-
6. Commit your changes using conventional commit messages
|
|
41
|
-
7. Push to your fork
|
|
42
|
-
8. Submit a pull request
|
|
43
|
-
|
|
44
|
-
### Commit Message Convention
|
|
45
|
-
|
|
46
|
-
We use conventional commits to automate versioning and changelog generation. Please format your commit messages as follows:
|
|
47
|
-
|
|
48
|
-
```
|
|
49
|
-
<type>(<scope>): <description>
|
|
50
|
-
|
|
51
|
-
[optional body]
|
|
52
|
-
|
|
53
|
-
[optional footer(s)]
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
Types include:
|
|
57
|
-
- `feat`: A new feature
|
|
58
|
-
- `fix`: A bug fix
|
|
59
|
-
- `docs`: Documentation changes
|
|
60
|
-
- `style`: Code style changes (formatting, etc.)
|
|
61
|
-
- `refactor`: Code changes that neither fix bugs nor add features
|
|
62
|
-
- `perf`: Performance improvements
|
|
63
|
-
- `test`: Adding or updating tests
|
|
64
|
-
- `chore`: Changes to the build process or auxiliary tools
|
|
65
|
-
|
|
66
|
-
Example:
|
|
67
|
-
```
|
|
68
|
-
feat(consent): add ability to customize consent banner colors
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
## Development Setup
|
|
72
|
-
|
|
73
|
-
1. Clone your fork of the repository
|
|
74
|
-
2. Install dependencies: `npm install`
|
|
75
|
-
3. Start the development server: `npm run dev`
|
|
76
|
-
4. Make your changes
|
|
77
|
-
5. Run tests: `npm test`
|
|
78
|
-
|
|
79
|
-
## Release Process
|
|
80
|
-
|
|
81
|
-
Releases are managed by the maintainers using semantic versioning. The process is automated through GitHub Actions.
|
|
82
|
-
|
|
83
|
-
## Questions?
|
|
84
|
-
|
|
85
|
-
If you have any questions about contributing, please open an issue with your question.
|
|
86
|
-
|
|
87
|
-
Thank you for contributing to the NDPR-Toolkit!
|
package/RELEASE-NOTES-v1.0.0.md
DELETED
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
# NDPR Toolkit v1.0.0 Release Notes
|
|
2
|
-
|
|
3
|
-
**Release Date:** May 4, 2025
|
|
4
|
-
**Package:** [@tantainnovative/ndpr-toolkit](https://www.npmjs.com/package/@tantainnovative/ndpr-toolkit)
|
|
5
|
-
**Version:** 1.0.0 (Initial Stable Release)
|
|
6
|
-
|
|
7
|
-
## Overview
|
|
8
|
-
|
|
9
|
-
We are excited to announce the official release of the NDPR Toolkit v1.0.0, a comprehensive solution for implementing Nigeria Data Protection Regulation (NDPR) compliance features in web applications. This enterprise-ready toolkit provides a complete set of components, hooks, and utilities to help organizations meet their NDPR compliance obligations efficiently and effectively.
|
|
10
|
-
|
|
11
|
-
## Key Features
|
|
12
|
-
|
|
13
|
-
### 1. Privacy Policy Management
|
|
14
|
-
- **PolicyGenerator**: Create customizable, NDPR-compliant privacy policies with an intuitive form interface
|
|
15
|
-
- **PolicyPreview**: Display generated policies with professional formatting and section navigation
|
|
16
|
-
- **PolicyExporter**: Export policies in multiple formats (PDF, HTML, Markdown) with compliance notices
|
|
17
|
-
|
|
18
|
-
### 2. Consent Management
|
|
19
|
-
- **ConsentBanner**: Implement cookie consent banners with customizable appearance and behavior
|
|
20
|
-
- **ConsentManager**: Track and manage user consent preferences across your application
|
|
21
|
-
- **ConsentStorage**: Securely store and retrieve consent records with built-in persistence
|
|
22
|
-
|
|
23
|
-
### 3. Data Subject Rights (DSR)
|
|
24
|
-
- **DSRRequestForm**: Collect and validate data subject requests with comprehensive form validation
|
|
25
|
-
- **DSRTracker**: Monitor the status and progress of data subject requests
|
|
26
|
-
- **DSRDashboard**: Visualize and manage all data subject requests in one place
|
|
27
|
-
|
|
28
|
-
### 4. Data Protection Impact Assessment (DPIA)
|
|
29
|
-
- **DPIAQuestionnaire**: Guide users through the DPIA process with step-by-step questionnaires
|
|
30
|
-
- **DPIAReport**: Generate comprehensive DPIA reports based on questionnaire responses
|
|
31
|
-
- **StepIndicator**: Track progress through multi-step DPIA processes
|
|
32
|
-
|
|
33
|
-
### 5. Breach Notification
|
|
34
|
-
- **BreachReportForm**: Collect essential information about data breaches
|
|
35
|
-
- **BreachRiskAssessment**: Evaluate the risk level of reported breaches
|
|
36
|
-
- **RegulatoryReportGenerator**: Create NDPR-compliant breach notification reports
|
|
37
|
-
- **BreachNotificationManager**: Manage the entire breach notification workflow
|
|
38
|
-
|
|
39
|
-
## Technical Specifications
|
|
40
|
-
|
|
41
|
-
- **Framework Compatibility**: React 18+
|
|
42
|
-
- **TypeScript Support**: Full TypeScript definitions for all components and utilities
|
|
43
|
-
- **Modular Architecture**: Use only what you need with tree-shakable imports
|
|
44
|
-
- **Customization**: Extensive theming and styling options
|
|
45
|
-
- **Accessibility**: WCAG 2.1 AA compliant components
|
|
46
|
-
- **Performance**: Optimized bundle size with minimal dependencies
|
|
47
|
-
|
|
48
|
-
## Installation
|
|
49
|
-
|
|
50
|
-
```bash
|
|
51
|
-
# Using npm
|
|
52
|
-
npm install @tantainnovative/ndpr-toolkit
|
|
53
|
-
|
|
54
|
-
# Using yarn
|
|
55
|
-
yarn add @tantainnovative/ndpr-toolkit
|
|
56
|
-
|
|
57
|
-
# Using pnpm
|
|
58
|
-
pnpm add @tantainnovative/ndpr-toolkit
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
## Usage Example
|
|
62
|
-
|
|
63
|
-
```jsx
|
|
64
|
-
import { ConsentBanner, useConsent } from '@tantainnovative/ndpr-toolkit';
|
|
65
|
-
|
|
66
|
-
function App() {
|
|
67
|
-
const { consent, updateConsent } = useConsent();
|
|
68
|
-
|
|
69
|
-
return (
|
|
70
|
-
<div className="app">
|
|
71
|
-
<ConsentBanner
|
|
72
|
-
title="Cookie Consent"
|
|
73
|
-
description="We use cookies to enhance your browsing experience."
|
|
74
|
-
cookieCategories={[
|
|
75
|
-
{ id: 'necessary', name: 'Necessary', required: true },
|
|
76
|
-
{ id: 'analytics', name: 'Analytics' },
|
|
77
|
-
{ id: 'marketing', name: 'Marketing' }
|
|
78
|
-
]}
|
|
79
|
-
onAccept={(categories) => updateConsent(categories)}
|
|
80
|
-
onReject={() => updateConsent(['necessary'])}
|
|
81
|
-
/>
|
|
82
|
-
{/* Your app content */}
|
|
83
|
-
</div>
|
|
84
|
-
);
|
|
85
|
-
}
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
## Documentation
|
|
89
|
-
|
|
90
|
-
Comprehensive documentation is available at:
|
|
91
|
-
- [GitHub Repository](https://github.com/tantainnovative/ndpr-toolkit)
|
|
92
|
-
- [Implementation Guides](https://github.com/tantainnovative/ndpr-toolkit/docs)
|
|
93
|
-
- [API Reference](https://github.com/tantainnovative/ndpr-toolkit/docs/api)
|
|
94
|
-
|
|
95
|
-
## Breaking Changes
|
|
96
|
-
|
|
97
|
-
This is the initial stable release, so there are no breaking changes from previous versions.
|
|
98
|
-
|
|
99
|
-
## Bug Fixes
|
|
100
|
-
|
|
101
|
-
- Fixed conditional rendering in policy templates
|
|
102
|
-
- Resolved issues with form validation in DSR components
|
|
103
|
-
- Improved error handling in consent management
|
|
104
|
-
- Fixed accessibility issues in UI components
|
|
105
|
-
|
|
106
|
-
## Performance Improvements
|
|
107
|
-
|
|
108
|
-
- Optimized bundle size with tree-shaking
|
|
109
|
-
- Improved rendering performance of complex forms
|
|
110
|
-
- Reduced memory usage in data management utilities
|
|
111
|
-
|
|
112
|
-
## Security Enhancements
|
|
113
|
-
|
|
114
|
-
- Implemented secure storage for consent records
|
|
115
|
-
- Added data sanitization for all user inputs
|
|
116
|
-
- Enhanced protection against XSS attacks
|
|
117
|
-
|
|
118
|
-
## Upcoming Features
|
|
119
|
-
|
|
120
|
-
We're already working on the next release, which will include:
|
|
121
|
-
- Integration with popular authentication providers
|
|
122
|
-
- Enhanced reporting capabilities
|
|
123
|
-
- Additional export formats
|
|
124
|
-
- Internationalization support
|
|
125
|
-
|
|
126
|
-
## Acknowledgements
|
|
127
|
-
|
|
128
|
-
We would like to thank all contributors and early adopters who provided valuable feedback during the development of this toolkit.
|
|
129
|
-
|
|
130
|
-
## License
|
|
131
|
-
|
|
132
|
-
MIT License - See LICENSE file for details.
|
|
133
|
-
|
|
134
|
-
## Support
|
|
135
|
-
|
|
136
|
-
For enterprise support, please contact support@tantainnovative.com
|
|
137
|
-
|
|
138
|
-
---
|
|
139
|
-
|
|
140
|
-
© 2025 Tanta Innovative. All rights reserved.
|