@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.cjs CHANGED
@@ -22305,10 +22305,11 @@ function EnvironmentBanner(props) {
22305
22305
  const {
22306
22306
  env,
22307
22307
  impersonating,
22308
+ showProdWarning = false,
22308
22309
  ...others
22309
22310
  } = props;
22310
22311
  const tid = useTestIds(others, "environmentBanner");
22311
- if (!shouldShowEnvironmentBanner(env, impersonating)) {
22312
+ if (!shouldShowEnvironmentBanner(env, impersonating, showProdWarning)) {
22312
22313
  return null;
22313
22314
  }
22314
22315
  const {
@@ -22316,7 +22317,7 @@ function EnvironmentBanner(props) {
22316
22317
  badgeLabel,
22317
22318
  message,
22318
22319
  tooltip
22319
- } = getEnvironmentBannerConfig(env, impersonating);
22320
+ } = getEnvironmentBannerConfig(env, impersonating, showProdWarning);
22320
22321
  const bgColorVar = maybeCssVar(bgColor);
22321
22322
  return /* @__PURE__ */ (0, import_jsx_runtime166.jsxs)("div", { ...(0, import_runtime90.trussProps)({
22322
22323
  flexShrink: "fs0",
@@ -22359,7 +22360,7 @@ function EnvironmentBanner(props) {
22359
22360
  ] })
22360
22361
  ] }),
22361
22362
  impersonating != null && /* @__PURE__ */ (0, import_jsx_runtime166.jsxs)("span", { className: "df aic gap2 fw6 fz_12px lh_16px white fs0", ...tid.impersonating, children: [
22362
- env !== "prod" && /* @__PURE__ */ (0, import_jsx_runtime166.jsxs)("span", { children: [
22363
+ (env !== "prod" || showProdWarning) && /* @__PURE__ */ (0, import_jsx_runtime166.jsxs)("span", { children: [
22363
22364
  /* @__PURE__ */ (0, import_jsx_runtime166.jsx)("span", { className: "dn mdandup_dib", children: "Impersonating \xA0" }),
22364
22365
  impersonating.name
22365
22366
  ] }),
@@ -22368,10 +22369,10 @@ function EnvironmentBanner(props) {
22368
22369
  ] })
22369
22370
  ] });
22370
22371
  }
22371
- function shouldShowEnvironmentBanner(env, impersonating) {
22372
- return env === "dev" || env === "qa" || env === "local-prod" || env === "prod" && isDefined(impersonating);
22372
+ function shouldShowEnvironmentBanner(env, impersonating, showProdWarning) {
22373
+ return env === "dev" || env === "qa" || env === "local-prod" || env === "prod" && (isDefined(impersonating) || showProdWarning);
22373
22374
  }
22374
- function getEnvironmentBannerConfig(env, impersonating) {
22375
+ function getEnvironmentBannerConfig(env, impersonating, showProdWarning) {
22375
22376
  switch (env) {
22376
22377
  case "dev":
22377
22378
  return {
@@ -22387,9 +22388,16 @@ function getEnvironmentBannerConfig(env, impersonating) {
22387
22388
  message: "You are in the QA Environment",
22388
22389
  tooltip: "You are in the QA Environment. Any changes here will not be reflected in live production data."
22389
22390
  };
22390
- // Prod env banner should only be displayed when impersonating
22391
+ // Prod banner shows when impersonating or when `showProdWarning` is set. The prod warning takes precedence:
22392
+ // it reuses the red local-prod fill for "live prod data" urgency, while impersonation (if any) still shows
22393
+ // on the right. Impersonation alone keeps its own prod fill and copy.
22391
22394
  case "prod":
22392
- return {
22395
+ return showProdWarning ? {
22396
+ bgColor: "--b-env-brand-local-prod" /* EnvBrandLocalProd */,
22397
+ badgeLabel: "PROD",
22398
+ message: "You are in the Production Environment",
22399
+ tooltip: "You are in the Production Environment. Any changes here WILL be reflected in live production data."
22400
+ } : {
22393
22401
  bgColor: "--b-env-brand-prod" /* EnvBrandProd */,
22394
22402
  badgeLabel: "PROD",
22395
22403
  message: `You are impersonating ${impersonating?.name}`,
@@ -24612,7 +24620,7 @@ function EnvironmentBannerLayout(props) {
24612
24620
  children
24613
24621
  } = props;
24614
24622
  const tid = useTestIds(props, "environmentBannerLayout");
24615
- const showBanner = environmentBanner != null && shouldShowEnvironmentBanner(environmentBanner.env, environmentBanner.impersonating);
24623
+ const showBanner = environmentBanner != null && shouldShowEnvironmentBanner(environmentBanner.env, environmentBanner.impersonating, environmentBanner.showProdWarning ?? false);
24616
24624
  const bannerHeightPx = showBanner ? environmentBannerSizePx : 0;
24617
24625
  const style = {
24618
24626
  [beamEnvironmentBannerLayoutHeightVar]: `${bannerHeightPx}px`