@smartgenie/cookie-consent 0.0.0-stage → 1.0.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 (92) hide show
  1. package/LICENSE +73 -0
  2. package/README.md +292 -2
  3. package/dist/blocking/attribute-blocker.d.ts +18 -0
  4. package/dist/blocking/gtm-consent-mode.d.ts +19 -0
  5. package/dist/blocking/uet-consent.d.ts +9 -0
  6. package/dist/capsules/banner-experiment.d.ts +2 -0
  7. package/dist/capsules/banner-experiment.js +1 -0
  8. package/dist/capsules/country-banners.d.ts +2 -0
  9. package/dist/capsules/country-banners.js +1 -0
  10. package/dist/capsules/loader.d.ts +8 -0
  11. package/dist/capsules/subdomain-consent.d.ts +5 -0
  12. package/dist/capsules/subdomain-consent.js +1 -0
  13. package/dist/config/schema.d.ts +19 -0
  14. package/dist/config/validator.d.ts +8 -0
  15. package/dist/core/consent-log.d.ts +14 -0
  16. package/dist/core/consent-manager.d.ts +13 -0
  17. package/dist/core/consent-stats.d.ts +13 -0
  18. package/dist/core/events.d.ts +5 -0
  19. package/dist/core/gpc.d.ts +5 -0
  20. package/dist/core/storage.d.ts +9 -0
  21. package/dist/geo/detector.d.ts +3 -0
  22. package/dist/i18n/langs/ar.d.ts +1 -0
  23. package/dist/i18n/langs/cs.d.ts +1 -0
  24. package/dist/i18n/langs/da.d.ts +1 -0
  25. package/dist/i18n/langs/de.d.ts +1 -0
  26. package/dist/i18n/langs/es.d.ts +1 -0
  27. package/dist/i18n/langs/fr.d.ts +1 -0
  28. package/dist/i18n/langs/hi.d.ts +1 -0
  29. package/dist/i18n/langs/it.d.ts +1 -0
  30. package/dist/i18n/langs/ja.d.ts +1 -0
  31. package/dist/i18n/langs/ko.d.ts +1 -0
  32. package/dist/i18n/langs/nl.d.ts +1 -0
  33. package/dist/i18n/langs/no.d.ts +1 -0
  34. package/dist/i18n/langs/pl.d.ts +1 -0
  35. package/dist/i18n/langs/pt.d.ts +1 -0
  36. package/dist/i18n/langs/ro.d.ts +1 -0
  37. package/dist/i18n/langs/ru.d.ts +1 -0
  38. package/dist/i18n/langs/sv.d.ts +1 -0
  39. package/dist/i18n/langs/tr.d.ts +1 -0
  40. package/dist/i18n/langs/zh.d.ts +1 -0
  41. package/dist/i18n/loader.d.ts +11 -0
  42. package/dist/i18n/remote.d.ts +23 -0
  43. package/dist/i18n/translations.d.ts +14 -0
  44. package/dist/index.d.ts +10 -0
  45. package/dist/lang/ar.json +1 -0
  46. package/dist/lang/cs.json +1 -0
  47. package/dist/lang/da.json +1 -0
  48. package/dist/lang/de.json +1 -0
  49. package/dist/lang/es.json +1 -0
  50. package/dist/lang/fr.json +1 -0
  51. package/dist/lang/hi.json +1 -0
  52. package/dist/lang/it.json +1 -0
  53. package/dist/lang/ja.json +1 -0
  54. package/dist/lang/ko.json +1 -0
  55. package/dist/lang/nl.json +1 -0
  56. package/dist/lang/no.json +1 -0
  57. package/dist/lang/pl.json +1 -0
  58. package/dist/lang/pt.json +1 -0
  59. package/dist/lang/ro.json +1 -0
  60. package/dist/lang/ru.json +1 -0
  61. package/dist/lang/sv.json +1 -0
  62. package/dist/lang/tr.json +1 -0
  63. package/dist/lang/zh.json +1 -0
  64. package/dist/react/SmartConsent.d.ts +14 -0
  65. package/dist/react/SmartConsent.js +2260 -0
  66. package/dist/react/SmartConsent.js.map +1 -0
  67. package/dist/regulations/loader.d.ts +3 -0
  68. package/dist/regulations/reasoner.d.ts +6 -0
  69. package/dist/regulations/schema.d.ts +8 -0
  70. package/dist/site/consent-records.d.ts +26 -0
  71. package/dist/site/settings.d.ts +48 -0
  72. package/dist/smartconsent.es.js +3063 -0
  73. package/dist/smartconsent.es.js.map +1 -0
  74. package/dist/smartconsent.js +3962 -0
  75. package/dist/smartconsent.js.map +1 -0
  76. package/dist/smartconsent.min.js +534 -0
  77. package/dist/smartconsent.min.js.map +1 -0
  78. package/dist/types.d.ts +377 -0
  79. package/dist/ui/a11y.d.ts +4 -0
  80. package/dist/ui/attribution-guard.d.ts +3 -0
  81. package/dist/ui/badge.d.ts +7 -0
  82. package/dist/ui/banner.d.ts +10 -0
  83. package/dist/ui/cookie-policy.d.ts +8 -0
  84. package/dist/ui/cookie-table.d.ts +7 -0
  85. package/dist/ui/credit.d.ts +15 -0
  86. package/dist/ui/embed-placeholder.d.ts +7 -0
  87. package/dist/ui/opt-out-notice.d.ts +7 -0
  88. package/dist/ui/styles.d.ts +3 -0
  89. package/dist/webhook.d.ts +5 -0
  90. package/package.json +100 -4
  91. package/templates/privacy-policy-template.md +135 -0
  92. package/templates/vanilla.html +116 -0
@@ -0,0 +1,135 @@
1
+ # Privacy Policy Template
2
+
3
+ > **SmartConsent — Privacy Policy Template**
4
+ > Generated: 2026-04-05
5
+ > ⚠️ This is a template, not legal advice. Consult a solicitor before publishing.
6
+ > Replace all [BRACKETED] text with your details.
7
+
8
+ ---
9
+
10
+ # Privacy Policy
11
+
12
+ **Last updated:** [DATE]
13
+
14
+ ## Who we are
15
+
16
+ [COMPANY NAME] ("[WE/US/OUR]") operates the website [WEBSITE URL].
17
+
18
+ - **Registered address:** [ADDRESS]
19
+ - **Company number:** [NUMBER] (if applicable)
20
+ - **Data protection contact:** [EMAIL]
21
+
22
+ ## What data we collect
23
+
24
+ When you visit our website, we may collect:
25
+
26
+ - **Cookies and similar technologies** — small text files stored on your device. See our Cookie Policy below for full details.
27
+ - **Contact information** — if you voluntarily submit a form (name, email, phone number).
28
+ - **Usage data** — pages visited, time on site, referring URL, browser type, device type. This data is anonymised where possible.
29
+
30
+ ## How we use your data
31
+
32
+ We use your data to:
33
+
34
+ - Provide and improve our website
35
+ - Respond to enquiries submitted via contact forms
36
+ - Analyse website usage to improve user experience (only with your consent)
37
+ - Send marketing communications (only with your explicit consent)
38
+
39
+ ## Legal basis for processing (UK GDPR)
40
+
41
+ | Purpose | Legal basis |
42
+ |---------|-------------|
43
+ | Essential website functionality | Legitimate interest (Art. 6(1)(f)) |
44
+ | Analytics and performance cookies | Consent (Art. 6(1)(a)) |
45
+ | Marketing cookies | Consent (Art. 6(1)(a)) |
46
+ | Responding to enquiries | Legitimate interest / contractual necessity |
47
+ | Marketing communications | Consent (Art. 6(1)(a)) |
48
+
49
+ ## Cookies
50
+
51
+ Our website uses cookies. We use SmartConsent to manage your cookie preferences. You can change your preferences at any time by clicking the cookie settings link in our footer.
52
+
53
+ For a full list of cookies we use, their categories, and their purposes, please see our [Cookie Policy page](./cookie-policy).
54
+
55
+ ### Cookie categories
56
+
57
+ - **Necessary** — required for the website to function. Cannot be disabled.
58
+ - **Analytics** — help us understand how visitors use our website.
59
+ - **Marketing** — used to deliver relevant advertisements.
60
+ - **Preferences** — remember your settings and choices.
61
+
62
+ ## Your rights
63
+
64
+ Under UK GDPR, you have the right to:
65
+
66
+ - **Access** your personal data
67
+ - **Rectify** inaccurate personal data
68
+ - **Erase** your personal data ("right to be forgotten")
69
+ - **Restrict** processing of your personal data
70
+ - **Data portability** — receive your data in a structured format
71
+ - **Object** to processing based on legitimate interest
72
+ - **Withdraw consent** at any time (this does not affect prior processing)
73
+
74
+ To exercise any of these rights, contact us at [EMAIL].
75
+
76
+ ## Data retention
77
+
78
+ - **Cookie consent records:** retained for 13 months from the date of consent
79
+ - **Contact form submissions:** retained for [PERIOD, e.g., 24 months] then deleted
80
+ - **Analytics data:** anonymised and retained for [PERIOD, e.g., 26 months]
81
+
82
+ ## Data sharing
83
+
84
+ We do not sell your personal data. We may share data with:
85
+
86
+ - **Analytics providers** (e.g., Google Analytics) — only with your consent
87
+ - **Hosting providers** (e.g., [HOSTING PROVIDER]) — as a data processor under a Data Processing Agreement
88
+ - **Law enforcement** — if required by law
89
+
90
+ ## International transfers
91
+
92
+ [IF APPLICABLE: Some of our third-party providers (e.g., Google) may transfer data outside the UK. These transfers are protected by Standard Contractual Clauses or adequacy decisions.]
93
+
94
+ [IF NOT APPLICABLE: We do not transfer your data outside the United Kingdom.]
95
+
96
+ ## Security
97
+
98
+ We take appropriate technical and organisational measures to protect your personal data, including encryption in transit (HTTPS), access controls, and regular security reviews.
99
+
100
+ ## Children
101
+
102
+ Our website is not directed at children under 13. We do not knowingly collect personal data from children.
103
+
104
+ ## Changes to this policy
105
+
106
+ We may update this privacy policy from time to time. The "Last updated" date at the top of this page reflects the most recent revision.
107
+
108
+ ## Complaints
109
+
110
+ If you are unhappy with how we handle your data, you have the right to lodge a complaint with the Information Commissioner's Office (ICO):
111
+
112
+ - **Website:** [https://ico.org.uk/make-a-complaint/](https://ico.org.uk/make-a-complaint/)
113
+ - **Phone:** 0303 123 1113
114
+
115
+ ## Contact us
116
+
117
+ For any data protection queries:
118
+
119
+ - **Email:** [EMAIL]
120
+ - **Post:** [ADDRESS]
121
+
122
+ ---
123
+
124
+ ## Recommended free privacy policy generators
125
+
126
+ If you need a more comprehensive privacy policy, these free tools can help:
127
+
128
+ - [PrivacyPolicies.com](https://www.privacypolicies.com/privacy-policy-generator/) — free generator, covers GDPR/CCPA
129
+ - [Termly](https://termly.io/products/privacy-policy-generator/) — free tier available
130
+ - [GetTerms.io](https://getterms.io/) — simple generator for small sites
131
+ - [ICO Template](https://ico.org.uk/for-organisations/uk-gdpr-guidance-and-resources/) — UK-specific guidance from the regulator
132
+
133
+ ---
134
+
135
+ *This template is provided by SmartConsent by SmartGenie for convenience only. It does not constitute legal advice. SmartGenie Ltd is not a law firm and does not provide legal services. You should consult a qualified solicitor to ensure your privacy policy meets your specific legal obligations.*
@@ -0,0 +1,116 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>SmartConsent — Vanilla Integration Example</title>
7
+
8
+ <!--
9
+ STEP 1: Configure SmartConsent
10
+
11
+ Only 'version' is required. Everything else has sensible defaults.
12
+ The regulatory intelligence layer auto-detects the visitor's jurisdiction
13
+ and configures compliance settings automatically.
14
+
15
+ Edit the theme, texts, and webhook URL to match your site.
16
+ -->
17
+ <script>
18
+ window.SmartConsentConfig = {
19
+ // REQUIRED: Increment this when you change your cookie policy.
20
+ // Visitors will be re-prompted for consent.
21
+ version: 1,
22
+
23
+ // OPTIONAL: Theme overrides (dark mode by default)
24
+ // theme: {
25
+ // bg: '#ffffff',
26
+ // text: '#1f1f1f',
27
+ // textMuted: '#666666',
28
+ // accent: '#0066cc',
29
+ // accept: '#0066cc',
30
+ // reject: '#666666',
31
+ // },
32
+
33
+ // OPTIONAL: Webhook for consent proof (fire-and-forget POST)
34
+ // webhookUrl: 'https://your-api.com/consent-webhook',
35
+
36
+ // OPTIONAL: Show "Powered by SmartGenie" attribution (default: true)
37
+ // attribution: true,
38
+ };
39
+ </script>
40
+
41
+ <!--
42
+ STEP 2: Include SmartConsent
43
+
44
+ Place this BEFORE any other scripts (especially Google Tag Manager).
45
+ SmartConsent must load first to block scripts and set GTM consent defaults.
46
+
47
+ For self-hosted: download smartconsent.min.js and host on your server.
48
+ For CDN: replace src with the CDN URL.
49
+ -->
50
+ <script src="smartconsent.min.js"></script>
51
+
52
+ <style>
53
+ body { font-family: system-ui, sans-serif; max-width: 700px; margin: 40px auto; padding: 0 20px; line-height: 1.6; }
54
+ h1 { margin-bottom: 8px; }
55
+ .status { padding: 12px 16px; border-radius: 8px; margin: 8px 0; font-weight: 500; }
56
+ .blocked { background: #fee2e2; color: #991b1b; }
57
+ .loaded { background: #dcfce7; color: #166534; }
58
+ pre { background: #f5f5f5; padding: 16px; border-radius: 8px; overflow-x: auto; font-size: 13px; }
59
+ button { padding: 8px 16px; border-radius: 6px; border: 1px solid #ccc; cursor: pointer; margin: 4px; background: #fff; }
60
+ button:hover { background: #f0f0f0; }
61
+ </style>
62
+ </head>
63
+ <body>
64
+ <h1>SmartConsent Integration Example</h1>
65
+ <p>This page demonstrates SmartConsent with script blocking. The scripts below will only execute after consent is given.</p>
66
+
67
+ <h2>Script Status</h2>
68
+ <div id="analytics-status" class="status blocked">Analytics: BLOCKED (waiting for consent)</div>
69
+ <div id="marketing-status" class="status blocked">Marketing: BLOCKED (waiting for consent)</div>
70
+
71
+ <h2>Console API</h2>
72
+ <pre>
73
+ SmartConsent.hasConsent('analytics') // true or false
74
+ SmartConsent.getConsent() // full consent state
75
+ SmartConsent.show() // reopen preferences
76
+ SmartConsent.reset() // clear consent, re-show banner
77
+ </pre>
78
+
79
+ <button onclick="SmartConsent.show()">Reopen Preferences</button>
80
+ <button onclick="SmartConsent.reset()">Reset Consent</button>
81
+
82
+ <!--
83
+ STEP 3: Tag your scripts with data-consent-category
84
+
85
+ Scripts with data-consent-category will be blocked until the visitor
86
+ consents to that category. Scripts without this attribute run normally.
87
+
88
+ Categories: essential (always allowed), analytics, functional, marketing
89
+ -->
90
+
91
+ <!-- Example: Analytics script (blocked until "analytics" consent) -->
92
+ <script data-consent-category="analytics">
93
+ document.getElementById('analytics-status').className = 'status loaded';
94
+ document.getElementById('analytics-status').textContent = 'Analytics: LOADED (consent given)';
95
+ window.__analytics_loaded = true;
96
+ console.log('[Analytics] Script executed after consent');
97
+ </script>
98
+
99
+ <!-- Example: Marketing script (blocked until "marketing" consent) -->
100
+ <script data-consent-category="marketing">
101
+ document.getElementById('marketing-status').className = 'status loaded';
102
+ document.getElementById('marketing-status').textContent = 'Marketing: LOADED (consent given)';
103
+ window.__marketing_loaded = true;
104
+ console.log('[Marketing] Script executed after consent');
105
+ </script>
106
+
107
+ <!--
108
+ Listen for consent changes programmatically:
109
+ -->
110
+ <script>
111
+ window.addEventListener('smartconsent:update', function(e) {
112
+ console.log('[SmartConsent] Consent updated:', e.detail);
113
+ });
114
+ </script>
115
+ </body>
116
+ </html>