@tantainnovative/ndpr-toolkit 2.1.0 → 2.1.1

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025-present Abraham Esandayinze Tanta
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -109,14 +109,14 @@ import { ConsentBanner, ConsentManager, useConsent, validateConsent } from '@tan
109
109
 
110
110
  ```tsx
111
111
  <ConsentManager
112
- position="bottom"
113
- animation="slide"
114
- onConsentChange={(consent) => {
115
- if (consent.analytics) loadAnalytics();
112
+ options={[
113
+ { id: 'essential', label: 'Essential', description: 'Required for the site to function', required: true, purpose: 'Site operation' },
114
+ { id: 'analytics', label: 'Analytics', description: 'Help us improve', required: false, purpose: 'Usage analytics' },
115
+ ]}
116
+ onSave={(settings) => {
117
+ if (settings.consents.analytics) loadAnalytics();
116
118
  }}
117
- >
118
- <App />
119
- </ConsentManager>
119
+ />
120
120
  ```
121
121
 
122
122
  **Key exports:** `ConsentBanner`, `ConsentManager`, `ConsentStorage`, `useConsent`, `validateConsent`, `validateConsentOptions`
@@ -152,7 +152,7 @@ import { DPIAQuestionnaire, DPIAReport, useDPIA, assessDPIARisk } from '@tantain
152
152
  ```
153
153
 
154
154
  ```tsx
155
- const { currentSection, answers, goToNextSection, getResult } = useDPIA({
155
+ const { currentSection, answers, nextSection, completeDPIA } = useDPIA({
156
156
  sections: dpiaSections,
157
157
  onComplete: (result) => saveAssessment(result),
158
158
  });
@@ -171,7 +171,7 @@ import { BreachReportForm, BreachNotificationManager, useBreach, calculateBreach
171
171
  ```
172
172
 
173
173
  ```tsx
174
- const { createReport, reports, assessRisk } = useBreach({
174
+ const { reportBreach, reports, assessRisk } = useBreach({
175
175
  categories: breachCategories,
176
176
  onReport: (report) => notifyNDPC(report),
177
177
  });
@@ -190,7 +190,11 @@ import { PolicyGenerator, PolicyPreview, usePrivacyPolicy, generatePolicyText }
190
190
  ```
191
191
 
192
192
  ```tsx
193
- <PolicyGenerator />
193
+ <PolicyGenerator
194
+ sections={policySections}
195
+ variables={policyVariables}
196
+ onGenerate={({ content }) => console.log(content)}
197
+ />
194
198
  ```
195
199
 
196
200
  The wizard covers organization info, data collection practices, data sharing, custom sections, and a preview with export.
@@ -1,4 +1,4 @@
1
- import { B as BreachReport, R as RiskAssessment } from './breach-BpSBPrdk.mjs';
1
+ import { B as BreachReport, R as RiskAssessment } from './breach-BtFbDOmV.mjs';
2
2
 
3
3
  /**
4
4
  * Calculates the severity of a data breach based on various factors
@@ -1,4 +1,4 @@
1
- import { B as BreachReport, R as RiskAssessment } from './breach-BpSBPrdk.js';
1
+ import { B as BreachReport, R as RiskAssessment } from './breach-BtFbDOmV.js';
2
2
 
3
3
  /**
4
4
  * Calculates the severity of a data breach based on various factors
@@ -45,7 +45,7 @@ interface BreachReport {
45
45
  affectedSystems: string[];
46
46
  /** Types of data involved in the breach */
47
47
  dataTypes: string[];
48
- /** Whether sensitive personal data is involved (NDPA Section 30) */
48
+ /** Whether sensitive personal data is involved (NDPA Section 27) */
49
49
  involvesSensitiveData?: boolean;
50
50
  /** Estimated number of data subjects affected */
51
51
  estimatedAffectedSubjects?: number;
@@ -45,7 +45,7 @@ interface BreachReport {
45
45
  affectedSystems: string[];
46
46
  /** Types of data involved in the breach */
47
47
  dataTypes: string[];
48
- /** Whether sensitive personal data is involved (NDPA Section 30) */
48
+ /** Whether sensitive personal data is involved (NDPA Section 27) */
49
49
  involvesSensitiveData?: boolean;
50
50
  /** Estimated number of data subjects affected */
51
51
  estimatedAffectedSubjects?: number;
package/dist/breach.d.mts CHANGED
@@ -1,8 +1,8 @@
1
1
  import React from 'react';
2
- import { a as BreachCategory, B as BreachReport, R as RiskAssessment, b as RegulatoryNotification } from './breach-BpSBPrdk.mjs';
3
- export { N as NotificationRequirement } from './breach-BpSBPrdk.mjs';
4
- export { u as useBreach } from './useBreach-DRKnexsk.mjs';
5
- export { c as calculateBreachSeverity } from './breach-D5zJYNph.mjs';
2
+ import { a as BreachCategory, B as BreachReport, R as RiskAssessment, b as RegulatoryNotification } from './breach-BtFbDOmV.mjs';
3
+ export { N as NotificationRequirement } from './breach-BtFbDOmV.mjs';
4
+ export { u as useBreach } from './useBreach-WrZzJilM.mjs';
5
+ export { c as calculateBreachSeverity } from './breach-6z0r-KuE.mjs';
6
6
 
7
7
  interface BreachReportFormProps {
8
8
  /**
package/dist/breach.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import React from 'react';
2
- import { a as BreachCategory, B as BreachReport, R as RiskAssessment, b as RegulatoryNotification } from './breach-BpSBPrdk.js';
3
- export { N as NotificationRequirement } from './breach-BpSBPrdk.js';
4
- export { u as useBreach } from './useBreach-DuT0N0K1.js';
5
- export { c as calculateBreachSeverity } from './breach-D7NgrdMX.js';
2
+ import { a as BreachCategory, B as BreachReport, R as RiskAssessment, b as RegulatoryNotification } from './breach-BtFbDOmV.js';
3
+ export { N as NotificationRequirement } from './breach-BtFbDOmV.js';
4
+ export { u as useBreach } from './useBreach-vrh_XMpI.js';
5
+ export { c as calculateBreachSeverity } from './breach-BFfnvtRk.js';
6
6
 
7
7
  interface BreachReportFormProps {
8
8
  /**
@@ -0,0 +1,2 @@
1
+ 'use strict';var chunkSSGJREE3_js=require('./chunk-SSGJREE3.js'),chunkMQFZHA2D_js=require('./chunk-MQFZHA2D.js'),react=require('react');function J({sections:u,initialAnswers:Q={},storageKey:d="ndpr_dpia_data",useLocalStorage:f=true,onComplete:A}){let[c,m]=react.useState(0),[i,g]=react.useState(Q);react.useEffect(()=>{if(f&&typeof window!="undefined")try{let r=localStorage.getItem(d);if(r){let{answers:n,sectionIndex:e}=JSON.parse(r);g(n||{}),m(e||0);}}catch(r){console.error("Error loading DPIA data:",r);}},[d,f]),react.useEffect(()=>{if(f&&typeof window!="undefined")try{localStorage.setItem(d,JSON.stringify({answers:i,sectionIndex:c}));}catch(r){console.error("Error saving DPIA data:",r);}},[i,c,d,f]);let p=u[c]||null,E=(r,n)=>{g(e=>chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},e),{[r]:n}));},v=r=>r.showWhen?r.showWhen.every(n=>{let e=i[n.questionId];switch(n.operator){case "equals":return e===n.value;case "contains":return Array.isArray(e)?e.includes(n.value):false;case "greaterThan":return typeof e=="number"?e>n.value:false;case "lessThan":return typeof e=="number"?e<n.value:false;default:return true}}):true,h=()=>p?p.questions.filter(v):[],I=()=>p?h().every(n=>{if(!n.required)return true;let e=i[n.id];return !(e==null||typeof e=="string"&&e.trim()===""||Array.isArray(e)&&e.length===0)}):false,x=()=>{let r={};return p&&h().forEach(e=>{if(!e.required)return;let t=i[e.id];t==null||typeof t=="string"&&t.trim()===""?r[e.id]="This question is required":Array.isArray(t)&&t.length===0&&(r[e.id]="At least one option must be selected");}),r},T=()=>I()&&c<u.length-1?(m(r=>r+1),true):false,C=()=>c>0?(m(r=>r-1),true):false,L=r=>r>=0&&r<u.length?(m(r),true):false,O=()=>u.every(r=>r.questions.filter(e=>!e.showWhen||e.showWhen.length===0?true:e.showWhen.some(t=>{let s=i[t.questionId];switch(t.operator){case "equals":return s===t.value;case "contains":return Array.isArray(s)&&s.includes(t.value);case "greaterThan":return typeof s=="number"&&s>t.value;case "lessThan":return typeof s=="number"&&s<t.value;default:return false}})).every(e=>{if(!e.required)return true;let t=i[e.id];return !(t==null||typeof t=="string"&&t.trim()===""||Array.isArray(t)&&t.length===0)})),W=()=>{let r=[];return u.forEach(n=>{n.questions.forEach(e=>{let t=i[e.id];if(t!=null&&e.riskLevel)if(["select","radio","checkbox"].includes(e.type)&&e.options)(Array.isArray(t)?t:[t]).forEach(o=>{var w;let a=(w=e.options)==null?void 0:w.find(l=>l.value===o);if(a!=null&&a.riskLevel){let l=a.riskLevel,y=l==="low"?1:l==="medium"?3:5,b=l==="low"?1:l==="medium"?3:5;r.push({id:`risk_${r.length+1}`,description:`${e.text} - ${a.label}`,likelihood:y,impact:b,score:y*b,level:l,mitigated:false,relatedQuestionIds:[e.id]});}});else {let s=e.riskLevel,o=s==="low"?1:s==="medium"?3:5,a=s==="low"?1:s==="medium"?3:5;r.push({id:`risk_${r.length+1}`,description:e.text,likelihood:o,impact:a,score:o*a,level:s,mitigated:false,relatedQuestionIds:[e.id]});}});}),r},_=(r,n,e)=>{let t=W(),s={id:`dpia_${Date.now()}`,title:n,processingDescription:e,startedAt:Date.now(),completedAt:Date.now(),assessor:r,answers:i,risks:t,overallRiskLevel:"low",canProceed:true,conclusion:"",version:"1.0"},o=chunkSSGJREE3_js.a(s);return s.overallRiskLevel=o.overallRiskLevel,s.canProceed=o.canProceed,s.conclusion=o.canProceed?"Based on the assessment, the processing can proceed with appropriate safeguards.":"Based on the assessment, the processing should not proceed without further mitigation measures.",s.recommendations=o.recommendations,A&&A(s),s},$=()=>{g({}),m(0),f&&typeof window!="undefined"&&localStorage.removeItem(d);},U=(()=>{let r=0,n=0;return u.forEach(e=>{e.questions.forEach(t=>{if(t.required&&v(t)){n++;let s=i[t.id];s!=null&&!(typeof s=="string"&&s.trim()==="")&&!(Array.isArray(s)&&s.length===0)&&r++;}});}),n>0?Math.round(r/n*100):0})();return {currentSectionIndex:c,currentSection:p,answers:i,updateAnswer:E,nextSection:T,prevSection:C,goToSection:L,isCurrentSectionValid:I,getCurrentSectionErrors:x,isComplete:O,completeDPIA:_,getVisibleQuestions:h,resetDPIA:$,progress:U}}exports.a=J;//# sourceMappingURL=chunk-3YCV2BA6.js.map
2
+ //# sourceMappingURL=chunk-3YCV2BA6.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../packages/ndpr-toolkit/src/hooks/useDPIA.ts"],"names":["useDPIA","sections","initialAnswers","storageKey","useLocalStorage","onComplete","currentSectionIndex","setCurrentSectionIndex","useState","answers","setAnswers","useEffect","savedData","savedAnswers","sectionIndex","error","currentSection","updateAnswer","questionId","value","prevAnswers","__spreadProps","__spreadValues","shouldShowQuestion","question","condition","answer","getVisibleQuestions","isCurrentSectionValid","getCurrentSectionErrors","errors","nextSection","prevIndex","prevSection","goToSection","index","isComplete","section","q","identifyRisks","risks","selectedOption","_a","option","opt","riskLevel","likelihood","impact","completeDPIA","assessorInfo","title","processingDescription","result","assessment","assessDPIARisk","resetDPIA","progress","answeredQuestions","totalRequiredQuestions"],"mappings":"wIA4GO,SAASA,CAAAA,CAAQ,CACtB,QAAA,CAAAC,CAAAA,CACA,cAAA,CAAAC,EAAiB,EAAC,CAClB,WAAAC,CAAAA,CAAa,gBAAA,CACb,gBAAAC,CAAAA,CAAkB,IAAA,CAClB,UAAA,CAAAC,CACF,CAAA,CAAkC,CAChC,GAAM,CAACC,CAAAA,CAAqBC,CAAsB,CAAA,CAAIC,cAAAA,CAAiB,CAAC,CAAA,CAClE,CAACC,CAAAA,CAASC,CAAU,CAAA,CAAIF,cAAAA,CAA8BN,CAAc,CAAA,CAG1ES,eAAAA,CAAU,IAAM,CACd,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EAAoB,CAAA,CACpBC,CAAAA,CAAyB,CAAA,CAE7B,OAAAzD,CAAAA,CAAS,OAAA,CAAQoC,GAAW,CAC1BA,CAAAA,CAAQ,SAAA,CAAU,OAAA,CAAQb,CAAAA,EAAY,CACpC,GAAIA,CAAAA,CAAS,QAAA,EAAYD,EAAmBC,CAAQ,CAAA,CAAG,CACrDkC,CAAAA,EAAAA,CAEA,IAAMhC,CAAAA,CAASjB,CAAAA,CAAQe,CAAAA,CAAS,EAAE,EAGhCE,CAAAA,EAAW,IAAA,EACX,EAAE,OAAOA,CAAAA,EAAW,QAAA,EAAYA,EAAO,IAAA,EAAK,GAAM,EAAA,CAAA,EAClD,EAAE,KAAA,CAAM,OAAA,CAAQA,CAAM,CAAA,EAAKA,CAAAA,CAAO,SAAW,CAAA,CAAA,EAE7C+B,CAAAA,GAEJ,CACF,CAAC,EACH,CAAC,CAAA,CAEMC,CAAAA,CAAyB,CAAA,CAC5B,KAAK,KAAA,CAAOD,CAAAA,CAAoBC,CAAAA,CAA0B,GAAG,CAAA,CAC7D,CACN,IAAG,CAEH,OAAO,CACL,mBAAA,CAAApD,CAAAA,CACA,cAAA,CAAAU,EACA,OAAA,CAAAP,CAAAA,CACA,aAAAQ,CAAAA,CACA,WAAA,CAAAc,EACA,WAAA,CAAAE,CAAAA,CACA,WAAA,CAAAC,CAAAA,CACA,qBAAA,CAAAN,CAAAA,CACA,wBAAAC,CAAAA,CACA,UAAA,CAAAO,CAAAA,CACA,YAAA,CAAAY,CAAAA,CACA,mBAAA,CAAArB,EACA,SAAA,CAAA4B,CAAAA,CACA,QAAA,CAAAC,CACF,CACF","file":"chunk-3YCV2BA6.js","sourcesContent":["import { useState, useEffect } from 'react';\nimport { DPIAQuestion, DPIASection, DPIAResult, DPIARisk } from '../types/dpia';\nimport { assessDPIARisk } from '../utils/dpia';\n\ninterface UseDPIAOptions {\n /**\n * Sections of the DPIA questionnaire\n */\n sections: DPIASection[];\n \n /**\n * Initial answers (if resuming a DPIA)\n */\n initialAnswers?: Record<string, any>;\n \n /**\n * Storage key for DPIA data\n * @default \"ndpr_dpia_data\"\n */\n storageKey?: string;\n \n /**\n * Whether to use local storage to persist DPIA data\n * @default true\n */\n useLocalStorage?: boolean;\n \n /**\n * Callback function called when the DPIA is completed\n */\n onComplete?: (result: DPIAResult) => void;\n}\n\ninterface UseDPIAReturn {\n /**\n * Current section index\n */\n currentSectionIndex: number;\n \n /**\n * Current section\n */\n currentSection: DPIASection | null;\n \n /**\n * All answers\n */\n answers: Record<string, any>;\n \n /**\n * Update an answer\n */\n updateAnswer: (questionId: string, value: any) => void;\n \n /**\n * Go to the next section\n */\n nextSection: () => boolean;\n \n /**\n * Go to the previous section\n */\n prevSection: () => boolean;\n \n /**\n * Go to a specific section\n */\n goToSection: (index: number) => boolean;\n \n /**\n * Check if the current section is valid\n */\n isCurrentSectionValid: () => boolean;\n \n /**\n * Get validation errors for the current section\n */\n getCurrentSectionErrors: () => Record<string, string>;\n \n /**\n * Check if the DPIA is complete\n */\n isComplete: () => boolean;\n \n /**\n * Complete the DPIA and generate a result\n */\n completeDPIA: (assessorInfo: { name: string; role: string; email: string; }, title: string, processingDescription: string) => DPIAResult;\n \n /**\n * Get the visible questions for the current section\n */\n getVisibleQuestions: () => DPIAQuestion[];\n \n /**\n * Reset the DPIA\n */\n resetDPIA: () => void;\n \n /**\n * Progress percentage\n */\n progress: number;\n}\n\n/**\n * Hook for conducting Data Protection Impact Assessments in compliance with the NDPA 2023\n */\nexport function useDPIA({\n sections,\n initialAnswers = {},\n storageKey = \"ndpr_dpia_data\",\n useLocalStorage = true,\n onComplete\n}: UseDPIAOptions): UseDPIAReturn {\n const [currentSectionIndex, setCurrentSectionIndex] = useState<number>(0);\n const [answers, setAnswers] = useState<Record<string, any>>(initialAnswers);\n \n // Load DPIA data from storage on mount\n useEffect(() => {\n if (useLocalStorage && typeof window !== 'undefined') {\n try {\n const savedData = localStorage.getItem(storageKey);\n if (savedData) {\n const { answers: savedAnswers, sectionIndex } = JSON.parse(savedData);\n setAnswers(savedAnswers || {});\n setCurrentSectionIndex(sectionIndex || 0);\n }\n } catch (error) {\n console.error('Error loading DPIA data:', error);\n }\n }\n }, [storageKey, useLocalStorage]);\n \n // Save DPIA data to storage when it changes\n useEffect(() => {\n if (useLocalStorage && typeof window !== 'undefined') {\n try {\n localStorage.setItem(storageKey, JSON.stringify({\n answers,\n sectionIndex: currentSectionIndex\n }));\n } catch (error) {\n console.error('Error saving DPIA data:', error);\n }\n }\n }, [answers, currentSectionIndex, storageKey, useLocalStorage]);\n \n // Get the current section\n const currentSection = sections[currentSectionIndex] || null;\n \n // Update an answer\n const updateAnswer = (questionId: string, value: any) => {\n setAnswers(prevAnswers => ({\n ...prevAnswers,\n [questionId]: value\n }));\n };\n \n // Check if a question should be shown based on its conditions\n const shouldShowQuestion = (question: DPIAQuestion): boolean => {\n if (!question.showWhen) {\n return true;\n }\n \n return question.showWhen.every(condition => {\n const answer = answers[condition.questionId];\n \n switch (condition.operator) {\n case 'equals':\n return answer === condition.value;\n case 'contains':\n return Array.isArray(answer) ? answer.includes(condition.value) : false;\n case 'greaterThan':\n return typeof answer === 'number' ? answer > condition.value : false;\n case 'lessThan':\n return typeof answer === 'number' ? answer < condition.value : false;\n default:\n return true;\n }\n });\n };\n \n // Get the visible questions for the current section\n const getVisibleQuestions = (): DPIAQuestion[] => {\n if (!currentSection) {\n return [];\n }\n \n return currentSection.questions.filter(shouldShowQuestion);\n };\n \n // Check if the current section is valid\n const isCurrentSectionValid = (): boolean => {\n if (!currentSection) {\n return false;\n }\n \n const visibleQuestions = getVisibleQuestions();\n \n return visibleQuestions.every(question => {\n if (!question.required) {\n return true;\n }\n \n const answer = answers[question.id];\n \n if (answer === undefined || answer === null) {\n return false;\n }\n \n if (typeof answer === 'string' && answer.trim() === '') {\n return false;\n }\n \n if (Array.isArray(answer) && answer.length === 0) {\n return false;\n }\n \n return true;\n });\n };\n \n // Get validation errors for the current section\n const getCurrentSectionErrors = (): Record<string, string> => {\n const errors: Record<string, string> = {};\n \n if (!currentSection) {\n return errors;\n }\n \n const visibleQuestions = getVisibleQuestions();\n \n visibleQuestions.forEach(question => {\n if (!question.required) {\n return;\n }\n \n const answer = answers[question.id];\n \n if (answer === undefined || answer === null) {\n errors[question.id] = 'This question is required';\n } else if (typeof answer === 'string' && answer.trim() === '') {\n errors[question.id] = 'This question is required';\n } else if (Array.isArray(answer) && answer.length === 0) {\n errors[question.id] = 'At least one option must be selected';\n }\n });\n \n return errors;\n };\n \n // Go to the next section\n const nextSection = (): boolean => {\n if (!isCurrentSectionValid()) {\n return false;\n }\n \n if (currentSectionIndex < sections.length - 1) {\n setCurrentSectionIndex(prevIndex => prevIndex + 1);\n return true;\n }\n \n return false;\n };\n \n // Go to the previous section\n const prevSection = (): boolean => {\n if (currentSectionIndex > 0) {\n setCurrentSectionIndex(prevIndex => prevIndex - 1);\n return true;\n }\n \n return false;\n };\n \n // Go to a specific section\n const goToSection = (index: number): boolean => {\n if (index >= 0 && index < sections.length) {\n setCurrentSectionIndex(index);\n return true;\n }\n \n return false;\n };\n \n // Check if the DPIA is complete (pure read — no state mutation)\n const isComplete = (): boolean => {\n return sections.every((section) => {\n const visibleQuestions = section.questions.filter(q => {\n if (!q.showWhen || q.showWhen.length === 0) return true;\n return q.showWhen.some(condition => {\n const answer = answers[condition.questionId];\n switch (condition.operator) {\n case 'equals': return answer === condition.value;\n case 'contains': return Array.isArray(answer) && answer.includes(condition.value);\n case 'greaterThan': return typeof answer === 'number' && answer > condition.value;\n case 'lessThan': return typeof answer === 'number' && answer < condition.value;\n default: return false;\n }\n });\n });\n\n return visibleQuestions.every(q => {\n if (!q.required) return true;\n const answer = answers[q.id];\n if (answer === undefined || answer === null) return false;\n if (typeof answer === 'string' && answer.trim() === '') return false;\n if (Array.isArray(answer) && answer.length === 0) return false;\n return true;\n });\n });\n };\n \n // Identify risks based on answers\n const identifyRisks = (): DPIARisk[] => {\n const risks: DPIARisk[] = [];\n \n // Check each question for risk indicators\n sections.forEach(section => {\n section.questions.forEach(question => {\n const answer = answers[question.id];\n \n // Skip if no answer\n if (answer === undefined || answer === null) {\n return;\n }\n \n // Check if the question has a risk level\n if (question.riskLevel) {\n // For select/radio/checkbox questions, check if the selected option has a risk level\n if (['select', 'radio', 'checkbox'].includes(question.type) && question.options) {\n const selectedOptions = Array.isArray(answer) ? answer : [answer];\n \n selectedOptions.forEach(selectedOption => {\n const option = question.options?.find(opt => opt.value === selectedOption);\n \n if (option?.riskLevel) {\n const riskLevel = option.riskLevel;\n const likelihood = riskLevel === 'low' ? 1 : riskLevel === 'medium' ? 3 : 5;\n const impact = riskLevel === 'low' ? 1 : riskLevel === 'medium' ? 3 : 5;\n \n risks.push({\n id: `risk_${risks.length + 1}`,\n description: `${question.text} - ${option.label}`,\n likelihood,\n impact,\n score: likelihood * impact,\n level: riskLevel,\n mitigated: false,\n relatedQuestionIds: [question.id]\n });\n }\n });\n } else {\n // For other question types, use the question's risk level\n const riskLevel = question.riskLevel;\n const likelihood = riskLevel === 'low' ? 1 : riskLevel === 'medium' ? 3 : 5;\n const impact = riskLevel === 'low' ? 1 : riskLevel === 'medium' ? 3 : 5;\n \n risks.push({\n id: `risk_${risks.length + 1}`,\n description: question.text,\n likelihood,\n impact,\n score: likelihood * impact,\n level: riskLevel,\n mitigated: false,\n relatedQuestionIds: [question.id]\n });\n }\n }\n });\n });\n \n return risks;\n };\n \n // Complete the DPIA and generate a result\n const completeDPIA = (\n assessorInfo: { name: string; role: string; email: string; },\n title: string,\n processingDescription: string\n ): DPIAResult => {\n const risks = identifyRisks();\n \n const result: DPIAResult = {\n id: `dpia_${Date.now()}`,\n title,\n processingDescription,\n startedAt: Date.now(),\n completedAt: Date.now(),\n assessor: assessorInfo,\n answers,\n risks,\n overallRiskLevel: 'low',\n canProceed: true,\n conclusion: '',\n version: '1.0'\n };\n \n // Assess the risks\n const assessment = assessDPIARisk(result);\n \n result.overallRiskLevel = assessment.overallRiskLevel;\n result.canProceed = assessment.canProceed;\n result.conclusion = assessment.canProceed\n ? 'Based on the assessment, the processing can proceed with appropriate safeguards.'\n : 'Based on the assessment, the processing should not proceed without further mitigation measures.';\n result.recommendations = assessment.recommendations;\n \n if (onComplete) {\n onComplete(result);\n }\n \n return result;\n };\n \n // Reset the DPIA\n const resetDPIA = () => {\n setAnswers({});\n setCurrentSectionIndex(0);\n \n if (useLocalStorage && typeof window !== 'undefined') {\n localStorage.removeItem(storageKey);\n }\n };\n \n // Calculate progress percentage\n const progress = (() => {\n let answeredQuestions = 0;\n let totalRequiredQuestions = 0;\n \n sections.forEach(section => {\n section.questions.forEach(question => {\n if (question.required && shouldShowQuestion(question)) {\n totalRequiredQuestions++;\n \n const answer = answers[question.id];\n if (\n answer !== undefined && \n answer !== null && \n !(typeof answer === 'string' && answer.trim() === '') &&\n !(Array.isArray(answer) && answer.length === 0)\n ) {\n answeredQuestions++;\n }\n }\n });\n });\n \n return totalRequiredQuestions > 0 \n ? Math.round((answeredQuestions / totalRequiredQuestions) * 100) \n : 0;\n })();\n \n return {\n currentSectionIndex,\n currentSection,\n answers,\n updateAnswer,\n nextSection,\n prevSection,\n goToSection,\n isCurrentSectionValid,\n getCurrentSectionErrors,\n isComplete,\n completeDPIA,\n getVisibleQuestions,\n resetDPIA,\n progress\n };\n}\n"]}
@@ -0,0 +1,2 @@
1
+ import {a as a$1}from'./chunk-PGSA2O5P.mjs';import {b,a}from'./chunk-WWT2ZSNU.mjs';import {useState,useEffect}from'react';function J({sections:u,initialAnswers:Q={},storageKey:d="ndpr_dpia_data",useLocalStorage:f=true,onComplete:A}){let[c,m]=useState(0),[i,g]=useState(Q);useEffect(()=>{if(f&&typeof window!="undefined")try{let r=localStorage.getItem(d);if(r){let{answers:n,sectionIndex:e}=JSON.parse(r);g(n||{}),m(e||0);}}catch(r){console.error("Error loading DPIA data:",r);}},[d,f]),useEffect(()=>{if(f&&typeof window!="undefined")try{localStorage.setItem(d,JSON.stringify({answers:i,sectionIndex:c}));}catch(r){console.error("Error saving DPIA data:",r);}},[i,c,d,f]);let p=u[c]||null,E=(r,n)=>{g(e=>b(a({},e),{[r]:n}));},v=r=>r.showWhen?r.showWhen.every(n=>{let e=i[n.questionId];switch(n.operator){case "equals":return e===n.value;case "contains":return Array.isArray(e)?e.includes(n.value):false;case "greaterThan":return typeof e=="number"?e>n.value:false;case "lessThan":return typeof e=="number"?e<n.value:false;default:return true}}):true,h=()=>p?p.questions.filter(v):[],I=()=>p?h().every(n=>{if(!n.required)return true;let e=i[n.id];return !(e==null||typeof e=="string"&&e.trim()===""||Array.isArray(e)&&e.length===0)}):false,x=()=>{let r={};return p&&h().forEach(e=>{if(!e.required)return;let t=i[e.id];t==null||typeof t=="string"&&t.trim()===""?r[e.id]="This question is required":Array.isArray(t)&&t.length===0&&(r[e.id]="At least one option must be selected");}),r},T=()=>I()&&c<u.length-1?(m(r=>r+1),true):false,C=()=>c>0?(m(r=>r-1),true):false,L=r=>r>=0&&r<u.length?(m(r),true):false,O=()=>u.every(r=>r.questions.filter(e=>!e.showWhen||e.showWhen.length===0?true:e.showWhen.some(t=>{let s=i[t.questionId];switch(t.operator){case "equals":return s===t.value;case "contains":return Array.isArray(s)&&s.includes(t.value);case "greaterThan":return typeof s=="number"&&s>t.value;case "lessThan":return typeof s=="number"&&s<t.value;default:return false}})).every(e=>{if(!e.required)return true;let t=i[e.id];return !(t==null||typeof t=="string"&&t.trim()===""||Array.isArray(t)&&t.length===0)})),W=()=>{let r=[];return u.forEach(n=>{n.questions.forEach(e=>{let t=i[e.id];if(t!=null&&e.riskLevel)if(["select","radio","checkbox"].includes(e.type)&&e.options)(Array.isArray(t)?t:[t]).forEach(o=>{var w;let a=(w=e.options)==null?void 0:w.find(l=>l.value===o);if(a!=null&&a.riskLevel){let l=a.riskLevel,y=l==="low"?1:l==="medium"?3:5,b=l==="low"?1:l==="medium"?3:5;r.push({id:`risk_${r.length+1}`,description:`${e.text} - ${a.label}`,likelihood:y,impact:b,score:y*b,level:l,mitigated:false,relatedQuestionIds:[e.id]});}});else {let s=e.riskLevel,o=s==="low"?1:s==="medium"?3:5,a=s==="low"?1:s==="medium"?3:5;r.push({id:`risk_${r.length+1}`,description:e.text,likelihood:o,impact:a,score:o*a,level:s,mitigated:false,relatedQuestionIds:[e.id]});}});}),r},_=(r,n,e)=>{let t=W(),s={id:`dpia_${Date.now()}`,title:n,processingDescription:e,startedAt:Date.now(),completedAt:Date.now(),assessor:r,answers:i,risks:t,overallRiskLevel:"low",canProceed:true,conclusion:"",version:"1.0"},o=a$1(s);return s.overallRiskLevel=o.overallRiskLevel,s.canProceed=o.canProceed,s.conclusion=o.canProceed?"Based on the assessment, the processing can proceed with appropriate safeguards.":"Based on the assessment, the processing should not proceed without further mitigation measures.",s.recommendations=o.recommendations,A&&A(s),s},$=()=>{g({}),m(0),f&&typeof window!="undefined"&&localStorage.removeItem(d);},U=(()=>{let r=0,n=0;return u.forEach(e=>{e.questions.forEach(t=>{if(t.required&&v(t)){n++;let s=i[t.id];s!=null&&!(typeof s=="string"&&s.trim()==="")&&!(Array.isArray(s)&&s.length===0)&&r++;}});}),n>0?Math.round(r/n*100):0})();return {currentSectionIndex:c,currentSection:p,answers:i,updateAnswer:E,nextSection:T,prevSection:C,goToSection:L,isCurrentSectionValid:I,getCurrentSectionErrors:x,isComplete:O,completeDPIA:_,getVisibleQuestions:h,resetDPIA:$,progress:U}}export{J as a};//# sourceMappingURL=chunk-6GGGTRDZ.mjs.map
2
+ //# sourceMappingURL=chunk-6GGGTRDZ.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../packages/ndpr-toolkit/src/hooks/useDPIA.ts"],"names":["useDPIA","sections","initialAnswers","storageKey","useLocalStorage","onComplete","currentSectionIndex","setCurrentSectionIndex","useState","answers","setAnswers","useEffect","savedData","savedAnswers","sectionIndex","error","currentSection","updateAnswer","questionId","value","prevAnswers","__spreadProps","__spreadValues","shouldShowQuestion","question","condition","answer","getVisibleQuestions","isCurrentSectionValid","getCurrentSectionErrors","errors","nextSection","prevIndex","prevSection","goToSection","index","isComplete","section","q","identifyRisks","risks","selectedOption","_a","option","opt","riskLevel","likelihood","impact","completeDPIA","assessorInfo","title","processingDescription","result","assessment","assessDPIARisk","resetDPIA","progress","answeredQuestions","totalRequiredQuestions"],"mappings":"0HA4GO,SAASA,CAAAA,CAAQ,CACtB,QAAA,CAAAC,CAAAA,CACA,cAAA,CAAAC,EAAiB,EAAC,CAClB,WAAAC,CAAAA,CAAa,gBAAA,CACb,gBAAAC,CAAAA,CAAkB,IAAA,CAClB,UAAA,CAAAC,CACF,CAAA,CAAkC,CAChC,GAAM,CAACC,CAAAA,CAAqBC,CAAsB,CAAA,CAAIC,QAAAA,CAAiB,CAAC,CAAA,CAClE,CAACC,CAAAA,CAASC,CAAU,CAAA,CAAIF,QAAAA,CAA8BN,CAAc,CAAA,CAG1ES,SAAAA,CAAU,IAAM,CACd,GAAIP,CAAAA,EAAmB,OAAO,MAAA,EAAW,WAAA,CACvC,GAAI,CACF,IAAMQ,CAAAA,CAAY,aAAa,OAAA,CAAQT,CAAU,EACjD,GAAIS,CAAAA,CAAW,CACb,GAAM,CAAE,OAAA,CAASC,CAAAA,CAAc,YAAA,CAAAC,CAAa,EAAI,IAAA,CAAK,KAAA,CAAMF,CAAS,CAAA,CACpEF,CAAAA,CAAWG,CAAAA,EAAgB,EAAE,CAAA,CAC7BN,CAAAA,CAAuBO,CAAAA,EAAgB,CAAC,EAC1C,CACF,CAAA,MAASC,CAAAA,CAAO,CACd,OAAA,CAAQ,KAAA,CAAM,2BAA4BA,CAAK,EACjD,CAEJ,CAAA,CAAG,CAACZ,CAAAA,CAAYC,CAAe,CAAC,CAAA,CAGhCO,SAAAA,CAAU,IAAM,CACd,GAAIP,GAAmB,OAAO,MAAA,EAAW,WAAA,CACvC,GAAI,CACF,YAAA,CAAa,QAAQD,CAAAA,CAAY,IAAA,CAAK,UAAU,CAC9C,OAAA,CAAAM,EACA,YAAA,CAAcH,CAChB,CAAC,CAAC,E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L,mBAAA,CAAApD,CAAAA,CACA,cAAA,CAAAU,EACA,OAAA,CAAAP,CAAAA,CACA,aAAAQ,CAAAA,CACA,WAAA,CAAAc,EACA,WAAA,CAAAE,CAAAA,CACA,WAAA,CAAAC,CAAAA,CACA,qBAAA,CAAAN,CAAAA,CACA,wBAAAC,CAAAA,CACA,UAAA,CAAAO,CAAAA,CACA,YAAA,CAAAY,CAAAA,CACA,mBAAA,CAAArB,EACA,SAAA,CAAA4B,CAAAA,CACA,QAAA,CAAAC,CACF,CACF","file":"chunk-6GGGTRDZ.mjs","sourcesContent":["import { useState, useEffect } from 'react';\nimport { DPIAQuestion, DPIASection, DPIAResult, DPIARisk } from '../types/dpia';\nimport { assessDPIARisk } from '../utils/dpia';\n\ninterface UseDPIAOptions {\n /**\n * Sections of the DPIA questionnaire\n */\n sections: DPIASection[];\n \n /**\n * Initial answers (if resuming a DPIA)\n */\n initialAnswers?: Record<string, any>;\n \n /**\n * Storage key for DPIA data\n * @default \"ndpr_dpia_data\"\n */\n storageKey?: string;\n \n /**\n * Whether to use local storage to persist DPIA data\n * @default true\n */\n useLocalStorage?: boolean;\n \n /**\n * Callback function called when the DPIA is completed\n */\n onComplete?: (result: DPIAResult) => void;\n}\n\ninterface UseDPIAReturn {\n /**\n * Current section index\n */\n currentSectionIndex: number;\n \n /**\n * Current section\n */\n currentSection: DPIASection | null;\n \n /**\n * All answers\n */\n answers: Record<string, any>;\n \n /**\n * Update an answer\n */\n updateAnswer: (questionId: string, value: any) => void;\n \n /**\n * Go to the next section\n */\n nextSection: () => boolean;\n \n /**\n * Go to the previous section\n */\n prevSection: () => boolean;\n \n /**\n * Go to a specific section\n */\n goToSection: (index: number) => boolean;\n \n /**\n * Check if the current section is valid\n */\n isCurrentSectionValid: () => boolean;\n \n /**\n * Get validation errors for the current section\n */\n getCurrentSectionErrors: () => Record<string, string>;\n \n /**\n * Check if the DPIA is complete\n */\n isComplete: () => boolean;\n \n /**\n * Complete the DPIA and generate a result\n */\n completeDPIA: (assessorInfo: { name: string; role: string; email: string; }, title: string, processingDescription: string) => DPIAResult;\n \n /**\n * Get the visible questions for the current section\n */\n getVisibleQuestions: () => DPIAQuestion[];\n \n /**\n * Reset the DPIA\n */\n resetDPIA: () => void;\n \n /**\n * Progress percentage\n */\n progress: number;\n}\n\n/**\n * Hook for conducting Data Protection Impact Assessments in compliance with the NDPA 2023\n */\nexport function useDPIA({\n sections,\n initialAnswers = {},\n storageKey = \"ndpr_dpia_data\",\n useLocalStorage = true,\n onComplete\n}: UseDPIAOptions): UseDPIAReturn {\n const [currentSectionIndex, setCurrentSectionIndex] = useState<number>(0);\n const [answers, setAnswers] = useState<Record<string, any>>(initialAnswers);\n \n // Load DPIA data from storage on mount\n useEffect(() => {\n if (useLocalStorage && typeof window !== 'undefined') {\n try {\n const savedData = localStorage.getItem(storageKey);\n if (savedData) {\n const { answers: savedAnswers, sectionIndex } = JSON.parse(savedData);\n setAnswers(savedAnswers || {});\n setCurrentSectionIndex(sectionIndex || 0);\n }\n } catch (error) {\n console.error('Error loading DPIA data:', error);\n }\n }\n }, [storageKey, useLocalStorage]);\n \n // Save DPIA data to storage when it changes\n useEffect(() => {\n if (useLocalStorage && typeof window !== 'undefined') {\n try {\n localStorage.setItem(storageKey, JSON.stringify({\n answers,\n sectionIndex: currentSectionIndex\n }));\n } catch (error) {\n console.error('Error saving DPIA data:', error);\n }\n }\n }, [answers, currentSectionIndex, storageKey, useLocalStorage]);\n \n // Get the current section\n const currentSection = sections[currentSectionIndex] || null;\n \n // Update an answer\n const updateAnswer = (questionId: string, value: any) => {\n setAnswers(prevAnswers => ({\n ...prevAnswers,\n [questionId]: value\n }));\n };\n \n // Check if a question should be shown based on its conditions\n const shouldShowQuestion = (question: DPIAQuestion): boolean => {\n if (!question.showWhen) {\n return true;\n }\n \n return question.showWhen.every(condition => {\n const answer = answers[condition.questionId];\n \n switch (condition.operator) {\n case 'equals':\n return answer === condition.value;\n case 'contains':\n return Array.isArray(answer) ? answer.includes(condition.value) : false;\n case 'greaterThan':\n return typeof answer === 'number' ? answer > condition.value : false;\n case 'lessThan':\n return typeof answer === 'number' ? answer < condition.value : false;\n default:\n return true;\n }\n });\n };\n \n // Get the visible questions for the current section\n const getVisibleQuestions = (): DPIAQuestion[] => {\n if (!currentSection) {\n return [];\n }\n \n return currentSection.questions.filter(shouldShowQuestion);\n };\n \n // Check if the current section is valid\n const isCurrentSectionValid = (): boolean => {\n if (!currentSection) {\n return false;\n }\n \n const visibleQuestions = getVisibleQuestions();\n \n return visibleQuestions.every(question => {\n if (!question.required) {\n return true;\n }\n \n const answer = answers[question.id];\n \n if (answer === undefined || answer === null) {\n return false;\n }\n \n if (typeof answer === 'string' && answer.trim() === '') {\n return false;\n }\n \n if (Array.isArray(answer) && answer.length === 0) {\n return false;\n }\n \n return true;\n });\n };\n \n // Get validation errors for the current section\n const getCurrentSectionErrors = (): Record<string, string> => {\n const errors: Record<string, string> = {};\n \n if (!currentSection) {\n return errors;\n }\n \n const visibleQuestions = getVisibleQuestions();\n \n visibleQuestions.forEach(question => {\n if (!question.required) {\n return;\n }\n \n const answer = answers[question.id];\n \n if (answer === undefined || answer === null) {\n errors[question.id] = 'This question is required';\n } else if (typeof answer === 'string' && answer.trim() === '') {\n errors[question.id] = 'This question is required';\n } else if (Array.isArray(answer) && answer.length === 0) {\n errors[question.id] = 'At least one option must be selected';\n }\n });\n \n return errors;\n };\n \n // Go to the next section\n const nextSection = (): boolean => {\n if (!isCurrentSectionValid()) {\n return false;\n }\n \n if (currentSectionIndex < sections.length - 1) {\n setCurrentSectionIndex(prevIndex => prevIndex + 1);\n return true;\n }\n \n return false;\n };\n \n // Go to the previous section\n const prevSection = (): boolean => {\n if (currentSectionIndex > 0) {\n setCurrentSectionIndex(prevIndex => prevIndex - 1);\n return true;\n }\n \n return false;\n };\n \n // Go to a specific section\n const goToSection = (index: number): boolean => {\n if (index >= 0 && index < sections.length) {\n setCurrentSectionIndex(index);\n return true;\n }\n \n return false;\n };\n \n // Check if the DPIA is complete (pure read — no state mutation)\n const isComplete = (): boolean => {\n return sections.every((section) => {\n const visibleQuestions = section.questions.filter(q => {\n if (!q.showWhen || q.showWhen.length === 0) return true;\n return q.showWhen.some(condition => {\n const answer = answers[condition.questionId];\n switch (condition.operator) {\n case 'equals': return answer === condition.value;\n case 'contains': return Array.isArray(answer) && answer.includes(condition.value);\n case 'greaterThan': return typeof answer === 'number' && answer > condition.value;\n case 'lessThan': return typeof answer === 'number' && answer < condition.value;\n default: return false;\n }\n });\n });\n\n return visibleQuestions.every(q => {\n if (!q.required) return true;\n const answer = answers[q.id];\n if (answer === undefined || answer === null) return false;\n if (typeof answer === 'string' && answer.trim() === '') return false;\n if (Array.isArray(answer) && answer.length === 0) return false;\n return true;\n });\n });\n };\n \n // Identify risks based on answers\n const identifyRisks = (): DPIARisk[] => {\n const risks: DPIARisk[] = [];\n \n // Check each question for risk indicators\n sections.forEach(section => {\n section.questions.forEach(question => {\n const answer = answers[question.id];\n \n // Skip if no answer\n if (answer === undefined || answer === null) {\n return;\n }\n \n // Check if the question has a risk level\n if (question.riskLevel) {\n // For select/radio/checkbox questions, check if the selected option has a risk level\n if (['select', 'radio', 'checkbox'].includes(question.type) && question.options) {\n const selectedOptions = Array.isArray(answer) ? answer : [answer];\n \n selectedOptions.forEach(selectedOption => {\n const option = question.options?.find(opt => opt.value === selectedOption);\n \n if (option?.riskLevel) {\n const riskLevel = option.riskLevel;\n const likelihood = riskLevel === 'low' ? 1 : riskLevel === 'medium' ? 3 : 5;\n const impact = riskLevel === 'low' ? 1 : riskLevel === 'medium' ? 3 : 5;\n \n risks.push({\n id: `risk_${risks.length + 1}`,\n description: `${question.text} - ${option.label}`,\n likelihood,\n impact,\n score: likelihood * impact,\n level: riskLevel,\n mitigated: false,\n relatedQuestionIds: [question.id]\n });\n }\n });\n } else {\n // For other question types, use the question's risk level\n const riskLevel = question.riskLevel;\n const likelihood = riskLevel === 'low' ? 1 : riskLevel === 'medium' ? 3 : 5;\n const impact = riskLevel === 'low' ? 1 : riskLevel === 'medium' ? 3 : 5;\n \n risks.push({\n id: `risk_${risks.length + 1}`,\n description: question.text,\n likelihood,\n impact,\n score: likelihood * impact,\n level: riskLevel,\n mitigated: false,\n relatedQuestionIds: [question.id]\n });\n }\n }\n });\n });\n \n return risks;\n };\n \n // Complete the DPIA and generate a result\n const completeDPIA = (\n assessorInfo: { name: string; role: string; email: string; },\n title: string,\n processingDescription: string\n ): DPIAResult => {\n const risks = identifyRisks();\n \n const result: DPIAResult = {\n id: `dpia_${Date.now()}`,\n title,\n processingDescription,\n startedAt: Date.now(),\n completedAt: Date.now(),\n assessor: assessorInfo,\n answers,\n risks,\n overallRiskLevel: 'low',\n canProceed: true,\n conclusion: '',\n version: '1.0'\n };\n \n // Assess the risks\n const assessment = assessDPIARisk(result);\n \n result.overallRiskLevel = assessment.overallRiskLevel;\n result.canProceed = assessment.canProceed;\n result.conclusion = assessment.canProceed\n ? 'Based on the assessment, the processing can proceed with appropriate safeguards.'\n : 'Based on the assessment, the processing should not proceed without further mitigation measures.';\n result.recommendations = assessment.recommendations;\n \n if (onComplete) {\n onComplete(result);\n }\n \n return result;\n };\n \n // Reset the DPIA\n const resetDPIA = () => {\n setAnswers({});\n setCurrentSectionIndex(0);\n \n if (useLocalStorage && typeof window !== 'undefined') {\n localStorage.removeItem(storageKey);\n }\n };\n \n // Calculate progress percentage\n const progress = (() => {\n let answeredQuestions = 0;\n let totalRequiredQuestions = 0;\n \n sections.forEach(section => {\n section.questions.forEach(question => {\n if (question.required && shouldShowQuestion(question)) {\n totalRequiredQuestions++;\n \n const answer = answers[question.id];\n if (\n answer !== undefined && \n answer !== null && \n !(typeof answer === 'string' && answer.trim() === '') &&\n !(Array.isArray(answer) && answer.length === 0)\n ) {\n answeredQuestions++;\n }\n }\n });\n });\n \n return totalRequiredQuestions > 0 \n ? Math.round((answeredQuestions / totalRequiredQuestions) * 100) \n : 0;\n })();\n \n return {\n currentSectionIndex,\n currentSection,\n answers,\n updateAnswer,\n nextSection,\n prevSection,\n goToSection,\n isCurrentSectionValid,\n getCurrentSectionErrors,\n isComplete,\n completeDPIA,\n getVisibleQuestions,\n resetDPIA,\n progress\n };\n}\n"]}
package/dist/core.d.mts CHANGED
@@ -1,7 +1,7 @@
1
1
  export { C as ConsentOption, a as ConsentSettings, b as ConsentStorageOptions, L as LawfulBasisType } from './consent-CmVzqZUk.mjs';
2
2
  export { D as DSRRequest, a as DSRStatus, b as DSRType, c as RequestStatus, R as RequestType } from './dsr-pQzQ3H1O.mjs';
3
3
  export { D as DPIAQuestion, b as DPIAResult, c as DPIARisk, a as DPIASection } from './dpia-vWfE_9bO.mjs';
4
- export { a as BreachCategory, B as BreachReport, N as NotificationRequirement, b as RegulatoryNotification, R as RiskAssessment } from './breach-BpSBPrdk.mjs';
4
+ export { a as BreachCategory, B as BreachReport, N as NotificationRequirement, b as RegulatoryNotification, R as RiskAssessment } from './breach-BtFbDOmV.mjs';
5
5
  export { O as OrganizationInfo, P as PolicySection, a as PolicyTemplate, b as PolicyVariable, c as PrivacyPolicy } from './privacy-Ca6te9Ir.mjs';
6
6
  export { L as LawfulBasis, b as LawfulBasisSummary, a as LegitimateInterestAssessment, P as ProcessingActivity, S as SensitiveDataCondition } from './lawful-basis-CWtvDG1x.mjs';
7
7
  export { A as AdequacyStatus, b as CrossBorderSummary, C as CrossBorderTransfer, a as TransferImpactAssessment, T as TransferMechanism, e as TransferRiskResult, d as TransferValidationResult, c as assessTransferRisk, g as getTransferMechanismDescription, i as isNDPCApprovalRequired, v as validateTransfer } from './cross-border-BrIy1ieh.mjs';
@@ -10,5 +10,5 @@ export { L as LawfulBasisComplianceGap, c as LawfulBasisValidationResult, a as a
10
10
  export { v as validateConsent, a as validateConsentOptions } from './consent-DCc5zjXI.mjs';
11
11
  export { f as formatDSRRequest } from './dsr-whPkiI0_.mjs';
12
12
  export { a as assessDPIARisk } from './dpia-B9ZZJG5a.mjs';
13
- export { c as calculateBreachSeverity } from './breach-D5zJYNph.mjs';
13
+ export { c as calculateBreachSeverity } from './breach-6z0r-KuE.mjs';
14
14
  export { g as generatePolicyText } from './privacy-9FcJceMr.mjs';
package/dist/core.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  export { C as ConsentOption, a as ConsentSettings, b as ConsentStorageOptions, L as LawfulBasisType } from './consent-CmVzqZUk.js';
2
2
  export { D as DSRRequest, a as DSRStatus, b as DSRType, c as RequestStatus, R as RequestType } from './dsr-pQzQ3H1O.js';
3
3
  export { D as DPIAQuestion, b as DPIAResult, c as DPIARisk, a as DPIASection } from './dpia-vWfE_9bO.js';
4
- export { a as BreachCategory, B as BreachReport, N as NotificationRequirement, b as RegulatoryNotification, R as RiskAssessment } from './breach-BpSBPrdk.js';
4
+ export { a as BreachCategory, B as BreachReport, N as NotificationRequirement, b as RegulatoryNotification, R as RiskAssessment } from './breach-BtFbDOmV.js';
5
5
  export { O as OrganizationInfo, P as PolicySection, a as PolicyTemplate, b as PolicyVariable, c as PrivacyPolicy } from './privacy-Ca6te9Ir.js';
6
6
  export { L as LawfulBasis, b as LawfulBasisSummary, a as LegitimateInterestAssessment, P as ProcessingActivity, S as SensitiveDataCondition } from './lawful-basis-CWtvDG1x.js';
7
7
  export { A as AdequacyStatus, b as CrossBorderSummary, C as CrossBorderTransfer, a as TransferImpactAssessment, T as TransferMechanism, e as TransferRiskResult, d as TransferValidationResult, c as assessTransferRisk, g as getTransferMechanismDescription, i as isNDPCApprovalRequired, v as validateTransfer } from './cross-border-BrIy1ieh.js';
@@ -10,5 +10,5 @@ export { L as LawfulBasisComplianceGap, c as LawfulBasisValidationResult, a as a
10
10
  export { v as validateConsent, a as validateConsentOptions } from './consent-DLWb5ota.js';
11
11
  export { f as formatDSRRequest } from './dsr-jq5NUEdz.js';
12
12
  export { a as assessDPIARisk } from './dpia-fdtTd2DI.js';
13
- export { c as calculateBreachSeverity } from './breach-D7NgrdMX.js';
13
+ export { c as calculateBreachSeverity } from './breach-BFfnvtRk.js';
14
14
  export { g as generatePolicyText } from './privacy-BXz7O2ej.js';
package/dist/dpia.js CHANGED
@@ -1,2 +1,2 @@
1
- 'use strict';var chunkRHWW5FDP_js=require('./chunk-RHWW5FDP.js'),chunkU2CGMEWB_js=require('./chunk-U2CGMEWB.js'),chunkSSGJREE3_js=require('./chunk-SSGJREE3.js');require('./chunk-MQFZHA2D.js');Object.defineProperty(exports,"DPIAQuestionnaire",{enumerable:true,get:function(){return chunkRHWW5FDP_js.a}});Object.defineProperty(exports,"DPIAReport",{enumerable:true,get:function(){return chunkRHWW5FDP_js.b}});Object.defineProperty(exports,"StepIndicator",{enumerable:true,get:function(){return chunkRHWW5FDP_js.c}});Object.defineProperty(exports,"useDPIA",{enumerable:true,get:function(){return chunkU2CGMEWB_js.a}});Object.defineProperty(exports,"assessDPIARisk",{enumerable:true,get:function(){return chunkSSGJREE3_js.a}});//# sourceMappingURL=dpia.js.map
1
+ 'use strict';var chunkRHWW5FDP_js=require('./chunk-RHWW5FDP.js'),chunk3YCV2BA6_js=require('./chunk-3YCV2BA6.js'),chunkSSGJREE3_js=require('./chunk-SSGJREE3.js');require('./chunk-MQFZHA2D.js');Object.defineProperty(exports,"DPIAQuestionnaire",{enumerable:true,get:function(){return chunkRHWW5FDP_js.a}});Object.defineProperty(exports,"DPIAReport",{enumerable:true,get:function(){return chunkRHWW5FDP_js.b}});Object.defineProperty(exports,"StepIndicator",{enumerable:true,get:function(){return chunkRHWW5FDP_js.c}});Object.defineProperty(exports,"useDPIA",{enumerable:true,get:function(){return chunk3YCV2BA6_js.a}});Object.defineProperty(exports,"assessDPIARisk",{enumerable:true,get:function(){return chunkSSGJREE3_js.a}});//# sourceMappingURL=dpia.js.map
2
2
  //# sourceMappingURL=dpia.js.map
package/dist/dpia.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export{a as DPIAQuestionnaire,b as DPIAReport,c as StepIndicator}from'./chunk-XMKA6GVK.mjs';export{a as useDPIA}from'./chunk-EWOZKYLY.mjs';export{a as assessDPIARisk}from'./chunk-PGSA2O5P.mjs';import'./chunk-WWT2ZSNU.mjs';//# sourceMappingURL=dpia.mjs.map
1
+ export{a as DPIAQuestionnaire,b as DPIAReport,c as StepIndicator}from'./chunk-XMKA6GVK.mjs';export{a as useDPIA}from'./chunk-6GGGTRDZ.mjs';export{a as assessDPIARisk}from'./chunk-PGSA2O5P.mjs';import'./chunk-WWT2ZSNU.mjs';//# sourceMappingURL=dpia.mjs.map
2
2
  //# sourceMappingURL=dpia.mjs.map
package/dist/hooks.d.mts CHANGED
@@ -1,7 +1,7 @@
1
1
  export { C as ConsentOption, a as ConsentSettings, b as ConsentStorageOptions, L as LawfulBasisType } from './consent-CmVzqZUk.mjs';
2
2
  export { D as DSRRequest, a as DSRStatus, b as DSRType } from './dsr-pQzQ3H1O.mjs';
3
3
  export { b as DPIAResult, c as DPIARisk } from './dpia-vWfE_9bO.mjs';
4
- export { B as BreachReport, N as NotificationRequirement, R as RiskAssessment } from './breach-BpSBPrdk.mjs';
4
+ export { B as BreachReport, N as NotificationRequirement, R as RiskAssessment } from './breach-BtFbDOmV.mjs';
5
5
  export { O as OrganizationInfo, P as PolicySection, c as PrivacyPolicy } from './privacy-Ca6te9Ir.mjs';
6
6
  export { L as LawfulBasis, b as LawfulBasisSummary, P as ProcessingActivity } from './lawful-basis-CWtvDG1x.mjs';
7
7
  export { b as CrossBorderSummary, C as CrossBorderTransfer } from './cross-border-BrIy1ieh.mjs';
@@ -9,7 +9,7 @@ export { P as ProcessingRecord, a as ROPASummary, R as RecordOfProcessingActivit
9
9
  export { u as useConsent } from './useConsent-DOt2Njst.mjs';
10
10
  export { u as useDSR } from './useDSR-OXM5Q9rf.mjs';
11
11
  export { u as useDPIA } from './useDPIA-FqPofFaV.mjs';
12
- export { u as useBreach } from './useBreach-DRKnexsk.mjs';
12
+ export { u as useBreach } from './useBreach-WrZzJilM.mjs';
13
13
  export { u as usePrivacyPolicy } from './usePrivacyPolicy-Dit2sFuV.mjs';
14
14
  export { u as useLawfulBasis } from './useLawfulBasis-DNQ8YszQ.mjs';
15
15
  export { u as useCrossBorderTransfer } from './useCrossBorderTransfer-TVnY8_UX.mjs';
package/dist/hooks.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  export { C as ConsentOption, a as ConsentSettings, b as ConsentStorageOptions, L as LawfulBasisType } from './consent-CmVzqZUk.js';
2
2
  export { D as DSRRequest, a as DSRStatus, b as DSRType } from './dsr-pQzQ3H1O.js';
3
3
  export { b as DPIAResult, c as DPIARisk } from './dpia-vWfE_9bO.js';
4
- export { B as BreachReport, N as NotificationRequirement, R as RiskAssessment } from './breach-BpSBPrdk.js';
4
+ export { B as BreachReport, N as NotificationRequirement, R as RiskAssessment } from './breach-BtFbDOmV.js';
5
5
  export { O as OrganizationInfo, P as PolicySection, c as PrivacyPolicy } from './privacy-Ca6te9Ir.js';
6
6
  export { L as LawfulBasis, b as LawfulBasisSummary, P as ProcessingActivity } from './lawful-basis-CWtvDG1x.js';
7
7
  export { b as CrossBorderSummary, C as CrossBorderTransfer } from './cross-border-BrIy1ieh.js';
@@ -9,7 +9,7 @@ export { P as ProcessingRecord, a as ROPASummary, R as RecordOfProcessingActivit
9
9
  export { u as useConsent } from './useConsent-D0pAfTlb.js';
10
10
  export { u as useDSR } from './useDSR-DAqqOBXb.js';
11
11
  export { u as useDPIA } from './useDPIA-DFDHBLSa.js';
12
- export { u as useBreach } from './useBreach-DuT0N0K1.js';
12
+ export { u as useBreach } from './useBreach-vrh_XMpI.js';
13
13
  export { u as usePrivacyPolicy } from './usePrivacyPolicy-CfySfBLS.js';
14
14
  export { u as useLawfulBasis } from './useLawfulBasis-RILM_xsx.js';
15
15
  export { u as useCrossBorderTransfer } from './useCrossBorderTransfer-D4FQYfFt.js';
package/dist/hooks.js CHANGED
@@ -1,2 +1,2 @@
1
- 'use strict';var chunkLXRXDTPI_js=require('./chunk-LXRXDTPI.js'),chunk5ZBO2UPH_js=require('./chunk-5ZBO2UPH.js'),chunk4A354HL3_js=require('./chunk-4A354HL3.js');require('./chunk-TDDAYVKK.js'),require('./chunk-IQF726GS.js'),require('./chunk-SWF3YVE5.js');var chunkZU73VG3X_js=require('./chunk-ZU73VG3X.js');require('./chunk-Y34DQYS7.js');var chunkWW3X3ELF_js=require('./chunk-WW3X3ELF.js');require('./chunk-CMZTI7SG.js');var chunkU2CGMEWB_js=require('./chunk-U2CGMEWB.js');require('./chunk-SSGJREE3.js');var chunkLI6WJ3LZ_js=require('./chunk-LI6WJ3LZ.js');require('./chunk-RYZEIDNR.js');var chunkIWUUVRLJ_js=require('./chunk-IWUUVRLJ.js');require('./chunk-PM7CMTMB.js'),require('./chunk-MQFZHA2D.js');Object.defineProperty(exports,"useLawfulBasis",{enumerable:true,get:function(){return chunkLXRXDTPI_js.a}});Object.defineProperty(exports,"useCrossBorderTransfer",{enumerable:true,get:function(){return chunk5ZBO2UPH_js.a}});Object.defineProperty(exports,"useROPA",{enumerable:true,get:function(){return chunk4A354HL3_js.a}});Object.defineProperty(exports,"useConsent",{enumerable:true,get:function(){return chunkZU73VG3X_js.a}});Object.defineProperty(exports,"useDSR",{enumerable:true,get:function(){return chunkWW3X3ELF_js.a}});Object.defineProperty(exports,"useDPIA",{enumerable:true,get:function(){return chunkU2CGMEWB_js.a}});Object.defineProperty(exports,"useBreach",{enumerable:true,get:function(){return chunkLI6WJ3LZ_js.a}});Object.defineProperty(exports,"usePrivacyPolicy",{enumerable:true,get:function(){return chunkIWUUVRLJ_js.a}});//# sourceMappingURL=hooks.js.map
1
+ 'use strict';var chunkLXRXDTPI_js=require('./chunk-LXRXDTPI.js'),chunk5ZBO2UPH_js=require('./chunk-5ZBO2UPH.js'),chunk4A354HL3_js=require('./chunk-4A354HL3.js');require('./chunk-TDDAYVKK.js'),require('./chunk-IQF726GS.js'),require('./chunk-SWF3YVE5.js');var chunkZU73VG3X_js=require('./chunk-ZU73VG3X.js');require('./chunk-Y34DQYS7.js');var chunkWW3X3ELF_js=require('./chunk-WW3X3ELF.js');require('./chunk-CMZTI7SG.js');var chunk3YCV2BA6_js=require('./chunk-3YCV2BA6.js');require('./chunk-SSGJREE3.js');var chunkLI6WJ3LZ_js=require('./chunk-LI6WJ3LZ.js');require('./chunk-RYZEIDNR.js');var chunkIWUUVRLJ_js=require('./chunk-IWUUVRLJ.js');require('./chunk-PM7CMTMB.js'),require('./chunk-MQFZHA2D.js');Object.defineProperty(exports,"useLawfulBasis",{enumerable:true,get:function(){return chunkLXRXDTPI_js.a}});Object.defineProperty(exports,"useCrossBorderTransfer",{enumerable:true,get:function(){return chunk5ZBO2UPH_js.a}});Object.defineProperty(exports,"useROPA",{enumerable:true,get:function(){return chunk4A354HL3_js.a}});Object.defineProperty(exports,"useConsent",{enumerable:true,get:function(){return chunkZU73VG3X_js.a}});Object.defineProperty(exports,"useDSR",{enumerable:true,get:function(){return chunkWW3X3ELF_js.a}});Object.defineProperty(exports,"useDPIA",{enumerable:true,get:function(){return chunk3YCV2BA6_js.a}});Object.defineProperty(exports,"useBreach",{enumerable:true,get:function(){return chunkLI6WJ3LZ_js.a}});Object.defineProperty(exports,"usePrivacyPolicy",{enumerable:true,get:function(){return chunkIWUUVRLJ_js.a}});//# sourceMappingURL=hooks.js.map
2
2
  //# sourceMappingURL=hooks.js.map
package/dist/hooks.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export{a as useLawfulBasis}from'./chunk-L52PDW6O.mjs';export{a as useCrossBorderTransfer}from'./chunk-VMJBW3EF.mjs';export{a as useROPA}from'./chunk-T44JQT2O.mjs';import'./chunk-TXBZPCGF.mjs';import'./chunk-QKK5S54L.mjs';import'./chunk-PYEX7DFR.mjs';export{a as useConsent}from'./chunk-PDJGTQMY.mjs';import'./chunk-GIV2OHE6.mjs';export{a as useDSR}from'./chunk-GMLNWS2N.mjs';import'./chunk-2SYNHRP6.mjs';export{a as useDPIA}from'./chunk-EWOZKYLY.mjs';import'./chunk-PGSA2O5P.mjs';export{a as useBreach}from'./chunk-OITITR6K.mjs';import'./chunk-RGYK4VAY.mjs';export{a as usePrivacyPolicy}from'./chunk-DB3JH4DS.mjs';import'./chunk-UYP64PV7.mjs';import'./chunk-WWT2ZSNU.mjs';//# sourceMappingURL=hooks.mjs.map
1
+ export{a as useLawfulBasis}from'./chunk-L52PDW6O.mjs';export{a as useCrossBorderTransfer}from'./chunk-VMJBW3EF.mjs';export{a as useROPA}from'./chunk-T44JQT2O.mjs';import'./chunk-TXBZPCGF.mjs';import'./chunk-QKK5S54L.mjs';import'./chunk-PYEX7DFR.mjs';export{a as useConsent}from'./chunk-PDJGTQMY.mjs';import'./chunk-GIV2OHE6.mjs';export{a as useDSR}from'./chunk-GMLNWS2N.mjs';import'./chunk-2SYNHRP6.mjs';export{a as useDPIA}from'./chunk-6GGGTRDZ.mjs';import'./chunk-PGSA2O5P.mjs';export{a as useBreach}from'./chunk-OITITR6K.mjs';import'./chunk-RGYK4VAY.mjs';export{a as usePrivacyPolicy}from'./chunk-DB3JH4DS.mjs';import'./chunk-UYP64PV7.mjs';import'./chunk-WWT2ZSNU.mjs';//# sourceMappingURL=hooks.mjs.map
2
2
  //# sourceMappingURL=hooks.mjs.map
package/dist/index.d.mts CHANGED
@@ -5,18 +5,18 @@ export { D as DSRRequest, a as DSRStatus, b as DSRType, c as RequestStatus, R as
5
5
  export { DPIAQuestionnaire, DPIAReport, StepIndicator } from './dpia.mjs';
6
6
  export { D as DPIAQuestion, b as DPIAResult, c as DPIARisk, a as DPIASection } from './dpia-vWfE_9bO.mjs';
7
7
  export { BreachNotificationManager, BreachReportForm, BreachRiskAssessment, RegulatoryReportGenerator } from './breach.mjs';
8
- export { a as BreachCategory, B as BreachReport, N as NotificationRequirement, b as RegulatoryNotification, R as RiskAssessment } from './breach-BpSBPrdk.mjs';
8
+ export { a as BreachCategory, B as BreachReport, N as NotificationRequirement, b as RegulatoryNotification, R as RiskAssessment } from './breach-BtFbDOmV.mjs';
9
9
  export { PolicyExporter, PolicyGenerator, PolicyPreview } from './policy.mjs';
10
10
  export { O as OrganizationInfo, P as PolicySection, a as PolicyTemplate, b as PolicyVariable, c as PrivacyPolicy } from './privacy-Ca6te9Ir.mjs';
11
11
  export { v as validateConsent, a as validateConsentOptions } from './consent-DCc5zjXI.mjs';
12
12
  export { f as formatDSRRequest } from './dsr-whPkiI0_.mjs';
13
13
  export { a as assessDPIARisk } from './dpia-B9ZZJG5a.mjs';
14
- export { c as calculateBreachSeverity } from './breach-D5zJYNph.mjs';
14
+ export { c as calculateBreachSeverity } from './breach-6z0r-KuE.mjs';
15
15
  export { g as generatePolicyText } from './privacy-9FcJceMr.mjs';
16
16
  export { u as useConsent } from './useConsent-DOt2Njst.mjs';
17
17
  export { u as useDSR } from './useDSR-OXM5Q9rf.mjs';
18
18
  export { u as useDPIA } from './useDPIA-FqPofFaV.mjs';
19
- export { u as useBreach } from './useBreach-DRKnexsk.mjs';
19
+ export { u as useBreach } from './useBreach-WrZzJilM.mjs';
20
20
  export { u as usePrivacyPolicy } from './usePrivacyPolicy-Dit2sFuV.mjs';
21
21
  export { LawfulBasisTracker } from './lawful-basis.mjs';
22
22
  export { L as LawfulBasis, b as LawfulBasisSummary, a as LegitimateInterestAssessment, P as ProcessingActivity, S as SensitiveDataCondition } from './lawful-basis-CWtvDG1x.mjs';
package/dist/index.d.ts CHANGED
@@ -5,18 +5,18 @@ export { D as DSRRequest, a as DSRStatus, b as DSRType, c as RequestStatus, R as
5
5
  export { DPIAQuestionnaire, DPIAReport, StepIndicator } from './dpia.js';
6
6
  export { D as DPIAQuestion, b as DPIAResult, c as DPIARisk, a as DPIASection } from './dpia-vWfE_9bO.js';
7
7
  export { BreachNotificationManager, BreachReportForm, BreachRiskAssessment, RegulatoryReportGenerator } from './breach.js';
8
- export { a as BreachCategory, B as BreachReport, N as NotificationRequirement, b as RegulatoryNotification, R as RiskAssessment } from './breach-BpSBPrdk.js';
8
+ export { a as BreachCategory, B as BreachReport, N as NotificationRequirement, b as RegulatoryNotification, R as RiskAssessment } from './breach-BtFbDOmV.js';
9
9
  export { PolicyExporter, PolicyGenerator, PolicyPreview } from './policy.js';
10
10
  export { O as OrganizationInfo, P as PolicySection, a as PolicyTemplate, b as PolicyVariable, c as PrivacyPolicy } from './privacy-Ca6te9Ir.js';
11
11
  export { v as validateConsent, a as validateConsentOptions } from './consent-DLWb5ota.js';
12
12
  export { f as formatDSRRequest } from './dsr-jq5NUEdz.js';
13
13
  export { a as assessDPIARisk } from './dpia-fdtTd2DI.js';
14
- export { c as calculateBreachSeverity } from './breach-D7NgrdMX.js';
14
+ export { c as calculateBreachSeverity } from './breach-BFfnvtRk.js';
15
15
  export { g as generatePolicyText } from './privacy-BXz7O2ej.js';
16
16
  export { u as useConsent } from './useConsent-D0pAfTlb.js';
17
17
  export { u as useDSR } from './useDSR-DAqqOBXb.js';
18
18
  export { u as useDPIA } from './useDPIA-DFDHBLSa.js';
19
- export { u as useBreach } from './useBreach-DuT0N0K1.js';
19
+ export { u as useBreach } from './useBreach-vrh_XMpI.js';
20
20
  export { u as usePrivacyPolicy } from './usePrivacyPolicy-CfySfBLS.js';
21
21
  export { LawfulBasisTracker } from './lawful-basis.js';
22
22
  export { L as LawfulBasis, b as LawfulBasisSummary, a as LegitimateInterestAssessment, P as ProcessingActivity, S as SensitiveDataCondition } from './lawful-basis-CWtvDG1x.js';
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- 'use strict';var chunkRB26MIRI_js=require('./chunk-RB26MIRI.js'),chunkAQEGDEQM_js=require('./chunk-AQEGDEQM.js'),chunkUUWVBENC_js=require('./chunk-UUWVBENC.js'),chunkLXRXDTPI_js=require('./chunk-LXRXDTPI.js'),chunk5ZBO2UPH_js=require('./chunk-5ZBO2UPH.js'),chunk4A354HL3_js=require('./chunk-4A354HL3.js'),chunkTDDAYVKK_js=require('./chunk-TDDAYVKK.js'),chunkIQF726GS_js=require('./chunk-IQF726GS.js'),chunkSWF3YVE5_js=require('./chunk-SWF3YVE5.js'),chunkFK3CSFLJ_js=require('./chunk-FK3CSFLJ.js'),chunkZU73VG3X_js=require('./chunk-ZU73VG3X.js'),chunkY34DQYS7_js=require('./chunk-Y34DQYS7.js'),chunk6JVYYLS7_js=require('./chunk-6JVYYLS7.js'),chunkWW3X3ELF_js=require('./chunk-WW3X3ELF.js'),chunkCMZTI7SG_js=require('./chunk-CMZTI7SG.js'),chunkRHWW5FDP_js=require('./chunk-RHWW5FDP.js'),chunkU2CGMEWB_js=require('./chunk-U2CGMEWB.js'),chunkSSGJREE3_js=require('./chunk-SSGJREE3.js'),chunkL3FKTBGV_js=require('./chunk-L3FKTBGV.js'),chunkLI6WJ3LZ_js=require('./chunk-LI6WJ3LZ.js'),chunkRYZEIDNR_js=require('./chunk-RYZEIDNR.js'),chunk4DKT6IB6_js=require('./chunk-4DKT6IB6.js'),chunkIWUUVRLJ_js=require('./chunk-IWUUVRLJ.js'),chunkPM7CMTMB_js=require('./chunk-PM7CMTMB.js');require('./chunk-MQFZHA2D.js');Object.defineProperty(exports,"LawfulBasisTracker",{enumerable:true,get:function(){return chunkRB26MIRI_js.a}});Object.defineProperty(exports,"CrossBorderTransferManager",{enumerable:true,get:function(){return chunkAQEGDEQM_js.a}});Object.defineProperty(exports,"ROPAManager",{enumerable:true,get:function(){return chunkUUWVBENC_js.a}});Object.defineProperty(exports,"useLawfulBasis",{enumerable:true,get:function(){return chunkLXRXDTPI_js.a}});Object.defineProperty(exports,"useCrossBorderTransfer",{enumerable:true,get:function(){return chunk5ZBO2UPH_js.a}});Object.defineProperty(exports,"useROPA",{enumerable:true,get:function(){return chunk4A354HL3_js.a}});Object.defineProperty(exports,"assessComplianceGaps",{enumerable:true,get:function(){return chunkTDDAYVKK_js.c}});Object.defineProperty(exports,"generateLawfulBasisSummary",{enumerable:true,get:function(){return chunkTDDAYVKK_js.d}});Object.defineProperty(exports,"getLawfulBasisDescription",{enumerable:true,get:function(){return chunkTDDAYVKK_js.b}});Object.defineProperty(exports,"validateProcessingActivity",{enumerable:true,get:function(){return chunkTDDAYVKK_js.a}});Object.defineProperty(exports,"assessTransferRisk",{enumerable:true,get:function(){return chunkIQF726GS_js.d}});Object.defineProperty(exports,"getTransferMechanismDescription",{enumerable:true,get:function(){return chunkIQF726GS_js.b}});Object.defineProperty(exports,"isNDPCApprovalRequired",{enumerable:true,get:function(){return chunkIQF726GS_js.a}});Object.defineProperty(exports,"validateTransfer",{enumerable:true,get:function(){return chunkIQF726GS_js.c}});Object.defineProperty(exports,"exportROPAToCSV",{enumerable:true,get:function(){return chunkSWF3YVE5_js.c}});Object.defineProperty(exports,"generateROPASummary",{enumerable:true,get:function(){return chunkSWF3YVE5_js.b}});Object.defineProperty(exports,"identifyComplianceGaps",{enumerable:true,get:function(){return chunkSWF3YVE5_js.d}});Object.defineProperty(exports,"validateProcessingRecord",{enumerable:true,get:function(){return chunkSWF3YVE5_js.a}});Object.defineProperty(exports,"ConsentBanner",{enumerable:true,get:function(){return chunkFK3CSFLJ_js.a}});Object.defineProperty(exports,"ConsentManager",{enumerable:true,get:function(){return chunkFK3CSFLJ_js.b}});Object.defineProperty(exports,"ConsentStorage",{enumerable:true,get:function(){return chunkFK3CSFLJ_js.c}});Object.defineProperty(exports,"useConsent",{enumerable:true,get:function(){return chunkZU73VG3X_js.a}});Object.defineProperty(exports,"validateConsent",{enumerable:true,get:function(){return chunkY34DQYS7_js.a}});Object.defineProperty(exports,"validateConsentOptions",{enumerable:true,get:function(){return chunkY34DQYS7_js.b}});Object.defineProperty(exports,"DSRDashboard",{enumerable:true,get:function(){return chunk6JVYYLS7_js.b}});Object.defineProperty(exports,"DSRRequestForm",{enumerable:true,get:function(){return chunk6JVYYLS7_js.a}});Object.defineProperty(exports,"DSRTracker",{enumerable:true,get:function(){return chunk6JVYYLS7_js.c}});Object.defineProperty(exports,"useDSR",{enumerable:true,get:function(){return chunkWW3X3ELF_js.a}});Object.defineProperty(exports,"formatDSRRequest",{enumerable:true,get:function(){return chunkCMZTI7SG_js.a}});Object.defineProperty(exports,"DPIAQuestionnaire",{enumerable:true,get:function(){return chunkRHWW5FDP_js.a}});Object.defineProperty(exports,"DPIAReport",{enumerable:true,get:function(){return chunkRHWW5FDP_js.b}});Object.defineProperty(exports,"StepIndicator",{enumerable:true,get:function(){return chunkRHWW5FDP_js.c}});Object.defineProperty(exports,"useDPIA",{enumerable:true,get:function(){return chunkU2CGMEWB_js.a}});Object.defineProperty(exports,"assessDPIARisk",{enumerable:true,get:function(){return chunkSSGJREE3_js.a}});Object.defineProperty(exports,"BreachNotificationManager",{enumerable:true,get:function(){return chunkL3FKTBGV_js.c}});Object.defineProperty(exports,"BreachReportForm",{enumerable:true,get:function(){return chunkL3FKTBGV_js.a}});Object.defineProperty(exports,"BreachRiskAssessment",{enumerable:true,get:function(){return chunkL3FKTBGV_js.b}});Object.defineProperty(exports,"RegulatoryReportGenerator",{enumerable:true,get:function(){return chunkL3FKTBGV_js.d}});Object.defineProperty(exports,"useBreach",{enumerable:true,get:function(){return chunkLI6WJ3LZ_js.a}});Object.defineProperty(exports,"calculateBreachSeverity",{enumerable:true,get:function(){return chunkRYZEIDNR_js.a}});Object.defineProperty(exports,"PolicyExporter",{enumerable:true,get:function(){return chunk4DKT6IB6_js.c}});Object.defineProperty(exports,"PolicyGenerator",{enumerable:true,get:function(){return chunk4DKT6IB6_js.a}});Object.defineProperty(exports,"PolicyPreview",{enumerable:true,get:function(){return chunk4DKT6IB6_js.b}});Object.defineProperty(exports,"usePrivacyPolicy",{enumerable:true,get:function(){return chunkIWUUVRLJ_js.a}});Object.defineProperty(exports,"generatePolicyText",{enumerable:true,get:function(){return chunkPM7CMTMB_js.a}});//# sourceMappingURL=index.js.map
1
+ 'use strict';var chunkRB26MIRI_js=require('./chunk-RB26MIRI.js'),chunkAQEGDEQM_js=require('./chunk-AQEGDEQM.js'),chunkUUWVBENC_js=require('./chunk-UUWVBENC.js'),chunkLXRXDTPI_js=require('./chunk-LXRXDTPI.js'),chunk5ZBO2UPH_js=require('./chunk-5ZBO2UPH.js'),chunk4A354HL3_js=require('./chunk-4A354HL3.js'),chunkTDDAYVKK_js=require('./chunk-TDDAYVKK.js'),chunkIQF726GS_js=require('./chunk-IQF726GS.js'),chunkSWF3YVE5_js=require('./chunk-SWF3YVE5.js'),chunkFK3CSFLJ_js=require('./chunk-FK3CSFLJ.js'),chunkZU73VG3X_js=require('./chunk-ZU73VG3X.js'),chunkY34DQYS7_js=require('./chunk-Y34DQYS7.js'),chunk6JVYYLS7_js=require('./chunk-6JVYYLS7.js'),chunkWW3X3ELF_js=require('./chunk-WW3X3ELF.js'),chunkCMZTI7SG_js=require('./chunk-CMZTI7SG.js'),chunkRHWW5FDP_js=require('./chunk-RHWW5FDP.js'),chunk3YCV2BA6_js=require('./chunk-3YCV2BA6.js'),chunkSSGJREE3_js=require('./chunk-SSGJREE3.js'),chunkL3FKTBGV_js=require('./chunk-L3FKTBGV.js'),chunkLI6WJ3LZ_js=require('./chunk-LI6WJ3LZ.js'),chunkRYZEIDNR_js=require('./chunk-RYZEIDNR.js'),chunk4DKT6IB6_js=require('./chunk-4DKT6IB6.js'),chunkIWUUVRLJ_js=require('./chunk-IWUUVRLJ.js'),chunkPM7CMTMB_js=require('./chunk-PM7CMTMB.js');require('./chunk-MQFZHA2D.js');Object.defineProperty(exports,"LawfulBasisTracker",{enumerable:true,get:function(){return chunkRB26MIRI_js.a}});Object.defineProperty(exports,"CrossBorderTransferManager",{enumerable:true,get:function(){return chunkAQEGDEQM_js.a}});Object.defineProperty(exports,"ROPAManager",{enumerable:true,get:function(){return chunkUUWVBENC_js.a}});Object.defineProperty(exports,"useLawfulBasis",{enumerable:true,get:function(){return chunkLXRXDTPI_js.a}});Object.defineProperty(exports,"useCrossBorderTransfer",{enumerable:true,get:function(){return chunk5ZBO2UPH_js.a}});Object.defineProperty(exports,"useROPA",{enumerable:true,get:function(){return chunk4A354HL3_js.a}});Object.defineProperty(exports,"assessComplianceGaps",{enumerable:true,get:function(){return chunkTDDAYVKK_js.c}});Object.defineProperty(exports,"generateLawfulBasisSummary",{enumerable:true,get:function(){return chunkTDDAYVKK_js.d}});Object.defineProperty(exports,"getLawfulBasisDescription",{enumerable:true,get:function(){return chunkTDDAYVKK_js.b}});Object.defineProperty(exports,"validateProcessingActivity",{enumerable:true,get:function(){return chunkTDDAYVKK_js.a}});Object.defineProperty(exports,"assessTransferRisk",{enumerable:true,get:function(){return chunkIQF726GS_js.d}});Object.defineProperty(exports,"getTransferMechanismDescription",{enumerable:true,get:function(){return chunkIQF726GS_js.b}});Object.defineProperty(exports,"isNDPCApprovalRequired",{enumerable:true,get:function(){return chunkIQF726GS_js.a}});Object.defineProperty(exports,"validateTransfer",{enumerable:true,get:function(){return chunkIQF726GS_js.c}});Object.defineProperty(exports,"exportROPAToCSV",{enumerable:true,get:function(){return chunkSWF3YVE5_js.c}});Object.defineProperty(exports,"generateROPASummary",{enumerable:true,get:function(){return chunkSWF3YVE5_js.b}});Object.defineProperty(exports,"identifyComplianceGaps",{enumerable:true,get:function(){return chunkSWF3YVE5_js.d}});Object.defineProperty(exports,"validateProcessingRecord",{enumerable:true,get:function(){return chunkSWF3YVE5_js.a}});Object.defineProperty(exports,"ConsentBanner",{enumerable:true,get:function(){return chunkFK3CSFLJ_js.a}});Object.defineProperty(exports,"ConsentManager",{enumerable:true,get:function(){return chunkFK3CSFLJ_js.b}});Object.defineProperty(exports,"ConsentStorage",{enumerable:true,get:function(){return chunkFK3CSFLJ_js.c}});Object.defineProperty(exports,"useConsent",{enumerable:true,get:function(){return chunkZU73VG3X_js.a}});Object.defineProperty(exports,"validateConsent",{enumerable:true,get:function(){return chunkY34DQYS7_js.a}});Object.defineProperty(exports,"validateConsentOptions",{enumerable:true,get:function(){return chunkY34DQYS7_js.b}});Object.defineProperty(exports,"DSRDashboard",{enumerable:true,get:function(){return chunk6JVYYLS7_js.b}});Object.defineProperty(exports,"DSRRequestForm",{enumerable:true,get:function(){return chunk6JVYYLS7_js.a}});Object.defineProperty(exports,"DSRTracker",{enumerable:true,get:function(){return chunk6JVYYLS7_js.c}});Object.defineProperty(exports,"useDSR",{enumerable:true,get:function(){return chunkWW3X3ELF_js.a}});Object.defineProperty(exports,"formatDSRRequest",{enumerable:true,get:function(){return chunkCMZTI7SG_js.a}});Object.defineProperty(exports,"DPIAQuestionnaire",{enumerable:true,get:function(){return chunkRHWW5FDP_js.a}});Object.defineProperty(exports,"DPIAReport",{enumerable:true,get:function(){return chunkRHWW5FDP_js.b}});Object.defineProperty(exports,"StepIndicator",{enumerable:true,get:function(){return chunkRHWW5FDP_js.c}});Object.defineProperty(exports,"useDPIA",{enumerable:true,get:function(){return chunk3YCV2BA6_js.a}});Object.defineProperty(exports,"assessDPIARisk",{enumerable:true,get:function(){return chunkSSGJREE3_js.a}});Object.defineProperty(exports,"BreachNotificationManager",{enumerable:true,get:function(){return chunkL3FKTBGV_js.c}});Object.defineProperty(exports,"BreachReportForm",{enumerable:true,get:function(){return chunkL3FKTBGV_js.a}});Object.defineProperty(exports,"BreachRiskAssessment",{enumerable:true,get:function(){return chunkL3FKTBGV_js.b}});Object.defineProperty(exports,"RegulatoryReportGenerator",{enumerable:true,get:function(){return chunkL3FKTBGV_js.d}});Object.defineProperty(exports,"useBreach",{enumerable:true,get:function(){return chunkLI6WJ3LZ_js.a}});Object.defineProperty(exports,"calculateBreachSeverity",{enumerable:true,get:function(){return chunkRYZEIDNR_js.a}});Object.defineProperty(exports,"PolicyExporter",{enumerable:true,get:function(){return chunk4DKT6IB6_js.c}});Object.defineProperty(exports,"PolicyGenerator",{enumerable:true,get:function(){return chunk4DKT6IB6_js.a}});Object.defineProperty(exports,"PolicyPreview",{enumerable:true,get:function(){return chunk4DKT6IB6_js.b}});Object.defineProperty(exports,"usePrivacyPolicy",{enumerable:true,get:function(){return chunkIWUUVRLJ_js.a}});Object.defineProperty(exports,"generatePolicyText",{enumerable:true,get:function(){return chunkPM7CMTMB_js.a}});//# sourceMappingURL=index.js.map
2
2
  //# sourceMappingURL=index.js.map
package/dist/index.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export{a as LawfulBasisTracker}from'./chunk-C2IJWCZQ.mjs';export{a as CrossBorderTransferManager}from'./chunk-2XHD22J7.mjs';export{a as ROPAManager}from'./chunk-6SGG6WPA.mjs';export{a as useLawfulBasis}from'./chunk-L52PDW6O.mjs';export{a as useCrossBorderTransfer}from'./chunk-VMJBW3EF.mjs';export{a as useROPA}from'./chunk-T44JQT2O.mjs';export{c as assessComplianceGaps,d as generateLawfulBasisSummary,b as getLawfulBasisDescription,a as validateProcessingActivity}from'./chunk-TXBZPCGF.mjs';export{d as assessTransferRisk,b as getTransferMechanismDescription,a as isNDPCApprovalRequired,c as validateTransfer}from'./chunk-QKK5S54L.mjs';export{c as exportROPAToCSV,b as generateROPASummary,d as identifyComplianceGaps,a as validateProcessingRecord}from'./chunk-PYEX7DFR.mjs';export{a as ConsentBanner,b as ConsentManager,c as ConsentStorage}from'./chunk-SLNMKGQ2.mjs';export{a as useConsent}from'./chunk-PDJGTQMY.mjs';export{a as validateConsent,b as validateConsentOptions}from'./chunk-GIV2OHE6.mjs';export{b as DSRDashboard,a as DSRRequestForm,c as DSRTracker}from'./chunk-6JFTAYXV.mjs';export{a as useDSR}from'./chunk-GMLNWS2N.mjs';export{a as formatDSRRequest}from'./chunk-2SYNHRP6.mjs';export{a as DPIAQuestionnaire,b as DPIAReport,c as StepIndicator}from'./chunk-XMKA6GVK.mjs';export{a as useDPIA}from'./chunk-EWOZKYLY.mjs';export{a as assessDPIARisk}from'./chunk-PGSA2O5P.mjs';export{c as BreachNotificationManager,a as BreachReportForm,b as BreachRiskAssessment,d as RegulatoryReportGenerator}from'./chunk-JUN6YPLL.mjs';export{a as useBreach}from'./chunk-OITITR6K.mjs';export{a as calculateBreachSeverity}from'./chunk-RGYK4VAY.mjs';export{c as PolicyExporter,a as PolicyGenerator,b as PolicyPreview}from'./chunk-FFW7RUAG.mjs';export{a as usePrivacyPolicy}from'./chunk-DB3JH4DS.mjs';export{a as generatePolicyText}from'./chunk-UYP64PV7.mjs';import'./chunk-WWT2ZSNU.mjs';//# sourceMappingURL=index.mjs.map
1
+ export{a as LawfulBasisTracker}from'./chunk-C2IJWCZQ.mjs';export{a as CrossBorderTransferManager}from'./chunk-2XHD22J7.mjs';export{a as ROPAManager}from'./chunk-6SGG6WPA.mjs';export{a as useLawfulBasis}from'./chunk-L52PDW6O.mjs';export{a as useCrossBorderTransfer}from'./chunk-VMJBW3EF.mjs';export{a as useROPA}from'./chunk-T44JQT2O.mjs';export{c as assessComplianceGaps,d as generateLawfulBasisSummary,b as getLawfulBasisDescription,a as validateProcessingActivity}from'./chunk-TXBZPCGF.mjs';export{d as assessTransferRisk,b as getTransferMechanismDescription,a as isNDPCApprovalRequired,c as validateTransfer}from'./chunk-QKK5S54L.mjs';export{c as exportROPAToCSV,b as generateROPASummary,d as identifyComplianceGaps,a as validateProcessingRecord}from'./chunk-PYEX7DFR.mjs';export{a as ConsentBanner,b as ConsentManager,c as ConsentStorage}from'./chunk-SLNMKGQ2.mjs';export{a as useConsent}from'./chunk-PDJGTQMY.mjs';export{a as validateConsent,b as validateConsentOptions}from'./chunk-GIV2OHE6.mjs';export{b as DSRDashboard,a as DSRRequestForm,c as DSRTracker}from'./chunk-6JFTAYXV.mjs';export{a as useDSR}from'./chunk-GMLNWS2N.mjs';export{a as formatDSRRequest}from'./chunk-2SYNHRP6.mjs';export{a as DPIAQuestionnaire,b as DPIAReport,c as StepIndicator}from'./chunk-XMKA6GVK.mjs';export{a as useDPIA}from'./chunk-6GGGTRDZ.mjs';export{a as assessDPIARisk}from'./chunk-PGSA2O5P.mjs';export{c as BreachNotificationManager,a as BreachReportForm,b as BreachRiskAssessment,d as RegulatoryReportGenerator}from'./chunk-JUN6YPLL.mjs';export{a as useBreach}from'./chunk-OITITR6K.mjs';export{a as calculateBreachSeverity}from'./chunk-RGYK4VAY.mjs';export{c as PolicyExporter,a as PolicyGenerator,b as PolicyPreview}from'./chunk-FFW7RUAG.mjs';export{a as usePrivacyPolicy}from'./chunk-DB3JH4DS.mjs';export{a as generatePolicyText}from'./chunk-UYP64PV7.mjs';import'./chunk-WWT2ZSNU.mjs';//# sourceMappingURL=index.mjs.map
2
2
  //# sourceMappingURL=index.mjs.map
@@ -1,4 +1,4 @@
1
- import { a as BreachCategory, B as BreachReport, R as RiskAssessment, b as RegulatoryNotification, N as NotificationRequirement } from './breach-BpSBPrdk.mjs';
1
+ import { a as BreachCategory, B as BreachReport, R as RiskAssessment, b as RegulatoryNotification, N as NotificationRequirement } from './breach-BtFbDOmV.mjs';
2
2
 
3
3
  interface UseBreachOptions {
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { a as BreachCategory, B as BreachReport, R as RiskAssessment, b as RegulatoryNotification, N as NotificationRequirement } from './breach-BpSBPrdk.js';
1
+ import { a as BreachCategory, B as BreachReport, R as RiskAssessment, b as RegulatoryNotification, N as NotificationRequirement } from './breach-BtFbDOmV.js';
2
2
 
3
3
  interface UseBreachOptions {
4
4
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tantainnovative/ndpr-toolkit",
3
- "version": "2.1.0",
3
+ "version": "2.1.1",
4
4
  "private": false,
5
5
  "description": "Nigeria Data Protection Toolkit — enterprise-grade compliance components for the Nigeria Data Protection Act (NDPA) 2023",
6
6
  "keywords": [
@@ -143,8 +143,10 @@
143
143
  "publishConfig": {
144
144
  "access": "public"
145
145
  },
146
+ "sideEffects": [
147
+ "*.css"
148
+ ],
146
149
  "dependencies": {
147
- "tslib": "^2.4.0",
148
150
  "uuid": "^13.0.0"
149
151
  },
150
152
  "peerDependencies": {
@@ -1,2 +0,0 @@
1
- import {a as a$1}from'./chunk-PGSA2O5P.mjs';import {b,a}from'./chunk-WWT2ZSNU.mjs';import {useState,useEffect}from'react';function N({sections:d,initialAnswers:Q={},storageKey:f="ndpr_dpia_data",useLocalStorage:m=true,onComplete:I}){let[l,c]=useState(0),[i,g]=useState(Q);useEffect(()=>{if(m&&typeof window!="undefined")try{let r=localStorage.getItem(f);if(r){let{answers:t,sectionIndex:e}=JSON.parse(r);g(t||{}),c(e||0);}}catch(r){console.error("Error loading DPIA data:",r);}},[f,m]),useEffect(()=>{if(m&&typeof window!="undefined")try{localStorage.setItem(f,JSON.stringify({answers:i,sectionIndex:l}));}catch(r){console.error("Error saving DPIA data:",r);}},[i,l,f,m]);let p=d[l]||null,E=(r,t)=>{g(e=>b(a({},e),{[r]:t}));},v=r=>r.showWhen?r.showWhen.every(t=>{let e=i[t.questionId];switch(t.operator){case "equals":return e===t.value;case "contains":return Array.isArray(e)?e.includes(t.value):false;case "greaterThan":return typeof e=="number"?e>t.value:false;case "lessThan":return typeof e=="number"?e<t.value:false;default:return true}}):true,A=()=>p?p.questions.filter(v):[],h=()=>p?A().every(t=>{if(!t.required)return true;let e=i[t.id];return !(e==null||typeof e=="string"&&e.trim()===""||Array.isArray(e)&&e.length===0)}):false,x=()=>{let r={};return p&&A().forEach(e=>{if(!e.required)return;let s=i[e.id];s==null||typeof s=="string"&&s.trim()===""?r[e.id]="This question is required":Array.isArray(s)&&s.length===0&&(r[e.id]="At least one option must be selected");}),r},C=()=>h()&&l<d.length-1?(c(r=>r+1),true):false,L=()=>l>0?(c(r=>r-1),true):false,O=r=>r>=0&&r<d.length?(c(r),true):false,T=()=>d.every((r,t)=>{c(t);let e=h();return c(l),e}),_=()=>{let r=[];return d.forEach(t=>{t.questions.forEach(e=>{let s=i[e.id];if(s!=null&&e.riskLevel)if(["select","radio","checkbox"].includes(e.type)&&e.options)(Array.isArray(s)?s:[s]).forEach(o=>{var w;let a=(w=e.options)==null?void 0:w.find(u=>u.value===o);if(a!=null&&a.riskLevel){let u=a.riskLevel,D=u==="low"?1:u==="medium"?3:5,P=u==="low"?1:u==="medium"?3:5;r.push({id:`risk_${r.length+1}`,description:`${e.text} - ${a.label}`,likelihood:D,impact:P,score:D*P,level:u,mitigated:false,relatedQuestionIds:[e.id]});}});else {let n=e.riskLevel,o=n==="low"?1:n==="medium"?3:5,a=n==="low"?1:n==="medium"?3:5;r.push({id:`risk_${r.length+1}`,description:e.text,likelihood:o,impact:a,score:o*a,level:n,mitigated:false,relatedQuestionIds:[e.id]});}});}),r},$=(r,t,e)=>{let s=_(),n={id:`dpia_${Date.now()}`,title:t,processingDescription:e,startedAt:Date.now(),completedAt:Date.now(),assessor:r,answers:i,risks:s,overallRiskLevel:"low",canProceed:true,conclusion:"",version:"1.0"},o=a$1(n);return n.overallRiskLevel=o.overallRiskLevel,n.canProceed=o.canProceed,n.conclusion=o.canProceed?"Based on the assessment, the processing can proceed with appropriate safeguards.":"Based on the assessment, the processing should not proceed without further mitigation measures.",n.recommendations=o.recommendations,I&&I(n),n},U=()=>{g({}),c(0),m&&typeof window!="undefined"&&localStorage.removeItem(f);},V=(()=>{let r=0,t=0;return d.forEach(e=>{e.questions.forEach(s=>{if(s.required&&v(s)){t++;let n=i[s.id];n!=null&&!(typeof n=="string"&&n.trim()==="")&&!(Array.isArray(n)&&n.length===0)&&r++;}});}),t>0?Math.round(r/t*100):0})();return {currentSectionIndex:l,currentSection:p,answers:i,updateAnswer:E,nextSection:C,prevSection:L,goToSection:O,isCurrentSectionValid:h,getCurrentSectionErrors:x,isComplete:T,completeDPIA:$,getVisibleQuestions:A,resetDPIA:U,progress:V}}export{N as a};//# sourceMappingURL=chunk-EWOZKYLY.mjs.map
2
- //# sourceMappingURL=chunk-EWOZKYLY.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../packages/ndpr-toolkit/src/hooks/useDPIA.ts"],"names":["useDPIA","sections","initialAnswers","storageKey","useLocalStorage","onComplete","currentSectionIndex","setCurrentSectionIndex","useState","answers","setAnswers","useEffect","savedData","savedAnswers","sectionIndex","error","currentSection","updateAnswer","questionId","value","prevAnswers","__spreadProps","__spreadValues","shouldShowQuestion","question","condition","answer","getVisibleQuestions","isCurrentSectionValid","getCurrentSectionErrors","errors","nextSection","prevIndex","prevSection","goToSection","index","isComplete","section","valid","identifyRisks","risks","selectedOption","_a","option","opt","riskLevel","likelihood","impact","completeDPIA","assessorInfo","title","processingDescription","result","assessment","assessDPIARisk","resetDPIA","progress","answeredQuestions","totalRequiredQuestions"],"mappings":"0HA4GO,SAASA,CAAAA,CAAQ,CACtB,QAAA,CAAAC,CAAAA,CACA,eAAAC,CAAAA,CAAiB,GACjB,UAAA,CAAAC,CAAAA,CAAa,iBACb,eAAA,CAAAC,CAAAA,CAAkB,KAClB,UAAA,CAAAC,CACF,EAAkC,CAChC,GAAM,CAACC,CAAAA,CAAqBC,CAAsB,EAAIC,QAAAA,CAAiB,CAAC,EAClE,CAACC,CAAAA,CAASC,CAAU,CAAA,CAAIF,QAAAA,CAA8BN,CAAc,CAAA,CAG1ES,SAAAA,CAAU,IAAM,CACd,GAAIP,GAAmB,OAAO,MAAA,EAAW,YACvC,GAAI,CACF,IAAMQ,CAAAA,CAAY,YAAA,CAAa,QAAQT,CAAU,CAAA,CACjD,GAAIS,CAAAA,CAAW,CACb,GAAM,CAAE,OAAA,CAASC,EAAc,YAAA,CAAAC,CAAa,EAAI,IAAA,CAAK,KAAA,CAAMF,CAAS,CAAA,CACpEF,CAAAA,CAAWG,GAAgB,EAAE,EAC7BN,CAAAA,CAAuBO,CAAAA,EAAgB,CAAC,EAC1C,CACF,OAASC,CAAAA,CAAO,CACd,QAAQ,KAAA,CAAM,0BAAA,CAA4BA,CAAK,EACjD,CAEJ,EAAG,CAACZ,CAAAA,CAAYC,CAAe,CAAC,CAAA,CAGhCO,UAAU,IAAM,CACd,GAAIP,CAAAA,EAAmB,OAAO,QAAW,WAAA,CACvC,GAAI,CACF,YAAA,CAAa,OAAA,CAAQD,EAAY,IAAA,CAAK,SAAA,CAAU,CAC9C,OAAA,CAAAM,CAAAA,CACA,aAAcH,CAChB,CAAC,CAAC,EACJ,CAAA,MAASS,EAAO,CACd,OAAA,CAAQ,MAAM,yBAAA,CAA2BA,CAAK,EAChD,CAEJ,CAAA,CAAG,CAACN,CAAAA,CAASH,CAAAA,CAAqBH,EAAYC,CAAe,CAAC,EAG9D,IAAMY,C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C,CACF,CACF","file":"chunk-EWOZKYLY.mjs","sourcesContent":["import { useState, useEffect } from 'react';\nimport { DPIAQuestion, DPIASection, DPIAResult, DPIARisk } from '../types/dpia';\nimport { assessDPIARisk } from '../utils/dpia';\n\ninterface UseDPIAOptions {\n /**\n * Sections of the DPIA questionnaire\n */\n sections: DPIASection[];\n \n /**\n * Initial answers (if resuming a DPIA)\n */\n initialAnswers?: Record<string, any>;\n \n /**\n * Storage key for DPIA data\n * @default \"ndpr_dpia_data\"\n */\n storageKey?: string;\n \n /**\n * Whether to use local storage to persist DPIA data\n * @default true\n */\n useLocalStorage?: boolean;\n \n /**\n * Callback function called when the DPIA is completed\n */\n onComplete?: (result: DPIAResult) => void;\n}\n\ninterface UseDPIAReturn {\n /**\n * Current section index\n */\n currentSectionIndex: number;\n \n /**\n * Current section\n */\n currentSection: DPIASection | null;\n \n /**\n * All answers\n */\n answers: Record<string, any>;\n \n /**\n * Update an answer\n */\n updateAnswer: (questionId: string, value: any) => void;\n \n /**\n * Go to the next section\n */\n nextSection: () => boolean;\n \n /**\n * Go to the previous section\n */\n prevSection: () => boolean;\n \n /**\n * Go to a specific section\n */\n goToSection: (index: number) => boolean;\n \n /**\n * Check if the current section is valid\n */\n isCurrentSectionValid: () => boolean;\n \n /**\n * Get validation errors for the current section\n */\n getCurrentSectionErrors: () => Record<string, string>;\n \n /**\n * Check if the DPIA is complete\n */\n isComplete: () => boolean;\n \n /**\n * Complete the DPIA and generate a result\n */\n completeDPIA: (assessorInfo: { name: string; role: string; email: string; }, title: string, processingDescription: string) => DPIAResult;\n \n /**\n * Get the visible questions for the current section\n */\n getVisibleQuestions: () => DPIAQuestion[];\n \n /**\n * Reset the DPIA\n */\n resetDPIA: () => void;\n \n /**\n * Progress percentage\n */\n progress: number;\n}\n\n/**\n * Hook for conducting Data Protection Impact Assessments in compliance with the NDPA 2023\n */\nexport function useDPIA({\n sections,\n initialAnswers = {},\n storageKey = \"ndpr_dpia_data\",\n useLocalStorage = true,\n onComplete\n}: UseDPIAOptions): UseDPIAReturn {\n const [currentSectionIndex, setCurrentSectionIndex] = useState<number>(0);\n const [answers, setAnswers] = useState<Record<string, any>>(initialAnswers);\n \n // Load DPIA data from storage on mount\n useEffect(() => {\n if (useLocalStorage && typeof window !== 'undefined') {\n try {\n const savedData = localStorage.getItem(storageKey);\n if (savedData) {\n const { answers: savedAnswers, sectionIndex } = JSON.parse(savedData);\n setAnswers(savedAnswers || {});\n setCurrentSectionIndex(sectionIndex || 0);\n }\n } catch (error) {\n console.error('Error loading DPIA data:', error);\n }\n }\n }, [storageKey, useLocalStorage]);\n \n // Save DPIA data to storage when it changes\n useEffect(() => {\n if (useLocalStorage && typeof window !== 'undefined') {\n try {\n localStorage.setItem(storageKey, JSON.stringify({\n answers,\n sectionIndex: currentSectionIndex\n }));\n } catch (error) {\n console.error('Error saving DPIA data:', error);\n }\n }\n }, [answers, currentSectionIndex, storageKey, useLocalStorage]);\n \n // Get the current section\n const currentSection = sections[currentSectionIndex] || null;\n \n // Update an answer\n const updateAnswer = (questionId: string, value: any) => {\n setAnswers(prevAnswers => ({\n ...prevAnswers,\n [questionId]: value\n }));\n };\n \n // Check if a question should be shown based on its conditions\n const shouldShowQuestion = (question: DPIAQuestion): boolean => {\n if (!question.showWhen) {\n return true;\n }\n \n return question.showWhen.every(condition => {\n const answer = answers[condition.questionId];\n \n switch (condition.operator) {\n case 'equals':\n return answer === condition.value;\n case 'contains':\n return Array.isArray(answer) ? answer.includes(condition.value) : false;\n case 'greaterThan':\n return typeof answer === 'number' ? answer > condition.value : false;\n case 'lessThan':\n return typeof answer === 'number' ? answer < condition.value : false;\n default:\n return true;\n }\n });\n };\n \n // Get the visible questions for the current section\n const getVisibleQuestions = (): DPIAQuestion[] => {\n if (!currentSection) {\n return [];\n }\n \n return currentSection.questions.filter(shouldShowQuestion);\n };\n \n // Check if the current section is valid\n const isCurrentSectionValid = (): boolean => {\n if (!currentSection) {\n return false;\n }\n \n const visibleQuestions = getVisibleQuestions();\n \n return visibleQuestions.every(question => {\n if (!question.required) {\n return true;\n }\n \n const answer = answers[question.id];\n \n if (answer === undefined || answer === null) {\n return false;\n }\n \n if (typeof answer === 'string' && answer.trim() === '') {\n return false;\n }\n \n if (Array.isArray(answer) && answer.length === 0) {\n return false;\n }\n \n return true;\n });\n };\n \n // Get validation errors for the current section\n const getCurrentSectionErrors = (): Record<string, string> => {\n const errors: Record<string, string> = {};\n \n if (!currentSection) {\n return errors;\n }\n \n const visibleQuestions = getVisibleQuestions();\n \n visibleQuestions.forEach(question => {\n if (!question.required) {\n return;\n }\n \n const answer = answers[question.id];\n \n if (answer === undefined || answer === null) {\n errors[question.id] = 'This question is required';\n } else if (typeof answer === 'string' && answer.trim() === '') {\n errors[question.id] = 'This question is required';\n } else if (Array.isArray(answer) && answer.length === 0) {\n errors[question.id] = 'At least one option must be selected';\n }\n });\n \n return errors;\n };\n \n // Go to the next section\n const nextSection = (): boolean => {\n if (!isCurrentSectionValid()) {\n return false;\n }\n \n if (currentSectionIndex < sections.length - 1) {\n setCurrentSectionIndex(prevIndex => prevIndex + 1);\n return true;\n }\n \n return false;\n };\n \n // Go to the previous section\n const prevSection = (): boolean => {\n if (currentSectionIndex > 0) {\n setCurrentSectionIndex(prevIndex => prevIndex - 1);\n return true;\n }\n \n return false;\n };\n \n // Go to a specific section\n const goToSection = (index: number): boolean => {\n if (index >= 0 && index < sections.length) {\n setCurrentSectionIndex(index);\n return true;\n }\n \n return false;\n };\n \n // Check if the DPIA is complete\n const isComplete = (): boolean => {\n return sections.every((section, index) => {\n // Temporarily set the current section to check ifit&apos;s valid\n setCurrentSectionIndex(index);\n const valid = isCurrentSectionValid();\n // Restore the current section\n setCurrentSectionIndex(currentSectionIndex);\n return valid;\n });\n };\n \n // Identify risks based on answers\n const identifyRisks = (): DPIARisk[] => {\n const risks: DPIARisk[] = [];\n \n // Check each question for risk indicators\n sections.forEach(section => {\n section.questions.forEach(question => {\n const answer = answers[question.id];\n \n // Skip if no answer\n if (answer === undefined || answer === null) {\n return;\n }\n \n // Check if the question has a risk level\n if (question.riskLevel) {\n // For select/radio/checkbox questions, check if the selected option has a risk level\n if (['select', 'radio', 'checkbox'].includes(question.type) && question.options) {\n const selectedOptions = Array.isArray(answer) ? answer : [answer];\n \n selectedOptions.forEach(selectedOption => {\n const option = question.options?.find(opt => opt.value === selectedOption);\n \n if (option?.riskLevel) {\n const riskLevel = option.riskLevel;\n const likelihood = riskLevel === 'low' ? 1 : riskLevel === 'medium' ? 3 : 5;\n const impact = riskLevel === 'low' ? 1 : riskLevel === 'medium' ? 3 : 5;\n \n risks.push({\n id: `risk_${risks.length + 1}`,\n description: `${question.text} - ${option.label}`,\n likelihood,\n impact,\n score: likelihood * impact,\n level: riskLevel,\n mitigated: false,\n relatedQuestionIds: [question.id]\n });\n }\n });\n } else {\n // For other question types, use the question's risk level\n const riskLevel = question.riskLevel;\n const likelihood = riskLevel === 'low' ? 1 : riskLevel === 'medium' ? 3 : 5;\n const impact = riskLevel === 'low' ? 1 : riskLevel === 'medium' ? 3 : 5;\n \n risks.push({\n id: `risk_${risks.length + 1}`,\n description: question.text,\n likelihood,\n impact,\n score: likelihood * impact,\n level: riskLevel,\n mitigated: false,\n relatedQuestionIds: [question.id]\n });\n }\n }\n });\n });\n \n return risks;\n };\n \n // Complete the DPIA and generate a result\n const completeDPIA = (\n assessorInfo: { name: string; role: string; email: string; },\n title: string,\n processingDescription: string\n ): DPIAResult => {\n const risks = identifyRisks();\n \n const result: DPIAResult = {\n id: `dpia_${Date.now()}`,\n title,\n processingDescription,\n startedAt: Date.now(),\n completedAt: Date.now(),\n assessor: assessorInfo,\n answers,\n risks,\n overallRiskLevel: 'low',\n canProceed: true,\n conclusion: '',\n version: '1.0'\n };\n \n // Assess the risks\n const assessment = assessDPIARisk(result);\n \n result.overallRiskLevel = assessment.overallRiskLevel;\n result.canProceed = assessment.canProceed;\n result.conclusion = assessment.canProceed\n ? 'Based on the assessment, the processing can proceed with appropriate safeguards.'\n : 'Based on the assessment, the processing should not proceed without further mitigation measures.';\n result.recommendations = assessment.recommendations;\n \n if (onComplete) {\n onComplete(result);\n }\n \n return result;\n };\n \n // Reset the DPIA\n const resetDPIA = () => {\n setAnswers({});\n setCurrentSectionIndex(0);\n \n if (useLocalStorage && typeof window !== 'undefined') {\n localStorage.removeItem(storageKey);\n }\n };\n \n // Calculate progress percentage\n const progress = (() => {\n let answeredQuestions = 0;\n let totalRequiredQuestions = 0;\n \n sections.forEach(section => {\n section.questions.forEach(question => {\n if (question.required && shouldShowQuestion(question)) {\n totalRequiredQuestions++;\n \n const answer = answers[question.id];\n if (\n answer !== undefined && \n answer !== null && \n !(typeof answer === 'string' && answer.trim() === '') &&\n !(Array.isArray(answer) && answer.length === 0)\n ) {\n answeredQuestions++;\n }\n }\n });\n });\n \n return totalRequiredQuestions > 0 \n ? Math.round((answeredQuestions / totalRequiredQuestions) * 100) \n : 0;\n })();\n \n return {\n currentSectionIndex,\n currentSection,\n answers,\n updateAnswer,\n nextSection,\n prevSection,\n goToSection,\n isCurrentSectionValid,\n getCurrentSectionErrors,\n isComplete,\n completeDPIA,\n getVisibleQuestions,\n resetDPIA,\n progress\n };\n}\n"]}
@@ -1,2 +0,0 @@
1
- 'use strict';var chunkSSGJREE3_js=require('./chunk-SSGJREE3.js'),chunkMQFZHA2D_js=require('./chunk-MQFZHA2D.js'),react=require('react');function N({sections:d,initialAnswers:Q={},storageKey:f="ndpr_dpia_data",useLocalStorage:m=true,onComplete:I}){let[l,c]=react.useState(0),[i,g]=react.useState(Q);react.useEffect(()=>{if(m&&typeof window!="undefined")try{let r=localStorage.getItem(f);if(r){let{answers:t,sectionIndex:e}=JSON.parse(r);g(t||{}),c(e||0);}}catch(r){console.error("Error loading DPIA data:",r);}},[f,m]),react.useEffect(()=>{if(m&&typeof window!="undefined")try{localStorage.setItem(f,JSON.stringify({answers:i,sectionIndex:l}));}catch(r){console.error("Error saving DPIA data:",r);}},[i,l,f,m]);let p=d[l]||null,E=(r,t)=>{g(e=>chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},e),{[r]:t}));},v=r=>r.showWhen?r.showWhen.every(t=>{let e=i[t.questionId];switch(t.operator){case "equals":return e===t.value;case "contains":return Array.isArray(e)?e.includes(t.value):false;case "greaterThan":return typeof e=="number"?e>t.value:false;case "lessThan":return typeof e=="number"?e<t.value:false;default:return true}}):true,A=()=>p?p.questions.filter(v):[],h=()=>p?A().every(t=>{if(!t.required)return true;let e=i[t.id];return !(e==null||typeof e=="string"&&e.trim()===""||Array.isArray(e)&&e.length===0)}):false,x=()=>{let r={};return p&&A().forEach(e=>{if(!e.required)return;let s=i[e.id];s==null||typeof s=="string"&&s.trim()===""?r[e.id]="This question is required":Array.isArray(s)&&s.length===0&&(r[e.id]="At least one option must be selected");}),r},C=()=>h()&&l<d.length-1?(c(r=>r+1),true):false,L=()=>l>0?(c(r=>r-1),true):false,O=r=>r>=0&&r<d.length?(c(r),true):false,T=()=>d.every((r,t)=>{c(t);let e=h();return c(l),e}),_=()=>{let r=[];return d.forEach(t=>{t.questions.forEach(e=>{let s=i[e.id];if(s!=null&&e.riskLevel)if(["select","radio","checkbox"].includes(e.type)&&e.options)(Array.isArray(s)?s:[s]).forEach(o=>{var w;let a=(w=e.options)==null?void 0:w.find(u=>u.value===o);if(a!=null&&a.riskLevel){let u=a.riskLevel,D=u==="low"?1:u==="medium"?3:5,P=u==="low"?1:u==="medium"?3:5;r.push({id:`risk_${r.length+1}`,description:`${e.text} - ${a.label}`,likelihood:D,impact:P,score:D*P,level:u,mitigated:false,relatedQuestionIds:[e.id]});}});else {let n=e.riskLevel,o=n==="low"?1:n==="medium"?3:5,a=n==="low"?1:n==="medium"?3:5;r.push({id:`risk_${r.length+1}`,description:e.text,likelihood:o,impact:a,score:o*a,level:n,mitigated:false,relatedQuestionIds:[e.id]});}});}),r},$=(r,t,e)=>{let s=_(),n={id:`dpia_${Date.now()}`,title:t,processingDescription:e,startedAt:Date.now(),completedAt:Date.now(),assessor:r,answers:i,risks:s,overallRiskLevel:"low",canProceed:true,conclusion:"",version:"1.0"},o=chunkSSGJREE3_js.a(n);return n.overallRiskLevel=o.overallRiskLevel,n.canProceed=o.canProceed,n.conclusion=o.canProceed?"Based on the assessment, the processing can proceed with appropriate safeguards.":"Based on the assessment, the processing should not proceed without further mitigation measures.",n.recommendations=o.recommendations,I&&I(n),n},U=()=>{g({}),c(0),m&&typeof window!="undefined"&&localStorage.removeItem(f);},V=(()=>{let r=0,t=0;return d.forEach(e=>{e.questions.forEach(s=>{if(s.required&&v(s)){t++;let n=i[s.id];n!=null&&!(typeof n=="string"&&n.trim()==="")&&!(Array.isArray(n)&&n.length===0)&&r++;}});}),t>0?Math.round(r/t*100):0})();return {currentSectionIndex:l,currentSection:p,answers:i,updateAnswer:E,nextSection:C,prevSection:L,goToSection:O,isCurrentSectionValid:h,getCurrentSectionErrors:x,isComplete:T,completeDPIA:$,getVisibleQuestions:A,resetDPIA:U,progress:V}}exports.a=N;//# sourceMappingURL=chunk-U2CGMEWB.js.map
2
- //# sourceMappingURL=chunk-U2CGMEWB.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../packages/ndpr-toolkit/src/hooks/useDPIA.ts"],"names":["useDPIA","sections","initialAnswers","storageKey","useLocalStorage","onComplete","currentSectionIndex","setCurrentSectionIndex","useState","answers","setAnswers","useEffect","savedData","savedAnswers","sectionIndex","error","currentSection","updateAnswer","questionId","value","prevAnswers","__spreadProps","__spreadValues","shouldShowQuestion","question","condition","answer","getVisibleQuestions","isCurrentSectionValid","getCurrentSectionErrors","errors","nextSection","prevIndex","prevSection","goToSection","index","isComplete","section","valid","identifyRisks","risks","selectedOption","_a","option","opt","riskLevel","likelihood","impact","completeDPIA","assessorInfo","title","processingDescription","result","assessment","assessDPIARisk","resetDPIA","progress","answeredQuestions","totalRequiredQuestions"],"mappings":"wIA4GO,SAASA,CAAAA,CAAQ,CACtB,QAAA,CAAAC,CAAAA,CACA,eAAAC,CAAAA,CAAiB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ACbH,CAAAA,CAAuB,CAAC,EAEpBH,CAAAA,EAAmB,OAAO,QAAW,WAAA,EACvC,YAAA,CAAa,WAAWD,CAAU,EAEtC,EAGMqD,CAAAA,CAAAA,CAAY,IAAM,CACtB,IAAIC,CAAAA,CAAoB,EACpBC,CAAAA,CAAyB,CAAA,CAE7B,OAAAzD,CAAAA,CAAS,OAAA,CAAQoC,GAAW,CAC1BA,CAAAA,CAAQ,UAAU,OAAA,CAAQb,CAAAA,EAAY,CACpC,GAAIA,CAAAA,CAAS,UAAYD,CAAAA,CAAmBC,CAAQ,EAAG,CACrDkC,CAAAA,EAAAA,CAEA,IAAMhC,CAAAA,CAASjB,CAAAA,CAAQe,EAAS,EAAE,CAAA,CAGhCE,GAAW,IAAA,EACX,EAAE,OAAOA,CAAAA,EAAW,QAAA,EAAYA,EAAO,IAAA,EAAK,GAAM,KAClD,EAAE,KAAA,CAAM,QAAQA,CAAM,CAAA,EAAKA,EAAO,MAAA,GAAW,CAAA,CAAA,EAE7C+B,IAEJ,CACF,CAAC,EACH,CAAC,CAAA,CAEMC,EAAyB,CAAA,CAC5B,IAAA,CAAK,MAAOD,CAAAA,CAAoBC,CAAAA,CAA0B,GAAG,CAAA,CAC7D,CACN,IAAG,CAEH,OAAO,CACL,mBAAA,CAAApD,CAAAA,CACA,eAAAU,CAAAA,CACA,OAAA,CAAAP,EACA,YAAA,CAAAQ,CAAAA,CACA,YAAAc,CAAAA,CACA,WAAA,CAAAE,EACA,WAAA,CAAAC,CAAAA,CACA,sBAAAN,CAAAA,CACA,uBAAA,CAAAC,EACA,UAAA,CAAAO,CAAAA,CACA,aAAAY,CAAAA,CACA,mBAAA,CAAArB,EACA,SAAA,CAAA4B,CAAAA,CACA,QAAA,CAAAC,CACF,CACF","file":"chunk-U2CGMEWB.js","sourcesContent":["import { useState, useEffect } from 'react';\nimport { DPIAQuestion, DPIASection, DPIAResult, DPIARisk } from '../types/dpia';\nimport { assessDPIARisk } from '../utils/dpia';\n\ninterface UseDPIAOptions {\n /**\n * Sections of the DPIA questionnaire\n */\n sections: DPIASection[];\n \n /**\n * Initial answers (if resuming a DPIA)\n */\n initialAnswers?: Record<string, any>;\n \n /**\n * Storage key for DPIA data\n * @default \"ndpr_dpia_data\"\n */\n storageKey?: string;\n \n /**\n * Whether to use local storage to persist DPIA data\n * @default true\n */\n useLocalStorage?: boolean;\n \n /**\n * Callback function called when the DPIA is completed\n */\n onComplete?: (result: DPIAResult) => void;\n}\n\ninterface UseDPIAReturn {\n /**\n * Current section index\n */\n currentSectionIndex: number;\n \n /**\n * Current section\n */\n currentSection: DPIASection | null;\n \n /**\n * All answers\n */\n answers: Record<string, any>;\n \n /**\n * Update an answer\n */\n updateAnswer: (questionId: string, value: any) => void;\n \n /**\n * Go to the next section\n */\n nextSection: () => boolean;\n \n /**\n * Go to the previous section\n */\n prevSection: () => boolean;\n \n /**\n * Go to a specific section\n */\n goToSection: (index: number) => boolean;\n \n /**\n * Check if the current section is valid\n */\n isCurrentSectionValid: () => boolean;\n \n /**\n * Get validation errors for the current section\n */\n getCurrentSectionErrors: () => Record<string, string>;\n \n /**\n * Check if the DPIA is complete\n */\n isComplete: () => boolean;\n \n /**\n * Complete the DPIA and generate a result\n */\n completeDPIA: (assessorInfo: { name: string; role: string; email: string; }, title: string, processingDescription: string) => DPIAResult;\n \n /**\n * Get the visible questions for the current section\n */\n getVisibleQuestions: () => DPIAQuestion[];\n \n /**\n * Reset the DPIA\n */\n resetDPIA: () => void;\n \n /**\n * Progress percentage\n */\n progress: number;\n}\n\n/**\n * Hook for conducting Data Protection Impact Assessments in compliance with the NDPA 2023\n */\nexport function useDPIA({\n sections,\n initialAnswers = {},\n storageKey = \"ndpr_dpia_data\",\n useLocalStorage = true,\n onComplete\n}: UseDPIAOptions): UseDPIAReturn {\n const [currentSectionIndex, setCurrentSectionIndex] = useState<number>(0);\n const [answers, setAnswers] = useState<Record<string, any>>(initialAnswers);\n \n // Load DPIA data from storage on mount\n useEffect(() => {\n if (useLocalStorage && typeof window !== 'undefined') {\n try {\n const savedData = localStorage.getItem(storageKey);\n if (savedData) {\n const { answers: savedAnswers, sectionIndex } = JSON.parse(savedData);\n setAnswers(savedAnswers || {});\n setCurrentSectionIndex(sectionIndex || 0);\n }\n } catch (error) {\n console.error('Error loading DPIA data:', error);\n }\n }\n }, [storageKey, useLocalStorage]);\n \n // Save DPIA data to storage when it changes\n useEffect(() => {\n if (useLocalStorage && typeof window !== 'undefined') {\n try {\n localStorage.setItem(storageKey, JSON.stringify({\n answers,\n sectionIndex: currentSectionIndex\n }));\n } catch (error) {\n console.error('Error saving DPIA data:', error);\n }\n }\n }, [answers, currentSectionIndex, storageKey, useLocalStorage]);\n \n // Get the current section\n const currentSection = sections[currentSectionIndex] || null;\n \n // Update an answer\n const updateAnswer = (questionId: string, value: any) => {\n setAnswers(prevAnswers => ({\n ...prevAnswers,\n [questionId]: value\n }));\n };\n \n // Check if a question should be shown based on its conditions\n const shouldShowQuestion = (question: DPIAQuestion): boolean => {\n if (!question.showWhen) {\n return true;\n }\n \n return question.showWhen.every(condition => {\n const answer = answers[condition.questionId];\n \n switch (condition.operator) {\n case 'equals':\n return answer === condition.value;\n case 'contains':\n return Array.isArray(answer) ? answer.includes(condition.value) : false;\n case 'greaterThan':\n return typeof answer === 'number' ? answer > condition.value : false;\n case 'lessThan':\n return typeof answer === 'number' ? answer < condition.value : false;\n default:\n return true;\n }\n });\n };\n \n // Get the visible questions for the current section\n const getVisibleQuestions = (): DPIAQuestion[] => {\n if (!currentSection) {\n return [];\n }\n \n return currentSection.questions.filter(shouldShowQuestion);\n };\n \n // Check if the current section is valid\n const isCurrentSectionValid = (): boolean => {\n if (!currentSection) {\n return false;\n }\n \n const visibleQuestions = getVisibleQuestions();\n \n return visibleQuestions.every(question => {\n if (!question.required) {\n return true;\n }\n \n const answer = answers[question.id];\n \n if (answer === undefined || answer === null) {\n return false;\n }\n \n if (typeof answer === 'string' && answer.trim() === '') {\n return false;\n }\n \n if (Array.isArray(answer) && answer.length === 0) {\n return false;\n }\n \n return true;\n });\n };\n \n // Get validation errors for the current section\n const getCurrentSectionErrors = (): Record<string, string> => {\n const errors: Record<string, string> = {};\n \n if (!currentSection) {\n return errors;\n }\n \n const visibleQuestions = getVisibleQuestions();\n \n visibleQuestions.forEach(question => {\n if (!question.required) {\n return;\n }\n \n const answer = answers[question.id];\n \n if (answer === undefined || answer === null) {\n errors[question.id] = 'This question is required';\n } else if (typeof answer === 'string' && answer.trim() === '') {\n errors[question.id] = 'This question is required';\n } else if (Array.isArray(answer) && answer.length === 0) {\n errors[question.id] = 'At least one option must be selected';\n }\n });\n \n return errors;\n };\n \n // Go to the next section\n const nextSection = (): boolean => {\n if (!isCurrentSectionValid()) {\n return false;\n }\n \n if (currentSectionIndex < sections.length - 1) {\n setCurrentSectionIndex(prevIndex => prevIndex + 1);\n return true;\n }\n \n return false;\n };\n \n // Go to the previous section\n const prevSection = (): boolean => {\n if (currentSectionIndex > 0) {\n setCurrentSectionIndex(prevIndex => prevIndex - 1);\n return true;\n }\n \n return false;\n };\n \n // Go to a specific section\n const goToSection = (index: number): boolean => {\n if (index >= 0 && index < sections.length) {\n setCurrentSectionIndex(index);\n return true;\n }\n \n return false;\n };\n \n // Check if the DPIA is complete\n const isComplete = (): boolean => {\n return sections.every((section, index) => {\n // Temporarily set the current section to check ifit&apos;s valid\n setCurrentSectionIndex(index);\n const valid = isCurrentSectionValid();\n // Restore the current section\n setCurrentSectionIndex(currentSectionIndex);\n return valid;\n });\n };\n \n // Identify risks based on answers\n const identifyRisks = (): DPIARisk[] => {\n const risks: DPIARisk[] = [];\n \n // Check each question for risk indicators\n sections.forEach(section => {\n section.questions.forEach(question => {\n const answer = answers[question.id];\n \n // Skip if no answer\n if (answer === undefined || answer === null) {\n return;\n }\n \n // Check if the question has a risk level\n if (question.riskLevel) {\n // For select/radio/checkbox questions, check if the selected option has a risk level\n if (['select', 'radio', 'checkbox'].includes(question.type) && question.options) {\n const selectedOptions = Array.isArray(answer) ? answer : [answer];\n \n selectedOptions.forEach(selectedOption => {\n const option = question.options?.find(opt => opt.value === selectedOption);\n \n if (option?.riskLevel) {\n const riskLevel = option.riskLevel;\n const likelihood = riskLevel === 'low' ? 1 : riskLevel === 'medium' ? 3 : 5;\n const impact = riskLevel === 'low' ? 1 : riskLevel === 'medium' ? 3 : 5;\n \n risks.push({\n id: `risk_${risks.length + 1}`,\n description: `${question.text} - ${option.label}`,\n likelihood,\n impact,\n score: likelihood * impact,\n level: riskLevel,\n mitigated: false,\n relatedQuestionIds: [question.id]\n });\n }\n });\n } else {\n // For other question types, use the question's risk level\n const riskLevel = question.riskLevel;\n const likelihood = riskLevel === 'low' ? 1 : riskLevel === 'medium' ? 3 : 5;\n const impact = riskLevel === 'low' ? 1 : riskLevel === 'medium' ? 3 : 5;\n \n risks.push({\n id: `risk_${risks.length + 1}`,\n description: question.text,\n likelihood,\n impact,\n score: likelihood * impact,\n level: riskLevel,\n mitigated: false,\n relatedQuestionIds: [question.id]\n });\n }\n }\n });\n });\n \n return risks;\n };\n \n // Complete the DPIA and generate a result\n const completeDPIA = (\n assessorInfo: { name: string; role: string; email: string; },\n title: string,\n processingDescription: string\n ): DPIAResult => {\n const risks = identifyRisks();\n \n const result: DPIAResult = {\n id: `dpia_${Date.now()}`,\n title,\n processingDescription,\n startedAt: Date.now(),\n completedAt: Date.now(),\n assessor: assessorInfo,\n answers,\n risks,\n overallRiskLevel: 'low',\n canProceed: true,\n conclusion: '',\n version: '1.0'\n };\n \n // Assess the risks\n const assessment = assessDPIARisk(result);\n \n result.overallRiskLevel = assessment.overallRiskLevel;\n result.canProceed = assessment.canProceed;\n result.conclusion = assessment.canProceed\n ? 'Based on the assessment, the processing can proceed with appropriate safeguards.'\n : 'Based on the assessment, the processing should not proceed without further mitigation measures.';\n result.recommendations = assessment.recommendations;\n \n if (onComplete) {\n onComplete(result);\n }\n \n return result;\n };\n \n // Reset the DPIA\n const resetDPIA = () => {\n setAnswers({});\n setCurrentSectionIndex(0);\n \n if (useLocalStorage && typeof window !== 'undefined') {\n localStorage.removeItem(storageKey);\n }\n };\n \n // Calculate progress percentage\n const progress = (() => {\n let answeredQuestions = 0;\n let totalRequiredQuestions = 0;\n \n sections.forEach(section => {\n section.questions.forEach(question => {\n if (question.required && shouldShowQuestion(question)) {\n totalRequiredQuestions++;\n \n const answer = answers[question.id];\n if (\n answer !== undefined && \n answer !== null && \n !(typeof answer === 'string' && answer.trim() === '') &&\n !(Array.isArray(answer) && answer.length === 0)\n ) {\n answeredQuestions++;\n }\n }\n });\n });\n \n return totalRequiredQuestions > 0 \n ? Math.round((answeredQuestions / totalRequiredQuestions) * 100) \n : 0;\n })();\n \n return {\n currentSectionIndex,\n currentSection,\n answers,\n updateAnswer,\n nextSection,\n prevSection,\n goToSection,\n isCurrentSectionValid,\n getCurrentSectionErrors,\n isComplete,\n completeDPIA,\n getVisibleQuestions,\n resetDPIA,\n progress\n };\n}\n"]}