@tantainnovative/ndpr-toolkit 3.3.0 → 3.4.0

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.
Files changed (176) hide show
  1. package/CHANGELOG.md +529 -0
  2. package/README.md +4 -4
  3. package/dist/{ConsentBanner-CDRT0o2k.d.mts → ConsentBanner-F5ayys5K.d.mts} +10 -0
  4. package/dist/{ConsentBanner-Vxyt8SCX.d.ts → ConsentBanner-VqIPophc.d.ts} +10 -0
  5. package/dist/{styling-B7CBzYG7.d.ts → ConsentManager-C7I3PDe8.d.mts} +2 -62
  6. package/dist/{styling-uJLsBbER.d.mts → ConsentManager-CQ2IZtUU.d.ts} +2 -62
  7. package/dist/{sanitize-B0AzEm1D.d.mts → NDPRProvider-DYFb8xEl.d.ts} +2 -94
  8. package/dist/{sanitize-B0AzEm1D.d.ts → NDPRProvider-U3QNu6MA.d.mts} +2 -94
  9. package/dist/adapters.js +1 -1
  10. package/dist/adapters.mjs +1 -1
  11. package/dist/breach.js +1 -1
  12. package/dist/breach.mjs +1 -1
  13. package/dist/chunk-2AW7KAZO.mjs +2 -0
  14. package/dist/chunk-2WH4DLV5.js +3 -0
  15. package/dist/chunk-3NQQSU4P.js +2 -0
  16. package/dist/chunk-3VQAYQR7.js +7 -0
  17. package/dist/chunk-4R42ZNO7.mjs +318 -0
  18. package/dist/chunk-5HL4UBFV.js +2 -0
  19. package/dist/chunk-6FGCGLH5.mjs +2 -0
  20. package/dist/chunk-6HZL2WDU.mjs +2 -0
  21. package/dist/chunk-6QPRDQZF.js +2 -0
  22. package/dist/chunk-74Z23WUA.mjs +2 -0
  23. package/dist/chunk-AHSMDPG5.js +132 -0
  24. package/dist/chunk-BN77GP4W.mjs +2 -0
  25. package/dist/chunk-C5QO3SX4.js +2 -0
  26. package/dist/chunk-CISJAQ6W.mjs +2 -0
  27. package/dist/chunk-DCJK5OZT.mjs +2 -0
  28. package/dist/chunk-DUY6F3GT.mjs +94 -0
  29. package/dist/chunk-EHAZIKDX.js +81 -0
  30. package/dist/chunk-EPT2K355.mjs +2 -0
  31. package/dist/chunk-HGGLW5TE.js +2 -0
  32. package/dist/chunk-HQSU7LGM.js +94 -0
  33. package/dist/chunk-IZCWCE7W.mjs +2 -0
  34. package/dist/chunk-JBSCER34.js +2 -0
  35. package/dist/chunk-KF3EFJEF.mjs +3 -0
  36. package/dist/chunk-KSERBMXW.mjs +4 -0
  37. package/dist/chunk-LJNNPAFU.mjs +2 -0
  38. package/dist/{chunk-UXMGBIX6.js → chunk-LSCMXAPY.mjs} +4 -4
  39. package/dist/chunk-LSNL4XR5.js +2 -0
  40. package/dist/chunk-M2TPT5GB.js +2 -0
  41. package/dist/chunk-MCWV7S2G.js +2 -0
  42. package/dist/chunk-MG73MOZC.mjs +15 -0
  43. package/dist/chunk-NCOZB2WU.mjs +2 -0
  44. package/dist/chunk-NQNFS3QI.js +7 -0
  45. package/dist/chunk-OPYQIJKY.js +2 -0
  46. package/dist/{chunk-ZEOQYWOE.mjs → chunk-P2YV6DR3.js} +4 -4
  47. package/dist/chunk-P6QAFBCV.js +2 -0
  48. package/dist/chunk-QVULSG6J.mjs +3 -0
  49. package/dist/chunk-R5FW5XUQ.mjs +2 -0
  50. package/dist/chunk-RGNP45VR.js +2 -0
  51. package/dist/chunk-RLYTX3MM.js +2 -0
  52. package/dist/chunk-RNTNHVKZ.js +15 -0
  53. package/dist/chunk-RRVKUCFR.mjs +2 -0
  54. package/dist/chunk-RXL6CZAI.js +2 -0
  55. package/dist/chunk-RY3PGVLZ.mjs +2 -0
  56. package/dist/chunk-SUEGUY35.js +2 -0
  57. package/dist/chunk-SYMQJO2W.mjs +7 -0
  58. package/dist/chunk-TCN22KYP.mjs +7 -0
  59. package/dist/chunk-UFPSUO52.js +318 -0
  60. package/dist/chunk-VTITKWGX.mjs +2 -0
  61. package/dist/chunk-WH6ZMUOS.mjs +81 -0
  62. package/dist/chunk-WTJGLNTB.js +3 -0
  63. package/dist/chunk-XHROISIF.mjs +2 -0
  64. package/dist/chunk-XMBSJJ5U.js +4 -0
  65. package/dist/chunk-XSEZDQLB.js +2 -0
  66. package/dist/chunk-Z6IIMLZU.mjs +2 -0
  67. package/dist/chunk-ZLSWOFAY.mjs +132 -0
  68. package/dist/chunk-ZPKVLTSX.js +2 -0
  69. package/dist/consent.d.mts +6 -4
  70. package/dist/consent.d.ts +6 -4
  71. package/dist/consent.js +1 -1
  72. package/dist/consent.mjs +1 -1
  73. package/dist/core.d.mts +6 -25
  74. package/dist/core.d.ts +6 -25
  75. package/dist/core.js +1 -1
  76. package/dist/core.mjs +1 -1
  77. package/dist/cross-border.d.mts +2 -2
  78. package/dist/cross-border.d.ts +2 -2
  79. package/dist/cross-border.js +1 -1
  80. package/dist/cross-border.mjs +1 -1
  81. package/dist/docx-BxKascXN.d.ts +64 -0
  82. package/dist/docx-CV7Vsry_.d.mts +64 -0
  83. package/dist/dpia.js +1 -1
  84. package/dist/dpia.mjs +1 -1
  85. package/dist/dsr.js +1 -1
  86. package/dist/dsr.mjs +1 -1
  87. package/dist/hooks.d.mts +4 -4
  88. package/dist/hooks.d.ts +4 -4
  89. package/dist/hooks.js +1 -1
  90. package/dist/hooks.mjs +1 -1
  91. package/dist/index.d.mts +8 -6
  92. package/dist/index.d.ts +8 -6
  93. package/dist/index.js +1 -1
  94. package/dist/index.mjs +1 -1
  95. package/dist/lawful-basis.js +1 -1
  96. package/dist/lawful-basis.mjs +1 -1
  97. package/dist/locale-CxJx2tzn.d.mts +25 -0
  98. package/dist/locale-DSkrtf-c.d.ts +25 -0
  99. package/dist/{policy-engine-C6nC2t3a.d.ts → policy-engine-CCUCud2T.d.ts} +1 -1
  100. package/dist/{policy-engine-DefZcX3R.d.mts → policy-engine-fYSqEqSW.d.mts} +1 -1
  101. package/dist/{policy-sections-DFDPVCCg.d.ts → policy-sections-BYx6fEFk.d.ts} +4 -2
  102. package/dist/{policy-sections-Bylm31kZ.d.mts → policy-sections-Dm97Nq8m.d.mts} +4 -2
  103. package/dist/{policy-templates-CIKcV0i1.d.ts → policy-templates-DhLwq4R-.d.ts} +8 -1
  104. package/dist/{policy-templates-DMsPwOSZ.d.mts → policy-templates-DwYl2329.d.mts} +8 -1
  105. package/dist/policy.d.mts +36 -71
  106. package/dist/policy.d.ts +36 -71
  107. package/dist/policy.js +1 -1
  108. package/dist/policy.mjs +1 -1
  109. package/dist/presets.d.mts +2 -2
  110. package/dist/presets.d.ts +2 -2
  111. package/dist/presets.js +1 -1
  112. package/dist/presets.mjs +1 -1
  113. package/dist/ropa.js +1 -1
  114. package/dist/ropa.mjs +1 -1
  115. package/dist/sanitize-CxxwKxAx.d.mts +94 -0
  116. package/dist/sanitize-CxxwKxAx.d.ts +94 -0
  117. package/dist/server.d.mts +24 -0
  118. package/dist/server.d.ts +24 -0
  119. package/dist/server.js +2 -0
  120. package/dist/server.mjs +2 -0
  121. package/dist/styles.css +1423 -31
  122. package/dist/styling-BMDGQDgS.d.mts +64 -0
  123. package/dist/styling-BaoQtV06.d.ts +64 -0
  124. package/dist/unstyled.d.mts +52 -19
  125. package/dist/unstyled.d.ts +52 -19
  126. package/dist/unstyled.js +1 -1
  127. package/dist/unstyled.mjs +1 -1
  128. package/dist/{useAdaptivePolicyWizard-A1PyOy6P.d.mts → useAdaptivePolicyWizard-BnjW4OR4.d.mts} +1 -1
  129. package/dist/{useAdaptivePolicyWizard-LVIKhAxw.d.ts → useAdaptivePolicyWizard-sb3m4-Zk.d.ts} +1 -1
  130. package/dist/{useCrossBorderTransfer-BGNZt2lk.d.mts → useCrossBorderTransfer-DixjLjN1.d.mts} +1 -1
  131. package/dist/{useCrossBorderTransfer-COqjgjsu.d.ts → useCrossBorderTransfer-DvSq06lv.d.ts} +1 -1
  132. package/dist/{useDefaultPrivacyPolicy-BsYttRey.d.mts → useDefaultPrivacyPolicy-Cs2WQSYQ.d.mts} +34 -9
  133. package/dist/{useDefaultPrivacyPolicy-C-mG-A5S.d.ts → useDefaultPrivacyPolicy-DkOqMg2e.d.ts} +34 -9
  134. package/package.json +20 -6
  135. package/dist/chunk-256APOQM.js +0 -2
  136. package/dist/chunk-25OOUES4.js +0 -2
  137. package/dist/chunk-4JKTIR33.mjs +0 -2
  138. package/dist/chunk-5BUS6AI7.js +0 -2
  139. package/dist/chunk-6BXUVS6E.js +0 -81
  140. package/dist/chunk-6JCRDJQI.mjs +0 -2
  141. package/dist/chunk-6RQGQZT2.js +0 -2
  142. package/dist/chunk-6YN73KR7.mjs +0 -2
  143. package/dist/chunk-CDZDT2OS.mjs +0 -320
  144. package/dist/chunk-CSIJCLGZ.mjs +0 -2
  145. package/dist/chunk-CWUPGY3M.mjs +0 -3
  146. package/dist/chunk-E63VPR7U.js +0 -2
  147. package/dist/chunk-FDDI426Y.mjs +0 -2
  148. package/dist/chunk-GCQRHMTQ.mjs +0 -144
  149. package/dist/chunk-GMLCWGNJ.js +0 -7
  150. package/dist/chunk-GQVNLUP2.js +0 -94
  151. package/dist/chunk-GXLSOZCH.mjs +0 -2
  152. package/dist/chunk-IQJO7WIH.js +0 -7
  153. package/dist/chunk-LETEUS5X.mjs +0 -2
  154. package/dist/chunk-LU4PFST7.js +0 -144
  155. package/dist/chunk-M6XETYNL.js +0 -2
  156. package/dist/chunk-NBSVFQ5G.js +0 -2
  157. package/dist/chunk-NUDVUAD4.mjs +0 -81
  158. package/dist/chunk-NUULHXVL.mjs +0 -7
  159. package/dist/chunk-PM7O5IGE.mjs +0 -2
  160. package/dist/chunk-Q7VHB64E.mjs +0 -2
  161. package/dist/chunk-QDHHD2KR.mjs +0 -94
  162. package/dist/chunk-SAA7UVI2.js +0 -3
  163. package/dist/chunk-TI2M7H6R.mjs +0 -7
  164. package/dist/chunk-TKVJ3OOV.mjs +0 -2
  165. package/dist/chunk-TXXWCB5O.js +0 -320
  166. package/dist/chunk-UGY5ZYUG.js +0 -2
  167. package/dist/chunk-UO6QPJLH.js +0 -2
  168. package/dist/chunk-UX6ZZNEM.mjs +0 -3
  169. package/dist/chunk-VLSGE2YA.js +0 -2
  170. package/dist/chunk-XFUEZ3MP.mjs +0 -2
  171. package/dist/chunk-XHSHPB74.js +0 -2
  172. package/dist/chunk-YCX6BFOQ.js +0 -2
  173. package/dist/chunk-YURSF2YO.mjs +0 -2
  174. package/dist/chunk-YZXUAIYN.js +0 -3
  175. package/dist/chunk-ZGJA7OO4.js +0 -2
  176. package/dist/chunk-ZT7KNFAU.mjs +0 -2
@@ -0,0 +1,64 @@
1
+ import React__default from 'react';
2
+ import { a as ConsentSettings, b as ConsentStorageOptions } from './consent-CmVzqZUk.mjs';
3
+
4
+ interface ConsentStorageClassNames {
5
+ root?: string;
6
+ }
7
+ interface ConsentStorageProps {
8
+ /**
9
+ * Current consent settings
10
+ */
11
+ settings: ConsentSettings;
12
+ /**
13
+ * Storage options for consent settings
14
+ */
15
+ storageOptions?: ConsentStorageOptions;
16
+ /**
17
+ * Callback function called when settings are loaded from storage
18
+ */
19
+ onLoad?: (settings: ConsentSettings | null) => void;
20
+ /**
21
+ * Callback function called when settings are saved to storage
22
+ */
23
+ onSave?: (settings: ConsentSettings) => void;
24
+ /**
25
+ * Whether to automatically save settings to storage
26
+ * @default true
27
+ */
28
+ autoSave?: boolean;
29
+ /**
30
+ * Whether to automatically load settings from storage on mount
31
+ * @default true
32
+ */
33
+ autoLoad?: boolean;
34
+ /**
35
+ * Object of CSS class overrides keyed by semantic section name.
36
+ */
37
+ classNames?: ConsentStorageClassNames;
38
+ /**
39
+ * When true, all default classes are removed so consumers
40
+ * can style from scratch using classNames.
41
+ */
42
+ unstyled?: boolean;
43
+ /**
44
+ * Children to render
45
+ * Can be either React nodes or a render prop function that receives storage methods
46
+ */
47
+ children?: React__default.ReactNode | ((props: {
48
+ loadSettings: () => ConsentSettings | null;
49
+ saveSettings: (settings: ConsentSettings) => void;
50
+ clearSettings: () => void;
51
+ loaded: boolean;
52
+ }) => React__default.ReactNode);
53
+ }
54
+ declare const ConsentStorage: ({ settings, storageOptions, onLoad, onSave, autoSave, autoLoad, classNames, unstyled, children }: ConsentStorageProps) => React__default.ReactElement | null;
55
+
56
+ /**
57
+ * Resolves class names for a component section.
58
+ * If unstyled is true, only the override class is used (or empty string).
59
+ * If an override is provided, it fully REPLACES the default — no appending.
60
+ * Otherwise the default class string is returned as-is.
61
+ */
62
+ declare function resolveClass(defaultClass: string, override?: string, unstyled?: boolean): string;
63
+
64
+ export { ConsentStorage as C, type ConsentStorageClassNames as a, type ConsentStorageProps as b, resolveClass as r };
@@ -0,0 +1,64 @@
1
+ import React__default from 'react';
2
+ import { a as ConsentSettings, b as ConsentStorageOptions } from './consent-CmVzqZUk.js';
3
+
4
+ interface ConsentStorageClassNames {
5
+ root?: string;
6
+ }
7
+ interface ConsentStorageProps {
8
+ /**
9
+ * Current consent settings
10
+ */
11
+ settings: ConsentSettings;
12
+ /**
13
+ * Storage options for consent settings
14
+ */
15
+ storageOptions?: ConsentStorageOptions;
16
+ /**
17
+ * Callback function called when settings are loaded from storage
18
+ */
19
+ onLoad?: (settings: ConsentSettings | null) => void;
20
+ /**
21
+ * Callback function called when settings are saved to storage
22
+ */
23
+ onSave?: (settings: ConsentSettings) => void;
24
+ /**
25
+ * Whether to automatically save settings to storage
26
+ * @default true
27
+ */
28
+ autoSave?: boolean;
29
+ /**
30
+ * Whether to automatically load settings from storage on mount
31
+ * @default true
32
+ */
33
+ autoLoad?: boolean;
34
+ /**
35
+ * Object of CSS class overrides keyed by semantic section name.
36
+ */
37
+ classNames?: ConsentStorageClassNames;
38
+ /**
39
+ * When true, all default classes are removed so consumers
40
+ * can style from scratch using classNames.
41
+ */
42
+ unstyled?: boolean;
43
+ /**
44
+ * Children to render
45
+ * Can be either React nodes or a render prop function that receives storage methods
46
+ */
47
+ children?: React__default.ReactNode | ((props: {
48
+ loadSettings: () => ConsentSettings | null;
49
+ saveSettings: (settings: ConsentSettings) => void;
50
+ clearSettings: () => void;
51
+ loaded: boolean;
52
+ }) => React__default.ReactNode);
53
+ }
54
+ declare const ConsentStorage: ({ settings, storageOptions, onLoad, onSave, autoSave, autoLoad, classNames, unstyled, children }: ConsentStorageProps) => React__default.ReactElement | null;
55
+
56
+ /**
57
+ * Resolves class names for a component section.
58
+ * If unstyled is true, only the override class is used (or empty string).
59
+ * If an override is provided, it fully REPLACES the default — no appending.
60
+ * Otherwise the default class string is returned as-is.
61
+ */
62
+ declare function resolveClass(defaultClass: string, override?: string, unstyled?: boolean): string;
63
+
64
+ export { ConsentStorage as C, type ConsentStorageClassNames as a, type ConsentStorageProps as b, resolveClass as r };
@@ -1,22 +1,55 @@
1
- import React__default, { ReactNode } from 'react';
1
+ import React__default from 'react';
2
+ import { c as ConsentBannerProps } from './ConsentBanner-F5ayys5K.mjs';
3
+ export { C as ConsentAnalyticsEvent, b as ConsentBannerClassNames } from './ConsentBanner-F5ayys5K.mjs';
4
+ import { b as ConsentManagerProps } from './ConsentManager-C7I3PDe8.mjs';
5
+ export { a as ConsentManagerClassNames } from './ConsentManager-C7I3PDe8.mjs';
6
+ import { c as DSRRequestFormProps } from './DSRRequestForm-DRouEr9j.mjs';
7
+ export { b as DSRRequestFormClassNames } from './DSRRequestForm-DRouEr9j.mjs';
8
+ import './consent-CmVzqZUk.mjs';
9
+ import './dsr-yKbqX531.mjs';
2
10
 
3
- interface UnstyledConsentBannerProps {
4
- className?: string;
5
- children?: ReactNode;
6
- }
7
- declare const UnstyledConsentBanner: React__default.FC<UnstyledConsentBannerProps>;
11
+ /**
12
+ * Unstyled entry — design-system-friendly component variants.
13
+ *
14
+ * Components imported from this subpath default `unstyled` to `true`,
15
+ * which strips every default class name from the rendered markup.
16
+ * Consumers using their own design system (Tailwind, Mantine, Chakra,
17
+ * shadcn, raw CSS) get logic + accessibility + semantic structure
18
+ * without any pre-applied visual styling.
19
+ *
20
+ * Markup, ARIA attributes, focus management, keyboard handling, and the
21
+ * `data-ndpr-component` data attributes are all preserved — those are
22
+ * part of the contract, not styling.
23
+ *
24
+ * @example
25
+ * ```tsx
26
+ * // app/cookie-banner.tsx
27
+ * import { ConsentBanner } from '@tantainnovative/ndpr-toolkit/unstyled';
28
+ *
29
+ * export function CookieBanner() {
30
+ * return (
31
+ * <ConsentBanner
32
+ * options={[]}
33
+ * onSave={() => {}}
34
+ * classNames={{
35
+ * root: 'fixed bottom-0 inset-x-0 bg-white p-6 shadow-2xl',
36
+ * title: 'text-xl font-bold mb-2',
37
+ * buttonGroup: 'flex gap-2 mt-4',
38
+ * acceptButton: 'btn-primary',
39
+ * rejectButton: 'btn-secondary',
40
+ * }}
41
+ * />
42
+ * );
43
+ * }
44
+ * ```
45
+ *
46
+ * For components not yet migrated to the BEM stylesheet (DPIA, Breach,
47
+ * ROPA, etc.), import them from their normal subpath and pass
48
+ * `unstyled` manually if available — the migration completes in 3.5.x.
49
+ */
8
50
 
9
- interface UnstyledConsentSettingsProps {
10
- className?: string;
11
- children?: ReactNode;
12
- }
13
- declare const UnstyledConsentSettings: React__default.FC<UnstyledConsentSettingsProps>;
51
+ declare const ConsentBanner: React__default.FC<ConsentBannerProps>;
52
+ declare const ConsentManager: React__default.FC<ConsentManagerProps>;
53
+ declare const DSRRequestForm: React__default.FC<DSRRequestFormProps>;
14
54
 
15
- interface UnstyledConsentToggleProps {
16
- category: 'analytics' | 'marketing' | 'functional';
17
- className?: string;
18
- label?: string;
19
- }
20
- declare const UnstyledConsentToggle: React__default.FC<UnstyledConsentToggleProps>;
21
-
22
- export { UnstyledConsentBanner as ConsentBanner, UnstyledConsentSettings as ConsentSettings, UnstyledConsentToggle as ConsentToggle };
55
+ export { ConsentBanner, ConsentBannerProps, ConsentManager, ConsentManagerProps, DSRRequestForm, DSRRequestFormProps };
@@ -1,22 +1,55 @@
1
- import React__default, { ReactNode } from 'react';
1
+ import React__default from 'react';
2
+ import { c as ConsentBannerProps } from './ConsentBanner-VqIPophc.js';
3
+ export { C as ConsentAnalyticsEvent, b as ConsentBannerClassNames } from './ConsentBanner-VqIPophc.js';
4
+ import { b as ConsentManagerProps } from './ConsentManager-CQ2IZtUU.js';
5
+ export { a as ConsentManagerClassNames } from './ConsentManager-CQ2IZtUU.js';
6
+ import { c as DSRRequestFormProps } from './DSRRequestForm-D8rPTNmU.js';
7
+ export { b as DSRRequestFormClassNames } from './DSRRequestForm-D8rPTNmU.js';
8
+ import './consent-CmVzqZUk.js';
9
+ import './dsr-yKbqX531.js';
2
10
 
3
- interface UnstyledConsentBannerProps {
4
- className?: string;
5
- children?: ReactNode;
6
- }
7
- declare const UnstyledConsentBanner: React__default.FC<UnstyledConsentBannerProps>;
11
+ /**
12
+ * Unstyled entry — design-system-friendly component variants.
13
+ *
14
+ * Components imported from this subpath default `unstyled` to `true`,
15
+ * which strips every default class name from the rendered markup.
16
+ * Consumers using their own design system (Tailwind, Mantine, Chakra,
17
+ * shadcn, raw CSS) get logic + accessibility + semantic structure
18
+ * without any pre-applied visual styling.
19
+ *
20
+ * Markup, ARIA attributes, focus management, keyboard handling, and the
21
+ * `data-ndpr-component` data attributes are all preserved — those are
22
+ * part of the contract, not styling.
23
+ *
24
+ * @example
25
+ * ```tsx
26
+ * // app/cookie-banner.tsx
27
+ * import { ConsentBanner } from '@tantainnovative/ndpr-toolkit/unstyled';
28
+ *
29
+ * export function CookieBanner() {
30
+ * return (
31
+ * <ConsentBanner
32
+ * options={[]}
33
+ * onSave={() => {}}
34
+ * classNames={{
35
+ * root: 'fixed bottom-0 inset-x-0 bg-white p-6 shadow-2xl',
36
+ * title: 'text-xl font-bold mb-2',
37
+ * buttonGroup: 'flex gap-2 mt-4',
38
+ * acceptButton: 'btn-primary',
39
+ * rejectButton: 'btn-secondary',
40
+ * }}
41
+ * />
42
+ * );
43
+ * }
44
+ * ```
45
+ *
46
+ * For components not yet migrated to the BEM stylesheet (DPIA, Breach,
47
+ * ROPA, etc.), import them from their normal subpath and pass
48
+ * `unstyled` manually if available — the migration completes in 3.5.x.
49
+ */
8
50
 
9
- interface UnstyledConsentSettingsProps {
10
- className?: string;
11
- children?: ReactNode;
12
- }
13
- declare const UnstyledConsentSettings: React__default.FC<UnstyledConsentSettingsProps>;
51
+ declare const ConsentBanner: React__default.FC<ConsentBannerProps>;
52
+ declare const ConsentManager: React__default.FC<ConsentManagerProps>;
53
+ declare const DSRRequestForm: React__default.FC<DSRRequestFormProps>;
14
54
 
15
- interface UnstyledConsentToggleProps {
16
- category: 'analytics' | 'marketing' | 'functional';
17
- className?: string;
18
- label?: string;
19
- }
20
- declare const UnstyledConsentToggle: React__default.FC<UnstyledConsentToggleProps>;
21
-
22
- export { UnstyledConsentBanner as ConsentBanner, UnstyledConsentSettings as ConsentSettings, UnstyledConsentToggle as ConsentToggle };
55
+ export { ConsentBanner, ConsentBannerProps, ConsentManager, ConsentManagerProps, DSRRequestForm, DSRRequestFormProps };
package/dist/unstyled.js CHANGED
@@ -1,2 +1,2 @@
1
- 'use strict';require('./chunk-MQFZHA2D.js');var react=require('react'),jsxRuntime=require('react/jsx-runtime');var m=react.createContext(void 0);function a(){let e=react.useContext(m);if(!e)throw new Error("useConsent must be used within a ConsentProvider");return e}var f=({className:e,children:i})=>{let{showBanner:t,acceptAll:s,rejectAll:l,openSettings:c}=a();return t?jsxRuntime.jsx("div",{className:e,role:"region","aria-label":"Cookie consent",children:i||jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{children:"Cookie Consent"}),jsxRuntime.jsx("p",{children:"We use cookies to enhance your experience. By continuing to visit this site you agree to our use of cookies."})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("button",{onClick:s,"aria-label":"Accept all cookies",children:"Accept All"}),jsxRuntime.jsx("button",{onClick:l,"aria-label":"Reject non-essential cookies",children:"Reject All"}),jsxRuntime.jsx("button",{onClick:c,"aria-label":"Manage cookie preferences",children:"Manage Preferences"})]})]})}):null};var w=[{id:"necessary",name:"Necessary Cookies",description:"These cookies are essential for the website to function properly.",disabled:true},{id:"analytics",name:"Analytics Cookies",description:"These cookies help us understand how visitors interact with our website.",disabled:false},{id:"marketing",name:"Marketing Cookies",description:"These cookies are used to track visitors across websites for marketing purposes.",disabled:false},{id:"functional",name:"Functional Cookies",description:"These cookies enable personalized features and functionality.",disabled:false}],u=({className:e,children:i})=>{let{showSettings:t,consentState:s,updateConsent:l,savePreferences:c,closeSettings:k}=a();if(!t)return null;let b=()=>{c(s);};return jsxRuntime.jsx("div",{className:e,role:"dialog","aria-label":"Cookie preferences",children:i||jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h2",{children:"Cookie Preferences"}),jsxRuntime.jsx("p",{children:"Manage your cookie preferences. You can enable or disable different categories of cookies below."})]}),jsxRuntime.jsx("div",{children:w.map(o=>jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h4",{children:o.name}),jsxRuntime.jsx("p",{children:o.description})]}),jsxRuntime.jsx("input",{type:"checkbox",checked:s[o.id],onChange:v=>l(o.id,v.target.checked),disabled:o.disabled,"aria-label":`Toggle ${o.name}`})]},o.id))}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("button",{onClick:k,"aria-label":"Cancel changes",children:"Cancel"}),jsxRuntime.jsx("button",{onClick:b,"aria-label":"Save cookie preferences",children:"Save Preferences"})]})]})})};var g=({category:e,className:i,label:t})=>{let{consentState:s,updateConsent:l}=a();return jsxRuntime.jsxs("label",{className:i,children:[jsxRuntime.jsx("input",{type:"checkbox",checked:s[e],onChange:c=>l(e,c.target.checked),"aria-label":t||`Toggle ${e} cookies`}),t&&jsxRuntime.jsx("span",{children:t})]})};exports.ConsentBanner=f;exports.ConsentSettings=u;exports.ConsentToggle=g;//# sourceMappingURL=unstyled.js.map
1
+ 'use strict';var chunkRLYTX3MM_js=require('./chunk-RLYTX3MM.js'),chunkSUEGUY35_js=require('./chunk-SUEGUY35.js'),chunkZPKVLTSX_js=require('./chunk-ZPKVLTSX.js');require('./chunk-I54CDQGN.js'),require('./chunk-E64TU6IU.js');var chunkMQFZHA2D_js=require('./chunk-MQFZHA2D.js'),P=require('react');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var P__default=/*#__PURE__*/_interopDefault(P);function e(C,R){let n=d=>{var s=d,{unstyled:l=true}=s,c=chunkMQFZHA2D_js.c(s,["unstyled"]);return P__default.default.createElement(C,chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},c),{unstyled:l}))};return n.displayName=R,n}var u=e(chunkSUEGUY35_js.a,"UnstyledConsentBanner"),y=e(chunkRLYTX3MM_js.a,"UnstyledConsentManager"),S=e(chunkZPKVLTSX_js.a,"UnstyledDSRRequestForm");exports.ConsentBanner=u;exports.ConsentManager=y;exports.DSRRequestForm=S;//# sourceMappingURL=unstyled.js.map
2
2
  //# sourceMappingURL=unstyled.js.map
package/dist/unstyled.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import'./chunk-WWT2ZSNU.mjs';import {createContext,useContext}from'react';import {jsx,jsxs,Fragment}from'react/jsx-runtime';var m=createContext(void 0);function a(){let e=useContext(m);if(!e)throw new Error("useConsent must be used within a ConsentProvider");return e}var f=({className:e,children:i})=>{let{showBanner:t,acceptAll:s,rejectAll:l,openSettings:c}=a();return t?jsx("div",{className:e,role:"region","aria-label":"Cookie consent",children:i||jsxs(Fragment,{children:[jsxs("div",{children:[jsx("h3",{children:"Cookie Consent"}),jsx("p",{children:"We use cookies to enhance your experience. By continuing to visit this site you agree to our use of cookies."})]}),jsxs("div",{children:[jsx("button",{onClick:s,"aria-label":"Accept all cookies",children:"Accept All"}),jsx("button",{onClick:l,"aria-label":"Reject non-essential cookies",children:"Reject All"}),jsx("button",{onClick:c,"aria-label":"Manage cookie preferences",children:"Manage Preferences"})]})]})}):null};var w=[{id:"necessary",name:"Necessary Cookies",description:"These cookies are essential for the website to function properly.",disabled:true},{id:"analytics",name:"Analytics Cookies",description:"These cookies help us understand how visitors interact with our website.",disabled:false},{id:"marketing",name:"Marketing Cookies",description:"These cookies are used to track visitors across websites for marketing purposes.",disabled:false},{id:"functional",name:"Functional Cookies",description:"These cookies enable personalized features and functionality.",disabled:false}],u=({className:e,children:i})=>{let{showSettings:t,consentState:s,updateConsent:l,savePreferences:c,closeSettings:k}=a();if(!t)return null;let b=()=>{c(s);};return jsx("div",{className:e,role:"dialog","aria-label":"Cookie preferences",children:i||jsxs(Fragment,{children:[jsxs("div",{children:[jsx("h2",{children:"Cookie Preferences"}),jsx("p",{children:"Manage your cookie preferences. You can enable or disable different categories of cookies below."})]}),jsx("div",{children:w.map(o=>jsxs("div",{children:[jsxs("div",{children:[jsx("h4",{children:o.name}),jsx("p",{children:o.description})]}),jsx("input",{type:"checkbox",checked:s[o.id],onChange:v=>l(o.id,v.target.checked),disabled:o.disabled,"aria-label":`Toggle ${o.name}`})]},o.id))}),jsxs("div",{children:[jsx("button",{onClick:k,"aria-label":"Cancel changes",children:"Cancel"}),jsx("button",{onClick:b,"aria-label":"Save cookie preferences",children:"Save Preferences"})]})]})})};var g=({category:e,className:i,label:t})=>{let{consentState:s,updateConsent:l}=a();return jsxs("label",{className:i,children:[jsx("input",{type:"checkbox",checked:s[e],onChange:c=>l(e,c.target.checked),"aria-label":t||`Toggle ${e} cookies`}),t&&jsx("span",{children:t})]})};export{f as ConsentBanner,u as ConsentSettings,g as ConsentToggle};//# sourceMappingURL=unstyled.mjs.map
1
+ import {a as a$2}from'./chunk-EPT2K355.mjs';import {a as a$1}from'./chunk-BN77GP4W.mjs';import {a as a$3}from'./chunk-6HZL2WDU.mjs';import'./chunk-GKKAK6ES.mjs';import'./chunk-AYKLAEOU.mjs';import {c,b,a}from'./chunk-WWT2ZSNU.mjs';import P from'react';function e(C,R){let n=d=>{var s=d,{unstyled:l=true}=s,c$1=c(s,["unstyled"]);return P.createElement(C,b(a({},c$1),{unstyled:l}))};return n.displayName=R,n}var u=e(a$1,"UnstyledConsentBanner"),y=e(a$2,"UnstyledConsentManager"),S=e(a$3,"UnstyledDSRRequestForm");export{u as ConsentBanner,y as ConsentManager,S as DSRRequestForm};//# sourceMappingURL=unstyled.mjs.map
2
2
  //# sourceMappingURL=unstyled.mjs.map
@@ -1,5 +1,5 @@
1
1
  import { c as PrivacyPolicy, P as PolicySection } from './privacy-Ca6te9Ir.mjs';
2
- import { P as PolicyDraft, C as ComplianceGap, T as TemplateContext, a as CustomSection, b as ComplianceResult, c as PDFExportOptions, D as DOCXExportOptions, H as HTMLExportOptions } from './policy-engine-DefZcX3R.mjs';
2
+ import { P as PolicyDraft, C as ComplianceGap, T as TemplateContext, b as CustomSection, a as ComplianceResult, g as PDFExportOptions, f as DOCXExportOptions, H as HTMLExportOptions } from './policy-engine-fYSqEqSW.mjs';
3
3
  import { S as StorageAdapter } from './types-DK2CoKOC.mjs';
4
4
 
5
5
  interface UseAdaptivePolicyWizardOptions {
@@ -1,5 +1,5 @@
1
1
  import { c as PrivacyPolicy, P as PolicySection } from './privacy-Ca6te9Ir.js';
2
- import { P as PolicyDraft, C as ComplianceGap, T as TemplateContext, a as CustomSection, b as ComplianceResult, c as PDFExportOptions, D as DOCXExportOptions, H as HTMLExportOptions } from './policy-engine-C6nC2t3a.js';
2
+ import { P as PolicyDraft, C as ComplianceGap, T as TemplateContext, b as CustomSection, a as ComplianceResult, g as PDFExportOptions, f as DOCXExportOptions, H as HTMLExportOptions } from './policy-engine-CCUCud2T.js';
3
3
  import { S as StorageAdapter } from './types-DK2CoKOC.js';
4
4
 
5
5
  interface UseAdaptivePolicyWizardOptions {
@@ -52,7 +52,7 @@ interface UseCrossBorderTransferReturn {
52
52
  /**
53
53
  * Remove a cross-border transfer
54
54
  */
55
- removeTransfer: (id: string) => boolean;
55
+ removeTransfer: (id: string) => void;
56
56
  /**
57
57
  * Get a cross-border transfer by ID
58
58
  */
@@ -52,7 +52,7 @@ interface UseCrossBorderTransferReturn {
52
52
  /**
53
53
  * Remove a cross-border transfer
54
54
  */
55
- removeTransfer: (id: string) => boolean;
55
+ removeTransfer: (id: string) => void;
56
56
  /**
57
57
  * Get a cross-border transfer by ID
58
58
  */
@@ -67,7 +67,7 @@ interface UsePrivacyPolicyReturn {
67
67
  /**
68
68
  * Generate the policy
69
69
  */
70
- generatePolicy: () => PrivacyPolicy;
70
+ generatePolicy: () => PrivacyPolicy | null;
71
71
  /**
72
72
  * Get the generated policy text
73
73
  */
@@ -99,16 +99,34 @@ declare function usePrivacyPolicy({ templates, initialPolicy, adapter, storageKe
99
99
 
100
100
  interface UseDefaultPrivacyPolicyOptions {
101
101
  /**
102
- * Organisation information to pre-fill into the policy variables.
102
+ * Organisation information to pre-fill into the policy. When provided and
103
+ * `autoGenerate` is true (the default), the hook will auto-select the
104
+ * default template and generate a renderable policy on first commit, so
105
+ * `policy` is non-null on the first useful render.
103
106
  */
104
107
  orgInfo?: {
105
- /** Organisation name */
108
+ /** Organisation name (maps to `organizationInfo.name` and `orgName` variable) */
106
109
  name?: string;
107
- /** Privacy contact email */
110
+ /** Privacy contact email (maps to `privacyEmail`) */
108
111
  email?: string;
112
+ /** Organisation website URL */
113
+ website?: string;
114
+ /** Physical address */
115
+ address?: string;
116
+ /** Industry / sector descriptor */
117
+ industry?: string;
109
118
  /** Data Protection Officer name */
110
119
  dpoName?: string;
120
+ /** DPO email address */
121
+ dpoEmail?: string;
111
122
  };
123
+ /**
124
+ * Whether the hook should auto-select the default template and generate
125
+ * the policy as soon as it's mounted with `orgInfo`. Set to false to
126
+ * retain manual control via `selectTemplate` / `generatePolicy`.
127
+ * @default true
128
+ */
129
+ autoGenerate?: boolean;
112
130
  /**
113
131
  * Storage key for policy data.
114
132
  * @default "ndpr_privacy_policy"
@@ -119,17 +137,24 @@ interface UseDefaultPrivacyPolicyOptions {
119
137
  * @default true
120
138
  */
121
139
  useLocalStorage?: boolean;
140
+ /**
141
+ * Pluggable storage adapter. When provided, takes precedence over
142
+ * storageKey/useLocalStorage.
143
+ */
144
+ adapter?: StorageAdapter<PrivacyPolicy>;
122
145
  }
123
146
  /**
124
- * Convenience wrapper around `usePrivacyPolicy` that automatically
125
- * loads the default NDPA-compliant business policy template and
126
- * pre-fills common organisation variables.
147
+ * Convenience wrapper around `usePrivacyPolicy`. With `orgInfo` provided
148
+ * and `autoGenerate` enabled (default), `policy` is non-null on the first
149
+ * post-load render no manual `selectTemplate` / `generatePolicy` chaining
150
+ * required.
127
151
  *
128
152
  * @example
129
153
  * ```tsx
130
- * const policy = useDefaultPrivacyPolicy({
131
- * orgInfo: { name: 'Acme Ltd', email: 'privacy@acme.ng', dpoName: 'Jane Doe' }
154
+ * const { policy } = useDefaultPrivacyPolicy({
155
+ * orgInfo: { name: 'Acme Ltd', email: 'privacy@acme.ng' }
132
156
  * });
157
+ * return policy ? <PolicyPage policy={policy} /> : <Spinner />;
133
158
  * ```
134
159
  */
135
160
  declare function useDefaultPrivacyPolicy(options?: UseDefaultPrivacyPolicyOptions): UsePrivacyPolicyReturn;
@@ -67,7 +67,7 @@ interface UsePrivacyPolicyReturn {
67
67
  /**
68
68
  * Generate the policy
69
69
  */
70
- generatePolicy: () => PrivacyPolicy;
70
+ generatePolicy: () => PrivacyPolicy | null;
71
71
  /**
72
72
  * Get the generated policy text
73
73
  */
@@ -99,16 +99,34 @@ declare function usePrivacyPolicy({ templates, initialPolicy, adapter, storageKe
99
99
 
100
100
  interface UseDefaultPrivacyPolicyOptions {
101
101
  /**
102
- * Organisation information to pre-fill into the policy variables.
102
+ * Organisation information to pre-fill into the policy. When provided and
103
+ * `autoGenerate` is true (the default), the hook will auto-select the
104
+ * default template and generate a renderable policy on first commit, so
105
+ * `policy` is non-null on the first useful render.
103
106
  */
104
107
  orgInfo?: {
105
- /** Organisation name */
108
+ /** Organisation name (maps to `organizationInfo.name` and `orgName` variable) */
106
109
  name?: string;
107
- /** Privacy contact email */
110
+ /** Privacy contact email (maps to `privacyEmail`) */
108
111
  email?: string;
112
+ /** Organisation website URL */
113
+ website?: string;
114
+ /** Physical address */
115
+ address?: string;
116
+ /** Industry / sector descriptor */
117
+ industry?: string;
109
118
  /** Data Protection Officer name */
110
119
  dpoName?: string;
120
+ /** DPO email address */
121
+ dpoEmail?: string;
111
122
  };
123
+ /**
124
+ * Whether the hook should auto-select the default template and generate
125
+ * the policy as soon as it's mounted with `orgInfo`. Set to false to
126
+ * retain manual control via `selectTemplate` / `generatePolicy`.
127
+ * @default true
128
+ */
129
+ autoGenerate?: boolean;
112
130
  /**
113
131
  * Storage key for policy data.
114
132
  * @default "ndpr_privacy_policy"
@@ -119,17 +137,24 @@ interface UseDefaultPrivacyPolicyOptions {
119
137
  * @default true
120
138
  */
121
139
  useLocalStorage?: boolean;
140
+ /**
141
+ * Pluggable storage adapter. When provided, takes precedence over
142
+ * storageKey/useLocalStorage.
143
+ */
144
+ adapter?: StorageAdapter<PrivacyPolicy>;
122
145
  }
123
146
  /**
124
- * Convenience wrapper around `usePrivacyPolicy` that automatically
125
- * loads the default NDPA-compliant business policy template and
126
- * pre-fills common organisation variables.
147
+ * Convenience wrapper around `usePrivacyPolicy`. With `orgInfo` provided
148
+ * and `autoGenerate` enabled (default), `policy` is non-null on the first
149
+ * post-load render no manual `selectTemplate` / `generatePolicy` chaining
150
+ * required.
127
151
  *
128
152
  * @example
129
153
  * ```tsx
130
- * const policy = useDefaultPrivacyPolicy({
131
- * orgInfo: { name: 'Acme Ltd', email: 'privacy@acme.ng', dpoName: 'Jane Doe' }
154
+ * const { policy } = useDefaultPrivacyPolicy({
155
+ * orgInfo: { name: 'Acme Ltd', email: 'privacy@acme.ng' }
132
156
  * });
157
+ * return policy ? <PolicyPage policy={policy} /> : <Spinner />;
133
158
  * ```
134
159
  */
135
160
  declare function useDefaultPrivacyPolicy(options?: UseDefaultPrivacyPolicyOptions): UsePrivacyPolicyReturn;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tantainnovative/ndpr-toolkit",
3
- "version": "3.3.0",
3
+ "version": "3.4.0",
4
4
  "private": false,
5
5
  "description": "Nigeria Data Protection Toolkit — enterprise-grade compliance components for the Nigeria Data Protection Act (NDPA) 2023",
6
6
  "keywords": [
@@ -46,6 +46,11 @@
46
46
  "import": "./dist/core.mjs",
47
47
  "require": "./dist/core.js"
48
48
  },
49
+ "./server": {
50
+ "types": "./dist/server.d.ts",
51
+ "import": "./dist/server.mjs",
52
+ "require": "./dist/server.js"
53
+ },
49
54
  "./hooks": {
50
55
  "types": "./dist/hooks.d.ts",
51
56
  "import": "./dist/hooks.mjs",
@@ -108,8 +113,11 @@
108
113
  },
109
114
  "./styles": {
110
115
  "types": "./dist/styles.d.ts",
116
+ "style": "./dist/styles.css",
117
+ "sass": "./dist/styles.css",
111
118
  "import": "./dist/styles.css",
112
- "require": "./dist/styles.css"
119
+ "require": "./dist/styles.css",
120
+ "default": "./dist/styles.css"
113
121
  }
114
122
  },
115
123
  "typesVersions": {
@@ -117,6 +125,9 @@
117
125
  "core": [
118
126
  "./dist/core.d.ts"
119
127
  ],
128
+ "server": [
129
+ "./dist/server.d.ts"
130
+ ],
120
131
  "hooks": [
121
132
  "./dist/hooks.d.ts"
122
133
  ],
@@ -162,6 +173,7 @@
162
173
  "dist/**/*.d.mts",
163
174
  "dist/**/*.css",
164
175
  "README.md",
176
+ "CHANGELOG.md",
165
177
  "LICENSE"
166
178
  ],
167
179
  "publishConfig": {
@@ -177,6 +189,7 @@
177
189
  "@radix-ui/react-tabs": "^1.1.9",
178
190
  "class-variance-authority": "^0.7.1",
179
191
  "clsx": "^2.1.1",
192
+ "docx": ">=8.0.0",
180
193
  "jspdf": "^3.0.3",
181
194
  "lucide-react": ">=0.400.0",
182
195
  "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
@@ -202,6 +215,9 @@
202
215
  "clsx": {
203
216
  "optional": true
204
217
  },
218
+ "docx": {
219
+ "optional": true
220
+ },
205
221
  "jspdf": {
206
222
  "optional": true
207
223
  },
@@ -221,7 +237,7 @@
221
237
  "@radix-ui/react-switch": "^1.2.6",
222
238
  "@radix-ui/react-tabs": "^1.1.13",
223
239
  "@tailwindcss/postcss": "^4.1.13",
224
- "@tantainnovative/ndpr-toolkit": "3.2.0",
240
+ "@tantainnovative/ndpr-toolkit": "3.3.0",
225
241
  "@testing-library/dom": "^10.4.1",
226
242
  "@testing-library/jest-dom": "^6.6.3",
227
243
  "@testing-library/react": "^16.3.0",
@@ -259,9 +275,7 @@
259
275
  "tw-animate-css": "^1.4.0",
260
276
  "typescript": "^5.0.0"
261
277
  },
262
- "dependencies": {
263
- "@phosphor-icons/react": "^2.1.10"
264
- },
278
+ "dependencies": {},
265
279
  "scripts": {
266
280
  "dev": "next dev --turbopack",
267
281
  "build": "next build && node scripts/post-build.js",
@@ -1,2 +0,0 @@
1
- 'use strict';var chunkE64TU6IU_js=require('./chunk-E64TU6IU.js'),chunkMQFZHA2D_js=require('./chunk-MQFZHA2D.js'),react=require('react'),jsxRuntime=require('react/jsx-runtime');var _=({options:b,settings:l,onSave:v,title:h="Manage Your Privacy Settings",description:R="Update your consent preferences at any time. Required cookies cannot be disabled as they are necessary for the website to function. Consent management is provided in accordance with NDPA Sections 25-26.",saveButtonText:B="Save Preferences",resetButtonText:x="Reset to Defaults",version:$="1.0",className:S="",buttonClassName:o="",primaryButtonClassName:i="",secondaryButtonClassName:y="",classNames:e,unstyled:s,showSuccessMessage:m=true,successMessage:k="Your preferences have been saved.",successMessageDuration:T=3e3})=>{let[p,t]=react.useState({}),[r,d]=react.useState(false),g=react.useRef(null);react.useEffect(()=>()=>{g.current&&clearTimeout(g.current);},[]),react.useEffect(()=>{if(l&&l.consents)t(l.consents);else {let n={};b.forEach(c=>{n[c.id]=c.defaultValue||false;}),t(n);}},[b,l]);let I=(n,c)=>{t(Y=>chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},Y),{[n]:c}));},M=()=>{let n={consents:p,timestamp:Date.now(),version:$,method:"manager",hasInteracted:true};v(n),m&&(d(true),g.current&&clearTimeout(g.current),g.current=setTimeout(()=>{d(false);},T));},O=()=>{let n={};b.forEach(c=>{n[c.id]=c.defaultValue||false;}),t(n);},w=(e==null?void 0:e.primaryButton)||(e==null?void 0:e.saveButton)||`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-[rgb(var(--ndpr-primary-foreground))] rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${o} ${i}`,C=(e==null?void 0:e.secondaryButton)||(e==null?void 0:e.resetButton)||`px-4 py-2 bg-gray-200 text-gray-800 dark:bg-gray-700 dark:text-white rounded hover:bg-gray-300 dark:hover:bg-gray-600 ${o} ${y}`;return jsxRuntime.jsxs("div",{className:chunkE64TU6IU_js.a(`bg-white dark:bg-gray-800 rounded-lg shadow-md p-6 ${S}`,e==null?void 0:e.root,s),children:[jsxRuntime.jsx("h2",{className:chunkE64TU6IU_js.a("text-xl font-bold mb-2",e==null?void 0:e.title,s),children:h}),jsxRuntime.jsx("p",{className:chunkE64TU6IU_js.a("mb-6 text-gray-600 dark:text-gray-300",e==null?void 0:e.description,s),children:R}),jsxRuntime.jsx("div",{className:chunkE64TU6IU_js.a("space-y-6",e==null?void 0:e.optionsList,s),children:b.map(n=>jsxRuntime.jsx("div",{className:chunkE64TU6IU_js.a("border-b border-gray-200 dark:border-gray-700 pb-4 last:border-0",e==null?void 0:e.optionItem,s),children:jsxRuntime.jsxs("div",{className:"flex items-start justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"font-medium text-gray-900 dark:text-white",children:n.label}),jsxRuntime.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mt-1",children:n.description})]}),jsxRuntime.jsx("div",{className:"ml-4 flex-shrink-0",children:jsxRuntime.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[jsxRuntime.jsx("input",{type:"checkbox",className:"sr-only peer",checked:p[n.id]||false,onChange:c=>I(n.id,c.target.checked),disabled:n.required}),jsxRuntime.jsx("div",{className:chunkE64TU6IU_js.a(`w-11 h-6 bg-gray-200 peer-focus:outline-none peer-focus:ring-4 peer-focus:ring-[rgb(var(--ndpr-ring)/0.3)] rounded-full peer dark:bg-gray-700 peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all dark:border-gray-600 peer-checked:bg-[rgb(var(--ndpr-primary))] ${n.required?"opacity-60":""}`,e==null?void 0:e.toggle,s)}),jsxRuntime.jsxs("span",{className:"ml-3 text-sm font-medium text-gray-900 dark:text-gray-300",children:[p[n.id]?"Enabled":"Disabled",n.required&&jsxRuntime.jsx("span",{className:"text-xs text-red-500 ml-1",children:"(Required)"})]})]})})]})},n.id))}),r&&jsxRuntime.jsx("div",{className:"mt-4 p-3 bg-green-50 dark:bg-green-900/20 text-green-800 dark:text-green-200 rounded-md","aria-live":"polite",role:"status",children:k}),jsxRuntime.jsxs("div",{className:"mt-6 flex flex-wrap gap-3",children:[jsxRuntime.jsx("button",{onClick:M,className:chunkE64TU6IU_js.a(w,e==null?void 0:e.saveButton,s),children:B}),jsxRuntime.jsx("button",{onClick:O,className:chunkE64TU6IU_js.a(C,e==null?void 0:e.resetButton,s),children:x})]}),jsxRuntime.jsxs("div",{className:"mt-4 text-xs text-gray-600 dark:text-gray-400",children:[jsxRuntime.jsxs("p",{children:["Last updated: ",l?new Date(l.timestamp).toLocaleString():"Never"]}),jsxRuntime.jsxs("p",{children:["Version: ",$]})]})]})};var N=({settings:b,storageOptions:l={},onLoad:v,onSave:h,autoSave:R=true,autoLoad:B=true,classNames:x,unstyled:$,children:S})=>{let{storageKey:o="ndpr_consent",storageType:i="localStorage",cookieOptions:y={}}=l,[e,s]=react.useState(false),m=react.useCallback(()=>{let t=null;try{if(i==="localStorage"&&typeof window!="undefined"){let r=localStorage.getItem(o);r&&(t=JSON.parse(r));}else if(i==="sessionStorage"&&typeof window!="undefined"){let r=sessionStorage.getItem(o);r&&(t=JSON.parse(r));}else if(i==="cookie"&&typeof document!="undefined"){let d=document.cookie.split(";").find(g=>g.trim().startsWith(`${o}=`));if(d){let g=d.split("=")[1];t=JSON.parse(decodeURIComponent(g));}}s(!0),v&&v(t);}catch(r){console.error("Error loading consent settings:",r),s(true),v&&v(null);}return t},[i,o,v]),k=react.useCallback(t=>{try{let r=JSON.stringify(t);if(i==="localStorage"&&typeof window!="undefined")localStorage.setItem(o,r);else if(i==="sessionStorage"&&typeof window!="undefined")sessionStorage.setItem(o,r);else if(i==="cookie"&&typeof document!="undefined"){let{domain:d,path:g="/",expires:I=365,secure:M=!0,sameSite:O="Lax"}=y,w=new Date;w.setDate(w.getDate()+I);let C=`${o}=${encodeURIComponent(r)}; path=${g}; expires=${w.toUTCString()}`;d&&(C+=`; domain=${d}`),M&&(C+="; secure"),C+=`; samesite=${O}`,document.cookie=C;}return h&&h(t),!0}catch(r){return console.error("Error saving consent settings:",r),false}},[i,o,y,h]),T=react.useCallback(()=>{try{if(i==="localStorage"&&typeof window!="undefined")localStorage.removeItem(o);else if(i==="sessionStorage"&&typeof window!="undefined")sessionStorage.removeItem(o);else if(i==="cookie"&&typeof document!="undefined"){let{domain:t,path:r="/"}=y,d=`${o}=; path=${r}; expires=Thu, 01 Jan 1970 00:00:00 GMT`;t&&(d+=`; domain=${t}`),document.cookie=d;}return !0}catch(t){return console.error("Error clearing consent settings:",t),false}},[i,o,y]);react.useEffect(()=>{B&&!e&&m();},[B,e,m]),react.useEffect(()=>{R&&e&&k(b);},[b,R,e,k]);let p=chunkE64TU6IU_js.a("",x==null?void 0:x.root,$);if(typeof S=="function"){let t=S({loadSettings:m,saveSettings:k,clearSettings:T,loaded:e});return p?jsxRuntime.jsx("div",{className:p,children:t}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:t})}return p?jsxRuntime.jsx("div",{className:p,children:S}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:S})};exports.a=_;exports.b=N;//# sourceMappingURL=chunk-256APOQM.js.map
2
- //# sourceMappingURL=chunk-256APOQM.js.map
@@ -1,2 +0,0 @@
1
- 'use strict';var chunkE64TU6IU_js=require('./chunk-E64TU6IU.js'),jsxRuntime=require('react/jsx-runtime');var x={consent:"Consent",dsr:"Data Subject Rights",dpia:"DPIA",breach:"Breach Notification",policy:"Privacy Policy",lawfulBasis:"Lawful Basis",crossBorder:"Cross-Border",ropa:"ROPA"},p={critical:"rgb(var(--ndpr-destructive))","needs-work":"rgb(var(--ndpr-warning))",good:"rgb(var(--ndpr-primary))",excellent:"rgb(var(--ndpr-success))"},m={critical:"Critical","needs-work":"Needs Work",good:"Good",excellent:"Excellent"},f={critical:"Critical",high:"High",medium:"Medium",low:"Low"},C=({score:t,rating:o,classNames:e,unstyled:a})=>{let r=p[o],i=2*Math.PI*40,c=i*(1-t/100);return jsxRuntime.jsxs("div",{className:chunkE64TU6IU_js.a("relative inline-flex items-center justify-center",e==null?void 0:e.scoreCircle,a),role:"img","aria-label":`Compliance score: ${t} out of 100, rated ${m[o]}`,children:[jsxRuntime.jsxs("svg",{width:"120",height:"120",viewBox:"0 0 100 100","aria-hidden":"true",children:[jsxRuntime.jsx("circle",{cx:"50",cy:"50",r:"40",fill:"none",stroke:"rgba(0,0,0,0.08)",strokeWidth:"8"}),jsxRuntime.jsx("circle",{cx:"50",cy:"50",r:"40",fill:"none",stroke:r,strokeWidth:"8",strokeLinecap:"round",strokeDasharray:i,strokeDashoffset:c,transform:"rotate(-90 50 50)",style:{transition:"stroke-dashoffset 0.4s ease"}})]}),jsxRuntime.jsx("span",{className:chunkE64TU6IU_js.a("absolute text-2xl font-bold tabular-nums",e==null?void 0:e.scoreValue,a),style:{color:r},children:t})]})},y=({rating:t,className:o,unstyled:e})=>{let a=p[t];return jsxRuntime.jsx("span",{className:chunkE64TU6IU_js.a("inline-block px-3 py-1 rounded-full text-sm font-semibold",o,e),style:{backgroundColor:`${a.replace("rgb(","rgba(").replace(")",", 0.12)")}`,color:a,border:`1px solid ${a.replace("rgb(","rgba(").replace(")",", 0.3)")}`},role:"status","aria-live":"polite",children:m[t]})},h=({moduleKey:t,module:o,classNames:e,unstyled:a})=>{var b;let r=o.score>=90?"excellent":o.score>=70?"good":o.score>=40?"needs-work":"critical",i=p[r];Math.round(o.score/100*(o.gaps.length+Math.round(o.score/100*5)));let u=o.gaps.length,g=(b=x[t])!=null?b:t;return jsxRuntime.jsxs("div",{className:chunkE64TU6IU_js.a("rounded-lg border p-4 flex flex-col gap-2",e==null?void 0:e.moduleCard,a),style:{borderColor:`${i.replace("rgb(","rgba(").replace(")",", 0.25)")}`,backgroundColor:`${i.replace("rgb(","rgba(").replace(")",", 0.04)")}`},children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:chunkE64TU6IU_js.a("text-sm font-semibold truncate",e==null?void 0:e.moduleTitle,a),children:g}),jsxRuntime.jsx("span",{className:chunkE64TU6IU_js.a("text-lg font-bold tabular-nums",e==null?void 0:e.moduleScore,a),style:{color:i},role:"status","aria-label":`${g} score: ${o.score}`,children:o.score})]}),jsxRuntime.jsx("div",{className:"h-1.5 rounded-full overflow-hidden",style:{backgroundColor:"rgba(0,0,0,0.08)"},role:"progressbar","aria-valuenow":o.score,"aria-valuemin":0,"aria-valuemax":100,"aria-label":`${g} compliance score: ${o.score}%`,children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${o.score}%`,backgroundColor:i}})}),u>0&&jsxRuntime.jsxs("p",{className:chunkE64TU6IU_js.a("text-xs text-gray-500 dark:text-gray-400",e==null?void 0:e.moduleGaps,a),children:[u," gap",u!==1?"s":""," to address"]})]})},R=({rec:t,classNames:o,unstyled:e})=>{var i,c;let r=(i={critical:p.critical,high:p["needs-work"],medium:p.good,low:p.excellent}[t.priority])!=null?i:p.good;return jsxRuntime.jsxs("div",{"data-testid":"recommendation-item",className:chunkE64TU6IU_js.a("flex gap-3 p-3 rounded-lg border border-gray-100 dark:border-gray-700 bg-white dark:bg-gray-800",o==null?void 0:o.recommendationItem,e),children:[jsxRuntime.jsx("span",{className:chunkE64TU6IU_js.a("mt-0.5 shrink-0 inline-block px-2 py-0.5 rounded text-xs font-bold uppercase tracking-wide",o==null?void 0:o.recommendationPriority,e),style:{backgroundColor:`${r.replace("rgb(","rgba(").replace(")",", 0.12)")}`,color:r},children:(c=f[t.priority])!=null?c:t.priority}),jsxRuntime.jsxs("div",{className:"min-w-0 flex-1",children:[jsxRuntime.jsx("p",{className:chunkE64TU6IU_js.a("text-sm font-medium text-gray-900 dark:text-gray-100",o==null?void 0:o.recommendationTitle,e),children:t.label}),jsxRuntime.jsx("p",{className:"mt-0.5 text-xs text-gray-500 dark:text-gray-400 leading-relaxed",children:t.recommendation}),jsxRuntime.jsxs("p",{className:"mt-1 text-xs text-gray-400 dark:text-gray-500",children:[t.ndpaSection," \u2022 Effort: ",t.effort]})]})]})},k=({report:t,title:o="NDPA Compliance Dashboard",showRecommendations:e=true,maxRecommendations:a=5,classNames:r,unstyled:i=false})=>{let c=t.recommendations.slice(0,a),u=Object.entries(t.modules);return jsxRuntime.jsxs("div",{"data-ndpr-component":"compliance-dashboard",className:chunkE64TU6IU_js.a("w-full rounded-xl border border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-900 shadow-sm p-6 flex flex-col gap-8",r==null?void 0:r.root,i),children:[jsxRuntime.jsxs("div",{className:chunkE64TU6IU_js.a("flex flex-col sm:flex-row items-start sm:items-center gap-6",r==null?void 0:r.header,i),children:[jsxRuntime.jsx(C,{score:t.score,rating:t.rating,classNames:{scoreCircle:r==null?void 0:r.scoreCircle,scoreValue:r==null?void 0:r.scoreValue},unstyled:i}),jsxRuntime.jsxs("div",{className:"flex flex-col gap-2",children:[jsxRuntime.jsx("h2",{className:"text-xl font-bold text-gray-900 dark:text-gray-100 leading-tight",children:o}),jsxRuntime.jsx(y,{rating:t.rating,className:r==null?void 0:r.ratingBadge,unstyled:i}),jsxRuntime.jsxs("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:["Generated on"," ",new Date(t.generatedAt).toLocaleDateString(void 0,{year:"numeric",month:"long",day:"numeric"})]})]})]}),jsxRuntime.jsx("div",{className:chunkE64TU6IU_js.a("grid grid-cols-2 sm:grid-cols-2 md:grid-cols-4 gap-3",r==null?void 0:r.modulesGrid,i),children:u.map(([g,b])=>jsxRuntime.jsx(h,{moduleKey:g,module:b,classNames:{moduleCard:r==null?void 0:r.moduleCard,moduleTitle:r==null?void 0:r.moduleTitle,moduleScore:r==null?void 0:r.moduleScore,moduleGaps:r==null?void 0:r.moduleGaps},unstyled:i},g))}),e&&c.length>0&&jsxRuntime.jsxs("div",{className:chunkE64TU6IU_js.a("flex flex-col gap-3",r==null?void 0:r.recommendationsSection,i),children:[jsxRuntime.jsx("h3",{className:"text-base font-semibold text-gray-900 dark:text-gray-100",children:"Recommendations"}),c.map(g=>jsxRuntime.jsx(R,{rec:g,classNames:{recommendationItem:r==null?void 0:r.recommendationItem,recommendationPriority:r==null?void 0:r.recommendationPriority,recommendationTitle:r==null?void 0:r.recommendationTitle},unstyled:i},`${g.module}-${g.key}`))]})]})};exports.a=k;//# sourceMappingURL=chunk-25OOUES4.js.map
2
- //# sourceMappingURL=chunk-25OOUES4.js.map