Derive consent mode from geolocation, not banner config

The consent mode is now determined dynamically by the visitor's
country and its applicable regulation. The configured consent_mode
column is dropped from cookie_banners and added to
cookie_consent_records to persist the geo-derived mode at
consent-recording time. When no regulation matches, the default
is OPT_OUT.

Signed-off-by: Émile Ré <emile@getprobo.com>
This commit is contained in:
Émile Ré
2026-05-13 12:17:34 +04:00
parent e9d786c5d6
commit e739473bcd
30 changed files with 68 additions and 246 deletions

View File

@@ -4720,7 +4720,6 @@ func (r *Resolver) AddCookieBannerTool(ctx context.Context, req *mcp.CallToolReq
PrivacyPolicyURL: input.PrivacyPolicyURL,
CookiePolicyURL: input.CookiePolicyURL,
ConsentExpiryDays: input.ConsentExpiryDays,
ConsentMode: coredata.CookieConsentMode(input.ConsentMode),
})
if err != nil {
return nil, types.AddCookieBannerOutput{}, fmt.Errorf("cannot create cookie banner: %w", err)
@@ -4745,10 +4744,6 @@ func (r *Resolver) UpdateCookieBannerTool(ctx context.Context, req *mcp.CallTool
if v := UnwrapOmittable(input.ConsentExpiryDays); v != nil && *v != nil {
updateReq.ConsentExpiryDays = *v
}
if v := UnwrapOmittable(input.ConsentMode); v != nil && *v != nil {
mode := coredata.CookieConsentMode(**v)
updateReq.ConsentMode = &mode
}
if v := UnwrapOmittable(input.DefaultLanguage); v != nil && *v != nil {
updateReq.DefaultLanguage = *v
}

View File

@@ -9311,7 +9311,6 @@ components:
- state
- cookie_policy_url
- consent_expiry_days
- consent_mode
- show_branding
- default_language
- created_at
@@ -9344,10 +9343,6 @@ components:
consent_expiry_days:
type: integer
description: Days until consent expires
consent_mode:
type: string
enum: [OPT_IN, OPT_OUT]
description: Consent mode
show_branding:
type: boolean
description: Whether to show Probo branding
@@ -9726,7 +9721,6 @@ components:
- origin
- cookie_policy_url
- consent_expiry_days
- consent_mode
properties:
organization_id:
$ref: "#/components/schemas/GID"
@@ -9746,10 +9740,6 @@ components:
consent_expiry_days:
type: integer
description: Days until consent expires
consent_mode:
type: string
enum: [OPT_IN, OPT_OUT]
description: Consent mode
AddCookieBannerOutput:
type: object
@@ -9787,11 +9777,6 @@ components:
- integer
- "null"
go.probo.inc/mcpgen/omittable: true
consent_mode:
type:
- string
- "null"
go.probo.inc/mcpgen/omittable: true
default_language:
type:
- string

View File

@@ -29,7 +29,6 @@ func NewCookieBanner(b *coredata.CookieBanner) *CookieBanner {
PrivacyPolicyURL: b.PrivacyPolicyURL,
CookiePolicyURL: b.CookiePolicyURL,
ConsentExpiryDays: b.ConsentExpiryDays,
ConsentMode: CookieBannerConsentMode(b.ConsentMode),
ShowBranding: b.ShowBranding,
DefaultLanguage: b.DefaultLanguage,
CreatedAt: b.CreatedAt,