@superblocksteam/library 2.0.116-next.1 → 2.0.116-next.2
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/jsx-dev-runtime/index.js +1 -1
- package/dist/{jsx-wrapper-C8Hy0LhA.js → jsx-wrapper-B1B_ySZF.js} +86 -29
- package/dist/jsx-wrapper-B1B_ySZF.js.map +1 -0
- package/dist/lib/index.d.ts +19 -0
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/index.js +1 -38
- package/dist/lib/index.js.map +1 -1
- package/package.json +4 -4
- package/dist/jsx-wrapper-C8Hy0LhA.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as root_store_default, t as makeWrappedComponent, x as api_hmr_tracker_default } from "../jsx-wrapper-
|
|
1
|
+
import { _ as root_store_default, t as makeWrappedComponent, x as api_hmr_tracker_default } from "../jsx-wrapper-B1B_ySZF.js";
|
|
2
2
|
import { SOURCE_ID_ATTRIBUTE } from "@superblocksteam/library-shared";
|
|
3
3
|
import * as ReactJsxDevRuntime from "react/jsx-dev-runtime";
|
|
4
4
|
|
|
@@ -1605,6 +1605,59 @@ const generateId = () => {
|
|
|
1605
1605
|
return Math.random().toString(36).substring(2, 15);
|
|
1606
1606
|
};
|
|
1607
1607
|
|
|
1608
|
+
//#endregion
|
|
1609
|
+
//#region src/lib/internal-details/embed-store.ts
|
|
1610
|
+
/**
|
|
1611
|
+
* Store for managing embed properties and events.
|
|
1612
|
+
* Used when the library is embedded in an external application (third-party embedding).
|
|
1613
|
+
*
|
|
1614
|
+
* Properties can be set by the parent window via postMessage, and events can be
|
|
1615
|
+
* emitted back to the parent window.
|
|
1616
|
+
*/
|
|
1617
|
+
var EmbedStore = class {
|
|
1618
|
+
properties = {};
|
|
1619
|
+
constructor() {
|
|
1620
|
+
makeAutoObservable(this);
|
|
1621
|
+
}
|
|
1622
|
+
/**
|
|
1623
|
+
* Update the embed properties. Called when the parent window sends updated properties.
|
|
1624
|
+
*/
|
|
1625
|
+
setProperties(properties) {
|
|
1626
|
+
this.properties = properties;
|
|
1627
|
+
}
|
|
1628
|
+
/**
|
|
1629
|
+
* Emit an event to the parent window.
|
|
1630
|
+
* The parent can listen for these events using window.addEventListener("message", ...).
|
|
1631
|
+
*/
|
|
1632
|
+
emitEvent(eventName, payload = {}) {
|
|
1633
|
+
if (typeof window === "undefined" || window.parent === window) return;
|
|
1634
|
+
window.parent.postMessage({
|
|
1635
|
+
type: "embed-emit-event",
|
|
1636
|
+
payload: {
|
|
1637
|
+
eventName,
|
|
1638
|
+
payload
|
|
1639
|
+
}
|
|
1640
|
+
}, "*");
|
|
1641
|
+
}
|
|
1642
|
+
/**
|
|
1643
|
+
* Typed helper for the platform-reserved
|
|
1644
|
+
* `superblocks:integration-auth-error` event. Emitted when an SDK API
|
|
1645
|
+
* execution fails the integration-auth gate (either reactively from a
|
|
1646
|
+
* 401/403 response or proactively from the embed shell). Hosts subscribe
|
|
1647
|
+
* via the embed SDK's `onEvent` and render their own connect/retry UX.
|
|
1648
|
+
*
|
|
1649
|
+
* `status` is the HTTP status that triggered the emit (401 or 403 for
|
|
1650
|
+
* reactive emits; the embed shell uses 401 for its proactive emit).
|
|
1651
|
+
* `integrationIds` are scoped to the integrations the host should drive
|
|
1652
|
+
* reauth for, so a host with multiple integrations can target the right
|
|
1653
|
+
* one.
|
|
1654
|
+
*/
|
|
1655
|
+
emitIntegrationAuthError(payload) {
|
|
1656
|
+
this.emitEvent("superblocks:integration-auth-error", payload);
|
|
1657
|
+
}
|
|
1658
|
+
};
|
|
1659
|
+
const embedStore = new EmbedStore();
|
|
1660
|
+
|
|
1608
1661
|
//#endregion
|
|
1609
1662
|
//#region src/lib/internal-details/scope/types.ts
|
|
1610
1663
|
const AppMode = {
|
|
@@ -2712,33 +2765,31 @@ var ApiManager = class {
|
|
|
2712
2765
|
}
|
|
2713
2766
|
if (!editMode$1 && commitId) body.commitId = commitId;
|
|
2714
2767
|
const integrationIds = (this.rootStore.getApiIntegrations(apiName) ?? []).map((integration) => integration.id);
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
const
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
|
|
2721
|
-
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
|
|
2725
|
-
|
|
2726
|
-
|
|
2727
|
-
|
|
2728
|
-
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
|
|
2734
|
-
|
|
2735
|
-
|
|
2736
|
-
|
|
2737
|
-
|
|
2738
|
-
|
|
2739
|
-
|
|
2740
|
-
};
|
|
2741
|
-
}
|
|
2768
|
+
const authCheckT0 = performance.now();
|
|
2769
|
+
const authResult = await new Promise((resolve) => {
|
|
2770
|
+
const callbackId = addNewPromise(resolve);
|
|
2771
|
+
window.parent.postMessage({
|
|
2772
|
+
type: "authenticate-api-request",
|
|
2773
|
+
payload: {
|
|
2774
|
+
apiId: apiName,
|
|
2775
|
+
callbackId,
|
|
2776
|
+
integrationIds
|
|
2777
|
+
}
|
|
2778
|
+
}, "*");
|
|
2779
|
+
});
|
|
2780
|
+
authCheckMs = Math.round(performance.now() - authCheckT0);
|
|
2781
|
+
const authData = authResult;
|
|
2782
|
+
if (authData?.tokens?.token && authData?.tokens?.accessToken) this.setTokens(authData.tokens.token, authData.tokens.accessToken);
|
|
2783
|
+
if (authData?.errors?.length) {
|
|
2784
|
+
console.warn("[api-store] SDK API authentication failed", apiName, authData.errors);
|
|
2785
|
+
return {
|
|
2786
|
+
success: false,
|
|
2787
|
+
error: {
|
|
2788
|
+
code: "AUTH_ERROR",
|
|
2789
|
+
message: authData.errors.map((e) => e.message).join("; ")
|
|
2790
|
+
},
|
|
2791
|
+
timingBreakdown: buildTimingBreakdown()
|
|
2792
|
+
};
|
|
2742
2793
|
}
|
|
2743
2794
|
const fetchStartMs = Date.now();
|
|
2744
2795
|
const fetchPerfT0 = performance.now();
|
|
@@ -2764,6 +2815,12 @@ var ApiManager = class {
|
|
|
2764
2815
|
} catch {
|
|
2765
2816
|
message = text || `HTTP ${response.status}`;
|
|
2766
2817
|
}
|
|
2818
|
+
if ((response.status === 401 || response.status === 403) && integrationIds.length > 0) embedStore.emitIntegrationAuthError({
|
|
2819
|
+
apiId: apiName,
|
|
2820
|
+
integrationIds,
|
|
2821
|
+
status: response.status,
|
|
2822
|
+
message
|
|
2823
|
+
});
|
|
2767
2824
|
return {
|
|
2768
2825
|
success: false,
|
|
2769
2826
|
error: {
|
|
@@ -4183,5 +4240,5 @@ const useJSXContext = () => {
|
|
|
4183
4240
|
};
|
|
4184
4241
|
|
|
4185
4242
|
//#endregion
|
|
4186
|
-
export { useSuperblocksProfiles as A,
|
|
4187
|
-
//# sourceMappingURL=jsx-wrapper-
|
|
4243
|
+
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, api_hmr_tracker_default as x, createIframeSpan as y, sendMessageImmediately as z };
|
|
4244
|
+
//# sourceMappingURL=jsx-wrapper-B1B_ySZF.js.map
|