@tantainnovative/ndpr-toolkit 3.3.1 → 3.4.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 +542 -0
- package/README.md +80 -38
- package/dist/{ConsentBanner-CDRT0o2k.d.mts → ConsentBanner-F5ayys5K.d.mts} +10 -0
- package/dist/{ConsentBanner-Vxyt8SCX.d.ts → ConsentBanner-VqIPophc.d.ts} +10 -0
- package/dist/{styling-B7CBzYG7.d.ts → ConsentManager-C7I3PDe8.d.mts} +2 -62
- package/dist/{styling-uJLsBbER.d.mts → ConsentManager-CQ2IZtUU.d.ts} +2 -62
- package/dist/{sanitize-B0AzEm1D.d.mts → NDPRProvider-DYFb8xEl.d.ts} +2 -94
- package/dist/{sanitize-B0AzEm1D.d.ts → NDPRProvider-U3QNu6MA.d.mts} +2 -94
- package/dist/adapters.js +1 -1
- package/dist/adapters.mjs +1 -1
- package/dist/breach.js +2 -1
- package/dist/breach.mjs +2 -1
- package/dist/chunk-2L7BSG7G.mjs +2 -0
- package/dist/chunk-3NQQSU4P.js +2 -0
- package/dist/chunk-3VQAYQR7.js +7 -0
- package/dist/chunk-4BOEFDDE.js +4 -0
- package/dist/chunk-5HL4UBFV.js +2 -0
- package/dist/chunk-6HZL2WDU.mjs +2 -0
- package/dist/chunk-6QPRDQZF.js +2 -0
- package/dist/chunk-74Z23WUA.mjs +2 -0
- package/dist/chunk-AHSMDPG5.js +132 -0
- package/dist/chunk-ASLMPY54.js +3 -0
- package/dist/chunk-BN77GP4W.mjs +2 -0
- package/dist/chunk-C5QO3SX4.js +2 -0
- package/dist/chunk-CISJAQ6W.mjs +2 -0
- package/dist/chunk-DUY6F3GT.mjs +94 -0
- package/dist/chunk-EHAZIKDX.js +81 -0
- package/dist/chunk-EPT2K355.mjs +2 -0
- package/dist/chunk-HGGLW5TE.js +2 -0
- package/dist/chunk-HQSU7LGM.js +94 -0
- package/dist/chunk-I557S566.mjs +15 -0
- package/dist/chunk-IZCWCE7W.mjs +2 -0
- package/dist/chunk-JBSCER34.js +2 -0
- package/dist/chunk-JFFOPHU3.mjs +318 -0
- package/dist/chunk-KF3EFJEF.mjs +3 -0
- package/dist/chunk-LJNNPAFU.mjs +2 -0
- package/dist/{chunk-UXMGBIX6.js → chunk-LSCMXAPY.mjs} +4 -4
- package/dist/chunk-LSNL4XR5.js +2 -0
- package/dist/chunk-MLOWRZXO.mjs +4 -0
- package/dist/chunk-NFJ4CB63.mjs +3 -0
- package/dist/chunk-NQNFS3QI.js +7 -0
- package/dist/{chunk-ZEOQYWOE.mjs → chunk-P2YV6DR3.js} +4 -4
- package/dist/chunk-P6QAFBCV.js +2 -0
- package/dist/chunk-R5FW5XUQ.mjs +2 -0
- package/dist/chunk-RLYTX3MM.js +2 -0
- package/dist/chunk-RRVKUCFR.mjs +2 -0
- package/dist/chunk-RXL6CZAI.js +2 -0
- package/dist/chunk-RY3PGVLZ.mjs +2 -0
- package/dist/chunk-SUEGUY35.js +2 -0
- package/dist/chunk-SYMQJO2W.mjs +7 -0
- package/dist/chunk-TCN22KYP.mjs +7 -0
- package/dist/chunk-UHTJ6UFW.js +2 -0
- package/dist/chunk-VTITKWGX.mjs +2 -0
- package/dist/chunk-WH6ZMUOS.mjs +81 -0
- package/dist/chunk-WTJGLNTB.js +3 -0
- package/dist/chunk-XHROISIF.mjs +2 -0
- package/dist/chunk-YPKUHSK4.js +15 -0
- package/dist/chunk-Z73T6MWY.js +318 -0
- package/dist/chunk-ZLSWOFAY.mjs +132 -0
- package/dist/chunk-ZPKVLTSX.js +2 -0
- package/dist/consent.d.mts +6 -4
- package/dist/consent.d.ts +6 -4
- package/dist/consent.js +2 -1
- package/dist/consent.mjs +2 -1
- package/dist/core.d.mts +6 -29
- package/dist/core.d.ts +6 -29
- package/dist/core.js +1 -1
- package/dist/core.mjs +1 -1
- package/dist/cross-border.js +2 -1
- package/dist/cross-border.mjs +2 -1
- package/dist/docx-4n8g4zul.d.mts +64 -0
- package/dist/docx-VvcTLYZM.d.ts +64 -0
- package/dist/dpia.js +2 -1
- package/dist/dpia.mjs +2 -1
- package/dist/dsr.js +2 -1
- package/dist/dsr.mjs +2 -1
- package/dist/hooks.d.mts +3 -3
- package/dist/hooks.d.ts +3 -3
- package/dist/hooks.js +2 -1
- package/dist/hooks.mjs +2 -1
- package/dist/index.d.mts +7 -5
- package/dist/index.d.ts +7 -5
- package/dist/index.js +2 -1
- package/dist/index.mjs +2 -1
- package/dist/lawful-basis.js +2 -1
- package/dist/lawful-basis.mjs +2 -1
- package/dist/locale-CxJx2tzn.d.mts +25 -0
- package/dist/locale-DSkrtf-c.d.ts +25 -0
- package/dist/{policy-engine-DefZcX3R.d.mts → policy-engine-5qTfp2z4.d.mts} +21 -1
- package/dist/{policy-engine-C6nC2t3a.d.ts → policy-engine-DzPxskOK.d.ts} +21 -1
- package/dist/{policy-sections-DFDPVCCg.d.ts → policy-sections-9tCb7VU7.d.ts} +4 -2
- package/dist/{policy-sections-Bylm31kZ.d.mts → policy-sections-CBWcJv-R.d.mts} +4 -2
- package/dist/{policy-templates-CIKcV0i1.d.ts → policy-templates-DhLwq4R-.d.ts} +8 -1
- package/dist/{policy-templates-DMsPwOSZ.d.mts → policy-templates-DwYl2329.d.mts} +8 -1
- package/dist/policy.d.mts +36 -71
- package/dist/policy.d.ts +36 -71
- package/dist/policy.js +2 -1
- package/dist/policy.mjs +2 -1
- package/dist/presets.d.mts +2 -2
- package/dist/presets.d.ts +2 -2
- package/dist/presets.js +2 -1
- package/dist/presets.mjs +2 -1
- package/dist/ropa.js +2 -1
- package/dist/ropa.mjs +2 -1
- package/dist/sanitize-CxxwKxAx.d.mts +94 -0
- package/dist/sanitize-CxxwKxAx.d.ts +94 -0
- package/dist/server.d.mts +24 -0
- package/dist/server.d.ts +24 -0
- package/dist/server.js +2 -0
- package/dist/server.mjs +2 -0
- package/dist/styles.css +1423 -31
- package/dist/styling-BMDGQDgS.d.mts +64 -0
- package/dist/styling-BaoQtV06.d.ts +64 -0
- package/dist/unstyled.d.mts +52 -19
- package/dist/unstyled.d.ts +52 -19
- package/dist/unstyled.js +2 -1
- package/dist/unstyled.mjs +2 -1
- package/dist/{useAdaptivePolicyWizard-A1PyOy6P.d.mts → useAdaptivePolicyWizard-BSLyltzZ.d.mts} +1 -1
- package/dist/{useAdaptivePolicyWizard-LVIKhAxw.d.ts → useAdaptivePolicyWizard-CL7C7MTZ.d.ts} +1 -1
- package/dist/{useDefaultPrivacyPolicy-ySWU7nc-.d.mts → useDefaultPrivacyPolicy-Cs2WQSYQ.d.mts} +30 -9
- package/dist/{useDefaultPrivacyPolicy-DvCbeEl1.d.ts → useDefaultPrivacyPolicy-DkOqMg2e.d.ts} +30 -9
- package/package.json +14 -2
- package/dist/chunk-25OOUES4.js +0 -2
- package/dist/chunk-4JKTIR33.mjs +0 -2
- package/dist/chunk-5BUS6AI7.js +0 -2
- package/dist/chunk-5ECDPRSZ.js +0 -7
- package/dist/chunk-6YN73KR7.mjs +0 -2
- package/dist/chunk-CDZDT2OS.mjs +0 -320
- package/dist/chunk-CWUPGY3M.mjs +0 -3
- package/dist/chunk-CYU6YUJQ.mjs +0 -81
- package/dist/chunk-EKHBORAH.js +0 -81
- package/dist/chunk-ENIMJ6SQ.js +0 -2
- package/dist/chunk-FLKJSGR7.mjs +0 -94
- package/dist/chunk-FWLPJ5YI.js +0 -94
- package/dist/chunk-GCQRHMTQ.mjs +0 -144
- package/dist/chunk-GMLCWGNJ.js +0 -7
- package/dist/chunk-GXLSOZCH.mjs +0 -2
- package/dist/chunk-LETEUS5X.mjs +0 -2
- package/dist/chunk-LU4PFST7.js +0 -144
- package/dist/chunk-NBSVFQ5G.js +0 -2
- package/dist/chunk-OYR3L4XS.mjs +0 -7
- package/dist/chunk-QF6XNKU6.mjs +0 -2
- package/dist/chunk-QJ3JNHO7.js +0 -2
- package/dist/chunk-QNCGRCAX.mjs +0 -2
- package/dist/chunk-SAA7UVI2.js +0 -3
- package/dist/chunk-TI2M7H6R.mjs +0 -7
- package/dist/chunk-TXXWCB5O.js +0 -320
- package/dist/chunk-UGY5ZYUG.js +0 -2
- package/dist/chunk-UO6QPJLH.js +0 -2
- package/dist/chunk-UX6ZZNEM.mjs +0 -3
- package/dist/chunk-XFUEZ3MP.mjs +0 -2
- package/dist/chunk-XHSHPB74.js +0 -2
- package/dist/chunk-YCX6BFOQ.js +0 -2
- package/dist/chunk-YURSF2YO.mjs +0 -2
- package/dist/chunk-YZXUAIYN.js +0 -3
- package/dist/chunk-ZT7KNFAU.mjs +0 -2
package/README.md
CHANGED
|
@@ -5,13 +5,15 @@
|
|
|
5
5
|
[](https://www.npmjs.com/package/@tantainnovative/ndpr-toolkit)
|
|
6
6
|
[](https://www.npmjs.com/package/@tantainnovative/ndpr-toolkit)
|
|
7
7
|
[](https://opensource.org/licenses/MIT)
|
|
8
|
-
[](https://www.typescriptlang.org/)
|
|
9
|
+
[](#)
|
|
10
10
|
[](https://bundlephobia.com/package/@tantainnovative/ndpr-toolkit)
|
|
11
11
|
|
|
12
12
|
v3 ships **zero-config presets**, **pluggable storage adapters**, **compound components**, and a **compliance score engine** — eight production-ready modules covering consent, data subject rights, DPIA, breach notification, privacy policies, lawful basis, cross-border transfers, and ROPA.
|
|
13
13
|
|
|
14
|
-
**[Documentation](https://ndprtoolkit.com.ng)** | **[Live Demos](https://ndprtoolkit.com.ng/ndpr-demos)** | **[npm](https://www.npmjs.com/package/@tantainnovative/ndpr-toolkit)** | **[Blog](https://ndprtoolkit.com.ng/blog)**
|
|
14
|
+
**[Documentation](https://ndprtoolkit.com.ng)** | **[Live Demos](https://ndprtoolkit.com.ng/ndpr-demos)** | **[npm](https://www.npmjs.com/package/@tantainnovative/ndpr-toolkit)** | **[Blog](https://ndprtoolkit.com.ng/blog)** | **[v3.4.0 Release](https://github.com/mr-tanta/ndpr-toolkit/releases/tag/v3.4.0)**
|
|
15
|
+
|
|
16
|
+
> **What's new in 3.4.0:** components now ship styled defaults via a real stylesheet — Tailwind is no longer required. Add `import "@tantainnovative/ndpr-toolkit/styles";` once in your app entry. Plus a new `/server` subpath for RSC-safe pure-logic imports (validators, generators, scoring) with zero React in the import graph. Backward-compatible at the component API level. Full notes on the [release page](https://github.com/mr-tanta/ndpr-toolkit/releases/tag/v3.4.0).
|
|
15
17
|
|
|
16
18
|
<p align="center">
|
|
17
19
|
<img src="public/screenshots/hero.png" alt="NDPA Toolkit — NDPA Compliance Made Beautiful" width="800" />
|
|
@@ -76,7 +78,16 @@ That's it. NDPA-compliant consent with server-side persistence in under 20 lines
|
|
|
76
78
|
pnpm add @tantainnovative/ndpr-toolkit
|
|
77
79
|
```
|
|
78
80
|
|
|
79
|
-
|
|
81
|
+
Add the stylesheet import once in your app entry so components render with default styles:
|
|
82
|
+
|
|
83
|
+
```ts
|
|
84
|
+
// app/layout.tsx (Next.js App Router) or src/main.tsx (Vite/CRA)
|
|
85
|
+
import "@tantainnovative/ndpr-toolkit/styles";
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
The stylesheet is opinionated but token-driven — override any `--ndpr-*` CSS custom property to theme. Skip this import only if you're using `/unstyled` to bring your own design system.
|
|
89
|
+
|
|
90
|
+
Install UI peer dependencies (only needed if you use the higher-level Radix-based components from `/presets`):
|
|
80
91
|
|
|
81
92
|
```bash
|
|
82
93
|
pnpm add @radix-ui/react-switch @radix-ui/react-tabs @radix-ui/react-label @radix-ui/react-slot lucide-react tailwind-merge clsx class-variance-authority
|
|
@@ -137,12 +148,27 @@ import { useConsent } from '@tantainnovative/ndpr-toolkit/hooks';
|
|
|
137
148
|
const { hasConsent, acceptAll, rejectAll, shouldShowBanner } = useConsent({ options });
|
|
138
149
|
```
|
|
139
150
|
|
|
140
|
-
###
|
|
151
|
+
### Server — strictly RSC-safe, zero React
|
|
152
|
+
|
|
153
|
+
The recommended entry for backend and serverless contexts. Pure validators, generators, scoring, locales, and adapters — no React in the import graph. Safe to call from a Next.js Server Component, Edge Function, NestJS controller, or Cloudflare Worker.
|
|
154
|
+
|
|
155
|
+
```ts
|
|
156
|
+
import {
|
|
157
|
+
validateConsent,
|
|
158
|
+
generatePolicyText,
|
|
159
|
+
exportHTML,
|
|
160
|
+
getComplianceScore,
|
|
161
|
+
} from '@tantainnovative/ndpr-toolkit/server';
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
Build-output guard tests assert this entry never carries a `"use client"` directive and never imports `react` — the RSC-safety contract is structurally enforced.
|
|
165
|
+
|
|
166
|
+
### Core — types + utilities + Provider
|
|
141
167
|
|
|
142
|
-
|
|
168
|
+
Adds the `NDPRProvider` React Context on top of `/server`'s pure surface. Use when you want types and validators alongside the provider in the same import.
|
|
143
169
|
|
|
144
170
|
```ts
|
|
145
|
-
import { validateConsent, getComplianceScore } from '@tantainnovative/ndpr-toolkit/core';
|
|
171
|
+
import { NDPRProvider, validateConsent, getComplianceScore } from '@tantainnovative/ndpr-toolkit/core';
|
|
146
172
|
```
|
|
147
173
|
|
|
148
174
|
### Adapters — pluggable storage
|
|
@@ -312,60 +338,76 @@ Every module has an interactive demo. No signup, no setup — try them instantly
|
|
|
312
338
|
|
|
313
339
|
## Styling & Customization
|
|
314
340
|
|
|
315
|
-
|
|
341
|
+
As of 3.4.0, components ship semantic BEM-style class names (`.ndpr-consent-banner`, `.ndpr-form-field__input`, etc.) backed by a real stylesheet. **Tailwind is no longer required** — the package works in any host so long as you import the stylesheet once.
|
|
316
342
|
|
|
317
|
-
**Default
|
|
343
|
+
**Default — works in any host:**
|
|
344
|
+
```ts
|
|
345
|
+
// Once in your app entry
|
|
346
|
+
import "@tantainnovative/ndpr-toolkit/styles";
|
|
347
|
+
```
|
|
318
348
|
```tsx
|
|
319
|
-
<ConsentBanner options={options} onSave={handleSave} />
|
|
349
|
+
<ConsentBanner options={options} onSave={handleSave} variant="card" position="bottom" />
|
|
320
350
|
```
|
|
321
351
|
|
|
322
|
-
**
|
|
323
|
-
```
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
}}
|
|
331
|
-
/>
|
|
352
|
+
**Theme via CSS custom properties:**
|
|
353
|
+
```css
|
|
354
|
+
/* Override any --ndpr-* token at :root, [data-theme="dark"], or scoped to a parent. */
|
|
355
|
+
:root {
|
|
356
|
+
--ndpr-primary: 22 163 74; /* RGB triplet — green-600 */
|
|
357
|
+
--ndpr-radius: 1rem;
|
|
358
|
+
--ndpr-font-sans: "Inter", system-ui, sans-serif;
|
|
359
|
+
}
|
|
332
360
|
```
|
|
333
361
|
|
|
334
|
-
|
|
362
|
+
Light + dark mode auto-switch via `prefers-color-scheme`, plus an explicit opt-in via `data-theme="dark"` or `.dark` on any ancestor.
|
|
363
|
+
|
|
364
|
+
**Per-instance override via slot map:**
|
|
335
365
|
```tsx
|
|
336
366
|
<ConsentBanner
|
|
337
367
|
options={options}
|
|
338
368
|
onSave={handleSave}
|
|
339
|
-
unstyled
|
|
340
369
|
classNames={{
|
|
341
370
|
root: "my-consent-banner",
|
|
342
371
|
acceptButton: "btn btn-primary",
|
|
372
|
+
rejectButton: "btn btn-secondary",
|
|
343
373
|
}}
|
|
344
374
|
/>
|
|
345
375
|
```
|
|
346
376
|
|
|
377
|
+
**Bring your own design system entirely:**
|
|
378
|
+
```tsx
|
|
379
|
+
import { ConsentBanner } from '@tantainnovative/ndpr-toolkit/unstyled';
|
|
380
|
+
|
|
381
|
+
<ConsentBanner options={options} onSave={handleSave} classNames={{ /* yours */ }} />
|
|
382
|
+
```
|
|
383
|
+
The `/unstyled` entry defaults `unstyled` to `true`, stripping every `.ndpr-*` class so your CSS applies unfiltered. ARIA, focus management, and `data-ndpr-component` attributes are preserved (those are part of the contract, not styling).
|
|
384
|
+
|
|
347
385
|
Each component exports its `ClassNames` TypeScript interface for autocomplete. Full reference in the [docs](https://ndprtoolkit.com.ng/docs/guides/styling-customization).
|
|
348
386
|
|
|
349
387
|
---
|
|
350
388
|
|
|
351
389
|
## Available Import Paths
|
|
352
390
|
|
|
353
|
-
| Path | What you get | Dependencies |
|
|
354
|
-
|
|
355
|
-
| `.` (default) | Everything |
|
|
356
|
-
| `/
|
|
357
|
-
| `/
|
|
358
|
-
| `/
|
|
359
|
-
| `/
|
|
360
|
-
| `/
|
|
361
|
-
| `/
|
|
362
|
-
| `/
|
|
363
|
-
| `/
|
|
364
|
-
| `/
|
|
365
|
-
| `/
|
|
366
|
-
| `/
|
|
367
|
-
| `/
|
|
368
|
-
| `/
|
|
391
|
+
| Path | What you get | Dependencies | RSC-safe |
|
|
392
|
+
|------|-------------|--------------|:--------:|
|
|
393
|
+
| `.` (default) | Everything | `react`, optional Radix peers for `/presets` | No |
|
|
394
|
+
| `/server` | **Pure validators, generators, scoring, locales, adapters, types — zero React** | `tslib` | **Yes** |
|
|
395
|
+
| `/core` | Types, utility functions, NDPRProvider | `react`[^core] | Partial |
|
|
396
|
+
| `/hooks` | React hooks for all 8 modules | `react` | No |
|
|
397
|
+
| `/presets` | Zero-config preset components | `react`, Radix peers | No |
|
|
398
|
+
| `/adapters` | Storage adapters (localStorage, sessionStorage, cookie, api, memory, composeAdapters) | none | Yes |
|
|
399
|
+
| `/consent` | ConsentBanner, ConsentManager, `Consent.*` compound API, useConsent | `react` | No |
|
|
400
|
+
| `/dsr` | DSR components + hook | `react` | No |
|
|
401
|
+
| `/dpia` | DPIA components + hook | `react` | No |
|
|
402
|
+
| `/breach` | Breach components + hook | `react` | No |
|
|
403
|
+
| `/policy` | Policy components + hook | `react`, `jspdf`, `docx` (optional) | No |
|
|
404
|
+
| `/lawful-basis` | Lawful basis component + hook | `react` | No |
|
|
405
|
+
| `/cross-border` | Cross-border component + hook | `react` | No |
|
|
406
|
+
| `/ropa` | ROPA component + hook | `react` | No |
|
|
407
|
+
| `/unstyled` | All published components with `unstyled` defaulted to `true` | `react` | No |
|
|
408
|
+
| `/styles` | Default CSS stylesheet — `import "@tantainnovative/ndpr-toolkit/styles"` once in your app entry | none | N/A |
|
|
409
|
+
|
|
410
|
+
[^core]: `/core` re-exports the React `NDPRProvider` for backward compatibility. For strictly server-side imports use `/server` — it carries the same pure validators with no React surface.
|
|
369
411
|
|
|
370
412
|
---
|
|
371
413
|
|
|
@@ -76,6 +76,16 @@ interface ConsentBannerProps {
|
|
|
76
76
|
* @default "bottom"
|
|
77
77
|
*/
|
|
78
78
|
position?: 'top' | 'bottom' | 'center' | 'inline';
|
|
79
|
+
/**
|
|
80
|
+
* Visual treatment.
|
|
81
|
+
* - 'bar' (default): full-width strip pinned to the edge.
|
|
82
|
+
* - 'card' : bounded floating card with rounded corners and a margin
|
|
83
|
+
* from the screen edges. Pairs well with `position="bottom"`.
|
|
84
|
+
* - 'modal' : centered card with a backdrop overlay. Forces center
|
|
85
|
+
* placement regardless of `position`.
|
|
86
|
+
* @default "bar"
|
|
87
|
+
*/
|
|
88
|
+
variant?: 'bar' | 'card' | 'modal';
|
|
79
89
|
/**
|
|
80
90
|
* z-index applied to the fixed-position banner.
|
|
81
91
|
* Ignored when position is 'inline'.
|
|
@@ -76,6 +76,16 @@ interface ConsentBannerProps {
|
|
|
76
76
|
* @default "bottom"
|
|
77
77
|
*/
|
|
78
78
|
position?: 'top' | 'bottom' | 'center' | 'inline';
|
|
79
|
+
/**
|
|
80
|
+
* Visual treatment.
|
|
81
|
+
* - 'bar' (default): full-width strip pinned to the edge.
|
|
82
|
+
* - 'card' : bounded floating card with rounded corners and a margin
|
|
83
|
+
* from the screen edges. Pairs well with `position="bottom"`.
|
|
84
|
+
* - 'modal' : centered card with a backdrop overlay. Forces center
|
|
85
|
+
* placement regardless of `position`.
|
|
86
|
+
* @default "bar"
|
|
87
|
+
*/
|
|
88
|
+
variant?: 'bar' | 'card' | 'modal';
|
|
79
89
|
/**
|
|
80
90
|
* z-index applied to the fixed-position banner.
|
|
81
91
|
* Ignored when position is 'inline'.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React__default from 'react';
|
|
2
|
-
import { C as ConsentOption, a as ConsentSettings
|
|
2
|
+
import { C as ConsentOption, a as ConsentSettings } from './consent-CmVzqZUk.mjs';
|
|
3
3
|
|
|
4
4
|
interface ConsentManagerClassNames {
|
|
5
5
|
root?: string;
|
|
@@ -102,64 +102,4 @@ interface ConsentManagerProps {
|
|
|
102
102
|
*/
|
|
103
103
|
declare const ConsentManager: React__default.FC<ConsentManagerProps>;
|
|
104
104
|
|
|
105
|
-
|
|
106
|
-
root?: string;
|
|
107
|
-
}
|
|
108
|
-
interface ConsentStorageProps {
|
|
109
|
-
/**
|
|
110
|
-
* Current consent settings
|
|
111
|
-
*/
|
|
112
|
-
settings: ConsentSettings;
|
|
113
|
-
/**
|
|
114
|
-
* Storage options for consent settings
|
|
115
|
-
*/
|
|
116
|
-
storageOptions?: ConsentStorageOptions;
|
|
117
|
-
/**
|
|
118
|
-
* Callback function called when settings are loaded from storage
|
|
119
|
-
*/
|
|
120
|
-
onLoad?: (settings: ConsentSettings | null) => void;
|
|
121
|
-
/**
|
|
122
|
-
* Callback function called when settings are saved to storage
|
|
123
|
-
*/
|
|
124
|
-
onSave?: (settings: ConsentSettings) => void;
|
|
125
|
-
/**
|
|
126
|
-
* Whether to automatically save settings to storage
|
|
127
|
-
* @default true
|
|
128
|
-
*/
|
|
129
|
-
autoSave?: boolean;
|
|
130
|
-
/**
|
|
131
|
-
* Whether to automatically load settings from storage on mount
|
|
132
|
-
* @default true
|
|
133
|
-
*/
|
|
134
|
-
autoLoad?: boolean;
|
|
135
|
-
/**
|
|
136
|
-
* Object of CSS class overrides keyed by semantic section name.
|
|
137
|
-
*/
|
|
138
|
-
classNames?: ConsentStorageClassNames;
|
|
139
|
-
/**
|
|
140
|
-
* When true, all default classes are removed so consumers
|
|
141
|
-
* can style from scratch using classNames.
|
|
142
|
-
*/
|
|
143
|
-
unstyled?: boolean;
|
|
144
|
-
/**
|
|
145
|
-
* Children to render
|
|
146
|
-
* Can be either React nodes or a render prop function that receives storage methods
|
|
147
|
-
*/
|
|
148
|
-
children?: React__default.ReactNode | ((props: {
|
|
149
|
-
loadSettings: () => ConsentSettings | null;
|
|
150
|
-
saveSettings: (settings: ConsentSettings) => void;
|
|
151
|
-
clearSettings: () => void;
|
|
152
|
-
loaded: boolean;
|
|
153
|
-
}) => React__default.ReactNode);
|
|
154
|
-
}
|
|
155
|
-
declare const ConsentStorage: ({ settings, storageOptions, onLoad, onSave, autoSave, autoLoad, classNames, unstyled, children }: ConsentStorageProps) => React__default.ReactElement | null;
|
|
156
|
-
|
|
157
|
-
/**
|
|
158
|
-
* Resolves class names for a component section.
|
|
159
|
-
* If unstyled is true, only the override class is used (or empty string).
|
|
160
|
-
* If an override is provided, it fully REPLACES the default — no appending.
|
|
161
|
-
* Otherwise the default class string is returned as-is.
|
|
162
|
-
*/
|
|
163
|
-
declare function resolveClass(defaultClass: string, override?: string, unstyled?: boolean): string;
|
|
164
|
-
|
|
165
|
-
export { ConsentManager as C, type ConsentManagerClassNames as a, ConsentStorage as b, type ConsentStorageClassNames as c, type ConsentManagerProps as d, type ConsentStorageProps as e, resolveClass as r };
|
|
105
|
+
export { ConsentManager as C, type ConsentManagerClassNames as a, type ConsentManagerProps as b };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React__default from 'react';
|
|
2
|
-
import { C as ConsentOption, a as ConsentSettings
|
|
2
|
+
import { C as ConsentOption, a as ConsentSettings } from './consent-CmVzqZUk.js';
|
|
3
3
|
|
|
4
4
|
interface ConsentManagerClassNames {
|
|
5
5
|
root?: string;
|
|
@@ -102,64 +102,4 @@ interface ConsentManagerProps {
|
|
|
102
102
|
*/
|
|
103
103
|
declare const ConsentManager: React__default.FC<ConsentManagerProps>;
|
|
104
104
|
|
|
105
|
-
|
|
106
|
-
root?: string;
|
|
107
|
-
}
|
|
108
|
-
interface ConsentStorageProps {
|
|
109
|
-
/**
|
|
110
|
-
* Current consent settings
|
|
111
|
-
*/
|
|
112
|
-
settings: ConsentSettings;
|
|
113
|
-
/**
|
|
114
|
-
* Storage options for consent settings
|
|
115
|
-
*/
|
|
116
|
-
storageOptions?: ConsentStorageOptions;
|
|
117
|
-
/**
|
|
118
|
-
* Callback function called when settings are loaded from storage
|
|
119
|
-
*/
|
|
120
|
-
onLoad?: (settings: ConsentSettings | null) => void;
|
|
121
|
-
/**
|
|
122
|
-
* Callback function called when settings are saved to storage
|
|
123
|
-
*/
|
|
124
|
-
onSave?: (settings: ConsentSettings) => void;
|
|
125
|
-
/**
|
|
126
|
-
* Whether to automatically save settings to storage
|
|
127
|
-
* @default true
|
|
128
|
-
*/
|
|
129
|
-
autoSave?: boolean;
|
|
130
|
-
/**
|
|
131
|
-
* Whether to automatically load settings from storage on mount
|
|
132
|
-
* @default true
|
|
133
|
-
*/
|
|
134
|
-
autoLoad?: boolean;
|
|
135
|
-
/**
|
|
136
|
-
* Object of CSS class overrides keyed by semantic section name.
|
|
137
|
-
*/
|
|
138
|
-
classNames?: ConsentStorageClassNames;
|
|
139
|
-
/**
|
|
140
|
-
* When true, all default classes are removed so consumers
|
|
141
|
-
* can style from scratch using classNames.
|
|
142
|
-
*/
|
|
143
|
-
unstyled?: boolean;
|
|
144
|
-
/**
|
|
145
|
-
* Children to render
|
|
146
|
-
* Can be either React nodes or a render prop function that receives storage methods
|
|
147
|
-
*/
|
|
148
|
-
children?: React__default.ReactNode | ((props: {
|
|
149
|
-
loadSettings: () => ConsentSettings | null;
|
|
150
|
-
saveSettings: (settings: ConsentSettings) => void;
|
|
151
|
-
clearSettings: () => void;
|
|
152
|
-
loaded: boolean;
|
|
153
|
-
}) => React__default.ReactNode);
|
|
154
|
-
}
|
|
155
|
-
declare const ConsentStorage: ({ settings, storageOptions, onLoad, onSave, autoSave, autoLoad, classNames, unstyled, children }: ConsentStorageProps) => React__default.ReactElement | null;
|
|
156
|
-
|
|
157
|
-
/**
|
|
158
|
-
* Resolves class names for a component section.
|
|
159
|
-
* If unstyled is true, only the override class is used (or empty string).
|
|
160
|
-
* If an override is provided, it fully REPLACES the default — no appending.
|
|
161
|
-
* Otherwise the default class string is returned as-is.
|
|
162
|
-
*/
|
|
163
|
-
declare function resolveClass(defaultClass: string, override?: string, unstyled?: boolean): string;
|
|
164
|
-
|
|
165
|
-
export { ConsentManager as C, type ConsentManagerClassNames as a, ConsentStorage as b, type ConsentStorageClassNames as c, type ConsentManagerProps as d, type ConsentStorageProps as e, resolveClass as r };
|
|
105
|
+
export { ConsentManager as C, type ConsentManagerClassNames as a, type ConsentManagerProps as b };
|
|
@@ -1,90 +1,5 @@
|
|
|
1
1
|
import React__default, { ReactNode, ErrorInfo } from 'react';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Locale strings for all toolkit components.
|
|
5
|
-
* Pass partial overrides — missing keys fall back to English defaults.
|
|
6
|
-
*/
|
|
7
|
-
interface NDPRLocale {
|
|
8
|
-
consent?: {
|
|
9
|
-
title?: string;
|
|
10
|
-
description?: string;
|
|
11
|
-
acceptAll?: string;
|
|
12
|
-
rejectAll?: string;
|
|
13
|
-
customize?: string;
|
|
14
|
-
savePreferences?: string;
|
|
15
|
-
selectAll?: string;
|
|
16
|
-
deselectAll?: string;
|
|
17
|
-
required?: string;
|
|
18
|
-
cookieNotice?: string;
|
|
19
|
-
};
|
|
20
|
-
dsr?: {
|
|
21
|
-
title?: string;
|
|
22
|
-
description?: string;
|
|
23
|
-
submitRequest?: string;
|
|
24
|
-
reset?: string;
|
|
25
|
-
fullName?: string;
|
|
26
|
-
email?: string;
|
|
27
|
-
phone?: string;
|
|
28
|
-
requestType?: string;
|
|
29
|
-
additionalInfo?: string;
|
|
30
|
-
identityVerification?: string;
|
|
31
|
-
identifierType?: string;
|
|
32
|
-
identifierValue?: string;
|
|
33
|
-
privacyNotice?: string;
|
|
34
|
-
successMessage?: string;
|
|
35
|
-
};
|
|
36
|
-
breach?: {
|
|
37
|
-
title?: string;
|
|
38
|
-
description?: string;
|
|
39
|
-
submitReport?: string;
|
|
40
|
-
breachTitle?: string;
|
|
41
|
-
category?: string;
|
|
42
|
-
discoveredAt?: string;
|
|
43
|
-
detailedDescription?: string;
|
|
44
|
-
};
|
|
45
|
-
dpia?: {
|
|
46
|
-
title?: string;
|
|
47
|
-
next?: string;
|
|
48
|
-
previous?: string;
|
|
49
|
-
complete?: string;
|
|
50
|
-
progress?: string;
|
|
51
|
-
};
|
|
52
|
-
policy?: {
|
|
53
|
-
title?: string;
|
|
54
|
-
generate?: string;
|
|
55
|
-
preview?: string;
|
|
56
|
-
export?: string;
|
|
57
|
-
sections?: string;
|
|
58
|
-
variables?: string;
|
|
59
|
-
};
|
|
60
|
-
compliance?: {
|
|
61
|
-
score?: string;
|
|
62
|
-
excellent?: string;
|
|
63
|
-
good?: string;
|
|
64
|
-
needsWork?: string;
|
|
65
|
-
critical?: string;
|
|
66
|
-
recommendations?: string;
|
|
67
|
-
passed?: string;
|
|
68
|
-
gaps?: string;
|
|
69
|
-
};
|
|
70
|
-
common?: {
|
|
71
|
-
loading?: string;
|
|
72
|
-
error?: string;
|
|
73
|
-
save?: string;
|
|
74
|
-
cancel?: string;
|
|
75
|
-
delete?: string;
|
|
76
|
-
edit?: string;
|
|
77
|
-
add?: string;
|
|
78
|
-
back?: string;
|
|
79
|
-
next?: string;
|
|
80
|
-
search?: string;
|
|
81
|
-
noResults?: string;
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
declare const defaultLocale: Required<{
|
|
86
|
-
[K in keyof NDPRLocale]: Required<NonNullable<NDPRLocale[K]>>;
|
|
87
|
-
}>;
|
|
2
|
+
import { N as NDPRLocale, d as defaultLocale } from './sanitize-CxxwKxAx.js';
|
|
88
3
|
|
|
89
4
|
/**
|
|
90
5
|
* Configuration for the NDPR toolkit provider.
|
|
@@ -150,11 +65,4 @@ declare function useNDPRConfig(): NDPRConfig;
|
|
|
150
65
|
*/
|
|
151
66
|
declare function useNDPRLocale(): typeof defaultLocale;
|
|
152
67
|
|
|
153
|
-
|
|
154
|
-
* Sanitizes user input to prevent XSS attacks.
|
|
155
|
-
* Escapes HTML special characters so that data rendered in dashboards
|
|
156
|
-
* or other consumer UIs cannot execute embedded scripts.
|
|
157
|
-
*/
|
|
158
|
-
declare function sanitizeInput(input: string): string;
|
|
159
|
-
|
|
160
|
-
export { type NDPRConfig as N, NDPRProvider as a, type NDPRLocale as b, useNDPRLocale as c, defaultLocale as d, sanitizeInput as s, useNDPRConfig as u };
|
|
68
|
+
export { type NDPRConfig as N, NDPRProvider as a, useNDPRLocale as b, useNDPRConfig as u };
|
|
@@ -1,90 +1,5 @@
|
|
|
1
1
|
import React__default, { ReactNode, ErrorInfo } from 'react';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Locale strings for all toolkit components.
|
|
5
|
-
* Pass partial overrides — missing keys fall back to English defaults.
|
|
6
|
-
*/
|
|
7
|
-
interface NDPRLocale {
|
|
8
|
-
consent?: {
|
|
9
|
-
title?: string;
|
|
10
|
-
description?: string;
|
|
11
|
-
acceptAll?: string;
|
|
12
|
-
rejectAll?: string;
|
|
13
|
-
customize?: string;
|
|
14
|
-
savePreferences?: string;
|
|
15
|
-
selectAll?: string;
|
|
16
|
-
deselectAll?: string;
|
|
17
|
-
required?: string;
|
|
18
|
-
cookieNotice?: string;
|
|
19
|
-
};
|
|
20
|
-
dsr?: {
|
|
21
|
-
title?: string;
|
|
22
|
-
description?: string;
|
|
23
|
-
submitRequest?: string;
|
|
24
|
-
reset?: string;
|
|
25
|
-
fullName?: string;
|
|
26
|
-
email?: string;
|
|
27
|
-
phone?: string;
|
|
28
|
-
requestType?: string;
|
|
29
|
-
additionalInfo?: string;
|
|
30
|
-
identityVerification?: string;
|
|
31
|
-
identifierType?: string;
|
|
32
|
-
identifierValue?: string;
|
|
33
|
-
privacyNotice?: string;
|
|
34
|
-
successMessage?: string;
|
|
35
|
-
};
|
|
36
|
-
breach?: {
|
|
37
|
-
title?: string;
|
|
38
|
-
description?: string;
|
|
39
|
-
submitReport?: string;
|
|
40
|
-
breachTitle?: string;
|
|
41
|
-
category?: string;
|
|
42
|
-
discoveredAt?: string;
|
|
43
|
-
detailedDescription?: string;
|
|
44
|
-
};
|
|
45
|
-
dpia?: {
|
|
46
|
-
title?: string;
|
|
47
|
-
next?: string;
|
|
48
|
-
previous?: string;
|
|
49
|
-
complete?: string;
|
|
50
|
-
progress?: string;
|
|
51
|
-
};
|
|
52
|
-
policy?: {
|
|
53
|
-
title?: string;
|
|
54
|
-
generate?: string;
|
|
55
|
-
preview?: string;
|
|
56
|
-
export?: string;
|
|
57
|
-
sections?: string;
|
|
58
|
-
variables?: string;
|
|
59
|
-
};
|
|
60
|
-
compliance?: {
|
|
61
|
-
score?: string;
|
|
62
|
-
excellent?: string;
|
|
63
|
-
good?: string;
|
|
64
|
-
needsWork?: string;
|
|
65
|
-
critical?: string;
|
|
66
|
-
recommendations?: string;
|
|
67
|
-
passed?: string;
|
|
68
|
-
gaps?: string;
|
|
69
|
-
};
|
|
70
|
-
common?: {
|
|
71
|
-
loading?: string;
|
|
72
|
-
error?: string;
|
|
73
|
-
save?: string;
|
|
74
|
-
cancel?: string;
|
|
75
|
-
delete?: string;
|
|
76
|
-
edit?: string;
|
|
77
|
-
add?: string;
|
|
78
|
-
back?: string;
|
|
79
|
-
next?: string;
|
|
80
|
-
search?: string;
|
|
81
|
-
noResults?: string;
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
declare const defaultLocale: Required<{
|
|
86
|
-
[K in keyof NDPRLocale]: Required<NonNullable<NDPRLocale[K]>>;
|
|
87
|
-
}>;
|
|
2
|
+
import { N as NDPRLocale, d as defaultLocale } from './sanitize-CxxwKxAx.mjs';
|
|
88
3
|
|
|
89
4
|
/**
|
|
90
5
|
* Configuration for the NDPR toolkit provider.
|
|
@@ -150,11 +65,4 @@ declare function useNDPRConfig(): NDPRConfig;
|
|
|
150
65
|
*/
|
|
151
66
|
declare function useNDPRLocale(): typeof defaultLocale;
|
|
152
67
|
|
|
153
|
-
|
|
154
|
-
* Sanitizes user input to prevent XSS attacks.
|
|
155
|
-
* Escapes HTML special characters so that data rendered in dashboards
|
|
156
|
-
* or other consumer UIs cannot execute embedded scripts.
|
|
157
|
-
*/
|
|
158
|
-
declare function sanitizeInput(input: string): string;
|
|
159
|
-
|
|
160
|
-
export { type NDPRConfig as N, NDPRProvider as a, type NDPRLocale as b, useNDPRLocale as c, defaultLocale as d, sanitizeInput as s, useNDPRConfig as u };
|
|
68
|
+
export { type NDPRConfig as N, NDPRProvider as a, useNDPRLocale as b, useNDPRConfig as u };
|
package/dist/adapters.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var chunkJBSCER34_js=require('./chunk-JBSCER34.js'),chunkA4PK7JB2_js=require('./chunk-A4PK7JB2.js'),chunkELKB2AFZ_js=require('./chunk-ELKB2AFZ.js');require('./chunk-MQFZHA2D.js');Object.defineProperty(exports,"apiAdapter",{enumerable:true,get:function(){return chunkJBSCER34_js.a}});Object.defineProperty(exports,"composeAdapters",{enumerable:true,get:function(){return chunkJBSCER34_js.c}});Object.defineProperty(exports,"memoryAdapter",{enumerable:true,get:function(){return chunkJBSCER34_js.b}});Object.defineProperty(exports,"cookieAdapter",{enumerable:true,get:function(){return chunkA4PK7JB2_js.b}});Object.defineProperty(exports,"sessionStorageAdapter",{enumerable:true,get:function(){return chunkA4PK7JB2_js.a}});Object.defineProperty(exports,"localStorageAdapter",{enumerable:true,get:function(){return chunkELKB2AFZ_js.a}});//# sourceMappingURL=adapters.js.map
|
|
2
2
|
//# sourceMappingURL=adapters.js.map
|
package/dist/adapters.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export{b as cookieAdapter,a as sessionStorageAdapter}from'./chunk-R3OYAJI6.mjs';export{a as localStorageAdapter}from'./chunk-6WIP33TW.mjs';import
|
|
1
|
+
export{a as apiAdapter,c as composeAdapters,b as memoryAdapter}from'./chunk-RY3PGVLZ.mjs';export{b as cookieAdapter,a as sessionStorageAdapter}from'./chunk-R3OYAJI6.mjs';export{a as localStorageAdapter}from'./chunk-6WIP33TW.mjs';import'./chunk-WWT2ZSNU.mjs';//# sourceMappingURL=adapters.mjs.map
|
|
2
2
|
//# sourceMappingURL=adapters.mjs.map
|
package/dist/breach.js
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
'use strict';var chunkEHAZIKDX_js=require('./chunk-EHAZIKDX.js'),chunkWTJGLNTB_js=require('./chunk-WTJGLNTB.js'),chunkI4M2AA3N_js=require('./chunk-I4M2AA3N.js'),chunkBKRETVJ6_js=require('./chunk-BKRETVJ6.js');require('./chunk-I54CDQGN.js'),require('./chunk-E64TU6IU.js'),require('./chunk-ELKB2AFZ.js');var chunkMQFZHA2D_js=require('./chunk-MQFZHA2D.js'),react=require('react'),jsxRuntime=require('react/jsx-runtime');var p=react.createContext(null);function P(){let e=react.useContext(p);if(!e)throw new Error("Breach compound components must be wrapped in <Breach.Provider>. Example: <Breach.Provider categories={...}><Breach.ReportForm /></Breach.Provider>");return e}var s=({categories:e,adapter:m,storageKey:h,useLocalStorage:B,initialReports:f,onReport:R,onAssessment:x,onNotification:u,children:d})=>{let y=chunkI4M2AA3N_js.a({categories:e,adapter:m,storageKey:h,useLocalStorage:B,initialReports:f,onReport:R,onAssessment:x,onNotification:u}),l=chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},y),{categories:e});return jsxRuntime.jsx(p.Provider,{value:l,children:d})};var A={Provider:s,ReportForm:chunkWTJGLNTB_js.a,RiskAssessment:chunkEHAZIKDX_js.a,NotificationManager:chunkEHAZIKDX_js.b,ReportGenerator:chunkEHAZIKDX_js.c};Object.defineProperty(exports,"BreachNotificationManager",{enumerable:true,get:function(){return chunkEHAZIKDX_js.b}});Object.defineProperty(exports,"BreachRiskAssessment",{enumerable:true,get:function(){return chunkEHAZIKDX_js.a}});Object.defineProperty(exports,"RegulatoryReportGenerator",{enumerable:true,get:function(){return chunkEHAZIKDX_js.c}});Object.defineProperty(exports,"BreachReportForm",{enumerable:true,get:function(){return chunkWTJGLNTB_js.a}});Object.defineProperty(exports,"useBreach",{enumerable:true,get:function(){return chunkI4M2AA3N_js.a}});Object.defineProperty(exports,"calculateBreachSeverity",{enumerable:true,get:function(){return chunkBKRETVJ6_js.a}});exports.Breach=A;exports.BreachProvider=s;exports.useBreachCompound=P;//# sourceMappingURL=breach.js.map
|
|
2
3
|
//# sourceMappingURL=breach.js.map
|
package/dist/breach.mjs
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
import {c,b,a}from'./chunk-WH6ZMUOS.mjs';export{b as BreachNotificationManager,a as BreachRiskAssessment,c as RegulatoryReportGenerator}from'./chunk-WH6ZMUOS.mjs';import {a as a$1}from'./chunk-KF3EFJEF.mjs';export{a as BreachReportForm}from'./chunk-KF3EFJEF.mjs';import {a as a$2}from'./chunk-PATONNTZ.mjs';export{a as useBreach}from'./chunk-PATONNTZ.mjs';export{a as calculateBreachSeverity}from'./chunk-DJGS7SSN.mjs';import'./chunk-GKKAK6ES.mjs';import'./chunk-AYKLAEOU.mjs';import'./chunk-6WIP33TW.mjs';import {b as b$1,a as a$3}from'./chunk-WWT2ZSNU.mjs';import {createContext,useContext}from'react';import {jsx}from'react/jsx-runtime';var p=createContext(null);function P(){let e=useContext(p);if(!e)throw new Error("Breach compound components must be wrapped in <Breach.Provider>. Example: <Breach.Provider categories={...}><Breach.ReportForm /></Breach.Provider>");return e}var s=({categories:e,adapter:m,storageKey:h,useLocalStorage:B,initialReports:f,onReport:R,onAssessment:x,onNotification:u,children:d})=>{let y=a$2({categories:e,adapter:m,storageKey:h,useLocalStorage:B,initialReports:f,onReport:R,onAssessment:x,onNotification:u}),l=b$1(a$3({},y),{categories:e});return jsx(p.Provider,{value:l,children:d})};var A={Provider:s,ReportForm:a$1,RiskAssessment:a,NotificationManager:b,ReportGenerator:c};export{A as Breach,s as BreachProvider,P as useBreachCompound};//# sourceMappingURL=breach.mjs.map
|
|
2
3
|
//# sourceMappingURL=breach.mjs.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import {b as b$1,e}from'./chunk-LSCMXAPY.mjs';import {a as a$1}from'./chunk-6WIP33TW.mjs';import {b,a}from'./chunk-WWT2ZSNU.mjs';import {useRef,useState,useEffect,useCallback}from'react';function H(e,s){return s?a$1(e):{load:()=>null,save:()=>{},remove:()=>{}}}function N({templates:e,initialPolicy:s,adapter:P,storageKey:l="ndpr_privacy_policy",useLocalStorage:m=true,onGenerate:T}){let w=P!=null?P:H(l,m),c=useRef(w);c.current=w;let[r,f]=useState(s||null),[o,p]=useState(null),[y,E]=useState({name:"",website:"",privacyEmail:"",address:"",privacyPhone:"",dpoName:"",dpoEmail:"",industry:""}),[A,O]=useState(true),D=useRef(e);D.current=e,useEffect(()=>{if(s){O(false);return}let t=false;try{let n=c.current.load(),i=a=>{if(a){if(f(a),a.templateId){let g=D.current.find(b=>b.id===a.templateId);g&&p(g);}a.organizationInfo&&E(a.organizationInfo);}O(!1);};n instanceof Promise?n.then(a=>{t||i(a);},()=>{t||O(!1);}):i(n);}catch(n){t||O(false);}return ()=>{t=true;}},[s]);let q=t=>{Promise.resolve(c.current.save(t)).catch(n=>{console.warn("[ndpr-toolkit] Failed to save policy:",n);});},_=useCallback(t=>{let n=e.find(b=>b.id===t);if(!n)return false;p(n);let i=n.sections.map(b$1=>b(a({},b$1),{customContent:void 0})),a$1={};Object.keys(n.variables).forEach(b=>{a$1[b]=n.variables[b].defaultValue||"";});let g=Date.now();return f({id:"policy_"+g+"_"+Math.random().toString(36).substr(2,9),title:"",templateId:n.id,organizationInfo:y,sections:i,variableValues:a$1,effectiveDate:g,lastUpdated:g,version:"1.0"}),true},[e,y]),C=useCallback(t=>{E(n=>a(a({},n),t));},[]),k=useCallback((t,n)=>{o&&(r?f(i=>i&&b(a({},i),{sections:i.sections.map(a$1=>a$1.id===t?b(a({},a$1),{included:n}):a$1)})):p(i=>i&&b(a({},i),{sections:i.sections.map(a$1=>a$1.id===t?b(a({},a$1),{included:n}):a$1)})));},[o,r]),j=useCallback((t,n)=>{o&&(r?f(i=>i&&b(a({},i),{sections:i.sections.map(a$1=>a$1.id===t?b(a({},a$1),{customContent:n}):a$1)})):p(i=>i&&b(a({},i),{sections:i.sections.map(a$1=>a$1.id===t?b(a({},a$1),{customContent:n}):a$1)})));},[o,r]),I=useCallback((t,n)=>{r&&f(i=>i&&b(a({},i),{variableValues:b(a({},i.variableValues),{[t]:n})}));},[r]),F=()=>"policy_"+Date.now()+"_"+Math.random().toString(36).substr(2,9),M=useCallback(()=>{if(!o)return null;let t=Date.now(),n={id:(r==null?void 0:r.id)||F(),title:`Privacy Policy for ${y.name}`,templateId:o.id,organizationInfo:y,sections:o.sections.map(i=>{var a$1;return b(a({},i),{customContent:(a$1=r==null?void 0:r.sections.find(g=>g.id===i.id))==null?void 0:a$1.customContent})}),variableValues:(r==null?void 0:r.variableValues)||{},effectiveDate:t,lastUpdated:t,version:"1.0"};return f(n),q(n),T&&T(n),n},[o,r,y,T]),$=useCallback(()=>{if(!r)return {fullText:"",sectionTexts:{},missingVariables:[]};let t=b$1(r.sections,r.organizationInfo);return typeof t=="string"?{fullText:t,sectionTexts:{full:t},missingVariables:[]}:t},[r]),B=useCallback(()=>{f(null),p(null),E({name:"",website:"",privacyEmail:"",address:"",privacyPhone:"",dpoName:"",dpoEmail:"",industry:""}),Promise.resolve(c.current.remove()).catch(t=>{console.warn("[ndpr-toolkit] Failed to remove policy:",t);});},[]),G=useCallback(()=>{let t=[];if(o||t.push("No template selected"),y.name||t.push("Organization name is required"),y.website||t.push("Organization website is required"),y.privacyEmail||t.push("Privacy contact email is required"),o){let n=o.sections.filter(a=>a.required),i=(r==null?void 0:r.sections.filter(a=>a.included))||[];n.forEach(a=>{i.some(g=>g.id===a.id)||t.push(`Required section "${a.title}" must be included`);});}return o&&r&&Object.entries(o.variables).forEach(([n,i])=>{i.required&&!r.variableValues[n]&&t.push(`Required variable "${i.name}" must have a value`);}),{valid:t.length===0,errors:t}},[o,y,r]);return {policy:r,selectedTemplate:o,organizationInfo:y,selectTemplate:_,updateOrganizationInfo:C,toggleSection:k,updateSectionContent:j,updateVariableValue:I,generatePolicy:M,getPolicyText:$,resetPolicy:B,isValid:G,isLoading:A}}var x="default-business";function J(e){return e.toLocaleDateString("en-NG",{day:"numeric",month:"long",year:"numeric"})}function Q(e$1){let{sections:s,variables:P}=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=J(new Date)),{id:x,name:"Default Business Policy",description:"NDPA-compliant privacy policy template for businesses.",organizationType:"business",sections:s,variables:Object.fromEntries(P.map(m=>[m.name,{name:m.name,description:m.description,required:m.required,defaultValue:l[m.name]||m.value||void 0}])),version:"1.0",lastUpdated:Date.now(),ndpaCompliant:true}}function W(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 se(e={}){let{orgInfo:s,autoGenerate:P=true,storageKey:l,useLocalStorage:m,adapter:T}=e,w=useRef(null);w.current===null&&(w.current=Q(s));let c=N({templates:[w.current],adapter:T,storageKey:l,useLocalStorage:m}),r=useRef(false),f=useRef(false);return useEffect(()=>{if(!P||c.isLoading||r.current)return;if(!T&&m!==false&&typeof window!="undefined"&&typeof window.localStorage!="undefined")try{if(window.localStorage.getItem(l!=null?l:"ndpr_privacy_policy")){r.current=!0,f.current=!0;return}}catch(y){}if(c.policy){r.current=true,f.current=true;return}r.current=true;let p=W(s);Object.keys(p).length>0&&c.updateOrganizationInfo(p),c.selectedTemplate||c.selectTemplate(x);},[P,c.isLoading]),useEffect(()=>{var p;if(!P||f.current||!r.current||!c.selectedTemplate)return;let o=(p=s==null?void 0:s.name)!=null?p:"";o&&c.organizationInfo.name!==o||(f.current=true,c.generatePolicy());},[P,c.selectedTemplate,c.organizationInfo]),c}export{N as a,se as b};//# sourceMappingURL=chunk-2L7BSG7G.mjs.map
|
|
2
|
+
//# sourceMappingURL=chunk-2L7BSG7G.mjs.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
'use strict';var chunkE64TU6IU_js=require('./chunk-E64TU6IU.js'),react=require('react'),jsxRuntime=require('react/jsx-runtime');var G=({settings:k,storageOptions:O={},onLoad:i,onSave:p,autoSave:v=true,autoLoad:w=true,classNames:u,unstyled:h,children:c})=>{let{storageKey:o="ndpr_consent",storageType:n="localStorage",cookieOptions:l={}}=O,[r,$]=react.useState(false),S=react.useCallback(()=>{let e=null;try{if(n==="localStorage"&&typeof window!="undefined"){let t=localStorage.getItem(o);t&&(e=JSON.parse(t));}else if(n==="sessionStorage"&&typeof window!="undefined"){let t=sessionStorage.getItem(o);t&&(e=JSON.parse(t));}else if(n==="cookie"&&typeof document!="undefined"){let s=document.cookie.split(";").find(a=>a.trim().startsWith(`${o}=`));if(s){let a=s.split("=")[1];e=JSON.parse(decodeURIComponent(a));}}$(!0),i&&i(e);}catch(t){console.error("[ndpr-toolkit] Error loading consent settings:",t),$(true),i&&i(null);}return e},[n,o,i]),m=react.useCallback(e=>{try{let t=JSON.stringify(e);if(n==="localStorage"&&typeof window!="undefined")localStorage.setItem(o,t);else if(n==="sessionStorage"&&typeof window!="undefined")sessionStorage.setItem(o,t);else if(n==="cookie"&&typeof document!="undefined"){let{domain:s,path:a="/",expires:N=365,secure:D=!0,sameSite:E="Lax"}=l,C=new Date;C.setDate(C.getDate()+N);let g=`${o}=${encodeURIComponent(t)}; path=${a}; expires=${C.toUTCString()}`;s&&(g+=`; domain=${s}`),D&&(g+="; secure"),g+=`; samesite=${E}`,document.cookie=g;}return p&&p(e),!0}catch(t){return console.error("[ndpr-toolkit] Error saving consent settings:",t),false}},[n,o,l,p]),x=react.useCallback(()=>{try{if(n==="localStorage"&&typeof window!="undefined")localStorage.removeItem(o);else if(n==="sessionStorage"&&typeof window!="undefined")sessionStorage.removeItem(o);else if(n==="cookie"&&typeof document!="undefined"){let{domain:e,path:t="/"}=l,s=`${o}=; path=${t}; expires=Thu, 01 Jan 1970 00:00:00 GMT`;e&&(s+=`; domain=${e}`),document.cookie=s;}return !0}catch(e){return console.error("[ndpr-toolkit] Error clearing consent settings:",e),false}},[n,o,l]);react.useEffect(()=>{w&&!r&&S();},[w,r,S]),react.useEffect(()=>{v&&r&&m(k);},[k,v,r,m]);let d=chunkE64TU6IU_js.a("",u==null?void 0:u.root,h);if(typeof c=="function"){let e=c({loadSettings:S,saveSettings:m,clearSettings:x,loaded:r});return d?jsxRuntime.jsx("div",{className:d,children:e}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:e})}return d?jsxRuntime.jsx("div",{className:d,children:c}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:c})};exports.a=G;//# sourceMappingURL=chunk-3NQQSU4P.js.map
|
|
2
|
+
//# sourceMappingURL=chunk-3NQQSU4P.js.map
|