@planningcenter/topbar 11.2.4 → 11.2.5
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/topbar.js +29 -22
- package/dist/topbar.js.map +1 -1
- package/dist/topbar.modern.js +29 -22
- package/dist/topbar.modern.js.map +1 -1
- package/dist/topbar.module.js +29 -22
- package/dist/topbar.module.js.map +1 -1
- package/dist/topbar.umd.js +29 -22
- package/dist/topbar.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/topbar.umd.js
CHANGED
|
@@ -3453,12 +3453,16 @@
|
|
|
3453
3453
|
|
|
3454
3454
|
const pcoUrl = pcoUrl$1;
|
|
3455
3455
|
|
|
3456
|
+
// The route rides in the iframe URL fragment (`…/topbar#conversations/abc`),
|
|
3457
|
+
// not the path, so updating it is a same-document navigation that doesn't
|
|
3458
|
+
// reload the iframe, but also lets the route survive a forced reload (e.g.
|
|
3459
|
+
// Turbo re-parenting the topbar).
|
|
3456
3460
|
function buildPicobotSrc(origin, path) {
|
|
3457
3461
|
const [rawPath, queryPart] = path.replace(/^\/+/, "").split("?", 2);
|
|
3458
3462
|
const safePath = rawPath.split("/").filter(segment => segment && segment !== "." && segment !== "..").join("/");
|
|
3459
|
-
const
|
|
3460
|
-
const
|
|
3461
|
-
return
|
|
3463
|
+
const fragment = queryPart !== undefined ? `${safePath}?${queryPart}` : safePath;
|
|
3464
|
+
const base = new URL("topbar", origin).toString();
|
|
3465
|
+
return fragment ? `${base}#${fragment}` : base;
|
|
3462
3466
|
}
|
|
3463
3467
|
|
|
3464
3468
|
const handleSearchSelect = (hit, indexName) => {
|
|
@@ -3626,13 +3630,10 @@
|
|
|
3626
3630
|
onMessage
|
|
3627
3631
|
}) {
|
|
3628
3632
|
const ref = React.useRef(null);
|
|
3629
|
-
|
|
3630
|
-
//
|
|
3631
|
-
//
|
|
3632
|
-
|
|
3633
|
-
// no leading slash or /topbar prefix—buildPicobotSrc adds those.
|
|
3634
|
-
const lastReportedPathRef = React.useRef(initialPath);
|
|
3635
|
-
const [loadedPath, setLoadedPath] = React.useState(initialPath);
|
|
3633
|
+
// Keep the fragment in sync in both directions—external opens (deeplink /
|
|
3634
|
+
// Contact support) and picobot's own NEW_ROUTE_RENDERED reports—so it
|
|
3635
|
+
// always reflects the live conversation. See buildPicobotSrc.
|
|
3636
|
+
const [loadedPath, setLoadedPath] = React.useState(iframePath || "");
|
|
3636
3637
|
React.useEffect(() => {
|
|
3637
3638
|
if (!onIframeChangePath && !onMessage) return undefined;
|
|
3638
3639
|
const handler = e => {
|
|
@@ -3642,7 +3643,7 @@
|
|
|
3642
3643
|
if (e.source !== ref.current.contentWindow) return;
|
|
3643
3644
|
if (((_a = e.data) === null || _a === void 0 ? void 0 : _a.type) === "NEW_ROUTE_RENDERED" && onIframeChangePath) {
|
|
3644
3645
|
const reportedPath = String((_b = e.data.payload) !== null && _b !== void 0 ? _b : "");
|
|
3645
|
-
|
|
3646
|
+
setLoadedPath(reportedPath);
|
|
3646
3647
|
onIframeChangePath(reportedPath);
|
|
3647
3648
|
}
|
|
3648
3649
|
if (onMessage) onMessage(e.data);
|
|
@@ -3651,9 +3652,7 @@
|
|
|
3651
3652
|
return () => window.removeEventListener("message", handler);
|
|
3652
3653
|
}, [onIframeChangePath, onMessage]);
|
|
3653
3654
|
React.useEffect(() => {
|
|
3654
|
-
|
|
3655
|
-
if (lastReportedPathRef.current === incomingPath) return;
|
|
3656
|
-
setLoadedPath(incomingPath);
|
|
3655
|
+
setLoadedPath(iframePath || "");
|
|
3657
3656
|
}, [iframePath]);
|
|
3658
3657
|
const iframeSrc = buildPicobotSrc(picobotOrigin, loadedPath);
|
|
3659
3658
|
return /*#__PURE__*/React.createElement("iframe", {
|
|
@@ -3708,7 +3707,8 @@
|
|
|
3708
3707
|
staticDotPath: "",
|
|
3709
3708
|
staticPath: "M16 10C14.9391 10 13.9217 10.4214 13.1716 11.1716C12.4214 11.9217 12 12.9391 12 14H14C14 13.4696 14.2107 12.9609 14.5858 12.5858C14.9609 12.2107 15.4696 12 16 12C16.5304 12 17.0391 12.2107 17.4142 12.5858C17.7893 12.9609 18 13.4696 18 14C18 16 15 15.75 15 19H17C17 16.75 20 16.5 20 14C20 12.9391 19.5786 11.9217 18.8284 11.1716C18.0783 10.4214 17.0609 10 16 10ZM16 24C14.4178 24 12.871 23.5308 11.5554 22.6518C10.2399 21.7727 9.21447 20.5233 8.60897 19.0615C8.00347 17.5997 7.84504 15.9911 8.15372 14.4393C8.4624 12.8874 9.22433 11.462 10.3432 10.3431C11.462 9.22433 12.8874 8.4624 14.4393 8.15372C15.9911 7.84504 17.5997 8.00346 19.0615 8.60896C20.5233 9.21446 21.7727 10.2398 22.6518 11.5554C23.5308 12.871 24 14.4177 24 16C23.9974 18.1209 23.1537 20.1542 21.6539 21.6539C20.1542 23.1537 18.1209 23.9974 16 24ZM16 6C14.0222 6 12.0888 6.58649 10.4443 7.6853C8.79981 8.78412 7.51809 10.3459 6.76121 12.1732C6.00433 14.0004 5.8063 16.0111 6.19215 17.9509C6.578 19.8907 7.53041 21.6725 8.92894 23.0711C10.3275 24.4696 12.1093 25.422 14.0491 25.8079C15.9889 26.1937 17.9996 25.9957 19.8268 25.2388C21.6541 24.4819 23.2159 23.2002 24.3147 21.5557C25.4135 19.9112 26 17.9778 26 16C26 13.3478 24.9464 10.8043 23.0711 8.92893C21.1957 7.05357 18.6522 6 16 6V6ZM15 22H17V20H15V22Z"
|
|
3710
3709
|
},
|
|
3711
|
-
name: "Helpdesk"
|
|
3710
|
+
name: "Helpdesk",
|
|
3711
|
+
storageExemptPaths: ["email", "phone"]
|
|
3712
3712
|
};
|
|
3713
3713
|
|
|
3714
3714
|
const Eyebrow = ({
|
|
@@ -4639,6 +4639,13 @@
|
|
|
4639
4639
|
const tool = toolsRouteMap[toolName];
|
|
4640
4640
|
return (_b = (_a = tool === null || tool === void 0 ? void 0 : tool.storageExemptPaths) === null || _a === void 0 ? void 0 : _a.includes(path)) !== null && _b !== void 0 ? _b : false;
|
|
4641
4641
|
}
|
|
4642
|
+
function scrollToolDrawerToTop(toolName) {
|
|
4643
|
+
var _a;
|
|
4644
|
+
(_a = document.getElementById(`toolbarDrawer${toolName}`)) === null || _a === void 0 ? void 0 : _a.scrollTo({
|
|
4645
|
+
behavior: "smooth",
|
|
4646
|
+
top: 0
|
|
4647
|
+
});
|
|
4648
|
+
}
|
|
4642
4649
|
const TOOLS_MAP = {
|
|
4643
4650
|
Chat,
|
|
4644
4651
|
Helpdesk,
|
|
@@ -4708,17 +4715,21 @@
|
|
|
4708
4715
|
unsubscribe();
|
|
4709
4716
|
};
|
|
4710
4717
|
}, [open, clearRoute]);
|
|
4718
|
+
const openHelpdeskAtRoot = React.useCallback(() => {
|
|
4719
|
+
onChangeToolbarFragmentRoute(Helpdesk.name.toLowerCase(), "");
|
|
4720
|
+
scrollToolDrawerToTop(Helpdesk.name);
|
|
4721
|
+
}, [onChangeToolbarFragmentRoute]);
|
|
4711
4722
|
React.useEffect(() => {
|
|
4712
4723
|
window.topbar = window.topbar || {};
|
|
4713
4724
|
window.topbar.openProfile = () => handleToolOnClick(Profile);
|
|
4714
|
-
window.topbar.openHelpdesk =
|
|
4725
|
+
window.topbar.openHelpdesk = openHelpdeskAtRoot;
|
|
4715
4726
|
window.openHelpdesk = window.topbar.openHelpdesk; /* TODO: Remove when products have migrated to window.topbar.openHelpdesk */
|
|
4716
4727
|
return () => {
|
|
4717
4728
|
delete window.topbar.openProfile;
|
|
4718
4729
|
delete window.topbar.openHelpdesk;
|
|
4719
4730
|
delete window.openHelpdesk; /* TODO: Remove when products have migrated to window.topbar.openHelpdesk */
|
|
4720
4731
|
};
|
|
4721
|
-
}, [
|
|
4732
|
+
}, [Profile, openHelpdeskAtRoot]);
|
|
4722
4733
|
const loginSettingsUrl = getLoginProfilePath({
|
|
4723
4734
|
appName: appName.replace(/[\s-]/, ""),
|
|
4724
4735
|
env: env,
|
|
@@ -4800,12 +4811,8 @@
|
|
|
4800
4811
|
});
|
|
4801
4812
|
const TOOLS = [Notifications, Tasks, displayChatIcon && Chat].filter(Boolean);
|
|
4802
4813
|
const handleToolOnClick = tool => {
|
|
4803
|
-
var _a;
|
|
4804
4814
|
toggleDrawer(tool);
|
|
4805
|
-
(
|
|
4806
|
-
behavior: "smooth",
|
|
4807
|
-
top: 0
|
|
4808
|
-
});
|
|
4815
|
+
scrollToolDrawerToTop(tool.name);
|
|
4809
4816
|
};
|
|
4810
4817
|
const toolSpecificProps = {
|
|
4811
4818
|
Profile: {
|