@the-portland-company/shell 0.93.0 → 0.94.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.
@@ -12,6 +12,26 @@ type CardProps = {
12
12
  };
13
13
  declare function Card({ title, children, minH, className, style, ...props }: CardProps): react_jsx_runtime.JSX.Element;
14
14
 
15
+ type AiCreditsStateKind = 'out' | 'paused' | 'waiting';
16
+ /** Organization Settings → Subscription & Billing → Wallet, on this organization. */
17
+ declare function aiCreditsWalletUrl(orgId?: string | null): string;
18
+ declare const AI_CREDITS_STATE_TITLES: Record<AiCreditsStateKind, string>;
19
+ type AiCreditsStateProps = {
20
+ kind: AiCreditsStateKind;
21
+ orgId?: string | null;
22
+ /** Account Admins see the Wallet buttons; others are told to ask one. */
23
+ isAccountAdmin: boolean;
24
+ /** paused: when the last output was made; null when there has been none. */
25
+ lastOutputAt?: Date | string | null;
26
+ /** Shows "Check again" (re-ask can-start). */
27
+ onCheckAgain?: () => void;
28
+ /** Overrides the time format (tests, or an app's own locale). */
29
+ formatTime?: (at: Date) => string;
30
+ className?: string;
31
+ style?: CSSProperties;
32
+ };
33
+ declare function AiCreditsState({ kind, orgId, isAccountAdmin, lastOutputAt, onCheckAgain, formatTime, className, style, }: AiCreditsStateProps): react_jsx_runtime.JSX.Element;
34
+
15
35
  type FormColumnProps = {
16
36
  children: ReactNode;
17
37
  className?: string;
@@ -1168,4 +1188,4 @@ type NavAppShellProps = {
1168
1188
  };
1169
1189
  declare function NavAppShell({ sidebar, topBar, betaBanner, contentWrapper, accountMenuPlacement, modeId, children, }: NavAppShellProps): react_jsx_runtime.JSX.Element;
1170
1190
 
1171
- export { NavBetaBanner as $, CREDIT_TYPE_ORDER as A, type BreadcrumbBarProps as B, Card as C, type CampaignFeatureAvailability as D, type ChromeMe as E, FormColumn as F, type ChromeNotificationAlert as G, HeaderTabBar as H, type ChromeNotificationImport as I, type ChromeNotificationQuarantine as J, KNOWN_TAB_GLYPHS as K, type ChromeNotificationReply as L, type ChromeNotificationsPayload as M, type NavItem as N, type ChromeOrgSummary as O, type PageHeaderProps as P, type CommunicationsFuelStatus as Q, type CreditHealthState as R, type StandardNavIconKey as S, type TabGlyphComponent as T, type CreditTypeKey as U, CreditsAction as V, type CreditsIconState as W, FuelAction as X, type FuelChannelStatus as Y, NavAppShell as Z, type NavAppShellProps as _, type CommsNotification as a, type NavBetaBannerProps as a0, type NavBrand as a1, NavChromeProvider as a2, NavDisplayAction as a3, type NavLinkProps as a4, type NavLinkedAccount as a5, type NavModeOption as a6, type NavOrg as a7, type NavRoleBadge as a8, NavSidebar as a9, creditTooltipLine as aA, creditsAriaLabel as aB, creditsIconState as aC, envChipClasses as aD, isNavItemActive as aE, modeIdFromLabel as aF, resolveOrgLogoUrl as aG, shortEnvLabel as aH, shortUserName as aI, standardPolitogyNav as aJ, topBarIconButtonClass as aK, useChromeMe as aL, useChromeOrgs as aM, useNavChromeDedupedFetch as aN, useNavChromeFetcher as aO, useThemePreference as aP, type NavSidebarProps as aa, type NavTab as ab, NavTabStrip as ac, type NavTabStripProps as ad, NavThemeControl as ae, NavTopBar as af, type NavTopBarAction as ag, type NavTopBarProps as ah, type NavUser as ai, NotificationsAction as aj, PageHeader as ak, type PageHeaderMode as al, SPECS_ORIGIN as am, SpecOverlayAction as an, type StandardNavOptions as ao, SupportAction as ap, type ThemePreference as aq, TopBarCountBadge as ar, type TopBarIconTone as as, TopBarPanelArrow as at, TopBarPopover as au, TopBarTooltip as av, TopBarWidgetSlot as aw, clearBetaBannerDismissal as ax, creditGaugeRatio as ay, creditStateWord as az, type CommsNotificationKind as b, type HeaderTabBarItem as c, type NotificationsAdapter as d, type NotificationsFeed as e, createCommsNotificationsAdapter as f, emptyNotificationsFeed as g, type NavIcon as h, type NavBreadcrumb as i, type StandardNavMode as j, type NavLinkComponent as k, type NavChromeFetcher as l, type NavMode as m, normalizeNotificationsFeed as n, type NavUserMenu as o, type NavOrgOption as p, type NavFooterLink as q, resolveTabGlyph as r, type NavFooter as s, type NavDisplayMode as t, BETA_BANNER_DISMISS_KEY as u, BreadcrumbBar as v, CAMPAIGN_FEATURE_AVAILABILITY as w, CORE_APP_ORIGIN as x, CORE_BILLING_PATH as y, CREDIT_TYPE_LABELS as z };
1191
+ export { FuelAction as $, AI_CREDITS_STATE_TITLES as A, type BreadcrumbBarProps as B, Card as C, CORE_APP_ORIGIN as D, CORE_BILLING_PATH as E, FormColumn as F, CREDIT_TYPE_LABELS as G, HeaderTabBar as H, CREDIT_TYPE_ORDER as I, type CampaignFeatureAvailability as J, KNOWN_TAB_GLYPHS as K, type ChromeMe as L, type ChromeNotificationAlert as M, type NavItem as N, type ChromeNotificationImport as O, type PageHeaderProps as P, type ChromeNotificationQuarantine as Q, type ChromeNotificationReply as R, type StandardNavIconKey as S, type TabGlyphComponent as T, type ChromeNotificationsPayload as U, type ChromeOrgSummary as V, type CommunicationsFuelStatus as W, type CreditHealthState as X, type CreditTypeKey as Y, CreditsAction as Z, type CreditsIconState as _, AiCreditsState as a, type FuelChannelStatus as a0, NavAppShell as a1, type NavAppShellProps as a2, NavBetaBanner as a3, type NavBetaBannerProps as a4, type NavBrand as a5, NavChromeProvider as a6, NavDisplayAction as a7, type NavLinkProps as a8, type NavLinkedAccount as a9, TopBarWidgetSlot as aA, clearBetaBannerDismissal as aB, creditGaugeRatio as aC, creditStateWord as aD, creditTooltipLine as aE, creditsAriaLabel as aF, creditsIconState as aG, envChipClasses as aH, isNavItemActive as aI, modeIdFromLabel as aJ, resolveOrgLogoUrl as aK, shortEnvLabel as aL, shortUserName as aM, standardPolitogyNav as aN, topBarIconButtonClass as aO, useChromeMe as aP, useChromeOrgs as aQ, useNavChromeDedupedFetch as aR, useNavChromeFetcher as aS, useThemePreference as aT, type NavModeOption as aa, type NavOrg as ab, type NavRoleBadge as ac, NavSidebar as ad, type NavSidebarProps as ae, type NavTab as af, NavTabStrip as ag, type NavTabStripProps as ah, NavThemeControl as ai, NavTopBar as aj, type NavTopBarAction as ak, type NavTopBarProps as al, type NavUser as am, NotificationsAction as an, PageHeader as ao, type PageHeaderMode as ap, SPECS_ORIGIN as aq, SpecOverlayAction as ar, type StandardNavOptions as as, SupportAction as at, type ThemePreference as au, TopBarCountBadge as av, type TopBarIconTone as aw, TopBarPanelArrow as ax, TopBarPopover as ay, TopBarTooltip as az, type AiCreditsStateKind as b, type CommsNotification as c, type CommsNotificationKind as d, type HeaderTabBarItem as e, type NotificationsAdapter as f, type NotificationsFeed as g, aiCreditsWalletUrl as h, createCommsNotificationsAdapter as i, emptyNotificationsFeed as j, type NavIcon as k, type NavBreadcrumb as l, type StandardNavMode as m, normalizeNotificationsFeed as n, type NavLinkComponent as o, type NavChromeFetcher as p, type NavMode as q, resolveTabGlyph as r, type NavUserMenu as s, type NavOrgOption as t, type NavFooterLink as u, type NavFooter as v, type NavDisplayMode as w, BETA_BANNER_DISMISS_KEY as x, BreadcrumbBar as y, CAMPAIGN_FEATURE_AVAILABILITY as z };
@@ -12,6 +12,26 @@ type CardProps = {
12
12
  };
13
13
  declare function Card({ title, children, minH, className, style, ...props }: CardProps): react_jsx_runtime.JSX.Element;
14
14
 
15
+ type AiCreditsStateKind = 'out' | 'paused' | 'waiting';
16
+ /** Organization Settings → Subscription & Billing → Wallet, on this organization. */
17
+ declare function aiCreditsWalletUrl(orgId?: string | null): string;
18
+ declare const AI_CREDITS_STATE_TITLES: Record<AiCreditsStateKind, string>;
19
+ type AiCreditsStateProps = {
20
+ kind: AiCreditsStateKind;
21
+ orgId?: string | null;
22
+ /** Account Admins see the Wallet buttons; others are told to ask one. */
23
+ isAccountAdmin: boolean;
24
+ /** paused: when the last output was made; null when there has been none. */
25
+ lastOutputAt?: Date | string | null;
26
+ /** Shows "Check again" (re-ask can-start). */
27
+ onCheckAgain?: () => void;
28
+ /** Overrides the time format (tests, or an app's own locale). */
29
+ formatTime?: (at: Date) => string;
30
+ className?: string;
31
+ style?: CSSProperties;
32
+ };
33
+ declare function AiCreditsState({ kind, orgId, isAccountAdmin, lastOutputAt, onCheckAgain, formatTime, className, style, }: AiCreditsStateProps): react_jsx_runtime.JSX.Element;
34
+
15
35
  type FormColumnProps = {
16
36
  children: ReactNode;
17
37
  className?: string;
@@ -1168,4 +1188,4 @@ type NavAppShellProps = {
1168
1188
  };
1169
1189
  declare function NavAppShell({ sidebar, topBar, betaBanner, contentWrapper, accountMenuPlacement, modeId, children, }: NavAppShellProps): react_jsx_runtime.JSX.Element;
1170
1190
 
1171
- export { NavBetaBanner as $, CREDIT_TYPE_ORDER as A, type BreadcrumbBarProps as B, Card as C, type CampaignFeatureAvailability as D, type ChromeMe as E, FormColumn as F, type ChromeNotificationAlert as G, HeaderTabBar as H, type ChromeNotificationImport as I, type ChromeNotificationQuarantine as J, KNOWN_TAB_GLYPHS as K, type ChromeNotificationReply as L, type ChromeNotificationsPayload as M, type NavItem as N, type ChromeOrgSummary as O, type PageHeaderProps as P, type CommunicationsFuelStatus as Q, type CreditHealthState as R, type StandardNavIconKey as S, type TabGlyphComponent as T, type CreditTypeKey as U, CreditsAction as V, type CreditsIconState as W, FuelAction as X, type FuelChannelStatus as Y, NavAppShell as Z, type NavAppShellProps as _, type CommsNotification as a, type NavBetaBannerProps as a0, type NavBrand as a1, NavChromeProvider as a2, NavDisplayAction as a3, type NavLinkProps as a4, type NavLinkedAccount as a5, type NavModeOption as a6, type NavOrg as a7, type NavRoleBadge as a8, NavSidebar as a9, creditTooltipLine as aA, creditsAriaLabel as aB, creditsIconState as aC, envChipClasses as aD, isNavItemActive as aE, modeIdFromLabel as aF, resolveOrgLogoUrl as aG, shortEnvLabel as aH, shortUserName as aI, standardPolitogyNav as aJ, topBarIconButtonClass as aK, useChromeMe as aL, useChromeOrgs as aM, useNavChromeDedupedFetch as aN, useNavChromeFetcher as aO, useThemePreference as aP, type NavSidebarProps as aa, type NavTab as ab, NavTabStrip as ac, type NavTabStripProps as ad, NavThemeControl as ae, NavTopBar as af, type NavTopBarAction as ag, type NavTopBarProps as ah, type NavUser as ai, NotificationsAction as aj, PageHeader as ak, type PageHeaderMode as al, SPECS_ORIGIN as am, SpecOverlayAction as an, type StandardNavOptions as ao, SupportAction as ap, type ThemePreference as aq, TopBarCountBadge as ar, type TopBarIconTone as as, TopBarPanelArrow as at, TopBarPopover as au, TopBarTooltip as av, TopBarWidgetSlot as aw, clearBetaBannerDismissal as ax, creditGaugeRatio as ay, creditStateWord as az, type CommsNotificationKind as b, type HeaderTabBarItem as c, type NotificationsAdapter as d, type NotificationsFeed as e, createCommsNotificationsAdapter as f, emptyNotificationsFeed as g, type NavIcon as h, type NavBreadcrumb as i, type StandardNavMode as j, type NavLinkComponent as k, type NavChromeFetcher as l, type NavMode as m, normalizeNotificationsFeed as n, type NavUserMenu as o, type NavOrgOption as p, type NavFooterLink as q, resolveTabGlyph as r, type NavFooter as s, type NavDisplayMode as t, BETA_BANNER_DISMISS_KEY as u, BreadcrumbBar as v, CAMPAIGN_FEATURE_AVAILABILITY as w, CORE_APP_ORIGIN as x, CORE_BILLING_PATH as y, CREDIT_TYPE_LABELS as z };
1191
+ export { FuelAction as $, AI_CREDITS_STATE_TITLES as A, type BreadcrumbBarProps as B, Card as C, CORE_APP_ORIGIN as D, CORE_BILLING_PATH as E, FormColumn as F, CREDIT_TYPE_LABELS as G, HeaderTabBar as H, CREDIT_TYPE_ORDER as I, type CampaignFeatureAvailability as J, KNOWN_TAB_GLYPHS as K, type ChromeMe as L, type ChromeNotificationAlert as M, type NavItem as N, type ChromeNotificationImport as O, type PageHeaderProps as P, type ChromeNotificationQuarantine as Q, type ChromeNotificationReply as R, type StandardNavIconKey as S, type TabGlyphComponent as T, type ChromeNotificationsPayload as U, type ChromeOrgSummary as V, type CommunicationsFuelStatus as W, type CreditHealthState as X, type CreditTypeKey as Y, CreditsAction as Z, type CreditsIconState as _, AiCreditsState as a, type FuelChannelStatus as a0, NavAppShell as a1, type NavAppShellProps as a2, NavBetaBanner as a3, type NavBetaBannerProps as a4, type NavBrand as a5, NavChromeProvider as a6, NavDisplayAction as a7, type NavLinkProps as a8, type NavLinkedAccount as a9, TopBarWidgetSlot as aA, clearBetaBannerDismissal as aB, creditGaugeRatio as aC, creditStateWord as aD, creditTooltipLine as aE, creditsAriaLabel as aF, creditsIconState as aG, envChipClasses as aH, isNavItemActive as aI, modeIdFromLabel as aJ, resolveOrgLogoUrl as aK, shortEnvLabel as aL, shortUserName as aM, standardPolitogyNav as aN, topBarIconButtonClass as aO, useChromeMe as aP, useChromeOrgs as aQ, useNavChromeDedupedFetch as aR, useNavChromeFetcher as aS, useThemePreference as aT, type NavModeOption as aa, type NavOrg as ab, type NavRoleBadge as ac, NavSidebar as ad, type NavSidebarProps as ae, type NavTab as af, NavTabStrip as ag, type NavTabStripProps as ah, NavThemeControl as ai, NavTopBar as aj, type NavTopBarAction as ak, type NavTopBarProps as al, type NavUser as am, NotificationsAction as an, PageHeader as ao, type PageHeaderMode as ap, SPECS_ORIGIN as aq, SpecOverlayAction as ar, type StandardNavOptions as as, SupportAction as at, type ThemePreference as au, TopBarCountBadge as av, type TopBarIconTone as aw, TopBarPanelArrow as ax, TopBarPopover as ay, TopBarTooltip as az, type AiCreditsStateKind as b, type CommsNotification as c, type CommsNotificationKind as d, type HeaderTabBarItem as e, type NotificationsAdapter as f, type NotificationsFeed as g, aiCreditsWalletUrl as h, createCommsNotificationsAdapter as i, emptyNotificationsFeed as j, type NavIcon as k, type NavBreadcrumb as l, type StandardNavMode as m, normalizeNotificationsFeed as n, type NavLinkComponent as o, type NavChromeFetcher as p, type NavMode as q, resolveTabGlyph as r, type NavUserMenu as s, type NavOrgOption as t, type NavFooterLink as u, type NavFooter as v, type NavDisplayMode as w, BETA_BANNER_DISMISS_KEY as x, BreadcrumbBar as y, CAMPAIGN_FEATURE_AVAILABILITY as z };
package/dist/index.cjs CHANGED
@@ -855,6 +855,71 @@ function Card({
855
855
  }
856
856
  );
857
857
  }
858
+ var SETTINGS_ORIGIN = "https://settings.politogyvrm.com";
859
+ var WALLET_PATH = "/organization-settings/subscription-billing/wallet";
860
+ function aiCreditsWalletUrl(orgId) {
861
+ const url = new URL(WALLET_PATH, SETTINGS_ORIGIN);
862
+ if (orgId) url.searchParams.set("org", orgId);
863
+ return url.toString();
864
+ }
865
+ var AI_CREDITS_STATE_TITLES = {
866
+ out: "Out of AI Credits",
867
+ paused: "Paused \u2014 out of AI Credits",
868
+ waiting: "Waiting for AI Credits"
869
+ };
870
+ var MUTED = { color: "var(--color-text-muted, #6b7280)" };
871
+ var BUTTON = {
872
+ display: "inline-block",
873
+ borderRadius: 6,
874
+ padding: "6px 12px",
875
+ fontSize: 12,
876
+ fontWeight: 600,
877
+ textDecoration: "none"
878
+ };
879
+ var PRIMARY = { ...BUTTON, background: "var(--color-text, #2F3136)", color: "#fff" };
880
+ var SECONDARY = {
881
+ ...BUTTON,
882
+ border: "1px solid var(--color-border, #e5e7eb)",
883
+ color: "var(--color-text, #2F3136)"
884
+ };
885
+ var defaultFormat = (at) => at.toLocaleString(void 0, { month: "short", day: "numeric", hour: "numeric", minute: "2-digit" });
886
+ function detail(kind, lastOutputAt, format) {
887
+ if (kind === "paused") return lastOutputAt ? `Last updated ${format(lastOutputAt)}.` : "Nothing has been generated yet.";
888
+ if (kind === "waiting") return "This step is kept and starts on its own once AI Credits are added.";
889
+ return null;
890
+ }
891
+ function AiCreditsState({
892
+ kind,
893
+ orgId,
894
+ isAccountAdmin,
895
+ lastOutputAt,
896
+ onCheckAgain,
897
+ formatTime = defaultFormat,
898
+ className,
899
+ style
900
+ }) {
901
+ const at = lastOutputAt == null ? null : lastOutputAt instanceof Date ? lastOutputAt : new Date(lastOutputAt);
902
+ const last = at && !Number.isNaN(at.getTime()) ? at : null;
903
+ const text = detail(kind, last, formatTime);
904
+ const wallet = aiCreditsWalletUrl(orgId);
905
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { role: "status", "data-ai-credits-state": kind, className, style: { fontSize: 14, ...style }, children: [
906
+ /* @__PURE__ */ jsxRuntime.jsx("p", { style: { margin: 0, fontWeight: 600 }, children: AI_CREDITS_STATE_TITLES[kind] }),
907
+ text && /* @__PURE__ */ jsxRuntime.jsx("p", { style: { margin: "4px 0 0", ...MUTED }, children: text }),
908
+ isAccountAdmin ? /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { marginTop: 8, display: "flex", flexWrap: "wrap", gap: 8 }, children: [
909
+ /* @__PURE__ */ jsxRuntime.jsx("a", { href: wallet, style: PRIMARY, children: "Buy AI Credits" }),
910
+ /* @__PURE__ */ jsxRuntime.jsx("a", { href: wallet, style: SECONDARY, children: "Turn on auto top-off" })
911
+ ] }) : /* @__PURE__ */ jsxRuntime.jsx("p", { style: { margin: "4px 0 0", ...MUTED }, children: "Ask an Account Admin to add AI Credits." }),
912
+ onCheckAgain && /* @__PURE__ */ jsxRuntime.jsx(
913
+ "button",
914
+ {
915
+ type: "button",
916
+ onClick: onCheckAgain,
917
+ style: { marginTop: 8, padding: 0, border: 0, background: "none", fontSize: 12, textDecoration: "underline", cursor: "pointer", ...MUTED },
918
+ children: "Check again"
919
+ }
920
+ )
921
+ ] });
922
+ }
858
923
  function FormColumn({ children, className }) {
859
924
  return /* @__PURE__ */ jsxRuntime.jsx("div", { "data-shell-form-column": "", className: clsx5__default.default("w-full max-w-[960px]", className), children });
860
925
  }
@@ -1900,6 +1965,8 @@ function SpeculationRulesScript({ items }) {
1900
1965
  return null;
1901
1966
  }
1902
1967
 
1968
+ exports.AI_CREDITS_STATE_TITLES = AI_CREDITS_STATE_TITLES;
1969
+ exports.AiCreditsState = AiCreditsState;
1903
1970
  exports.BrandIcon = BrandIcon;
1904
1971
  exports.BrandLogo = BrandLogo;
1905
1972
  exports.BreadcrumbBar = BreadcrumbBar;
@@ -1921,6 +1988,7 @@ exports.ShellProvider = ShellProvider;
1921
1988
  exports.ShellRoleContext = ShellRoleContext;
1922
1989
  exports.ShellSupportProviderContext = ShellSupportProviderContext;
1923
1990
  exports.SpeculationRulesScript = SpeculationRulesScript;
1991
+ exports.aiCreditsWalletUrl = aiCreditsWalletUrl;
1924
1992
  exports.buildNavSpeculationRules = buildNavSpeculationRules;
1925
1993
  exports.buildSpeculationRules = buildSpeculationRules;
1926
1994
  exports.collectSiblingAppUrls = collectSiblingAppUrls;