@planningcenter/topbar 12.6.0-qa-1010.0 → 12.6.0-qa-1010.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 CHANGED
@@ -8324,15 +8324,12 @@ const ToolIframe = /*#__PURE__*/React.forwardRef(function ToolIframe({
8324
8324
  setLoadedPath(currentPath || "");
8325
8325
  }, [currentPath]);
8326
8326
  React.useImperativeHandle(ref, () => ({
8327
- postMessage(message, transfer) {
8327
+ postMessage(message) {
8328
8328
  var _a, _b, _c;
8329
8329
  // Safari ignores focus() from inside a cross-origin iframe, so the
8330
8330
  // host focuses the iframe before the page focuses its own input.
8331
8331
  if (message.type === "PANE_VISIBLE") (_a = iframeRef.current) === null || _a === void 0 ? void 0 : _a.focus();
8332
- (_c = (_b = iframeRef.current) === null || _b === void 0 ? void 0 : _b.contentWindow) === null || _c === void 0 ? void 0 : _c.postMessage(message, {
8333
- targetOrigin: origin,
8334
- transfer
8335
- });
8332
+ (_c = (_b = iframeRef.current) === null || _b === void 0 ? void 0 : _b.contentWindow) === null || _c === void 0 ? void 0 : _c.postMessage(message, origin);
8336
8333
  }
8337
8334
  }), [origin]);
8338
8335
  return /*#__PURE__*/React.createElement("iframe", {
@@ -8377,8 +8374,7 @@ function trackPendo(payload) {
8377
8374
  * ticketExternalId? }, TRACK_PENDO { event, properties }.
8378
8375
  *
8379
8376
  * Topbar → page: PANE_VISIBLE, PANE_HIDDEN, HOST_CONTEXT_CHANGED { appName,
8380
- * host, pathname, pcoMeta, search }, and, when `onReceivePort` is given,
8381
- * CONNECT_PORT with a MessagePort after each READY.
8377
+ * host, pathname, pcoMeta, search }.
8382
8378
  */
8383
8379
  function IframeTool({
8384
8380
  appName,
@@ -8390,7 +8386,6 @@ function IframeTool({
8390
8386
  onChangePath,
8391
8387
  openDrawer,
8392
8388
  openPicobot,
8393
- onReceivePort,
8394
8389
  openTool
8395
8390
  }) {
8396
8391
  const pcoMeta = usePcoMeta();
@@ -8432,23 +8427,10 @@ function IframeTool({
8432
8427
  type: isOpen ? "PANE_VISIBLE" : "PANE_HIDDEN"
8433
8428
  });
8434
8429
  }, [isOpen, isReady]);
8435
- // A reloaded page has lost its end of the last channel, so every READY
8436
- // gets a fresh one.
8437
- const connectPort = React.useCallback(() => {
8438
- var _a;
8439
- if (!onReceivePort) return;
8440
- const channel = new MessageChannel();
8441
- (_a = iframeRef.current) === null || _a === void 0 ? void 0 : _a.postMessage({
8442
- type: "CONNECT_PORT"
8443
- }, [channel.port2]);
8444
- channel.port1.start();
8445
- onReceivePort(channel.port1);
8446
- }, [onReceivePort]);
8447
8430
  const handleMessage = React.useCallback(message => {
8448
8431
  var _a;
8449
8432
  switch (message.type) {
8450
8433
  case "READY":
8451
- connectPort();
8452
8434
  return setIsReady(true);
8453
8435
  case "CLOSE_DRAWER":
8454
8436
  return closeDrawer();
@@ -8472,7 +8454,7 @@ function IframeTool({
8472
8454
  console.warn(`topbar: ${config.title} iframe failed to load`);
8473
8455
  return setErrored(true);
8474
8456
  }
8475
- }, [closeDrawer, config.title, connectPort, openDrawer, openPicobot, openTool]);
8457
+ }, [closeDrawer, config.title, openDrawer, openPicobot, openTool]);
8476
8458
  const handleRetry = React.useCallback(() => {
8477
8459
  setErrored(false);
8478
8460
  setIsReady(false);
@@ -10049,12 +10031,11 @@ const TASKS_IFRAME_CONFIG = {
10049
10031
  function TasksComponent(props) {
10050
10032
  return props.mountLegacy === false ? (
10051
10033
  /*#__PURE__*/
10052
- // Home's page answers the same messages over this port that the add-on's
10053
- // worker does, so products keep using onReceiveTasksWorker.
10034
+ // The iframe and Home's own pages share Home's origin and talk to each
10035
+ // other directly, so there's no worker to hand over.
10054
10036
  React.createElement(IframeTool, {
10055
10037
  ...props,
10056
- config: TASKS_IFRAME_CONFIG,
10057
- onReceivePort: props.onReceiveWorker
10038
+ config: TASKS_IFRAME_CONFIG
10058
10039
  })) : (/*#__PURE__*/React.createElement(TasksAddOn, {
10059
10040
  ...props
10060
10041
  }));