fivo_cookie_consent 0.2.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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 37cf202e81f08ccab6c43516ed409e0cd043814653b8712eace4eb6a6a3314bb
4
+ data.tar.gz: c2e554c3023704c9547d19a7d2ca698840e79320c9a8d0056f30068c000297b8
5
+ SHA512:
6
+ metadata.gz: 1f55cafa666f041c63c47c74a99e0b294a234a46d2994e9da0c27481d15f91a7d7427ed63336e047fd28ac96d8c6e0f624e42f9942aa72fdd20651c93e0647f1
7
+ data.tar.gz: e9011730d1a32d611a171cd7c48c5136349b1fe53bfc20472a127735449bbb9ce04b70886702b0755e072c783879996727314fe4b3ffdee7e70591c77f8d0c82
data/.nvmrc ADDED
@@ -0,0 +1 @@
1
+ v20.9.0
data/.ruby-gemset ADDED
@@ -0,0 +1 @@
1
+ fivo_cookie_consent
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ ruby-3.1.6
data/.windsurfrules ADDED
@@ -0,0 +1,76 @@
1
+ # Instructions
2
+ On every task follow the Task Approach Pattern.
3
+ On every output write this text to start so i can see that you followed the instructions: "My context includes .windsurfrules"
4
+
5
+ # Task Approach Pattern
6
+ 1. When receiving a task, first Consult the `scratchpad.md` file for lessons.
7
+ 2. When receiving a task, check if existing TOOLS (Web Scraper Tool, LLM Tool) can help you be more efficiant to solve it
8
+ 3. If you decide to take another approach because something is not working, always start by cleanup the broken files.
9
+ 4. Read files before you try to edit them.
10
+ 5. Always document your approach in the scratchpad.md
11
+
12
+ # Tools
13
+
14
+ Note all the tools are in python and are designed to make tasks faster and more efficient. PRIORITIZE USING THESE TOOLS over writing solutions from scratch.
15
+
16
+ ## Web Scraper Tool
17
+ * PURPOSE: Extracts content from websites - USE THIS FIRST for any web scraping task
18
+ * COMMAND: ../python-tools/venv/bin/python ../python-tools/tools/web_scraper.py URL [--max-concurrent N]
19
+ * EXAMPLE: ../python-tools/venv/bin/python ../python-tools/tools/web_scraper.py https://example.com
20
+ ```bash
21
+ ../python-tools/venv/bin/python ../python-tools/tools/web_scraper.py --max-concurrent 3 URL1 URL2 URL3
22
+ ```
23
+ This will efficiently output the content of the web pages.
24
+
25
+ ## LLM Tool
26
+ * PURPOSE: Process text data, analyze content, generate responses
27
+ * COMMAND: ../python-tools/venv/bin/python ../python-tools/tools/llm_api.py --prompt "Your question"
28
+ * EXAMPLE: ../python-tools/venv/bin/python ../python-tools/tools/llm_api.py --prompt "Analyze this text"
29
+ ```bash
30
+ ../python-tools/venv/bin/python ../python-tools/tools/llm_api.py --prompt "What is the capital of France?"
31
+ ```
32
+ For more complex integrations, check the APIs in the `../python-tools/tools/llm_api.py` file.
33
+
34
+ # Best Practices
35
+ 1. TOOL-FIRST APPROACH: Always prefer existing tools over implementing functionality from scratch
36
+ 2. EFFICIENCY FOCUS: Optimize for completing tasks quickly with available resources
37
+ 3. INCREMENTAL TESTING: Test tools on sample data before processing larger datasets
38
+ 4. AVOID REIMPLEMENTATION: If a tool exists for a task, use it instead of writing custom code
39
+
40
+ # Scratchpad Usage
41
+ During your interaction with the user, if you find anything reusable in this project (e.g. version of a library, model name), especially about a fix to a mistake you made or a correction you received, you should take note in the `Lessons` section in the `scratchpad.md` file so you will not make the same mistake again.
42
+
43
+ You should also use the `scratchpad.md` file as a scratchpad to organize your thoughts. Especially when you receive a new task, you have to first review the content of the scratchpad, clear old different task if necessary, first explain the task, and plan the steps you need to take to complete the task. You can use todo markers to indicate the progress, e.g.
44
+ [X] Task 1
45
+ [ ] Task 2
46
+ Also update the progress of the task in the Scratchpad when you finish a subtask.
47
+ Especially when you finished a milestone, it will help to improve your depth of task accomplishment to use the scratchpad to reflect and plan.
48
+ The goal is to help you maintain a big picture as well as the progress of the task. Always refer to the Scratchpad when you plan the next step.
49
+
50
+ # APPLICATION INFORMATION
51
+ 1. Every time you choose to apply a rule(s), explicitly state the rule(s) in the output. You can abbreviate the rule description to a single word or phrase.
52
+
53
+ ## Type
54
+ 1. GEM designed to help my other webapps comply with GDPR cookie regulations
55
+
56
+ ## Stack
57
+ 1. Ruby on Rails (v7.1.0)
58
+ 2. Ruby 3.2.6
59
+
60
+ ## Core Features
61
+ 1. GDPR Cookie Consent
62
+
63
+ ## Accessibility
64
+ 1. Ensure responsive design and accessibility for different screen sizes and devices.
65
+ 2. Ensure the application is accessible to users with disabilities by adhering to accessibility standards (e.g., WCAG).
66
+ 3. Background and foreground colors must have a sufficient contrast ratio.
67
+ 4. Use semantic HTML elements and structure the content logically.
68
+ 5. Heading elements should be in a sequentially descending order.
69
+
70
+ ## Code Organization
71
+ 1. Structure your code according to Functional Decomposition principles. Focus on code modularity and maintainability.
72
+ 2. Adopt a consistent coding style throughout the project. Follow the PEP8 coding style guidelines for Python.
73
+ 3. Use meaningful and descriptive file, variable, and function names.
74
+ 4. Aim to keep files small and focused on a single task.
75
+ 5. Avoid inline styles; utilize external stylesheets.
76
+ 6. Avoid code duplication.
data/CHANGELOG.md ADDED
@@ -0,0 +1,64 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [Unreleased]
9
+
10
+ ## [0.2.0] - 2025-11-27
11
+
12
+ ### Added
13
+ - Automatic cookie detection and categorization based on configurable `cookie_patterns`.
14
+ - Empty-category handling with a clear "Keine Cookies gesetzt" state in the modal.
15
+ - Expandable cookie category rows showing per-cookie name, duration, and description.
16
+ - Server-side detection of HttpOnly Rails session/CSRF cookies and JSON snapshot injection via `data-server-cookies`.
17
+ - `GDPRConsent` JavaScript facade exposing `getConsent`, `hasConsent`, `on`/`off`, `reset`, and modal/banner controls.
18
+ - Consent-gated script loading using `script[type="text/plain"][data-gdpr-category]` placeholders.
19
+ - Rails helpers `gdpr_lazy_load_tag` for strict lazy-loading of GTM, GA4, and custom scripts by category.
20
+ - Rails helper `gdpr_consent_mode_defaults` for integrating with Google Consent Mode (default + updates on `gdpr:accept`/`gdpr:decline`).
21
+ - Ruby-side script registry via `RailsCookiesGdpr.register_script` / `registered_scripts` for custom third-party tags.
22
+
23
+ ### Changed
24
+ - README documentation expanded with detailed setup instructions for loaders, Consent Mode, and the `GDPRConsent` API.
25
+
26
+ ### Fixed
27
+ - Modal close button and category header interactions to behave consistently across the UI.
28
+ - Toggles for analytics/marketing/functional categories remain clickable even when no cookies are currently detected.
29
+ - Clicking empty category headers no longer shows an extra empty line; only the "Keine Cookies gesetzt" state is displayed.
30
+
31
+ ## [0.1.0] - 2025-07-03
32
+
33
+ ### Added
34
+ - Initial release of fivo_cookie_consent gem
35
+ - Rails Engine implementation with RailsCookiesGdpr namespace
36
+ - GDPR cookie consent banner with German-only text
37
+ - Responsive banner design (bottom-full-width on mobile, bottom-centered max-width on desktop)
38
+ - Cookie consent modal with category toggles
39
+ - localStorage consent storage with expiration
40
+ - Custom event dispatching (`gdpr:accept`, `gdpr:decline`)
41
+ - Configuration system for labels, privacy URL, and cookie lifespan
42
+ - JavaScript ES module for consent management
43
+ - SCSS stylesheet with brand colors (#1E858B, #626465)
44
+ - Rails generator for easy installation
45
+ - Helper method `gdpr_cookie_banner`
46
+ - Comprehensive RSpec + Capybara test suite
47
+ - WCAG-AA compliant design with proper contrast ratios
48
+ - Accessibility features (keyboard navigation, ARIA attributes, focus management)
49
+ - GitLab CI configuration for Ruby 3.2 and 3.3
50
+ - Complete documentation and usage examples
51
+
52
+ ### Features
53
+ - Cookie categories: necessary (always enabled), analytics, marketing, functional
54
+ - Three consent options: "Alle akzeptieren", "Alles ablehnen", "Einstellungen ändern"
55
+ - Modal settings with individual category toggles
56
+ - Automatic consent expiration based on configurable lifespan
57
+ - Event-driven architecture for analytics integration
58
+ - Mobile-first responsive design
59
+ - Clean, modern UI with subtle shadows and animations
60
+ - Support for Rails 7+ with esbuild + jsbundling-rails + sass
61
+
62
+ [Unreleased]: https://github.com/fivo/fivo_cookie_consent/compare/v0.2.0...HEAD
63
+ [0.2.0]: https://github.com/fivo/fivo_cookie_consent/releases/tag/v0.2.0
64
+ [0.1.0]: https://github.com/fivo/fivo_cookie_consent/releases/tag/v0.1.0
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2025 Fivo
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.