@planningcenter/topbar 12.4.0-rc.2 → 12.4.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.
- package/dist/topbar.js +45 -4
- package/dist/topbar.js.map +1 -1
- package/dist/topbar.modern.js +45 -4
- package/dist/topbar.modern.js.map +1 -1
- package/dist/topbar.module.js +45 -4
- package/dist/topbar.module.js.map +1 -1
- package/dist/topbar.umd.js +45 -4
- package/dist/topbar.umd.js.map +1 -1
- package/dist/types/index.d.ts +5 -1
- package/package.json +2 -3
package/dist/topbar.js
CHANGED
|
@@ -34684,12 +34684,15 @@ function createPicobotIframe(picobotOrigin, {
|
|
|
34684
34684
|
setLoadedPath(iframePath || "");
|
|
34685
34685
|
}, [iframePath]);
|
|
34686
34686
|
// A one-way channel for sending messages to picobot. Topbar just
|
|
34687
|
-
// forwards the envelope to the iframe
|
|
34688
|
-
//
|
|
34687
|
+
// forwards the envelope to the iframe—the consumer decides what to send
|
|
34688
|
+
// and when. The one exception is PANE_VISIBLE: Safari ignores focus()
|
|
34689
|
+
// from inside a cross-origin iframe, so the host has to focus the iframe
|
|
34690
|
+
// before picobot can focus its composer.
|
|
34689
34691
|
React.useImperativeHandle(ref, () => ({
|
|
34690
34692
|
postMessage(message) {
|
|
34691
|
-
var _a, _b;
|
|
34692
|
-
(
|
|
34693
|
+
var _a, _b, _c;
|
|
34694
|
+
if (message.type === "PANE_VISIBLE") (_a = iframeRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
34695
|
+
(_c = (_b = iframeRef.current) === null || _b === void 0 ? void 0 : _b.contentWindow) === null || _c === void 0 ? void 0 : _c.postMessage(message, picobotOrigin);
|
|
34693
34696
|
}
|
|
34694
34697
|
}), []);
|
|
34695
34698
|
const iframeSrc = buildPicobotSrc(picobotOrigin, loadedPath, {
|
|
@@ -35432,6 +35435,7 @@ function PicobotComponent({
|
|
|
35432
35435
|
closeDrawer,
|
|
35433
35436
|
currentPath,
|
|
35434
35437
|
env,
|
|
35438
|
+
isOpen,
|
|
35435
35439
|
onChangePath,
|
|
35436
35440
|
openTool,
|
|
35437
35441
|
pending
|
|
@@ -35476,6 +35480,17 @@ function PicobotComponent({
|
|
|
35476
35480
|
}
|
|
35477
35481
|
clearPending();
|
|
35478
35482
|
}, [pending, isPicobotReady, clearPending]);
|
|
35483
|
+
// The drawer keeps the iframe mounted while it's closed, so picobot's
|
|
35484
|
+
// autofocus is spent by the time the panel reopens. READY gates the signal
|
|
35485
|
+
// because picobot has no listener before it.
|
|
35486
|
+
React.useEffect(function tellPicobotThePanelIsVisible() {
|
|
35487
|
+
var _a;
|
|
35488
|
+
if (isOpen && isPicobotReady) {
|
|
35489
|
+
(_a = picobotRef.current) === null || _a === void 0 ? void 0 : _a.postMessage({
|
|
35490
|
+
type: "PANE_VISIBLE"
|
|
35491
|
+
});
|
|
35492
|
+
}
|
|
35493
|
+
}, [isOpen, isPicobotReady]);
|
|
35479
35494
|
const [iframeErrored, setIframeErrored] = React.useState(false);
|
|
35480
35495
|
const [mountKey, setMountKey] = React.useState(0);
|
|
35481
35496
|
const handleRetry = React.useCallback(() => {
|
|
@@ -35992,6 +36007,11 @@ const Profile = {
|
|
|
35992
36007
|
};
|
|
35993
36008
|
|
|
35994
36009
|
const DURATION = 100;
|
|
36010
|
+
const TOOLBAR_DRAWER_CHANGE_EVENT = "topbar:toolbar-drawer-change";
|
|
36011
|
+
const CLOSED_TOOLBAR_DRAWER = {
|
|
36012
|
+
open: false,
|
|
36013
|
+
tool: null
|
|
36014
|
+
};
|
|
35995
36015
|
// Exempt paths match regardless of query, so `email?conversationId=…` is
|
|
35996
36016
|
// exempt along with `email`.
|
|
35997
36017
|
function isToolPathExemptFromStorage(toolName, path) {
|
|
@@ -36105,6 +36125,27 @@ function Toolbar({
|
|
|
36105
36125
|
delete window.openHelpdesk; /* TODO: Remove when products have migrated to window.topbar.openHelpdesk */
|
|
36106
36126
|
};
|
|
36107
36127
|
}, [Profile, openHelpdeskAtRoot]);
|
|
36128
|
+
const toolbarDrawerTool = open && currentContent ? currentContent.name.toLowerCase() : null;
|
|
36129
|
+
const lastToolbarDrawer = React.useRef(CLOSED_TOOLBAR_DRAWER);
|
|
36130
|
+
React.useEffect(() => {
|
|
36131
|
+
const toolbarDrawer = {
|
|
36132
|
+
open,
|
|
36133
|
+
tool: toolbarDrawerTool
|
|
36134
|
+
};
|
|
36135
|
+
window.topbar = window.topbar || {};
|
|
36136
|
+
window.topbar.toolbarDrawer = toolbarDrawer;
|
|
36137
|
+
const last = lastToolbarDrawer.current;
|
|
36138
|
+
if (last.open !== toolbarDrawer.open || last.tool !== toolbarDrawer.tool) {
|
|
36139
|
+
lastToolbarDrawer.current = toolbarDrawer;
|
|
36140
|
+
window.dispatchEvent(new CustomEvent(TOOLBAR_DRAWER_CHANGE_EVENT, {
|
|
36141
|
+
detail: toolbarDrawer
|
|
36142
|
+
}));
|
|
36143
|
+
}
|
|
36144
|
+
return () => {
|
|
36145
|
+
var _a;
|
|
36146
|
+
(_a = window.topbar) === null || _a === void 0 ? true : delete _a.toolbarDrawer;
|
|
36147
|
+
};
|
|
36148
|
+
}, [open, toolbarDrawerTool]);
|
|
36108
36149
|
const loginSettingsUrl = getLoginProfilePath({
|
|
36109
36150
|
appName: appName.replace(/[\s-]/, ""),
|
|
36110
36151
|
env: env,
|