@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
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
import { cn } from "@stigmer/theme";
|
|
5
|
+
import { getUserMessage } from "@stigmer/sdk";
|
|
6
|
+
import { Feature } from "@stigmer/protos/ai/stigmer/platform/v1/entitlement_pb";
|
|
7
|
+
import { Button } from "../button/index.js";
|
|
8
|
+
import { UNSTYLED_FIELDSET } from "../internal/element-resets.js";
|
|
9
|
+
import { FEATURE_COPY } from "../internal/features.js";
|
|
10
|
+
import { Field, INPUT_CLASSES } from "../internal/form-primitives.js";
|
|
11
|
+
import { EMPTY_PLAN_DRAFT, planInputFromDraft } from "./plan-draft.js";
|
|
12
|
+
import { useCreatePlan } from "./usePlanMutations.js";
|
|
13
|
+
/** The features a subscription plan can list, in contract order. */
|
|
14
|
+
const PLAN_FEATURES = [
|
|
15
|
+
Feature.channels,
|
|
16
|
+
Feature.sharing,
|
|
17
|
+
Feature.teams,
|
|
18
|
+
Feature.managed_organizations,
|
|
19
|
+
Feature.byo_provider_keys,
|
|
20
|
+
Feature.sso_enforcement,
|
|
21
|
+
];
|
|
22
|
+
/**
|
|
23
|
+
* Adds a subscription plan to the catalog: its name and handle, its
|
|
24
|
+
* monthly minimum and usage share, its features, and the managed
|
|
25
|
+
* organizations it includes. The form states before submitting that a
|
|
26
|
+
* plan's terms are final: a change of terms is a new plan, and the old
|
|
27
|
+
* one is retired.
|
|
28
|
+
*/
|
|
29
|
+
export function PlanCreateForm({ onCreated, onCancel }) {
|
|
30
|
+
const creator = useCreatePlan();
|
|
31
|
+
const [draft, setDraft] = useState(EMPTY_PLAN_DRAFT);
|
|
32
|
+
const [confirming, setConfirming] = useState(false);
|
|
33
|
+
const result = planInputFromDraft(draft);
|
|
34
|
+
const set = (key, value) => {
|
|
35
|
+
setConfirming(false);
|
|
36
|
+
setDraft((current) => ({ ...current, [key]: value }));
|
|
37
|
+
};
|
|
38
|
+
const toggle = (feature, on) => set("features", on ? [...draft.features, feature] : draft.features.filter((f) => f !== feature));
|
|
39
|
+
const submit = (e) => {
|
|
40
|
+
e.preventDefault();
|
|
41
|
+
if (!result.ok)
|
|
42
|
+
return;
|
|
43
|
+
if (!confirming) {
|
|
44
|
+
setConfirming(true);
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
creator.createPlan(result.input).then(onCreated, () => undefined);
|
|
48
|
+
};
|
|
49
|
+
const fieldError = (field) => !result.ok && result.field === field && draft[field] !== "" ? (_jsx("span", { className: "stg:block stg:text-xs stg:text-destructive", children: result.message })) : null;
|
|
50
|
+
return (_jsxs("form", { onSubmit: submit, className: "stg:space-y-4", "aria-label": "New plan", children: [_jsxs("div", { className: "stg:grid stg:gap-3 stg:sm:grid-cols-2", children: [_jsx(Field, { label: "Name", required: true, children: _jsx("input", { className: INPUT_CLASSES, value: draft.name, onChange: (e) => set("name", e.target.value) }) }), _jsxs(Field, { label: "Handle (slug)", required: true, children: [_jsx("input", { className: INPUT_CLASSES, value: draft.slug, placeholder: "team-2027", onChange: (e) => set("slug", e.target.value) }), fieldError("slug")] }), _jsxs(Field, { label: "Monthly minimum (USD)", required: true, children: [_jsx("input", { className: INPUT_CLASSES, inputMode: "decimal", value: draft.monthlyMinimumUsd, onChange: (e) => set("monthlyMinimumUsd", e.target.value) }), fieldError("monthlyMinimumUsd")] }), _jsxs(Field, { label: "Usage share (% of provider cost)", required: true, children: [_jsx("input", { className: INPUT_CLASSES, inputMode: "decimal", value: draft.usageSharePercent, onChange: (e) => set("usageSharePercent", e.target.value) }), fieldError("usageSharePercent")] })] }), _jsxs("fieldset", { className: cn(UNSTYLED_FIELDSET, "stg:space-y-2"), children: [_jsx("legend", { className: "stg:mb-1 stg:text-xs stg:font-medium stg:text-muted-foreground", children: "Features" }), PLAN_FEATURES.map((feature) => (_jsxs("label", { className: "stg:flex stg:items-start stg:gap-2 stg:text-sm", children: [_jsx("input", { type: "checkbox", className: "stg:mt-0.5", checked: draft.features.includes(feature), onChange: (e) => toggle(feature, e.target.checked) }), _jsxs("span", { children: [_jsx("span", { className: "stg:block stg:text-foreground", children: FEATURE_COPY[feature].label }), _jsx("span", { className: "stg:block stg:text-xs stg:text-muted-foreground", children: FEATURE_COPY[feature].description })] })] }, feature)))] }), draft.features.includes(Feature.managed_organizations) && (_jsxs("div", { className: "stg:grid stg:gap-3 stg:sm:grid-cols-2", children: [_jsxs(Field, { label: "Managed organizations included (empty: unlimited)", children: [_jsx("input", { className: INPUT_CLASSES, inputMode: "numeric", value: draft.includedManagedOrganizations, onChange: (e) => set("includedManagedOrganizations", e.target.value) }), fieldError("includedManagedOrganizations")] }), _jsxs(Field, { label: "Each one beyond (USD/month)", children: [_jsx("input", { className: INPUT_CLASSES, inputMode: "decimal", value: draft.perExtraOrganizationUsd, onChange: (e) => set("perExtraOrganizationUsd", e.target.value) }), fieldError("perExtraOrganizationUsd")] })] })), confirming && (_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: "A plan's terms are final once it exists: every subscriber on it is invoiced by them. A change of terms is a new plan, and this one is retired. Create it?" })), creator.error && (_jsx("p", { className: "stg:text-xs stg:text-destructive", role: "alert", children: getUserMessage(creator.error) })), _jsxs("div", { className: "stg:flex stg:justify-end stg:gap-2", children: [_jsx(Button, { variant: "ghost", size: "sm", type: "button", onClick: onCancel, disabled: creator.isSubmitting, children: "Cancel" }), _jsx(Button, { size: "sm", type: "submit", disabled: !result.ok || creator.isSubmitting, children: confirming ? "Create plan" : "Review" })] })] }));
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=PlanCreateForm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PlanCreateForm.js","sourceRoot":"","sources":["../src/plan-catalog/PlanCreateForm.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,QAAQ,EAAkB,MAAM,OAAO,CAAC;AACjD,OAAO,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9C,OAAO,EAAE,OAAO,EAAE,MAAM,uDAAuD,CAAC;AAChF,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,YAAY,EAAqB,MAAM,yBAAyB,CAAC;AAC1E,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AACtE,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAkB,MAAM,iBAAiB,CAAC;AACvF,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAEtD,oEAAoE;AACpE,MAAM,aAAa,GAA4B;IAC7C,OAAO,CAAC,QAAQ;IAChB,OAAO,CAAC,OAAO;IACf,OAAO,CAAC,KAAK;IACb,OAAO,CAAC,qBAAqB;IAC7B,OAAO,CAAC,iBAAiB;IACzB,OAAO,CAAC,eAAe;CACxB,CAAC;AAUF;;;;;;GAMG;AACH,MAAM,UAAU,cAAc,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAuB;IACzE,MAAM,OAAO,GAAG,aAAa,EAAE,CAAC;IAChC,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAY,gBAAgB,CAAC,CAAC;IAChE,MAAM,CAAC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AAE,aAAa,EACxB,SAAS,EAAC,SAAS,EACnB,KAAK,EAAE,KAAK,CAAC,uBAAuB,EACpC,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,yBAAyB,EAAE,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,GAC/D,EACD,UAAU,CAAC,yBAAyB,CAAC,IAChC,IACJ,CACP,EAEA,UAAU,IAAI,CACb,YAAG,SAAS,EAAC,sFAAsF,EAAC,IAAI,EAAC,QAAQ,0KAG7G,CACL,EACA,OAAO,CAAC,KAAK,IAAI,CAChB,YAAG,SAAS,EAAC,kCAAkC,EAAC,IAAI,EAAC,OAAO,YACzD,cAAc,CAAC,OAAO,CAAC,KAAK,CAAC,GAC5B,CACL,EAED,eAAK,SAAS,EAAC,oCAAoC,aACjD,KAAC,MAAM,IAAC,OAAO,EAAC,OAAO,EAAC,IAAI,EAAC,IAAI,EAAC,IAAI,EAAC,QAAQ,EAAC,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,CAAC,YAAY,uBAExF,EACT,KAAC,MAAM,IAAC,IAAI,EAAC,IAAI,EAAC,IAAI,EAAC,QAAQ,EAAC,QAAQ,EAAE,CAAC,MAAM,CAAC,EAAE,IAAI,OAAO,CAAC,YAAY,YACzE,UAAU,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,QAAQ,GAC/B,IACL,IACD,CACR,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The access-denied state for the plan catalog's operator surface.
|
|
3
|
+
* Server-side authorization (`can_manage_plans` on `platform:stigmer`) is
|
|
4
|
+
* the real gate; this is the designed face of it for anyone who reaches
|
|
5
|
+
* the route without the permission.
|
|
6
|
+
*/
|
|
7
|
+
export declare function PlansAccessNotice({ className }: {
|
|
8
|
+
readonly className?: string;
|
|
9
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
//# sourceMappingURL=PlansAccessNotice.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PlansAccessNotice.d.ts","sourceRoot":"","sources":["../src/plan-catalog/PlansAccessNotice.tsx"],"names":[],"mappings":"AAIA;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,EAAE,SAAS,EAAE,EAAE;IAAE,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,2CAS/E"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { EmptyState } from "../empty-state/index.js";
|
|
4
|
+
/**
|
|
5
|
+
* The access-denied state for the plan catalog's operator surface.
|
|
6
|
+
* Server-side authorization (`can_manage_plans` on `platform:stigmer`) is
|
|
7
|
+
* the real gate; this is the designed face of it for anyone who reaches
|
|
8
|
+
* the route without the permission.
|
|
9
|
+
*/
|
|
10
|
+
export function PlansAccessNotice({ className }) {
|
|
11
|
+
return (_jsx(EmptyState, { variant: "permission", className: className, title: "Platform operator access required", description: "The plan catalog is managed by Stigmer's platform operators: a plan's terms are what every subscriber on it is invoiced. Organization roles do not grant access; organizations choose their plan under Billing." }));
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=PlansAccessNotice.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PlansAccessNotice.js","sourceRoot":"","sources":["../src/plan-catalog/PlansAccessNotice.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAErD;;;;;GAKG;AACH,MAAM,UAAU,iBAAiB,CAAC,EAAE,SAAS,EAAmC;IAC9E,OAAO,CACL,KAAC,UAAU,IACT,OAAO,EAAC,YAAY,EACpB,SAAS,EAAE,SAAS,EACpB,KAAK,EAAC,mCAAmC,EACzC,WAAW,EAAC,iNAAiN,GAC7N,CACH,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { useCreatePlan, useRetirePlan } from "./usePlanMutations.js";
|
|
2
|
+
export type { UseCreatePlanReturn, UseRetirePlanReturn } from "./usePlanMutations.js";
|
|
3
|
+
export { PlanCatalogConsole } from "./PlanCatalogConsole.js";
|
|
4
|
+
export type { PlanCatalogConsoleProps } from "./PlanCatalogConsole.js";
|
|
5
|
+
export { PlanCreateForm } from "./PlanCreateForm.js";
|
|
6
|
+
export type { PlanCreateFormProps } from "./PlanCreateForm.js";
|
|
7
|
+
export { PlansAccessNotice } from "./PlansAccessNotice.js";
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/plan-catalog/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACrE,YAAY,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAGtF,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,YAAY,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AACvE,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,YAAY,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// Plan catalog: the platform-operator console for the Stigmer Cloud plans
|
|
2
|
+
// organizations subscribe to (gated on can_manage_plans). Choosing a plan
|
|
3
|
+
// is the customer-facing billing surface's (../billing).
|
|
4
|
+
// Behavior hooks
|
|
5
|
+
export { useCreatePlan, useRetirePlan } from "./usePlanMutations.js";
|
|
6
|
+
// Styled components
|
|
7
|
+
export { PlanCatalogConsole } from "./PlanCatalogConsole.js";
|
|
8
|
+
export { PlanCreateForm } from "./PlanCreateForm.js";
|
|
9
|
+
export { PlansAccessNotice } from "./PlansAccessNotice.js";
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/plan-catalog/index.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,0EAA0E;AAC1E,yDAAyD;AAEzD,iBAAiB;AACjB,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAGrE,oBAAoB;AACpB,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAE7D,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { PlanInput } from "@stigmer/sdk";
|
|
2
|
+
import { Feature } from "@stigmer/protos/ai/stigmer/platform/v1/entitlement_pb";
|
|
3
|
+
/** What an operator types to create a subscription plan. */
|
|
4
|
+
export interface PlanDraft {
|
|
5
|
+
readonly name: string;
|
|
6
|
+
readonly slug: string;
|
|
7
|
+
readonly monthlyMinimumUsd: string;
|
|
8
|
+
readonly usageSharePercent: string;
|
|
9
|
+
readonly features: readonly Feature[];
|
|
10
|
+
/** Empty: the plan includes every managed organization. */
|
|
11
|
+
readonly includedManagedOrganizations: string;
|
|
12
|
+
readonly perExtraOrganizationUsd: string;
|
|
13
|
+
}
|
|
14
|
+
export declare const EMPTY_PLAN_DRAFT: PlanDraft;
|
|
15
|
+
/** The draft as a PlanInput, or the first field that is wrong and why. */
|
|
16
|
+
export type PlanDraftResult = {
|
|
17
|
+
readonly ok: true;
|
|
18
|
+
readonly input: PlanInput;
|
|
19
|
+
} | {
|
|
20
|
+
readonly ok: false;
|
|
21
|
+
readonly field: keyof PlanDraft;
|
|
22
|
+
readonly message: string;
|
|
23
|
+
};
|
|
24
|
+
/** A dollar amount with at most two decimals as exact micros, or `null`. */
|
|
25
|
+
export declare function parseUsd(text: string): bigint | null;
|
|
26
|
+
/** A percent with at most two decimals as basis points, or `null`. */
|
|
27
|
+
export declare function parseBasisPoints(text: string): number | null;
|
|
28
|
+
/** Translate a draft into the create request, refusing what the contract cannot take. */
|
|
29
|
+
export declare function planInputFromDraft(draft: PlanDraft): PlanDraftResult;
|
|
30
|
+
//# sourceMappingURL=plan-draft.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plan-draft.d.ts","sourceRoot":"","sources":["../src/plan-catalog/plan-draft.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C,OAAO,EAAE,OAAO,EAAE,MAAM,uDAAuD,CAAC;AAOhF,4DAA4D;AAC5D,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC;IACnC,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC;IACnC,QAAQ,CAAC,QAAQ,EAAE,SAAS,OAAO,EAAE,CAAC;IACtC,2DAA2D;IAC3D,QAAQ,CAAC,4BAA4B,EAAE,MAAM,CAAC;IAC9C,QAAQ,CAAC,uBAAuB,EAAE,MAAM,CAAC;CAC1C;AAED,eAAO,MAAM,gBAAgB,EAAE,SAQ9B,CAAC;AAEF,0EAA0E;AAC1E,MAAM,MAAM,eAAe,GACvB;IAAE,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAA;CAAE,GAChD;IAAE,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,SAAS,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAItF,4EAA4E;AAC5E,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAOpD;AAED,sEAAsE;AACtE,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAO5D;AAED,yFAAyF;AACzF,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,SAAS,GAAG,eAAe,CAkDpE"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
// The plan create form's draft and its translation to the SDK's
|
|
2
|
+
// PlanInput: dollars typed by an operator become exact micros, a percent
|
|
3
|
+
// becomes basis points, and every field the contract cannot take is
|
|
4
|
+
// refused here with the field that is wrong, before a request is sent.
|
|
5
|
+
import { PlanInstrument } from "@stigmer/protos/ai/stigmer/billing/plan/v1/spec_pb";
|
|
6
|
+
import { Feature } from "@stigmer/protos/ai/stigmer/platform/v1/entitlement_pb";
|
|
7
|
+
// BigInt(...), not literals: the docs site compiles this source for a
|
|
8
|
+
// target below ES2020, which has no BigInt literal syntax.
|
|
9
|
+
const MICROS_PER_CENT = BigInt(10_000);
|
|
10
|
+
const CENTS_PER_USD = BigInt(100);
|
|
11
|
+
export const EMPTY_PLAN_DRAFT = {
|
|
12
|
+
name: "",
|
|
13
|
+
slug: "",
|
|
14
|
+
monthlyMinimumUsd: "",
|
|
15
|
+
usageSharePercent: "10",
|
|
16
|
+
features: [Feature.channels, Feature.sharing],
|
|
17
|
+
includedManagedOrganizations: "",
|
|
18
|
+
perExtraOrganizationUsd: "",
|
|
19
|
+
};
|
|
20
|
+
const SLUG = /^[a-z0-9]+(-[a-z0-9]+)*$/;
|
|
21
|
+
/** A dollar amount with at most two decimals as exact micros, or `null`. */
|
|
22
|
+
export function parseUsd(text) {
|
|
23
|
+
const match = /^(\d+)(?:\.(\d{1,2}))?$/.exec(text.trim());
|
|
24
|
+
if (match === null) {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
const cents = BigInt(match[1] ?? "0") * CENTS_PER_USD + BigInt((match[2] ?? "").padEnd(2, "0"));
|
|
28
|
+
return cents * MICROS_PER_CENT;
|
|
29
|
+
}
|
|
30
|
+
/** A percent with at most two decimals as basis points, or `null`. */
|
|
31
|
+
export function parseBasisPoints(text) {
|
|
32
|
+
const match = /^(\d{1,3})(?:\.(\d{1,2}))?$/.exec(text.trim());
|
|
33
|
+
if (match === null) {
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
const points = Number(match[1]) * 100 + Number((match[2] ?? "").padEnd(2, "0"));
|
|
37
|
+
return points <= 10_000 ? points : null;
|
|
38
|
+
}
|
|
39
|
+
/** Translate a draft into the create request, refusing what the contract cannot take. */
|
|
40
|
+
export function planInputFromDraft(draft) {
|
|
41
|
+
const name = draft.name.trim();
|
|
42
|
+
if (name === "") {
|
|
43
|
+
return { ok: false, field: "name", message: "A plan needs a name." };
|
|
44
|
+
}
|
|
45
|
+
const slug = draft.slug.trim();
|
|
46
|
+
if (!SLUG.test(slug)) {
|
|
47
|
+
return { ok: false, field: "slug", message: "Lowercase letters, digits and single hyphens, e.g. team-2027." };
|
|
48
|
+
}
|
|
49
|
+
const minimum = parseUsd(draft.monthlyMinimumUsd);
|
|
50
|
+
if (minimum === null) {
|
|
51
|
+
return { ok: false, field: "monthlyMinimumUsd", message: "A dollar amount, e.g. 99 or 99.50." };
|
|
52
|
+
}
|
|
53
|
+
const share = parseBasisPoints(draft.usageSharePercent);
|
|
54
|
+
if (share === null) {
|
|
55
|
+
return { ok: false, field: "usageSharePercent", message: "A percent from 0 to 100, e.g. 10." };
|
|
56
|
+
}
|
|
57
|
+
const managed = draft.features.includes(Feature.managed_organizations);
|
|
58
|
+
let includedManagedOrganizations;
|
|
59
|
+
let perExtraOrganizationMicros;
|
|
60
|
+
if (managed && draft.includedManagedOrganizations.trim() !== "") {
|
|
61
|
+
const included = Number(draft.includedManagedOrganizations.trim());
|
|
62
|
+
if (!Number.isInteger(included) || included < 0) {
|
|
63
|
+
return { ok: false, field: "includedManagedOrganizations", message: "A whole number, or empty for unlimited." };
|
|
64
|
+
}
|
|
65
|
+
includedManagedOrganizations = included;
|
|
66
|
+
const fee = parseUsd(draft.perExtraOrganizationUsd === "" ? "0" : draft.perExtraOrganizationUsd);
|
|
67
|
+
if (fee === null) {
|
|
68
|
+
return { ok: false, field: "perExtraOrganizationUsd", message: "A dollar amount per organization, e.g. 25." };
|
|
69
|
+
}
|
|
70
|
+
perExtraOrganizationMicros = fee;
|
|
71
|
+
}
|
|
72
|
+
return {
|
|
73
|
+
ok: true,
|
|
74
|
+
input: {
|
|
75
|
+
name,
|
|
76
|
+
slug,
|
|
77
|
+
org: "",
|
|
78
|
+
instrument: PlanInstrument.subscription,
|
|
79
|
+
entitlements: {
|
|
80
|
+
features: [...new Set(draft.features)].sort((a, b) => a - b),
|
|
81
|
+
...(includedManagedOrganizations === undefined ? {} : { limits: { includedManagedOrganizations } }),
|
|
82
|
+
},
|
|
83
|
+
terms: {
|
|
84
|
+
monthlyMinimumMicros: minimum,
|
|
85
|
+
usageShareBasisPoints: share,
|
|
86
|
+
...(perExtraOrganizationMicros === undefined ? {} : { perExtraOrganizationMicros }),
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=plan-draft.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plan-draft.js","sourceRoot":"","sources":["../src/plan-catalog/plan-draft.ts"],"names":[],"mappings":"AAAA,gEAAgE;AAChE,yEAAyE;AACzE,oEAAoE;AACpE,uEAAuE;AAGvE,OAAO,EAAE,cAAc,EAAE,MAAM,oDAAoD,CAAC;AACpF,OAAO,EAAE,OAAO,EAAE,MAAM,uDAAuD,CAAC;AAEhF,sEAAsE;AACtE,2DAA2D;AAC3D,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC;AACvC,MAAM,aAAa,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;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AAK;gBAC5B,GAAG,CAAC,0BAA0B,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,0BAA0B,EAAE,CAAC;aACpF;SACF;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { PlanInput } from "@stigmer/sdk";
|
|
2
|
+
import type { Plan } from "@stigmer/protos/ai/stigmer/billing/plan/v1/api_pb";
|
|
3
|
+
/** Return value of {@link useCreatePlan}. */
|
|
4
|
+
export interface UseCreatePlanReturn {
|
|
5
|
+
/**
|
|
6
|
+
* Add a plan to the catalog. A plan's terms are final once it exists:
|
|
7
|
+
* there is no update, so changed terms are a new plan and the old one
|
|
8
|
+
* is retired.
|
|
9
|
+
*/
|
|
10
|
+
readonly createPlan: (input: PlanInput) => Promise<Plan>;
|
|
11
|
+
/** `true` while a create is in flight. */
|
|
12
|
+
readonly isSubmitting: boolean;
|
|
13
|
+
/** Error from the last failed attempt, or `null` when healthy. */
|
|
14
|
+
readonly error: Error | null;
|
|
15
|
+
/** Reset `error` to `null`. */
|
|
16
|
+
readonly clearError: () => void;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Behaviour hook that adds a plan to the Stigmer Cloud catalog.
|
|
20
|
+
* Platform-operator surface: `can_manage_plans` on `platform:stigmer`.
|
|
21
|
+
*/
|
|
22
|
+
export declare function useCreatePlan(): UseCreatePlanReturn;
|
|
23
|
+
/** Return value of {@link useRetirePlan}. */
|
|
24
|
+
export interface UseRetirePlanReturn {
|
|
25
|
+
/**
|
|
26
|
+
* Retire a plan: it can no longer be bought, and every subscription
|
|
27
|
+
* already on it keeps it. Retiring is final.
|
|
28
|
+
*/
|
|
29
|
+
readonly retirePlan: (planId: string) => Promise<Plan>;
|
|
30
|
+
/** `true` while a retire is in flight. */
|
|
31
|
+
readonly isSubmitting: boolean;
|
|
32
|
+
/** Error from the last failed attempt, or `null` when healthy. */
|
|
33
|
+
readonly error: Error | null;
|
|
34
|
+
/** Reset `error` to `null`. */
|
|
35
|
+
readonly clearError: () => void;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Behaviour hook that retires a catalog plan.
|
|
39
|
+
* Platform-operator surface: `can_manage_plans` on `platform:stigmer`.
|
|
40
|
+
*/
|
|
41
|
+
export declare function useRetirePlan(): UseRetirePlanReturn;
|
|
42
|
+
//# sourceMappingURL=usePlanMutations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usePlanMutations.d.ts","sourceRoot":"","sources":["../src/plan-catalog/usePlanMutations.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,mDAAmD,CAAC;AAI9E,6CAA6C;AAC7C,MAAM,WAAW,mBAAmB;IAClC;;;;OAIG;IACH,QAAQ,CAAC,UAAU,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACzD,0CAA0C;IAC1C,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC;IAC/B,kEAAkE;IAClE,QAAQ,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IAC7B,+BAA+B;IAC/B,QAAQ,CAAC,UAAU,EAAE,MAAM,IAAI,CAAC;CACjC;AAED;;;GAGG;AACH,wBAAgB,aAAa,IAAI,mBAAmB,CAsBnD;AAED,6CAA6C;AAC7C,MAAM,WAAW,mBAAmB;IAClC;;;OAGG;IACH,QAAQ,CAAC,UAAU,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACvD,0CAA0C;IAC1C,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC;IAC/B,kEAAkE;IAClE,QAAQ,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IAC7B,+BAA+B;IAC/B,QAAQ,CAAC,UAAU,EAAE,MAAM,IAAI,CAAC;CACjC;AAED;;;GAGG;AACH,wBAAgB,aAAa,IAAI,mBAAmB,CAsBnD"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useCallback, useMemo, useState } from "react";
|
|
3
|
+
import { useStigmer } from "../hooks.js";
|
|
4
|
+
import { toError } from "../internal/toError.js";
|
|
5
|
+
/**
|
|
6
|
+
* Behaviour hook that adds a plan to the Stigmer Cloud catalog.
|
|
7
|
+
* Platform-operator surface: `can_manage_plans` on `platform:stigmer`.
|
|
8
|
+
*/
|
|
9
|
+
export function useCreatePlan() {
|
|
10
|
+
const stigmer = useStigmer();
|
|
11
|
+
const [isSubmitting, setIsSubmitting] = useState(false);
|
|
12
|
+
const [error, setError] = useState(null);
|
|
13
|
+
const createPlan = useCallback(async (input) => {
|
|
14
|
+
setIsSubmitting(true);
|
|
15
|
+
setError(null);
|
|
16
|
+
try {
|
|
17
|
+
return await stigmer.plan.create(input);
|
|
18
|
+
}
|
|
19
|
+
catch (e) {
|
|
20
|
+
const err = toError(e);
|
|
21
|
+
setError(err);
|
|
22
|
+
throw err;
|
|
23
|
+
}
|
|
24
|
+
finally {
|
|
25
|
+
setIsSubmitting(false);
|
|
26
|
+
}
|
|
27
|
+
}, [stigmer.plan]);
|
|
28
|
+
const clearError = useCallback(() => setError(null), []);
|
|
29
|
+
return useMemo(() => ({ createPlan, isSubmitting, error, clearError }), [createPlan, isSubmitting, error, clearError]);
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Behaviour hook that retires a catalog plan.
|
|
33
|
+
* Platform-operator surface: `can_manage_plans` on `platform:stigmer`.
|
|
34
|
+
*/
|
|
35
|
+
export function useRetirePlan() {
|
|
36
|
+
const stigmer = useStigmer();
|
|
37
|
+
const [isSubmitting, setIsSubmitting] = useState(false);
|
|
38
|
+
const [error, setError] = useState(null);
|
|
39
|
+
const retirePlan = useCallback(async (planId) => {
|
|
40
|
+
setIsSubmitting(true);
|
|
41
|
+
setError(null);
|
|
42
|
+
try {
|
|
43
|
+
return await stigmer.plan.retire(planId);
|
|
44
|
+
}
|
|
45
|
+
catch (e) {
|
|
46
|
+
const err = toError(e);
|
|
47
|
+
setError(err);
|
|
48
|
+
throw err;
|
|
49
|
+
}
|
|
50
|
+
finally {
|
|
51
|
+
setIsSubmitting(false);
|
|
52
|
+
}
|
|
53
|
+
}, [stigmer.plan]);
|
|
54
|
+
const clearError = useCallback(() => setError(null), []);
|
|
55
|
+
return useMemo(() => ({ retirePlan, isSubmitting, error, clearError }), [retirePlan, isSubmitting, error, clearError]);
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=usePlanMutations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usePlanMutations.js","sourceRoot":"","sources":["../src/plan-catalog/usePlanMutations.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAGvD,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAkBjD;;;GAGG;AACH,MAAM,UAAU,aAAa;IAC3B,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;IAC7B,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IACxD,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAe,IAAI,CAAC,CAAC;IACvD,MAAM,UAAU,GAAG,WAAW,CAC5B,KAAK,EAAE,KAAgB,EAAiB,EAAE;QACxC,eAAe,CAAC,IAAI,CAAC,CAAC;QACtB,QAAQ,CAAC,IAAI,CAAC,CAAC;QACf,IAAI,CAAC;YACH,OAAO,MAAM,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAC1C,CAAC;QAAC,OA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AK,CAAC,CAAC;QACzB,CAAC;IACH,CAAC,EACD,CAAC,OAAO,CAAC,IAAI,CAAC,CACf,CAAC;IACF,MAAM,UAAU,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC;IACzD,OAAO,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,UAAU,EAAE,YAAY,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC,EAAE,CAAC,UAAU,EAAE,YAAY,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC;AACzH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TeamsSection.d.ts","sourceRoot":"","sources":["../src/settings/TeamsSection.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TeamsSection.d.ts","sourceRoot":"","sources":["../src/settings/TeamsSection.tsx"],"names":[],"mappings":"AA2CA,oDAAoD;AACpD,wBAAgB,YAAY,4CAsG3B"}
|
package/settings/TeamsSection.js
CHANGED
|
@@ -12,9 +12,21 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
12
12
|
*
|
|
13
13
|
* The section owns the list's data and passes it down, so a create, an edit
|
|
14
14
|
* or a delete refreshes the list here without a child reaching up.
|
|
15
|
+
*
|
|
16
|
+
* On Stigmer Cloud, teams are a plan feature: where the organization's plan
|
|
17
|
+
* lacks them, the section names the cheapest plan that includes them and
|
|
18
|
+
* links to the plans in place of "New team", and its existing teams stay
|
|
19
|
+
* readable and usable. Only Cloud reads
|
|
20
|
+
* the plan; on Enterprise a license never lists teams and every
|
|
21
|
+
* organization has them, so the read would refuse Enterprise its own teams.
|
|
15
22
|
*/
|
|
16
23
|
import { useCallback, useId, useState } from "react";
|
|
17
|
-
import {
|
|
24
|
+
import { Feature } from "@stigmer/protos/ai/stigmer/platform/v1/entitlement_pb";
|
|
25
|
+
import { UpgradeNotice } from "../billing/UpgradeNotice.js";
|
|
26
|
+
import { lowestPlanWith } from "../billing/plan-features.js";
|
|
27
|
+
import { useEntitlements } from "../billing/useEntitlements.js";
|
|
28
|
+
import { usePlans } from "../billing/usePlans.js";
|
|
29
|
+
import { useDeploymentMode, useResourceAvailable, ApiResourceKind } from "../deployment-mode.js";
|
|
18
30
|
import { CloudFeatureNotice } from "../internal/CloudFeatureNotice.js";
|
|
19
31
|
import { PermissionGate } from "../iam-policy/PermissionGate.js";
|
|
20
32
|
import { useOrg } from "../organization/OrgProvider.js";
|
|
@@ -29,6 +41,11 @@ export function TeamsSection() {
|
|
|
29
41
|
const teamsServed = useResourceAvailable(ApiResourceKind.team);
|
|
30
42
|
const orgSlug = activeOrg?.metadata?.slug ?? "";
|
|
31
43
|
const orgId = activeOrg?.metadata?.id ?? "";
|
|
44
|
+
const onCloud = useDeploymentMode() === "cloud";
|
|
45
|
+
const plan = useEntitlements(orgId || null, { enabled: onCloud && teamsServed });
|
|
46
|
+
const planLacksTeams = plan.allows(Feature.teams) === false;
|
|
47
|
+
const catalog = usePlans({ enabled: planLacksTeams });
|
|
48
|
+
const unlockingPlanName = lowestPlanWith(catalog.plans ?? [], Feature.teams)?.metadata?.name;
|
|
32
49
|
const list = useTeamList(teamsServed && orgSlug ? orgSlug : null);
|
|
33
50
|
const { refetch } = list;
|
|
34
51
|
const [flow, setFlow] = useState({ phase: "idle" });
|
|
@@ -44,6 +61,6 @@ export function TeamsSection() {
|
|
|
44
61
|
refetch();
|
|
45
62
|
setFlow({ phase: "idle" });
|
|
46
63
|
}, [refetch]);
|
|
47
|
-
return (_jsxs("section", { "aria-labelledby": headingId, children: [_jsxs("div", { className: "stg:mb-3 stg:flex stg:items-center stg:justify-between", children: [_jsx("h2", { id: headingId, className: "stg:text-foreground stg:text-sm stg:font-semibold", children: "Teams" }), teamsServed && orgId && flow.phase === "idle" && (_jsx(PermissionGate, { resource: { kind: "organization", id: orgId }, relation: "can_create_team", children: _jsx("button", { type: "button", onClick: () => setFlow({ phase: "creating" }), className: "stg:text-primary stg:hover:text-foreground stg:text-xs stg:font-medium stg:transition-colors", children: "+ New team" }) }))] }), _jsx("p", { className: "stg:text-muted-foreground stg:mb-4 stg:text-xs", children: "Teams group people so agents, workflows and other resources can be shared with everyone in the team at once. Adding someone to a team gives them everything shared with it. Removing them from the team, or their leaving the organization, takes that access away." }), !teamsServed ? (_jsx(CloudFeatureNotice, { children: "Teams are available in Stigmer Enterprise and Cloud. This edition shares resources with people and with the whole organization." })) : !orgSlug ? (_jsx("p", { className: "stg:text-muted-foreground stg:py-4 stg:text-center stg:text-xs", children: "Select an organization to manage teams." })) : flow.phase === "creating" ? (_jsx("div", { className: "stg:border-border stg:bg-card stg:rounded-lg stg:border stg:p-4", children: _jsx(CreateTeamForm, { org: orgSlug, onCreated: handleCreated, onCancel: () => setFlow({ phase: "idle" }) }) })) : flow.phase === "viewing" ? (_jsx("div", { className: "stg:border-border stg:bg-card stg:rounded-lg stg:border stg:p-4", children: _jsx(TeamDetailPanel, { team: flow.team, orgId: orgId, onUpdated: handleUpdated, onDeleted: handleDeleted, onBack: () => setFlow({ phase: "idle" }) }, flow.team.metadata?.id) })) : (_jsx(TeamListPanel, { teams: list.teams, isLoading: list.isLoading, error: list.error, onOpen: (team) => setFlow({ phase: "viewing", team }) }))] }));
|
|
64
|
+
return (_jsxs("section", { "aria-labelledby": headingId, children: [_jsxs("div", { className: "stg:mb-3 stg:flex stg:items-center stg:justify-between", children: [_jsx("h2", { id: headingId, className: "stg:text-foreground stg:text-sm stg:font-semibold", children: "Teams" }), teamsServed && orgId && flow.phase === "idle" && !planLacksTeams && (_jsx(PermissionGate, { resource: { kind: "organization", id: orgId }, relation: "can_create_team", children: _jsx("button", { type: "button", onClick: () => setFlow({ phase: "creating" }), className: "stg:text-primary stg:hover:text-foreground stg:text-xs stg:font-medium stg:transition-colors", children: "+ New team" }) }))] }), _jsx("p", { className: "stg:text-muted-foreground stg:mb-4 stg:text-xs", children: "Teams group people so agents, workflows and other resources can be shared with everyone in the team at once. Adding someone to a team gives them everything shared with it. Removing them from the team, or their leaving the organization, takes that access away." }), teamsServed && orgId && planLacksTeams && _jsx(UpgradeNotice, { feature: Feature.teams, unlockingPlanName: unlockingPlanName, className: "stg:mb-3" }), !teamsServed ? (_jsx(CloudFeatureNotice, { children: "Teams are available in Stigmer Enterprise and Cloud. This edition shares resources with people and with the whole organization." })) : !orgSlug ? (_jsx("p", { className: "stg:text-muted-foreground stg:py-4 stg:text-center stg:text-xs", children: "Select an organization to manage teams." })) : flow.phase === "creating" ? (_jsx("div", { className: "stg:border-border stg:bg-card stg:rounded-lg stg:border stg:p-4", children: _jsx(CreateTeamForm, { org: orgSlug, onCreated: handleCreated, onCancel: () => setFlow({ phase: "idle" }) }) })) : flow.phase === "viewing" ? (_jsx("div", { className: "stg:border-border stg:bg-card stg:rounded-lg stg:border stg:p-4", children: _jsx(TeamDetailPanel, { team: flow.team, orgId: orgId, onUpdated: handleUpdated, onDeleted: handleDeleted, onBack: () => setFlow({ phase: "idle" }) }, flow.team.metadata?.id) })) : (_jsx(TeamListPanel, { teams: list.teams, isLoading: list.isLoading, error: list.error, onOpen: (team) => setFlow({ phase: "viewing", team }) }))] }));
|
|
48
65
|
}
|
|
49
66
|
//# sourceMappingURL=TeamsSection.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TeamsSection.js","sourceRoot":"","sources":["../src/settings/TeamsSection.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb
|
|
1
|
+
{"version":3,"file":"TeamsSection.js","sourceRoot":"","sources":["../src/settings/TeamsSection.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAErD,OAAO,EAAE,OAAO,EAAE,MAAM,uDAAuD,CAAC;AAChF,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B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,EAAE,CAAC,IALnC,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAE,CAM3B,GACE,CACP,CAAC,CAAC,CAAC,CACF,KAAC,aAAa,IACZ,KAAK,EAAE,IAAI,CAAC,KAAK,EACjB,SAAS,EAAE,IAAI,CAAC,SAAS,EACzB,KAAK,EAAE,IAAI,CAAC,KAAK,EACjB,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,GACrD,CACH,IACO,CACX,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"settings-nav.d.ts","sourceRoot":"","sources":["../src/settings/settings-nav.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"settings-nav.d.ts","sourceRoot":"","sources":["../src/settings/settings-nav.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAwB3C,sDAAsD;AACtD,MAAM,WAAW,eAAe;IAC9B,yCAAyC;IACzC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,oDAAoD;IACpD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,wDAAwD;IACxD,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC;QAC3B,mDAAmD;QACnD,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,CAAC,CAAC;IACH;;;;;;OAMG;IACH,QAAQ,CAAC,kBAAkB,CAAC,EAAE,MAAM,CAAC;CACtC;AAED,kEAAkE;AAClE,MAAM,WAAW,gBAAgB;IAC/B,sDAAsD;IACtD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,gDAAgD;IAChD,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,yCAAyC;IACzC,QAAQ,CAAC,KAAK,EAAE,SAAS,eAAe,EAAE,CAAC;CAC5C;AAED,2DAA2D;AAC3D,eAAO,MAAM,mBAAmB,EAAE,SAAS,gBAAgB,EA8D1D,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,2BAA2B,EAAE,gBAoCzC,CAAC"}
|
package/settings/settings-nav.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Activity, AppWindow, BarChart3, Box, Brain, Building2, CreditCard, FileBadge, KeyRound, Link, MessageSquare, MousePointerClick, Plug, Scale, ShieldCheck, SlidersHorizontal, UserCog, Users, UsersRound, } from "lucide-react";
|
|
1
|
+
import { Activity, AppWindow, BarChart3, Box, Brain, Building2, CreditCard, FileBadge, Layers, KeyRound, Link, MessageSquare, MousePointerClick, Plug, Scale, ShieldCheck, SlidersHorizontal, UserCog, Users, UsersRound, } from "lucide-react";
|
|
2
2
|
/** Canonical settings sidebar/grouped navigation model. */
|
|
3
3
|
export const SETTINGS_NAV_GROUPS = [
|
|
4
4
|
{
|
|
@@ -102,6 +102,12 @@ export const PLATFORM_SETTINGS_NAV_GROUP = {
|
|
|
102
102
|
icon: FileBadge,
|
|
103
103
|
requiredPermission: "can_issue_license",
|
|
104
104
|
},
|
|
105
|
+
{
|
|
106
|
+
href: "/settings/plans",
|
|
107
|
+
label: "Plans",
|
|
108
|
+
icon: Layers,
|
|
109
|
+
requiredPermission: "can_manage_plans",
|
|
110
|
+
},
|
|
105
111
|
],
|
|
106
112
|
};
|
|
107
113
|
//# sourceMappingURL=settings-nav.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"settings-nav.js","sourceRoot":"","sources":["../src/settings/settings-nav.ts"],"names":[],"mappings":"AACA,OAAO,EACL,QAAQ,EACR,SAAS,EACT,SAAS,EACT,GAAG,EACH,KAAK,EACL,SAAS,EACT,UAAU,EACV,SAAS,EACT,QAAQ,EACR,IAAI,EACJ,aAAa,EACb,iBAAiB,EACjB,IAAI,EACJ,KAAK,E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,kBAAkB,EAAE,4BAA4B;SACjD;QACD;YACE,IAAI,EAAE,oBAAoB;YAC1B,KAAK,EAAE,UAAU;YACjB,IAAI,EAAE,SAAS;YACf,kBAAkB,EAAE,mBAAmB;SACxC;QACD;YACE,IAAI,EAAE,iBAAiB;YACvB,KAAK,EAAE,OAAO;YACd,IAAI,EAAE,MAAM;YACZ,kBAAkB,EAAE,kBAAkB;SACvC;KACF;CACF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSettingsNavGroups.d.ts","sourceRoot":"","sources":["../src/settings/useSettingsNavGroups.ts"],"names":[],"mappings":"AAIA,OAAO,EAGL,KAAK,gBAAgB,EACtB,MAAM,mBAAmB,CAAC;AAS3B;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,oBAAoB,IAAI,SAAS,gBAAgB,EAAE,
|
|
1
|
+
{"version":3,"file":"useSettingsNavGroups.d.ts","sourceRoot":"","sources":["../src/settings/useSettingsNavGroups.ts"],"names":[],"mappings":"AAIA,OAAO,EAGL,KAAK,gBAAgB,EACtB,MAAM,mBAAmB,CAAC;AAS3B;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,oBAAoB,IAAI,SAAS,gBAAgB,EAAE,CA0DlE"}
|
|
@@ -39,16 +39,19 @@ export function useSettingsNavGroups() {
|
|
|
39
39
|
const cursorAccounts = useCheckPermission(PLATFORM_RESOURCE, "can_manage_cursor_accounts", { fail: "closed" });
|
|
40
40
|
const providerStanding = useCheckPermission(PLATFORM_RESOURCE, "can_view_provider_standing", { fail: "closed" });
|
|
41
41
|
const licenses = useCheckPermission(PLATFORM_RESOURCE, "can_issue_license", { fail: "closed" });
|
|
42
|
+
const plans = useCheckPermission(PLATFORM_RESOURCE, "can_manage_plans", { fail: "closed" });
|
|
42
43
|
const pricingAllowed = pricing.allowed;
|
|
43
44
|
const cursorAccountsAllowed = cursorAccounts.allowed;
|
|
44
45
|
const providerStandingAllowed = providerStanding.allowed;
|
|
45
46
|
const licensesAllowed = licenses.allowed;
|
|
47
|
+
const plansAllowed = plans.allowed;
|
|
46
48
|
return useMemo(() => {
|
|
47
49
|
const verdicts = {
|
|
48
50
|
can_manage_model_pricing: pricingAllowed,
|
|
49
51
|
can_manage_cursor_accounts: cursorAccountsAllowed,
|
|
50
52
|
can_view_provider_standing: providerStandingAllowed,
|
|
51
53
|
can_issue_license: licensesAllowed,
|
|
54
|
+
can_manage_plans: plansAllowed,
|
|
52
55
|
};
|
|
53
56
|
const visibleItems = PLATFORM_SETTINGS_NAV_GROUP.items.filter(
|
|
54
57
|
// Fail closed on both axes: an item with no declared permission or
|
|
@@ -62,6 +65,6 @@ export function useSettingsNavGroups() {
|
|
|
62
65
|
...SETTINGS_NAV_GROUPS,
|
|
63
66
|
{ ...PLATFORM_SETTINGS_NAV_GROUP, items: visibleItems },
|
|
64
67
|
];
|
|
65
|
-
}, [pricingAllowed, cursorAccountsAllowed, providerStandingAllowed, licensesAllowed]);
|
|
68
|
+
}, [pricingAllowed, cursorAccountsAllowed, providerStandingAllowed, licensesAllowed, plansAllowed]);
|
|
66
69
|
}
|
|
67
70
|
//# sourceMappingURL=useSettingsNavGroups.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSettingsNavGroups.js","sourceRoot":"","sources":["../src/settings/useSettingsNavGroups.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAChC,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AACzE,OAAO,EACL,2BAA2B,EAC3B,mBAAmB,GAEpB,MAAM,mBAAmB,CAAC;AAE3B;;;;GAIG;AACH,MAAM,iBAAiB,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE,EAAE,SAAS,EAAW,CAAC;AAEvE;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,UAAU,oBAAoB;IAClC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mB;YACtB,EAAE,GAAG,2BAA2B,EAAE,KAAK,EAAE,YAAY,EAAE;SACxD,CAAC;IACJ,CAAC,EAAE,CAAC,cAAc,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,eAAe,EAAE,YAAY,CAAC,CAAC,CAAC;AACtG,CAAC"}
|
|
@@ -161,8 +161,8 @@ export function AutoRechargeCard({
|
|
|
161
161
|
|
|
162
162
|
{!hasPaymentMethod && (
|
|
163
163
|
<p className="stg:mt-3 stg:text-xs stg:text-muted-foreground">
|
|
164
|
-
A saved payment method is required to enable auto-recharge.
|
|
165
|
-
|
|
164
|
+
A saved payment method is required to enable auto-recharge. Add
|
|
165
|
+
one under Payment Method.
|
|
166
166
|
</p>
|
|
167
167
|
)}
|
|
168
168
|
|