@the-portland-company/shell 0.21.1 → 0.23.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/app-chrome.cjs +61 -15
- package/dist/app-chrome.cjs.map +1 -1
- package/dist/app-chrome.d.cts +23 -3
- package/dist/app-chrome.d.ts +23 -3
- package/dist/app-chrome.js +62 -16
- package/dist/app-chrome.js.map +1 -1
- package/dist/{chunk-M7LRHWJY.js → chunk-MAHINHZB.js} +62 -9
- package/dist/chunk-MAHINHZB.js.map +1 -0
- package/dist/native.cjs +60 -7
- package/dist/native.cjs.map +1 -1
- package/dist/native.d.cts +9 -1
- package/dist/native.d.ts +9 -1
- package/dist/native.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-M7LRHWJY.js.map +0 -1
package/dist/app-chrome.cjs
CHANGED
|
@@ -760,7 +760,10 @@ var ChromeStateContext = react.createContext(null);
|
|
|
760
760
|
function useChromeState() {
|
|
761
761
|
return react.useContext(ChromeStateContext);
|
|
762
762
|
}
|
|
763
|
-
function ChromeStateProvider({
|
|
763
|
+
function ChromeStateProvider({
|
|
764
|
+
controlledOrg,
|
|
765
|
+
children
|
|
766
|
+
}) {
|
|
764
767
|
const { orgs } = useChromeOrgs();
|
|
765
768
|
const [orgId, setOrgIdState] = react.useState(null);
|
|
766
769
|
const [navDisplay, setNavDisplayState] = react.useState("both");
|
|
@@ -793,8 +796,24 @@ function ChromeStateProvider({ children }) {
|
|
|
793
796
|
} catch {
|
|
794
797
|
}
|
|
795
798
|
}, []);
|
|
796
|
-
const value = react.useMemo(
|
|
797
|
-
()
|
|
799
|
+
const value = react.useMemo(() => {
|
|
800
|
+
if (controlledOrg) {
|
|
801
|
+
return {
|
|
802
|
+
orgId: controlledOrg.orgId,
|
|
803
|
+
setOrgId: controlledOrg.onSwitch,
|
|
804
|
+
orgs: controlledOrg.orgs ?? (orgs ?? []).map((o) => ({
|
|
805
|
+
id: o.id,
|
|
806
|
+
name: o.name,
|
|
807
|
+
logoUrl: o.logoUrl,
|
|
808
|
+
brandColor: o.brandColor,
|
|
809
|
+
role: o.role,
|
|
810
|
+
rawRole: o.rawRole ?? null
|
|
811
|
+
})),
|
|
812
|
+
navDisplay,
|
|
813
|
+
setNavDisplay
|
|
814
|
+
};
|
|
815
|
+
}
|
|
816
|
+
return {
|
|
798
817
|
orgId,
|
|
799
818
|
setOrgId,
|
|
800
819
|
orgs: (orgs ?? []).map((o) => ({
|
|
@@ -807,24 +826,25 @@ function ChromeStateProvider({ children }) {
|
|
|
807
826
|
})),
|
|
808
827
|
navDisplay,
|
|
809
828
|
setNavDisplay
|
|
810
|
-
}
|
|
811
|
-
|
|
812
|
-
);
|
|
829
|
+
};
|
|
830
|
+
}, [controlledOrg, orgId, setOrgId, orgs, navDisplay, setNavDisplay]);
|
|
813
831
|
return /* @__PURE__ */ jsxRuntime.jsx(ChromeStateContext.Provider, { value, children });
|
|
814
832
|
}
|
|
815
833
|
function AppDevNotes({
|
|
816
834
|
storagePrefix,
|
|
817
835
|
proxyBasePath,
|
|
836
|
+
devNotes,
|
|
818
837
|
identity,
|
|
819
838
|
children
|
|
820
839
|
}) {
|
|
821
840
|
const adapter = react.useMemo(
|
|
822
841
|
() => devnotes.createDevNotesClient({
|
|
823
|
-
basePath: `${proxyBasePath}/devnotes`,
|
|
824
|
-
//
|
|
825
|
-
getAuthToken: async () => ""
|
|
842
|
+
basePath: devNotes?.basePath ?? `${proxyBasePath}/devnotes`,
|
|
843
|
+
// Default: the same-origin proxy attaches the session's Bearer.
|
|
844
|
+
getAuthToken: devNotes?.getAuthToken ?? (async () => ""),
|
|
845
|
+
...devNotes?.fetch ? { fetch: devNotes.fetch } : {}
|
|
826
846
|
}),
|
|
827
|
-
[proxyBasePath]
|
|
847
|
+
[proxyBasePath, devNotes?.basePath, devNotes?.getAuthToken, devNotes?.fetch]
|
|
828
848
|
);
|
|
829
849
|
const user = react.useMemo(
|
|
830
850
|
() => ({
|
|
@@ -849,6 +869,8 @@ function PolitogyAppChrome({
|
|
|
849
869
|
storagePrefix,
|
|
850
870
|
proxyBasePath = "/api/chrome",
|
|
851
871
|
fetchJson: fetchJsonOverride,
|
|
872
|
+
devNotes,
|
|
873
|
+
org,
|
|
852
874
|
identity,
|
|
853
875
|
children
|
|
854
876
|
}) {
|
|
@@ -867,11 +889,12 @@ function PolitogyAppChrome({
|
|
|
867
889
|
[proxyBasePath]
|
|
868
890
|
);
|
|
869
891
|
const fetchJson = fetchJsonOverride ?? proxyFetchJson;
|
|
870
|
-
return /* @__PURE__ */ jsxRuntime.jsx(NavChromeProvider, { fetchJson, children: /* @__PURE__ */ jsxRuntime.jsx(ChromeStateProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
892
|
+
return /* @__PURE__ */ jsxRuntime.jsx(NavChromeProvider, { fetchJson, children: /* @__PURE__ */ jsxRuntime.jsx(ChromeStateProvider, { controlledOrg: org, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
871
893
|
AppDevNotes,
|
|
872
894
|
{
|
|
873
895
|
storagePrefix,
|
|
874
896
|
proxyBasePath,
|
|
897
|
+
devNotes,
|
|
875
898
|
identity,
|
|
876
899
|
children
|
|
877
900
|
}
|
|
@@ -935,9 +958,28 @@ function useChromeUserMenu({
|
|
|
935
958
|
};
|
|
936
959
|
}
|
|
937
960
|
var MODE_DEFS = [
|
|
938
|
-
{
|
|
939
|
-
|
|
940
|
-
|
|
961
|
+
{
|
|
962
|
+
id: "relationship",
|
|
963
|
+
label: "Relationship Mode",
|
|
964
|
+
icon: fi.FiUsers,
|
|
965
|
+
href: `${CORE_BASE_URL}/relationship/dashboard`,
|
|
966
|
+
orgQuery: true
|
|
967
|
+
},
|
|
968
|
+
{
|
|
969
|
+
id: "campaign",
|
|
970
|
+
label: "Campaign Mode",
|
|
971
|
+
icon: fi.FiBarChart2,
|
|
972
|
+
href: `${CORE_BASE_URL}/campaign/dashboard`,
|
|
973
|
+
orgQuery: true
|
|
974
|
+
},
|
|
975
|
+
{
|
|
976
|
+
// Petition Mode lives in its own standalone app (HITL 2026-07-23).
|
|
977
|
+
id: "petition",
|
|
978
|
+
label: "Petition Mode",
|
|
979
|
+
icon: fi.FiFlag,
|
|
980
|
+
href: "https://petitions.politogyvrm.com/",
|
|
981
|
+
orgQuery: true
|
|
982
|
+
}
|
|
941
983
|
];
|
|
942
984
|
function useChromeMode(currentModeId = "relationship") {
|
|
943
985
|
const ctx = react.useContext(ChromeStateContext);
|
|
@@ -966,7 +1008,11 @@ function useChromeMode(currentModeId = "relationship") {
|
|
|
966
1008
|
options: options.length > 1 ? options.map((o) => ({ id: o.id, label: o.label, icon: o.icon })) : void 0,
|
|
967
1009
|
onSelect: options.length > 1 ? (id) => {
|
|
968
1010
|
const def = MODE_DEFS.find((m) => m.id === id);
|
|
969
|
-
if (def)
|
|
1011
|
+
if (!def) return;
|
|
1012
|
+
const sep = def.href.includes("?") ? "&" : "?";
|
|
1013
|
+
window.location.assign(
|
|
1014
|
+
def.orgQuery && suffix ? `${def.href}${sep}${suffix.slice(1)}` : def.href
|
|
1015
|
+
);
|
|
970
1016
|
} : void 0
|
|
971
1017
|
};
|
|
972
1018
|
}
|