@tantainnovative/ndpr-toolkit
Version:
Nigeria Data Protection Toolkit — enterprise-grade compliance components for the Nigeria Data Protection Act (NDPA) 2023
298 lines (277 loc) • 11.1 kB
TypeScript
import React__default from 'react';
/** A user-defined section added to the policy outside the generated ones. */
declare interface CustomSection {
id: string;
title: string;
content: string;
order: number;
required: false;
}
/** A logical category of personal data the organisation may collect. */
declare interface DataCategory {
/** Machine-readable identifier. */
id: string;
/** Human-readable label shown in the wizard. */
label: string;
/** Grouping for display and compliance checks. */
group: 'identity' | 'financial' | 'behavioral' | 'sensitive' | 'children';
/** Specific data points within this category. */
dataPoints: string[];
/** Whether this category is currently selected by the user. */
selected: boolean;
}
/**
* Policy engine types for the adaptive privacy policy generator.
* These types power the wizard-driven policy builder, compliance checker,
* and export functionality — all aligned with the NDPA 2023.
*/
/** Industry verticals with sector-specific compliance requirements. */
declare type Industry = 'fintech' | 'healthcare' | 'ecommerce' | 'saas' | 'education' | 'government' | 'other';
export declare const NDPRPrivacyPolicy: React__default.FC<NDPRPrivacyPolicyProps>;
/**
* UX copy overrides for the NDPRPrivacyPolicy preset. Strings you omit
* fall back to the underlying `<AdaptivePolicyWizard>` defaults.
*
* Note: the wizard renders many step-specific labels; the fields here
* cover the high-level header text. Step-specific copy is wired through
* the `NDPRProvider` locale.
*/
declare interface NDPRPrivacyPolicyCopy {
/** Wizard heading. Default: "Privacy Policy Builder" */
title?: string;
/** Optional body paragraph under the heading. */
description?: string;
/** Submit / complete button label. */
submitButton?: string;
}
export declare interface NDPRPrivacyPolicyProps {
adapter?: StorageAdapter<PolicyDraft>;
onComplete?: (policy: PrivacyPolicy) => void;
classNames?: Record<string, string>;
unstyled?: boolean;
/**
* UX copy overrides — see the `NDPRPrivacyPolicyCopy` interface. The wizard
* derives most of its labels from the active `NDPRProvider` locale; the
* fields here cover the high-level header text.
*/
copy?: NDPRPrivacyPolicyCopy;
/**
* Pre-fill the policy wizard with a sector-specific starter template.
*
* Pass one of `'saas' | 'ecommerce' | 'school' | 'healthcare' |
* 'procurement'` and the wizard opens already populated with the data
* categories, lawful-basis defaults, sensitive-data / children /
* cross-border / automated-decisions flags that org type usually needs.
* The user can still flip every flag and rewrite every section.
*
* @example
* <NDPRPrivacyPolicy
* template="healthcare"
* templateOverrides={{ orgName: 'Lagos Heart Centre' }}
* />
*
* @see templateContextFor in `/server` or `/core` for the underlying
* factory if you'd rather build the context yourself.
*/
template?: OrgPolicyTemplateId;
/**
* Organisation-level overrides applied on top of the chosen template.
* Ignored when `template` is unset.
*/
templateOverrides?: OrgPolicyTemplateOverrides;
/**
* Pass a fully-constructed `TemplateContext` to skip the template
* lookup entirely. Takes precedence over `template` if both are set.
*/
initialContext?: TemplateContext;
}
/**
* Represents organization information for a privacy policy
*/
declare interface OrganizationInfo {
/** Name of the organization */
name: string;
/** Website URL of the organization */
website: string;
/** Contact email for privacy inquiries */
privacyEmail: string;
/** Physical address of the organization */
address?: string;
/** Phone number for privacy inquiries */
privacyPhone?: string;
/** Name of the Data Protection Officer */
dpoName?: string;
/** Email of the Data Protection Officer */
dpoEmail?: string;
/** Industry or sector of the organization */
industry?: string;
/** NDPC registration number (if registered) */
ndpcRegistrationNumber?: string;
}
/**
* Org-specific privacy-policy templates — pre-filled `TemplateContext`
* factories for the most common Nigerian app shapes.
*
* Each template returns a fully-populated `TemplateContext` with:
* - industry set to the matching `Industry` value
* - the data categories the sector typically collects (selected: true)
* - the processing purposes that match the business model
* - sensitive-data / children / cross-border / automated-decisions flags
* set to the defaults that org type usually needs (a school will have
* children data, a hospital will have sensitive data, etc.)
*
* Templates are guidance starters. The wizard still walks the user through
* every step — they can flip any flag, add/remove categories, or rewrite
* any section before the policy is finalised. The legal-notice footer the
* toolkit ships everywhere applies to the generated output.
*
* @example
* import { templateContextFor } from '@tantainnovative/ndpr-toolkit/server';
* const ctx = templateContextFor('ecommerce', { orgName: 'Acme NG' });
* const draft = assemblePolicy(ctx);
*/
/** Identifiers for the bundled org templates. */
declare type OrgPolicyTemplateId = 'saas' | 'ecommerce' | 'school' | 'healthcare' | 'procurement';
/** Optional overrides applied on top of a template's defaults. */
declare interface OrgPolicyTemplateOverrides {
/** Organisation name (e.g. "Acme Nigeria Ltd"). Default: empty. */
orgName?: string;
/** Public website URL. */
website?: string;
/** Privacy contact email. */
privacyEmail?: string;
/** Postal address. */
address?: string;
/** DPO name. Required for DCPMI under NDPA Section 32. */
dpoName?: string;
/** DPO email. Required for the NDPC breach-notification contact. */
dpoEmail?: string;
}
/** Organisation size tiers — affects complexity of generated language. */
declare type OrgSize = 'startup' | 'midsize' | 'enterprise';
/** Represents an in-progress policy being built in the wizard. */
declare interface PolicyDraft {
/** Unique identifier for the draft. */
id: string;
/** The template context driving section generation. */
templateContext: TemplateContext;
/** Custom sections added by the user. */
customSections: CustomSection[];
/** Per-section content overrides keyed by section id. */
sectionOverrides: Record<string, string>;
/** Ordered list of section ids defining the final order. */
sectionOrder: string[];
/** Current wizard step (0-indexed). */
currentStep: number;
/** Timestamp of the last save. */
lastSavedAt: number;
/** The draft is always in "draft" status until finalised. */
status: 'draft';
}
/**
* Privacy policy types aligned with NDPA 2023
* Privacy policies must clearly inform data subjects of their rights under the NDPA
*/
/**
* Represents a section in a privacy policy
*/
declare interface PolicySection {
/** Unique identifier for the section */
id: string;
/** Title of the section */
title: string;
/** Description of the section */
description?: string;
/** Order of the section in the policy */
order?: number;
/** Whether the section is required by NDPA */
required: boolean;
/** Template text for the section */
template: string;
/**
* Default content for the section (legacy field)
* @deprecated Use template instead
*/
defaultContent?: string;
/**
* Custom content for the section (overrides default content)
* @deprecated Use template instead
*/
customContent?: string;
/** Whether the section is included in the policy */
included: boolean;
/** Variables that can be used in the section content */
variables?: string[];
}
/**
* Represents a generated privacy policy
*/
declare interface PrivacyPolicy {
/** Unique identifier for the policy */
id: string;
/** Title of the policy */
title: string;
/** Template used to generate the policy */
templateId: string;
/** Organization information */
organizationInfo: OrganizationInfo;
/** Sections of the policy */
sections: PolicySection[];
/** Values for the variables used in the policy */
variableValues: Record<string, string>;
/** Effective date of the policy */
effectiveDate: number;
/** Last updated date of the policy */
lastUpdated: number;
/** Version of the policy */
version: string;
/**
* Applicable legal frameworks
*/
applicableFrameworks?: ('ndpa' | 'ndpr' | 'gdpr' | 'ccpa')[];
}
/** Lawful processing purposes recognised under the NDPA. */
declare type ProcessingPurpose = 'service_delivery' | 'marketing' | 'analytics' | 'research' | 'legal_compliance' | 'fraud_prevention';
declare interface StorageAdapter<T = unknown> {
/** Load persisted data. Called once on hook mount. */
load(): T | null | Promise<T | null>;
/** Persist data. Called on every state change. */
save(data: T): void | Promise<void>;
/** Clear persisted data. Called on reset. */
remove(): void | Promise<void>;
}
/** Full context used to generate an adaptive privacy policy. */
declare interface TemplateContext {
/** Organisation details, extended with industry and size. */
org: OrganizationInfo & {
industry: Industry;
orgSize: OrgSize;
country: string;
};
/** Data categories the organisation collects. */
dataCategories: DataCategory[];
/** Processing purposes relevant to the organisation. */
purposes: ProcessingPurpose[];
/** Whether the organisation processes children's data. */
hasChildrenData: boolean;
/** Whether the organisation processes sensitive/special-category data. */
hasSensitiveData: boolean;
/** Whether the organisation processes financial data. */
hasFinancialData: boolean;
/** Whether data is transferred outside Nigeria. */
hasCrossBorderTransfer: boolean;
/** Whether automated decision-making or profiling is used. */
hasAutomatedDecisions: boolean;
/** Third-party processors that receive personal data. */
thirdPartyProcessors: ThirdPartyProcessor[];
}
/** A third-party entity that processes data on behalf of the organisation. */
declare interface ThirdPartyProcessor {
/** Name of the third party. */
name: string;
/** Purpose of sharing data with this processor. */
purpose: string;
/** Country where the processor is located. */
country: string;
}
export { }