@tantainnovative/ndpr-toolkit 5.7.0 → 5.7.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/CHANGELOG.md +17 -0
- package/bin/ndpr.mjs +11 -3
- package/dist/adapters.js +1 -1
- package/dist/adapters.mjs +1 -1
- package/dist/{chunk-BIJSMSUU.mjs → chunk-3ELNTFUX.mjs} +1 -1
- package/dist/{chunk-CWY2FMIC.mjs → chunk-4QQJEO3F.mjs} +1 -1
- package/dist/{chunk-UVXS7KRV.mjs → chunk-4R24NN4F.mjs} +1 -1
- package/dist/{chunk-NUOHT3LO.js → chunk-6GG3XWI6.js} +1 -1
- package/dist/chunk-AVV47UX7.mjs +1 -0
- package/dist/{chunk-6LJHLE6G.js → chunk-CIEWD57T.js} +1 -1
- package/dist/{chunk-2MGLU3FY.js → chunk-D4BC2NZZ.js} +2 -2
- package/dist/chunk-F3YIUWR3.mjs +1 -0
- package/dist/{chunk-D2ZKDQVL.js → chunk-F54TBNVF.js} +1 -1
- package/dist/{chunk-TWWGNFPF.mjs → chunk-FVZUR7QN.mjs} +1 -1
- package/dist/{chunk-HDPXARLC.mjs → chunk-IT5VIC2P.mjs} +1 -1
- package/dist/{chunk-KE2FZH2V.mjs → chunk-JTM463ES.mjs} +1 -1
- package/dist/{chunk-RC3XFXTJ.js → chunk-MHQMCLFJ.js} +1 -1
- package/dist/{chunk-6KQADEFS.js → chunk-OVXDSUQU.js} +1 -1
- package/dist/chunk-PYM5Z3SB.js +1 -0
- package/dist/{chunk-SMEZAQNJ.js → chunk-T63MYPKE.js} +1 -1
- package/dist/chunk-TKY6M4TM.js +1 -0
- package/dist/{chunk-NBQQ2GN3.mjs → chunk-UZBRO7WP.mjs} +1 -1
- package/dist/{chunk-5E56KT7E.mjs → chunk-VSW3N5JC.mjs} +1 -1
- package/dist/{chunk-QHW4UKGJ.js → chunk-WJ4DAOKE.js} +2 -2
- package/dist/core.js +1 -1
- package/dist/core.mjs +1 -1
- package/dist/headless.js +1 -1
- package/dist/headless.mjs +1 -1
- package/dist/hooks.js +1 -1
- package/dist/hooks.mjs +1 -1
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/dist/policy.js +1 -1
- package/dist/policy.mjs +1 -1
- package/dist/presets-policy.js +1 -1
- package/dist/presets-policy.mjs +1 -1
- package/dist/presets.js +1 -1
- package/dist/presets.mjs +1 -1
- package/dist/server.js +1 -1
- package/dist/server.mjs +1 -1
- package/package.json +1 -1
- package/dist/chunk-7PMPKVY3.mjs +0 -1
- package/dist/chunk-NUWVPRNI.js +0 -1
- package/dist/chunk-R3CU7DTT.js +0 -1
- package/dist/chunk-ZIZL37BG.mjs +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,23 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
## [5.7.1](https://github.com/mr-tanta/ndpr-toolkit/compare/v5.7.0...v5.7.1) (2026-06-05)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* **site:** complete sitemap, add missing canonicals, standardise locale to en_NG ([7340b28](https://github.com/mr-tanta/ndpr-toolkit/commit/7340b28cbe20bb167ba0357b7a6010a29edad296))
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* correct NDPA citations and harden CLI/adapter edge cases ([86f0698](https://github.com/mr-tanta/ndpr-toolkit/commit/86f06987346fd5d7bb7ea920245fc5a28fb3cf1a))
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Code Refactoring
|
|
19
|
+
|
|
20
|
+
* remove dead code and avoidable any casts ([2cd0053](https://github.com/mr-tanta/ndpr-toolkit/commit/2cd0053406ed90e735f3a709e01db8c53fda6ce4))
|
|
21
|
+
|
|
5
22
|
## [5.7.0](https://github.com/mr-tanta/ndpr-toolkit/compare/v5.6.0...v5.7.0) (2026-06-02)
|
|
6
23
|
|
|
7
24
|
|
package/bin/ndpr.mjs
CHANGED
|
@@ -109,16 +109,24 @@ async function main() {
|
|
|
109
109
|
process.stderr.write(`Failed to parse ${configPath}: ${err.message}\n`);
|
|
110
110
|
return 2;
|
|
111
111
|
}
|
|
112
|
-
if (!config || typeof config.compliance !== 'object') {
|
|
112
|
+
if (!config || typeof config.compliance !== 'object' || config.compliance === null) {
|
|
113
113
|
process.stderr.write(`Config ${configPath} must contain a "compliance" object.\n`);
|
|
114
114
|
return 2;
|
|
115
115
|
}
|
|
116
116
|
|
|
117
117
|
const { runNdprAudit, formatNdprAuditReport } = await import('@tantainnovative/ndpr-toolkit/server');
|
|
118
118
|
|
|
119
|
-
const minScore = args.flags['min-score'] !== undefined ? Number(args.flags['min-score']) : config.minScore;
|
|
120
119
|
const options = { ...(config.options ?? {}) };
|
|
121
|
-
if (
|
|
120
|
+
if (args.flags['min-score'] !== undefined) {
|
|
121
|
+
const minScore = Number(args.flags['min-score']);
|
|
122
|
+
if (typeof args.flags['min-score'] !== 'string' || Number.isNaN(minScore)) {
|
|
123
|
+
process.stderr.write('--min-score requires a numeric value.\n');
|
|
124
|
+
return 2;
|
|
125
|
+
}
|
|
126
|
+
options.minScore = minScore;
|
|
127
|
+
} else if (config.minScore !== undefined) {
|
|
128
|
+
options.minScore = config.minScore;
|
|
129
|
+
}
|
|
122
130
|
|
|
123
131
|
const result = runNdprAudit(
|
|
124
132
|
{ compliance: config.compliance, dcpmi: config.dcpmi, car: config.car, breaches: config.breaches },
|
package/dist/adapters.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var chunkPYM5Z3SB_js=require('./chunk-PYM5Z3SB.js'),chunkC2KEXHRX_js=require('./chunk-C2KEXHRX.js'),chunkVWED6UTN_js=require('./chunk-VWED6UTN.js');require('./chunk-RFPLZDIO.js');Object.defineProperty(exports,"apiAdapter",{enumerable:true,get:function(){return chunkPYM5Z3SB_js.a}});Object.defineProperty(exports,"composeAdapters",{enumerable:true,get:function(){return chunkPYM5Z3SB_js.c}});Object.defineProperty(exports,"memoryAdapter",{enumerable:true,get:function(){return chunkPYM5Z3SB_js.b}});Object.defineProperty(exports,"cookieAdapter",{enumerable:true,get:function(){return chunkC2KEXHRX_js.b}});Object.defineProperty(exports,"sessionStorageAdapter",{enumerable:true,get:function(){return chunkC2KEXHRX_js.a}});Object.defineProperty(exports,"localStorageAdapter",{enumerable:true,get:function(){return chunkVWED6UTN_js.a}});
|
package/dist/adapters.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{a as apiAdapter,c as composeAdapters,b as memoryAdapter}from'./chunk-
|
|
1
|
+
export{a as apiAdapter,c as composeAdapters,b as memoryAdapter}from'./chunk-F3YIUWR3.mjs';export{b as cookieAdapter,a as sessionStorageAdapter}from'./chunk-XC3DLYEG.mjs';export{a as localStorageAdapter}from'./chunk-DBZSN4WP.mjs';import'./chunk-ZJYULEER.mjs';
|
|
@@ -140,5 +140,5 @@ When personal data is no longer required, it is securely deleted or irreversibly
|
|
|
140
140
|
3. Right to Erasure (Section 34(1)(d), Section 34(2))
|
|
141
141
|
4. Right to Restrict Processing (Section 34(1)(e))
|
|
142
142
|
5. Right to Data Portability (Section 38)
|
|
143
|
-
6. Right to Object (Section 36)`})},{id:"right-to-withdraw-consent",name:"Right to Withdraw Consent",ndpaSection:"NDPA Section
|
|
143
|
+
6. Right to Object (Section 36)`})},{id:"right-to-withdraw-consent",name:"Right to Withdraw Consent",ndpaSection:"NDPA Section 35",severity:"important",points:7,check:e=>{let t=f(e).toLowerCase();return t.includes("withdraw")&&t.includes("consent")},gap:()=>({message:"The policy does not mention the right to withdraw consent. Data subjects must be informed that they can withdraw consent at any time without affecting the lawfulness of prior processing.",fixType:"add_content",fixLabel:"Add withdrawal clause",suggestedContent:"You have the right to withdraw your consent at any time, without affecting the lawfulness of processing carried out prior to withdrawal. To withdraw your consent, contact us at the email address provided in this policy."})},{id:"right-to-lodge-complaint",name:"Right to Lodge Complaint with NDPC",ndpaSection:"NDPA Section 46",severity:"important",points:7,check:e=>{let t=f(e).toLowerCase();return t.includes("ndpc")||t.includes("nigeria data protection commission")},gap:()=>({message:"The policy does not mention the right to lodge a complaint with the Nigeria Data Protection Commission (NDPC). Data subjects must be informed of this right.",fixType:"add_content",fixLabel:"Add NDPC complaint reference",suggestedContent:"You have the right to lodge a complaint with the Nigeria Data Protection Commission (NDPC) if you believe your data protection rights have been infringed. Website: https://ndpc.gov.ng"})},{id:"cross-border-safeguards",name:"Cross-Border Transfer Safeguards",ndpaSection:"NDPA Part VIII (Sections 41-43)",severity:"important",points:7,check:(e,t)=>t.hasCrossBorderTransfer?u(e,"cross-border-transfers"):true,gap:()=>({message:"Cross-border data transfers are indicated but the policy lacks a section describing the safeguards in place. The NDPA requires disclosure of transfer mechanisms and adequacy assessments.",fixType:"add_section",fixLabel:"Add cross-border section",suggestedContent:"Where we transfer personal data outside Nigeria, we ensure compliance with Part VIII (Sections 41-43) of the NDPA 2023 by implementing appropriate safeguards, including adequacy assessments and Standard Contractual Clauses."})},{id:"automated-decision-disclosure",name:"Automated Decision-Making Disclosure",ndpaSection:"NDPA Section 37",severity:"important",points:7,check:(e,t)=>t.hasAutomatedDecisions?u(e,"automated-decision-making"):true,gap:()=>({message:"Automated decision-making is indicated but the policy does not include a section disclosing this. The NDPA requires you to inform data subjects about automated decisions, including the logic involved and the right to human intervention.",fixType:"add_section",fixLabel:"Add automated decisions section",suggestedContent:"We use automated decision-making in certain processes. You have the right to request human intervention, express your point of view, and contest automated decisions, in accordance with Section 37 of the NDPA 2023."})},{id:"children-data-protection",name:"Children's Data Protection",ndpaSection:"NDPA Section 31",severity:"recommended",points:5,check:(e,t)=>t.hasChildrenData?u(e,"children-data-protection"):true,gap:()=>({message:"Children's data processing is indicated but the policy does not include a dedicated children's data protection section. The NDPA requires enhanced protections including parental consent for children under 13.",fixType:"add_section",fixLabel:"Add children's data section",suggestedContent:"We do not knowingly collect personal data from children under the age of 13 without verifiable parental or guardian consent. Parents and guardians may request access to, correction of, or deletion of their child's data at any time."})},{id:"dpo-contact-info",name:"DPO Contact Information",ndpaSection:"NDPA Section 30",severity:"recommended",points:5,check:e=>{var t,i;return ((t=e.organizationInfo.dpoName)!=null?t:"").trim().length>0&&((i=e.organizationInfo.dpoEmail)!=null?i:"").trim().length>0},gap:()=>({message:"The Data Protection Officer (DPO) contact information is not provided. While not always mandatory, appointing a DPO and publishing their contact details is strongly recommended under the NDPA.",fixType:"fill_field",fixLabel:"Add DPO details",suggestedContent:"Provide the full name and email address of your Data Protection Officer in the Organisation Info section."})},{id:"security-measures",name:"Security Measures Described",ndpaSection:"NDPA Section 28",severity:"recommended",points:5,check:e=>u(e,"data-security"),gap:()=>({message:"The policy does not describe the technical and organisational security measures in place to protect personal data. Describing these measures builds trust and demonstrates NDPA compliance.",fixType:"add_section",fixLabel:"Add security section",suggestedContent:"We implement appropriate technical and organisational measures to protect personal data, including encryption in transit and at rest, access controls, regular security assessments, and incident response procedures aligned with NDPA breach notification requirements."})},{id:"policy-effective-date",name:"Policy Effective Date",ndpaSection:"NDPA Section 24",severity:"recommended",points:5,check:e=>e.effectiveDate>0,gap:()=>({message:"The policy does not have an effective date set. An effective date is important for version control and for data subjects to know when the policy was last updated.",fixType:"fill_field",fixLabel:"Set effective date",suggestedContent:"Set the policy's effective date to the date you intend to publish it."})}];function B(e,t){let i=m.reduce((r,l)=>r+l.points,0),n=0,a$1=[],o=[];for(let r of m)if(r.check(e,t))n+=r.points,o.push(r.id);else {let l=r.gap(t);a$1.push(a({requirementId:r.id,requirement:r.name,ndpaSection:r.ndpaSection,severity:r.severity},l));}let d=Math.round(n/i*100),p;return n>=100?p="compliant":n>=80?p="nearly_compliant":p="not_compliant",{score:n,maxScore:i,percentage:d,rating:p,gaps:a$1,passed:o}}
|
|
144
144
|
export{y as a,W as b,E as c,L as d,O as e,B as f};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {e,d}from'./chunk-
|
|
1
|
+
import {e,d}from'./chunk-3ELNTFUX.mjs';import {b,a as a$1}from'./chunk-ZJYULEER.mjs';var x={saas:{id:"saas",label:"SaaS / B2B Software",description:"Multi-tenant cloud software. Account credentials, usage analytics, cross-border transfer to the SaaS vendor, automated processing for features like spam filtering or fraud scoring.",examples:["team collaboration tools","CRM","developer tools","workflow automation"]},ecommerce:{id:"ecommerce",label:"Ecommerce / Online Store",description:"Online retail. Customer identity, payment data, shipping address, cart abandonment cookies, marketing analytics, third-party payment processors.",examples:["online retail","D2C brand","marketplace","food delivery"]},school:{id:"school",label:"School / Education",description:"Educational institution or edtech platform. Student data including minors (NDPA Section 31 \u2014 parental consent required), academic records, attendance, behavioural data for learning analytics.",examples:["K-12 school","edtech app","tutoring platform","online courses"]},healthcare:{id:"healthcare",label:"Healthcare / HealthTech",description:"Medical practice, hospital, telemedicine, or health insurance. Sensitive personal data (NDPA Section 30 \u2014 medical), prescription history, insurance claims, biometric data.",examples:["hospital","telemedicine","pharmacy","health insurance"]},procurement:{id:"procurement",label:"Procurement / B2G",description:"Government procurement, vendor management, public-sector bidding. Vendor company data, tax IDs, beneficial-owner information, contract records, sometimes politically-exposed-person (PEP) data.",examples:["e-procurement portal","vendor registry","government supplier database"]}},a={fullName:"full-name",contactDetails:"contact-details",govIds:"government-ids",credentials:"account-credentials",payment:"payment-info",financialRecords:"financial-records",bvn:"bvn",device:"device-info",usage:"usage-data",location:"location-data",cookies:"cookies",health:"health-data",biometric:"biometric-data",children:"children"};function s(e){let t=new Set(e);return d.map(r=>b(a$1({},r),{selected:t.has(r.id)}))}function h(e,t){var r,c,l,d,p,m;return t?b(a$1({},e),{org:b(a$1({},e.org),{name:(r=t.orgName)!=null?r:e.org.name,website:(c=t.website)!=null?c:e.org.website,privacyEmail:(l=t.privacyEmail)!=null?l:e.org.privacyEmail,address:(d=t.address)!=null?d:e.org.address,dpoName:(p=t.dpoName)!=null?p:e.org.dpoName,dpoEmail:(m=t.dpoEmail)!=null?m:e.org.dpoEmail})}):e}var f=["service_delivery","analytics","marketing","fraud_prevention"],y=["service_delivery","marketing","analytics","fraud_prevention","legal_compliance"],v=["service_delivery","analytics","legal_compliance"],C=["service_delivery","legal_compliance","research"],T=["service_delivery","legal_compliance","fraud_prevention"];function P(){let e$1=e();return e$1.org.industry="saas",e$1.org.orgSize="startup",e$1.dataCategories=s([a.fullName,a.contactDetails,a.credentials,a.device,a.usage,a.cookies]),e$1.purposes=f,e$1.hasChildrenData=false,e$1.hasSensitiveData=false,e$1.hasFinancialData=false,e$1.hasCrossBorderTransfer=true,e$1.hasAutomatedDecisions=false,e$1}function S(){let e$1=e();return e$1.org.industry="ecommerce",e$1.org.orgSize="midsize",e$1.dataCategories=s([a.fullName,a.contactDetails,a.payment,a.financialRecords,a.device,a.usage,a.location,a.cookies]),e$1.purposes=y,e$1.hasChildrenData=false,e$1.hasSensitiveData=false,e$1.hasFinancialData=true,e$1.hasCrossBorderTransfer=true,e$1.hasAutomatedDecisions=true,e$1}function D(){let e$1=e();return e$1.org.industry="education",e$1.org.orgSize="midsize",e$1.dataCategories=s([a.fullName,a.contactDetails,a.govIds,a.credentials,a.usage,a.cookies,a.children]),e$1.purposes=v,e$1.hasChildrenData=true,e$1.hasSensitiveData=false,e$1.hasFinancialData=false,e$1.hasCrossBorderTransfer=false,e$1.hasAutomatedDecisions=false,e$1}function E(){let e$1=e();return e$1.org.industry="healthcare",e$1.org.orgSize="enterprise",e$1.dataCategories=s([a.fullName,a.contactDetails,a.govIds,a.payment,a.health,a.biometric]),e$1.purposes=C,e$1.hasChildrenData=false,e$1.hasSensitiveData=true,e$1.hasFinancialData=true,e$1.hasCrossBorderTransfer=false,e$1.hasAutomatedDecisions=false,e$1}function O(){let e$1=e();return e$1.org.industry="government",e$1.org.orgSize="enterprise",e$1.dataCategories=s([a.fullName,a.contactDetails,a.govIds,a.financialRecords,a.bvn]),e$1.purposes=T,e$1.hasChildrenData=false,e$1.hasSensitiveData=false,e$1.hasFinancialData=true,e$1.hasCrossBorderTransfer=false,e$1.hasAutomatedDecisions=false,e$1}var g={saas:P,ecommerce:S,school:D,healthcare:E,procurement:O};function _(e,t){let r=g[e];if(!r)throw new Error(`[ndpr-toolkit] Unknown org template id: ${String(e)}. Expected one of: ${Object.keys(g).join(", ")}.`);return h(r(),t)}export{x as a,_ as b};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {b as b$1,e}from'./chunk-
|
|
1
|
+
import {b as b$1,e}from'./chunk-UZBRO7WP.mjs';import {a as a$1}from'./chunk-DBZSN4WP.mjs';import {b,a}from'./chunk-ZJYULEER.mjs';import {useRef,useState,useEffect,useCallback}from'react';function W(e,s){return s?a$1(e):{load:()=>null,save:()=>{},remove:()=>{}}}function A({templates:e,initialPolicy:s,adapter:y,storageKey:l="ndpr_privacy_policy",persist:f,useLocalStorage:D,onGenerate:T}){var V;let O=(V=f!=null?f:D)!=null?V:true,w=y!=null?y:W(l,O),c=useRef(w);c.current=w;let[n,p]=useState(s||null),[o,g]=useState(null),[u,S]=useState({name:"",website:"",privacyEmail:"",address:"",privacyPhone:"",dpoName:"",dpoEmail:"",industry:""}),[C,E]=useState(true),R=useRef(e);R.current=e,useEffect(()=>{if(s){E(false);return}let t=false;try{let r=c.current.load(),i=a=>{if(a){if(p(a),a.templateId){let P=R.current.find(b=>b.id===a.templateId);P&&g(P);}a.organizationInfo&&S(a.organizationInfo);}E(!1);};r instanceof Promise?r.then(a=>{t||i(a);},()=>{t||E(!1);}):i(r);}catch(r){t||E(false);}return ()=>{t=true;}},[s]);let k=t=>{Promise.resolve(c.current.save(t)).catch(r=>{console.warn("[ndpr-toolkit] Failed to save policy:",r);});},j=useCallback(t=>{let r=e.find(b=>b.id===t);if(!r)return false;g(r);let i=r.sections.map(b$1=>b(a({},b$1),{customContent:void 0})),a$1={};Object.keys(r.variables).forEach(b=>{a$1[b]=r.variables[b].defaultValue||"";});let P=Date.now();return p({id:"policy_"+P+"_"+Math.random().toString(36).substr(2,9),title:"",templateId:r.id,organizationInfo:u,sections:i,variableValues:a$1,effectiveDate:P,lastUpdated:P,version:"1.0"}),true},[e,u]),I=useCallback(t=>{S(r=>a(a({},r),t));},[]),F=useCallback((t,r)=>{o&&(n?p(i=>i&&b(a({},i),{sections:i.sections.map(a$1=>a$1.id===t?b(a({},a$1),{included:r}):a$1)})):g(i=>i&&b(a({},i),{sections:i.sections.map(a$1=>a$1.id===t?b(a({},a$1),{included:r}):a$1)})));},[o,n]),M=useCallback((t,r)=>{o&&(n?p(i=>i&&b(a({},i),{sections:i.sections.map(a$1=>a$1.id===t?b(a({},a$1),{customContent:r}):a$1)})):g(i=>i&&b(a({},i),{sections:i.sections.map(a$1=>a$1.id===t?b(a({},a$1),{customContent:r}):a$1)})));},[o,n]),$=useCallback((t,r)=>{n&&p(i=>i&&b(a({},i),{variableValues:b(a({},i.variableValues),{[t]:r})}));},[n]),B=()=>"policy_"+Date.now()+"_"+Math.random().toString(36).substr(2,9),G=useCallback(()=>{if(!o)return null;let t=Date.now(),r={id:(n==null?void 0:n.id)||B(),title:`Privacy Policy for ${u.name}`,templateId:o.id,organizationInfo:u,sections:o.sections.map(i=>{var a$1;return b(a({},i),{customContent:(a$1=n==null?void 0:n.sections.find(P=>P.id===i.id))==null?void 0:a$1.customContent})}),variableValues:(n==null?void 0:n.variableValues)||{},effectiveDate:t,lastUpdated:t,version:"1.0"};return p(r),k(r),T&&T(r),r},[o,n,u,T]),K=useCallback(()=>{if(!n)return {fullText:"",sectionTexts:{},missingVariables:[]};let t=b$1(n.sections,n.organizationInfo);return typeof t=="string"?{fullText:t,sectionTexts:{full:t},missingVariables:[]}:t},[n]),H=useCallback(()=>{p(null),g(null),S({name:"",website:"",privacyEmail:"",address:"",privacyPhone:"",dpoName:"",dpoEmail:"",industry:""}),Promise.resolve(c.current.remove()).catch(t=>{console.warn("[ndpr-toolkit] Failed to remove policy:",t);});},[]),J=useCallback(()=>{let t=[];if(o||t.push("No template selected"),u.name||t.push("Organization name is required"),u.website||t.push("Organization website is required"),u.privacyEmail||t.push("Privacy contact email is required"),o){let r=o.sections.filter(a=>a.required),i=(n==null?void 0:n.sections.filter(a=>a.included))||[];r.forEach(a=>{i.some(P=>P.id===a.id)||t.push(`Required section "${a.title}" must be included`);});}return o&&n&&Object.entries(o.variables).forEach(([r,i])=>{i.required&&!n.variableValues[r]&&t.push(`Required variable "${i.name}" must have a value`);}),{valid:t.length===0,errors:t}},[o,u,n]);return {policy:n,selectedTemplate:o,organizationInfo:u,selectTemplate:j,updateOrganizationInfo:I,toggleSection:F,updateSectionContent:M,updateVariableValue:$,generatePolicy:G,getPolicyText:K,resetPolicy:H,isValid:J,isLoading:C}}var _="default-business";function X(e){return e.toLocaleDateString("en-NG",{day:"numeric",month:"long",year:"numeric"})}function Y(e$1){let{sections:s,variables:y}=e(),l={};return e$1&&(e$1.name&&(l.orgName=e$1.name),e$1.email&&(l.privacyEmail=e$1.email),e$1.website&&(l.website=e$1.website),e$1.address&&(l.address=e$1.address),e$1.industry&&(l.industry=e$1.industry),e$1.dpoName&&(l.dpoName=e$1.dpoName),e$1.dpoEmail&&(l.dpoEmail=e$1.dpoEmail)),l.effectiveDate||(l.effectiveDate=X(new Date)),{id:_,name:"Default Business Policy",description:"NDPA-compliant privacy policy template for businesses.",organizationType:"business",sections:s,variables:Object.fromEntries(y.map(f=>[f.name,{name:f.name,description:f.description,required:f.required,defaultValue:l[f.name]||f.value||void 0}])),version:"1.0",lastUpdated:Date.now(),ndpaCompliant:true}}function Z(e){if(!e)return {};let s={};return e.name&&(s.name=e.name),e.email&&(s.privacyEmail=e.email),e.website&&(s.website=e.website),e.address&&(s.address=e.address),e.industry&&(s.industry=e.industry),e.dpoName&&(s.dpoName=e.dpoName),e.dpoEmail&&(s.dpoEmail=e.dpoEmail),s}function ce(e={}){var o;let{orgInfo:s,autoGenerate:y=true,storageKey:l,persist:f,useLocalStorage:D,adapter:T}=e,O=(o=f!=null?f:D)!=null?o:true,w=useRef(null);w.current===null&&(w.current=Y(s));let c=A({templates:[w.current],adapter:T,storageKey:l,persist:O}),n=useRef(false),p=useRef(false);return useEffect(()=>{if(!y||c.isLoading||n.current)return;if(!T&&O!==false&&typeof window!="undefined"&&typeof window.localStorage!="undefined")try{if(window.localStorage.getItem(l!=null?l:"ndpr_privacy_policy")){n.current=!0,p.current=!0;return}}catch(S){}if(c.policy){n.current=true,p.current=true;return}n.current=true;let u=Z(s);Object.keys(u).length>0&&c.updateOrganizationInfo(u),c.selectedTemplate||c.selectTemplate(_);},[y,c.isLoading]),useEffect(()=>{var u;if(!y||p.current||!n.current||!c.selectedTemplate)return;let g=(u=s==null?void 0:s.name)!=null?u:"";g&&c.organizationInfo.name!==g||(p.current=true,c.generatePolicy());},[y,c.selectedTemplate,c.organizationInfo]),c}export{A as a,ce as b};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var chunkCIEWD57T_js=require('./chunk-CIEWD57T.js'),chunkRFPLZDIO_js=require('./chunk-RFPLZDIO.js');var x={saas:{id:"saas",label:"SaaS / B2B Software",description:"Multi-tenant cloud software. Account credentials, usage analytics, cross-border transfer to the SaaS vendor, automated processing for features like spam filtering or fraud scoring.",examples:["team collaboration tools","CRM","developer tools","workflow automation"]},ecommerce:{id:"ecommerce",label:"Ecommerce / Online Store",description:"Online retail. Customer identity, payment data, shipping address, cart abandonment cookies, marketing analytics, third-party payment processors.",examples:["online retail","D2C brand","marketplace","food delivery"]},school:{id:"school",label:"School / Education",description:"Educational institution or edtech platform. Student data including minors (NDPA Section 31 \u2014 parental consent required), academic records, attendance, behavioural data for learning analytics.",examples:["K-12 school","edtech app","tutoring platform","online courses"]},healthcare:{id:"healthcare",label:"Healthcare / HealthTech",description:"Medical practice, hospital, telemedicine, or health insurance. Sensitive personal data (NDPA Section 30 \u2014 medical), prescription history, insurance claims, biometric data.",examples:["hospital","telemedicine","pharmacy","health insurance"]},procurement:{id:"procurement",label:"Procurement / B2G",description:"Government procurement, vendor management, public-sector bidding. Vendor company data, tax IDs, beneficial-owner information, contract records, sometimes politically-exposed-person (PEP) data.",examples:["e-procurement portal","vendor registry","government supplier database"]}},a={fullName:"full-name",contactDetails:"contact-details",govIds:"government-ids",credentials:"account-credentials",payment:"payment-info",financialRecords:"financial-records",bvn:"bvn",device:"device-info",usage:"usage-data",location:"location-data",cookies:"cookies",health:"health-data",biometric:"biometric-data",children:"children"};function s(e){let t=new Set(e);return chunkCIEWD57T_js.d.map(r=>chunkRFPLZDIO_js.b(chunkRFPLZDIO_js.a({},r),{selected:t.has(r.id)}))}function h(e,t){var r,c,l,d,p,m;return t?chunkRFPLZDIO_js.b(chunkRFPLZDIO_js.a({},e),{org:chunkRFPLZDIO_js.b(chunkRFPLZDIO_js.a({},e.org),{name:(r=t.orgName)!=null?r:e.org.name,website:(c=t.website)!=null?c:e.org.website,privacyEmail:(l=t.privacyEmail)!=null?l:e.org.privacyEmail,address:(d=t.address)!=null?d:e.org.address,dpoName:(p=t.dpoName)!=null?p:e.org.dpoName,dpoEmail:(m=t.dpoEmail)!=null?m:e.org.dpoEmail})}):e}var f=["service_delivery","analytics","marketing","fraud_prevention"],y=["service_delivery","marketing","analytics","fraud_prevention","legal_compliance"],v=["service_delivery","analytics","legal_compliance"],C=["service_delivery","legal_compliance","research"],T=["service_delivery","legal_compliance","fraud_prevention"];function P(){let e=chunkCIEWD57T_js.e();return e.org.industry="saas",e.org.orgSize="startup",e.dataCategories=s([a.fullName,a.contactDetails,a.credentials,a.device,a.usage,a.cookies]),e.purposes=f,e.hasChildrenData=false,e.hasSensitiveData=false,e.hasFinancialData=false,e.hasCrossBorderTransfer=true,e.hasAutomatedDecisions=false,e}function S(){let e=chunkCIEWD57T_js.e();return e.org.industry="ecommerce",e.org.orgSize="midsize",e.dataCategories=s([a.fullName,a.contactDetails,a.payment,a.financialRecords,a.device,a.usage,a.location,a.cookies]),e.purposes=y,e.hasChildrenData=false,e.hasSensitiveData=false,e.hasFinancialData=true,e.hasCrossBorderTransfer=true,e.hasAutomatedDecisions=true,e}function D(){let e=chunkCIEWD57T_js.e();return e.org.industry="education",e.org.orgSize="midsize",e.dataCategories=s([a.fullName,a.contactDetails,a.govIds,a.credentials,a.usage,a.cookies,a.children]),e.purposes=v,e.hasChildrenData=true,e.hasSensitiveData=false,e.hasFinancialData=false,e.hasCrossBorderTransfer=false,e.hasAutomatedDecisions=false,e}function E(){let e=chunkCIEWD57T_js.e();return e.org.industry="healthcare",e.org.orgSize="enterprise",e.dataCategories=s([a.fullName,a.contactDetails,a.govIds,a.payment,a.health,a.biometric]),e.purposes=C,e.hasChildrenData=false,e.hasSensitiveData=true,e.hasFinancialData=true,e.hasCrossBorderTransfer=false,e.hasAutomatedDecisions=false,e}function O(){let e=chunkCIEWD57T_js.e();return e.org.industry="government",e.org.orgSize="enterprise",e.dataCategories=s([a.fullName,a.contactDetails,a.govIds,a.financialRecords,a.bvn]),e.purposes=T,e.hasChildrenData=false,e.hasSensitiveData=false,e.hasFinancialData=true,e.hasCrossBorderTransfer=false,e.hasAutomatedDecisions=false,e}var g={saas:P,ecommerce:S,school:D,healthcare:E,procurement:O};function _(e,t){let r=g[e];if(!r)throw new Error(`[ndpr-toolkit] Unknown org template id: ${String(e)}. Expected one of: ${Object.keys(g).join(", ")}.`);return h(r(),t)}exports.a=x;exports.b=_;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {a}from'./chunk-SFGW37LE.mjs';import {jsxs,jsx}from'react/jsx-runtime';var f={consent:"Consent",dsr:"Data Subject Rights",dpia:"DPIA",breach:"Breach Notification",policy:"Privacy Policy",lawfulBasis:"Lawful Basis",crossBorder:"Cross-Border",ropa:"ROPA"},p={critical:"rgb(var(--ndpr-destructive))","needs-work":"rgb(var(--ndpr-warning))",good:"rgb(var(--ndpr-primary))",excellent:"rgb(var(--ndpr-success))"},m={critical:"Critical","needs-work":"Needs Work",good:"Good",excellent:"Excellent"},C={critical:"Critical",high:"High",medium:"Medium",low:"Low"},x=({score:t,rating:e,classNames:o,unstyled:l})=>{let r=p[e],i=2*Math.PI*40,c=i*(1-t/100);return jsxs("div",{className:a("relative inline-flex items-center justify-center",o==null?void 0:o.scoreCircle,l),role:"img","aria-label":`Compliance score: ${t} out of 100, rated ${m[e]}`,children:[jsxs("svg",{width:"120",height:"120",viewBox:"0 0 100 100","aria-hidden":"true",children:[jsx("circle",{cx:"50",cy:"50",r:"40",fill:"none",stroke:"rgba(0,0,0,0.08)",strokeWidth:"8"}),jsx("circle",{cx:"50",cy:"50",r:"40",fill:"none",stroke:r,strokeWidth:"8",strokeLinecap:"round",strokeDasharray:i,strokeDashoffset:c,transform:"rotate(-90 50 50)",style:{transition:"stroke-dashoffset 0.4s ease"}})]}),jsx("span",{className:a("absolute text-2xl font-bold tabular-nums",o==null?void 0:o.scoreValue,l),style:{color:r},children:t})]})},h=({rating:t,className:e,unstyled:o})=>{let l=p[t];return jsx("span",{className:a("inline-block px-3 py-1 rounded-full text-sm font-semibold",e,o),style:{backgroundColor:`${l.replace("rgb(","rgba(").replace(")",", 0.12)")}`,color:l,border:`1px solid ${l.replace("rgb(","rgba(").replace(")",", 0.3)")}`},role:"status","aria-live":"polite",children:m[t]})},R=({moduleKey:t,module:e,classNames:o,unstyled:l})=>{var g;let r=e.score>=90?"excellent":e.score>=70?"good":e.score>=40?"needs-work":"critical",i=p[r],c=e.gaps.length,u=(g=f[t])!=null?g:t;return jsxs("div",{className:a("rounded-lg border p-4 flex flex-col gap-2",o==null?void 0:o.moduleCard,l),style:{borderColor:`${i.replace("rgb(","rgba(").replace(")",", 0.25)")}`,backgroundColor:`${i.replace("rgb(","rgba(").replace(")",", 0.04)")}`},children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:a("text-sm font-semibold truncate",o==null?void 0:o.moduleTitle,l),children:u}),jsx("span",{className:a("text-lg font-bold tabular-nums",o==null?void 0:o.moduleScore,l),style:{color:i},role:"status","aria-label":`${u} score: ${e.score}`,children:e.score})]}),jsx("div",{className:"h-1.5 rounded-full overflow-hidden",style:{backgroundColor:"rgba(0,0,0,0.08)"},role:"progressbar","aria-valuenow":e.score,"aria-valuemin":0,"aria-valuemax":100,"aria-label":`${u} compliance score: ${e.score}%`,children:jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${e.score}%`,backgroundColor:i}})}),c>0&&jsxs("p",{className:a("ndpr-form-field__hint",o==null?void 0:o.moduleGaps,l),children:[c," gap",c!==1?"s":""," to address"]})]})},y=({rec:t,classNames:e,unstyled:o})=>{var i,c;let r=(i={critical:p.critical,high:p["needs-work"],medium:p.good,low:p.excellent}[t.priority])!=null?i:p.good;return jsxs("div",{"data-testid":"recommendation-item",className:a("flex gap-3 p-3 rounded-lg border border-gray-100 dark:border-gray-700 bg-white dark:bg-gray-800",e==null?void 0:e.recommendationItem,o),children:[jsx("span",{className:a("mt-0.5 shrink-0 inline-block px-2 py-0.5 rounded text-xs font-bold uppercase tracking-wide",e==null?void 0:e.recommendationPriority,o),style:{backgroundColor:`${r.replace("rgb(","rgba(").replace(")",", 0.12)")}`,color:r},children:(c=C[t.priority])!=null?c:t.priority}),jsxs("div",{className:"min-w-0 flex-1",children:[jsx("p",{className:a("text-sm font-medium ndpr-text-foreground",e==null?void 0:e.recommendationTitle,o),children:t.label}),jsx("p",{className:"mt-0.5 text-xs ndpr-text-muted leading-relaxed",children:t.recommendation}),jsxs("p",{className:"mt-1 text-xs text-gray-400 dark:text-gray-500",children:[t.ndpaSection," \u2022 Effort: ",t.effort]})]})]})},P=({report:t,title:e="NDPA Compliance Dashboard",showRecommendations:o=true,maxRecommendations:l=5,classNames:r,unstyled:i=false})=>{let c=t.recommendations.slice(0,l),u=Object.entries(t.modules);return jsxs("div",{"data-ndpr-component":"compliance-dashboard",className:a("w-full rounded-xl border border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-900 shadow-sm p-6 flex flex-col gap-8",r==null?void 0:r.root,i),children:[jsxs("div",{className:a("flex flex-col sm:flex-row items-start sm:items-center gap-6",r==null?void 0:r.header,i),children:[jsx(x,{score:t.score,rating:t.rating,classNames:{scoreCircle:r==null?void 0:r.scoreCircle,scoreValue:r==null?void 0:r.scoreValue},unstyled:i}),jsxs("div",{className:"flex flex-col gap-2",children:[jsx("h2",{className:"text-xl font-bold ndpr-text-foreground leading-tight",children:e}),jsx(h,{rating:t.rating,className:r==null?void 0:r.ratingBadge,unstyled:i}),jsxs("p",{className:"ndpr-form-field__hint",children:["Generated on"," ",new Date(t.generatedAt).toLocaleDateString(void 0,{year:"numeric",month:"long",day:"numeric"})]})]})]}),jsx("div",{className:a("grid grid-cols-2 sm:grid-cols-2 md:grid-cols-4 gap-3",r==null?void 0:r.modulesGrid,i),children:u.map(([g,b])=>jsx(R,{moduleKey:g,module:b,classNames:{moduleCard:r==null?void 0:r.moduleCard,moduleTitle:r==null?void 0:r.moduleTitle,moduleScore:r==null?void 0:r.moduleScore,moduleGaps:r==null?void 0:r.moduleGaps},unstyled:i},g))}),o&&c.length>0&&jsxs("div",{className:a("flex flex-col gap-3",r==null?void 0:r.recommendationsSection,i),children:[jsx("h3",{className:"text-base font-semibold ndpr-text-foreground",children:"Recommendations"}),c.map(g=>jsx(y,{rec:g,classNames:{recommendationItem:r==null?void 0:r.recommendationItem,recommendationPriority:r==null?void 0:r.recommendationPriority,recommendationTitle:r==null?void 0:r.recommendationTitle},unstyled:i},`${g.module}-${g.key}`))]})]})};export{P as a};
|
|
@@ -140,5 +140,5 @@ When personal data is no longer required, it is securely deleted or irreversibly
|
|
|
140
140
|
3. Right to Erasure (Section 34(1)(d), Section 34(2))
|
|
141
141
|
4. Right to Restrict Processing (Section 34(1)(e))
|
|
142
142
|
5. Right to Data Portability (Section 38)
|
|
143
|
-
6. Right to Object (Section 36)`})},{id:"right-to-withdraw-consent",name:"Right to Withdraw Consent",ndpaSection:"NDPA Section
|
|
143
|
+
6. Right to Object (Section 36)`})},{id:"right-to-withdraw-consent",name:"Right to Withdraw Consent",ndpaSection:"NDPA Section 35",severity:"important",points:7,check:e=>{let t=f(e).toLowerCase();return t.includes("withdraw")&&t.includes("consent")},gap:()=>({message:"The policy does not mention the right to withdraw consent. Data subjects must be informed that they can withdraw consent at any time without affecting the lawfulness of prior processing.",fixType:"add_content",fixLabel:"Add withdrawal clause",suggestedContent:"You have the right to withdraw your consent at any time, without affecting the lawfulness of processing carried out prior to withdrawal. To withdraw your consent, contact us at the email address provided in this policy."})},{id:"right-to-lodge-complaint",name:"Right to Lodge Complaint with NDPC",ndpaSection:"NDPA Section 46",severity:"important",points:7,check:e=>{let t=f(e).toLowerCase();return t.includes("ndpc")||t.includes("nigeria data protection commission")},gap:()=>({message:"The policy does not mention the right to lodge a complaint with the Nigeria Data Protection Commission (NDPC). Data subjects must be informed of this right.",fixType:"add_content",fixLabel:"Add NDPC complaint reference",suggestedContent:"You have the right to lodge a complaint with the Nigeria Data Protection Commission (NDPC) if you believe your data protection rights have been infringed. Website: https://ndpc.gov.ng"})},{id:"cross-border-safeguards",name:"Cross-Border Transfer Safeguards",ndpaSection:"NDPA Part VIII (Sections 41-43)",severity:"important",points:7,check:(e,t)=>t.hasCrossBorderTransfer?u(e,"cross-border-transfers"):true,gap:()=>({message:"Cross-border data transfers are indicated but the policy lacks a section describing the safeguards in place. The NDPA requires disclosure of transfer mechanisms and adequacy assessments.",fixType:"add_section",fixLabel:"Add cross-border section",suggestedContent:"Where we transfer personal data outside Nigeria, we ensure compliance with Part VIII (Sections 41-43) of the NDPA 2023 by implementing appropriate safeguards, including adequacy assessments and Standard Contractual Clauses."})},{id:"automated-decision-disclosure",name:"Automated Decision-Making Disclosure",ndpaSection:"NDPA Section 37",severity:"important",points:7,check:(e,t)=>t.hasAutomatedDecisions?u(e,"automated-decision-making"):true,gap:()=>({message:"Automated decision-making is indicated but the policy does not include a section disclosing this. The NDPA requires you to inform data subjects about automated decisions, including the logic involved and the right to human intervention.",fixType:"add_section",fixLabel:"Add automated decisions section",suggestedContent:"We use automated decision-making in certain processes. You have the right to request human intervention, express your point of view, and contest automated decisions, in accordance with Section 37 of the NDPA 2023."})},{id:"children-data-protection",name:"Children's Data Protection",ndpaSection:"NDPA Section 31",severity:"recommended",points:5,check:(e,t)=>t.hasChildrenData?u(e,"children-data-protection"):true,gap:()=>({message:"Children's data processing is indicated but the policy does not include a dedicated children's data protection section. The NDPA requires enhanced protections including parental consent for children under 13.",fixType:"add_section",fixLabel:"Add children's data section",suggestedContent:"We do not knowingly collect personal data from children under the age of 13 without verifiable parental or guardian consent. Parents and guardians may request access to, correction of, or deletion of their child's data at any time."})},{id:"dpo-contact-info",name:"DPO Contact Information",ndpaSection:"NDPA Section 30",severity:"recommended",points:5,check:e=>{var t,i;return ((t=e.organizationInfo.dpoName)!=null?t:"").trim().length>0&&((i=e.organizationInfo.dpoEmail)!=null?i:"").trim().length>0},gap:()=>({message:"The Data Protection Officer (DPO) contact information is not provided. While not always mandatory, appointing a DPO and publishing their contact details is strongly recommended under the NDPA.",fixType:"fill_field",fixLabel:"Add DPO details",suggestedContent:"Provide the full name and email address of your Data Protection Officer in the Organisation Info section."})},{id:"security-measures",name:"Security Measures Described",ndpaSection:"NDPA Section 28",severity:"recommended",points:5,check:e=>u(e,"data-security"),gap:()=>({message:"The policy does not describe the technical and organisational security measures in place to protect personal data. Describing these measures builds trust and demonstrates NDPA compliance.",fixType:"add_section",fixLabel:"Add security section",suggestedContent:"We implement appropriate technical and organisational measures to protect personal data, including encryption in transit and at rest, access controls, regular security assessments, and incident response procedures aligned with NDPA breach notification requirements."})},{id:"policy-effective-date",name:"Policy Effective Date",ndpaSection:"NDPA Section 24",severity:"recommended",points:5,check:e=>e.effectiveDate>0,gap:()=>({message:"The policy does not have an effective date set. An effective date is important for version control and for data subjects to know when the policy was last updated.",fixType:"fill_field",fixLabel:"Set effective date",suggestedContent:"Set the policy's effective date to the date you intend to publish it."})}];function B(e,t){let i=m.reduce((r,l)=>r+l.points,0),n=0,a=[],o=[];for(let r of m)if(r.check(e,t))n+=r.points,o.push(r.id);else {let l=r.gap(t);a.push(chunkRFPLZDIO_js.a({requirementId:r.id,requirement:r.name,ndpaSection:r.ndpaSection,severity:r.severity},l));}let d=Math.round(n/i*100),p;return n>=100?p="compliant":n>=80?p="nearly_compliant":p="not_compliant",{score:n,maxScore:i,percentage:d,rating:p,gaps:a,passed:o}}
|
|
144
144
|
exports.a=y;exports.b=W;exports.c=E;exports.d=L;exports.e=O;exports.f=B;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var chunkF54TBNVF_js=require('./chunk-F54TBNVF.js'),chunkAME4HJR4_js=require('./chunk-AME4HJR4.js'),chunkI5ZDNSX5_js=require('./chunk-I5ZDNSX5.js'),chunkRFPLZDIO_js=require('./chunk-RFPLZDIO.js'),react=require('react'),jsxRuntime=require('react/jsx-runtime');var Ee=({sections:E=chunkF54TBNVF_js.c,variables:R=chunkF54TBNVF_js.d,onGenerate:S,title:F,description:A,className:N="",buttonClassName:P="",generateButtonText:Y,showPreview:q=true,allowEditing:Q=true,classNames:t,unstyled:y=false})=>{var W,de,ae;let B=chunkI5ZDNSX5_js.c(),Z=(W=F!=null?F:B.policy.generatorTitle)!=null?W:"NDPA Privacy Policy Generator",l=(de=A!=null?A:B.policy.generatorDescription)!=null?de:"Generate an NDPA-compliant privacy policy for your organization in accordance with NDPA Section 27.",i=(ae=Y!=null?Y:B.policy.generate)!=null?ae:"Generate Policy",m=react.useId(),[L,ee]=react.useState(E),[b,k]=react.useState(R),[g,$]=react.useState("sections"),[X,H]=react.useState(""),[U,M]=react.useState(""),[ne,T]=react.useState(false),[h,G]=react.useState({});react.useEffect(()=>{ee(E);},[E]),react.useEffect(()=>{k(R);},[R]);let oe=p=>{ee(c=>c.map(e=>e.id===p?chunkRFPLZDIO_js.b(chunkRFPLZDIO_js.a({},e),{included:!e.included}):e));},I=(p,c)=>{k(e=>e.map(d=>d.id===p?chunkRFPLZDIO_js.b(chunkRFPLZDIO_js.a({},d),{value:c}):d)),h[p]&&G(e=>{let d=chunkRFPLZDIO_js.a({},e);return delete d[p],d});},ie=()=>{let p={},c=true;return b.forEach(e=>{e.required&&!e.value&&(p[e.id]=`${e.name} is required`,c=false);}),G(p),c},re=()=>{if(!ie()){$("variables");return}let p=L.filter(d=>d.included),c=Object.fromEntries(b.map(d=>[d.name,d.value])),e="";p.forEach(d=>{e+=`## ${d.title}
|
|
2
2
|
|
|
3
|
-
`,e+=
|
|
3
|
+
`,e+=chunkF54TBNVF_js.b(d.template,c),e+=`
|
|
4
4
|
|
|
5
5
|
`;}),H(e),M(e),T(true),$("preview");},V=()=>{S({sections:L,variables:b,content:Q?U:X});},u=()=>jsxRuntime.jsxs("div",{"data-ndpr-component":"policy-generator",className:chunkAME4HJR4_js.a("ndpr-form-section",t==null?void 0:t.sectionList,y),role:"group","aria-labelledby":`${m}-sections-heading`,children:[jsxRuntime.jsx("h3",{id:`${m}-sections-heading`,className:"text-lg font-medium mb-4",children:"Select Policy Sections"}),L.map(p=>{let c=`${m}-section-${p.id}`,e=p.description?`${m}-section-desc-${p.id}`:void 0;return jsxRuntime.jsx("div",{className:chunkAME4HJR4_js.a("border border-gray-200 dark:border-gray-700 rounded-md p-4",t==null?void 0:t.sectionItem,y),children:jsxRuntime.jsxs("div",{className:"flex items-start",children:[jsxRuntime.jsx("div",{className:"flex items-center h-5",children:jsxRuntime.jsx("input",{id:c,type:"checkbox",checked:p.included,onChange:()=>oe(p.id),disabled:p.required,"aria-describedby":e,className:chunkAME4HJR4_js.a("w-4 h-4 text-[rgb(var(--ndpr-primary))] border-gray-300 rounded focus:ring-[rgb(var(--ndpr-ring))] dark:focus:ring-[rgb(var(--ndpr-ring))] dark:ring-offset-gray-800 dark:focus:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600",t==null?void 0:t.input,y)})}),jsxRuntime.jsxs("div",{className:"ml-3 text-sm",children:[jsxRuntime.jsxs("label",{htmlFor:c,className:"font-medium ndpr-text-foreground",children:[p.title," ",p.required&&jsxRuntime.jsx("span",{className:"text-red-500","aria-hidden":"true",children:"*"}),p.required&&jsxRuntime.jsx("span",{className:"sr-only",children:" (required)"})]}),p.description&&jsxRuntime.jsx("p",{id:e,className:"ndpr-text-muted mt-1",children:p.description})]})]})},p.id)}),jsxRuntime.jsx("div",{className:"mt-6",children:jsxRuntime.jsx("button",{onClick:()=>$("variables"),className:chunkAME4HJR4_js.a(`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${P}`,(t==null?void 0:t.primaryButton)||(t==null?void 0:t.generateButton),y),children:"Next: Fill Variables"})})]}),f=()=>{let p={};return b.forEach(c=>{let e=c.id.split(".")[0];p[e]||(p[e]=[]),p[e].push(c);}),jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a("",t==null?void 0:t.form,y),children:[jsxRuntime.jsx("h3",{className:"text-lg font-medium mb-4",children:"Fill Policy Variables"}),jsxRuntime.jsx("div",{className:"ndpr-form-section",children:Object.entries(p).map(([c,e])=>{let d=L.find(r=>r.id===c);return d&&!d.included?null:jsxRuntime.jsxs("div",{className:"border border-gray-200 dark:border-gray-700 rounded-md p-4",children:[jsxRuntime.jsx("h4",{className:"font-medium text-lg mb-3",children:d?d.title:"General Information"}),jsxRuntime.jsx("div",{className:"ndpr-form-section",children:e.map(r=>{let O=`${m}-var-${r.id}`,j=r.description?`${m}-var-desc-${r.id}`:void 0,le=h[r.id]?`${m}-var-err-${r.id}`:void 0,J=[j,le].filter(Boolean).join(" ")||void 0;return jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{htmlFor:O,className:"ndpr-form-field__label",children:[r.name," ",r.required&&jsxRuntime.jsx("span",{className:"text-red-500","aria-hidden":"true",children:"*"})]}),r.description&&jsxRuntime.jsx("p",{id:j,className:"text-xs ndpr-text-muted mb-2",children:r.description}),r.inputType==="textarea"?jsxRuntime.jsx("textarea",{id:O,value:r.value,onChange:_=>I(r.id,_.target.value),rows:4,className:chunkAME4HJR4_js.a(`w-full px-3 py-2 border ${h[r.id]?"border-red-500 focus:ring-red-500":"border-gray-300 dark:border-gray-600 focus:ring-[rgb(var(--ndpr-ring))]"} rounded-md focus:outline-none focus:ring-2`,t==null?void 0:t.input,y),required:r.required,"aria-required":r.required||void 0,"aria-describedby":J,"aria-invalid":h[r.id]?true:void 0}):r.inputType==="select"&&r.options?jsxRuntime.jsxs("select",{id:O,value:r.value,onChange:_=>I(r.id,_.target.value),className:chunkAME4HJR4_js.a(`w-full px-3 py-2 border ${h[r.id]?"border-red-500 focus:ring-red-500":"border-gray-300 dark:border-gray-600 focus:ring-[rgb(var(--ndpr-ring))]"} rounded-md focus:outline-none focus:ring-2`,t==null?void 0:t.input,y),required:r.required,"aria-required":r.required||void 0,"aria-describedby":J,"aria-invalid":h[r.id]?true:void 0,children:[jsxRuntime.jsx("option",{value:"",children:"Select an option"}),r.options.map(_=>jsxRuntime.jsx("option",{value:_,children:_},_))]}):jsxRuntime.jsx("input",{id:O,type:r.inputType,value:r.value,onChange:_=>I(r.id,_.target.value),className:chunkAME4HJR4_js.a(`w-full px-3 py-2 border ${h[r.id]?"border-red-500 focus:ring-red-500":"border-gray-300 dark:border-gray-600 focus:ring-[rgb(var(--ndpr-ring))]"} rounded-md focus:outline-none focus:ring-2`,t==null?void 0:t.input,y),required:r.required,"aria-required":r.required||void 0,"aria-describedby":J,"aria-invalid":h[r.id]?true:void 0}),h[r.id]&&jsxRuntime.jsx("p",{id:le,role:"alert",className:"mt-1 text-sm ndpr-text-destructive dark:text-red-500",children:h[r.id]})]},r.id)})})]},c)})}),jsxRuntime.jsxs("div",{className:"mt-6 flex space-x-4",children:[jsxRuntime.jsx("button",{onClick:()=>$("sections"),className:`px-4 py-2 bg-gray-200 text-gray-800 dark:bg-gray-700 dark:text-white rounded hover:bg-gray-300 dark:hover:bg-gray-600 ${P}`,children:"Back to Sections"}),jsxRuntime.jsx("button",{onClick:re,className:chunkAME4HJR4_js.a(`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${P}`,(t==null?void 0:t.primaryButton)||(t==null?void 0:t.generateButton),y),children:i})]})]})},x=()=>{let p=`${m}-policy-content`;return jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-lg font-medium mb-4",children:"Preview Generated Policy"}),Q?jsxRuntime.jsxs("div",{className:"ndpr-form-field",children:[jsxRuntime.jsx("label",{htmlFor:p,className:"ndpr-form-field__label",children:"Edit Policy Content"}),jsxRuntime.jsx("textarea",{id:p,value:U,onChange:c=>M(c.target.value),rows:20,className:"ndpr-form-field__input ndpr-form-field__input--mono"})]}):jsxRuntime.jsx("div",{className:"ndpr-panel","aria-live":"polite",children:jsxRuntime.jsx("div",{className:"prose dark:prose-invert max-w-none",children:X.split(`
|
|
6
6
|
`).map((c,e)=>c.startsWith("## ")?jsxRuntime.jsx("h3",{className:"text-xl font-bold mt-6 mb-3",children:c.substring(3)},e):c.startsWith("### ")?jsxRuntime.jsx("h4",{className:"text-lg font-bold mt-4 mb-2",children:c.substring(4)},e):c===""?jsxRuntime.jsx("br",{},e):jsxRuntime.jsx("p",{className:"mb-2",children:c},e))})}),jsxRuntime.jsxs("div",{className:"mt-6 flex space-x-4",children:[jsxRuntime.jsx("button",{onClick:()=>$("variables"),className:`px-4 py-2 bg-gray-200 text-gray-800 dark:bg-gray-700 dark:text-white rounded hover:bg-gray-300 dark:hover:bg-gray-600 ${P}`,children:"Back to Variables"}),jsxRuntime.jsx("button",{onClick:V,className:`px-4 py-2 bg-green-600 text-white rounded hover:bg-green-700 ${P}`,children:"Save Policy"})]})]})},C=()=>{switch(g){case "sections":return u();case "variables":return f();case "preview":return x();default:return u()}};return jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a(`bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ${N}`,t==null?void 0:t.root,y),children:[jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a("mb-6",t==null?void 0:t.header,y),children:[jsxRuntime.jsx("h2",{className:chunkAME4HJR4_js.a("ndpr-section-heading",t==null?void 0:t.title,y),children:Z}),jsxRuntime.jsx("p",{className:chunkAME4HJR4_js.a("ndpr-card__subtitle",t==null?void 0:t.description,y),children:l})]}),jsxRuntime.jsx("nav",{"aria-label":"Policy generation steps",className:"mb-8",children:jsxRuntime.jsxs("ol",{className:"flex items-center w-full",children:[jsxRuntime.jsxs("li",{className:`flex w-full items-center ${g==="sections"?"ndpr-text-primary":"ndpr-card__subtitle"} after:content-[''] after:w-full after:h-1 after:border-b after:border-gray-200 after:border-1 after:hidden sm:after:inline-block after:mx-6 xl:after:mx-10`,children:[jsxRuntime.jsx("span",{className:`flex items-center justify-center w-8 h-8 ${g==="sections"?"ndpr-alert ndpr-alert--info":"ndpr-panel"} rounded-full shrink-0`,"aria-current":g==="sections"?"step":void 0,children:"1"}),jsxRuntime.jsx("span",{className:"hidden sm:inline-flex sm:ml-2",children:"Sections"}),jsxRuntime.jsx("span",{className:"sr-only",children:g==="sections"?" (current step)":""})]}),jsxRuntime.jsxs("li",{className:`flex w-full items-center ${g==="variables"?"ndpr-text-primary":"ndpr-card__subtitle"} after:content-[''] after:w-full after:h-1 after:border-b after:border-gray-200 after:border-1 after:hidden sm:after:inline-block after:mx-6 xl:after:mx-10`,children:[jsxRuntime.jsx("span",{className:`flex items-center justify-center w-8 h-8 ${g==="variables"?"ndpr-alert ndpr-alert--info":"ndpr-panel"} rounded-full shrink-0`,"aria-current":g==="variables"?"step":void 0,children:"2"}),jsxRuntime.jsx("span",{className:"hidden sm:inline-flex sm:ml-2",children:"Variables"}),jsxRuntime.jsx("span",{className:"sr-only",children:g==="variables"?" (current step)":""})]}),jsxRuntime.jsxs("li",{className:`flex items-center ${g==="preview"?"ndpr-text-primary":"ndpr-card__subtitle"}`,children:[jsxRuntime.jsx("span",{className:`flex items-center justify-center w-8 h-8 ${g==="preview"?"ndpr-alert ndpr-alert--info":"ndpr-panel"} rounded-full shrink-0`,"aria-current":g==="preview"?"step":void 0,children:"3"}),jsxRuntime.jsx("span",{className:"hidden sm:inline-flex sm:ml-2",children:"Preview"}),jsxRuntime.jsx("span",{className:"sr-only",children:g==="preview"?" (current step)":""})]})]})}),jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a("ndpr-alert ndpr-alert--info",t==null?void 0:t.complianceNotice,y),children:[jsxRuntime.jsx("h3",{className:"text-sm font-bold ndpr-text-info mb-2",children:"NDPA Compliance Notice"}),jsxRuntime.jsx("p",{className:"ndpr-text-info text-sm",children:"This tool helps you generate a privacy policy that aligns with the Nigeria Data Protection Act (NDPA) 2023. While we strive to ensure compliance, we recommend having the final policy reviewed by a legal professional familiar with NDPA requirements."})]}),C()]})};var Ie=({content:E,sections:R,variables:S,onExport:F,onEdit:A,title:N,description:P,className:Y="",buttonClassName:q="",showExportOptions:Q=true,showEditButton:t=true,showTableOfContents:y=true,showMetadata:B=true,organizationName:Z,lastUpdated:l,classNames:i,unstyled:m=false})=>{var re,V;let L=chunkI5ZDNSX5_js.c(),ee=(re=N!=null?N:L.policy.previewTitle)!=null?re:"Privacy Policy Preview",b=(V=P!=null?P:L.policy.previewDescription)!=null?V:"Preview your NDPA-compliant privacy policy before exporting.",k=react.useId(),[g,$]=react.useState("preview"),X=`${k}-tab-preview`,H=`${k}-tab-markdown`,U=`${k}-panel-preview`,M=`${k}-panel-markdown`,T=(()=>{let u=E.split(`
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {d,b,a}from'./chunk-ZJYULEER.mjs';function M(e){return e.response?e.response.status>=500:true}function $(e){return new Promise(a=>setTimeout(a,e))}function O(e){return e?typeof e=="function"?e():e:{}}function q(e,a$1={}){var w,k,g;let{headers:p,credentials:c="same-origin",loadMethod:l="GET",saveMethod:u="POST",unwrap:i,retry:r,onError:h,onSuccess:f,fetchInit:x}=a$1,T=(w=r==null?void 0:r.attempts)!=null?w:0,C=(k=r==null?void 0:r.baseDelayMs)!=null?k:250,E=(g=r==null?void 0:r.shouldRetry)!=null?g:M,y=h!=null?h:(t=>{if(t.method==="load")return;let o=t.method==="save"?"save to":"delete from";if(t.response){console.warn(`[ndpr-toolkit] Failed to ${o} ${t.endpoint}: ${t.response.status}`);try{let n=typeof t.response.clone=="function"?t.response.clone():null;n&&typeof n.text=="function"&&n.text().then(d=>{let s=d.length>256?`${d.slice(0,256)}\u2026`:d;s.trim()&&console.warn(`[ndpr-toolkit] ${o} ${t.endpoint} response body: ${s}`);}).catch(()=>{});}catch(n){}}else console.warn(`[ndpr-toolkit] Failed to ${o} ${t.endpoint}`);});function v(t,o,n){return d(this,null,function*(){for(let d=0;d<=T;d++){let s,S;try{s=yield fetch(e,b(a(a({},x),o),{headers:a(a({},O(p)),o.headers),credentials:c}));}catch(b){S=b;}if(s&&s.ok)return {ok:true,response:s};let R={method:t,endpoint:e,error:S,response:s,status:s==null?void 0:s.status,payload:n,attempt:d};if(d===T||!E(R))return y(R),{ok:false};yield $(C*Math.pow(2,d));}return {ok:false}})}return {load(){return d(this,null,function*(){let t=yield v("load",{method:l,headers:{}});if(!t.ok)return null;try{let o=yield t.response.json(),n=i?i(o):o;return f&&f({method:"load",endpoint:e,response:t.response,data:n!=null?n:void 0}),n}catch(o){return y({method:"load",endpoint:e,error:o,response:t.response,status:t.response.status,attempt:T}),null}})},save(t){return d(this,null,function*(){let o=yield v("save",{method:u,headers:{"Content-Type":"application/json"},body:JSON.stringify(t)},t);o.ok&&f&&f({method:"save",endpoint:e,response:o.response,payload:t});})},remove(){return d(this,null,function*(){let t=yield v("remove",{method:"DELETE",headers:{}});t.ok&&f&&f({method:"remove",endpoint:e,response:t.response});})}}}function F(e){let a=e!=null?e:null;return {load(){return a},save(p){a=p;},remove(){a=null;}}}function H(e,...a){return {load(){return e.load()},save(p){let c=e.save(p),l=()=>{for(let u of a)try{let i=u.save(p);i instanceof Promise&&i.catch(r=>console.warn("[ndpr-toolkit] Secondary adapter save failed:",r));}catch(i){console.warn("[ndpr-toolkit] Secondary adapter save failed:",i);}};if(c instanceof Promise)return c.then(()=>l());l();},remove(){let p=e.remove(),c=()=>{for(let l of a)try{let u=l.remove();u instanceof Promise&&u.catch(i=>console.warn("[ndpr-toolkit] Secondary adapter remove failed:",i));}catch(u){console.warn("[ndpr-toolkit] Secondary adapter remove failed:",u);}};if(p instanceof Promise)return p.then(()=>c());c();}}}export{q as a,F as b,H as c};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var chunkCIEWD57T_js=require('./chunk-CIEWD57T.js'),chunkRFPLZDIO_js=require('./chunk-RFPLZDIO.js');function s(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function q(e){let n=new Set,o=new RegExp(`${s(chunkCIEWD57T_js.a)}([^${s("\xBB")}]+)${s("\xBB")}`,"g"),i;for(;(i=o.exec(e))!==null;)n.add(i[1].trim());let r=/\{\{\s*([^}\s]+)\s*\}\}/g;for(;(i=r.exec(e))!==null;)n.add(i[1].trim());return Array.from(n)}function P(e,n){if(typeof e=="string"){let o=e,i=n,r=o,c=/\{\{([^}]+)\}\}/g,d;for(;(d=c.exec(o))!==null;){let t=d[1].trim(),a=i[t]||"";r=r.replace(new RegExp(`\\{\\{\\s*${s(t)}\\s*\\}\\}`,"g"),a);}return r}else {let o=e,i=n,r={},c=[];return o.filter(t=>t.included).sort((t,a)=>(t.order||0)-(a.order||0)).forEach(t=>{let a=t.template||t.customContent||t.defaultContent||"",y=/\{\{([^}]+)\}\}/g,m,h=[];for(;(m=y.exec(a))!==null;)h.push(m[1].trim());h.forEach(l=>{let u="";l in i&&(u=i[l]||""),u||c.push(l),a=a.replace(new RegExp(`\\{\\{\\s*${s(l)}\\s*\\}\\}`,"g"),u);}),r[t.id]=a;}),{fullText:Object.values(r).join(`
|
|
2
2
|
|
|
3
3
|
`),sectionTexts:r,missingVariables:Array.from(new Set(c))}}}var w=[{id:"data-collection",title:"Data Collection",description:"Describes what personal data is collected and how it is obtained.",order:1,required:true,included:true,template:'{{orgName}} ("we", "us", or "our") collects personal data from users of our services at {{website}}. We collect information you provide directly, such as your name, email address, phone number, and any other details you submit through forms or communications. We may also collect data automatically, including IP addresses, browser type, device information, and usage patterns through cookies and similar technologies. All data collection is conducted in accordance with the Nigeria Data Protection Act (NDPA) 2023.',variables:["orgName","website"]},{id:"legal-basis",title:"Legal Basis for Processing",description:"Specifies the lawful basis for processing personal data under the NDPA.",order:2,required:true,included:true,template:`{{orgName}} processes personal data under one or more of the following lawful bases as prescribed by the NDPA 2023:
|
|
4
4
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {a}from'./chunk-
|
|
1
|
+
import {a}from'./chunk-IT5VIC2P.mjs';import {b}from'./chunk-4QQJEO3F.mjs';import {c,b as b$1,a as a$1}from'./chunk-ZJYULEER.mjs';import {useMemo}from'react';import {jsx}from'react/jsx-runtime';var C=d=>{var o=d,{template:e,templateOverrides:r,initialContext:t,copy:s}=o,l=c(o,["template","templateOverrides","initialContext","copy"]);let n=useMemo(()=>{if(t)return t;if(e)return b(e,r)},[t,e,r]);return jsx(a,b$1(a$1({},l),{initialContext:n}))};export{C as a};
|