@tantainnovative/ndpr-toolkit 3.3.1 → 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 (155) hide show
  1. package/CHANGELOG.md +529 -0
  2. package/dist/{ConsentBanner-CDRT0o2k.d.mts → ConsentBanner-F5ayys5K.d.mts} +10 -0
  3. package/dist/{ConsentBanner-Vxyt8SCX.d.ts → ConsentBanner-VqIPophc.d.ts} +10 -0
  4. package/dist/{styling-B7CBzYG7.d.ts → ConsentManager-C7I3PDe8.d.mts} +2 -62
  5. package/dist/{styling-uJLsBbER.d.mts → ConsentManager-CQ2IZtUU.d.ts} +2 -62
  6. package/dist/{sanitize-B0AzEm1D.d.mts → NDPRProvider-DYFb8xEl.d.ts} +2 -94
  7. package/dist/{sanitize-B0AzEm1D.d.ts → NDPRProvider-U3QNu6MA.d.mts} +2 -94
  8. package/dist/adapters.js +1 -1
  9. package/dist/adapters.mjs +1 -1
  10. package/dist/breach.js +1 -1
  11. package/dist/breach.mjs +1 -1
  12. package/dist/chunk-2WH4DLV5.js +3 -0
  13. package/dist/chunk-3NQQSU4P.js +2 -0
  14. package/dist/chunk-3VQAYQR7.js +7 -0
  15. package/dist/chunk-4R42ZNO7.mjs +318 -0
  16. package/dist/chunk-5HL4UBFV.js +2 -0
  17. package/dist/chunk-6HZL2WDU.mjs +2 -0
  18. package/dist/chunk-6QPRDQZF.js +2 -0
  19. package/dist/chunk-74Z23WUA.mjs +2 -0
  20. package/dist/chunk-AHSMDPG5.js +132 -0
  21. package/dist/chunk-BN77GP4W.mjs +2 -0
  22. package/dist/chunk-C5QO3SX4.js +2 -0
  23. package/dist/chunk-CISJAQ6W.mjs +2 -0
  24. package/dist/chunk-DUY6F3GT.mjs +94 -0
  25. package/dist/chunk-EHAZIKDX.js +81 -0
  26. package/dist/chunk-EPT2K355.mjs +2 -0
  27. package/dist/chunk-HGGLW5TE.js +2 -0
  28. package/dist/chunk-HQSU7LGM.js +94 -0
  29. package/dist/chunk-IZCWCE7W.mjs +2 -0
  30. package/dist/chunk-JBSCER34.js +2 -0
  31. package/dist/chunk-KF3EFJEF.mjs +3 -0
  32. package/dist/chunk-KSERBMXW.mjs +4 -0
  33. package/dist/chunk-LJNNPAFU.mjs +2 -0
  34. package/dist/{chunk-UXMGBIX6.js → chunk-LSCMXAPY.mjs} +4 -4
  35. package/dist/chunk-LSNL4XR5.js +2 -0
  36. package/dist/chunk-MG73MOZC.mjs +15 -0
  37. package/dist/chunk-NCOZB2WU.mjs +2 -0
  38. package/dist/chunk-NQNFS3QI.js +7 -0
  39. package/dist/{chunk-ZEOQYWOE.mjs → chunk-P2YV6DR3.js} +4 -4
  40. package/dist/chunk-P6QAFBCV.js +2 -0
  41. package/dist/chunk-QVULSG6J.mjs +3 -0
  42. package/dist/chunk-R5FW5XUQ.mjs +2 -0
  43. package/dist/chunk-RGNP45VR.js +2 -0
  44. package/dist/chunk-RLYTX3MM.js +2 -0
  45. package/dist/chunk-RNTNHVKZ.js +15 -0
  46. package/dist/chunk-RRVKUCFR.mjs +2 -0
  47. package/dist/chunk-RXL6CZAI.js +2 -0
  48. package/dist/chunk-RY3PGVLZ.mjs +2 -0
  49. package/dist/chunk-SUEGUY35.js +2 -0
  50. package/dist/chunk-SYMQJO2W.mjs +7 -0
  51. package/dist/chunk-TCN22KYP.mjs +7 -0
  52. package/dist/chunk-UFPSUO52.js +318 -0
  53. package/dist/chunk-VTITKWGX.mjs +2 -0
  54. package/dist/chunk-WH6ZMUOS.mjs +81 -0
  55. package/dist/chunk-WTJGLNTB.js +3 -0
  56. package/dist/chunk-XHROISIF.mjs +2 -0
  57. package/dist/chunk-XMBSJJ5U.js +4 -0
  58. package/dist/chunk-ZLSWOFAY.mjs +132 -0
  59. package/dist/chunk-ZPKVLTSX.js +2 -0
  60. package/dist/consent.d.mts +6 -4
  61. package/dist/consent.d.ts +6 -4
  62. package/dist/consent.js +1 -1
  63. package/dist/consent.mjs +1 -1
  64. package/dist/core.d.mts +6 -29
  65. package/dist/core.d.ts +6 -29
  66. package/dist/core.js +1 -1
  67. package/dist/core.mjs +1 -1
  68. package/dist/cross-border.js +1 -1
  69. package/dist/cross-border.mjs +1 -1
  70. package/dist/docx-BxKascXN.d.ts +64 -0
  71. package/dist/docx-CV7Vsry_.d.mts +64 -0
  72. package/dist/dpia.js +1 -1
  73. package/dist/dpia.mjs +1 -1
  74. package/dist/dsr.js +1 -1
  75. package/dist/dsr.mjs +1 -1
  76. package/dist/hooks.d.mts +3 -3
  77. package/dist/hooks.d.ts +3 -3
  78. package/dist/hooks.js +1 -1
  79. package/dist/hooks.mjs +1 -1
  80. package/dist/index.d.mts +7 -5
  81. package/dist/index.d.ts +7 -5
  82. package/dist/index.js +1 -1
  83. package/dist/index.mjs +1 -1
  84. package/dist/lawful-basis.js +1 -1
  85. package/dist/lawful-basis.mjs +1 -1
  86. package/dist/locale-CxJx2tzn.d.mts +25 -0
  87. package/dist/locale-DSkrtf-c.d.ts +25 -0
  88. package/dist/{policy-engine-C6nC2t3a.d.ts → policy-engine-CCUCud2T.d.ts} +1 -1
  89. package/dist/{policy-engine-DefZcX3R.d.mts → policy-engine-fYSqEqSW.d.mts} +1 -1
  90. package/dist/{policy-sections-DFDPVCCg.d.ts → policy-sections-BYx6fEFk.d.ts} +4 -2
  91. package/dist/{policy-sections-Bylm31kZ.d.mts → policy-sections-Dm97Nq8m.d.mts} +4 -2
  92. package/dist/{policy-templates-CIKcV0i1.d.ts → policy-templates-DhLwq4R-.d.ts} +8 -1
  93. package/dist/{policy-templates-DMsPwOSZ.d.mts → policy-templates-DwYl2329.d.mts} +8 -1
  94. package/dist/policy.d.mts +36 -71
  95. package/dist/policy.d.ts +36 -71
  96. package/dist/policy.js +1 -1
  97. package/dist/policy.mjs +1 -1
  98. package/dist/presets.d.mts +2 -2
  99. package/dist/presets.d.ts +2 -2
  100. package/dist/presets.js +1 -1
  101. package/dist/presets.mjs +1 -1
  102. package/dist/ropa.js +1 -1
  103. package/dist/ropa.mjs +1 -1
  104. package/dist/sanitize-CxxwKxAx.d.mts +94 -0
  105. package/dist/sanitize-CxxwKxAx.d.ts +94 -0
  106. package/dist/server.d.mts +24 -0
  107. package/dist/server.d.ts +24 -0
  108. package/dist/server.js +2 -0
  109. package/dist/server.mjs +2 -0
  110. package/dist/styles.css +1423 -31
  111. package/dist/styling-BMDGQDgS.d.mts +64 -0
  112. package/dist/styling-BaoQtV06.d.ts +64 -0
  113. package/dist/unstyled.d.mts +52 -19
  114. package/dist/unstyled.d.ts +52 -19
  115. package/dist/unstyled.js +1 -1
  116. package/dist/unstyled.mjs +1 -1
  117. package/dist/{useAdaptivePolicyWizard-A1PyOy6P.d.mts → useAdaptivePolicyWizard-BnjW4OR4.d.mts} +1 -1
  118. package/dist/{useAdaptivePolicyWizard-LVIKhAxw.d.ts → useAdaptivePolicyWizard-sb3m4-Zk.d.ts} +1 -1
  119. package/dist/{useDefaultPrivacyPolicy-ySWU7nc-.d.mts → useDefaultPrivacyPolicy-Cs2WQSYQ.d.mts} +30 -9
  120. package/dist/{useDefaultPrivacyPolicy-DvCbeEl1.d.ts → useDefaultPrivacyPolicy-DkOqMg2e.d.ts} +30 -9
  121. package/package.json +14 -2
  122. package/dist/chunk-25OOUES4.js +0 -2
  123. package/dist/chunk-4JKTIR33.mjs +0 -2
  124. package/dist/chunk-5BUS6AI7.js +0 -2
  125. package/dist/chunk-5ECDPRSZ.js +0 -7
  126. package/dist/chunk-6YN73KR7.mjs +0 -2
  127. package/dist/chunk-CDZDT2OS.mjs +0 -320
  128. package/dist/chunk-CWUPGY3M.mjs +0 -3
  129. package/dist/chunk-CYU6YUJQ.mjs +0 -81
  130. package/dist/chunk-EKHBORAH.js +0 -81
  131. package/dist/chunk-ENIMJ6SQ.js +0 -2
  132. package/dist/chunk-FLKJSGR7.mjs +0 -94
  133. package/dist/chunk-FWLPJ5YI.js +0 -94
  134. package/dist/chunk-GCQRHMTQ.mjs +0 -144
  135. package/dist/chunk-GMLCWGNJ.js +0 -7
  136. package/dist/chunk-GXLSOZCH.mjs +0 -2
  137. package/dist/chunk-LETEUS5X.mjs +0 -2
  138. package/dist/chunk-LU4PFST7.js +0 -144
  139. package/dist/chunk-NBSVFQ5G.js +0 -2
  140. package/dist/chunk-OYR3L4XS.mjs +0 -7
  141. package/dist/chunk-QF6XNKU6.mjs +0 -2
  142. package/dist/chunk-QJ3JNHO7.js +0 -2
  143. package/dist/chunk-QNCGRCAX.mjs +0 -2
  144. package/dist/chunk-SAA7UVI2.js +0 -3
  145. package/dist/chunk-TI2M7H6R.mjs +0 -7
  146. package/dist/chunk-TXXWCB5O.js +0 -320
  147. package/dist/chunk-UGY5ZYUG.js +0 -2
  148. package/dist/chunk-UO6QPJLH.js +0 -2
  149. package/dist/chunk-UX6ZZNEM.mjs +0 -3
  150. package/dist/chunk-XFUEZ3MP.mjs +0 -2
  151. package/dist/chunk-XHSHPB74.js +0 -2
  152. package/dist/chunk-YCX6BFOQ.js +0 -2
  153. package/dist/chunk-YURSF2YO.mjs +0 -2
  154. package/dist/chunk-YZXUAIYN.js +0 -3
  155. 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 {
@@ -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"
@@ -120,20 +138,23 @@ interface UseDefaultPrivacyPolicyOptions {
120
138
  */
121
139
  useLocalStorage?: boolean;
122
140
  /**
123
- * Pluggable storage adapter. When provided, takes precedence over storageKey/useLocalStorage.
141
+ * Pluggable storage adapter. When provided, takes precedence over
142
+ * storageKey/useLocalStorage.
124
143
  */
125
144
  adapter?: StorageAdapter<PrivacyPolicy>;
126
145
  }
127
146
  /**
128
- * Convenience wrapper around `usePrivacyPolicy` that automatically
129
- * loads the default NDPA-compliant business policy template and
130
- * 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.
131
151
  *
132
152
  * @example
133
153
  * ```tsx
134
- * const policy = useDefaultPrivacyPolicy({
135
- * orgInfo: { name: 'Acme Ltd', email: 'privacy@acme.ng', dpoName: 'Jane Doe' }
154
+ * const { policy } = useDefaultPrivacyPolicy({
155
+ * orgInfo: { name: 'Acme Ltd', email: 'privacy@acme.ng' }
136
156
  * });
157
+ * return policy ? <PolicyPage policy={policy} /> : <Spinner />;
137
158
  * ```
138
159
  */
139
160
  declare function useDefaultPrivacyPolicy(options?: UseDefaultPrivacyPolicyOptions): UsePrivacyPolicyReturn;
@@ -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"
@@ -120,20 +138,23 @@ interface UseDefaultPrivacyPolicyOptions {
120
138
  */
121
139
  useLocalStorage?: boolean;
122
140
  /**
123
- * Pluggable storage adapter. When provided, takes precedence over storageKey/useLocalStorage.
141
+ * Pluggable storage adapter. When provided, takes precedence over
142
+ * storageKey/useLocalStorage.
124
143
  */
125
144
  adapter?: StorageAdapter<PrivacyPolicy>;
126
145
  }
127
146
  /**
128
- * Convenience wrapper around `usePrivacyPolicy` that automatically
129
- * loads the default NDPA-compliant business policy template and
130
- * 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.
131
151
  *
132
152
  * @example
133
153
  * ```tsx
134
- * const policy = useDefaultPrivacyPolicy({
135
- * orgInfo: { name: 'Acme Ltd', email: 'privacy@acme.ng', dpoName: 'Jane Doe' }
154
+ * const { policy } = useDefaultPrivacyPolicy({
155
+ * orgInfo: { name: 'Acme Ltd', email: 'privacy@acme.ng' }
136
156
  * });
157
+ * return policy ? <PolicyPage policy={policy} /> : <Spinner />;
137
158
  * ```
138
159
  */
139
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.1",
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": {
@@ -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
@@ -1,2 +0,0 @@
1
- import {a as a$1}from'./chunk-AYKLAEOU.mjs';import {a,b}from'./chunk-WWT2ZSNU.mjs';import {useState,useRef,useEffect,useCallback}from'react';import {createPortal}from'react-dom';import {jsx,jsxs}from'react/jsx-runtime';var yt=({options:d,onSave:U,title:Q="We Value Your Privacy",description:X="We use cookies and similar technologies to provide our services and enhance your experience. Your consent is collected in accordance with NDPA Sections 25-26.",acceptAllButtonText:Z="Accept All",rejectAllButtonText:s="Reject All",customizeButtonText:N="Customize",saveButtonText:tt="Save Preferences",position:L="bottom",zIndex:q=9999,version:a$2="1.0",show:x,manageStorage:z=true,storageKey:D="ndpr_consent",className:et="",buttonClassName:B="",primaryButtonClassName:H="",secondaryButtonClassName:nt="",classNames:t,unstyled:o,onAnalytics:k})=>{let[u,c]=useState(false),[g,m]=useState(false),[w,E]=useState({}),[F,rt]=useState(false),f=useRef(null),T=useRef(null),$=useRef(false);useEffect(()=>{rt(true);},[]);let b$1=useCallback((e,n)=>{k==null||k(a({action:e,timestamp:Date.now(),version:a$2},n!==void 0?{categories:n}:{}));},[k,a$2]);useEffect(()=>{let e={};if(d.forEach(n=>{e[n.id]=n.defaultValue||false;}),E(e),x===void 0)if(!z)c(true);else {let n=localStorage.getItem(D);if(n)try{JSON.parse(n).version!==a$2?c(!0):c(!1);}catch(C){c(true);}else c(true);}else c(x);},[d,D,a$2,z]),useEffect(()=>{x!==void 0&&c(x);},[x]);let ot=()=>{let e={};d.forEach(n=>{e[n.id]=true;}),b$1("accepted_all",e),j(e);},M=()=>{let e={};d.forEach(n=>{e[n.id]=n.required||false;}),b$1("rejected_all",e),j(e);},it=(e,n)=>{E(C=>b(a({},C),{[e]:n}));},dt=()=>{let e={};d.forEach(n=>{e[n.id]=true;}),E(e);},ut=()=>{let e={};d.forEach(n=>{e[n.id]=n.required||false;}),E(e);},_=d.length>0&&d.every(e=>w[e.id]),ct=()=>{b$1("customized",w),j(w);},j=e=>{let n={consents:e,timestamp:Date.now(),version:a$2,method:g?"customize":"banner",hasInteracted:true};z&&localStorage.setItem(D,JSON.stringify(n)),U(n),c(false),m(false);};if(useEffect(()=>{if(!u)return;let e=n=>{n.key==="Escape"&&(b$1("dismissed"),M());};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[u,b$1,d,g]),useEffect(()=>{u&&!$.current&&($.current=true,b$1("shown")),u||($.current=false);},[u,b$1]),useEffect(()=>{if(!u||!f.current)return;let e='a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])',C=setTimeout(()=>{if(!f.current)return;let p=f.current.querySelectorAll(e);p.length>0?p[0].focus():f.current.focus();},0),G=p=>{if(p.key!=="Tab"||!f.current)return;let A=f.current.querySelectorAll(e);if(A.length===0)return;let V=A[0],J=A[A.length-1];p.shiftKey?document.activeElement===V&&(p.preventDefault(),J.focus()):document.activeElement===J&&(p.preventDefault(),V.focus());};return document.addEventListener("keydown",G),()=>{clearTimeout(C),document.removeEventListener("keydown",G);}},[u,g]),useEffect(()=>{if(g&&T.current){let e=T.current;e.style.maxHeight="0px",e.style.opacity="0",e.offsetHeight,e.style.maxHeight=`${e.scrollHeight}px`,e.style.opacity="1";}},[g]),!u)return null;let lt=(t==null?void 0:t.primaryButton)||(t==null?void 0:t.acceptButton)||`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-[rgb(var(--ndpr-primary-foreground))] rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${B} ${H}`,K=(t==null?void 0:t.secondaryButton)||(t==null?void 0:t.rejectButton)||`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 ${B} ${nt}`,gt=(t==null?void 0:t.customizeButton)||`px-4 py-2 bg-transparent text-gray-800 dark:text-white hover:underline ${B}`,ft=(t==null?void 0:t.saveButton)||`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-[rgb(var(--ndpr-primary-foreground))] rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${B} ${H}`,S=L==="inline",y=L==="center",h;S||y?h="":L==="top"?h="fixed inset-x-0 top-0":h="fixed inset-x-0 bottom-0";let P=jsx("div",{ref:f,tabIndex:-1,"data-ndpr-component":"consent-banner",className:a$1(`${S?"":h} bg-white dark:bg-gray-800 shadow-lg p-3 sm:p-4 border border-gray-200 dark:border-gray-700 ${y?"max-w-lg w-full":""} ${et}`,t==null?void 0:t.root,o),style:!S&&!y?{zIndex:q}:void 0,role:"dialog","aria-modal":y||void 0,"aria-labelledby":"consent-banner-title","aria-describedby":"consent-banner-description",children:jsxs("div",{className:a$1("max-w-6xl mx-auto",t==null?void 0:t.container,o),children:[jsx("h2",{id:"consent-banner-title",className:a$1("text-lg font-bold mb-2",t==null?void 0:t.title,o),children:Q}),jsx("p",{id:"consent-banner-description",className:a$1("text-sm sm:text-base mb-4",t==null?void 0:t.description,o),children:X}),g&&jsxs("div",{ref:T,className:a$1("mb-4 p-3 sm:p-4 rounded-md border border-gray-200 dark:border-gray-600 bg-gray-50 dark:bg-gray-700/50",t==null?void 0:t.customizePanel,o),style:{overflow:"hidden",transition:"max-height 0.3s ease-out, opacity 0.3s ease-out"},children:[jsx("div",{className:"mb-3 flex items-center justify-end",children:jsx("button",{type:"button",onClick:_?ut:dt,className:a$1("text-sm font-medium text-[rgb(var(--ndpr-primary))] hover:underline",t==null?void 0:t.selectAllButton,o),children:_?"Deselect All":"Select All"})}),jsx("div",{className:a$1("space-y-3",t==null?void 0:t.optionsList,o),children:d.map(e=>jsxs("div",{className:a$1("flex items-start",t==null?void 0:t.optionItem,o),children:[jsx("div",{className:"flex items-center h-5",children:jsx("input",{id:`consent-${e.id}`,type:"checkbox",checked:w[e.id]||false,onChange:n=>it(e.id,n.target.checked),disabled:e.required,className:a$1("h-4 w-4 rounded border-gray-300 text-[rgb(var(--ndpr-primary))] focus:ring-[rgb(var(--ndpr-ring))]",t==null?void 0:t.optionCheckbox,o)})}),jsxs("div",{className:"ml-3 text-sm",children:[jsxs("label",{htmlFor:`consent-${e.id}`,className:a$1("font-medium",t==null?void 0:t.optionLabel,o),children:[e.label," ",e.required&&jsx("span",{className:"text-red-500",children:"*"})]}),jsx("p",{className:a$1("text-gray-600 dark:text-gray-400",t==null?void 0:t.optionDescription,o),children:e.description})]})]},e.id))}),jsxs("div",{className:a$1("mt-4 flex flex-col sm:flex-row flex-wrap gap-2",t==null?void 0:t.buttonGroup,o),children:[jsx("button",{onClick:ct,className:a$1(ft,t==null?void 0:t.saveButton,o),children:tt}),jsx("button",{onClick:()=>m(false),className:a$1(K,t==null?void 0:t.rejectButton,o),children:"Back"})]})]}),!g&&jsxs("div",{className:a$1("flex flex-col sm:flex-row flex-wrap gap-2",t==null?void 0:t.buttonGroup,o),children:[jsx("button",{onClick:ot,className:a$1(lt,t==null?void 0:t.acceptButton,o),children:Z}),jsx("button",{onClick:M,className:a$1(K,t==null?void 0:t.rejectButton,o),children:s}),jsx("button",{onClick:()=>m(true),className:a$1(gt,t==null?void 0:t.customizeButton,o),children:N})]}),jsx("div",{className:a$1("mt-2 text-xs text-gray-600 dark:text-gray-400",void 0,o),children:'By clicking "Accept All", you agree to the use of ALL cookies. Visit our Cookie Policy to learn more.'})]})});if(S)return P;if(y){let e=jsxs("div",{className:"fixed inset-0 flex items-center justify-center",style:{zIndex:q},children:[jsx("div",{className:"absolute inset-0 bg-black/50","aria-hidden":"true"}),jsx("div",{className:"relative",children:P})]});return F?createPortal(e,document.body):null}return F?createPortal(P,document.body):null};export{yt as a};//# sourceMappingURL=chunk-4JKTIR33.mjs.map
2
- //# sourceMappingURL=chunk-4JKTIR33.mjs.map