@stigmer/react 3.39.1-dev.20260928194002 → 3.40.1

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.
Files changed (200) hide show
  1. package/billing/AutoRechargeCard.js +1 -1
  2. package/billing/AutoRechargeCard.js.map +1 -1
  3. package/billing/BillingSection.d.ts +18 -1
  4. package/billing/BillingSection.d.ts.map +1 -1
  5. package/billing/BillingSection.js +21 -11
  6. package/billing/BillingSection.js.map +1 -1
  7. package/billing/ChangePlanDialog.d.ts +46 -0
  8. package/billing/ChangePlanDialog.d.ts.map +1 -0
  9. package/billing/ChangePlanDialog.js +90 -0
  10. package/billing/ChangePlanDialog.js.map +1 -0
  11. package/billing/CreditPackGrid.d.ts +1 -1
  12. package/billing/CreditPackGrid.js +1 -1
  13. package/billing/LowBalanceBanner.js +1 -1
  14. package/billing/LowBalanceBanner.js.map +1 -1
  15. package/billing/PaymentMethodCard.d.ts +9 -1
  16. package/billing/PaymentMethodCard.d.ts.map +1 -1
  17. package/billing/PaymentMethodCard.js +2 -2
  18. package/billing/PaymentMethodCard.js.map +1 -1
  19. package/billing/PlanCard.d.ts +27 -0
  20. package/billing/PlanCard.d.ts.map +1 -0
  21. package/billing/PlanCard.js +68 -0
  22. package/billing/PlanCard.js.map +1 -0
  23. package/billing/PlanPicker.d.ts +34 -0
  24. package/billing/PlanPicker.d.ts.map +1 -0
  25. package/billing/PlanPicker.js +46 -0
  26. package/billing/PlanPicker.js.map +1 -0
  27. package/billing/PlanSection.d.ts +45 -0
  28. package/billing/PlanSection.d.ts.map +1 -0
  29. package/billing/PlanSection.js +136 -0
  30. package/billing/PlanSection.js.map +1 -0
  31. package/billing/UpgradeNotice.d.ts +47 -0
  32. package/billing/UpgradeNotice.d.ts.map +1 -0
  33. package/billing/UpgradeNotice.js +49 -0
  34. package/billing/UpgradeNotice.js.map +1 -0
  35. package/billing/credit-packs.d.ts.map +1 -1
  36. package/billing/credit-packs.js +4 -1
  37. package/billing/credit-packs.js.map +1 -1
  38. package/billing/index.d.ts +26 -1
  39. package/billing/index.d.ts.map +1 -1
  40. package/billing/index.js +12 -0
  41. package/billing/index.js.map +1 -1
  42. package/billing/plan-features.d.ts +60 -0
  43. package/billing/plan-features.d.ts.map +1 -0
  44. package/billing/plan-features.js +128 -0
  45. package/billing/plan-features.js.map +1 -0
  46. package/billing/plan-state.d.ts +43 -0
  47. package/billing/plan-state.d.ts.map +1 -0
  48. package/billing/plan-state.js +69 -0
  49. package/billing/plan-state.js.map +1 -0
  50. package/billing/redirect.d.ts +31 -0
  51. package/billing/redirect.d.ts.map +1 -0
  52. package/billing/redirect.js +30 -0
  53. package/billing/redirect.js.map +1 -0
  54. package/billing/useBillingAccount.d.ts +10 -1
  55. package/billing/useBillingAccount.d.ts.map +1 -1
  56. package/billing/useBillingAccount.js +2 -2
  57. package/billing/useBillingAccount.js.map +1 -1
  58. package/billing/useChangePlan.d.ts +51 -0
  59. package/billing/useChangePlan.d.ts.map +1 -0
  60. package/billing/useChangePlan.js +61 -0
  61. package/billing/useChangePlan.js.map +1 -0
  62. package/billing/useCreateBillingPortalSession.d.ts +6 -3
  63. package/billing/useCreateBillingPortalSession.d.ts.map +1 -1
  64. package/billing/useCreateBillingPortalSession.js +11 -4
  65. package/billing/useCreateBillingPortalSession.js.map +1 -1
  66. package/billing/useCreateCheckoutSession.d.ts +7 -5
  67. package/billing/useCreateCheckoutSession.d.ts.map +1 -1
  68. package/billing/useCreateCheckoutSession.js +5 -3
  69. package/billing/useCreateCheckoutSession.js.map +1 -1
  70. package/billing/useCreatePaymentMethodSetupSession.d.ts +28 -0
  71. package/billing/useCreatePaymentMethodSetupSession.d.ts.map +1 -0
  72. package/billing/useCreatePaymentMethodSetupSession.js +50 -0
  73. package/billing/useCreatePaymentMethodSetupSession.js.map +1 -0
  74. package/billing/useEntitlements.d.ts +46 -0
  75. package/billing/useEntitlements.d.ts.map +1 -0
  76. package/billing/useEntitlements.js +37 -0
  77. package/billing/useEntitlements.js.map +1 -0
  78. package/billing/usePeriodEstimate.d.ts +35 -0
  79. package/billing/usePeriodEstimate.d.ts.map +1 -0
  80. package/billing/usePeriodEstimate.js +29 -0
  81. package/billing/usePeriodEstimate.js.map +1 -0
  82. package/billing/usePlans.d.ts +38 -0
  83. package/billing/usePlans.d.ts.map +1 -0
  84. package/billing/usePlans.js +33 -0
  85. package/billing/usePlans.js.map +1 -0
  86. package/billing/useSubscription.d.ts +39 -0
  87. package/billing/useSubscription.d.ts.map +1 -0
  88. package/billing/useSubscription.js +40 -0
  89. package/billing/useSubscription.js.map +1 -0
  90. package/channel-app/ChannelAppDetailPanel.d.ts +5 -0
  91. package/channel-app/ChannelAppDetailPanel.d.ts.map +1 -1
  92. package/channel-app/ChannelAppDetailPanel.js +9 -3
  93. package/channel-app/ChannelAppDetailPanel.js.map +1 -1
  94. package/channel-app/ChannelAppListPanel.d.ts +13 -4
  95. package/channel-app/ChannelAppListPanel.d.ts.map +1 -1
  96. package/channel-app/ChannelAppListPanel.js +5 -5
  97. package/channel-app/ChannelAppListPanel.js.map +1 -1
  98. package/channel-app/copy.d.ts +15 -0
  99. package/channel-app/copy.d.ts.map +1 -0
  100. package/channel-app/copy.js +15 -0
  101. package/channel-app/copy.js.map +1 -0
  102. package/index.d.ts +4 -2
  103. package/index.d.ts.map +1 -1
  104. package/index.js +4 -1
  105. package/index.js.map +1 -1
  106. package/internal/features.d.ts +11 -0
  107. package/internal/features.d.ts.map +1 -0
  108. package/internal/features.js +42 -0
  109. package/internal/features.js.map +1 -0
  110. package/licenses/license-format.d.ts +5 -3
  111. package/licenses/license-format.d.ts.map +1 -1
  112. package/licenses/license-format.js +10 -19
  113. package/licenses/license-format.js.map +1 -1
  114. package/package.json +5 -5
  115. package/plan-catalog/PlanCatalogConsole.d.ts +22 -0
  116. package/plan-catalog/PlanCatalogConsole.d.ts.map +1 -0
  117. package/plan-catalog/PlanCatalogConsole.js +90 -0
  118. package/plan-catalog/PlanCatalogConsole.js.map +1 -0
  119. package/plan-catalog/PlanCreateForm.d.ts +17 -0
  120. package/plan-catalog/PlanCreateForm.d.ts.map +1 -0
  121. package/plan-catalog/PlanCreateForm.js +52 -0
  122. package/plan-catalog/PlanCreateForm.js.map +1 -0
  123. package/plan-catalog/PlansAccessNotice.d.ts +10 -0
  124. package/plan-catalog/PlansAccessNotice.d.ts.map +1 -0
  125. package/plan-catalog/PlansAccessNotice.js +13 -0
  126. package/plan-catalog/PlansAccessNotice.js.map +1 -0
  127. package/plan-catalog/index.d.ts +8 -0
  128. package/plan-catalog/index.d.ts.map +1 -0
  129. package/plan-catalog/index.js +10 -0
  130. package/plan-catalog/index.js.map +1 -0
  131. package/plan-catalog/plan-draft.d.ts +30 -0
  132. package/plan-catalog/plan-draft.d.ts.map +1 -0
  133. package/plan-catalog/plan-draft.js +91 -0
  134. package/plan-catalog/plan-draft.js.map +1 -0
  135. package/plan-catalog/usePlanMutations.d.ts +42 -0
  136. package/plan-catalog/usePlanMutations.d.ts.map +1 -0
  137. package/plan-catalog/usePlanMutations.js +57 -0
  138. package/plan-catalog/usePlanMutations.js.map +1 -0
  139. package/settings/ChannelAppsSection.d.ts +7 -0
  140. package/settings/ChannelAppsSection.d.ts.map +1 -1
  141. package/settings/ChannelAppsSection.js +15 -2
  142. package/settings/ChannelAppsSection.js.map +1 -1
  143. package/settings/TeamsSection.d.ts.map +1 -1
  144. package/settings/TeamsSection.js +19 -2
  145. package/settings/TeamsSection.js.map +1 -1
  146. package/settings/settings-nav.d.ts.map +1 -1
  147. package/settings/settings-nav.js +7 -1
  148. package/settings/settings-nav.js.map +1 -1
  149. package/settings/useSettingsNavGroups.d.ts.map +1 -1
  150. package/settings/useSettingsNavGroups.js +4 -1
  151. package/settings/useSettingsNavGroups.js.map +1 -1
  152. package/src/billing/AutoRechargeCard.tsx +2 -2
  153. package/src/billing/BillingSection.tsx +68 -11
  154. package/src/billing/ChangePlanDialog.tsx +221 -0
  155. package/src/billing/CreditPackGrid.tsx +1 -1
  156. package/src/billing/LowBalanceBanner.tsx +1 -1
  157. package/src/billing/PaymentMethodCard.tsx +28 -2
  158. package/src/billing/PlanCard.tsx +171 -0
  159. package/src/billing/PlanPicker.tsx +178 -0
  160. package/src/billing/PlanSection.tsx +234 -0
  161. package/src/billing/UpgradeNotice.tsx +95 -0
  162. package/src/billing/credit-packs.ts +4 -1
  163. package/src/billing/index.ts +26 -1
  164. package/src/billing/plan-features.ts +162 -0
  165. package/src/billing/plan-state.ts +92 -0
  166. package/src/billing/redirect.ts +45 -0
  167. package/src/billing/useBillingAccount.ts +12 -0
  168. package/src/billing/useChangePlan.ts +115 -0
  169. package/src/billing/useCreateBillingPortalSession.ts +17 -6
  170. package/src/billing/useCreateCheckoutSession.ts +12 -7
  171. package/src/billing/useCreatePaymentMethodSetupSession.ts +77 -0
  172. package/src/billing/useEntitlements.ts +80 -0
  173. package/src/billing/usePeriodEstimate.ts +59 -0
  174. package/src/billing/usePlans.ts +65 -0
  175. package/src/billing/useSubscription.ts +70 -0
  176. package/src/channel-app/ChannelAppDetailPanel.tsx +179 -158
  177. package/src/channel-app/ChannelAppListPanel.tsx +14 -4
  178. package/src/channel-app/copy.ts +16 -0
  179. package/src/index.ts +54 -0
  180. package/src/internal/features.ts +49 -0
  181. package/src/licenses/license-format.ts +10 -19
  182. package/src/plan-catalog/PlanCatalogConsole.tsx +197 -0
  183. package/src/plan-catalog/PlanCreateForm.tsx +167 -0
  184. package/src/plan-catalog/PlansAccessNotice.tsx +20 -0
  185. package/src/plan-catalog/index.ts +14 -0
  186. package/src/plan-catalog/plan-draft.ts +116 -0
  187. package/src/plan-catalog/usePlanMutations.ts +94 -0
  188. package/src/settings/ChannelAppsSection.tsx +19 -2
  189. package/src/settings/TeamsSection.tsx +20 -2
  190. package/src/settings/settings-nav.ts +7 -0
  191. package/src/settings/useSettingsNavGroups.ts +8 -1
  192. package/src/team/CreateTeamForm.tsx +12 -3
  193. package/src/team/TeamMembersPanel.tsx +6 -2
  194. package/team/CreateTeamForm.d.ts +6 -1
  195. package/team/CreateTeamForm.d.ts.map +1 -1
  196. package/team/CreateTeamForm.js +4 -2
  197. package/team/CreateTeamForm.js.map +1 -1
  198. package/team/TeamMembersPanel.d.ts.map +1 -1
  199. package/team/TeamMembersPanel.js +3 -1
  200. package/team/TeamMembersPanel.js.map +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"license-format.js","sourceRoot":"","sources":["../src/licenses/license-format.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,oEAAoE;AACpE,EAAE;AACF,0EAA0E;AAC1E,4EAA4E;AAC5E,yEAAyE;AACzE,6DAA6D;AAC7D,EAAE;AACF,yEAAyE;AACzE,0EAA0E;AAC1E,4EAA4E;AAC5E,yEAAyE;AACzE,4EAA4E;AAC5E,yEAAyE;AAGzE,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EACL,OAAO,GAER,MAAM,uDAAuD,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,mDAAmD,CAAC;AAiChF,6CAA6C;AAC7C,MAAM,CAAC,MAAM,WAAW,GAA2C;IACjE,CAAC,WAAW,CAAC,KAAK,CAAC,EAAE,OAAO;IAC5B,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,MAAM;CAC3B,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,cAAc,GAEvB;IACF,CAAC,OAAO,CAAC,eAAe,CAAC,EAAE;QACzB,KAAK,EAAE,iBAAiB;QACxB,WAAW,EAAE,oEAAoE;KAClF;IACD,CAAC,OAAO,CAAC,iBAAiB,CAAC,EAAE;QAC3B,KAAK,EAAE,8BAA8B;QACrC,WAAW,EAAE,wEAAwE;KACtF;IACD,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE;QAClB,KAAK,EAAE,UAAU;QACjB,WAAW,EAAE,mEAAmE;KACjF;IACD,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE;QACjB,KAAK,EAAE,SAAS;QAChB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AC;AAED,SAAS,MAAM,CAAC,KAAa,EAAE,IAAY;IACzC,OAAO,GAAG,KAAK,IAAI,IAAI,GAAG,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC;AACrD,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stigmer/react",
3
- "version": "3.39.1-dev.20260928194002",
3
+ "version": "3.40.1",
4
4
  "description": "React provider and client hook for the Stigmer platform SDK",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -37,8 +37,8 @@
37
37
  "dependencies": {
38
38
  "@bufbuild/protovalidate": "^1.1.1",
39
39
  "@dagrejs/dagre": "^1.1.4",
40
- "@stigmer/plugin-package": "3.39.1-dev.20260928194002",
41
- "@stigmer/theme": "3.39.1-dev.20260928194002",
40
+ "@stigmer/plugin-package": "3.40.1",
41
+ "@stigmer/theme": "3.40.1",
42
42
  "diff": "^8.0.3",
43
43
  "fflate": "^0.8.2",
44
44
  "hast-util-to-jsx-runtime": "^2.3.6",
@@ -61,8 +61,8 @@
61
61
  "@codemirror/state": "^6.0.0",
62
62
  "@codemirror/view": "^6.0.0",
63
63
  "@lezer/highlight": "^1.0.0",
64
- "@stigmer/protos": "3.39.1-dev.20260928194002",
65
- "@stigmer/sdk": "3.39.1-dev.20260928194002",
64
+ "@stigmer/protos": "3.40.1",
65
+ "@stigmer/sdk": "3.40.1",
66
66
  "@tanstack/react-table": "^8.20.0",
67
67
  "@xyflow/react": "^12.0.0",
68
68
  "elkjs": "^0.9.0",
@@ -0,0 +1,22 @@
1
+ /** Props for {@link PlanCatalogConsole}. */
2
+ export interface PlanCatalogConsoleProps {
3
+ /** Additional CSS class names. */
4
+ readonly className?: string;
5
+ }
6
+ /**
7
+ * The platform-operator console for the Stigmer Cloud plan catalog: every
8
+ * plan, retired ones included, with its terms and what it offers; retiring
9
+ * a plan; and creating one.
10
+ *
11
+ * Every signed-in caller may read the catalog, so the page gates on
12
+ * `can_manage_plans` on `platform:stigmer` itself, and anyone without it
13
+ * sees the designed access notice. Organizations choose their plan under
14
+ * Billing, not here.
15
+ *
16
+ * @example
17
+ * ```tsx
18
+ * <PlanCatalogConsole />
19
+ * ```
20
+ */
21
+ export declare function PlanCatalogConsole({ className }: PlanCatalogConsoleProps): import("react/jsx-runtime").JSX.Element;
22
+ //# sourceMappingURL=PlanCatalogConsole.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PlanCatalogConsole.d.ts","sourceRoot":"","sources":["../src/plan-catalog/PlanCatalogConsole.tsx"],"names":[],"mappings":"AA2BA,4CAA4C;AAC5C,MAAM,WAAW,uBAAuB;IACtC,kCAAkC;IAClC,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,kBAAkB,CAAC,EAAE,SAAS,EAAE,EAAE,uBAAuB,2CA2FxE"}
@@ -0,0 +1,90 @@
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, isUnimplemented } from "@stigmer/sdk";
6
+ import { PlanInstrument } from "@stigmer/protos/ai/stigmer/billing/plan/v1/spec_pb";
7
+ import { PlanLifecycle } from "@stigmer/protos/ai/stigmer/billing/plan/v1/status_pb";
8
+ import { formatCreditBalance } from "../billing/format.js";
9
+ import { formatManagedOrganizations, formatUsageShare, offeredFeatures } from "../billing/plan-features.js";
10
+ import { usePlans } from "../billing/usePlans.js";
11
+ import { Button } from "../button/index.js";
12
+ import { ApiResourceKind, useResourceAvailable } from "../deployment-mode.js";
13
+ import { useCheckPermission } from "../iam-policy/useCheckPermission.js";
14
+ import { CloudFeatureNotice } from "../internal/CloudFeatureNotice.js";
15
+ import { UNSTYLED_LIST } from "../internal/element-resets.js";
16
+ import { FEATURE_COPY, isNamedFeature } from "../internal/features.js";
17
+ import { ConfirmDialog } from "../resource-detail/ConfirmDialog.js";
18
+ import { useConfirmAction } from "../resource-detail/useConfirmAction.js";
19
+ import { StatusBadge } from "../resource-workbench/components/StatusBadge.js";
20
+ import { PlanCreateForm } from "./PlanCreateForm.js";
21
+ import { PlansAccessNotice } from "./PlansAccessNotice.js";
22
+ import { useRetirePlan } from "./usePlanMutations.js";
23
+ /** The platform object the catalog's permission is held on. */
24
+ const PLATFORM = { kind: "platform", id: "stigmer" };
25
+ /**
26
+ * The platform-operator console for the Stigmer Cloud plan catalog: every
27
+ * plan, retired ones included, with its terms and what it offers; retiring
28
+ * a plan; and creating one.
29
+ *
30
+ * Every signed-in caller may read the catalog, so the page gates on
31
+ * `can_manage_plans` on `platform:stigmer` itself, and anyone without it
32
+ * sees the designed access notice. Organizations choose their plan under
33
+ * Billing, not here.
34
+ *
35
+ * @example
36
+ * ```tsx
37
+ * <PlanCatalogConsole />
38
+ * ```
39
+ */
40
+ export function PlanCatalogConsole({ className }) {
41
+ const available = useResourceAvailable(ApiResourceKind.plan);
42
+ const operator = useCheckPermission(available ? PLATFORM : null, "can_manage_plans", { fail: "closed" });
43
+ const catalog = usePlans({ includeRetired: true, enabled: available && operator.allowed });
44
+ const retirer = useRetirePlan();
45
+ const { confirmState, confirm, handleConfirm, handleCancel } = useConfirmAction();
46
+ const [creating, setCreating] = useState(false);
47
+ const header = _jsx(ConsoleHeader, { onCreate: operator.allowed && !creating ? () => setCreating(true) : undefined });
48
+ if (!available || (catalog.error && isUnimplemented(catalog.error))) {
49
+ return (_jsxs("div", { className: cn("stg:space-y-3", className), children: [header, _jsx(CloudFeatureNotice, { children: "Plans are sold on Stigmer Cloud. The server this console is connected to serves no plan catalog." })] }));
50
+ }
51
+ if (operator.isLoading || (operator.allowed && catalog.plans === null && catalog.error === null)) {
52
+ return (_jsx("div", { className: cn("stg:space-y-2", className), "aria-busy": "true", children: Array.from({ length: 3 }, (_, i) => (_jsx("div", { className: "stg:h-12 stg:animate-pulse stg:rounded-lg stg:bg-muted-subtle" }, i))) }));
53
+ }
54
+ if (!operator.allowed) {
55
+ return (_jsxs("div", { className: cn("stg:space-y-3", className), children: [header, _jsx(PlansAccessNotice, {})] }));
56
+ }
57
+ if (catalog.error) {
58
+ return (_jsxs("div", { className: cn("stg:space-y-3", className), children: [header, _jsx("p", { className: "stg:text-sm stg:text-destructive", role: "alert", children: getUserMessage(catalog.error) }), _jsx(Button, { variant: "outline", onClick: catalog.refetch, children: "Try again" })] }));
59
+ }
60
+ const retire = async (plan) => {
61
+ const ok = await confirm({
62
+ title: `Retire ${plan.metadata?.name ?? "this plan"}?`,
63
+ description: "It can no longer be bought. Every organization already on it keeps it, invoiced by its terms. Retiring is final.",
64
+ confirmLabel: "Retire",
65
+ variant: "destructive",
66
+ });
67
+ if (ok) {
68
+ retirer.retirePlan(plan.metadata?.id ?? "").then(catalog.refetch, () => undefined);
69
+ }
70
+ };
71
+ return (_jsxs("div", { className: cn("stg:space-y-4", className), children: [header, creating ? (_jsx("div", { className: "stg:rounded-lg stg:border stg:border-border stg:bg-card stg:p-4", children: _jsx(PlanCreateForm, { onCreated: () => {
72
+ setCreating(false);
73
+ catalog.refetch();
74
+ }, onCancel: () => setCreating(false) }) })) : null, retirer.error && (_jsx("p", { className: "stg:text-xs stg:text-destructive", role: "alert", children: getUserMessage(retirer.error) })), _jsx("ul", { className: cn(UNSTYLED_LIST, "stg:space-y-2"), "aria-label": "Plan catalog", children: (catalog.plans ?? []).map((plan) => (_jsx(PlanRow, { plan: plan, onRetire: () => void retire(plan), busy: retirer.isSubmitting }, plan.metadata?.id))) }), _jsx(ConfirmDialog, { state: confirmState, onConfirm: handleConfirm, onCancel: handleCancel })] }));
75
+ }
76
+ function ConsoleHeader({ onCreate }) {
77
+ return (_jsxs("div", { className: "stg:flex stg:items-start stg:justify-between stg:gap-3", children: [_jsxs("div", { children: [_jsx("h2", { className: "stg:text-sm stg:font-semibold stg:text-foreground", children: "Plans" }), _jsx("p", { className: "stg:text-xs stg:text-muted-foreground", children: "The plans organizations subscribe to. A plan's terms are final; change them with a new plan and retire the old one." })] }), onCreate && (_jsx(Button, { size: "xs", onClick: onCreate, children: "New plan" }))] }));
78
+ }
79
+ function PlanRow({ plan, onRetire, busy }) {
80
+ const active = plan.status?.lifecycle === PlanLifecycle.active;
81
+ const license = plan.spec?.instrument === PlanInstrument.license;
82
+ const terms = plan.spec?.terms;
83
+ const listed = (plan.spec?.entitlements?.features ?? []).filter(isNamedFeature).map((f) => FEATURE_COPY[f].label);
84
+ const offered = new Set(offeredFeatures(plan.spec?.entitlements).map((f) => f.label));
85
+ const managed = formatManagedOrganizations(plan.spec?.entitlements, terms);
86
+ return (_jsxs("li", { className: "stg:rounded-lg stg:border stg:border-border stg:bg-card stg:p-3", children: [_jsxs("div", { className: "stg:flex stg:items-center stg:justify-between stg:gap-3", children: [_jsxs("div", { className: "stg:min-w-0", children: [_jsxs("p", { className: "stg:truncate stg:text-sm stg:font-medium stg:text-foreground", children: [plan.metadata?.name, " ", _jsxs("span", { className: "stg:font-normal stg:text-muted-foreground", children: ["(", plan.metadata?.slug, ")"] })] }), _jsx("p", { className: "stg:text-xs stg:text-muted-foreground", children: license
87
+ ? "Issued as a license"
88
+ : `${formatCreditBalance(terms?.monthlyMinimumMicros ?? BigInt(0))}/month ${formatUsageShare(terms)}` })] }), _jsxs("div", { className: "stg:flex stg:shrink-0 stg:items-center stg:gap-2", children: [_jsx(StatusBadge, { phase: active ? "ready" : "disabled", label: active ? "On sale" : "Retired" }), active && (_jsx(Button, { variant: "outline", size: "xs", onClick: onRetire, disabled: busy, children: "Retire" }))] })] }), _jsxs("p", { className: "stg:mt-1 stg:text-xs stg:text-muted-foreground", children: [listed.map((label) => (offered.has(label) ? label : `${label} (not offered yet)`)).join(" · "), managed === "" ? "" : ` · ${managed}`] })] }));
89
+ }
90
+ //# sourceMappingURL=PlanCatalogConsole.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PlanCatalogConsole.js","sourceRoot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,IAAI,CAAC,QAAQ,EAAE,IAAI,SAAS,IACxF,EACJ,YAAG,SAAS,EAAC,uCAAuC,YACjD,OAAO;oCACN,CAAC,CAAC,qBAAqB;oCACvB,CAAC,CAAC,GAAG,mBAAmB,CAAC,KAAK,EAAE,oBAAoB,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,UAAU,gBAAgB,CAAC,KAAK,CAAC,EAAE,GACrG,IACA,EACN,eAAK,SAAS,EAAC,kDAAkD,aAC/D,KAAC,WAAW,IAAC,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,UAAU,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,GAAI,EAC3F,MAAM,IAAI,CACT,KAAC,MAAM,IAAC,OAAO,EAAC,SAAS,EAAC,IAAI,EAAC,IAAI,EAAC,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,uBAE5D,CACV,IACG,IACF,EACN,aAAG,SAAS,EAAC,gDAAgD,aAC1D,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,oBAAoB,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,EAC9F,OAAO,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,OAAO,EAAE,IACpC,IACD,CACN,CAAC;AACJ,CAAC"}
@@ -0,0 +1,17 @@
1
+ import type { Plan } from "@stigmer/protos/ai/stigmer/billing/plan/v1/api_pb";
2
+ /** Props for {@link PlanCreateForm}. */
3
+ export interface PlanCreateFormProps {
4
+ /** Fired with the created plan. */
5
+ readonly onCreated: (plan: Plan) => void;
6
+ /** Fired when the operator leaves without creating. */
7
+ readonly onCancel: () => void;
8
+ }
9
+ /**
10
+ * Adds a subscription plan to the catalog: its name and handle, its
11
+ * monthly minimum and usage share, its features, and the managed
12
+ * organizations it includes. The form states before submitting that a
13
+ * plan's terms are final: a change of terms is a new plan, and the old
14
+ * one is retired.
15
+ */
16
+ export declare function PlanCreateForm({ onCreated, onCancel }: PlanCreateFormProps): import("react/jsx-runtime").JSX.Element;
17
+ //# sourceMappingURL=PlanCreateForm.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PlanCreateForm.d.ts","sourceRoot":"","sources":["../src/plan-catalog/PlanCreateForm.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,mDAAmD,CAAC;AAmB9E,wCAAwC;AACxC,MAAM,WAAW,mBAAmB;IAClC,mCAAmC;IACnC,QAAQ,CAAC,SAAS,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;IACzC,uDAAuD;IACvD,QAAQ,CAAC,QAAQ,EAAE,MAAM,IAAI,CAAC;CAC/B;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,mBAAmB,2CA+H1E"}
@@ -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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ACxC,gBACE,SAAS,EAAE,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;AAclC,MAAM,CAAC,MAAM,gBAAgB,GAAc;IACzC,IAAI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C,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,CA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AAU,GAAG,WAAW,CAC5B,KAAK,EAAE,MAAc,EAAiB,EAAE;QACtC,eAAe,CAAC,IAAI,CAAC,CAAC;QACtB,QAAQ,CAAC,IAAI,CAAC,CAAC;QACf,IAAI,CAAC;YACH,OAAO,MAAM,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QAC3C,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,MAAM,GAAG,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;YACvB,QAAQ,CAAC,GAAG,CAAC,CAAC;YACd,MAAM,GAAG,CAAC;QACZ,CAAC;gBAAS,CAAC;YACT,eAAe,CAAC,KAAK,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"}
@@ -8,6 +8,13 @@
8
8
  *
9
9
  * After registering an app here, the connect dialog on any agent's
10
10
  * Channels tab offers it as the serving app.
11
+ *
12
+ * "New channel app" is offered once the server confirms the caller holds
13
+ * `can_create_channel_app` on the organization. The list shows only the
14
+ * apps the caller may view (their creator, anyone granted viewer on one,
15
+ * and the organization's admins), so a caller who may not create channel
16
+ * apps is told that the organization's admins manage them rather than that
17
+ * none is registered.
11
18
  */
12
19
  export declare function ChannelAppsSection(): import("react/jsx-runtime").JSX.Element;
13
20
  //# sourceMappingURL=ChannelAppsSection.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ChannelAppsSection.d.ts","sourceRoot":"","sources":["../src/settings/ChannelAppsSection.tsx"],"names":[],"mappings":"AA4BA;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,4CA8FjC"}
1
+ {"version":3,"file":"ChannelAppsSection.d.ts","sourceRoot":"","sources":["../src/settings/ChannelAppsSection.tsx"],"names":[],"mappings":"AA8BA;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,kBAAkB,4CAsGjC"}