@superblocksteam/library 2.0.123 → 2.0.124-next.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.
@@ -1,4 +1,4 @@
1
- import { _ as root_store_default, t as makeWrappedComponent, x as tracker } from "../jsx-wrapper-BaTggkUU.js";
1
+ import { _ as root_store_default, t as makeWrappedComponent, x as tracker } from "../jsx-wrapper-CWuebR52.js";
2
2
  import { SOURCE_ID_ATTRIBUTE } from "@superblocksteam/library-shared";
3
3
  import * as ReactJsxDevRuntime from "react/jsx-dev-runtime";
4
4
  //#region src/jsx-dev-runtime/jsx-dev-runtime.ts
@@ -1,4 +1,4 @@
1
- import { t as getTracer } from "./utils-BfE8-Afc.js";
1
+ import { t as getTracer } from "./utils-C-i9g4Qh.js";
2
2
  import { InputType, PropsCategory } from "@superblocksteam/library-shared/props";
3
3
  import { action, entries, isComputedProp, isObservableArray, isObservableMap, isObservableObject, makeAutoObservable, makeObservable, observable, observe, reaction, toJS, values } from "mobx";
4
4
  import { matchRoutes } from "react-router";
@@ -639,8 +639,13 @@ function isEmbeddedBySuperblocksFirstParty() {
639
639
  }
640
640
  const PARENT_REF = typeof window !== "undefined" && window !== window.parent ? window.parent : null;
641
641
  const SELF_REF = typeof window !== "undefined" ? window : null;
642
+ let capturedParentOrigin = null;
643
+ function getParentOrigin() {
644
+ return capturedParentOrigin;
645
+ }
642
646
  function parentMessageHandler(e) {
643
647
  if (e.source !== PARENT_REF && e.source !== SELF_REF) return;
648
+ if (capturedParentOrigin === null && e.origin) capturedParentOrigin = e.origin;
644
649
  const event = new SbIframeEventInternal(e.data.type, e.data);
645
650
  iframeMessageHandler.dispatchEvent(event);
646
651
  }
@@ -709,7 +714,7 @@ var DeployedParentBridge = class {
709
714
  });
710
715
  }
711
716
  connected() {}
712
- sendReady() {}
717
+ sendReady(_connectionStartTime) {}
713
718
  sendLoadError(_error) {}
714
719
  sendClearLoadError() {}
715
720
  sendAppFrameWillReload() {}
@@ -738,7 +743,7 @@ var DeployedParentBridge = class {
738
743
  payload: routeInfo
739
744
  });
740
745
  }
741
- socketError(_message) {}
746
+ socketError(_message, _connectionStartTime) {}
742
747
  aiGenerate(_prompt) {}
743
748
  addComponentToAiContext(_sourceId, _selectorId) {}
744
749
  toggleComponentInAiContext(_sourceId, _selectorId, _label) {}
@@ -807,10 +812,10 @@ var SuperblocksEditorBridge = class SuperblocksEditorBridge {
807
812
  this.messagesToSend.forEach((message) => this.queueMessage(message.payload, message.mergeOptions));
808
813
  this.messagesToSend = [];
809
814
  }
810
- sendReady() {
815
+ sendReady(connectionStartTime) {
811
816
  this.sendImmediate({
812
817
  type: "sb-ready",
813
- payload: void 0
818
+ payload: { connectionStartTime }
814
819
  }, true);
815
820
  }
816
821
  sendLoadError(error) {
@@ -1078,10 +1083,13 @@ var SuperblocksEditorBridge = class SuperblocksEditorBridge {
1078
1083
  }
1079
1084
  });
1080
1085
  }
1081
- socketError(message) {
1086
+ socketError(message, connectionStartTime) {
1082
1087
  this.sendImmediate({
1083
1088
  type: "socket/error",
1084
- payload: { message }
1089
+ payload: {
1090
+ message,
1091
+ connectionStartTime
1092
+ }
1085
1093
  });
1086
1094
  }
1087
1095
  sendRuntimeError(data, forceSend = false) {
@@ -2171,6 +2179,12 @@ function withTrailingSlash(baseUrl) {
2171
2179
  //#endregion
2172
2180
  //#region src/lib/internal-details/lib/features/api-store.ts
2173
2181
  const ENVIRONMENT_ALL = "*";
2182
+ function getFetchByPathViewMode(appMode, editMode) {
2183
+ if (appMode === AppMode.PREVIEW) return OrchestratorViewMode.PREVIEW;
2184
+ if (appMode === AppMode.PUBLISHED) return OrchestratorViewMode.DEPLOYED;
2185
+ if (appMode === AppMode.EDIT) return OrchestratorViewMode.EDIT;
2186
+ return editMode ? OrchestratorViewMode.EDIT : OrchestratorViewMode.DEPLOYED;
2187
+ }
2174
2188
  /**
2175
2189
  * Local equivalent of the parent's `isProfileSupported` utility.
2176
2190
  * Determines whether an agent supports a given profile based on
@@ -2441,8 +2455,7 @@ var ApiManager = class {
2441
2455
  const abortController = new AbortController();
2442
2456
  (this.runningApiControllers[apiName] ??= /* @__PURE__ */ new Set()).add(abortController);
2443
2457
  const editMode = isEditMode();
2444
- const appMode = getAppMode();
2445
- const orchestratorViewMode = appMode === AppMode.PREVIEW ? OrchestratorViewMode.PREVIEW : appMode === AppMode.PUBLISHED ? OrchestratorViewMode.DEPLOYED : OrchestratorViewMode.EDIT;
2458
+ const orchestratorViewMode = getFetchByPathViewMode(getAppMode(), editMode);
2446
2459
  const isStream = editMode ? true : false;
2447
2460
  const authResult = await new Promise((resolve) => {
2448
2461
  const callbackId = addNewPromise(resolve);
@@ -4166,6 +4179,6 @@ const useJSXContext = () => {
4166
4179
  return React.useContext(JSXContext);
4167
4180
  };
4168
4181
  //#endregion
4169
- export { useSuperblocksProfiles as A, isEditMode as B, rejectById as C, useSuperblocksContext as D, getAppMode as E, colors as F, createPropertiesPanelDefinition as G, Prop as H, editorBridge as I, getEditStore as K, iframeMessageHandler as L, embedStore as M, generateId as N, useSuperblocksDataTags as O, sendNotification as P, isEmbeddedBySuperblocksFirstParty as R, addNewPromise as S, SuperblocksContextProvider as T, PropsCategory as U, createManagedPropsList as V, Section as W, root_store_default as _, FixWithClarkButton as a, getContextFromTraceHeaders as b, ErrorContent as c, ErrorMessage as d, ErrorStack as f, StyledClarkIcon as g, SecondaryButton as h, getWidgetRectAnchorName as i, useSuperblocksUser as j, useSuperblocksGroups as k, ErrorDetails as l, ErrorTitle as m, useJSXContext as n, ActionsContainer as o, ErrorSummary as p, getWidgetAnchorName as r, ErrorContainer as s, makeWrappedComponent as t, ErrorIconContainer as u, startEditorSync as v, resolveById as w, tracker as x, createIframeSpan as y, sendMessageImmediately as z };
4182
+ export { useSuperblocksProfiles as A, sendMessageImmediately as B, rejectById as C, useSuperblocksContext as D, getAppMode as E, colors as F, Section as G, createManagedPropsList as H, editorBridge as I, createPropertiesPanelDefinition as K, getParentOrigin as L, embedStore as M, generateId as N, useSuperblocksDataTags as O, sendNotification as P, iframeMessageHandler as R, addNewPromise as S, SuperblocksContextProvider as T, Prop as U, isEditMode as V, PropsCategory as W, root_store_default as _, FixWithClarkButton as a, getContextFromTraceHeaders as b, ErrorContent as c, ErrorMessage as d, ErrorStack as f, StyledClarkIcon as g, SecondaryButton as h, getWidgetRectAnchorName as i, useSuperblocksUser as j, useSuperblocksGroups as k, ErrorDetails as l, ErrorTitle as m, useJSXContext as n, ActionsContainer as o, ErrorSummary as p, getEditStore as q, getWidgetAnchorName as r, ErrorContainer as s, makeWrappedComponent as t, ErrorIconContainer as u, startEditorSync as v, resolveById as w, tracker as x, createIframeSpan as y, isEmbeddedBySuperblocksFirstParty as z };
4170
4183
 
4171
- //# sourceMappingURL=jsx-wrapper-BaTggkUU.js.map
4184
+ //# sourceMappingURL=jsx-wrapper-CWuebR52.js.map