@growth-operations/ui-shared 1.17.0 → 1.17.2
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/package.json
CHANGED
|
@@ -41,7 +41,15 @@ import { resolveBillingBanner } from "../lib/creditDisplay";
|
|
|
41
41
|
// omit it to render the banner with no in-app button.
|
|
42
42
|
// context — the UI-extension serverless context (optional; only used
|
|
43
43
|
// for the portal link's return URL portal id).
|
|
44
|
-
|
|
44
|
+
// currentPath — the host's current route path (optional). When the resolved
|
|
45
|
+
// CTA is the in-app billing-navigation CTA (kind "billing")
|
|
46
|
+
// and currentPath is "/billing", the button is suppressed —
|
|
47
|
+
// it would just reload the page the user is already on. The
|
|
48
|
+
// banner text still renders (it's informative on Billing too),
|
|
49
|
+
// and the external portal CTA (kind "portal") is NOT
|
|
50
|
+
// suppressed. Omitting the prop keeps the legacy behavior
|
|
51
|
+
// (button always rendered), so non-updated hosts don't break.
|
|
52
|
+
export function BillingBanner({ state, actionLabel, actionsNoun, onNavigate, context, currentPath }) {
|
|
45
53
|
const banner = resolveBillingBanner(state?.entitlement, {
|
|
46
54
|
actionLabel,
|
|
47
55
|
actionsNoun,
|
|
@@ -70,6 +78,12 @@ export function BillingBanner({ state, actionLabel, actionsNoun, onNavigate, con
|
|
|
70
78
|
}
|
|
71
79
|
}
|
|
72
80
|
|
|
81
|
+
// Suppress the in-app billing-navigation CTA on the Billing page itself —
|
|
82
|
+
// there it would just reload the current route. Only the kind "billing"
|
|
83
|
+
// (in-app navigate) CTA is suppressed; the external portal CTA stays.
|
|
84
|
+
const suppressInAppCta =
|
|
85
|
+
currentPath === "/billing" && banner.cta && banner.cta.kind !== "portal";
|
|
86
|
+
|
|
73
87
|
return (
|
|
74
88
|
<Alert title={banner.title} variant={banner.variant}>
|
|
75
89
|
<Flex direction="column" gap="extra-small">
|
|
@@ -81,7 +95,7 @@ export function BillingBanner({ state, actionLabel, actionsNoun, onNavigate, con
|
|
|
81
95
|
>
|
|
82
96
|
{banner.cta.label}
|
|
83
97
|
</Button>
|
|
84
|
-
) : banner.cta && onNavigate ? (
|
|
98
|
+
) : !suppressInAppCta && banner.cta && onNavigate ? (
|
|
85
99
|
<Button variant="secondary" onClick={() => onNavigate("/billing")}>
|
|
86
100
|
{banner.cta.kind === "portal" ? "Go to Billing →" : banner.cta.label}
|
|
87
101
|
</Button>
|
package/src/lib/creditDisplay.js
CHANGED
|
@@ -129,7 +129,7 @@ export function resolveCreditMeter(entitlement, creditMeter) {
|
|
|
129
129
|
title: "You're out of credits",
|
|
130
130
|
message: onPaidPlan
|
|
131
131
|
? "Actions are paused until your next billing period or a successful top-up."
|
|
132
|
-
: "
|
|
132
|
+
: "Choose a plan to resume your use.",
|
|
133
133
|
};
|
|
134
134
|
} else if (thresholdState === "top_up_failed") {
|
|
135
135
|
alert = {
|