@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.js
CHANGED
|
@@ -3466,12 +3466,16 @@ var styles = {"toolbar":"toolbar-KHJR5","toolbar-button":"toolbar-button-Ye4h5",
|
|
|
3466
3466
|
|
|
3467
3467
|
const pcoUrl = pcoUrl$1;
|
|
3468
3468
|
|
|
3469
|
+
// The route rides in the iframe URL fragment (`…/topbar#conversations/abc`),
|
|
3470
|
+
// not the path, so updating it is a same-document navigation that doesn't
|
|
3471
|
+
// reload the iframe, but also lets the route survive a forced reload (e.g.
|
|
3472
|
+
// Turbo re-parenting the topbar).
|
|
3469
3473
|
function buildPicobotSrc(origin, path) {
|
|
3470
3474
|
const [rawPath, queryPart] = path.replace(/^\/+/, "").split("?", 2);
|
|
3471
3475
|
const safePath = rawPath.split("/").filter(segment => segment && segment !== "." && segment !== "..").join("/");
|
|
3472
|
-
const
|
|
3473
|
-
const
|
|
3474
|
-
return
|
|
3476
|
+
const fragment = queryPart !== undefined ? `${safePath}?${queryPart}` : safePath;
|
|
3477
|
+
const base = new URL("topbar", origin).toString();
|
|
3478
|
+
return fragment ? `${base}#${fragment}` : base;
|
|
3475
3479
|
}
|
|
3476
3480
|
|
|
3477
3481
|
const handleSearchSelect = (hit, indexName) => {
|
|
@@ -3639,13 +3643,10 @@ function HelpdeskComponent({
|
|
|
3639
3643
|
onMessage
|
|
3640
3644
|
}) {
|
|
3641
3645
|
const ref = React.useRef(null);
|
|
3642
|
-
|
|
3643
|
-
//
|
|
3644
|
-
//
|
|
3645
|
-
|
|
3646
|
-
// no leading slash or /topbar prefix—buildPicobotSrc adds those.
|
|
3647
|
-
const lastReportedPathRef = React.useRef(initialPath);
|
|
3648
|
-
const [loadedPath, setLoadedPath] = React.useState(initialPath);
|
|
3646
|
+
// Keep the fragment in sync in both directions—external opens (deeplink /
|
|
3647
|
+
// Contact support) and picobot's own NEW_ROUTE_RENDERED reports—so it
|
|
3648
|
+
// always reflects the live conversation. See buildPicobotSrc.
|
|
3649
|
+
const [loadedPath, setLoadedPath] = React.useState(iframePath || "");
|
|
3649
3650
|
React.useEffect(() => {
|
|
3650
3651
|
if (!onIframeChangePath && !onMessage) return undefined;
|
|
3651
3652
|
const handler = e => {
|
|
@@ -3655,7 +3656,7 @@ function HelpdeskComponent({
|
|
|
3655
3656
|
if (e.source !== ref.current.contentWindow) return;
|
|
3656
3657
|
if (((_a = e.data) === null || _a === void 0 ? void 0 : _a.type) === "NEW_ROUTE_RENDERED" && onIframeChangePath) {
|
|
3657
3658
|
const reportedPath = String((_b = e.data.payload) !== null && _b !== void 0 ? _b : "");
|
|
3658
|
-
|
|
3659
|
+
setLoadedPath(reportedPath);
|
|
3659
3660
|
onIframeChangePath(reportedPath);
|
|
3660
3661
|
}
|
|
3661
3662
|
if (onMessage) onMessage(e.data);
|
|
@@ -3664,9 +3665,7 @@ function HelpdeskComponent({
|
|
|
3664
3665
|
return () => window.removeEventListener("message", handler);
|
|
3665
3666
|
}, [onIframeChangePath, onMessage]);
|
|
3666
3667
|
React.useEffect(() => {
|
|
3667
|
-
|
|
3668
|
-
if (lastReportedPathRef.current === incomingPath) return;
|
|
3669
|
-
setLoadedPath(incomingPath);
|
|
3668
|
+
setLoadedPath(iframePath || "");
|
|
3670
3669
|
}, [iframePath]);
|
|
3671
3670
|
const iframeSrc = buildPicobotSrc(picobotOrigin, loadedPath);
|
|
3672
3671
|
return /*#__PURE__*/React.createElement("iframe", {
|
|
@@ -3721,7 +3720,8 @@ const Helpdesk = {
|
|
|
3721
3720
|
staticDotPath: "",
|
|
3722
3721
|
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"
|
|
3723
3722
|
},
|
|
3724
|
-
name: "Helpdesk"
|
|
3723
|
+
name: "Helpdesk",
|
|
3724
|
+
storageExemptPaths: ["email", "phone"]
|
|
3725
3725
|
};
|
|
3726
3726
|
|
|
3727
3727
|
const Eyebrow = ({
|
|
@@ -4652,6 +4652,13 @@ function isToolPathExemptFromStorage(toolName, path) {
|
|
|
4652
4652
|
const tool = toolsRouteMap[toolName];
|
|
4653
4653
|
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;
|
|
4654
4654
|
}
|
|
4655
|
+
function scrollToolDrawerToTop(toolName) {
|
|
4656
|
+
var _a;
|
|
4657
|
+
(_a = document.getElementById(`toolbarDrawer${toolName}`)) === null || _a === void 0 ? void 0 : _a.scrollTo({
|
|
4658
|
+
behavior: "smooth",
|
|
4659
|
+
top: 0
|
|
4660
|
+
});
|
|
4661
|
+
}
|
|
4655
4662
|
const TOOLS_MAP = {
|
|
4656
4663
|
Chat,
|
|
4657
4664
|
Helpdesk,
|
|
@@ -4721,17 +4728,21 @@ function Toolbar({
|
|
|
4721
4728
|
unsubscribe();
|
|
4722
4729
|
};
|
|
4723
4730
|
}, [open, clearRoute]);
|
|
4731
|
+
const openHelpdeskAtRoot = React.useCallback(() => {
|
|
4732
|
+
onChangeToolbarFragmentRoute(Helpdesk.name.toLowerCase(), "");
|
|
4733
|
+
scrollToolDrawerToTop(Helpdesk.name);
|
|
4734
|
+
}, [onChangeToolbarFragmentRoute]);
|
|
4724
4735
|
React.useEffect(() => {
|
|
4725
4736
|
window.topbar = window.topbar || {};
|
|
4726
4737
|
window.topbar.openProfile = () => handleToolOnClick(Profile);
|
|
4727
|
-
window.topbar.openHelpdesk =
|
|
4738
|
+
window.topbar.openHelpdesk = openHelpdeskAtRoot;
|
|
4728
4739
|
window.openHelpdesk = window.topbar.openHelpdesk; /* TODO: Remove when products have migrated to window.topbar.openHelpdesk */
|
|
4729
4740
|
return () => {
|
|
4730
4741
|
delete window.topbar.openProfile;
|
|
4731
4742
|
delete window.topbar.openHelpdesk;
|
|
4732
4743
|
delete window.openHelpdesk; /* TODO: Remove when products have migrated to window.topbar.openHelpdesk */
|
|
4733
4744
|
};
|
|
4734
|
-
}, [
|
|
4745
|
+
}, [Profile, openHelpdeskAtRoot]);
|
|
4735
4746
|
const loginSettingsUrl = getLoginProfilePath({
|
|
4736
4747
|
appName: appName.replace(/[\s-]/, ""),
|
|
4737
4748
|
env: env,
|
|
@@ -4813,12 +4824,8 @@ function Toolbar({
|
|
|
4813
4824
|
});
|
|
4814
4825
|
const TOOLS = [Notifications, Tasks, displayChatIcon && Chat].filter(Boolean);
|
|
4815
4826
|
const handleToolOnClick = tool => {
|
|
4816
|
-
var _a;
|
|
4817
4827
|
toggleDrawer(tool);
|
|
4818
|
-
(
|
|
4819
|
-
behavior: "smooth",
|
|
4820
|
-
top: 0
|
|
4821
|
-
});
|
|
4828
|
+
scrollToolDrawerToTop(tool.name);
|
|
4822
4829
|
};
|
|
4823
4830
|
const toolSpecificProps = {
|
|
4824
4831
|
Profile: {
|