@the-portland-company/shell 0.92.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.
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { P as PageHeaderProps, B as BreadcrumbBarProps, N as NavItem } from './index-Cg5aEImm.cjs';
2
- export { C as Card, a as CommsNotification, b as CommsNotificationKind, F as FormColumn, H as HeaderTabBar, c as HeaderTabBarItem, d as NotificationsAdapter, e as NotificationsFeed, f as createCommsNotificationsAdapter, g as emptyNotificationsFeed, n as normalizeNotificationsFeed } from './index-Cg5aEImm.cjs';
1
+ import { P as PageHeaderProps, B as BreadcrumbBarProps, N as NavItem } from './index-ByUbBbta.cjs';
2
+ export { A as AI_CREDITS_STATE_TITLES, a as AiCreditsState, b as AiCreditsStateKind, C as Card, c as CommsNotification, d as CommsNotificationKind, F as FormColumn, H as HeaderTabBar, e as HeaderTabBarItem, K as KNOWN_TAB_GLYPHS, f as NotificationsAdapter, g as NotificationsFeed, T as TabGlyphComponent, h as aiCreditsWalletUrl, i as createCommsNotificationsAdapter, j as emptyNotificationsFeed, n as normalizeNotificationsFeed, r as resolveTabGlyph } from './index-ByUbBbta.cjs';
3
3
  import * as react_jsx_runtime from 'react/jsx-runtime';
4
4
  import * as react from 'react';
5
5
  import { ReactNode, CSSProperties } from 'react';
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { P as PageHeaderProps, B as BreadcrumbBarProps, N as NavItem } from './index-DG32i0jC.js';
2
- export { C as Card, a as CommsNotification, b as CommsNotificationKind, F as FormColumn, H as HeaderTabBar, c as HeaderTabBarItem, d as NotificationsAdapter, e as NotificationsFeed, f as createCommsNotificationsAdapter, g as emptyNotificationsFeed, n as normalizeNotificationsFeed } from './index-DG32i0jC.js';
1
+ import { P as PageHeaderProps, B as BreadcrumbBarProps, N as NavItem } from './index-PRu56mmW.js';
2
+ export { A as AI_CREDITS_STATE_TITLES, a as AiCreditsState, b as AiCreditsStateKind, C as Card, c as CommsNotification, d as CommsNotificationKind, F as FormColumn, H as HeaderTabBar, e as HeaderTabBarItem, K as KNOWN_TAB_GLYPHS, f as NotificationsAdapter, g as NotificationsFeed, T as TabGlyphComponent, h as aiCreditsWalletUrl, i as createCommsNotificationsAdapter, j as emptyNotificationsFeed, n as normalizeNotificationsFeed, r as resolveTabGlyph } from './index-PRu56mmW.js';
3
3
  import * as react_jsx_runtime from 'react/jsx-runtime';
4
4
  import * as react from 'react';
5
5
  import { ReactNode, CSSProperties } from 'react';
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import { PageHeaderView, warnDeprecated, BreadcrumbBarView } from './chunk-ZS7MQXDQ.js';
2
- export { Card, FormColumn, HeaderTabBar, SpeculationRulesScript, buildNavSpeculationRules, buildSpeculationRules, collectSiblingAppUrls, createCommsNotificationsAdapter, emptyNotificationsFeed, normalizeNotificationsFeed } from './chunk-ZS7MQXDQ.js';
1
+ import { PageHeaderView, warnDeprecated, BreadcrumbBarView } from './chunk-JQ53VZO5.js';
2
+ export { AI_CREDITS_STATE_TITLES, AiCreditsState, Card, FormColumn, HeaderTabBar, KNOWN_TAB_GLYPHS, SpeculationRulesScript, aiCreditsWalletUrl, buildNavSpeculationRules, buildSpeculationRules, collectSiblingAppUrls, createCommsNotificationsAdapter, emptyNotificationsFeed, normalizeNotificationsFeed, resolveTabGlyph } from './chunk-JQ53VZO5.js';
3
3
  import { readResolvedTheme } from './chunk-BHRVZPZ7.js';
4
4
  import { extendTheme, ChakraProvider, useColorMode } from '@chakra-ui/react';
5
5
  import { jsx, jsxs } from 'react/jsx-runtime';
package/dist/native.cjs CHANGED
@@ -4,9 +4,9 @@
4
4
  var react = require('react');
5
5
  var clsx4 = require('clsx');
6
6
  var fi = require('react-icons/fi');
7
+ var lu = require('react-icons/lu');
7
8
  var reactDom = require('react-dom');
8
9
  var jsxRuntime = require('react/jsx-runtime');
9
- var lu = require('react-icons/lu');
10
10
 
11
11
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
12
12
 
@@ -59,6 +59,173 @@ function resolveBrandGlyph(name) {
59
59
  if (!name) return null;
60
60
  return GLYPHS[name.trim().toLowerCase()] ?? null;
61
61
  }
62
+ var TAB_GLYPHS = {
63
+ "layout-dashboard": lu.LuLayoutDashboard,
64
+ "layout-list": lu.LuLayoutList,
65
+ "layout-grid": lu.LuLayoutGrid,
66
+ "layout-template": lu.LuLayoutTemplate,
67
+ "users": lu.LuUsers,
68
+ "users-round": lu.LuUsersRound,
69
+ "user": lu.LuUser,
70
+ "user-plus": lu.LuUserPlus,
71
+ "user-check": lu.LuUserCheck,
72
+ "square-user": lu.LuSquareUser,
73
+ "upload": lu.LuUpload,
74
+ "download": lu.LuDownload,
75
+ "copy": lu.LuCopy,
76
+ "library": lu.LuLibrary,
77
+ "flag": lu.LuFlag,
78
+ "flag-triangle-right": lu.LuFlagTriangleRight,
79
+ "activity": lu.LuActivity,
80
+ "table-2": lu.LuTable2,
81
+ "chart-pie": lu.LuChartPie,
82
+ "chart-column": lu.LuChartColumn,
83
+ "chart-line": lu.LuChartLine,
84
+ "chart-bar": lu.LuChartBar,
85
+ "chart-area": lu.LuChartArea,
86
+ "chart-no-axes-combined": lu.LuChartNoAxesCombined,
87
+ "lightbulb": lu.LuLightbulb,
88
+ "crosshair": lu.LuCrosshair,
89
+ "map": lu.LuMap,
90
+ "map-pin": lu.LuMapPin,
91
+ "footprints": lu.LuFootprints,
92
+ "brain": lu.LuBrain,
93
+ "clipboard-list": lu.LuClipboardList,
94
+ "clipboard-check": lu.LuClipboardCheck,
95
+ "timer": lu.LuTimer,
96
+ "clock": lu.LuClock,
97
+ "calendar": lu.LuCalendar,
98
+ "layers": lu.LuLayers,
99
+ "scale": lu.LuScale,
100
+ "route": lu.LuRoute,
101
+ "bot": lu.LuBot,
102
+ "messages-square": lu.LuMessagesSquare,
103
+ "message-square": lu.LuMessageSquare,
104
+ "message-circle": lu.LuMessageCircle,
105
+ "send": lu.LuSend,
106
+ "gauge": lu.LuGauge,
107
+ "split": lu.LuSplit,
108
+ "file-text": lu.LuFileText,
109
+ "file": lu.LuFile,
110
+ "files": lu.LuFiles,
111
+ "folder": lu.LuFolder,
112
+ "folder-lock": lu.LuFolderLock,
113
+ "list": lu.LuList,
114
+ "list-checks": lu.LuListChecks,
115
+ "list-ordered": lu.LuListOrdered,
116
+ "list-todo": lu.LuListTodo,
117
+ "trending-up": lu.LuTrendingUp,
118
+ "megaphone": lu.LuMegaphone,
119
+ "shield": lu.LuShield,
120
+ "shield-check": lu.LuShieldCheck,
121
+ "phone": lu.LuPhone,
122
+ "phone-call": lu.LuPhoneCall,
123
+ "book-open": lu.LuBookOpen,
124
+ "notebook-pen": lu.LuNotebookPen,
125
+ "radio": lu.LuRadio,
126
+ "voicemail": lu.LuVoicemail,
127
+ "square-check": lu.LuSquareCheck,
128
+ "circle-check": lu.LuCircleCheck,
129
+ "rotate-ccw": lu.LuRotateCcw,
130
+ "refresh-cw": lu.LuRefreshCw,
131
+ "history": lu.LuHistory,
132
+ "smartphone": lu.LuSmartphone,
133
+ "pencil": lu.LuPencil,
134
+ "sparkles": lu.LuSparkles,
135
+ "target": lu.LuTarget,
136
+ "flask-conical": lu.LuFlaskConical,
137
+ "settings": lu.LuSettings,
138
+ "sliders-horizontal": lu.LuSlidersHorizontal,
139
+ "inbox": lu.LuInbox,
140
+ "share-2": lu.LuShare2,
141
+ "building-2": lu.LuBuilding2,
142
+ "palette": lu.LuPalette,
143
+ "credit-card": lu.LuCreditCard,
144
+ "wallet": lu.LuWallet,
145
+ "receipt": lu.LuReceipt,
146
+ "dollar-sign": lu.LuDollarSign,
147
+ "mail": lu.LuMail,
148
+ "mail-open": lu.LuMailOpen,
149
+ "bell": lu.LuBell,
150
+ "house": lu.LuHouse,
151
+ "star": lu.LuStar,
152
+ "heart": lu.LuHeart,
153
+ "hand-heart": lu.LuHandHeart,
154
+ "tag": lu.LuTag,
155
+ "filter": lu.LuFilter,
156
+ "search": lu.LuSearch,
157
+ "globe": lu.LuGlobe,
158
+ "link": lu.LuLink,
159
+ "image": lu.LuImage,
160
+ "video": lu.LuVideo,
161
+ "mic": lu.LuMic,
162
+ "printer": lu.LuPrinter,
163
+ "eye": lu.LuEye,
164
+ "lock": lu.LuLock,
165
+ "key": lu.LuKey,
166
+ "vote": lu.LuVote,
167
+ "landmark": lu.LuLandmark,
168
+ "newspaper": lu.LuNewspaper,
169
+ "kanban": lu.LuKanban,
170
+ "wrench": lu.LuWrench,
171
+ "zap": lu.LuZap,
172
+ "rocket": lu.LuRocket,
173
+ "archive": lu.LuArchive,
174
+ "trash-2": lu.LuTrash2,
175
+ "circle-help": lu.LuCircleHelp,
176
+ "info": lu.LuInfo,
177
+ "triangle-alert": lu.LuTriangleAlert,
178
+ "door-open": lu.LuDoorOpen,
179
+ "signpost": lu.LuSignpost,
180
+ "badge-check": lu.LuBadgeCheck,
181
+ "award": lu.LuAward,
182
+ "briefcase": lu.LuBriefcase,
183
+ "handshake": lu.LuHandshake,
184
+ "network": lu.LuNetwork,
185
+ "workflow": lu.LuWorkflow,
186
+ "git-branch": lu.LuGitBranch
187
+ };
188
+ function resolveTabGlyph(name) {
189
+ if (!name) return null;
190
+ const key = name.trim().replace(/^['"]|['"]$/g, "").trim().toLowerCase();
191
+ if (!key) return null;
192
+ return Object.prototype.hasOwnProperty.call(TAB_GLYPHS, key) ? TAB_GLYPHS[key] : null;
193
+ }
194
+ var KNOWN_TAB_GLYPHS = Object.freeze(Object.keys(TAB_GLYPHS));
195
+ function tabIconVarName(strip, tabKey) {
196
+ return `--tab-icon-${strip}-${tabKey}`;
197
+ }
198
+ var EMPTY = Object.freeze({});
199
+ function useTabIconStripGlyphs(strip, tabKeys) {
200
+ const [names, setNames] = react.useState(EMPTY);
201
+ const keysSig = tabKeys.join("\0");
202
+ react.useEffect(() => {
203
+ if (!strip || typeof window === "undefined" || typeof document === "undefined") {
204
+ setNames(EMPTY);
205
+ return;
206
+ }
207
+ const keys = keysSig ? keysSig.split("\0") : [];
208
+ const read = () => {
209
+ const style = window.getComputedStyle(document.documentElement);
210
+ const next = {};
211
+ for (const key of keys) {
212
+ const raw = style.getPropertyValue(tabIconVarName(strip, key)).trim().replace(/^['"]|['"]$/g, "").trim();
213
+ if (raw) next[key] = raw;
214
+ }
215
+ setNames((prev) => sameNames(prev, next) ? prev : next);
216
+ };
217
+ read();
218
+ const observer = new MutationObserver(read);
219
+ observer.observe(document.head, { childList: true, subtree: true, characterData: true });
220
+ return () => observer.disconnect();
221
+ }, [strip, keysSig]);
222
+ return names;
223
+ }
224
+ function sameNames(a, b) {
225
+ const ak = Object.keys(a);
226
+ if (ak.length !== Object.keys(b).length) return false;
227
+ return ak.every((k) => a[k] === b[k]);
228
+ }
62
229
 
63
230
  // src/lib/deprecation.ts
64
231
  var warned = /* @__PURE__ */ new Set();
@@ -2420,6 +2587,71 @@ function Card({
2420
2587
  }
2421
2588
  );
2422
2589
  }
2590
+ var SETTINGS_ORIGIN = "https://settings.politogyvrm.com";
2591
+ var WALLET_PATH = "/organization-settings/subscription-billing/wallet";
2592
+ function aiCreditsWalletUrl(orgId) {
2593
+ const url = new URL(WALLET_PATH, SETTINGS_ORIGIN);
2594
+ if (orgId) url.searchParams.set("org", orgId);
2595
+ return url.toString();
2596
+ }
2597
+ var AI_CREDITS_STATE_TITLES = {
2598
+ out: "Out of AI Credits",
2599
+ paused: "Paused \u2014 out of AI Credits",
2600
+ waiting: "Waiting for AI Credits"
2601
+ };
2602
+ var MUTED = { color: "var(--color-text-muted, #6b7280)" };
2603
+ var BUTTON = {
2604
+ display: "inline-block",
2605
+ borderRadius: 6,
2606
+ padding: "6px 12px",
2607
+ fontSize: 12,
2608
+ fontWeight: 600,
2609
+ textDecoration: "none"
2610
+ };
2611
+ var PRIMARY = { ...BUTTON, background: "var(--color-text, #2F3136)", color: "#fff" };
2612
+ var SECONDARY = {
2613
+ ...BUTTON,
2614
+ border: "1px solid var(--color-border, #e5e7eb)",
2615
+ color: "var(--color-text, #2F3136)"
2616
+ };
2617
+ var defaultFormat = (at) => at.toLocaleString(void 0, { month: "short", day: "numeric", hour: "numeric", minute: "2-digit" });
2618
+ function detail(kind, lastOutputAt, format) {
2619
+ if (kind === "paused") return lastOutputAt ? `Last updated ${format(lastOutputAt)}.` : "Nothing has been generated yet.";
2620
+ if (kind === "waiting") return "This step is kept and starts on its own once AI Credits are added.";
2621
+ return null;
2622
+ }
2623
+ function AiCreditsState({
2624
+ kind,
2625
+ orgId,
2626
+ isAccountAdmin,
2627
+ lastOutputAt,
2628
+ onCheckAgain,
2629
+ formatTime = defaultFormat,
2630
+ className,
2631
+ style
2632
+ }) {
2633
+ const at = lastOutputAt == null ? null : lastOutputAt instanceof Date ? lastOutputAt : new Date(lastOutputAt);
2634
+ const last = at && !Number.isNaN(at.getTime()) ? at : null;
2635
+ const text = detail(kind, last, formatTime);
2636
+ const wallet = aiCreditsWalletUrl(orgId);
2637
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { role: "status", "data-ai-credits-state": kind, className, style: { fontSize: 14, ...style }, children: [
2638
+ /* @__PURE__ */ jsxRuntime.jsx("p", { style: { margin: 0, fontWeight: 600 }, children: AI_CREDITS_STATE_TITLES[kind] }),
2639
+ text && /* @__PURE__ */ jsxRuntime.jsx("p", { style: { margin: "4px 0 0", ...MUTED }, children: text }),
2640
+ isAccountAdmin ? /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { marginTop: 8, display: "flex", flexWrap: "wrap", gap: 8 }, children: [
2641
+ /* @__PURE__ */ jsxRuntime.jsx("a", { href: wallet, style: PRIMARY, children: "Buy AI Credits" }),
2642
+ /* @__PURE__ */ jsxRuntime.jsx("a", { href: wallet, style: SECONDARY, children: "Turn on auto top-off" })
2643
+ ] }) : /* @__PURE__ */ jsxRuntime.jsx("p", { style: { margin: "4px 0 0", ...MUTED }, children: "Ask an Account Admin to add AI Credits." }),
2644
+ onCheckAgain && /* @__PURE__ */ jsxRuntime.jsx(
2645
+ "button",
2646
+ {
2647
+ type: "button",
2648
+ onClick: onCheckAgain,
2649
+ style: { marginTop: 8, padding: 0, border: 0, background: "none", fontSize: 12, textDecoration: "underline", cursor: "pointer", ...MUTED },
2650
+ children: "Check again"
2651
+ }
2652
+ )
2653
+ ] });
2654
+ }
2423
2655
  var standardNavIcons = {
2424
2656
  home: lu.LuHouse,
2425
2657
  users: lu.LuUsers,
@@ -2474,7 +2706,7 @@ var PHONEBANK_ORIGIN = "https://phonebank.politogyvrm.com/";
2474
2706
  var CANVASS_ORIGIN = "https://canvass.politogyvrm.com/";
2475
2707
  var SIGNS_ORIGIN = "https://signs.politogyvrm.com/";
2476
2708
  var POLLS_ORIGIN = "https://polls.politogyvrm.com/";
2477
- var SETTINGS_ORIGIN = "https://settings.politogyvrm.com/";
2709
+ var SETTINGS_ORIGIN2 = "https://settings.politogyvrm.com/";
2478
2710
  var DASHBOARD_ORIGIN = "https://dashboard.politogyvrm.com/";
2479
2711
  var BATTLEGROUND_ORIGIN = "https://battleground.politogyvrm.com/";
2480
2712
  var DISTRICTS_ORIGIN = "https://districts.politogyvrm.com/";
@@ -2604,8 +2836,8 @@ function standardPolitogyNav(opts) {
2604
2836
  icon: icon("settings"),
2605
2837
  // Organization settings moved to the standalone Settings app
2606
2838
  // (settings.politogyvrm.com, Specs/Organization-Settings v12).
2607
- href: withOrg(`${SETTINGS_ORIGIN}organization-settings`),
2608
- children: branches(SETTINGS_ORIGIN, ORG_SETTINGS_CHILDREN)
2839
+ href: withOrg(`${SETTINGS_ORIGIN2}organization-settings`),
2840
+ children: branches(SETTINGS_ORIGIN2, ORG_SETTINGS_CHILDREN)
2609
2841
  }
2610
2842
  ];
2611
2843
  const buildRelationship = () => {
@@ -4146,9 +4378,14 @@ function NavTabStrip({
4146
4378
  linkComponent,
4147
4379
  size = "md",
4148
4380
  className,
4381
+ iconStrip,
4149
4382
  children
4150
4383
  }) {
4151
4384
  const Link = linkComponent ?? DefaultLink;
4385
+ const brandIconNames = useTabIconStripGlyphs(
4386
+ iconStrip,
4387
+ tabs.map((tab) => tab.key)
4388
+ );
4152
4389
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
4153
4390
  /* @__PURE__ */ jsxRuntime.jsx(
4154
4391
  "div",
@@ -4162,7 +4399,18 @@ function NavTabStrip({
4162
4399
  "flex items-end gap-[var(--tab-gap,26px)] border-b border-[color:var(--tab-border-color,#D7DADF)]",
4163
4400
  className
4164
4401
  ].filter(Boolean).join(" "),
4165
- children: tabs.map((tab) => /* @__PURE__ */ jsxRuntime.jsx(NavTabButton, { tab, Link, size }, tab.key))
4402
+ children: tabs.map((tab) => {
4403
+ const BrandIcon = iconStrip ? resolveTabGlyph(brandIconNames[tab.key]) : null;
4404
+ return /* @__PURE__ */ jsxRuntime.jsx(
4405
+ NavTabButton,
4406
+ {
4407
+ tab: BrandIcon ? { ...tab, icon: BrandIcon } : tab,
4408
+ Link,
4409
+ size
4410
+ },
4411
+ tab.key
4412
+ );
4413
+ })
4166
4414
  }
4167
4415
  ),
4168
4416
  children !== void 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pt-5", children }) : null
@@ -4363,6 +4611,8 @@ function NavAppShell({
4363
4611
  );
4364
4612
  }
4365
4613
 
4614
+ exports.AI_CREDITS_STATE_TITLES = AI_CREDITS_STATE_TITLES;
4615
+ exports.AiCreditsState = AiCreditsState;
4366
4616
  exports.BETA_BANNER_DISMISS_KEY = BETA_BANNER_DISMISS_KEY;
4367
4617
  exports.BreadcrumbBar = BreadcrumbBar;
4368
4618
  exports.CAMPAIGN_FEATURE_AVAILABILITY = CAMPAIGN_FEATURE_AVAILABILITY;
@@ -4375,6 +4625,7 @@ exports.CreditsAction = CreditsAction;
4375
4625
  exports.FormColumn = FormColumn;
4376
4626
  exports.FuelAction = FuelAction;
4377
4627
  exports.HeaderTabBar = HeaderTabBar;
4628
+ exports.KNOWN_TAB_GLYPHS = KNOWN_TAB_GLYPHS;
4378
4629
  exports.NavAppShell = NavAppShell;
4379
4630
  exports.NavBetaBanner = NavBetaBanner;
4380
4631
  exports.NavChromeProvider = NavChromeProvider;
@@ -4393,6 +4644,7 @@ exports.TopBarPanelArrow = TopBarPanelArrow;
4393
4644
  exports.TopBarPopover = TopBarPopover;
4394
4645
  exports.TopBarTooltip = TopBarTooltip;
4395
4646
  exports.TopBarWidgetSlot = TopBarWidgetSlot;
4647
+ exports.aiCreditsWalletUrl = aiCreditsWalletUrl;
4396
4648
  exports.clearBetaBannerDismissal = clearBetaBannerDismissal;
4397
4649
  exports.creditGaugeRatio = creditGaugeRatio;
4398
4650
  exports.creditStateWord = creditStateWord;
@@ -4403,6 +4655,7 @@ exports.envChipClasses = envChipClasses;
4403
4655
  exports.isNavItemActive = isNavItemActive;
4404
4656
  exports.modeIdFromLabel = modeIdFromLabel;
4405
4657
  exports.resolveOrgLogoUrl = resolveOrgLogoUrl;
4658
+ exports.resolveTabGlyph = resolveTabGlyph;
4406
4659
  exports.shortEnvLabel = shortEnvLabel;
4407
4660
  exports.shortUserName = shortUserName;
4408
4661
  exports.standardPolitogyNav = standardPolitogyNav;