@stigmer/react 3.39.0 → 3.40.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/billing/AutoRechargeCard.js +1 -1
- package/billing/AutoRechargeCard.js.map +1 -1
- package/billing/BillingSection.d.ts +18 -1
- package/billing/BillingSection.d.ts.map +1 -1
- package/billing/BillingSection.js +21 -11
- package/billing/BillingSection.js.map +1 -1
- package/billing/ChangePlanDialog.d.ts +46 -0
- package/billing/ChangePlanDialog.d.ts.map +1 -0
- package/billing/ChangePlanDialog.js +90 -0
- package/billing/ChangePlanDialog.js.map +1 -0
- package/billing/CreditPackGrid.d.ts +1 -1
- package/billing/CreditPackGrid.js +1 -1
- package/billing/LowBalanceBanner.js +1 -1
- package/billing/LowBalanceBanner.js.map +1 -1
- package/billing/PaymentMethodCard.d.ts +9 -1
- package/billing/PaymentMethodCard.d.ts.map +1 -1
- package/billing/PaymentMethodCard.js +2 -2
- package/billing/PaymentMethodCard.js.map +1 -1
- package/billing/PlanCard.d.ts +27 -0
- package/billing/PlanCard.d.ts.map +1 -0
- package/billing/PlanCard.js +68 -0
- package/billing/PlanCard.js.map +1 -0
- package/billing/PlanPicker.d.ts +34 -0
- package/billing/PlanPicker.d.ts.map +1 -0
- package/billing/PlanPicker.js +46 -0
- package/billing/PlanPicker.js.map +1 -0
- package/billing/PlanSection.d.ts +45 -0
- package/billing/PlanSection.d.ts.map +1 -0
- package/billing/PlanSection.js +136 -0
- package/billing/PlanSection.js.map +1 -0
- package/billing/UpgradeNotice.d.ts +47 -0
- package/billing/UpgradeNotice.d.ts.map +1 -0
- package/billing/UpgradeNotice.js +49 -0
- package/billing/UpgradeNotice.js.map +1 -0
- package/billing/credit-packs.d.ts.map +1 -1
- package/billing/credit-packs.js +4 -1
- package/billing/credit-packs.js.map +1 -1
- package/billing/index.d.ts +26 -1
- package/billing/index.d.ts.map +1 -1
- package/billing/index.js +12 -0
- package/billing/index.js.map +1 -1
- package/billing/plan-features.d.ts +60 -0
- package/billing/plan-features.d.ts.map +1 -0
- package/billing/plan-features.js +128 -0
- package/billing/plan-features.js.map +1 -0
- package/billing/plan-state.d.ts +43 -0
- package/billing/plan-state.d.ts.map +1 -0
- package/billing/plan-state.js +69 -0
- package/billing/plan-state.js.map +1 -0
- package/billing/redirect.d.ts +31 -0
- package/billing/redirect.d.ts.map +1 -0
- package/billing/redirect.js +30 -0
- package/billing/redirect.js.map +1 -0
- package/billing/useBillingAccount.d.ts +10 -1
- package/billing/useBillingAccount.d.ts.map +1 -1
- package/billing/useBillingAccount.js +2 -2
- package/billing/useBillingAccount.js.map +1 -1
- package/billing/useChangePlan.d.ts +51 -0
- package/billing/useChangePlan.d.ts.map +1 -0
- package/billing/useChangePlan.js +61 -0
- package/billing/useChangePlan.js.map +1 -0
- package/billing/useCreateBillingPortalSession.d.ts +6 -3
- package/billing/useCreateBillingPortalSession.d.ts.map +1 -1
- package/billing/useCreateBillingPortalSession.js +11 -4
- package/billing/useCreateBillingPortalSession.js.map +1 -1
- package/billing/useCreateCheckoutSession.d.ts +7 -5
- package/billing/useCreateCheckoutSession.d.ts.map +1 -1
- package/billing/useCreateCheckoutSession.js +5 -3
- package/billing/useCreateCheckoutSession.js.map +1 -1
- package/billing/useCreatePaymentMethodSetupSession.d.ts +28 -0
- package/billing/useCreatePaymentMethodSetupSession.d.ts.map +1 -0
- package/billing/useCreatePaymentMethodSetupSession.js +50 -0
- package/billing/useCreatePaymentMethodSetupSession.js.map +1 -0
- package/billing/useEntitlements.d.ts +46 -0
- package/billing/useEntitlements.d.ts.map +1 -0
- package/billing/useEntitlements.js +37 -0
- package/billing/useEntitlements.js.map +1 -0
- package/billing/usePeriodEstimate.d.ts +35 -0
- package/billing/usePeriodEstimate.d.ts.map +1 -0
- package/billing/usePeriodEstimate.js +29 -0
- package/billing/usePeriodEstimate.js.map +1 -0
- package/billing/usePlans.d.ts +38 -0
- package/billing/usePlans.d.ts.map +1 -0
- package/billing/usePlans.js +33 -0
- package/billing/usePlans.js.map +1 -0
- package/billing/useSubscription.d.ts +39 -0
- package/billing/useSubscription.d.ts.map +1 -0
- package/billing/useSubscription.js +40 -0
- package/billing/useSubscription.js.map +1 -0
- package/index.d.ts +4 -2
- package/index.d.ts.map +1 -1
- package/index.js +4 -1
- package/index.js.map +1 -1
- package/internal/features.d.ts +11 -0
- package/internal/features.d.ts.map +1 -0
- package/internal/features.js +42 -0
- package/internal/features.js.map +1 -0
- package/licenses/license-format.d.ts +5 -3
- package/licenses/license-format.d.ts.map +1 -1
- package/licenses/license-format.js +10 -19
- package/licenses/license-format.js.map +1 -1
- package/package.json +5 -5
- package/plan-catalog/PlanCatalogConsole.d.ts +22 -0
- package/plan-catalog/PlanCatalogConsole.d.ts.map +1 -0
- package/plan-catalog/PlanCatalogConsole.js +90 -0
- package/plan-catalog/PlanCatalogConsole.js.map +1 -0
- package/plan-catalog/PlanCreateForm.d.ts +17 -0
- package/plan-catalog/PlanCreateForm.d.ts.map +1 -0
- package/plan-catalog/PlanCreateForm.js +52 -0
- package/plan-catalog/PlanCreateForm.js.map +1 -0
- package/plan-catalog/PlansAccessNotice.d.ts +10 -0
- package/plan-catalog/PlansAccessNotice.d.ts.map +1 -0
- package/plan-catalog/PlansAccessNotice.js +13 -0
- package/plan-catalog/PlansAccessNotice.js.map +1 -0
- package/plan-catalog/index.d.ts +8 -0
- package/plan-catalog/index.d.ts.map +1 -0
- package/plan-catalog/index.js +10 -0
- package/plan-catalog/index.js.map +1 -0
- package/plan-catalog/plan-draft.d.ts +30 -0
- package/plan-catalog/plan-draft.d.ts.map +1 -0
- package/plan-catalog/plan-draft.js +91 -0
- package/plan-catalog/plan-draft.js.map +1 -0
- package/plan-catalog/usePlanMutations.d.ts +42 -0
- package/plan-catalog/usePlanMutations.d.ts.map +1 -0
- package/plan-catalog/usePlanMutations.js +57 -0
- package/plan-catalog/usePlanMutations.js.map +1 -0
- package/settings/TeamsSection.d.ts.map +1 -1
- package/settings/TeamsSection.js +19 -2
- package/settings/TeamsSection.js.map +1 -1
- package/settings/settings-nav.d.ts.map +1 -1
- package/settings/settings-nav.js +7 -1
- package/settings/settings-nav.js.map +1 -1
- package/settings/useSettingsNavGroups.d.ts.map +1 -1
- package/settings/useSettingsNavGroups.js +4 -1
- package/settings/useSettingsNavGroups.js.map +1 -1
- package/src/billing/AutoRechargeCard.tsx +2 -2
- package/src/billing/BillingSection.tsx +68 -11
- package/src/billing/ChangePlanDialog.tsx +221 -0
- package/src/billing/CreditPackGrid.tsx +1 -1
- package/src/billing/LowBalanceBanner.tsx +1 -1
- package/src/billing/PaymentMethodCard.tsx +28 -2
- package/src/billing/PlanCard.tsx +171 -0
- package/src/billing/PlanPicker.tsx +178 -0
- package/src/billing/PlanSection.tsx +234 -0
- package/src/billing/UpgradeNotice.tsx +95 -0
- package/src/billing/credit-packs.ts +4 -1
- package/src/billing/index.ts +26 -1
- package/src/billing/plan-features.ts +162 -0
- package/src/billing/plan-state.ts +92 -0
- package/src/billing/redirect.ts +45 -0
- package/src/billing/useBillingAccount.ts +12 -0
- package/src/billing/useChangePlan.ts +115 -0
- package/src/billing/useCreateBillingPortalSession.ts +17 -6
- package/src/billing/useCreateCheckoutSession.ts +12 -7
- package/src/billing/useCreatePaymentMethodSetupSession.ts +77 -0
- package/src/billing/useEntitlements.ts +80 -0
- package/src/billing/usePeriodEstimate.ts +59 -0
- package/src/billing/usePlans.ts +65 -0
- package/src/billing/useSubscription.ts +70 -0
- package/src/index.ts +54 -0
- package/src/internal/features.ts +49 -0
- package/src/licenses/license-format.ts +10 -19
- package/src/plan-catalog/PlanCatalogConsole.tsx +197 -0
- package/src/plan-catalog/PlanCreateForm.tsx +167 -0
- package/src/plan-catalog/PlansAccessNotice.tsx +20 -0
- package/src/plan-catalog/index.ts +14 -0
- package/src/plan-catalog/plan-draft.ts +116 -0
- package/src/plan-catalog/usePlanMutations.ts +94 -0
- package/src/settings/TeamsSection.tsx +20 -2
- package/src/settings/settings-nav.ts +7 -0
- package/src/settings/useSettingsNavGroups.ts +8 -1
- package/src/team/CreateTeamForm.tsx +12 -3
- package/src/team/TeamMembersPanel.tsx +6 -2
- package/team/CreateTeamForm.d.ts +6 -1
- package/team/CreateTeamForm.d.ts.map +1 -1
- package/team/CreateTeamForm.js +4 -2
- package/team/CreateTeamForm.js.map +1 -1
- package/team/TeamMembersPanel.d.ts.map +1 -1
- package/team/TeamMembersPanel.js +3 -1
- package/team/TeamMembersPanel.js.map +1 -1
|
@@ -80,7 +80,7 @@ export function AutoRechargeCard({ orgId, autoRecharge, hasPaymentMethod, accoun
|
|
|
80
80
|
// error state is managed by the hook
|
|
81
81
|
}
|
|
82
82
|
}, [orgId, enabled, threshold, amount, cap, setConfig, clearError, onSaved]);
|
|
83
|
-
return (_jsxs("div", { className: cn("stg:rounded-lg stg:border stg:border-border stg:bg-card stg:px-4 stg:py-4", className), children: [_jsxs("div", { className: "stg:flex stg:items-center stg:justify-between", children: [_jsxs("div", { children: [_jsx("h3", { className: "stg:text-xs stg:font-semibold stg:text-foreground", children: "Auto-Recharge" }), _jsx("p", { className: "stg:mt-0.5 stg:text-[0.7rem] stg:text-muted-foreground", children: "Automatically add credits when your balance runs low." })] }), _jsx("button", { type: "button", role: "switch", "aria-checked": enabled, disabled: !canConfigure || isSubmitting, onClick: () => setEnabled((prev) => !prev), className: cn("stg:relative stg:inline-flex stg:h-5 stg:w-9 stg:shrink-0 stg:rounded-full stg:transition-colors", "stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring", "stg:disabled:cursor-not-allowed stg:disabled:opacity-50", enabled ? "stg:bg-primary" : "stg:bg-muted"), children: _jsx("span", { className: cn("stg:pointer-events-none stg:block stg:size-4 stg:rounded-full stg:bg-background stg:shadow-sm stg:ring-0 stg:transition-transform", enabled ? "stg:translate-x-4" : "stg:translate-x-0.5", "stg:mt-0.5") }) })] }), !hasPaymentMethod && (_jsx("p", { className: "stg:mt-3 stg:text-xs stg:text-muted-foreground", children: "A saved payment method is required to enable auto-recharge.
|
|
83
|
+
return (_jsxs("div", { className: cn("stg:rounded-lg stg:border stg:border-border stg:bg-card stg:px-4 stg:py-4", className), children: [_jsxs("div", { className: "stg:flex stg:items-center stg:justify-between", children: [_jsxs("div", { children: [_jsx("h3", { className: "stg:text-xs stg:font-semibold stg:text-foreground", children: "Auto-Recharge" }), _jsx("p", { className: "stg:mt-0.5 stg:text-[0.7rem] stg:text-muted-foreground", children: "Automatically add credits when your balance runs low." })] }), _jsx("button", { type: "button", role: "switch", "aria-checked": enabled, disabled: !canConfigure || isSubmitting, onClick: () => setEnabled((prev) => !prev), className: cn("stg:relative stg:inline-flex stg:h-5 stg:w-9 stg:shrink-0 stg:rounded-full stg:transition-colors", "stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring", "stg:disabled:cursor-not-allowed stg:disabled:opacity-50", enabled ? "stg:bg-primary" : "stg:bg-muted"), children: _jsx("span", { className: cn("stg:pointer-events-none stg:block stg:size-4 stg:rounded-full stg:bg-background stg:shadow-sm stg:ring-0 stg:transition-transform", enabled ? "stg:translate-x-4" : "stg:translate-x-0.5", "stg:mt-0.5") }) })] }), !hasPaymentMethod && (_jsx("p", { className: "stg:mt-3 stg:text-xs stg:text-muted-foreground", children: "A saved payment method is required to enable auto-recharge. Add one under Payment Method." })), canConfigure && (_jsxs("div", { className: "stg:mt-4 stg:space-y-3", children: [_jsx(DollarInput, { id: `${baseId}-threshold`, label: "When balance drops below", value: threshold, onChange: setThreshold, disabled: isSubmitting, placeholder: "e.g. 5" }), _jsx(DollarInput, { id: `${baseId}-amount`, label: "Recharge amount", value: amount, onChange: setAmount, disabled: isSubmitting, placeholder: "e.g. 50" }), _jsx(DollarInput, { id: `${baseId}-cap`, label: "Monthly cap", value: cap, onChange: setCap, disabled: isSubmitting, placeholder: "e.g. 200" }), _jsxs("div", { className: "stg:flex stg:items-center stg:gap-3 stg:pt-1", children: [_jsx("button", { type: "button", disabled: !hasChanges || isSubmitting, onClick: handleSave, className: cn("stg:rounded-md stg:px-3 stg:py-1.5 stg:text-xs stg:font-medium stg:transition-colors", "stg:bg-primary stg:text-primary-foreground stg:hover:bg-primary-hover", "stg:disabled:pointer-events-none stg:disabled:opacity-50"), "aria-busy": isSubmitting, children: isSubmitting ? "Saving\u2026" : "Save" }), saved && (_jsx("span", { className: "stg:text-xs stg:text-emerald-600 stg:dark:text-emerald-400", children: "Saved" }))] }), error && (_jsx("p", { className: "stg:text-xs stg:text-destructive", role: "alert", children: getUserMessage(error) }))] }))] }));
|
|
84
84
|
}
|
|
85
85
|
// ---------------------------------------------------------------------------
|
|
86
86
|
// DollarInput (internal)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AutoRechargeCard.js","sourceRoot":"","sources":["../src/billing/AutoRechargeCard.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAChE,OAAO,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AAEpC,OAAO,EAAE,oBAAoB,EAAE,MAAM,+CAA+C,CAAC;AACrF,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AAkBzE,MAAM,iBAAiB,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC;AAE5C,SAAS,eAAe,CAAC,MAAc;IACrC,IAAI,MAAM,KAAK,MAAM,CAAC,CAAC,CAAC;QAAE,OAAO,EAAE,CAAC;IACpC,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,GAAG,SAAS,CAAC;IAC3C,OAAO,OAAO,CAAC,QAAQ,EAAE,CAAC;AAC5B,CAAC;AAED,SAAS,eAAe,CAAC,KAAa;IACpC,MAAM,GAAG,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC;IAC9B,IAAI,KAAK,CAAC,GAAG,CA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AAS,WAAW,CAAC,EACnB,EAAE,EACF,KAAK,EACL,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,WAAW,GAQZ;IACC,OAAO,CACL,0BACE,gBAAO,OAAO,EAAE,EAAE,EAAE,SAAS,EAAC,iDAAiD,YAC5E,KAAK,GACA,EACR,eAAK,SAAS,EAAC,uBAAuB,aACpC,eAAM,SAAS,EAAC,0HAA0H,kBAEnI,EACP,gBACE,EAAE,EAAE,EAAE,EACN,IAAI,EAAC,QAAQ,EACb,GAAG,EAAC,GAAG,EACP,IAAI,EAAC,KAAK,EACV,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EACzC,QAAQ,EAAE,QAAQ,EAClB,WAAW,EAAE,WAAW,EACxB,SAAS,EAAE,EAAE,CACX,mIAAmI,EACnI,kEAAkE,EAClE,qFAAqF,EACrF,yDAAyD,CAC1D,GACD,IACE,IACF,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type BillingRedirect } from "./redirect.js";
|
|
1
2
|
/** Props for {@link BillingSection}. */
|
|
2
3
|
export interface BillingSectionProps {
|
|
3
4
|
/**
|
|
@@ -10,6 +11,22 @@ export interface BillingSectionProps {
|
|
|
10
11
|
readonly checkoutSuccess?: boolean;
|
|
11
12
|
/** Callback to dismiss the checkout success banner. */
|
|
12
13
|
readonly onDismissCheckoutSuccess?: () => void;
|
|
14
|
+
/**
|
|
15
|
+
* The plan the person was choosing when they left to save a card: the
|
|
16
|
+
* `plan` query Stripe returns with after `?setup=success`. The plan
|
|
17
|
+
* section reopens that choice for an explicit confirm.
|
|
18
|
+
*/
|
|
19
|
+
readonly resumePlanId?: string;
|
|
20
|
+
/** Called once the resumed plan choice is taken up, so the host can clear its query. */
|
|
21
|
+
readonly onResumeHandled?: () => void;
|
|
22
|
+
/**
|
|
23
|
+
* The host's seam for Stripe-hosted pages (checkout, card setup and the
|
|
24
|
+
* billing portal). Absent, this window navigates to them and Stripe
|
|
25
|
+
* returns to this origin's `/settings/billing`. A desktop host opens the
|
|
26
|
+
* system browser and names the web console's billing page instead; its
|
|
27
|
+
* reads refresh when the window regains focus.
|
|
28
|
+
*/
|
|
29
|
+
readonly redirect?: BillingRedirect;
|
|
13
30
|
/** Additional CSS class names. */
|
|
14
31
|
readonly className?: string;
|
|
15
32
|
}
|
|
@@ -28,5 +45,5 @@ export interface BillingSectionProps {
|
|
|
28
45
|
* <BillingSection checkoutSuccess={searchParams.checkout === "success"} />
|
|
29
46
|
* ```
|
|
30
47
|
*/
|
|
31
|
-
export declare function BillingSection({ checkoutSuccess, onDismissCheckoutSuccess, className, }: BillingSectionProps): import("react/jsx-runtime").JSX.Element;
|
|
48
|
+
export declare function BillingSection({ checkoutSuccess, onDismissCheckoutSuccess, resumePlanId, onResumeHandled, redirect, className, }: BillingSectionProps): import("react/jsx-runtime").JSX.Element;
|
|
32
49
|
//# sourceMappingURL=BillingSection.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BillingSection.d.ts","sourceRoot":"","sources":["../src/billing/BillingSection.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"BillingSection.d.ts","sourceRoot":"","sources":["../src/billing/BillingSection.tsx"],"names":[],"mappings":"AAoBA,OAAO,EAAoB,KAAK,eAAe,EAAE,MAAM,eAAe,CAAC;AAGvE,wCAAwC;AACxC,MAAM,WAAW,mBAAmB;IAClC;;;;;;OAMG;IACH,QAAQ,CAAC,eAAe,CAAC,EAAE,OAAO,CAAC;IACnC,uDAAuD;IACvD,QAAQ,CAAC,wBAAwB,CAAC,EAAE,MAAM,IAAI,CAAC;IAC/C;;;;OAIG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B,wFAAwF;IACxF,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,IAAI,CAAC;IACtC;;;;;;OAMG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,eAAe,CAAC;IACpC,kCAAkC;IAClC,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,cAAc,CAAC,EAC7B,eAAe,EACf,wBAAwB,EACxB,YAAY,EACZ,eAAe,EACf,QAAQ,EACR,SAAS,GACV,EAAE,mBAAmB,2CA0CrB"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useCallback, useId, useState } from "react";
|
|
4
4
|
import { getUserMessage } from "@stigmer/sdk";
|
|
5
|
+
import { ManagementMode } from "@stigmer/protos/ai/stigmer/tenancy/organization/v1/enum_pb";
|
|
5
6
|
import { useDeploymentMode } from "../deployment-mode.js";
|
|
6
7
|
import { CloudFeatureNotice } from "../internal/CloudFeatureNotice.js";
|
|
7
8
|
import { useOrg } from "../organization/OrgProvider.js";
|
|
@@ -14,6 +15,9 @@ import { AutoRechargeCard } from "./AutoRechargeCard.js";
|
|
|
14
15
|
import { CreditPackGrid } from "./CreditPackGrid.js";
|
|
15
16
|
import { CreditLedgerTable } from "./CreditLedgerTable.js";
|
|
16
17
|
import { LowBalanceBanner } from "./LowBalanceBanner.js";
|
|
18
|
+
import { PlanSection } from "./PlanSection.js";
|
|
19
|
+
import { billingReturnUrl } from "./redirect.js";
|
|
20
|
+
import { useCreatePaymentMethodSetupSession } from "./useCreatePaymentMethodSetupSession.js";
|
|
17
21
|
/**
|
|
18
22
|
* Top-level billing settings section.
|
|
19
23
|
*
|
|
@@ -29,26 +33,30 @@ import { LowBalanceBanner } from "./LowBalanceBanner.js";
|
|
|
29
33
|
* <BillingSection checkoutSuccess={searchParams.checkout === "success"} />
|
|
30
34
|
* ```
|
|
31
35
|
*/
|
|
32
|
-
export function BillingSection({ checkoutSuccess, onDismissCheckoutSuccess, className, }) {
|
|
36
|
+
export function BillingSection({ checkoutSuccess, onDismissCheckoutSuccess, resumePlanId, onResumeHandled, redirect, className, }) {
|
|
33
37
|
const headingId = useId();
|
|
34
38
|
const { activeOrg } = useOrg();
|
|
35
39
|
const mode = useDeploymentMode();
|
|
36
40
|
const orgId = activeOrg?.metadata?.id ?? "";
|
|
37
|
-
|
|
41
|
+
const managed = activeOrg?.spec?.managementMode === ManagementMode.platform_managed;
|
|
42
|
+
return (_jsxs("section", { "aria-labelledby": headingId, className: className, children: [_jsx("h2", { id: headingId, className: "stg:text-foreground stg:mb-1 stg:text-sm stg:font-semibold", children: "Billing" }), _jsx("p", { className: "stg:text-muted-foreground stg:mb-4 stg:text-xs", children: "Your plan, credits, payment method and transaction history." }), mode === "local" ? (_jsx(CloudFeatureNotice, { children: "Credit billing and purchases are available on Stigmer Cloud. Local mode uses your own LLM API keys directly \u2014 no Stigmer credits needed." })) : !orgId ? (_jsx("p", { className: "stg:text-muted-foreground stg:py-4 stg:text-center stg:text-xs", children: "Select an organization to view billing." })) : (_jsx(BillingContent, { orgId: orgId, managed: managed, checkoutSuccess: checkoutSuccess, onDismissCheckoutSuccess: onDismissCheckoutSuccess, resumePlanId: resumePlanId, onResumeHandled: onResumeHandled, redirect: redirect }))] }));
|
|
38
43
|
}
|
|
39
44
|
// ---------------------------------------------------------------------------
|
|
40
45
|
// BillingContent (internal)
|
|
41
46
|
// ---------------------------------------------------------------------------
|
|
42
|
-
function BillingContent({ orgId, checkoutSuccess, onDismissCheckoutSuccess, }) {
|
|
43
|
-
const { account, isLoading, error, refetch } = useBillingAccount(orgId
|
|
44
|
-
|
|
45
|
-
|
|
47
|
+
function BillingContent({ orgId, managed, checkoutSuccess, onDismissCheckoutSuccess, resumePlanId, onResumeHandled, redirect, }) {
|
|
48
|
+
const { account, isLoading, error, refetch } = useBillingAccount(orgId, {
|
|
49
|
+
refetchOnWindowFocus: redirect?.openUrl !== undefined,
|
|
50
|
+
});
|
|
51
|
+
const { createSession, isSubmitting, error: checkoutError, clearError } = useCreateCheckoutSession(redirect);
|
|
52
|
+
const { openPortal, isLoading: isPortalLoading } = useCreateBillingPortalSession(redirect);
|
|
53
|
+
const setup = useCreatePaymentMethodSetupSession(redirect);
|
|
54
|
+
const returnUrl = redirect?.returnUrl;
|
|
46
55
|
const [purchasingPackId, setPurchasingPackId] = useState(null);
|
|
47
56
|
const handlePurchase = useCallback((packId) => {
|
|
48
57
|
setPurchasingPackId(packId);
|
|
49
58
|
clearError();
|
|
50
|
-
const
|
|
51
|
-
const billingPath = `${baseUrl}/settings/billing`;
|
|
59
|
+
const billingPath = billingReturnUrl({ returnUrl });
|
|
52
60
|
createSession({
|
|
53
61
|
orgId,
|
|
54
62
|
packId,
|
|
@@ -57,7 +65,7 @@ function BillingContent({ orgId, checkoutSuccess, onDismissCheckoutSuccess, }) {
|
|
|
57
65
|
}).catch(() => {
|
|
58
66
|
setPurchasingPackId(null);
|
|
59
67
|
});
|
|
60
|
-
}, [orgId, createSession, clearError]);
|
|
68
|
+
}, [orgId, createSession, clearError, returnUrl]);
|
|
61
69
|
if (isLoading) {
|
|
62
70
|
return (_jsxs("div", { className: "stg:space-y-4", "aria-busy": "true", "aria-label": "Loading billing", children: [_jsx("div", { className: "stg:h-24 stg:animate-pulse stg:rounded-lg stg:bg-muted-subtle" }), _jsx("div", { className: "stg:grid stg:grid-cols-3 stg:gap-3", children: Array.from({ length: 3 }, (_, i) => (_jsx("div", { className: "stg:h-36 stg:animate-pulse stg:rounded-lg stg:bg-muted-subtle" }, i))) }), _jsx("div", { className: "stg:h-48 stg:animate-pulse stg:rounded-lg stg:bg-muted-subtle" })] }));
|
|
63
71
|
}
|
|
@@ -70,8 +78,10 @@ function BillingContent({ orgId, checkoutSuccess, onDismissCheckoutSuccess, }) {
|
|
|
70
78
|
if (!balance)
|
|
71
79
|
return null;
|
|
72
80
|
const isLowBalance = balance.availableMicros < account.lowBalanceThresholdMicros;
|
|
73
|
-
|
|
74
|
-
|
|
81
|
+
const hasPaymentMethod = account.defaultPaymentMethod != null && account.defaultPaymentMethod.paymentMethodId !== "";
|
|
82
|
+
return (_jsxs("div", { className: "stg:space-y-6", children: [checkoutSuccess && (_jsx(CheckoutSuccessBanner, { onDismiss: onDismissCheckoutSuccess })), _jsx(LowBalanceBanner, { availableMicros: balance.availableMicros, thresholdMicros: account.lowBalanceThresholdMicros }), _jsx(PlanSection, { orgId: orgId, managed: managed, hasPaymentMethod: hasPaymentMethod, onRefreshAccount: refetch, redirect: redirect, resumePlanId: resumePlanId, onResumeHandled: onResumeHandled }), _jsx(CreditBalanceCard, { balance: balance, isLowBalance: isLowBalance }), _jsx(PaymentMethodCard, { paymentMethod: account.defaultPaymentMethod, accountStatus: account.status, isPortalLoading: isPortalLoading, onManage: () => openPortal(orgId), onAdd: () => {
|
|
83
|
+
setup.addPaymentMethod(orgId).catch(() => undefined);
|
|
84
|
+
}, isAdding: setup.isSubmitting }), setup.error && (_jsx("p", { className: "stg:text-destructive stg:text-xs", role: "alert", children: getUserMessage(setup.error) })), _jsx(AutoRechargeCard, { orgId: orgId, autoRecharge: account.autoRecharge, hasPaymentMethod: hasPaymentMethod, accountStatus: account.status, onSaved: refetch }), _jsx(CreditPackGrid, { accountStatus: account.status, purchasingPackId: isSubmitting ? purchasingPackId : null, onPurchase: handlePurchase }), checkoutError && (_jsx("p", { className: "stg:text-destructive stg:text-xs", role: "alert", children: getUserMessage(checkoutError) })), _jsx(CreditLedgerTable, { orgId: orgId })] }));
|
|
75
85
|
}
|
|
76
86
|
// ---------------------------------------------------------------------------
|
|
77
87
|
// CheckoutSuccessBanner (internal)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BillingSection.js","sourceRoot":"","sources":["../src/billing/BillingSection.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAErD,OAAO,EAAE,cAAc,EAAE,MAAM,cA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,IAAI,EACxD,UAAU,EAAE,cAAc,GAC1B,EAED,aAAa,IAAI,CAChB,YAAG,SAAS,EAAC,kCAAkC,EAAC,IAAI,EAAC,OAAO,YACzD,cAAc,CAAC,aAAa,CAAC,GAC5B,CACL,EAED,KAAC,iBAAiB,IAAC,KAAK,EAAE,KAAK,GAAI,IAC/B,CACP,CAAC;AACJ,CAAC;AAED,8EAA8E;AAC9E,mCAAmC;AACnC,8EAA8E;AAE9E,SAAS,qBAAqB,CAAC,EAC7B,SAAS,GAGV;IACC,OAAO,CACL,eACE,IAAI,EAAC,QAAQ,EACb,SAAS,EAAC,iNAAiN,aAE3N,wBACE,eAAM,SAAS,EAAC,iBAAiB,iCAAwB,EACxD,UAAU,oDAET,EACH,SAAS,IAAI,CACZ,iBACE,IAAI,EAAC,QAAQ,EACb,OAAO,EAAE,SAAS,EAClB,SAAS,EAAC,sFAAsF,gBACrF,SAAS,YAEpB,eACE,KAAK,EAAC,IAAI,EACV,MAAM,EAAC,IAAI,EACX,OAAO,EAAC,WAAW,EACnB,IAAI,EAAC,MAAM,EACX,MAAM,EAAC,cAAc,EACrB,WAAW,EAAC,GAAG,EACf,aAAa,EAAC,OAAO,EACrB,cAAc,EAAC,OAAO,iBACV,MAAM,aAElB,eAAM,CAAC,EAAC,YAAY,GAAG,EACvB,eAAM,CAAC,EAAC,YAAY,GAAG,IACnB,GACC,CACV,IACG,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { type OfferedFeature } from "./plan-features.js";
|
|
2
|
+
import type { PlanMove } from "./plan-state.js";
|
|
3
|
+
/** The reason a plan change is refused for want of a saved card (billing/subscription/v1/command.proto). */
|
|
4
|
+
export declare const PAYMENT_METHOD_REQUIRED = "PAYMENT_METHOD_REQUIRED";
|
|
5
|
+
/** Props for {@link ChangePlanDialog}. */
|
|
6
|
+
export interface ChangePlanDialogProps {
|
|
7
|
+
/** The move to confirm; the dialog is open while it is set. */
|
|
8
|
+
readonly move: PlanMove | null;
|
|
9
|
+
/** The display name of a plan by id, for the plan being left. */
|
|
10
|
+
readonly planName: (planId: string) => string;
|
|
11
|
+
/**
|
|
12
|
+
* For a switch, what the plan being left offers that the new one does
|
|
13
|
+
* not (`featuresLost`). Empty, as for an upgrade, the dialog says
|
|
14
|
+
* nothing is lost.
|
|
15
|
+
*/
|
|
16
|
+
readonly losing?: readonly OfferedFeature[];
|
|
17
|
+
/**
|
|
18
|
+
* Whether the organization has a saved card. Every move but a cancel
|
|
19
|
+
* needs one, because every period is collected from it.
|
|
20
|
+
*/
|
|
21
|
+
readonly hasPaymentMethod: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* The card was just saved on Stripe's page and is on its way to the
|
|
24
|
+
* account: say so instead of asking for one again.
|
|
25
|
+
*/
|
|
26
|
+
readonly awaitingPaymentMethod?: boolean;
|
|
27
|
+
/** `true` while the move, or the card page, is in flight. */
|
|
28
|
+
readonly isSubmitting: boolean;
|
|
29
|
+
/** Why the last attempt failed, or `null`. */
|
|
30
|
+
readonly error: Error | null;
|
|
31
|
+
/** Make the move. */
|
|
32
|
+
readonly onConfirm: () => void;
|
|
33
|
+
/** Leave to save a card, returning to this choice. */
|
|
34
|
+
readonly onAddPaymentMethod: () => void;
|
|
35
|
+
/** Close without moving. */
|
|
36
|
+
readonly onClose: () => void;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* The confirm step for a plan change. It states exactly what the move does
|
|
40
|
+
* and when money moves: a subscription starts now and every period is
|
|
41
|
+
* collected when it closes; a switch closes this period early, billed for
|
|
42
|
+
* the time it ran; a cancel keeps the plan to its period's end and deletes
|
|
43
|
+
* nothing. Without a saved card it offers the card page first.
|
|
44
|
+
*/
|
|
45
|
+
export declare function ChangePlanDialog({ move, planName, losing, hasPaymentMethod, awaitingPaymentMethod, isSubmitting, error, onConfirm, onAddPaymentMethod, onClose, }: ChangePlanDialogProps): import("react/jsx-runtime").JSX.Element;
|
|
46
|
+
//# sourceMappingURL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,EAAE,qBAAqB,2CA2DvB"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { useId } from "react";
|
|
4
|
+
import { getErrorReason, getUserMessage } from "@stigmer/sdk";
|
|
5
|
+
import { Button } from "../button/index.js";
|
|
6
|
+
import { DialogShell } from "../internal/DialogShell.js";
|
|
7
|
+
import { formatDay, formatMonthlyMinimum, sharePercent } from "./plan-features.js";
|
|
8
|
+
/** The reason a plan change is refused for want of a saved card (billing/subscription/v1/command.proto). */
|
|
9
|
+
export const PAYMENT_METHOD_REQUIRED = "PAYMENT_METHOD_REQUIRED";
|
|
10
|
+
/**
|
|
11
|
+
* The confirm step for a plan change. It states exactly what the move does
|
|
12
|
+
* and when money moves: a subscription starts now and every period is
|
|
13
|
+
* collected when it closes; a switch closes this period early, billed for
|
|
14
|
+
* the time it ran; a cancel keeps the plan to its period's end and deletes
|
|
15
|
+
* nothing. Without a saved card it offers the card page first.
|
|
16
|
+
*/
|
|
17
|
+
export function ChangePlanDialog({ move, planName, losing = [], hasPaymentMethod, awaitingPaymentMethod, isSubmitting, error, onConfirm, onAddPaymentMethod, onClose, }) {
|
|
18
|
+
const headingId = useId();
|
|
19
|
+
const needsCard = move !== null &&
|
|
20
|
+
move.kind !== "cancel" &&
|
|
21
|
+
(!hasPaymentMethod || getErrorReason(error)?.reason === PAYMENT_METHOD_REQUIRED);
|
|
22
|
+
return (_jsx(DialogShell, { open: move !== null, onOpenChange: (open) => {
|
|
23
|
+
if (!open)
|
|
24
|
+
onClose();
|
|
25
|
+
}, width: "md", "aria-labelledby": headingId, children: move && (_jsxs("div", { className: "stg:space-y-3 stg:p-5", children: [_jsx("h2", { id: headingId, className: "stg:text-sm stg:font-semibold stg:text-foreground", children: title(move) }), _jsx("div", { className: "stg:space-y-2 stg:text-xs stg:text-muted-foreground", children: body(move, planName, losing) }), needsCard && (_jsx("p", { className: "stg:rounded-md stg:bg-muted-subtle stg:px-3 stg:py-2 stg:text-xs stg:text-foreground", role: "status", children: awaitingPaymentMethod
|
|
26
|
+
? "Your card is being saved. This takes a few seconds; the choice is kept."
|
|
27
|
+
: "A saved card is needed first: every period is collected from it. You come back here after saving it." })), error && getErrorReason(error)?.reason !== PAYMENT_METHOD_REQUIRED && (_jsx("p", { className: "stg:text-xs stg:text-destructive", role: "alert", children: getUserMessage(error) })), _jsxs("div", { className: "stg:flex stg:justify-end stg:gap-2 stg:pt-1", children: [_jsx(Button, { variant: "ghost", size: "sm", onClick: onClose, disabled: isSubmitting, children: "Not now" }), needsCard ? (_jsx(Button, { size: "sm", onClick: onAddPaymentMethod, disabled: isSubmitting || awaitingPaymentMethod, children: "Add a payment method" })) : (_jsx(Button, { variant: move.kind === "cancel" ? "destructive" : "primary", size: "sm", onClick: onConfirm, disabled: isSubmitting, children: confirmLabel(move) }))] })] })) }));
|
|
28
|
+
}
|
|
29
|
+
function title(move) {
|
|
30
|
+
switch (move.kind) {
|
|
31
|
+
case "subscribe":
|
|
32
|
+
return `Subscribe to ${move.to.metadata?.name ?? "this plan"}`;
|
|
33
|
+
case "switch":
|
|
34
|
+
return `Switch to ${move.to.metadata?.name ?? "this plan"}`;
|
|
35
|
+
case "resume":
|
|
36
|
+
return `Keep ${move.to.metadata?.name ?? "this plan"}`;
|
|
37
|
+
case "cancel":
|
|
38
|
+
return "Move to Free";
|
|
39
|
+
default: {
|
|
40
|
+
const exhaustive = move;
|
|
41
|
+
return String(exhaustive);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
function body(move, planName, losing) {
|
|
46
|
+
switch (move.kind) {
|
|
47
|
+
case "subscribe":
|
|
48
|
+
return (_jsxs(_Fragment, { children: [_jsxs("p", { children: [move.to.metadata?.name, " starts now. Each monthly period is billed when it ends:", " ", periodCharge(move.to.spec?.terms)] }), _jsx("p", { children: "Nothing is charged today." })] }));
|
|
49
|
+
case "switch":
|
|
50
|
+
return (_jsxs(_Fragment, { children: [_jsxs("p", { children: ["The switch takes effect now. This period closes early and is billed for the time it ran on", " ", planName(move.fromPlanId), "; a new monthly period opens on ", move.to.metadata?.name, " at", " ", formatMonthlyMinimum(move.to.spec?.terms), "."] }), losing.length > 0 && (_jsxs("p", { children: [move.to.metadata?.name, " does not include ", listFeatures(losing), ". Everything you built keeps working; only creating more is refused."] }))] }));
|
|
51
|
+
case "resume":
|
|
52
|
+
return _jsxs("p", { children: ["The cancellation is withdrawn, and ", move.to.metadata?.name, " runs on into its next period."] });
|
|
53
|
+
case "cancel":
|
|
54
|
+
return (_jsxs(_Fragment, { children: [_jsxs("p", { children: [planName(move.fromPlanId), " stays in force until ", formatDay(move.endsAt), ", then this organization is on Free. The period is billed as usual when it closes."] }), _jsx("p", { children: "Nothing you built is deleted. Creating what Free does not include is refused until you subscribe again." })] }));
|
|
55
|
+
default: {
|
|
56
|
+
const exhaustive = move;
|
|
57
|
+
return String(exhaustive);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
function confirmLabel(move) {
|
|
62
|
+
switch (move.kind) {
|
|
63
|
+
case "subscribe":
|
|
64
|
+
return "Subscribe";
|
|
65
|
+
case "switch":
|
|
66
|
+
return "Switch now";
|
|
67
|
+
case "resume":
|
|
68
|
+
return "Keep plan";
|
|
69
|
+
case "cancel":
|
|
70
|
+
return "Cancel plan";
|
|
71
|
+
default: {
|
|
72
|
+
const exhaustive = move;
|
|
73
|
+
return String(exhaustive);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
/** "Teams", "Teams and Managed organizations", "A, B and C". */
|
|
78
|
+
function listFeatures(features) {
|
|
79
|
+
const labels = features.map((feature) => feature.label);
|
|
80
|
+
return labels.length <= 1 ? (labels[0] ?? "") : `${labels.slice(0, -1).join(", ")} and ${labels[labels.length - 1]}`;
|
|
81
|
+
}
|
|
82
|
+
/** What a period of the plan is billed at its end, in the customer's words. */
|
|
83
|
+
function periodCharge(terms) {
|
|
84
|
+
const minimum = formatMonthlyMinimum(terms);
|
|
85
|
+
const percent = sharePercent(terms);
|
|
86
|
+
return percent === ""
|
|
87
|
+
? `${minimum}.`
|
|
88
|
+
: `${minimum}, less the ${percent} commission already paid on that period's usage. Usage itself stays paid from credits.`;
|
|
89
|
+
}
|
|
90
|
+
//# sourceMappingURL=ChangePlanDialog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChangePlanDialog.js","sourceRoot":"","sources":["../src/billing/ChangePlanDialog.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAC9B,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9D,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,oBAAoB,EAAE,YAAY,EAAuB,MAAM,oBAAoB,CAAC;AAGxG,4GAA4G;AAC5G,MAAM,CAAC,MAAM,uBAAuB,GAAG,yBAAyB,CAAC;AAoCjE;;;;;;GAMG;AACH,MAAM,UAAU,gBAAgB,CAAC,EAC/B,IAAI,EACJ,QAAQ,EACR,MAAM,GAAG,EAAE,EACX,gBAAgB,EAChB,qBAAqB,EACrB,YAAY,EACZ,KAAK,EACL,SAAS,EACT,kBAAkB,EAClB,OAAO,GACe;IACtB,MAAM,SAAS,GAAG,KAAK,EAAE,CAAC;IAC1B,MAAM,SAAS,GACb,IAAI,KAAK,IAAI;QACb,IAAI,CAAC,IAAI,KAAK,QAAQ;QACtB,CAAC,CAAC,gBAAgB,IAAI,cAAc,CAAC,KAAK,CAAC,EAAE,MAAM,KAAK,uBAAuB,CAAC,CAAC;IAEnF,OAAO,CACL,KAAC,WAAW,IACV,IAAI,EAAE,IAAI,KAA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E,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,EAAE,CAAC;AACvH,CAAC;AAED,+EAA+E;AAC/E,SAAS,YAAY,CAAC,KAA4B;IAChD,MAAM,OAAO,GAAG,oBAAoB,CAAC,KAAK,CAAC,CAAC;IAC5C,MAAM,OAAO,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC;IACpC,OAAO,OAAO,KAAK,EAAE;QACnB,CAAC,CAAC,GAAG,OAAO,GAAG;QACf,CAAC,CAAC,GAAG,OAAO,cAAc,OAAO,wFAAwF,CAAC;AAC9H,CAAC"}
|
|
@@ -13,7 +13,7 @@ export interface CreditPackGridProps {
|
|
|
13
13
|
/**
|
|
14
14
|
* Grid of credit pack cards with purchase buttons.
|
|
15
15
|
*
|
|
16
|
-
* Displays the 3 self-serve credit packs (Starter, Growth,
|
|
16
|
+
* Displays the 3 self-serve credit packs (Starter, Growth, Scale)
|
|
17
17
|
* in a responsive grid. Each card shows the pack name, price,
|
|
18
18
|
* credit count, and a buy button. Buttons are disabled when the
|
|
19
19
|
* account is suspended/closed or a purchase is in progress.
|
|
@@ -6,7 +6,7 @@ import { CREDIT_PACKS, formatPackPrice, formatCreditCount, } from "./credit-pack
|
|
|
6
6
|
/**
|
|
7
7
|
* Grid of credit pack cards with purchase buttons.
|
|
8
8
|
*
|
|
9
|
-
* Displays the 3 self-serve credit packs (Starter, Growth,
|
|
9
|
+
* Displays the 3 self-serve credit packs (Starter, Growth, Scale)
|
|
10
10
|
* in a responsive grid. Each card shows the pack name, price,
|
|
11
11
|
* credit count, and a buy button. Buttons are disabled when the
|
|
12
12
|
* account is suspended/closed or a purchase is in progress.
|
|
@@ -27,7 +27,7 @@ export function LowBalanceBanner({ availableMicros, thresholdMicros, className,
|
|
|
27
27
|
: "stg:border-warning/30 stg:bg-warning/5 stg:text-warning-foreground", className), children: [_jsx(AlertTriangle, { className: "stg:mt-0.5 stg:size-3.5 stg:shrink-0", "aria-hidden": "true" }), _jsxs("div", { children: [_jsx("p", { className: "stg:font-medium", children: isZeroOrNegative
|
|
28
28
|
? "Credit balance exhausted"
|
|
29
29
|
: "Low credit balance" }), _jsx("p", { className: "stg:mt-0.5 stg:opacity-80", children: isZeroOrNegative
|
|
30
|
-
? "Your credit balance is zero.
|
|
30
|
+
? "Your credit balance is zero. Credits pay for agent usage on every plan; purchase credits to keep running agent executions."
|
|
31
31
|
: `Your balance (${formatCreditBalance(availableMicros)}) is below the warning threshold. Consider purchasing additional credits.` })] })] }));
|
|
32
32
|
}
|
|
33
33
|
//# sourceMappingURL=LowBalanceBanner.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LowBalanceBanner.js","sourceRoot":"","sources":["../src/billing/LowBalanceBanner.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAYlD;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,gBAAgB,CAAC,EAC/B,eAAe,EACf,eAAe,EACf,SAAS,GACa;IACtB,IAAI,eAAe,IAAI,eAAe;QAAE,OAAO,IAAI,CAAC;IAEpD,MAAM,gBAAgB,GAAG,eAAe,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC;IAEtD,OAAO,CACL,eACE,IAAI,EAAC,OAAO,EACZ,SAAS,EAAE,EAAE,CACX,gGAAgG,EAChG,gBAAgB;YACd,CAAC,CAAC,0EAA0E;YAC5E,CAAC,CAAC,oEAAoE,EACxE,SAAS,CACV,aAED,KAAC,aAAa,IAAC,SAAS,EAAC,sCAAsC,iBAAa,MAAM,GAAG,EACrF,0BACE,YAAG,SAAS,EAAC,iBAAiB,YAC3B,gBAAgB;4BACf,CAAC,CAAC,0BAA0B;4BAC5B,CAAC,CAAC,oBAAoB,GACtB,EACJ,YAAG,SAAS,EAAC,2BAA2B,YACrC,gBAAgB;4BACf,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"LowBalanceBanner.js","sourceRoot":"","sources":["../src/billing/LowBalanceBanner.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAYlD;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,gBAAgB,CAAC,EAC/B,eAAe,EACf,eAAe,EACf,SAAS,GACa;IACtB,IAAI,eAAe,IAAI,eAAe;QAAE,OAAO,IAAI,CAAC;IAEpD,MAAM,gBAAgB,GAAG,eAAe,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC;IAEtD,OAAO,CACL,eACE,IAAI,EAAC,OAAO,EACZ,SAAS,EAAE,EAAE,CACX,gGAAgG,EAChG,gBAAgB;YACd,CAAC,CAAC,0EAA0E;YAC5E,CAAC,CAAC,oEAAoE,EACxE,SAAS,CACV,aAED,KAAC,aAAa,IAAC,SAAS,EAAC,sCAAsC,iBAAa,MAAM,GAAG,EACrF,0BACE,YAAG,SAAS,EAAC,iBAAiB,YAC3B,gBAAgB;4BACf,CAAC,CAAC,0BAA0B;4BAC5B,CAAC,CAAC,oBAAoB,GACtB,EACJ,YAAG,SAAS,EAAC,2BAA2B,YACrC,gBAAgB;4BACf,CAAC,CAAC,4HAA4H;4BAC9H,CAAC,CAAC,iBAAiB,mBAAmB,CAAC,eAAe,CAAC,2EAA2E,GAClI,IACA,IACF,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -10,6 +10,14 @@ export interface PaymentMethodCardProps {
|
|
|
10
10
|
readonly isPortalLoading?: boolean;
|
|
11
11
|
/** Called when the user clicks "Manage payment methods". */
|
|
12
12
|
readonly onManage: () => void;
|
|
13
|
+
/**
|
|
14
|
+
* Called when the user clicks "Add payment method" with none on file:
|
|
15
|
+
* the host opens Stripe's page to save a card without a charge. Absent,
|
|
16
|
+
* the card has no add action.
|
|
17
|
+
*/
|
|
18
|
+
readonly onAdd?: () => void;
|
|
19
|
+
/** `true` while the card page is being opened. */
|
|
20
|
+
readonly isAdding?: boolean;
|
|
13
21
|
/** Additional CSS class names. */
|
|
14
22
|
readonly className?: string;
|
|
15
23
|
}
|
|
@@ -31,5 +39,5 @@ export interface PaymentMethodCardProps {
|
|
|
31
39
|
* />
|
|
32
40
|
* ```
|
|
33
41
|
*/
|
|
34
|
-
export declare function PaymentMethodCard({ paymentMethod, accountStatus, isPortalLoading, onManage, className, }: PaymentMethodCardProps): import("react/jsx-runtime").JSX.Element;
|
|
42
|
+
export declare function PaymentMethodCard({ paymentMethod, accountStatus, isPortalLoading, onManage, onAdd, isAdding, className, }: PaymentMethodCardProps): import("react/jsx-runtime").JSX.Element;
|
|
35
43
|
//# sourceMappingURL=PaymentMethodCard.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PaymentMethodCard.d.ts","sourceRoot":"","sources":["../src/billing/PaymentMethodCard.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,0DAA0D,CAAC;AACrG,OAAO,EAAE,oBAAoB,EAAE,MAAM,+CAA+C,CAAC;AAErF,2CAA2C;AAC3C,MAAM,WAAW,sBAAsB;IACrC,iEAAiE;IACjE,QAAQ,CAAC,aAAa,CAAC,EAAE,oBAAoB,CAAC;IAC9C,wEAAwE;IACxE,QAAQ,CAAC,aAAa,EAAE,oBAAoB,CAAC;IAC7C,wDAAwD;IACxD,QAAQ,CAAC,eAAe,CAAC,EAAE,OAAO,CAAC;IACnC,4DAA4D;IAC5D,QAAQ,CAAC,QAAQ,EAAE,MAAM,IAAI,CAAC;IAC9B,kCAAkC;IAClC,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B;AAsBD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,aAAa,EACb,aAAa,EACb,eAAe,EACf,QAAQ,EACR,SAAS,GACV,EAAE,sBAAsB,
|
|
1
|
+
{"version":3,"file":"PaymentMethodCard.d.ts","sourceRoot":"","sources":["../src/billing/PaymentMethodCard.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,0DAA0D,CAAC;AACrG,OAAO,EAAE,oBAAoB,EAAE,MAAM,+CAA+C,CAAC;AAErF,2CAA2C;AAC3C,MAAM,WAAW,sBAAsB;IACrC,iEAAiE;IACjE,QAAQ,CAAC,aAAa,CAAC,EAAE,oBAAoB,CAAC;IAC9C,wEAAwE;IACxE,QAAQ,CAAC,aAAa,EAAE,oBAAoB,CAAC;IAC7C,wDAAwD;IACxD,QAAQ,CAAC,eAAe,CAAC,EAAE,OAAO,CAAC;IACnC,4DAA4D;IAC5D,QAAQ,CAAC,QAAQ,EAAE,MAAM,IAAI,CAAC;IAC9B;;;;OAIG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,IAAI,CAAC;IAC5B,kDAAkD;IAClD,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAC5B,kCAAkC;IAClC,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B;AAsBD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,aAAa,EACb,aAAa,EACb,eAAe,EACf,QAAQ,EACR,KAAK,EACL,QAAQ,EACR,SAAS,GACV,EAAE,sBAAsB,2CA0ExB"}
|
|
@@ -37,10 +37,10 @@ function formatExpiry(month, year) {
|
|
|
37
37
|
* />
|
|
38
38
|
* ```
|
|
39
39
|
*/
|
|
40
|
-
export function PaymentMethodCard({ paymentMethod, accountStatus, isPortalLoading, onManage, className, }) {
|
|
40
|
+
export function PaymentMethodCard({ paymentMethod, accountStatus, isPortalLoading, onManage, onAdd, isAdding, className, }) {
|
|
41
41
|
const isAccountActive = accountStatus === BillingAccountStatus.billing_account_active;
|
|
42
42
|
const hasPm = paymentMethod != null && paymentMethod.paymentMethodId !== "";
|
|
43
|
-
return (_jsxs("div", { className: cn("stg:rounded-lg stg:border stg:border-border stg:bg-card stg:px-4 stg:py-4", className), children: [_jsxs("div", { className: "stg:flex stg:items-center stg:justify-between", children: [_jsx("h3", { className: "stg:text-xs stg:font-semibold stg:text-foreground", children: "Payment Method" }), hasPm && (_jsx("button", { type: "button", disabled: !isAccountActive || isPortalLoading, onClick: onManage, className: cn("stg:rounded-md stg:px-2.5 stg:py-1 stg:text-xs stg:font-medium stg:transition-colors", "stg:text-muted-foreground stg:hover:bg-accent stg:hover:text-foreground", "stg:disabled:pointer-events-none stg:disabled:opacity-50"), "aria-busy": isPortalLoading, children: isPortalLoading ? "Opening\u2026" : "Manage" }))] }), hasPm ? (_jsxs("div", { className: "stg:mt-2 stg:flex stg:items-center stg:gap-3", children: [_jsx(CardBrandIcon, { brand: paymentMethod.brand }), _jsxs("div", { children: [_jsxs("div", { className: "stg:text-sm stg:font-medium stg:text-foreground", children: [formatBrand(paymentMethod.brand), " \u00B7\u00B7\u00B7\u00B7", " ", paymentMethod.last4] }), _jsxs("div", { className: "stg:text-xs stg:text-muted-foreground", children: ["Expires", " ", formatExpiry(paymentMethod.expMonth, paymentMethod.expYear)] })] })] })) : (
|
|
43
|
+
return (_jsxs("div", { className: cn("stg:rounded-lg stg:border stg:border-border stg:bg-card stg:px-4 stg:py-4", className), children: [_jsxs("div", { className: "stg:flex stg:items-center stg:justify-between", children: [_jsx("h3", { className: "stg:text-xs stg:font-semibold stg:text-foreground", children: "Payment Method" }), hasPm && (_jsx("button", { type: "button", disabled: !isAccountActive || isPortalLoading, onClick: onManage, className: cn("stg:rounded-md stg:px-2.5 stg:py-1 stg:text-xs stg:font-medium stg:transition-colors", "stg:text-muted-foreground stg:hover:bg-accent stg:hover:text-foreground", "stg:disabled:pointer-events-none stg:disabled:opacity-50"), "aria-busy": isPortalLoading, children: isPortalLoading ? "Opening\u2026" : "Manage" }))] }), hasPm ? (_jsxs("div", { className: "stg:mt-2 stg:flex stg:items-center stg:gap-3", children: [_jsx(CardBrandIcon, { brand: paymentMethod.brand }), _jsxs("div", { children: [_jsxs("div", { className: "stg:text-sm stg:font-medium stg:text-foreground", children: [formatBrand(paymentMethod.brand), " \u00B7\u00B7\u00B7\u00B7", " ", paymentMethod.last4] }), _jsxs("div", { className: "stg:text-xs stg:text-muted-foreground", children: ["Expires", " ", formatExpiry(paymentMethod.expMonth, paymentMethod.expYear)] })] })] })) : (_jsxs("div", { className: "stg:mt-2", children: [_jsx("p", { className: "stg:text-xs stg:text-muted-foreground", children: "No payment method on file. A saved card is needed to subscribe to a plan or turn on auto-recharge; buying a credit pack also saves one." }), onAdd && (_jsx("button", { type: "button", disabled: !isAccountActive || isAdding, onClick: onAdd, className: cn("stg:mt-2 stg:rounded-md stg:px-2.5 stg:py-1 stg:text-xs stg:font-medium stg:transition-colors", "stg:text-primary stg:hover:bg-accent", "stg:disabled:pointer-events-none stg:disabled:opacity-50"), "aria-busy": isAdding, children: isAdding ? "Opening\u2026" : "Add payment method" }))] }))] }));
|
|
44
44
|
}
|
|
45
45
|
function CardBrandIcon({ brand }) {
|
|
46
46
|
return (_jsx("div", { className: "stg:flex stg:size-9 stg:items-center stg:justify-center stg:rounded-md stg:border stg:border-border stg:bg-background", children: _jsx("span", { className: "stg:text-[0.6rem] stg:font-bold stg:uppercase stg:text-muted-foreground", children: brand.slice(0, 4) }) }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PaymentMethodCard.js","sourceRoot":"","sources":["../src/billing/PaymentMethodCard.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AAEpC,OAAO,EAAE,oBAA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,SAAS,EAAC,yEAAyE,YACtF,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,GACb,GACH,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type PeriodEstimate } from "@stigmer/protos/ai/stigmer/billing/subscription/v1/io_pb";
|
|
2
|
+
import type { PlanStanding } from "./plan-state.js";
|
|
3
|
+
/** Props for {@link PlanCard}. */
|
|
4
|
+
export interface PlanCardProps {
|
|
5
|
+
/** The plan's display name ("Free" when there is none). */
|
|
6
|
+
readonly planName: string;
|
|
7
|
+
/** Where the organization stands on it. */
|
|
8
|
+
readonly standing: PlanStanding;
|
|
9
|
+
/** The current period's estimated invoice, when a plan is live. */
|
|
10
|
+
readonly estimate?: PeriodEstimate | null;
|
|
11
|
+
/** Why the estimate could not be read, shown in its place. */
|
|
12
|
+
readonly estimateError?: Error | null;
|
|
13
|
+
/**
|
|
14
|
+
* The organization is platform-managed: it is on its integrator's plan
|
|
15
|
+
* and has no plan, period or invoice of its own.
|
|
16
|
+
*/
|
|
17
|
+
readonly managed?: boolean;
|
|
18
|
+
/** Additional CSS class names. */
|
|
19
|
+
readonly className?: string;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* The organization's plan: its name, its standing (active, payment
|
|
23
|
+
* failed, or ending on a date), the period it is in, and the period's
|
|
24
|
+
* estimated invoice line by line, the way the invoice will read it.
|
|
25
|
+
*/
|
|
26
|
+
export declare function PlanCard({ planName, standing, estimate, estimateError, managed, className }: PlanCardProps): import("react/jsx-runtime").JSX.Element;
|
|
27
|
+
//# sourceMappingURL=PlanCard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PlanCard.d.ts","sourceRoot":"","sources":["../src/billing/PlanCard.tsx"],"names":[],"mappings":"AAIA,OAAO,EAEL,KAAK,cAAc,EAEpB,MAAM,0DAA0D,CAAC;AAIlE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAEpD,kCAAkC;AAClC,MAAM,WAAW,aAAa;IAC5B,2DAA2D;IAC3D,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,2CAA2C;IAC3C,QAAQ,CAAC,QAAQ,EAAE,YAAY,CAAC;IAChC,mEAAmE;IACnE,QAAQ,CAAC,QAAQ,CAAC,EAAE,cAAc,GAAG,IAAI,CAAC;IAC1C,8DAA8D;IAC9D,QAAQ,CAAC,aAAa,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC;IACtC;;;OAGG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;IAC3B,kCAAkC;IAClC,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,aAAa,EAAE,OAAO,EAAE,SAAS,EAAE,EAAE,aAAa,2CAiC1G"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { cn } from "@stigmer/theme";
|
|
4
|
+
import { getUserMessage } from "@stigmer/sdk";
|
|
5
|
+
import { PeriodEstimateLineKind, } from "@stigmer/protos/ai/stigmer/billing/subscription/v1/io_pb";
|
|
6
|
+
import { StatusBadge } from "../resource-workbench/components/StatusBadge.js";
|
|
7
|
+
import { formatCreditBalance, formatLedgerAmount } from "./format.js";
|
|
8
|
+
import { formatDay, formatPeriodDay } from "./plan-features.js";
|
|
9
|
+
/**
|
|
10
|
+
* The organization's plan: its name, its standing (active, payment
|
|
11
|
+
* failed, or ending on a date), the period it is in, and the period's
|
|
12
|
+
* estimated invoice line by line, the way the invoice will read it.
|
|
13
|
+
*/
|
|
14
|
+
export function PlanCard({ planName, standing, estimate, estimateError, managed, className }) {
|
|
15
|
+
return (_jsxs("div", { className: cn("stg:rounded-lg stg:border stg:border-border stg:bg-card stg:px-4 stg:py-4", className), children: [_jsxs("div", { className: "stg:flex stg:items-center stg:justify-between stg:gap-3", children: [_jsx("h3", { className: "stg:text-xs stg:font-semibold stg:text-foreground", children: "Plan" }), !managed && _jsx(StandingBadge, { standing: standing })] }), _jsx("p", { className: "stg:mt-2 stg:text-sm stg:font-medium stg:text-foreground", children: managed ? "Your integrator's plan" : planName }), managed ? (_jsx("p", { className: "stg:mt-1 stg:text-xs stg:text-muted-foreground", children: "This organization is managed by its integrator and runs on the integrator's plan. It has no plan or invoice of its own." })) : (_jsx(StandingDetail, { standing: standing })), !managed && estimate && _jsx(EstimateLines, { planName: planName, estimate: estimate }), !managed && !estimate && estimateError && (_jsx("p", { className: "stg:mt-3 stg:text-xs stg:text-destructive", role: "alert", children: getUserMessage(estimateError) }))] }));
|
|
16
|
+
}
|
|
17
|
+
function StandingBadge({ standing }) {
|
|
18
|
+
switch (standing.kind) {
|
|
19
|
+
case "active":
|
|
20
|
+
return _jsx(StatusBadge, { phase: "ready", label: "Active" });
|
|
21
|
+
case "past-due":
|
|
22
|
+
return _jsx(StatusBadge, { phase: "failed", label: "Payment failed" });
|
|
23
|
+
case "ending":
|
|
24
|
+
return _jsx(StatusBadge, { phase: "degraded", label: `Ends ${formatDay(standing.endsAt)}` });
|
|
25
|
+
case "free":
|
|
26
|
+
return _jsx(StatusBadge, { phase: "disabled", label: "Free" });
|
|
27
|
+
default: {
|
|
28
|
+
const exhaustive = standing;
|
|
29
|
+
return exhaustive;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
function StandingDetail({ standing }) {
|
|
34
|
+
switch (standing.kind) {
|
|
35
|
+
case "free":
|
|
36
|
+
return (_jsx("p", { className: "stg:mt-1 stg:text-xs stg:text-muted-foreground", children: "Channels, sharing and unlimited members. Usage is paid from credits." }));
|
|
37
|
+
case "past-due":
|
|
38
|
+
return (_jsx("p", { className: "stg:mt-1 stg:text-xs stg:text-destructive", role: "status", children: "The last period's payment failed. Stripe retries it; update the card under Payment Method. The plan stays in force meanwhile." }));
|
|
39
|
+
case "ending":
|
|
40
|
+
return (_jsxs("p", { className: "stg:mt-1 stg:text-xs stg:text-muted-foreground", children: ["Canceled. The plan stays in force until ", formatDay(standing.endsAt), ", then this organization is on Free. Nothing you built is deleted."] }));
|
|
41
|
+
case "active":
|
|
42
|
+
return null;
|
|
43
|
+
default: {
|
|
44
|
+
const exhaustive = standing;
|
|
45
|
+
return exhaustive;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
function EstimateLines({ planName, estimate }) {
|
|
50
|
+
return (_jsxs("div", { className: "stg:mt-4 stg:border-t stg:border-border stg:pt-3", children: [_jsxs("div", { className: "stg:flex stg:items-baseline stg:justify-between stg:gap-3", children: [_jsxs("p", { className: "stg:text-xs stg:font-medium stg:text-foreground", children: ["Estimated invoice on ", formatPeriodDay(estimate.periodEnd)] }), _jsxs("p", { className: "stg:text-xs stg:text-muted-foreground", children: ["Period ", formatPeriodDay(estimate.periodStart), " \u2013 ", formatPeriodDay(estimate.periodEnd)] })] }), _jsxs("dl", { className: "stg:mt-2 stg:space-y-1", children: [estimate.lines.map((line) => (_jsxs("div", { className: "stg:flex stg:justify-between stg:gap-3 stg:text-xs", children: [_jsx("dt", { className: "stg:text-muted-foreground", children: lineLabel(line, planName, estimate) }), _jsx("dd", { className: "stg:tabular-nums stg:text-foreground", children: line.amountMicros < BigInt(0) ? formatLedgerAmount(line.amountMicros) : formatCreditBalance(line.amountMicros) })] }, line.kind))), _jsxs("div", { className: "stg:flex stg:justify-between stg:gap-3 stg:border-t stg:border-border stg:pt-1 stg:text-xs stg:font-medium", children: [_jsx("dt", { className: "stg:text-foreground", children: "Total so far" }), _jsx("dd", { className: "stg:tabular-nums stg:text-foreground", children: formatCreditBalance(estimate.totalMicros) })] })] }), _jsx("p", { className: "stg:mt-2 stg:text-xs stg:text-muted-foreground", children: "From usage so far. Usage itself is paid from credits; the commission already paid on it counts toward the minimum, which covers the whole period." })] }));
|
|
51
|
+
}
|
|
52
|
+
function lineLabel(line, planName, estimate) {
|
|
53
|
+
switch (line.kind) {
|
|
54
|
+
case PeriodEstimateLineKind.plan:
|
|
55
|
+
return `${planName} plan`;
|
|
56
|
+
case PeriodEstimateLineKind.commission_credit:
|
|
57
|
+
return "Commission already paid on tokens";
|
|
58
|
+
case PeriodEstimateLineKind.managed_organizations:
|
|
59
|
+
return `Managed organizations beyond those included (${estimate.managedOrganizationCount} this period)`;
|
|
60
|
+
case PeriodEstimateLineKind.period_estimate_line_kind_unspecified:
|
|
61
|
+
return "Other";
|
|
62
|
+
default: {
|
|
63
|
+
const exhaustive = line.kind;
|
|
64
|
+
return String(exhaustive);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=PlanCard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PlanCard.js","sourceRoot":"","sources":["../src/billing/PlanCard.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EACL,sBAAsB,GAGvB,MAAM,0DAA0D,CAAC;AAClE,OAAO,EAAE,WAAW,EAAE,MAAM,iDAAiD,CAAC;AAC9E,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACtE,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAsBhE;;;;GAIG;AACH,MAAM,UAAU,QAAQ,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,aAAa,EAAE,OAAO,EAAE,SAAS,EAAiB;IACzG,OAAO,CACL,eACE,SAAS,EAAE,EAAE,CACX,2EAA2E,EAC3E,SAAS,CACV,aAED,eAAK,SAAS,EAAC,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