@homebound/beam 3.31.2 → 3.32.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.
package/dist/index.d.cts CHANGED
@@ -6205,11 +6205,20 @@ type ImpersonatedUser = {
6205
6205
  type EnvironmentBannerProps = {
6206
6206
  env: AppEnvironment;
6207
6207
  impersonating?: ImpersonatedUser;
6208
+ /**
6209
+ * Shows the production warning banner; typically set to `true` only for developers in the consuming app.
6210
+ * Its styling takes precedence over impersonation (red fill + prod warning copy, with impersonation still
6211
+ * shown on the right).
6212
+ */
6213
+ showProdWarning?: boolean;
6208
6214
  };
6209
6215
  /** Environment banner; horizontal/vertical pinning is owned by {@link EnvironmentBannerLayout}. */
6210
6216
  declare function EnvironmentBanner(props: EnvironmentBannerProps): JSX.Element | null;
6211
- /** True when {@link EnvironmentBanner} should display: `dev`, `qa`, `local-prod`, or `prod` while impersonating. */
6212
- declare function shouldShowEnvironmentBanner(env: AppEnvironment, impersonating: ImpersonatedUser | undefined): boolean;
6217
+ /**
6218
+ * True when {@link EnvironmentBanner} should display: `dev`, `qa`, `local-prod`, or `prod` while impersonating
6219
+ * or when `showProdWarning` is set (typically only for developers in the consuming app).
6220
+ */
6221
+ declare function shouldShowEnvironmentBanner(env: AppEnvironment, impersonating: ImpersonatedUser | undefined, showProdWarning: boolean): boolean;
6213
6222
  /** Fixed banner height (px); {@link EnvironmentBannerLayout} reads this for spacer/CSS var offsets. */
6214
6223
  declare const environmentBannerSizePx = 34;
6215
6224
 
package/dist/index.d.ts CHANGED
@@ -6205,11 +6205,20 @@ type ImpersonatedUser = {
6205
6205
  type EnvironmentBannerProps = {
6206
6206
  env: AppEnvironment;
6207
6207
  impersonating?: ImpersonatedUser;
6208
+ /**
6209
+ * Shows the production warning banner; typically set to `true` only for developers in the consuming app.
6210
+ * Its styling takes precedence over impersonation (red fill + prod warning copy, with impersonation still
6211
+ * shown on the right).
6212
+ */
6213
+ showProdWarning?: boolean;
6208
6214
  };
6209
6215
  /** Environment banner; horizontal/vertical pinning is owned by {@link EnvironmentBannerLayout}. */
6210
6216
  declare function EnvironmentBanner(props: EnvironmentBannerProps): JSX.Element | null;
6211
- /** True when {@link EnvironmentBanner} should display: `dev`, `qa`, `local-prod`, or `prod` while impersonating. */
6212
- declare function shouldShowEnvironmentBanner(env: AppEnvironment, impersonating: ImpersonatedUser | undefined): boolean;
6217
+ /**
6218
+ * True when {@link EnvironmentBanner} should display: `dev`, `qa`, `local-prod`, or `prod` while impersonating
6219
+ * or when `showProdWarning` is set (typically only for developers in the consuming app).
6220
+ */
6221
+ declare function shouldShowEnvironmentBanner(env: AppEnvironment, impersonating: ImpersonatedUser | undefined, showProdWarning: boolean): boolean;
6213
6222
  /** Fixed banner height (px); {@link EnvironmentBannerLayout} reads this for spacer/CSS var offsets. */
6214
6223
  declare const environmentBannerSizePx = 34;
6215
6224
 
package/dist/index.js CHANGED
@@ -21845,10 +21845,11 @@ function EnvironmentBanner(props) {
21845
21845
  const {
21846
21846
  env,
21847
21847
  impersonating,
21848
+ showProdWarning = false,
21848
21849
  ...others
21849
21850
  } = props;
21850
21851
  const tid = useTestIds(others, "environmentBanner");
21851
- if (!shouldShowEnvironmentBanner(env, impersonating)) {
21852
+ if (!shouldShowEnvironmentBanner(env, impersonating, showProdWarning)) {
21852
21853
  return null;
21853
21854
  }
21854
21855
  const {
@@ -21856,7 +21857,7 @@ function EnvironmentBanner(props) {
21856
21857
  badgeLabel,
21857
21858
  message,
21858
21859
  tooltip
21859
- } = getEnvironmentBannerConfig(env, impersonating);
21860
+ } = getEnvironmentBannerConfig(env, impersonating, showProdWarning);
21860
21861
  const bgColorVar = maybeCssVar(bgColor);
21861
21862
  return /* @__PURE__ */ jsxs84("div", { ...trussProps83({
21862
21863
  flexShrink: "fs0",
@@ -21899,7 +21900,7 @@ function EnvironmentBanner(props) {
21899
21900
  ] })
21900
21901
  ] }),
21901
21902
  impersonating != null && /* @__PURE__ */ jsxs84("span", { className: "df aic gap2 fw6 fz_12px lh_16px white fs0", ...tid.impersonating, children: [
21902
- env !== "prod" && /* @__PURE__ */ jsxs84("span", { children: [
21903
+ (env !== "prod" || showProdWarning) && /* @__PURE__ */ jsxs84("span", { children: [
21903
21904
  /* @__PURE__ */ jsx166("span", { className: "dn mdandup_dib", children: "Impersonating \xA0" }),
21904
21905
  impersonating.name
21905
21906
  ] }),
@@ -21908,10 +21909,10 @@ function EnvironmentBanner(props) {
21908
21909
  ] })
21909
21910
  ] });
21910
21911
  }
21911
- function shouldShowEnvironmentBanner(env, impersonating) {
21912
- return env === "dev" || env === "qa" || env === "local-prod" || env === "prod" && isDefined(impersonating);
21912
+ function shouldShowEnvironmentBanner(env, impersonating, showProdWarning) {
21913
+ return env === "dev" || env === "qa" || env === "local-prod" || env === "prod" && (isDefined(impersonating) || showProdWarning);
21913
21914
  }
21914
- function getEnvironmentBannerConfig(env, impersonating) {
21915
+ function getEnvironmentBannerConfig(env, impersonating, showProdWarning) {
21915
21916
  switch (env) {
21916
21917
  case "dev":
21917
21918
  return {
@@ -21927,9 +21928,16 @@ function getEnvironmentBannerConfig(env, impersonating) {
21927
21928
  message: "You are in the QA Environment",
21928
21929
  tooltip: "You are in the QA Environment. Any changes here will not be reflected in live production data."
21929
21930
  };
21930
- // Prod env banner should only be displayed when impersonating
21931
+ // Prod banner shows when impersonating or when `showProdWarning` is set. The prod warning takes precedence:
21932
+ // it reuses the red local-prod fill for "live prod data" urgency, while impersonation (if any) still shows
21933
+ // on the right. Impersonation alone keeps its own prod fill and copy.
21931
21934
  case "prod":
21932
- return {
21935
+ return showProdWarning ? {
21936
+ bgColor: "--b-env-brand-local-prod" /* EnvBrandLocalProd */,
21937
+ badgeLabel: "PROD",
21938
+ message: "You are in the Production Environment",
21939
+ tooltip: "You are in the Production Environment. Any changes here WILL be reflected in live production data."
21940
+ } : {
21933
21941
  bgColor: "--b-env-brand-prod" /* EnvBrandProd */,
21934
21942
  badgeLabel: "PROD",
21935
21943
  message: `You are impersonating ${impersonating?.name}`,
@@ -24160,7 +24168,7 @@ function EnvironmentBannerLayout(props) {
24160
24168
  children
24161
24169
  } = props;
24162
24170
  const tid = useTestIds(props, "environmentBannerLayout");
24163
- const showBanner = environmentBanner != null && shouldShowEnvironmentBanner(environmentBanner.env, environmentBanner.impersonating);
24171
+ const showBanner = environmentBanner != null && shouldShowEnvironmentBanner(environmentBanner.env, environmentBanner.impersonating, environmentBanner.showProdWarning ?? false);
24164
24172
  const bannerHeightPx = showBanner ? environmentBannerSizePx : 0;
24165
24173
  const style = {
24166
24174
  [beamEnvironmentBannerLayoutHeightVar]: `${bannerHeightPx}px`