@tantainnovative/ndpr-toolkit 3.6.1 → 3.10.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 +230 -0
- package/README.md +146 -1
- package/dist/chunk-2MIQXECH.mjs +3 -0
- package/dist/chunk-3GRGYT3P.js +1 -0
- package/dist/chunk-5IOC3VAW.js +1 -0
- package/dist/chunk-ATFUSHC2.mjs +2 -0
- package/dist/{chunk-SJRIOZ4K.mjs → chunk-EFIWANHF.mjs} +1 -1
- package/dist/chunk-GQYBS3A7.mjs +0 -0
- package/dist/chunk-HXWHL4BD.js +3 -0
- package/dist/chunk-OZCNFB5C.js +1 -0
- package/dist/chunk-R7545FP4.mjs +1 -0
- package/dist/chunk-UKLU6BQF.mjs +1 -0
- package/dist/{chunk-I2LMQWK3.js → chunk-W7OLQRJP.js} +2 -2
- package/dist/{chunk-RXZFYBUJ.js → chunk-XS3Z4UT7.js} +1 -1
- package/dist/core.d.mts +70 -0
- package/dist/core.d.ts +70 -0
- package/dist/core.js +1 -1
- package/dist/core.mjs +1 -1
- package/dist/cross-border-lite.d.mts +141 -0
- package/dist/cross-border-lite.d.ts +141 -0
- package/dist/cross-border-lite.js +2 -0
- package/dist/cross-border-lite.mjs +2 -0
- package/dist/dsr.js +1 -1
- package/dist/dsr.mjs +1 -1
- package/dist/headless.d.mts +2391 -0
- package/dist/headless.d.ts +2391 -0
- package/dist/headless.js +2 -0
- package/dist/headless.mjs +2 -0
- package/dist/hooks.d.mts +10 -0
- package/dist/hooks.d.ts +10 -0
- package/dist/hooks.js +1 -1
- package/dist/hooks.mjs +1 -1
- package/dist/index.d.mts +133 -0
- package/dist/index.d.ts +133 -0
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/dist/lawful-basis-lite.d.mts +153 -0
- package/dist/lawful-basis-lite.d.ts +153 -0
- package/dist/lawful-basis-lite.js +2 -0
- package/dist/lawful-basis-lite.mjs +2 -0
- package/dist/policy.d.mts +86 -0
- package/dist/policy.d.ts +86 -0
- package/dist/policy.js +1 -1
- package/dist/policy.mjs +1 -1
- package/dist/presets-dsr.d.mts +25 -0
- package/dist/presets-dsr.d.ts +25 -0
- package/dist/presets-dsr.js +1 -1
- package/dist/presets-dsr.mjs +1 -1
- package/dist/presets-policy.d.mts +71 -0
- package/dist/presets-policy.d.ts +71 -0
- package/dist/presets-policy.js +1 -1
- package/dist/presets-policy.mjs +1 -1
- package/dist/presets.d.mts +96 -0
- package/dist/presets.d.ts +96 -0
- package/dist/presets.js +1 -1
- package/dist/presets.mjs +1 -1
- package/dist/ropa-lite.d.mts +218 -0
- package/dist/ropa-lite.d.ts +218 -0
- package/dist/ropa-lite.js +2 -0
- package/dist/ropa-lite.mjs +2 -0
- package/dist/server.d.mts +70 -0
- package/dist/server.d.ts +70 -0
- package/dist/server.js +1 -1
- package/dist/server.mjs +1 -1
- package/package.json +3 -2
- package/dist/chunk-BNHQFZHL.mjs +0 -2
- package/dist/chunk-O6CUBNXK.mjs +0 -3
- package/dist/chunk-RV2VMWZJ.mjs +0 -1
- package/dist/chunk-UI536RU2.js +0 -3
- package/dist/chunk-W7RBGZCC.js +0 -1
package/dist/chunk-BNHQFZHL.mjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import {a}from'./chunk-O6CUBNXK.mjs';import {a as a$1}from'./chunk-SFGW37LE.mjs';import {d,b,a as a$2}from'./chunk-ZJYULEER.mjs';import Gr,{useId,useState,useEffect}from'react';import {jsxs,jsx,Fragment}from'react/jsx-runtime';var vr=["Organization","Data Collection","Processing","Review & Export"],lr=({currentStep:d,classNames:p,unstyled:r})=>jsx("nav",{"data-ndpr-component":"policy-step-indicator","aria-label":"Policy wizard progress",className:a$1("w-full flex items-center justify-between px-2 py-4",p==null?void 0:p.root,r),children:vr.map((e,n)=>{let t=n+1,i=t<d,u=t===d,l=n===vr.length-1;return jsxs(Gr.Fragment,{children:[jsxs("div",{className:a$1("flex flex-col items-center gap-1",p==null?void 0:p.stepWrapper,r),children:[jsx("div",{"aria-current":u?"step":void 0,"aria-label":`Step ${t}: ${e}${i?" (completed)":u?" (current)":""}`,className:a$1(["flex items-center justify-center rounded-full border-2 font-semibold transition-all",i?"w-8 h-8 bg-[rgb(var(--ndpr-primary))] border-[rgb(var(--ndpr-primary))] text-[rgb(var(--ndpr-primary-foreground))]":u?"w-9 h-9 bg-[rgb(var(--ndpr-primary))] border-[rgb(var(--ndpr-primary))] text-[rgb(var(--ndpr-primary-foreground))] shadow-md":"w-8 h-8 bg-white dark:bg-gray-900 border-gray-300 dark:border-gray-600 text-gray-400 dark:text-gray-500"].join(" "),i?p==null?void 0:p.stepCompleted:u?p==null?void 0:p.stepCurrent:p==null?void 0:p.stepUpcoming,r),children:i?jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:3,"aria-hidden":"true",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}):jsx("span",{className:"text-xs leading-none",children:t})}),jsx("span",{className:a$1(["text-xs font-medium hidden sm:block",i||u?"text-[rgb(var(--ndpr-primary))]":"ndpr-card__subtitle"].join(" "),p==null?void 0:p.stepLabel,r),children:e})]}),!l&&jsx("div",{className:a$1(["flex-1 h-0.5 mx-2",i?"bg-[rgb(var(--ndpr-primary))]":"bg-gray-200 dark:bg-gray-700"].join(" "),p==null?void 0:p.connector,r),"aria-hidden":"true"})]},t)})});var $="w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md bg-white dark:bg-gray-800 ndpr-text-foreground focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))] text-sm",Vr="block text-sm font-medium ndpr-text-muted mb-1",A=({id:d,label:p,required:r,description:e,children:n,classNames:t,unstyled:i})=>{let u=e?`${d}-desc`:void 0;return jsxs("div",{className:a$1("flex flex-col",t==null?void 0:t.field,i),children:[jsxs("label",{htmlFor:d,className:a$1(Vr,t==null?void 0:t.label,i),children:[p,r&&jsx("span",{className:"text-red-500 ml-0.5","aria-hidden":"true",children:"*"})]}),e&&jsx("p",{id:u,className:"text-xs ndpr-text-muted mb-1",children:e}),n]})},fr=({context:d,onUpdateOrg:p,classNames:r,unstyled:e})=>{var i,u,b;let n=useId(),t=d.org;return jsxs("div",{"data-ndpr-component":"policy-step-about",className:a$1("ndpr-form-section",r==null?void 0:r.root,e),children:[jsxs("div",{children:[jsx("h2",{className:a$1("ndpr-section-heading",r==null?void 0:r.heading,e),children:"Organisation Details"}),jsxs("p",{className:a$1("ndpr-form-field__hint",r==null?void 0:r.subheading,e),children:["Tell us about your organisation. Fields marked ",jsx("span",{className:"text-red-500","aria-hidden":"true",children:"*"})," are required."]})]}),jsxs("div",{className:a$1("grid grid-cols-1 md:grid-cols-2 gap-4",r==null?void 0:r.grid,e),children:[jsx(A,{id:`${n}-org-name`,label:"Organisation Name",required:true,classNames:r,unstyled:e,children:jsx("input",{id:`${n}-org-name`,type:"text",value:t.name,onChange:l=>p({name:l.target.value}),placeholder:"Acme Corporation",className:a$1($,r==null?void 0:r.input,e),"aria-required":"true"})}),jsx(A,{id:`${n}-website`,label:"Website",required:true,classNames:r,unstyled:e,children:jsx("input",{id:`${n}-website`,type:"url",value:t.website,onChange:l=>p({website:l.target.value}),placeholder:"https://example.com",className:a$1($,r==null?void 0:r.input,e),"aria-required":"true"})}),jsx(A,{id:`${n}-privacy-email`,label:"Privacy Contact Email",required:true,classNames:r,unstyled:e,children:jsx("input",{id:`${n}-privacy-email`,type:"email",value:t.privacyEmail,onChange:l=>p({privacyEmail:l.target.value}),placeholder:"privacy@example.com",className:a$1($,r==null?void 0:r.input,e),"aria-required":"true"})}),jsx(A,{id:`${n}-industry`,label:"Industry",classNames:r,unstyled:e,children:jsxs("select",{id:`${n}-industry`,value:t.industry,onChange:l=>p({industry:l.target.value}),className:a$1($,r==null?void 0:r.select,e),children:[jsx("option",{value:"fintech",children:"Fintech"}),jsx("option",{value:"healthcare",children:"Healthcare"}),jsx("option",{value:"ecommerce",children:"E-commerce"}),jsx("option",{value:"saas",children:"SaaS"}),jsx("option",{value:"education",children:"Education"}),jsx("option",{value:"government",children:"Government"}),jsx("option",{value:"other",children:"Other"})]})}),jsx(A,{id:`${n}-dpo-name`,label:"Data Protection Officer (DPO) Name",classNames:r,unstyled:e,children:jsx("input",{id:`${n}-dpo-name`,type:"text",value:(i=t.dpoName)!=null?i:"",onChange:l=>p({dpoName:l.target.value}),placeholder:"Jane Smith",className:a$1($,r==null?void 0:r.input,e)})}),jsx(A,{id:`${n}-dpo-email`,label:"DPO Email",classNames:r,unstyled:e,children:jsx("input",{id:`${n}-dpo-email`,type:"email",value:(u=t.dpoEmail)!=null?u:"",onChange:l=>p({dpoEmail:l.target.value}),placeholder:"dpo@example.com",className:a$1($,r==null?void 0:r.input,e)})}),jsx(A,{id:`${n}-address`,label:"Registered Address",classNames:r,unstyled:e,children:jsx("input",{id:`${n}-address`,type:"text",value:(b=t.address)!=null?b:"",onChange:l=>p({address:l.target.value}),placeholder:"1 Victoria Island, Lagos, Nigeria",className:a$1($,r==null?void 0:r.input,e)})}),jsx(A,{id:`${n}-org-size`,label:"Organisation Size",classNames:r,unstyled:e,children:jsxs("select",{id:`${n}-org-size`,value:t.orgSize,onChange:l=>p({orgSize:l.target.value}),className:a$1($,r==null?void 0:r.select,e),children:[jsx("option",{value:"startup",children:"Startup (1\u201350 employees)"}),jsx("option",{value:"midsize",children:"Mid-size (51\u2013500 employees)"}),jsx("option",{value:"enterprise",children:"Enterprise (500+ employees)"})]})}),jsx(A,{id:`${n}-country`,label:"Country of Operation",classNames:r,unstyled:e,children:jsx("input",{id:`${n}-country`,type:"text",value:t.country,onChange:l=>p({country:l.target.value}),placeholder:"Nigeria",className:a$1($,r==null?void 0:r.input,e)})})]})]})};var Xr={identity:"Identity",financial:"Financial",behavioral:"Behavioural",sensitive:"Sensitive",children:"Children"},Yr=["identity","financial","behavioral","sensitive","children"],Jr=["sensitive","children"],xr=({categories:d,onToggle:p,classNames:r,unstyled:e})=>{let n=Yr.reduce((t,i)=>{let u=d.filter(b=>b.group===i);return u.length>0&&(t[i]=u),t},{});return jsxs("div",{"data-ndpr-component":"policy-step-data",className:a$1("space-y-8",r==null?void 0:r.root,e),children:[jsxs("div",{children:[jsx("h2",{className:a$1("ndpr-section-heading",r==null?void 0:r.heading,e),children:"Data Categories"}),jsx("p",{id:"data-categories-desc",className:a$1("ndpr-form-field__hint",r==null?void 0:r.subheading,e),children:"Select the categories of personal data your organisation collects. You must select at least one."})]}),Object.entries(n).map(([t,i])=>{let u=Jr.includes(t);return jsxs("div",{className:a$1("space-y-3",r==null?void 0:r.group,e),children:[jsxs("div",{className:a$1("flex items-center gap-2",r==null?void 0:r.groupHeader,e),children:[jsx("h3",{className:a$1("text-sm font-semibold uppercase tracking-wide ndpr-text-muted",r==null?void 0:r.groupTitle,e),children:Xr[t]}),u&&jsx("span",{className:a$1("text-xs font-medium ndpr-text-warning bg-amber-50 dark:bg-amber-900/20 px-2 py-0.5 rounded-full",r==null?void 0:r.sensitiveTag,e),children:"Sensitive"})]}),u&&jsx("p",{className:a$1("text-xs ndpr-text-warning",r==null?void 0:r.sensitiveWarning,e),children:t==="children"?"Processing children's data requires parental consent under NDPA Section 31 and imposes heightened obligations.":"Sensitive/special-category data requires explicit consent and additional safeguards under NDPA Section 30."}),jsx("div",{className:a$1("grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3",r==null?void 0:r.cardsGrid,e),children:i.map(b=>jsx("button",{type:"button",onClick:()=>p(b.id),"aria-pressed":b.selected,className:a$1(["text-left rounded-lg border p-4 transition-all cursor-pointer focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",b.selected?"bg-[rgb(var(--ndpr-primary))]/5 border-[rgb(var(--ndpr-primary))] dark:bg-[rgb(var(--ndpr-primary))]/10":"bg-white dark:bg-gray-800 border-gray-200 dark:border-gray-700 hover:border-gray-300 dark:hover:border-gray-600"].join(" "),r==null?void 0:r.card,e),children:jsxs("div",{className:"flex items-start gap-3",children:[jsx("div",{className:a$1(["mt-0.5 w-4 h-4 rounded border-2 flex-shrink-0 flex items-center justify-center",b.selected?"bg-[rgb(var(--ndpr-primary))] border-[rgb(var(--ndpr-primary))]":"border-gray-300 dark:border-gray-600"].join(" "),r==null?void 0:r.checkbox,e),"aria-hidden":"true",children:b.selected&&jsx("svg",{className:"w-2.5 h-2.5 text-[rgb(var(--ndpr-primary-foreground))]",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:3,children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})})}),jsxs("div",{className:"min-w-0",children:[jsx("p",{className:a$1("text-sm font-medium ndpr-text-foreground",r==null?void 0:r.cardLabel,e),children:b.label}),jsx("p",{className:a$1("text-xs ndpr-text-muted mt-1 leading-relaxed",r==null?void 0:r.cardDataPoints,e),children:b.dataPoints.join(", ")})]})]})},b.id))})]},t)})]})};var Qr=[{value:"service_delivery",label:"Service Delivery",description:"Processing required to deliver the core product or service."},{value:"marketing",label:"Marketing & Communications",description:"Sending promotional messages, newsletters or offers."},{value:"analytics",label:"Analytics & Insights",description:"Analysing usage patterns to improve the product."},{value:"research",label:"Research & Development",description:"Using data to develop new features or products."},{value:"legal_compliance",label:"Legal Compliance",description:"Meeting statutory, regulatory or contractual obligations."},{value:"fraud_prevention",label:"Fraud Prevention & Security",description:"Detecting and preventing fraudulent activity."}],dr="w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md bg-white dark:bg-gray-800 ndpr-text-foreground focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))] text-sm",pr="ndpr-card ndpr-card--compact",gr=({id:d,checked:p,onChange:r})=>jsx("button",{id:d,type:"button",role:"switch","aria-checked":p,onClick:()=>r(!p),className:["relative inline-flex h-6 w-11 flex-shrink-0 rounded-full border-2 border-transparent cursor-pointer transition-colors focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",p?"bg-[rgb(var(--ndpr-primary))]":"bg-gray-200 dark:bg-gray-600"].join(" "),children:jsx("span",{"aria-hidden":"true",className:["pointer-events-none inline-block h-5 w-5 rounded-full bg-white shadow transform ring-0 transition-transform",p?"translate-x-5":"translate-x-0"].join(" ")})}),hr=({context:d,onTogglePurpose:p,onUpdateContext:r,onAddProcessor:e,onRemoveProcessor:n,classNames:t,unstyled:i})=>{let u=useId(),[b$1,l]=useState({name:"",purpose:"",country:""}),[C,g]=useState(false),a=()=>{let{name:v,purpose:c,country:S}=b$1;!v.trim()||!c.trim()||!S.trim()||(e({name:v.trim(),purpose:c.trim(),country:S.trim()}),l({name:"",purpose:"",country:""}),g(false));};return jsxs("div",{"data-ndpr-component":"policy-step-processing",className:a$1("ndpr-form-section",t==null?void 0:t.root,i),children:[jsxs("div",{children:[jsx("h2",{className:a$1("ndpr-section-heading",t==null?void 0:t.heading,i),children:"Processing Details"}),jsx("p",{className:a$1("ndpr-form-field__hint",t==null?void 0:t.subheading,i),children:"Define how and why you process personal data."})]}),jsxs("section",{className:a$1(pr,t==null?void 0:t.section,i),"aria-labelledby":"purposes-heading",children:[jsx("h3",{id:"purposes-heading",className:a$1("text-base font-semibold ndpr-text-foreground",t==null?void 0:t.sectionTitle,i),children:"Processing Purposes"}),jsx("p",{className:a$1("ndpr-form-field__hint",t==null?void 0:t.sectionDescription,i),children:"Select all purposes for which you process personal data. At least one is required."}),jsx("div",{className:a$1("space-y-3",t==null?void 0:t.purposeList,i),children:Qr.map(v=>{let c=d.purposes.includes(v.value),S=`${u}-purpose-${v.value}`,B=`${u}-purpose-desc-${v.value}`;return jsxs("label",{htmlFor:S,className:a$1("flex items-start gap-3 cursor-pointer group",t==null?void 0:t.purposeItem,i),children:[jsx("input",{id:S,type:"checkbox",checked:c,onChange:()=>p(v.value),"aria-describedby":B,className:a$1("mt-0.5 h-4 w-4 rounded border-gray-300 dark:border-gray-600 text-[rgb(var(--ndpr-primary))] focus:ring-[rgb(var(--ndpr-ring))] cursor-pointer",t==null?void 0:t.purposeCheckbox,i)}),jsxs("div",{children:[jsx("p",{className:a$1("text-sm font-medium ndpr-text-foreground",t==null?void 0:t.purposeLabel,i),children:v.label}),jsx("p",{id:B,className:a$1("ndpr-form-field__hint",t==null?void 0:t.purposeDescription,i),children:v.description})]})]},v.value)})})]}),jsxs("section",{className:a$1(pr,t==null?void 0:t.section,i),"aria-labelledby":"thirdparty-heading",children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("h3",{id:"thirdparty-heading",className:a$1("text-base font-semibold ndpr-text-foreground",t==null?void 0:t.sectionTitle,i),children:"Third-Party Data Sharing"}),jsx(gr,{id:`${u}-thirdparty-toggle`,checked:d.thirdPartyProcessors.length>0||C,onChange:v=>{v?g(true):(d.thirdPartyProcessors.forEach((c,S)=>n(0)),g(false));}})]}),(d.thirdPartyProcessors.length>0||C)&&jsxs("div",{className:a$1("ndpr-form-section",t==null?void 0:t.processorSection,i),children:[d.thirdPartyProcessors.length>0&&jsx("div",{className:a$1("overflow-x-auto",t==null?void 0:t.processorTable,i),children:jsxs("table",{className:"w-full text-sm",children:[jsx("thead",{children:jsxs("tr",{className:a$1("text-left text-xs font-medium ndpr-text-muted border-b border-gray-200 dark:border-gray-700",t==null?void 0:t.tableHeader,i),children:[jsx("th",{className:"pb-2 pr-4",children:"Name"}),jsx("th",{className:"pb-2 pr-4",children:"Purpose"}),jsx("th",{className:"pb-2 pr-4",children:"Country"}),jsx("th",{className:"pb-2"})]})}),jsx("tbody",{className:"divide-y divide-gray-100 dark:divide-gray-700",children:d.thirdPartyProcessors.map((v,c)=>jsxs("tr",{children:[jsx("td",{className:a$1("py-2 pr-4 ndpr-text-foreground",t==null?void 0:t.tableCell,i),children:v.name}),jsx("td",{className:a$1("py-2 pr-4 ndpr-text-muted",t==null?void 0:t.tableCell,i),children:v.purpose}),jsx("td",{className:a$1("py-2 pr-4 ndpr-text-muted",t==null?void 0:t.tableCell,i),children:v.country}),jsx("td",{className:"py-2",children:jsx("button",{type:"button",onClick:()=>n(c),className:a$1("text-red-500 hover:ndpr-text-destructive dark:hover:text-red-300 text-xs font-medium",t==null?void 0:t.removeButton,i),"aria-label":`Remove ${v.name}`,children:"Remove"})})]},c))})]})}),C?jsxs("div",{className:a$1("grid grid-cols-1 sm:grid-cols-3 gap-3 items-end",t==null?void 0:t.processorForm,i),children:[jsxs("div",{children:[jsx("label",{htmlFor:`${u}-proc-name`,className:"block text-xs font-medium ndpr-text-muted mb-1",children:"Processor Name"}),jsx("input",{id:`${u}-proc-name`,type:"text",placeholder:"Processor name",value:b$1.name,onChange:v=>l(c=>b(a$2({},c),{name:v.target.value})),"aria-required":"true",className:a$1(dr,t==null?void 0:t.input,i)})]}),jsxs("div",{children:[jsx("label",{htmlFor:`${u}-proc-purpose`,className:"block text-xs font-medium ndpr-text-muted mb-1",children:"Purpose"}),jsx("input",{id:`${u}-proc-purpose`,type:"text",placeholder:"Purpose",value:b$1.purpose,onChange:v=>l(c=>b(a$2({},c),{purpose:v.target.value})),"aria-required":"true",className:a$1(dr,t==null?void 0:t.input,i)})]}),jsxs("div",{children:[jsx("label",{htmlFor:`${u}-proc-country`,className:"block text-xs font-medium ndpr-text-muted mb-1",children:"Country"}),jsx("input",{id:`${u}-proc-country`,type:"text",placeholder:"Country",value:b$1.country,onChange:v=>l(c=>b(a$2({},c),{country:v.target.value})),"aria-required":"true",className:a$1(dr,t==null?void 0:t.input,i)})]}),jsxs("div",{className:"sm:col-span-3 flex gap-2",children:[jsx("button",{type:"button",onClick:a,className:a$1("ndpr-button ndpr-button--primary ndpr-button--sm",t==null?void 0:t.addButton,i),children:"Add Processor"}),jsx("button",{type:"button",onClick:()=>g(false),className:a$1("ndpr-button ndpr-button--secondary ndpr-button--sm",t==null?void 0:t.cancelButton,i),children:"Cancel"})]})]}):jsxs("button",{type:"button",onClick:()=>g(true),className:a$1("flex items-center gap-1 text-sm text-[rgb(var(--ndpr-primary))] hover:underline font-medium",t==null?void 0:t.addLink,i),children:[jsx("span",{"aria-hidden":"true",children:"+"})," Add processor"]})]})]}),jsxs("section",{className:a$1(pr,t==null?void 0:t.section,i),"aria-labelledby":"disclosures-heading",children:[jsx("h3",{id:"disclosures-heading",className:a$1("text-base font-semibold ndpr-text-foreground",t==null?void 0:t.sectionTitle,i),children:"Additional Disclosures"}),jsxs("div",{className:a$1("ndpr-form-section",t==null?void 0:t.disclosureList,i),children:[jsxs("div",{className:a$1("flex items-start justify-between gap-4",t==null?void 0:t.disclosureItem,i),children:[jsxs("div",{children:[jsx("p",{id:`${u}-cross-border-label`,className:a$1("text-sm font-medium ndpr-text-foreground",t==null?void 0:t.disclosureLabel,i),children:"Cross-border Data Transfers"}),jsx("p",{id:`${u}-cross-border-desc`,className:a$1("text-xs ndpr-text-muted mt-0.5",t==null?void 0:t.disclosureDescription,i),children:"Do you transfer personal data outside Nigeria? This triggers NDPA Chapter 6 obligations."})]}),jsx(gr,{id:`${u}-cross-border-toggle`,checked:d.hasCrossBorderTransfer,onChange:v=>r({hasCrossBorderTransfer:v})})]}),jsxs("div",{className:a$1("flex items-start justify-between gap-4",t==null?void 0:t.disclosureItem,i),children:[jsxs("div",{children:[jsx("p",{id:`${u}-automated-label`,className:a$1("text-sm font-medium ndpr-text-foreground",t==null?void 0:t.disclosureLabel,i),children:"Automated Decision-Making / Profiling"}),jsx("p",{id:`${u}-automated-desc`,className:a$1("text-xs ndpr-text-muted mt-0.5",t==null?void 0:t.disclosureDescription,i),children:"Do you use algorithms or automated systems to make decisions about individuals? Requires disclosure under NDPA Section 37."})]}),jsx(gr,{id:`${u}-automated-toggle`,checked:d.hasAutomatedDecisions,onChange:v=>r({hasAutomatedDecisions:v})})]})]})]})]})};var Cr=({section:d,index:p,isCustom:r,isEditing:e,editedContent:n,onEdit:t,onSaveEdit:i,onCancelEdit:u,onMoveUp:b,onMoveDown:l,onDelete:C,classNames:g,unstyled:a})=>{let[v,c]=useState(n!=null?n:d.template);return useEffect(()=>{n!==void 0&&c(n);},[n]),useEffect(()=>{e&&c(n!=null?n:d.template);},[e,n,d.template]),jsxs("div",{"data-ndpr-component":"policy-section-card",className:a$1("bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg p-4 space-y-3",g==null?void 0:g.root,a),children:[jsxs("div",{className:a$1("flex items-start justify-between gap-2",g==null?void 0:g.header,a),children:[jsxs("div",{className:a$1("flex items-center gap-3 min-w-0",g==null?void 0:g.titleRow,a),children:[jsx("span",{className:a$1("flex-shrink-0 w-7 h-7 rounded-full bg-gray-100 dark:bg-gray-700 ndpr-text-muted text-xs font-semibold flex items-center justify-center",g==null?void 0:g.sectionNumber,a),"aria-hidden":"true",children:p+1}),jsxs("h4",{className:a$1("text-sm font-semibold ndpr-text-foreground truncate",g==null?void 0:g.sectionTitle,a),children:[d.title,r&&jsx("span",{className:a$1("ml-2 text-xs font-normal ndpr-text-muted bg-gray-100 dark:bg-gray-700 px-1.5 py-0.5 rounded",g==null?void 0:g.customBadge,a),children:"Custom"})]})]}),jsxs("div",{className:a$1("flex items-center gap-1 flex-shrink-0",g==null?void 0:g.actions,a),children:[b&&jsx("button",{type:"button",onClick:b,className:a$1("ndpr-button ndpr-button--icon",g==null?void 0:g.moveButton,a),"aria-label":`Move "${d.title}" up`,children:jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,"aria-hidden":"true",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 15l7-7 7 7"})})}),l&&jsx("button",{type:"button",onClick:l,className:a$1("ndpr-button ndpr-button--icon",g==null?void 0:g.moveButton,a),"aria-label":`Move "${d.title}" down`,children:jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,"aria-hidden":"true",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})}),!e&&jsx("button",{type:"button",onClick:t,className:a$1("p-1.5 text-gray-400 hover:text-[rgb(var(--ndpr-primary))] rounded hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors",g==null?void 0:g.editButton,a),"aria-label":`Edit "${d.title}"`,children:jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,"aria-hidden":"true",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"})})}),r&&C&&jsx("button",{type:"button",onClick:C,className:a$1("p-1.5 text-gray-400 hover:text-red-500 dark:hover:text-red-400 rounded hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors",g==null?void 0:g.deleteButton,a),"aria-label":`Delete "${d.title}"`,children:jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,"aria-hidden":"true",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})})})]})]}),e?jsxs("div",{className:a$1("space-y-2",g==null?void 0:g.editArea,a),children:[jsx("textarea",{value:v,onChange:S=>c(S.target.value),rows:8,className:a$1("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md bg-white dark:bg-gray-800 ndpr-text-foreground focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))] text-sm font-mono resize-y",g==null?void 0:g.textarea,a),"aria-label":`Edit content for ${d.title}`}),jsxs("div",{className:a$1("flex gap-2",g==null?void 0:g.editActions,a),children:[jsx("button",{type:"button",onClick:()=>i(v),className:a$1("ndpr-button ndpr-button--primary ndpr-button--sm",g==null?void 0:g.saveButton,a),children:"Save"}),jsx("button",{type:"button",onClick:u,className:a$1("ndpr-button ndpr-button--secondary ndpr-button--sm",g==null?void 0:g.cancelButton,a),children:"Cancel"})]})]}):jsx("div",{className:a$1("text-sm ndpr-text-muted leading-relaxed line-clamp-4 whitespace-pre-wrap",g==null?void 0:g.content,a),children:d.template})]})};var kr="w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md bg-white dark:bg-gray-800 ndpr-text-foreground focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))] text-sm",wr=({onAdd:d,nextOrder:p,classNames:r,unstyled:e})=>{let n=useId(),[t,i]=useState(""),[u,b]=useState(""),[l,C]=useState(""),g=()=>{if(!t.trim()){C("Section title is required.");return}if(!u.trim()){C("Section content is required.");return}C(""),d({title:t.trim(),content:u.trim(),order:p}),i(""),b("");};return jsxs("div",{"data-ndpr-component":"custom-section-form",className:a$1("ndpr-card ndpr-card--compact",r==null?void 0:r.root,e),children:[jsx("h4",{className:a$1("ndpr-section-heading",r==null?void 0:r.heading,e),children:"Add Custom Section"}),l&&jsx("p",{role:"alert",className:a$1("text-xs ndpr-text-destructive",r==null?void 0:r.error,e),children:l}),jsxs("div",{className:a$1("space-y-3",r==null?void 0:r.fields,e),children:[jsxs("div",{children:[jsxs("label",{htmlFor:`${n}-custom-section-title`,className:a$1("block text-xs font-medium ndpr-text-muted mb-1",r==null?void 0:r.label,e),children:["Section Title ",jsx("span",{className:"text-red-500","aria-hidden":"true",children:"*"})]}),jsx("input",{id:`${n}-custom-section-title`,type:"text",value:t,onChange:a=>{i(a.target.value),l&&C("");},placeholder:"e.g. Cookie Policy",className:a$1(kr,r==null?void 0:r.input,e),"aria-required":"true"})]}),jsxs("div",{children:[jsxs("label",{htmlFor:`${n}-custom-section-content`,className:a$1("block text-xs font-medium ndpr-text-muted mb-1",r==null?void 0:r.label,e),children:["Content ",jsx("span",{className:"text-red-500","aria-hidden":"true",children:"*"})]}),jsx("textarea",{id:`${n}-custom-section-content`,value:u,onChange:a=>{b(a.target.value),l&&C("");},placeholder:"Write the section content here...",rows:5,className:a$1(`${kr} resize-y`,r==null?void 0:r.textarea,e),"aria-required":"true"})]})]}),jsx("div",{className:a$1("flex items-center gap-2",r==null?void 0:r.footer,e),children:jsx("button",{type:"button",onClick:g,className:a$1("ndpr-button ndpr-button--primary ndpr-button--sm",r==null?void 0:r.addButton,e),children:"Add Section"})})]})};var Sr={compliant:{bg:"ndpr-alert ndpr-alert--success",text:"ndpr-text-success",border:"border-green-200 dark:border-green-700"},nearly_compliant:{bg:"bg-amber-50 dark:bg-amber-900/20",text:"ndpr-text-warning",border:"border-amber-200 dark:border-amber-700"},not_compliant:{bg:"ndpr-alert ndpr-alert--destructive",text:"ndpr-text-destructive",border:"border-red-200 dark:border-red-700"}},sr={compliant:"Compliant",nearly_compliant:"Nearly Compliant",not_compliant:"Not Compliant"},N=({icon:d,label:p,description:r,actionLabel:e,loading:n,onClick:t,classNames:i,unstyled:u})=>jsxs("div",{className:a$1("bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg p-4 flex flex-col gap-3",i==null?void 0:i.formatCard,u),children:[jsxs("div",{className:a$1("flex items-center gap-3",i==null?void 0:i.formatHeader,u),children:[jsx("div",{className:a$1("w-10 h-10 rounded-lg bg-gray-100 dark:bg-gray-700 flex items-center justify-center flex-shrink-0",i==null?void 0:i.formatIcon,u),"aria-hidden":"true",children:d}),jsxs("div",{className:"min-w-0",children:[jsx("p",{className:a$1("ndpr-section-heading",i==null?void 0:i.formatLabel,u),children:p}),jsx("p",{className:a$1("ndpr-form-field__hint",i==null?void 0:i.formatDescription,u),children:r})]})]}),jsx("button",{type:"button",onClick:t,disabled:n,className:a$1("w-full px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-[rgb(var(--ndpr-primary-foreground))] rounded-md hover:bg-[rgb(var(--ndpr-primary-hover))] text-sm font-medium disabled:opacity-60 disabled:cursor-not-allowed flex items-center justify-center gap-2",i==null?void 0:i.formatButton,u),children:n?jsxs(Fragment,{children:[jsxs("svg",{className:"animate-spin w-4 h-4",fill:"none",viewBox:"0 0 24 24","aria-hidden":"true",children:[jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8v4l3-3-3-3v4a10 10 0 100 10l-1.73-3A8 8 0 014 12z"})]}),"Generating\u2026"]}):e})]}),mr=({complianceResult:d$1,onExportPDF:p,onExportDOCX:r,onExportHTML:e,onExportMarkdown:n,classNames:t,unstyled:i})=>{var c;let[u,b]=useState(false),[l,C]=useState(false),g=(c=Sr[d$1.rating])!=null?c:Sr.not_compliant,a=()=>d(null,null,function*(){b(true);try{yield p();}finally{b(false);}}),v=()=>d(null,null,function*(){C(true);try{yield r();}finally{C(false);}});return jsxs("div",{"data-ndpr-component":"policy-export-panel",className:a$1("ndpr-form-section",t==null?void 0:t.root,i),children:[jsxs("div",{className:a$1(`rounded-lg border p-4 flex items-center gap-4 ${g.bg} ${g.border}`,t==null?void 0:t.complianceSummary,i),children:[jsxs("div",{className:a$1(`text-3xl font-bold ${g.text}`,t==null?void 0:t.complianceScore,i),"aria-label":`Compliance score: ${d$1.percentage}%`,children:[d$1.percentage,"%"]}),jsxs("div",{children:[jsx("p",{className:a$1(`text-sm font-semibold ${g.text}`,t==null?void 0:t.complianceRating,i),children:sr[d$1.rating]}),jsxs("p",{className:a$1("text-xs ndpr-text-muted mt-0.5",t==null?void 0:t.complianceDetail,i),children:[d$1.score," / ",d$1.maxScore," points \u2022"," ",d$1.gaps.length," gap",d$1.gaps.length!==1?"s":""," remaining"]})]})]}),jsxs("div",{children:[jsx("h3",{className:a$1("ndpr-section-heading",t==null?void 0:t.formatsHeading,i),children:"Export Format"}),jsxs("div",{className:a$1("grid grid-cols-1 sm:grid-cols-2 gap-3",t==null?void 0:t.formatsGrid,i),children:[jsx(N,{icon:jsx("svg",{className:"w-5 h-5 text-red-500",fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:jsx("path",{d:"M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8l-6-6zm-1 7V3.5L18.5 9H13zm-3 7v-1h4v1h-4zm0-3v-1h4v1h-4zm-2-5h8v1H8v-1z"})}),label:"PDF",description:"Professional formatted document, ideal for publishing.",actionLabel:"Download PDF",loading:u,onClick:a,classNames:t,unstyled:i}),jsx(N,{icon:jsx("svg",{className:"w-5 h-5 text-blue-500",fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:jsx("path",{d:"M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8l-6-6zm-1 7V3.5L18.5 9H13zm-5 8v-5h1.5l1 3 1-3H13v5h-1v-3.5l-.75 2.25h-.5L10 13.5V17H9zm5-1.5h.75c.55 0 .75-.25.75-.75 0-.4-.2-.65-.75-.65H14V15.5zm1 1.5h-2v-4h2c1.1 0 1.75.6 1.75 1.5 0 .55-.25.95-.65 1.15.5.2.8.65.8 1.2 0 1-.65 1.65-1.9 1.65V17zm-.25-1c.6 0 .9-.25.9-.75 0-.45-.3-.75-.9-.75H14V16h.75z"})}),label:"DOCX",description:"Editable Word document for further customisation.",actionLabel:"Download DOCX",loading:l,onClick:v,classNames:t,unstyled:i}),jsx(N,{icon:jsxs("svg",{className:"w-5 h-5 text-orange-500",fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:[jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-1 15H9V8h2v9zm4 0h-2V8h2v9z"}),jsx("path",{d:"M9.5 6.5h1v1h-1zm4 0h1v1h-1z"}),jsx("path",{d:"M5 5h14v2H5zm0 12h14v2H5z"})]}),label:"HTML",description:"Copy-ready HTML to embed on your website.",actionLabel:"Copy HTML",onClick:e,classNames:t,unstyled:i}),jsx(N,{icon:jsx("svg",{className:"w-5 h-5 ndpr-text-muted",fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:jsx("path",{d:"M3 5h18v2H3V5zm0 4h12v2H3V9zm0 4h18v2H3v-2zm0 4h12v2H3v-2z"})}),label:"Markdown",description:"Plain-text format for documentation or Git repos.",actionLabel:"Copy Markdown",onClick:n,classNames:t,unstyled:i})]})]})]})};var Lr=({sections:d,customSections:p,sectionOverrides:r,complianceResult:e,onEditSection:n,onAddCustomSection:t,onRemoveCustomSection:i,onReorderSection:u,onExportPDF:b$1,onExportDOCX:l,onExportHTML:C,onExportMarkdown:g,classNames:a,unstyled:v})=>{let[c,S]=useState(null),[B,J]=useState(false),Z=new Set(p.map(h=>h.id)),or=(h,D)=>{n(h,D),S(null);},er=d.length>0?Math.max(...d.map(h=>{var D;return (D=h.order)!=null?D:0}))+1:1;return jsxs("div",{"data-ndpr-component":"policy-step-review",className:a$1("ndpr-form-section",a==null?void 0:a.root,v),children:[jsxs("div",{children:[jsx("h2",{className:a$1("ndpr-section-heading",a==null?void 0:a.heading,v),children:"Review & Export"}),jsx("p",{className:a$1("ndpr-form-field__hint",a==null?void 0:a.subheading,v),children:"Review your generated policy sections, reorder or edit content, then export."})]}),jsx("div",{className:a$1("space-y-3",a==null?void 0:a.sectionList,v),"aria-live":"polite",children:d.map((h,D)=>jsx(Cr,{section:r[h.id]?b(a$2({},h),{template:r[h.id]}):h,index:D,isCustom:Z.has(h.id),isEditing:c===h.id,editedContent:r[h.id],onEdit:()=>S(h.id),onSaveEdit:ir=>or(h.id,ir),onCancelEdit:()=>S(null),onMoveUp:D>0?()=>u(h.id,"up"):void 0,onMoveDown:D<d.length-1?()=>u(h.id,"down"):void 0,onDelete:Z.has(h.id)?()=>i(h.id):void 0,classNames:a,unstyled:v},h.id))}),!B&&jsxs("button",{type:"button",onClick:()=>J(true),className:a$1("flex items-center gap-2 text-sm text-[rgb(var(--ndpr-primary))] hover:underline font-medium",a==null?void 0:a.addSectionButton,v),children:[jsx("span",{className:a$1("w-5 h-5 rounded-full border-2 border-[rgb(var(--ndpr-primary))] flex items-center justify-center text-xs font-bold leading-none",a==null?void 0:a.addSectionIcon,v),"aria-hidden":"true",children:"+"}),"Add Custom Section"]}),B&&jsxs("div",{className:a$1("space-y-2",a==null?void 0:a.customFormWrapper,v),children:[jsx(wr,{onAdd:h=>{t(h),J(false);},nextOrder:er,classNames:a,unstyled:v}),jsx("button",{type:"button",onClick:()=>J(false),className:a$1("text-sm ndpr-text-muted hover:underline",a==null?void 0:a.cancelCustomForm,v),children:"Cancel"})]}),jsx("hr",{className:a$1("border-gray-200 dark:border-gray-700",a==null?void 0:a.divider,v)}),jsx(mr,{complianceResult:e,onExportPDF:b$1,onExportDOCX:l,onExportHTML:C,onExportMarkdown:g,classNames:a,unstyled:v})]})};var Dr={compliant:{stroke:"stroke-green-500 dark:stroke-green-400",text:"ndpr-text-success"},nearly_compliant:{stroke:"stroke-amber-500 dark:stroke-amber-400",text:"ndpr-text-warning"},not_compliant:{stroke:"stroke-red-500 dark:stroke-red-400",text:"ndpr-text-destructive"}},tt={compliant:"Compliant",nearly_compliant:"Nearly Compliant",not_compliant:"Not Compliant"},Fr=({score:d,maxScore:p,rating:r,classNames:e,unstyled:n})=>{var C,g;let t=p>0?Math.round(d/p*100):0,i=(C=Dr[r])!=null?C:Dr.not_compliant,u=36,b=2*Math.PI*u,l=b-t/100*b;return jsxs("div",{"data-ndpr-component":"compliance-score-ring",className:a$1("flex flex-col items-center gap-2",e==null?void 0:e.root,n),children:[jsxs("div",{className:a$1("relative w-24 h-24",e==null?void 0:e.svgWrapper,n),children:[jsxs("svg",{className:"w-24 h-24 -rotate-90",viewBox:"0 0 96 96","aria-hidden":"true",children:[jsx("circle",{cx:"48",cy:"48",r:u,fill:"none",className:"stroke-gray-200 dark:stroke-gray-700",strokeWidth:"8"}),jsx("circle",{cx:"48",cy:"48",r:u,fill:"none",className:i.stroke,strokeWidth:"8",strokeLinecap:"round",strokeDasharray:b,strokeDashoffset:l,style:{transition:"stroke-dashoffset 0.5s ease-out"}})]}),jsx("div",{className:a$1("absolute inset-0 flex flex-col items-center justify-center",e==null?void 0:e.centerText,n),children:jsxs("span",{className:a$1(`text-xl font-bold leading-none ${i.text}`,e==null?void 0:e.scoreValue,n),"aria-label":`${t}% compliance score`,children:[t,"%"]})})]}),jsx("p",{className:a$1(`text-xs font-semibold text-center ${i.text}`,e==null?void 0:e.ratingLabel,n),children:(g=tt[r])!=null?g:r}),jsxs("p",{className:a$1("text-xs ndpr-text-muted text-center",e==null?void 0:e.scoreDetail,n),children:[d," / ",p," pts"]})]})};var et={critical:"ndpr-text-destructive",important:"ndpr-text-warning",recommended:"ndpr-text-info"},Er=({gap:d,isPassed:p,onFix:r,classNames:e,unstyled:n})=>{let[t,i]=useState(false);return jsxs("div",{"data-ndpr-component":"compliance-requirement-item",className:a$1("border-b border-gray-100 dark:border-gray-700 last:border-0 py-2",e==null?void 0:e.root,n),children:[jsxs("button",{type:"button",onClick:()=>!p&&i(u=>!u),className:a$1("w-full flex items-start gap-2 text-left group",e==null?void 0:e.row,n),"aria-expanded":p?void 0:t,"aria-disabled":p,children:[jsx("span",{className:a$1(["mt-0.5 flex-shrink-0 w-4 h-4 rounded-full flex items-center justify-center",p?"bg-green-500":d.severity==="critical"?"bg-red-500":d.severity==="important"?"bg-amber-500":"bg-blue-400"].join(" "),e==null?void 0:e.statusIcon,n),"aria-hidden":"true",children:p?jsx("svg",{className:"w-2.5 h-2.5 text-white",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:3,children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}):jsx("svg",{className:"w-2.5 h-2.5 text-white",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:3,children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsxs("div",{className:"flex items-center justify-between gap-1",children:[jsx("p",{className:a$1(`text-xs font-medium ${p?"ndpr-text-muted":"ndpr-text-foreground"}`,e==null?void 0:e.requirementLabel,n),children:d.requirement}),!p&&jsx("svg",{className:`flex-shrink-0 w-3 h-3 text-gray-400 transition-transform ${t?"rotate-180":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,"aria-hidden":"true",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),jsxs("p",{className:a$1("text-xs text-gray-400 dark:text-gray-500 mt-0.5",e==null?void 0:e.ndpaSection,n),children:["NDPA ",d.ndpaSection]})]})]}),!p&&t&&jsxs("div",{className:a$1("mt-2 ml-6 space-y-2",e==null?void 0:e.detail,n),children:[jsx("p",{className:a$1(`text-xs ${et[d.severity]}`,e==null?void 0:e.message,n),children:d.message}),jsx("button",{type:"button",onClick:()=>{r(d.requirementId),i(false);},className:a$1("text-xs font-medium px-3 py-1 bg-[rgb(var(--ndpr-primary))] text-[rgb(var(--ndpr-primary-foreground))] rounded hover:bg-[rgb(var(--ndpr-primary-hover))]",e==null?void 0:e.fixButton,n),children:d.fixLabel})]})]})};function nt(d,p){let r=p.map(t=>({gap:{requirementId:t,requirement:t.split("-").map(i=>i.charAt(0).toUpperCase()+i.slice(1)).join(" "),ndpaSection:"\u2014",severity:"recommended",message:"",fixType:"fill_field",fixLabel:""},isPassed:true})),e=d.map(t=>({gap:t,isPassed:false})),n={critical:0,important:1,recommended:2};return e.sort((t,i)=>n[t.gap.severity]-n[i.gap.severity]),[...e,...r]}var $r=({complianceResult:d,onFix:p,classNames:r,unstyled:e})=>{let[n,t]=useState(false),i=nt(d.gaps,d.passed);return jsxs("aside",{"data-ndpr-component":"compliance-checker-sidebar",className:a$1("bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden",r==null?void 0:r.root,e),"aria-label":"NDPA compliance checker",children:[jsxs("div",{className:a$1("flex items-center justify-between px-4 py-3 border-b border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-900/50",r==null?void 0:r.header,e),children:[jsx("h2",{className:a$1("ndpr-section-heading",r==null?void 0:r.title,e),children:"NDPA Compliance"}),jsx("button",{type:"button",onClick:()=>t(u=>!u),className:a$1("p-1 text-gray-400 hover:text-gray-600 dark:hover:text-gray-200 rounded hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors",r==null?void 0:r.collapseButton,e),"aria-expanded":!n,"aria-label":n?"Expand compliance checker":"Collapse compliance checker",children:jsx("svg",{className:`w-4 h-4 transition-transform ${n?"-rotate-90":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,"aria-hidden":"true",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})})]}),!n&&jsxs("div",{className:a$1("p-4 space-y-4",r==null?void 0:r.body,e),children:[jsx("div",{className:a$1("flex justify-center",r==null?void 0:r.ringWrapper,e),children:jsx(Fr,{score:d.score,maxScore:d.maxScore,rating:d.rating,classNames:r,unstyled:e})}),jsx("div",{className:a$1("grid grid-cols-3 gap-2 text-center",r==null?void 0:r.statsRow,e),children:[{count:d.gaps.filter(u=>u.severity==="critical").length,label:"Critical",color:"ndpr-text-destructive"},{count:d.gaps.filter(u=>u.severity==="important").length,label:"Important",color:"ndpr-text-warning"},{count:d.passed.length,label:"Passed",color:"ndpr-text-success"}].map(({count:u,label:b,color:l})=>jsxs("div",{children:[jsx("p",{className:a$1(`text-base font-bold ${l}`,r==null?void 0:r.statValue,e),children:u}),jsx("p",{className:a$1("ndpr-form-field__hint",r==null?void 0:r.statLabel,e),children:b})]},b))}),jsx("div",{className:a$1("overflow-y-auto max-h-80",r==null?void 0:r.requirementsList,e),children:i.length===0?jsx("p",{className:a$1("ndpr-empty-state",r==null?void 0:r.emptyState,e),children:"No requirements to display."}):i.map(({gap:u,isPassed:b})=>jsx(Er,{gap:u,isPassed:b,onFix:p,classNames:r,unstyled:e},u.requirementId))})]})]})};function dt(d){let p=Date.now()-d;return p<1e4?"just now":p<6e4?`${Math.floor(p/1e3)}s ago`:p<36e5?`${Math.floor(p/6e4)}m ago`:new Date(d).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"})}var Ir=({lastSavedAt:d,isSaving:p,hasError:r,classNames:e,unstyled:n})=>{let t="idle";if(p?t="saving":r?t="error":d!==null&&(t="saved"),t==="idle")return null;let i=t==="saving"?"Saving\u2026":t==="error"?"Unable to save":`Draft saved ${d?dt(d):""}`;return jsxs("div",{"data-ndpr-component":"draft-save-indicator",role:"status","aria-live":"polite","aria-atomic":"true",className:a$1(`flex items-center gap-1.5 ${t==="error"?"text-red-500 dark:text-red-400":t==="saving"?"ndpr-card__subtitle":"ndpr-text-success"}`,e==null?void 0:e.root,n),children:[t==="saving"&&jsxs("svg",{className:"animate-spin w-3 h-3 flex-shrink-0",fill:"none",viewBox:"0 0 24 24","aria-hidden":"true",children:[jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8v4l3-3-3-3v4a10 10 0 100 10l-1.73-3A8 8 0 014 12z"})]}),t==="saved"&&jsx("svg",{className:"w-3 h-3 flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:3,"aria-hidden":"true",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}),t==="error"&&jsx("svg",{className:"w-3 h-3 flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,"aria-hidden":"true",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v2m0 4h.01M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z"})}),jsx("span",{className:a$1("text-xs font-medium",e==null?void 0:e.text,n),children:i})]})};var mo=({adapter:d$1,onComplete:p,classNames:r,unstyled:e})=>{let{currentStep:n,nextStep:t,prevStep:i,canProceed:u,context:b,updateOrg:l,updateContext:C,toggleDataCategory:g,togglePurpose:a$2,addProcessor:v,removeProcessor:c,sections:S,customSections:B,sectionOverrides:J,editSectionContent:Z,addCustomSection:or,removeCustomSection:er,reorderSections:h,complianceResult:D,applyFix:ir,handleExportPDF:Tr,handleExportDOCX:_r,handleExportHTML:Mr,handleExportMarkdown:Br,lastSavedAt:zr,isLoading:jr}=a({adapter:d$1,onComplete:p}),nr=(F,K)=>{let O=URL.createObjectURL(F),H=document.createElement("a");H.href=O,H.download=K,H.click(),URL.revokeObjectURL(O);},qr=()=>d(null,null,function*(){let F=yield Tr();nr(F,"privacy-policy.pdf");}),Or=()=>d(null,null,function*(){let F=yield _r();nr(F,"privacy-policy.docx");}),Hr=()=>{let F=Mr();navigator.clipboard.writeText(F).catch(()=>{let K=new Blob([F],{type:"text/html"}),O=URL.createObjectURL(K),H=window.open(O,"_blank");H?H.addEventListener("load",()=>URL.revokeObjectURL(O)):URL.revokeObjectURL(O);});},Wr=()=>{let F=Br();navigator.clipboard.writeText(F).catch(()=>{let K=new Blob([F],{type:"text/markdown"});nr(K,"privacy-policy.md");});};return jr?jsxs("div",{"data-ndpr-component":"adaptive-policy-wizard",className:a$1("flex items-center justify-center min-h-64 text-gray-400 dark:text-gray-500",r==null?void 0:r.root,e),"aria-busy":"true","aria-label":"Loading policy wizard",children:[jsxs("svg",{className:"animate-spin w-6 h-6 mr-2",fill:"none",viewBox:"0 0 24 24","aria-hidden":"true",children:[jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8v4l3-3-3-3v4a10 10 0 100 10l-1.73-3A8 8 0 014 12z"})]}),jsx("span",{className:"ndpr-text-sm",children:"Loading\u2026"})]}):jsx("div",{"data-ndpr-component":"adaptive-policy-wizard",className:a$1("min-h-screen bg-gray-50 dark:bg-gray-900",r==null?void 0:r.root,e),children:jsxs("div",{className:a$1("max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8",r==null?void 0:r.container,e),children:[jsxs("div",{className:a$1("flex items-center justify-between mb-6",r==null?void 0:r.topBar,e),children:[jsx("h1",{className:a$1("text-2xl font-bold ndpr-text-foreground",r==null?void 0:r.wizardTitle,e),children:"Privacy Policy Builder"}),jsx(Ir,{lastSavedAt:zr,isSaving:false,hasError:false,classNames:r,unstyled:e})]}),jsx("div",{className:a$1("bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg px-4 mb-6",r==null?void 0:r.stepIndicatorWrapper,e),children:jsx(lr,{currentStep:n,classNames:r,unstyled:e})}),jsxs("div",{className:a$1("flex flex-col lg:flex-row gap-6 items-start",r==null?void 0:r.panels,e),children:[jsxs("main",{"aria-live":"polite",className:a$1("flex-1 min-w-0 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg p-6",r==null?void 0:r.mainPanel,e),children:[n===1&&jsx(fr,{context:b,onUpdateOrg:l,classNames:r,unstyled:e}),n===2&&jsx(xr,{categories:b.dataCategories,onToggle:g,classNames:r,unstyled:e}),n===3&&jsx(hr,{context:b,onTogglePurpose:a$2,onUpdateContext:C,onAddProcessor:v,onRemoveProcessor:c,classNames:r,unstyled:e}),n===4&&jsx(Lr,{sections:S,customSections:B,sectionOverrides:J,complianceResult:D,onEditSection:Z,onAddCustomSection:or,onRemoveCustomSection:er,onReorderSection:h,onExportPDF:qr,onExportDOCX:Or,onExportHTML:Hr,onExportMarkdown:Wr,classNames:r,unstyled:e}),jsxs("div",{className:a$1("flex items-center justify-between mt-8 pt-4 border-t border-gray-200 dark:border-gray-700",r==null?void 0:r.navigation,e),children:[jsx("button",{type:"button",onClick:i,disabled:n===1,className:a$1("px-4 py-2 bg-gray-200 dark:bg-gray-700 ndpr-text-foreground rounded-md text-sm font-medium disabled:opacity-40 disabled:cursor-not-allowed hover:bg-gray-300 dark:hover:bg-gray-600 transition-colors",r==null?void 0:r.backButton,e),children:"Back"}),jsx("div",{className:"flex items-center gap-2",children:jsxs("span",{className:a$1("ndpr-form-field__hint",r==null?void 0:r.stepCounter,e),children:["Step ",n," of 4"]})}),n<4?jsx("button",{type:"button",onClick:t,disabled:!u,className:a$1("px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-[rgb(var(--ndpr-primary-foreground))] rounded-md hover:bg-[rgb(var(--ndpr-primary-hover))] text-sm font-medium disabled:opacity-40 disabled:cursor-not-allowed transition-colors",r==null?void 0:r.nextButton,e),children:"Next"}):jsx("span",{})]})]}),jsx("aside",{className:a$1("w-full lg:w-80 flex-shrink-0",r==null?void 0:r.sidebarWrapper,e),children:jsx($r,{complianceResult:D,onFix:ir,classNames:r,unstyled:e})})]})]})})};
|
|
2
|
-
export{mo as a};
|
package/dist/chunk-O6CUBNXK.mjs
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import {c as c$1,d as d$1,a as a$2,b as b$1}from'./chunk-AOHKVFAS.mjs';import {e,c,f}from'./chunk-RMQ7OLNY.mjs';import {a}from'./chunk-DBZSN4WP.mjs';import {b,a as a$1,d}from'./chunk-ZJYULEER.mjs';import {useRef,useState,useEffect,useMemo,useCallback}from'react';var nt=10,Rt="ndpr_policy_draft",_t=2e3;function st(){return `section_${Date.now()}_${Math.random().toString(36).slice(2,9)}`}function it(){return `draft_${Date.now()}_${Math.random().toString(36).slice(2,9)}`}function w(u,A,M){let S=Date.now();return {id:M,title:`Privacy Policy${u.org.name?` \u2014 ${u.org.name}`:""}`,templateId:"adaptive-policy-wizard",organizationInfo:{name:u.org.name,website:u.org.website,privacyEmail:u.org.privacyEmail,address:u.org.address,dpoName:u.org.dpoName,dpoEmail:u.org.dpoEmail,industry:u.org.industry},sections:A,variableValues:{},effectiveDate:S,lastUpdated:S,version:"1.0",applicableFrameworks:["ndpa","ndpr"]}}function Ut(u={}){var K;let{onComplete:A,onComplianceChange:M}=u,S=useRef((K=u.adapter)!=null?K:a(Rt));u.adapter&&(S.current=u.adapter);let f$1=useRef(it()),[P,y]=useState(1),[n,v]=useState(e),[b$2,O]=useState([]),[x,I]=useState({}),[E,$]=useState([]),[at,q]=useState(false),[ct,z]=useState(null),[N,U]=useState(true),T=useRef(false),R=useRef(null);useEffect(()=>{let t=false,e=r=>{r&&(f$1.current=r.id,v(r.templateContext),O(r.customSections),I(r.sectionOverrides),$(r.sectionOrder),y(r.currentStep),z(r.lastSavedAt),q(true));};try{let r=S.current.load();r instanceof Promise?r.then(i=>{t||(e(i),U(!1));},()=>{t||U(!1);}):(e(r),U(!1));}catch(r){t||U(false);}return ()=>{t=true;}},[]);let l=useMemo(()=>{let e=c(n).map(o=>x[o.id]?b(a$1({},o),{template:x[o.id]}):o),r=b$2.map(o=>{var d;return {id:o.id,title:o.title,template:(d=x[o.id])!=null?d:o.content,order:o.order,required:false,included:true}}),i=[...e,...r];if(E.length>0){let o=new Map(E.map((d,p)=>[d,p]));return [...i].sort((d,p)=>{let m=o.has(d.id)?o.get(d.id):i.length,C=o.has(p.id)?o.get(p.id):i.length;return m-C})}return [...i].sort((o,d)=>{var p,m;return ((p=o.order)!=null?p:0)-((m=d.order)!=null?m:0)})},[n,b$2,x,E]),s=useMemo(()=>!n.org.name&&!n.org.privacyEmail?null:w(n,l,f$1.current),[n,l]),Y=useMemo(()=>w(e(),[],f$1.current),[]),V=useMemo(()=>f(s!=null?s:Y,n),[s,n,Y]),_=V.percentage,D=V.gaps,j=useRef({score:-1,gaps:[]});useEffect(()=>{let t=j.current;M&&(_!==t.score||D!==t.gaps)&&M(_,D),j.current={score:_,gaps:D};},[_,D,M]);let dt=useMemo(()=>{switch(P){case 1:return n.org.name.trim().length>0&&n.org.privacyEmail.trim().length>0;case 2:return n.dataCategories.some(t=>t.selected);case 3:return n.purposes.length>0;case 4:return true;default:return false}},[P,n]),lt=useCallback(t=>{let e=Math.min(Math.max(1,t),4);e<4&&(T.current=false),y(e);},[]),pt=useCallback(()=>{y(t=>Math.min(t+1,4));},[]),ut=useCallback(()=>{T.current=false,y(t=>Math.max(t-1,1));},[]),mt=useCallback(t=>{v(e=>a$1(a$1({},e),t));},[]),gt=useCallback(t=>{v(e=>b(a$1({},e),{org:a$1(a$1({},e.org),t)}));},[]),ft=useCallback(t=>{v(e=>b(a$1({},e),{dataCategories:e.dataCategories.map(r=>r.id===t?b(a$1({},r),{selected:!r.selected}):r)}));},[]),Pt=useCallback(t=>{v(e=>{let r=t,i=e.purposes.includes(r);return b(a$1({},e),{purposes:i?e.purposes.filter(o=>o!==t):[...e.purposes,r]})});},[]),yt=useCallback(t=>{v(e=>b(a$1({},e),{thirdPartyProcessors:[...e.thirdPartyProcessors,t]}));},[]),Ct=useCallback(t=>{v(e=>b(a$1({},e),{thirdPartyProcessors:e.thirdPartyProcessors.filter((r,i)=>i!==t)}));},[]),St=useCallback(t=>{O(e=>e.length>=nt?e:[...e,b(a$1({},t),{id:st(),required:false})]);},[]),vt=useCallback((t,e)=>{O(r=>r.map(i=>i.id===t?a$1(a$1({},i),e):i));},[]),xt=useCallback(t=>{O(e=>e.filter(r=>r.id!==t)),$(e=>e.filter(r=>r!==t)),I(e=>{let r=a$1({},e);return delete r[t],r});},[]),ht=useCallback((t,e)=>{$(r=>{let i=r.length>0?r:l.map(m=>m.id),o=i.indexOf(t);if(o===-1){let m=l.map(It=>It.id),C=m.indexOf(t);if(C===-1)return r;let G=e==="up"?C-1:C+1;if(G<0||G>=m.length)return m;let k=[...m];return [k[C],k[G]]=[k[G],k[C]],k}let d=e==="up"?o-1:o+1;if(d<0||d>=i.length)return i;let p=[...i];return [p[o],p[d]]=[p[d],p[o]],p});},[l]),Dt=useCallback((t,e)=>{I(r=>b(a$1({},r),{[t]:e}));},[]),bt=useCallback(t=>{let e=D.find(r=>r.requirementId===t);if(e)switch(e.fixType){case "fill_field":{T.current=false;let i=["data-categories-disclosed"],o=["purpose-of-processing"];i.includes(t)?y(2):o.includes(t)?y(3):(y(1));break}case "add_section":{if(!e.suggestedContent)break;O(r=>r.length>=nt?r:[...r,{id:st(),title:e.requirement,content:e.suggestedContent,order:999,required:false}]);break}case "add_content":{if(!e.suggestedContent)break;let r="data-subject-rights";I(i=>{var d,p,m;let o=(m=(p=i[r])!=null?p:(d=l.find(C=>C.id===r))==null?void 0:d.template)!=null?m:"";return b(a$1({},i),{[r]:`${o}
|
|
2
|
-
|
|
3
|
-
${e.suggestedContent}`.trim()})});break}}},[D,l]),X=useCallback(t=>({id:f$1.current,templateContext:n,customSections:b$2,sectionOverrides:x,sectionOrder:E,currentStep:t,lastSavedAt:Date.now(),status:"draft"}),[n,b$2,x,E]),Ot=useCallback(()=>d(null,null,function*(){let t=X(P);try{yield Promise.resolve(S.current.save(t)),z(t.lastSavedAt),q(!0);}catch(e){console.warn("[ndpr-toolkit] Failed to save draft:",e);}}),[X,P]),Et=useCallback(()=>{Promise.resolve(S.current.remove()).catch(t=>{console.warn("[ndpr-toolkit] Failed to remove draft:",t);}),f$1.current=it(),T.current=false,v(e()),O([]),I({}),$([]),y(1),q(false),z(null);},[]);useEffect(()=>{if(!N)return R.current&&clearTimeout(R.current),R.current=setTimeout(()=>{let t=X(P);Promise.resolve(S.current.save(t)).then(()=>{z(t.lastSavedAt),q(true);}).catch(e=>{console.warn("[ndpr-toolkit] Auto-save failed:",e);});},_t),()=>{R.current&&clearTimeout(R.current);}},[n,b$2,x,E,P,N,X]),useEffect(()=>{P===4&&s&&A&&!T.current&&(T.current=true,A(s));},[P,s,A]);let Tt=useCallback(t=>d(null,null,function*(){let e=s!=null?s:w(n,l,f$1.current);return c$1(e,t)}),[s,n,l]),wt=useCallback(t=>d(null,null,function*(){let e=s!=null?s:w(n,l,f$1.current);return d$1(e,t)}),[s,n,l]),At=useCallback(t=>{let e=s!=null?s:w(n,l,f$1.current);return a$2(e,t)},[s,n,l]),Mt=useCallback(()=>{let t=s!=null?s:w(n,l,f$1.current);return b$1(t)},[s,n,l]);return {currentStep:P,goToStep:lt,nextStep:pt,prevStep:ut,canProceed:dt,context:n,updateContext:mt,updateOrg:gt,toggleDataCategory:ft,togglePurpose:Pt,addProcessor:yt,removeProcessor:Ct,policy:s,sections:l,customSections:b$2,addCustomSection:St,updateCustomSection:vt,removeCustomSection:xt,reorderSections:ht,editSectionContent:Dt,sectionOverrides:x,complianceScore:_,complianceResult:V,complianceGaps:D,applyFix:bt,handleExportPDF:Tt,handleExportDOCX:wt,handleExportHTML:At,handleExportMarkdown:Mt,isDraftSaved:at,lastSavedAt:ct,saveDraft:Ot,discardDraft:Et,isLoading:N}}export{Ut as a};
|
package/dist/chunk-RV2VMWZJ.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import {a}from'./chunk-BNHQFZHL.mjs';import {a as a$1}from'./chunk-ZJYULEER.mjs';import {jsx}from'react/jsx-runtime';var p=t=>jsx(a,a$1({},t));export{p as a};
|
package/dist/chunk-UI536RU2.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
'use strict';var chunkN3MQQUQP_js=require('./chunk-N3MQQUQP.js'),chunkQ64735OC_js=require('./chunk-Q64735OC.js'),chunkVWED6UTN_js=require('./chunk-VWED6UTN.js'),chunkRFPLZDIO_js=require('./chunk-RFPLZDIO.js'),react=require('react');var nt=10,Rt="ndpr_policy_draft",_t=2e3;function st(){return `section_${Date.now()}_${Math.random().toString(36).slice(2,9)}`}function it(){return `draft_${Date.now()}_${Math.random().toString(36).slice(2,9)}`}function w(u,A,M){let S=Date.now();return {id:M,title:`Privacy Policy${u.org.name?` \u2014 ${u.org.name}`:""}`,templateId:"adaptive-policy-wizard",organizationInfo:{name:u.org.name,website:u.org.website,privacyEmail:u.org.privacyEmail,address:u.org.address,dpoName:u.org.dpoName,dpoEmail:u.org.dpoEmail,industry:u.org.industry},sections:A,variableValues:{},effectiveDate:S,lastUpdated:S,version:"1.0",applicableFrameworks:["ndpa","ndpr"]}}function Ut(u={}){var K;let{onComplete:A,onComplianceChange:M}=u,S=react.useRef((K=u.adapter)!=null?K:chunkVWED6UTN_js.a(Rt));u.adapter&&(S.current=u.adapter);let f=react.useRef(it()),[P,y]=react.useState(1),[n,v]=react.useState(chunkQ64735OC_js.e),[b,O]=react.useState([]),[x,I]=react.useState({}),[E,$]=react.useState([]),[at,q]=react.useState(false),[ct,z]=react.useState(null),[N,U]=react.useState(true),T=react.useRef(false),R=react.useRef(null);react.useEffect(()=>{let t=false,e=r=>{r&&(f.current=r.id,v(r.templateContext),O(r.customSections),I(r.sectionOverrides),$(r.sectionOrder),y(r.currentStep),z(r.lastSavedAt),q(true));};try{let r=S.current.load();r instanceof Promise?r.then(i=>{t||(e(i),U(!1));},()=>{t||U(!1);}):(e(r),U(!1));}catch(r){t||U(false);}return ()=>{t=true;}},[]);let l=react.useMemo(()=>{let e=chunkQ64735OC_js.c(n).map(o=>x[o.id]?chunkRFPLZDIO_js.b(chunkRFPLZDIO_js.a({},o),{template:x[o.id]}):o),r=b.map(o=>{var d;return {id:o.id,title:o.title,template:(d=x[o.id])!=null?d:o.content,order:o.order,required:false,included:true}}),i=[...e,...r];if(E.length>0){let o=new Map(E.map((d,p)=>[d,p]));return [...i].sort((d,p)=>{let m=o.has(d.id)?o.get(d.id):i.length,C=o.has(p.id)?o.get(p.id):i.length;return m-C})}return [...i].sort((o,d)=>{var p,m;return ((p=o.order)!=null?p:0)-((m=d.order)!=null?m:0)})},[n,b,x,E]),s=react.useMemo(()=>!n.org.name&&!n.org.privacyEmail?null:w(n,l,f.current),[n,l]),Y=react.useMemo(()=>w(chunkQ64735OC_js.e(),[],f.current),[]),V=react.useMemo(()=>chunkQ64735OC_js.f(s!=null?s:Y,n),[s,n,Y]),_=V.percentage,D=V.gaps,j=react.useRef({score:-1,gaps:[]});react.useEffect(()=>{let t=j.current;M&&(_!==t.score||D!==t.gaps)&&M(_,D),j.current={score:_,gaps:D};},[_,D,M]);let dt=react.useMemo(()=>{switch(P){case 1:return n.org.name.trim().length>0&&n.org.privacyEmail.trim().length>0;case 2:return n.dataCategories.some(t=>t.selected);case 3:return n.purposes.length>0;case 4:return true;default:return false}},[P,n]),lt=react.useCallback(t=>{let e=Math.min(Math.max(1,t),4);e<4&&(T.current=false),y(e);},[]),pt=react.useCallback(()=>{y(t=>Math.min(t+1,4));},[]),ut=react.useCallback(()=>{T.current=false,y(t=>Math.max(t-1,1));},[]),mt=react.useCallback(t=>{v(e=>chunkRFPLZDIO_js.a(chunkRFPLZDIO_js.a({},e),t));},[]),gt=react.useCallback(t=>{v(e=>chunkRFPLZDIO_js.b(chunkRFPLZDIO_js.a({},e),{org:chunkRFPLZDIO_js.a(chunkRFPLZDIO_js.a({},e.org),t)}));},[]),ft=react.useCallback(t=>{v(e=>chunkRFPLZDIO_js.b(chunkRFPLZDIO_js.a({},e),{dataCategories:e.dataCategories.map(r=>r.id===t?chunkRFPLZDIO_js.b(chunkRFPLZDIO_js.a({},r),{selected:!r.selected}):r)}));},[]),Pt=react.useCallback(t=>{v(e=>{let r=t,i=e.purposes.includes(r);return chunkRFPLZDIO_js.b(chunkRFPLZDIO_js.a({},e),{purposes:i?e.purposes.filter(o=>o!==t):[...e.purposes,r]})});},[]),yt=react.useCallback(t=>{v(e=>chunkRFPLZDIO_js.b(chunkRFPLZDIO_js.a({},e),{thirdPartyProcessors:[...e.thirdPartyProcessors,t]}));},[]),Ct=react.useCallback(t=>{v(e=>chunkRFPLZDIO_js.b(chunkRFPLZDIO_js.a({},e),{thirdPartyProcessors:e.thirdPartyProcessors.filter((r,i)=>i!==t)}));},[]),St=react.useCallback(t=>{O(e=>e.length>=nt?e:[...e,chunkRFPLZDIO_js.b(chunkRFPLZDIO_js.a({},t),{id:st(),required:false})]);},[]),vt=react.useCallback((t,e)=>{O(r=>r.map(i=>i.id===t?chunkRFPLZDIO_js.a(chunkRFPLZDIO_js.a({},i),e):i));},[]),xt=react.useCallback(t=>{O(e=>e.filter(r=>r.id!==t)),$(e=>e.filter(r=>r!==t)),I(e=>{let r=chunkRFPLZDIO_js.a({},e);return delete r[t],r});},[]),ht=react.useCallback((t,e)=>{$(r=>{let i=r.length>0?r:l.map(m=>m.id),o=i.indexOf(t);if(o===-1){let m=l.map(It=>It.id),C=m.indexOf(t);if(C===-1)return r;let G=e==="up"?C-1:C+1;if(G<0||G>=m.length)return m;let k=[...m];return [k[C],k[G]]=[k[G],k[C]],k}let d=e==="up"?o-1:o+1;if(d<0||d>=i.length)return i;let p=[...i];return [p[o],p[d]]=[p[d],p[o]],p});},[l]),Dt=react.useCallback((t,e)=>{I(r=>chunkRFPLZDIO_js.b(chunkRFPLZDIO_js.a({},r),{[t]:e}));},[]),bt=react.useCallback(t=>{let e=D.find(r=>r.requirementId===t);if(e)switch(e.fixType){case "fill_field":{T.current=false;let i=["data-categories-disclosed"],o=["purpose-of-processing"];i.includes(t)?y(2):o.includes(t)?y(3):(y(1));break}case "add_section":{if(!e.suggestedContent)break;O(r=>r.length>=nt?r:[...r,{id:st(),title:e.requirement,content:e.suggestedContent,order:999,required:false}]);break}case "add_content":{if(!e.suggestedContent)break;let r="data-subject-rights";I(i=>{var d,p,m;let o=(m=(p=i[r])!=null?p:(d=l.find(C=>C.id===r))==null?void 0:d.template)!=null?m:"";return chunkRFPLZDIO_js.b(chunkRFPLZDIO_js.a({},i),{[r]:`${o}
|
|
2
|
-
|
|
3
|
-
${e.suggestedContent}`.trim()})});break}}},[D,l]),X=react.useCallback(t=>({id:f.current,templateContext:n,customSections:b,sectionOverrides:x,sectionOrder:E,currentStep:t,lastSavedAt:Date.now(),status:"draft"}),[n,b,x,E]),Ot=react.useCallback(()=>chunkRFPLZDIO_js.d(null,null,function*(){let t=X(P);try{yield Promise.resolve(S.current.save(t)),z(t.lastSavedAt),q(!0);}catch(e){console.warn("[ndpr-toolkit] Failed to save draft:",e);}}),[X,P]),Et=react.useCallback(()=>{Promise.resolve(S.current.remove()).catch(t=>{console.warn("[ndpr-toolkit] Failed to remove draft:",t);}),f.current=it(),T.current=false,v(chunkQ64735OC_js.e()),O([]),I({}),$([]),y(1),q(false),z(null);},[]);react.useEffect(()=>{if(!N)return R.current&&clearTimeout(R.current),R.current=setTimeout(()=>{let t=X(P);Promise.resolve(S.current.save(t)).then(()=>{z(t.lastSavedAt),q(true);}).catch(e=>{console.warn("[ndpr-toolkit] Auto-save failed:",e);});},_t),()=>{R.current&&clearTimeout(R.current);}},[n,b,x,E,P,N,X]),react.useEffect(()=>{P===4&&s&&A&&!T.current&&(T.current=true,A(s));},[P,s,A]);let Tt=react.useCallback(t=>chunkRFPLZDIO_js.d(null,null,function*(){let e=s!=null?s:w(n,l,f.current);return chunkN3MQQUQP_js.c(e,t)}),[s,n,l]),wt=react.useCallback(t=>chunkRFPLZDIO_js.d(null,null,function*(){let e=s!=null?s:w(n,l,f.current);return chunkN3MQQUQP_js.d(e,t)}),[s,n,l]),At=react.useCallback(t=>{let e=s!=null?s:w(n,l,f.current);return chunkN3MQQUQP_js.a(e,t)},[s,n,l]),Mt=react.useCallback(()=>{let t=s!=null?s:w(n,l,f.current);return chunkN3MQQUQP_js.b(t)},[s,n,l]);return {currentStep:P,goToStep:lt,nextStep:pt,prevStep:ut,canProceed:dt,context:n,updateContext:mt,updateOrg:gt,toggleDataCategory:ft,togglePurpose:Pt,addProcessor:yt,removeProcessor:Ct,policy:s,sections:l,customSections:b,addCustomSection:St,updateCustomSection:vt,removeCustomSection:xt,reorderSections:ht,editSectionContent:Dt,sectionOverrides:x,complianceScore:_,complianceResult:V,complianceGaps:D,applyFix:bt,handleExportPDF:Tt,handleExportDOCX:wt,handleExportHTML:At,handleExportMarkdown:Mt,isDraftSaved:at,lastSavedAt:ct,saveDraft:Ot,discardDraft:Et,isLoading:N}}exports.a=Ut;
|
package/dist/chunk-W7RBGZCC.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
'use strict';var chunkI2LMQWK3_js=require('./chunk-I2LMQWK3.js'),chunkRFPLZDIO_js=require('./chunk-RFPLZDIO.js'),jsxRuntime=require('react/jsx-runtime');var p=t=>jsxRuntime.jsx(chunkI2LMQWK3_js.a,chunkRFPLZDIO_js.a({},t));exports.a=p;
|