@growth-operations/ui-shared 1.3.1 → 1.4.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/package.json +1 -1
- package/src/billing/BillingTab.jsx +27 -1
package/package.json
CHANGED
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
Text,
|
|
7
7
|
Tile,
|
|
8
8
|
LoadingButton,
|
|
9
|
+
Button,
|
|
9
10
|
Alert,
|
|
10
11
|
} from "@hubspot/ui-extensions";
|
|
11
12
|
import { useStrictModeEffect } from "../lib/useStrictModeEffect";
|
|
@@ -339,13 +340,38 @@ function CreditsBilling({ context, state, appKey }) {
|
|
|
339
340
|
);
|
|
340
341
|
}
|
|
341
342
|
|
|
343
|
+
// Legacy (Anvil) installs are billed through their existing subscription, NOT
|
|
344
|
+
// the credit model. Render a calm informational panel — never the credit meter
|
|
345
|
+
// or plan picker, which would falsely tell a paying Anvil customer they're out
|
|
346
|
+
// of credits and push them to buy a credit plan.
|
|
347
|
+
function LegacyBilling({ state }) {
|
|
348
|
+
const manageUrl = state?.legacy_billing_url;
|
|
349
|
+
return (
|
|
350
|
+
<Flex direction="column" gap="medium">
|
|
351
|
+
<Alert title="Managed through your existing subscription" variant="info">
|
|
352
|
+
<Text>
|
|
353
|
+
Your plan and payment method are billed through your existing
|
|
354
|
+
subscription. There's nothing to set up here.
|
|
355
|
+
</Text>
|
|
356
|
+
</Alert>
|
|
357
|
+
{manageUrl && (
|
|
358
|
+
<Button href={{ url: manageUrl, external: true }} variant="secondary">
|
|
359
|
+
Manage subscription
|
|
360
|
+
</Button>
|
|
361
|
+
)}
|
|
362
|
+
</Flex>
|
|
363
|
+
);
|
|
364
|
+
}
|
|
365
|
+
|
|
342
366
|
export function BillingTab({ context, state, appKey }) {
|
|
343
367
|
const mode = state?.entitlement?.mode;
|
|
344
368
|
|
|
345
369
|
return (
|
|
346
370
|
<Flex direction="column" gap="medium">
|
|
347
371
|
<Heading>Billing</Heading>
|
|
348
|
-
{mode === "
|
|
372
|
+
{mode === "legacy" ? (
|
|
373
|
+
<LegacyBilling state={state} />
|
|
374
|
+
) : mode === "credits" ? (
|
|
349
375
|
<CreditsBilling context={context} state={state} appKey={appKey} />
|
|
350
376
|
) : (
|
|
351
377
|
<TrialSubscriptionBilling context={context} state={state} appKey={appKey} />
|