Remove unused available_languages from cookie banner config
The field was populated by the backend and declared in the TS interface but never consumed by any client-side code. The banner resolves its language via detectLanguage() and passes it as a query param. Signed-off-by: Émile Ré <emile@getprobo.com>
This commit is contained in:
@@ -27,9 +27,6 @@ import { detectLanguage } from "./i18n";
|
|||||||
import { enqueue, flush } from "./queue";
|
import { enqueue, flush } from "./queue";
|
||||||
import { getOrCreateVisitorId } from "./visitor";
|
import { getOrCreateVisitorId } from "./visitor";
|
||||||
|
|
||||||
export type { BannerTexts } from "./i18n";
|
|
||||||
export { interpolate } from "./i18n";
|
|
||||||
|
|
||||||
export interface CookieItem {
|
export interface CookieItem {
|
||||||
name: string;
|
name: string;
|
||||||
duration: string;
|
duration: string;
|
||||||
@@ -48,7 +45,6 @@ export interface BannerConfig {
|
|||||||
version: number;
|
version: number;
|
||||||
language: string;
|
language: string;
|
||||||
default_language: string;
|
default_language: string;
|
||||||
available_languages: string[];
|
|
||||||
privacy_policy_url: string;
|
privacy_policy_url: string;
|
||||||
consent_expiry_days: number;
|
consent_expiry_days: number;
|
||||||
consent_mode: "OPT_IN" | "OPT_OUT";
|
consent_mode: "OPT_IN" | "OPT_OUT";
|
||||||
|
|||||||
@@ -130,7 +130,6 @@ type (
|
|||||||
Version int `json:"version"`
|
Version int `json:"version"`
|
||||||
Language string `json:"language"`
|
Language string `json:"language"`
|
||||||
DefaultLanguage string `json:"default_language"`
|
DefaultLanguage string `json:"default_language"`
|
||||||
AvailableLanguages []string `json:"available_languages"`
|
|
||||||
PrivacyPolicyURL string `json:"privacy_policy_url"`
|
PrivacyPolicyURL string `json:"privacy_policy_url"`
|
||||||
ConsentExpiryDays int `json:"consent_expiry_days"`
|
ConsentExpiryDays int `json:"consent_expiry_days"`
|
||||||
ConsentMode string `json:"consent_mode"`
|
ConsentMode string `json:"consent_mode"`
|
||||||
@@ -1707,14 +1706,6 @@ func buildBannerConfig(
|
|||||||
defaultLang = "en"
|
defaultLang = "en"
|
||||||
}
|
}
|
||||||
|
|
||||||
availableLanguages := make([]string, 0, len(snapshot.Translations))
|
|
||||||
for l := range snapshot.Translations {
|
|
||||||
availableLanguages = append(availableLanguages, l)
|
|
||||||
}
|
|
||||||
if len(availableLanguages) == 0 {
|
|
||||||
availableLanguages = []string{defaultLang}
|
|
||||||
}
|
|
||||||
|
|
||||||
resolvedLang := defaultLang
|
resolvedLang := defaultLang
|
||||||
if lang != "" {
|
if lang != "" {
|
||||||
if _, ok := snapshot.Translations[lang]; ok {
|
if _, ok := snapshot.Translations[lang]; ok {
|
||||||
@@ -1748,7 +1739,6 @@ func buildBannerConfig(
|
|||||||
Version: version.Version,
|
Version: version.Version,
|
||||||
Language: resolvedLang,
|
Language: resolvedLang,
|
||||||
DefaultLanguage: defaultLang,
|
DefaultLanguage: defaultLang,
|
||||||
AvailableLanguages: availableLanguages,
|
|
||||||
PrivacyPolicyURL: snapshot.PrivacyPolicyURL,
|
PrivacyPolicyURL: snapshot.PrivacyPolicyURL,
|
||||||
ConsentExpiryDays: snapshot.ConsentExpiryDays,
|
ConsentExpiryDays: snapshot.ConsentExpiryDays,
|
||||||
ConsentMode: snapshot.ConsentMode,
|
ConsentMode: snapshot.ConsentMode,
|
||||||
|
|||||||
Reference in New Issue
Block a user