Skip to content

Commit 4fe33d1

Browse files
nattb8claude
andcommitted
chore(audience-sample): remove prod-warning banner
Now that all keys route to production there is no test-key mode to contrast against, so the "you're affecting prod data" banner is permanently true and adds noise. Remove it from the UXML, UI bindings, and all related live-fire tests. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent a74fa55 commit 4fe33d1

4 files changed

Lines changed: 3 additions & 41 deletions

File tree

examples/audience/Assets/SampleApp/Resources/AudienceSample.uxml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33

44
<ui:VisualElement name="root" class="root">
55

6-
<ui:Label name="prod-warning" class="prod-warning hidden"
7-
text="⚠ USING PROD ENDPOINT — ACTIONS HERE AFFECT PROD DATA ⚠" />
8-
96
<ui:VisualElement name="sticky-outer" class="sticky-outer">
107
<ui:VisualElement class="sticky-top-main">
118

examples/audience/Assets/SampleApp/Scripts/AudienceSample.UI.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ private static readonly (string TabId, string PanelId)[] Tabs =
7676
// ---- UXML element fields (Tabs + status bar + header) ----
7777

7878
private readonly List<Button> _tabButtons = new List<Button>();
79-
private Label _prodWarning, _sdkVersionLabel, _titleLabel;
79+
private Label _sdkVersionLabel, _titleLabel;
8080
private Label _statusEndpoint, _statusConsent, _statusAnon, _statusUser, _statusSession, _statusQueue;
8181

8282
// ---- UXML element fields (Log pane) ----
@@ -165,7 +165,7 @@ private T Require<T>(string name) where T : VisualElement =>
165165

166166
private void BindElements()
167167
{
168-
_prodWarning = Require<Label>("prod-warning");
168+
169169
_sdkVersionLabel = Require<Label>("sdk-version");
170170
_titleLabel = _root.Q<Label>(className: "title");
171171

@@ -615,7 +615,6 @@ private void RefreshStatusBar()
615615
bool hasOverride = !string.IsNullOrEmpty(overrideUrl);
616616
string? endpoint = hasOverride ? overrideUrl : (keyEmpty ? null : Constants.ProductionBaseUrl);
617617
SetStatusCell(_statusEndpoint, endpoint, hasOverride ? "state-warn" : "state-ok");
618-
_prodWarning.EnableInClassList("hidden", hasOverride || keyEmpty);
619618

620619
var consent = _initialised ? ImmutableAudience.CurrentConsent : ConsentOrder[Mathf.Clamp(_initialConsent?.index ?? 0, 0, ConsentOrder.Length - 1)];
621620
int cIdx = Array.IndexOf(ConsentOrder, consent);

examples/audience/Assets/SampleApp/Tests/Runtime/SampleAppLiveFireTests.cs

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,7 @@ private IEnumerator LoadAndInit(string? initialConsent = null, Action<VisualElem
8787
}
8888

8989
// Scene load + AudienceSample lookup + root capture, without clicking
90-
// btn-init. Useful for tests that need to inspect pre-init UI state
91-
// (e.g. prod-warning visibility for non-test keys).
90+
// btn-init. Useful for tests that need to inspect pre-init UI state.
9291
private IEnumerator LoadSceneOnly()
9392
{
9493
_key = Environment.GetEnvironmentVariable(SampleAppUi.EnvKey) ?? "";
@@ -735,31 +734,5 @@ public IEnumerator IdentityPanel_PopulatesUserIdAfterIdentify()
735734
"identity-user-id label should reflect ImmutableAudience.UserId after Identify");
736735
}
737736

738-
[UnityTest]
739-
public IEnumerator ProdWarning_VisibleForAnyKey()
740-
{
741-
// All keys route to production. The prod-warning banner must be
742-
// visible whenever a key is entered without a BaseUrl override.
743-
yield return LoadSceneOnly();
744-
_root!.Q<TextField>(SampleAppUi.Setup.PublishableKey).value = _key;
745-
yield return null;
746-
747-
Assert.IsFalse(_root.Q<Label>(SampleAppUi.ProdWarning).ClassListContains(SampleAppUi.HiddenClass),
748-
"prod-warning should be visible when a publishable-key is entered");
749-
}
750-
751-
[UnityTest]
752-
public IEnumerator ProdWarning_HiddenWhenBaseUrlOverrideSet()
753-
{
754-
// A BaseUrl override puts the studio in explicit-target mode, so
755-
// the prod-warning is suppressed.
756-
yield return LoadSceneOnly();
757-
_root!.Q<TextField>(SampleAppUi.Setup.PublishableKey).value = _key;
758-
_root!.Q<TextField>(SampleAppUi.Setup.BaseUrl).value = SampleAppUi.ExplicitBaseUrl;
759-
yield return null;
760-
761-
Assert.IsTrue(_root.Q<Label>(SampleAppUi.ProdWarning).ClassListContains(SampleAppUi.HiddenClass),
762-
"prod-warning should be hidden when a BaseUrl override is set");
763-
}
764737
}
765738
}

examples/audience/Assets/SampleApp/Tests/Runtime/SampleAppUi.cs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -127,10 +127,6 @@ internal static class Panels
127127
// it as `root.Q<ScrollView>(SampleAppUi.LogScrollView)`.
128128
internal const string LogScrollView = "log";
129129

130-
// The banner that warns when the publishable key looks like a prod
131-
// key. Toggled via the "hidden" CSS class.
132-
internal const string ProdWarning = "prod-warning";
133-
134130
// Mirrors AudienceSample.UI.cs PopulateTypedEventAccordions naming:
135131
// input.name = $"typed-{spec.Name.Replace('_', '-')}-{field.Key.ToLowerInvariant().Replace('_', '-')}";
136132
internal static string TypedEventField(string specName, string fieldKey) =>
@@ -142,9 +138,6 @@ internal static string TypedEventField(string specName, string fieldKey) =>
142138
// on consent buttons, etc.
143139
internal const string ActiveClass = "active";
144140

145-
// Toggled by RefreshStatusBar on the prod-warning banner.
146-
internal const string HiddenClass = "hidden";
147-
148141
// ---- Log labels ----
149142
// Mirrors AudienceSample.cs: every RunAndLog(label, ...) and
150143
// AppendLog(label, ...) call. Tests await these via WaitForLogEntry.

0 commit comments

Comments
 (0)