@superblocksteam/library 2.0.86 → 2.0.87-next.0
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-BxcW9P1H.js → jsx-wrapper-DL2O6Y1G.js} +43 -7
- package/dist/jsx-wrapper-DL2O6Y1G.js.map +1 -0
- package/dist/lib/index.d.ts +46 -6
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/index.js +62 -9
- package/dist/lib/index.js.map +1 -1
- package/package.json +8 -8
- package/dist/jsx-wrapper-BxcW9P1H.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { S as api_hmr_tracker_default, _ as root_store_default, t as makeWrappedComponent } from "../jsx-wrapper-
|
|
1
|
+
import { S as api_hmr_tracker_default, _ as root_store_default, t as makeWrappedComponent } from "../jsx-wrapper-DL2O6Y1G.js";
|
|
2
2
|
import { SOURCE_ID_ATTRIBUTE } from "@superblocksteam/library-shared";
|
|
3
3
|
import * as ReactJsxDevRuntime from "react/jsx-dev-runtime";
|
|
4
4
|
|
|
@@ -2122,8 +2122,31 @@ function withTrailingSlash(baseUrl) {
|
|
|
2122
2122
|
|
|
2123
2123
|
//#endregion
|
|
2124
2124
|
//#region src/lib/internal-details/lib/features/api-store.ts
|
|
2125
|
+
const ENVIRONMENT_ALL = "*";
|
|
2126
|
+
/**
|
|
2127
|
+
* Local equivalent of the parent's `isProfileSupported` utility.
|
|
2128
|
+
* Determines whether an agent supports a given profile based on
|
|
2129
|
+
* its tags and legacy environment field.
|
|
2130
|
+
*/
|
|
2131
|
+
function isAgentProfileSupported(agent, targetEnvironment) {
|
|
2132
|
+
const supportedProfiles = agent.tags?.profile ?? [];
|
|
2133
|
+
if (supportedProfiles.includes(ENVIRONMENT_ALL)) return true;
|
|
2134
|
+
if (supportedProfiles.length === 0) return agent.environment === ENVIRONMENT_ALL || agent.environment === targetEnvironment;
|
|
2135
|
+
return supportedProfiles.includes(targetEnvironment);
|
|
2136
|
+
}
|
|
2125
2137
|
var ApiManager = class {
|
|
2138
|
+
/**
|
|
2139
|
+
* Pre-filtered agent URLs for the current profile, sent by the parent.
|
|
2140
|
+
* Used as fallback for cloud orgs where URLs come from
|
|
2141
|
+
* SUPERBLOCKS_UI_AGENT_BASE_URL rather than agent metadata.
|
|
2142
|
+
*/
|
|
2126
2143
|
_agentUrls = [];
|
|
2144
|
+
/**
|
|
2145
|
+
* Full on-premise agent metadata (all profiles) from the parent,
|
|
2146
|
+
* enabling local profile-based filtering without a postMessage
|
|
2147
|
+
* round-trip. Empty for cloud orgs.
|
|
2148
|
+
*/
|
|
2149
|
+
_agents = [];
|
|
2127
2150
|
token;
|
|
2128
2151
|
accessToken;
|
|
2129
2152
|
runningApiControllers = {};
|
|
@@ -2140,6 +2163,9 @@ var ApiManager = class {
|
|
|
2140
2163
|
set agentUrls(urls) {
|
|
2141
2164
|
this._agentUrls = urls;
|
|
2142
2165
|
}
|
|
2166
|
+
set agents(agents) {
|
|
2167
|
+
this._agents = agents;
|
|
2168
|
+
}
|
|
2143
2169
|
setTokens(token, accessToken) {
|
|
2144
2170
|
this.token = token;
|
|
2145
2171
|
this.accessToken = accessToken;
|
|
@@ -2148,12 +2174,22 @@ var ApiManager = class {
|
|
|
2148
2174
|
return !!this.token && !!this.accessToken;
|
|
2149
2175
|
}
|
|
2150
2176
|
/**
|
|
2177
|
+
* Get agent URLs for the given profile by filtering locally stored
|
|
2178
|
+
* agent metadata. Falls back to the pre-filtered `_agentUrls` when
|
|
2179
|
+
* no full agent metadata is available (cloud orgs or legacy parents).
|
|
2180
|
+
*/
|
|
2181
|
+
getAgentUrlsForProfile(profileKey) {
|
|
2182
|
+
if (this._agents.length > 0) return this._agents.filter((agent) => isAgentProfileSupported(agent, profileKey)).map((agent) => agent.url);
|
|
2183
|
+
return this._agentUrls;
|
|
2184
|
+
}
|
|
2185
|
+
/**
|
|
2151
2186
|
* Selects a random agent URL from the available agents and returns it normalized
|
|
2152
2187
|
* (with trailing slash) to ensure proper URL path joining.
|
|
2153
2188
|
*/
|
|
2154
|
-
getRandomAgentBaseUrl() {
|
|
2155
|
-
|
|
2156
|
-
|
|
2189
|
+
getRandomAgentBaseUrl(profileKey) {
|
|
2190
|
+
const urls = this.getAgentUrlsForProfile(profileKey);
|
|
2191
|
+
if (!urls.length) return;
|
|
2192
|
+
const agentUrl = urls[Math.floor(Math.random() * urls.length)];
|
|
2157
2193
|
return withTrailingSlash(agentUrl);
|
|
2158
2194
|
}
|
|
2159
2195
|
async awaitInitApiIfNeeded() {
|
|
@@ -2292,7 +2328,9 @@ var ApiManager = class {
|
|
|
2292
2328
|
error: "No application ID was found"
|
|
2293
2329
|
};
|
|
2294
2330
|
}
|
|
2295
|
-
|
|
2331
|
+
const profileKey = context$1.profiles?.selected?.key ?? "staging";
|
|
2332
|
+
const agentBaseUrl = this.getRandomAgentBaseUrl(profileKey);
|
|
2333
|
+
if (!agentBaseUrl) {
|
|
2296
2334
|
sendNotification({
|
|
2297
2335
|
message: "No active agent found",
|
|
2298
2336
|
type: "error"
|
|
@@ -2307,9 +2345,7 @@ var ApiManager = class {
|
|
|
2307
2345
|
error: "No active agent found"
|
|
2308
2346
|
};
|
|
2309
2347
|
}
|
|
2310
|
-
const agentBaseUrl = this.getRandomAgentBaseUrl();
|
|
2311
2348
|
const orchestratorUrl = new URL("v2/execute", agentBaseUrl).href;
|
|
2312
|
-
const profileKey = context$1.profiles?.selected?.key ?? "staging";
|
|
2313
2349
|
const profileId = context$1.profiles?.selected?.id ?? "";
|
|
2314
2350
|
const events = [];
|
|
2315
2351
|
await this.rootStore.editStore?.operationManager.ensureFilesSynced();
|
|
@@ -3668,4 +3704,4 @@ const useJSXContext = () => {
|
|
|
3668
3704
|
|
|
3669
3705
|
//#endregion
|
|
3670
3706
|
export { useSuperblocksProfiles as A, PropsCategory as B, addNewPromise as C, getAppMode as D, SuperblocksContextProvider as E, iframeMessageHandler as F, createPropertiesPanelDefinition as H, isEmbeddedBySuperblocksFirstParty as I, isEditMode as L, sendNotification as M, colors as N, useSuperblocksContext as O, editorBridge as P, createManagedPropsList as R, api_hmr_tracker_default as S, resolveById as T, getEditStore as U, Section as V, root_store_default as _, FixWithClarkButton as a, createIframeSpan 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, rejectById as w, getContextFromTraceHeaders as x, generateId as y, Prop as z };
|
|
3671
|
-
//# sourceMappingURL=jsx-wrapper-
|
|
3707
|
+
//# sourceMappingURL=jsx-wrapper-DL2O6Y1G.js.map
|