Surface regulation and user agent across consent record API layers

Signed-off-by: Émile Ré <emile@getprobo.com>
This commit is contained in:
Émile Ré
2026-05-07 14:59:00 +04:00
parent 806bd672ed
commit 5f4fd3c427
9 changed files with 74 additions and 26 deletions

View File

@@ -103,8 +103,8 @@ type (
ConsentData json.RawMessage
Action coredata.CookieConsentAction
SdkVersion string
Regulation Regulation
CountryCode coredata.CountryCode
Regulation *Regulation
CountryCode *coredata.CountryCode
}
DetectedCookie struct {
@@ -1847,6 +1847,10 @@ func (s *Service) RecordConsent(
CreatedAt: time.Now(),
}
if record.Regulation != nil && *record.Regulation == coredata.RegulationNone {
record.Regulation = nil
}
if err := record.Insert(ctx, tx, scope); err != nil {
return fmt.Errorf("cannot insert consent record: %w", err)
}