@the-portland-company/shell 0.86.0 → 0.87.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.
@@ -196,6 +196,19 @@ type PolitogyAppSession = {
196
196
  * copy through `data.searchPlaceholder`.
197
197
  */
198
198
  declare const MODE_SEARCH_PLACEHOLDER: Record<string, string>;
199
+ /**
200
+ * Where a Relationship universal search goes (Reference/UI-Platform "Top bar
201
+ * — required elements": Relationship search returns the Account's Contacts
202
+ * only; Data-System/UVP §7.1: a result opens the Contact Card). It opens
203
+ * Contacts → All Contacts with the query as the `q` feature parameter, which
204
+ * Contacts reads into its table search. From inside Contacts the link stays
205
+ * on the same origin; a staging host goes to the staging twin.
206
+ */
207
+ declare function relationshipSearchHref(query: string, opts?: {
208
+ orgId?: string | null;
209
+ fromApp?: string;
210
+ hostname?: string;
211
+ }): string | null;
199
212
  type PolitogyFrameData = {
200
213
  /** Chrome-API fetcher override for apps that authenticate client-side. */
201
214
  fetchJson?: NavChromeFetcher;
@@ -595,4 +608,4 @@ type UseChromeModeArg = ModeId | {
595
608
  */
596
609
  declare function useChromeMode(arg?: UseChromeModeArg): NavMode;
597
610
 
598
- export { type BootPhase, type BootProgress, type BootStageId, type ChromeDevNotesConfig, type ChromeIdentity, ChromeTopBarActions, type ControlledOrgState, LoadingScreen, MODE_SEARCH_PLACEHOLDER, POLITOGY_APPS, PolitogyAppChrome, PolitogyAppFrame, type PolitogyAppKey, type PolitogyAppMode, type PolitogyAppSession, type PolitogyBuildMeta, type PolitogyFrameData, type PolitogyFrameGrant, type PolitogyGrantedFrame, type ResolvedIdentity, type TokenOrgState, deriveBreadcrumbs, footerLinks, looksLikeEmail, modeLandingHref, orgSwitchLanding, resolveIdentity, standardNavIcons, useChromeFooter, useChromeIdentity, useChromeMode, useChromeState, useChromeUserMenu, useIsSuperAdmin };
611
+ export { type BootPhase, type BootProgress, type BootStageId, type ChromeDevNotesConfig, type ChromeIdentity, ChromeTopBarActions, type ControlledOrgState, LoadingScreen, MODE_SEARCH_PLACEHOLDER, POLITOGY_APPS, PolitogyAppChrome, PolitogyAppFrame, type PolitogyAppKey, type PolitogyAppMode, type PolitogyAppSession, type PolitogyBuildMeta, type PolitogyFrameData, type PolitogyFrameGrant, type PolitogyGrantedFrame, type ResolvedIdentity, type TokenOrgState, deriveBreadcrumbs, footerLinks, looksLikeEmail, modeLandingHref, orgSwitchLanding, relationshipSearchHref, resolveIdentity, standardNavIcons, useChromeFooter, useChromeIdentity, useChromeMode, useChromeState, useChromeUserMenu, useIsSuperAdmin };
@@ -196,6 +196,19 @@ type PolitogyAppSession = {
196
196
  * copy through `data.searchPlaceholder`.
197
197
  */
198
198
  declare const MODE_SEARCH_PLACEHOLDER: Record<string, string>;
199
+ /**
200
+ * Where a Relationship universal search goes (Reference/UI-Platform "Top bar
201
+ * — required elements": Relationship search returns the Account's Contacts
202
+ * only; Data-System/UVP §7.1: a result opens the Contact Card). It opens
203
+ * Contacts → All Contacts with the query as the `q` feature parameter, which
204
+ * Contacts reads into its table search. From inside Contacts the link stays
205
+ * on the same origin; a staging host goes to the staging twin.
206
+ */
207
+ declare function relationshipSearchHref(query: string, opts?: {
208
+ orgId?: string | null;
209
+ fromApp?: string;
210
+ hostname?: string;
211
+ }): string | null;
199
212
  type PolitogyFrameData = {
200
213
  /** Chrome-API fetcher override for apps that authenticate client-side. */
201
214
  fetchJson?: NavChromeFetcher;
@@ -595,4 +608,4 @@ type UseChromeModeArg = ModeId | {
595
608
  */
596
609
  declare function useChromeMode(arg?: UseChromeModeArg): NavMode;
597
610
 
598
- export { type BootPhase, type BootProgress, type BootStageId, type ChromeDevNotesConfig, type ChromeIdentity, ChromeTopBarActions, type ControlledOrgState, LoadingScreen, MODE_SEARCH_PLACEHOLDER, POLITOGY_APPS, PolitogyAppChrome, PolitogyAppFrame, type PolitogyAppKey, type PolitogyAppMode, type PolitogyAppSession, type PolitogyBuildMeta, type PolitogyFrameData, type PolitogyFrameGrant, type PolitogyGrantedFrame, type ResolvedIdentity, type TokenOrgState, deriveBreadcrumbs, footerLinks, looksLikeEmail, modeLandingHref, orgSwitchLanding, resolveIdentity, standardNavIcons, useChromeFooter, useChromeIdentity, useChromeMode, useChromeState, useChromeUserMenu, useIsSuperAdmin };
611
+ export { type BootPhase, type BootProgress, type BootStageId, type ChromeDevNotesConfig, type ChromeIdentity, ChromeTopBarActions, type ControlledOrgState, LoadingScreen, MODE_SEARCH_PLACEHOLDER, POLITOGY_APPS, PolitogyAppChrome, PolitogyAppFrame, type PolitogyAppKey, type PolitogyAppMode, type PolitogyAppSession, type PolitogyBuildMeta, type PolitogyFrameData, type PolitogyFrameGrant, type PolitogyGrantedFrame, type ResolvedIdentity, type TokenOrgState, deriveBreadcrumbs, footerLinks, looksLikeEmail, modeLandingHref, orgSwitchLanding, relationshipSearchHref, resolveIdentity, standardNavIcons, useChromeFooter, useChromeIdentity, useChromeMode, useChromeState, useChromeUserMenu, useIsSuperAdmin };
@@ -1,5 +1,6 @@
1
1
  "use client";
2
2
  import { broadcastLogout, watchLogout } from './chunk-LL6LSJAH.js';
3
+ import { writeUrlState } from './chunk-GVQKZI5X.js';
3
4
  import { clearBetaBannerDismissal, standardPolitogyNav, standardNavIcons, isNavItemActive, NavAppShell } from './chunk-3JOLELB4.js';
4
5
  export { standardNavIcons } from './chunk-3JOLELB4.js';
5
6
  import { warnDeprecated, NavChromeProvider, TopBarWidgetSlot, FuelAction, SpecOverlayAction, NotificationsAction, SupportAction, useChromeMe, useNavChromeDedupedFetch, useChromeOrgs, useNavChromeFetcher } from './chunk-PRZP2SB6.js';
@@ -607,6 +608,22 @@ var MODE_SEARCH_PLACEHOLDER = {
607
608
  campaign: "Search voters, walk lists, polls",
608
609
  petition: "Search petitions, sheets, circulators"
609
610
  };
611
+ function relationshipSearchHref(query, opts = {}) {
612
+ const q = query.trim();
613
+ if (!q) return null;
614
+ const search = writeUrlState("", {
615
+ mode: "relationship",
616
+ page: "contacts",
617
+ tab: "contacts",
618
+ section: "table",
619
+ org_id: opts.orgId ?? null,
620
+ feature: { q }
621
+ });
622
+ if (opts.fromApp === "contacts") return `/${search}`;
623
+ const staging = (opts.hostname ?? "").toLowerCase().includes("staging");
624
+ const origin = staging ? "https://contacts-staging.politogyvrm.com" : POLITOGY_APPS.contacts.origin;
625
+ return `${origin}/${search}`;
626
+ }
610
627
  function PolitogyAppFrame({
611
628
  app,
612
629
  pathname,
@@ -768,6 +785,8 @@ function FrameBody({
768
785
  }, [cookieMode]);
769
786
  const coreOrgs = chrome?.orgs ?? [];
770
787
  const activeCoreOrg = coreOrgs.find((o) => o.id === chrome?.orgId) ?? null;
788
+ const searchMode = appMode ?? mode.id ?? "relationship";
789
+ const [searchText, setSearchText] = useState("");
771
790
  const navDisplay = chrome?.navDisplay ?? "both";
772
791
  const navMode = appMode ?? (app !== CORE_APP && isStandardNavMode(mode.id) ? mode.id : "relationship");
773
792
  const activeOrgId = chrome?.orgId ?? null;
@@ -880,11 +899,25 @@ function FrameBody({
880
899
  userMenu,
881
900
  onSignOut: handleSignOut,
882
901
  // Reference/UI-Platform "Top bar — required elements": Universal
883
- // search is the only thing on the left end of the bar. No app wires
884
- // search yet, so this stays decorative (`NavTopBarProps.search` — "an
885
- // app that has not wired search yet still gets the correct chrome").
902
+ // search is the only thing on the left end of the bar. In
903
+ // Relationship Mode it searches the Account's Contacts: Enter opens
904
+ // Contacts → All Contacts filtered to the query, from every app, with
905
+ // no app wiring (an app never passes chrome configuration). Campaign
906
+ // and Petition search are not built yet and stay decorative.
886
907
  search: {
887
- placeholder: data?.searchPlaceholder ?? MODE_SEARCH_PLACEHOLDER[appMode ?? mode.id ?? "relationship"] ?? "Search"
908
+ placeholder: data?.searchPlaceholder ?? MODE_SEARCH_PLACEHOLDER[searchMode] ?? "Search",
909
+ ...searchMode === "relationship" ? {
910
+ value: searchText,
911
+ onChange: setSearchText,
912
+ onSubmit: (value) => {
913
+ const href = relationshipSearchHref(value, {
914
+ orgId: activeCoreOrg?.id ?? session.accountId ?? null,
915
+ fromApp: app,
916
+ hostname: typeof window === "undefined" ? "" : window.location.hostname
917
+ });
918
+ if (href) window.location.assign(href);
919
+ }
920
+ } : {}
888
921
  },
889
922
  // No Build notes control (Reference/UI-Platform, decided 2026-10-03).
890
923
  // The action cluster is IDENTICAL everywhere — core included. Page
@@ -1602,6 +1635,6 @@ function useChromeMode(arg = {}) {
1602
1635
  };
1603
1636
  }
1604
1637
 
1605
- export { ChromeTopBarActions, LoadingScreen, MODE_SEARCH_PLACEHOLDER, POLITOGY_APPS, PolitogyAppChrome, PolitogyAppFrame, deriveBreadcrumbs, footerLinks, looksLikeEmail, modeLandingHref, orgSwitchLanding, resolveIdentity, useChromeFooter, useChromeIdentity, useChromeMode, useChromeState, useChromeUserMenu, useIsSuperAdmin };
1638
+ export { ChromeTopBarActions, LoadingScreen, MODE_SEARCH_PLACEHOLDER, POLITOGY_APPS, PolitogyAppChrome, PolitogyAppFrame, deriveBreadcrumbs, footerLinks, looksLikeEmail, modeLandingHref, orgSwitchLanding, relationshipSearchHref, resolveIdentity, useChromeFooter, useChromeIdentity, useChromeMode, useChromeState, useChromeUserMenu, useIsSuperAdmin };
1606
1639
  //# sourceMappingURL=app-chrome.js.map
1607
1640
  //# sourceMappingURL=app-chrome.js.map