@superblocksteam/library 2.0.11-next.8 → 2.0.11
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/{allPaths-myr92AsW.js → allPaths-DGMrcGYt.js} +2 -2
- package/dist/{allPaths-myr92AsW.js.map → allPaths-DGMrcGYt.js.map} +1 -1
- package/dist/{allPaths-Y4YGXSmF.js → allPaths-nl-QZWn1.js} +2 -2
- package/dist/{allPaths-Y4YGXSmF.js.map → allPaths-nl-QZWn1.js.map} +1 -1
- package/dist/{allPathsLoader-DLbEQFY1.js → allPathsLoader-BIuTbNcY.js} +3 -3
- package/dist/{allPathsLoader-DLbEQFY1.js.map → allPathsLoader-BIuTbNcY.js.map} +1 -1
- package/dist/{allPathsLoader-xuZ2GzGt.js → allPathsLoader-Tf9x8dtV.js} +3 -3
- package/dist/{allPathsLoader-xuZ2GzGt.js.map → allPathsLoader-Tf9x8dtV.js.map} +1 -1
- package/dist/{devtools-consolidated-CAMIuL-C.js → devtools-consolidated-Brbj1JeD.js} +2 -2
- package/dist/{devtools-consolidated-CAMIuL-C.js.map → devtools-consolidated-Brbj1JeD.js.map} +1 -1
- package/dist/{index-C4OthB64.js → index-CCewmzC_.js} +302 -55
- package/dist/{index-C4OthB64.js.map → index-CCewmzC_.js.map} +1 -1
- package/dist/index.js +2 -2
- package/dist/{splitPathsBySizeLoader-Ufjcf3C9.js → splitPathsBySizeLoader-BM6L8m2i.js} +2 -2
- package/dist/{splitPathsBySizeLoader-Ufjcf3C9.js.map → splitPathsBySizeLoader-BM6L8m2i.js.map} +1 -1
- package/dist/{splitPathsBySizeLoader-CCK4w8Rs.js → splitPathsBySizeLoader-C3MBiqmb.js} +2 -2
- package/dist/{splitPathsBySizeLoader-CCK4w8Rs.js.map → splitPathsBySizeLoader-C3MBiqmb.js.map} +1 -1
- package/dist-types/edit-mode/base-editor-bridge.d.ts +54 -0
- package/dist-types/edit-mode/features/runtime-entities-manager.d.ts +22 -22
- package/dist-types/edit-mode/noop-editor-bridge.d.ts +1 -0
- package/dist-types/edit-mode/superblocks-editor-bridge.d.ts +4 -3
- package/dist-types/lib/internal-details/app-wrappers.d.ts +5 -0
- package/dist-types/lib/internal-details/is-edit-mode.d.ts +1 -0
- package/dist-types/lib/internal-details/lib/features/api-store.d.ts +1 -1
- package/dist-types/lib/internal-details/lib/features/component-registry.d.ts +8 -0
- package/dist-types/lib/internal-details/lib/types.d.ts +1 -6
- package/dist-types/lib/internal-details/sb-wrapper.d.ts +45 -2
- package/dist-types/lib/internal-details/sb-wrapper.test.d.ts +1 -0
- package/dist-types/lib/user-facing/components/button/index.d.ts +41 -1
- package/dist-types/lib/user-facing/components/checkbox/index.d.ts +47 -1
- package/dist-types/lib/user-facing/components/column/index.d.ts +30 -1
- package/dist-types/lib/user-facing/components/container/index.d.ts +32 -1
- package/dist-types/lib/user-facing/components/custom/index.d.ts +1 -2
- package/dist-types/lib/user-facing/components/custom/register-custom-component.d.ts +1 -1
- package/dist-types/lib/user-facing/components/date-picker/index.d.ts +71 -2
- package/dist-types/lib/user-facing/components/dropdown/index.d.ts +75 -2
- package/dist-types/lib/user-facing/components/icon/index.d.ts +24 -1
- package/dist-types/lib/user-facing/components/image/index.d.ts +33 -1
- package/dist-types/lib/user-facing/components/input/editor-template.d.ts +3 -0
- package/dist-types/lib/user-facing/components/input/index.d.ts +94 -1
- package/dist-types/lib/user-facing/components/modal/index.d.ts +39 -1
- package/dist-types/lib/user-facing/components/page/index.d.ts +19 -1
- package/dist-types/lib/user-facing/components/section/index.d.ts +24 -1
- package/dist-types/lib/user-facing/components/slideout/index.d.ts +39 -1
- package/dist-types/lib/user-facing/components/switch/index.d.ts +48 -1
- package/dist-types/lib/user-facing/components/table/index.d.ts +361 -1
- package/dist-types/lib/user-facing/components/text/index.d.ts +56 -1
- package/package.json +2 -2
|
@@ -54059,6 +54059,17 @@ function deserializeErrors2(errors2) {
|
|
|
54059
54059
|
}
|
|
54060
54060
|
return serialized;
|
|
54061
54061
|
}
|
|
54062
|
+
const getIsEditMode = () => {
|
|
54063
|
+
const envMode = window._SB_VIEW_MODE;
|
|
54064
|
+
return envMode === "dev";
|
|
54065
|
+
};
|
|
54066
|
+
let editMode;
|
|
54067
|
+
const isEditMode = () => {
|
|
54068
|
+
if (editMode === void 0) {
|
|
54069
|
+
editMode = getIsEditMode();
|
|
54070
|
+
}
|
|
54071
|
+
return editMode;
|
|
54072
|
+
};
|
|
54062
54073
|
function cleanObject(obj) {
|
|
54063
54074
|
obj = toJS(obj);
|
|
54064
54075
|
if (!obj || typeof obj !== "object") {
|
|
@@ -54171,14 +54182,63 @@ class SbMessageHandler extends EventTarget {
|
|
|
54171
54182
|
// Parent implements all functionalityza
|
|
54172
54183
|
}
|
|
54173
54184
|
const iframeMessageHandler = new SbMessageHandler();
|
|
54185
|
+
class NoopEditorBridge {
|
|
54186
|
+
connected() {
|
|
54187
|
+
}
|
|
54188
|
+
sendReady() {
|
|
54189
|
+
}
|
|
54190
|
+
sendNotification(_type, _message, _description) {
|
|
54191
|
+
}
|
|
54192
|
+
selectWidgets(_sourceIds) {
|
|
54193
|
+
}
|
|
54194
|
+
editOpRequest(_type, _payload) {
|
|
54195
|
+
}
|
|
54196
|
+
undo() {
|
|
54197
|
+
}
|
|
54198
|
+
redo() {
|
|
54199
|
+
}
|
|
54200
|
+
sendStreamedApiEvent(_event, _apiName) {
|
|
54201
|
+
}
|
|
54202
|
+
sendStreamedApiMessage(_message, _apiName) {
|
|
54203
|
+
}
|
|
54204
|
+
setApiStarted(_apiName) {
|
|
54205
|
+
}
|
|
54206
|
+
setApiResponse(_apiName, _response) {
|
|
54207
|
+
}
|
|
54208
|
+
navigateTo(_path, _newWindow) {
|
|
54209
|
+
}
|
|
54210
|
+
updateTheme(_theme, _generatedTheme) {
|
|
54211
|
+
}
|
|
54212
|
+
updatePropertiesPanels(_updates) {
|
|
54213
|
+
}
|
|
54214
|
+
addPropertiesPanel(_id, _definition) {
|
|
54215
|
+
}
|
|
54216
|
+
initializeEditorSyncedStore(_payload) {
|
|
54217
|
+
}
|
|
54218
|
+
updateEditorSyncedStore(_payload) {
|
|
54219
|
+
}
|
|
54220
|
+
resolvePromise(_callbackId, _payload) {
|
|
54221
|
+
}
|
|
54222
|
+
rejectPromise(_callbackId, _payload) {
|
|
54223
|
+
}
|
|
54224
|
+
canvasClicked() {
|
|
54225
|
+
}
|
|
54226
|
+
registerContextMenuClick(_sourceId, _clientX, _clientY) {
|
|
54227
|
+
}
|
|
54228
|
+
updateRoute(_routeInfo) {
|
|
54229
|
+
}
|
|
54230
|
+
socketError(_message) {
|
|
54231
|
+
}
|
|
54232
|
+
}
|
|
54174
54233
|
const _SuperblocksEditorBridge = class _SuperblocksEditorBridge {
|
|
54175
54234
|
constructor() {
|
|
54176
54235
|
__publicField(this, "messagesToSend", []);
|
|
54177
54236
|
__publicField(this, "connectedToParent", false);
|
|
54178
54237
|
}
|
|
54179
54238
|
static getInstance() {
|
|
54239
|
+
const editMode2 = isEditMode();
|
|
54180
54240
|
if (!_SuperblocksEditorBridge.instance) {
|
|
54181
|
-
_SuperblocksEditorBridge.instance = new _SuperblocksEditorBridge();
|
|
54241
|
+
_SuperblocksEditorBridge.instance = editMode2 ? new _SuperblocksEditorBridge() : new NoopEditorBridge();
|
|
54182
54242
|
}
|
|
54183
54243
|
return _SuperblocksEditorBridge.instance;
|
|
54184
54244
|
}
|
|
@@ -95020,7 +95080,7 @@ function registerStores(stores) {
|
|
|
95020
95080
|
internalStores = { ...internalStores, ...stores };
|
|
95021
95081
|
if (SUPPORTED_MODES.includes("production")) {
|
|
95022
95082
|
if (Object.keys(internalStores).length === Object.keys(stores).length) {
|
|
95023
|
-
import("./devtools-consolidated-
|
|
95083
|
+
import("./devtools-consolidated-Brbj1JeD.js").then(({ initializeCustomDevTools, setRegisteredStores }) => {
|
|
95024
95084
|
setRegisteredStores(internalStores);
|
|
95025
95085
|
initializeCustomDevTools();
|
|
95026
95086
|
}).catch((error) => {
|
|
@@ -95033,7 +95093,7 @@ function registerStores(stores) {
|
|
|
95033
95093
|
}
|
|
95034
95094
|
}
|
|
95035
95095
|
const DevToolsInternal = React__default.lazy(() => {
|
|
95036
|
-
return import("./devtools-consolidated-
|
|
95096
|
+
return import("./devtools-consolidated-Brbj1JeD.js").then((module2) => ({
|
|
95037
95097
|
default: module2.CustomDevTools
|
|
95038
95098
|
}));
|
|
95039
95099
|
});
|
|
@@ -96656,7 +96716,7 @@ _runApi_dec = [action], _cancelApi_dec = [action];
|
|
|
96656
96716
|
class ApiManager {
|
|
96657
96717
|
constructor(rootStore2) {
|
|
96658
96718
|
__runInitializers(_init2, 5, this);
|
|
96659
|
-
__publicField(this, "
|
|
96719
|
+
__publicField(this, "baseUrl");
|
|
96660
96720
|
__publicField(this, "token");
|
|
96661
96721
|
__publicField(this, "accessToken");
|
|
96662
96722
|
__publicField(this, "apisByName", {});
|
|
@@ -96758,12 +96818,12 @@ class ApiManager {
|
|
|
96758
96818
|
scopeId,
|
|
96759
96819
|
this.apiNameToDepCandidates[apiName] ?? []
|
|
96760
96820
|
);
|
|
96761
|
-
const
|
|
96762
|
-
const orchestratorUrl = new URL("v2/execute", agentBaseUrl).href;
|
|
96821
|
+
const orchestratorUrl = new URL("v2/execute", this.baseUrl).href;
|
|
96763
96822
|
const events2 = [];
|
|
96764
96823
|
await ((_a2 = this.rootStore.editStore) == null ? void 0 : _a2.operationManager.ensureFilesSynced());
|
|
96765
96824
|
const abortController = new AbortController();
|
|
96766
96825
|
this.runningApiControllers[apiName] = abortController;
|
|
96826
|
+
const editMode2 = isEditMode();
|
|
96767
96827
|
await executeV2Api({
|
|
96768
96828
|
body: {
|
|
96769
96829
|
inputs,
|
|
@@ -96777,6 +96837,7 @@ class ApiManager {
|
|
|
96777
96837
|
name: "staging"
|
|
96778
96838
|
},
|
|
96779
96839
|
viewMode: srcExports.ViewMode.UNSPECIFIED
|
|
96840
|
+
// TODO - deployed gives 404
|
|
96780
96841
|
},
|
|
96781
96842
|
options: {
|
|
96782
96843
|
includeEventOutputs: true,
|
|
@@ -96789,7 +96850,7 @@ class ApiManager {
|
|
|
96789
96850
|
responseType: ApiResponseType.STREAM,
|
|
96790
96851
|
baseUrl: orchestratorUrl + "/stream",
|
|
96791
96852
|
agents: [],
|
|
96792
|
-
viewMode: ViewMode.EDITOR,
|
|
96853
|
+
viewMode: editMode2 ? ViewMode.EDITOR : ViewMode.DEPLOYED,
|
|
96793
96854
|
accessToken: this.accessToken ?? "",
|
|
96794
96855
|
token: this.token ?? "",
|
|
96795
96856
|
abortController,
|
|
@@ -97171,6 +97232,7 @@ class ComponentRegistry {
|
|
|
97171
97232
|
__publicField(this, "_customComponentRegistry", /* @__PURE__ */ new Map());
|
|
97172
97233
|
__publicField(this, "_managedPropsRegistry", /* @__PURE__ */ new Map());
|
|
97173
97234
|
__publicField(this, "_internalPropsRegistry", /* @__PURE__ */ new Map());
|
|
97235
|
+
__publicField(this, "_editorTemplatesRegistry", /* @__PURE__ */ new Map());
|
|
97174
97236
|
this.rootStore = rootStore2;
|
|
97175
97237
|
makeAutoObservable(this);
|
|
97176
97238
|
startEditorSync({
|
|
@@ -97191,6 +97253,7 @@ class ComponentRegistry {
|
|
|
97191
97253
|
deleteCustomComponent(type5) {
|
|
97192
97254
|
this._customComponentRegistry.delete(type5);
|
|
97193
97255
|
this._managedPropsRegistry.delete(type5);
|
|
97256
|
+
this._editorTemplatesRegistry.delete(type5);
|
|
97194
97257
|
}
|
|
97195
97258
|
renameCustomComponent(oldName, newName) {
|
|
97196
97259
|
const component = this._customComponentRegistry.get(oldName);
|
|
@@ -97210,6 +97273,13 @@ class ComponentRegistry {
|
|
|
97210
97273
|
deleteManagedProps(type5) {
|
|
97211
97274
|
this._managedPropsRegistry.delete(type5);
|
|
97212
97275
|
}
|
|
97276
|
+
addEditorTemplate(type5, template) {
|
|
97277
|
+
const existingTemplates = this._editorTemplatesRegistry.get(type5) ?? [];
|
|
97278
|
+
this._editorTemplatesRegistry.set(type5, [...existingTemplates, template]);
|
|
97279
|
+
}
|
|
97280
|
+
getEditorTemplates(type5) {
|
|
97281
|
+
return this._editorTemplatesRegistry.get(type5);
|
|
97282
|
+
}
|
|
97213
97283
|
addInternalProps(type5, props2) {
|
|
97214
97284
|
this._internalPropsRegistry.set(type5, props2);
|
|
97215
97285
|
}
|
|
@@ -102572,14 +102642,14 @@ function getLoaderFn$1(options) {
|
|
|
102572
102642
|
if (!(loader === "all")) return [3, 3];
|
|
102573
102643
|
return [4, import(
|
|
102574
102644
|
/* webpackChunkName: "blueprint-icons-all-paths-loader" */
|
|
102575
|
-
"./allPathsLoader-
|
|
102645
|
+
"./allPathsLoader-Tf9x8dtV.js"
|
|
102576
102646
|
)];
|
|
102577
102647
|
case 2:
|
|
102578
102648
|
return [2, _b2.sent().allPathsLoader];
|
|
102579
102649
|
case 3:
|
|
102580
102650
|
return [4, import(
|
|
102581
102651
|
/* webpackChunkName: "blueprint-icons-split-paths-by-size-loader" */
|
|
102582
|
-
"./splitPathsBySizeLoader-
|
|
102652
|
+
"./splitPathsBySizeLoader-C3MBiqmb.js"
|
|
102583
102653
|
)];
|
|
102584
102654
|
case 4:
|
|
102585
102655
|
return [2, _b2.sent().splitPathsBySizeLoader];
|
|
@@ -128259,29 +128329,46 @@ function getTriggerComponent({
|
|
|
128259
128329
|
throw new Error("Unhandled component type: " + componentType);
|
|
128260
128330
|
}
|
|
128261
128331
|
function getComponentBaseProperties(componentType, parentInfo) {
|
|
128262
|
-
var _a2, _b2;
|
|
128332
|
+
var _a2, _b2, _c2, _d2;
|
|
128263
128333
|
const customComponents = rootStore.componentRegistry.customComponentList;
|
|
128264
|
-
|
|
128334
|
+
let properties2 = {};
|
|
128265
128335
|
let children = [];
|
|
128266
|
-
const
|
|
128267
|
-
|
|
128268
|
-
|
|
128269
|
-
|
|
128270
|
-
|
|
128336
|
+
const editorTemplates = rootStore.componentRegistry.getEditorTemplates(componentType);
|
|
128337
|
+
if (editorTemplates && editorTemplates.length > 1) {
|
|
128338
|
+
throw new Error(
|
|
128339
|
+
`Multiple editor templates are not supported yet. Found ${editorTemplates.length} for component type: ${componentType}.`
|
|
128340
|
+
);
|
|
128341
|
+
}
|
|
128342
|
+
const context2 = {
|
|
128343
|
+
generateUniqueName: getUniqueName
|
|
128344
|
+
};
|
|
128345
|
+
const editorTemplateOnCreate = (_b2 = (_a2 = editorTemplates == null ? void 0 : editorTemplates[0]) == null ? void 0 : _a2.create) == null ? void 0 : _b2.call(_a2, context2);
|
|
128346
|
+
if (editorTemplateOnCreate && Array.isArray(editorTemplateOnCreate)) {
|
|
128347
|
+
throw new Error(
|
|
128348
|
+
`Multiple creates for on editor template are not supported yet. Found ${editorTemplateOnCreate.length} for component type: ${componentType}.`
|
|
128349
|
+
);
|
|
128350
|
+
}
|
|
128351
|
+
if (editorTemplateOnCreate && editorTemplateOnCreate.bind) {
|
|
128352
|
+
properties2.name = Property.Static(editorTemplateOnCreate.bind);
|
|
128353
|
+
} else {
|
|
128354
|
+
const shouldProvideAName = (
|
|
128355
|
+
// TODO: migrate these components
|
|
128356
|
+
componentType === "Dropdown" || componentType === "DatePicker" || componentType === "Checkbox" || componentType === "Switch" || componentType === "Modal" || componentType === "Slideout" || componentType === "Table" || // All components dropped in a grid
|
|
128357
|
+
parentInfo.isGridLike || // All custom components
|
|
128358
|
+
customComponents.includes(componentType)
|
|
128359
|
+
);
|
|
128360
|
+
if (shouldProvideAName) {
|
|
128361
|
+
properties2.name = Property.Static(getUniqueName(componentType));
|
|
128362
|
+
}
|
|
128363
|
+
}
|
|
128271
128364
|
const isContainer = componentType === "Section" || componentType === "Column" || componentType === "Container" || componentType === "Modal" || componentType === "Slideout";
|
|
128272
128365
|
if (isContainer && componentType !== "Modal" && componentType !== "Slideout") {
|
|
128273
128366
|
properties2.width = Property.Dimension(Dim.fill());
|
|
128274
128367
|
}
|
|
128275
|
-
if (shouldProvideAName) {
|
|
128276
|
-
properties2.name = Property.Static(getUniqueName(componentType));
|
|
128277
|
-
}
|
|
128278
128368
|
switch (componentType) {
|
|
128279
128369
|
case "Text":
|
|
128280
128370
|
properties2.text = Property.Static("Hello, world!");
|
|
128281
128371
|
break;
|
|
128282
|
-
case "Input":
|
|
128283
|
-
properties2.label = Property.Static("Label");
|
|
128284
|
-
break;
|
|
128285
128372
|
case "Button":
|
|
128286
128373
|
properties2.label = Property.Static("Submit");
|
|
128287
128374
|
properties2.onClick = Property.Event([
|
|
@@ -128358,7 +128445,7 @@ function getComponentBaseProperties(componentType, parentInfo) {
|
|
|
128358
128445
|
]);
|
|
128359
128446
|
break;
|
|
128360
128447
|
case "Modal":
|
|
128361
|
-
children = getModalChildren((
|
|
128448
|
+
children = getModalChildren((_c2 = properties2.name) == null ? void 0 : _c2.value);
|
|
128362
128449
|
break;
|
|
128363
128450
|
case "Slideout":
|
|
128364
128451
|
children = getSlideoutChildren();
|
|
@@ -128383,6 +128470,12 @@ function getComponentBaseProperties(componentType, parentInfo) {
|
|
|
128383
128470
|
properties2.searchPlaceholder = Property.Static("Search...");
|
|
128384
128471
|
break;
|
|
128385
128472
|
}
|
|
128473
|
+
if (editorTemplateOnCreate == null ? void 0 : editorTemplateOnCreate.properties) {
|
|
128474
|
+
properties2 = {
|
|
128475
|
+
...properties2,
|
|
128476
|
+
...editorTemplateOnCreate.properties
|
|
128477
|
+
};
|
|
128478
|
+
}
|
|
128386
128479
|
const { width, height, ...restProperties } = properties2;
|
|
128387
128480
|
const safeDimensions = parentInfo.isGridLike ? filterSafeGridDimensionProperties({
|
|
128388
128481
|
width: width == null ? void 0 : width.value,
|
|
@@ -128397,7 +128490,7 @@ function getComponentBaseProperties(componentType, parentInfo) {
|
|
|
128397
128490
|
...safeDimensions
|
|
128398
128491
|
},
|
|
128399
128492
|
children,
|
|
128400
|
-
name: (
|
|
128493
|
+
name: (_d2 = properties2.name) == null ? void 0 : _d2.value
|
|
128401
128494
|
};
|
|
128402
128495
|
}
|
|
128403
128496
|
const getUniqueName = (componentType) => {
|
|
@@ -128452,7 +128545,6 @@ async function createComponent({
|
|
|
128452
128545
|
...propertiesFromType,
|
|
128453
128546
|
...baseProperties
|
|
128454
128547
|
};
|
|
128455
|
-
console.log("creating component", { tagName, properties: properties2 });
|
|
128456
128548
|
const parentElement = { source: parent };
|
|
128457
128549
|
const isDetachedComponent = DetachedComponentTypes.has(componentType);
|
|
128458
128550
|
const needTriggerComponent = isDetachedComponent && !skipTriggerCreation;
|
|
@@ -130480,10 +130572,6 @@ function useTrackRuntimeWidget(instanceId, params) {
|
|
|
130480
130572
|
);
|
|
130481
130573
|
}
|
|
130482
130574
|
const registerComponent$1 = (type5, config2, Component3) => {
|
|
130483
|
-
if (typeof window === "undefined") {
|
|
130484
|
-
console.log("[] ssr registering component", type5);
|
|
130485
|
-
return (props2) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ...props2 });
|
|
130486
|
-
}
|
|
130487
130575
|
const managedProps = createManagedPropsList(config2.propertiesDefinition);
|
|
130488
130576
|
rootStore.onEditorRegistered(() => {
|
|
130489
130577
|
getEditStore().propertiesPanelManager.setPropertiesDefinition(
|
|
@@ -130592,7 +130680,13 @@ const registerComponent$1 = (type5, config2, Component3) => {
|
|
|
130592
130680
|
rootStore.componentRegistry.addType(type5, SbComponent);
|
|
130593
130681
|
}
|
|
130594
130682
|
rootStore.componentRegistry.addManagedProps(type5, managedProps ?? []);
|
|
130595
|
-
|
|
130683
|
+
const chainableComponent = Object.assign(SbComponent, {
|
|
130684
|
+
addEditorTemplate: (templateConfig) => {
|
|
130685
|
+
rootStore.componentRegistry.addEditorTemplate(type5, templateConfig);
|
|
130686
|
+
return chainableComponent;
|
|
130687
|
+
}
|
|
130688
|
+
});
|
|
130689
|
+
return chainableComponent;
|
|
130596
130690
|
};
|
|
130597
130691
|
function registerEntity(name, config2, Entity) {
|
|
130598
130692
|
const managedProps = createManagedPropsList(config2.propertiesDefinition);
|
|
@@ -132307,6 +132401,15 @@ const Column = registerComponent$1(
|
|
|
132307
132401
|
);
|
|
132308
132402
|
}
|
|
132309
132403
|
);
|
|
132404
|
+
const editorTemplate = {
|
|
132405
|
+
create: (context2) => ({
|
|
132406
|
+
type: "Input",
|
|
132407
|
+
bind: context2.generateUniqueName("Input"),
|
|
132408
|
+
properties: {
|
|
132409
|
+
label: Property.Static("Label")
|
|
132410
|
+
}
|
|
132411
|
+
})
|
|
132412
|
+
};
|
|
132310
132413
|
/*!
|
|
132311
132414
|
* decimal.js v10.5.0
|
|
132312
132415
|
* An arbitrary-precision Decimal type for JavaScript.
|
|
@@ -139971,7 +140074,7 @@ const Input2 = registerComponent$1(
|
|
|
139971
140074
|
}
|
|
139972
140075
|
) });
|
|
139973
140076
|
}
|
|
139974
|
-
);
|
|
140077
|
+
).addEditorTemplate(editorTemplate);
|
|
139975
140078
|
const propertiesDefinition$d = {
|
|
139976
140079
|
contents: Section$1.category(PropsPanelCategory.Content).children({
|
|
139977
140080
|
columns: Prop.array().readAndWrite().propertiesPanel({
|
|
@@ -159668,14 +159771,14 @@ function getLoaderFn(options) {
|
|
|
159668
159771
|
if (!(loader === "all")) return [3, 3];
|
|
159669
159772
|
return [4, import(
|
|
159670
159773
|
/* webpackChunkName: "blueprint-icons-all-paths-loader" */
|
|
159671
|
-
"./allPathsLoader-
|
|
159774
|
+
"./allPathsLoader-BIuTbNcY.js"
|
|
159672
159775
|
)];
|
|
159673
159776
|
case 2:
|
|
159674
159777
|
return [2, _b2.sent().allPathsLoader];
|
|
159675
159778
|
case 3:
|
|
159676
159779
|
return [4, import(
|
|
159677
159780
|
/* webpackChunkName: "blueprint-icons-split-paths-by-size-loader" */
|
|
159678
|
-
"./splitPathsBySizeLoader-
|
|
159781
|
+
"./splitPathsBySizeLoader-BM6L8m2i.js"
|
|
159679
159782
|
)];
|
|
159680
159783
|
case 4:
|
|
159681
159784
|
return [2, _b2.sent().splitPathsBySizeLoader];
|
|
@@ -197734,7 +197837,7 @@ function EditorHotkeys({ children }) {
|
|
|
197734
197837
|
});
|
|
197735
197838
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children });
|
|
197736
197839
|
}
|
|
197737
|
-
const FullPageSpinner = qe$1(Spinner$1)`
|
|
197840
|
+
const FullPageSpinner$1 = qe$1(Spinner$1)`
|
|
197738
197841
|
width: 100%;
|
|
197739
197842
|
height: 100%;
|
|
197740
197843
|
position: absolute;
|
|
@@ -197789,7 +197892,7 @@ const IframeConnected = observer(function IframeConnected2(props2) {
|
|
|
197789
197892
|
const isPossiblyEditor = useMemo$2(isEmbeddedBySuperblocksFirstParty, []);
|
|
197790
197893
|
const connectionStatus = (_a2 = rootStore.editStore) == null ? void 0 : _a2.connectionManager.connectionStatus;
|
|
197791
197894
|
if (connectionStatus === "pre-init" || connectionStatus === "connecting") {
|
|
197792
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(FullPageSpinner, {});
|
|
197895
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(FullPageSpinner$1, {});
|
|
197793
197896
|
}
|
|
197794
197897
|
if (isPossiblyEditor && editStore.isInitialized && typeof window !== "undefined") {
|
|
197795
197898
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs(DnDProvider, { children: [
|
|
@@ -197799,20 +197902,20 @@ const IframeConnected = observer(function IframeConnected2(props2) {
|
|
|
197799
197902
|
}
|
|
197800
197903
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(React__default.Fragment, { children: props2.children });
|
|
197801
197904
|
});
|
|
197802
|
-
const WithUserWrapper = (props2) => {
|
|
197905
|
+
const WithUserWrapper$1 = (props2) => {
|
|
197803
197906
|
const { data: currentUser, isLoading } = useGetCurrentUserQuery();
|
|
197804
197907
|
if (isLoading) {
|
|
197805
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(FullPageSpinner, {});
|
|
197908
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(FullPageSpinner$1, {});
|
|
197806
197909
|
}
|
|
197807
197910
|
if (!currentUser) {
|
|
197808
197911
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "No user found" });
|
|
197809
197912
|
}
|
|
197810
197913
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: props2.children });
|
|
197811
197914
|
};
|
|
197812
|
-
const Auth0Wrapper = (props2) => {
|
|
197813
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(WithUserWrapper, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(IframeConnected, { children: props2.children }) });
|
|
197915
|
+
const Auth0Wrapper$2 = (props2) => {
|
|
197916
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(WithUserWrapper$1, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(IframeConnected, { children: props2.children }) });
|
|
197814
197917
|
};
|
|
197815
|
-
const EmbedWrapper = (props2) => {
|
|
197918
|
+
const EmbedWrapper$2 = (props2) => {
|
|
197816
197919
|
const isRetrievingToken = useRef(false);
|
|
197817
197920
|
const [error, setError] = useState();
|
|
197818
197921
|
const [isLoaded, setIsLoaded] = useState(false);
|
|
@@ -197844,7 +197947,7 @@ const EmbedWrapper = (props2) => {
|
|
|
197844
197947
|
useEffect(() => {
|
|
197845
197948
|
const bootstrapResponseListener = (event) => {
|
|
197846
197949
|
try {
|
|
197847
|
-
rootStore.apis.
|
|
197950
|
+
rootStore.apis.baseUrl = event.data.payload.agentUrl;
|
|
197848
197951
|
rootStore.apis.setTokens(
|
|
197849
197952
|
event.data.payload.token,
|
|
197850
197953
|
event.data.payload.accessToken
|
|
@@ -197862,13 +197965,6 @@ const EmbedWrapper = (props2) => {
|
|
|
197862
197965
|
"sb-bootstrap-response",
|
|
197863
197966
|
bootstrapResponseListener
|
|
197864
197967
|
);
|
|
197865
|
-
const updateActiveAgentsListener = (event) => {
|
|
197866
|
-
rootStore.apis.agentUrls = event.data.payload.agentUrls;
|
|
197867
|
-
};
|
|
197868
|
-
iframeMessageHandler.addEventListener(
|
|
197869
|
-
"sb-update-active-agents",
|
|
197870
|
-
updateActiveAgentsListener
|
|
197871
|
-
);
|
|
197872
197968
|
const retrievePropertyPanelPropsListener = (event) => {
|
|
197873
197969
|
const sourceId = event.data.payload.sourceId;
|
|
197874
197970
|
const instanceId = getEditStore().runtimeEntitiesManager.widgets.getAnyInstanceIdForSourceId(
|
|
@@ -197999,10 +198095,6 @@ const EmbedWrapper = (props2) => {
|
|
|
197999
198095
|
"sb-bootstrap-response",
|
|
198000
198096
|
bootstrapResponseListener
|
|
198001
198097
|
);
|
|
198002
|
-
iframeMessageHandler.removeEventListener(
|
|
198003
|
-
"sb-update-active-agents",
|
|
198004
|
-
updateActiveAgentsListener
|
|
198005
|
-
);
|
|
198006
198098
|
iframeMessageHandler.removeEventListener(
|
|
198007
198099
|
"sb-edit-operation-acknowledge",
|
|
198008
198100
|
editOperationAcknowledgeListener
|
|
@@ -198098,9 +198190,162 @@ const EmbedWrapper = (props2) => {
|
|
|
198098
198190
|
);
|
|
198099
198191
|
isRetrievingToken.current = true;
|
|
198100
198192
|
}
|
|
198193
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(FullPageSpinner$1, {});
|
|
198194
|
+
}
|
|
198195
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(WithUserWrapper$1, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(IframeConnected, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(EditorHotkeys, { children: props2.children }) }) });
|
|
198196
|
+
};
|
|
198197
|
+
const FullPageSpinner = qe$1(Spinner$1)`
|
|
198198
|
+
width: 100%;
|
|
198199
|
+
height: 100%;
|
|
198200
|
+
position: absolute;
|
|
198201
|
+
`;
|
|
198202
|
+
const WithUserWrapper = (props2) => {
|
|
198203
|
+
const { data: currentUser, isLoading } = useGetCurrentUserQuery();
|
|
198204
|
+
if (isLoading) {
|
|
198101
198205
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(FullPageSpinner, {});
|
|
198102
198206
|
}
|
|
198103
|
-
|
|
198207
|
+
if (!currentUser) {
|
|
198208
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "No user found" });
|
|
198209
|
+
}
|
|
198210
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: props2.children });
|
|
198211
|
+
};
|
|
198212
|
+
const Auth0Wrapper$1 = (props2) => {
|
|
198213
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(WithUserWrapper, { children: props2.children });
|
|
198214
|
+
};
|
|
198215
|
+
const EmbedWrapper$1 = (props2) => {
|
|
198216
|
+
const isRetrievingToken = useRef(false);
|
|
198217
|
+
const [error, setError] = useState();
|
|
198218
|
+
const [isLoaded, setIsLoaded] = useState(false);
|
|
198219
|
+
const navigate = useNavigate();
|
|
198220
|
+
useEffect(() => {
|
|
198221
|
+
const maxRetries = 20;
|
|
198222
|
+
let retryCount = 0;
|
|
198223
|
+
let timeout2;
|
|
198224
|
+
const attemptBootstrap = () => {
|
|
198225
|
+
if (rootStore.apis.isInitialized()) {
|
|
198226
|
+
return;
|
|
198227
|
+
}
|
|
198228
|
+
if (retryCount < maxRetries) {
|
|
198229
|
+
retryCount++;
|
|
198230
|
+
window.parent.postMessage(
|
|
198231
|
+
{
|
|
198232
|
+
type: "sb-editor-request-bootstrap"
|
|
198233
|
+
},
|
|
198234
|
+
"*"
|
|
198235
|
+
);
|
|
198236
|
+
timeout2 = setTimeout(attemptBootstrap, 200);
|
|
198237
|
+
} else {
|
|
198238
|
+
setError("Token took too long to load after multiple retries");
|
|
198239
|
+
}
|
|
198240
|
+
};
|
|
198241
|
+
timeout2 = setTimeout(attemptBootstrap, 200);
|
|
198242
|
+
return () => clearTimeout(timeout2);
|
|
198243
|
+
}, []);
|
|
198244
|
+
useEffect(() => {
|
|
198245
|
+
const bootstrapResponseListener = (event) => {
|
|
198246
|
+
try {
|
|
198247
|
+
rootStore.apis.baseUrl = event.data.payload.agentUrl;
|
|
198248
|
+
rootStore.apis.setTokens(
|
|
198249
|
+
event.data.payload.token,
|
|
198250
|
+
event.data.payload.accessToken
|
|
198251
|
+
);
|
|
198252
|
+
setIsLoaded(true);
|
|
198253
|
+
iframeMessageHandler.removeEventListener(
|
|
198254
|
+
"sb-bootstrap-response",
|
|
198255
|
+
bootstrapResponseListener
|
|
198256
|
+
);
|
|
198257
|
+
} catch (e3) {
|
|
198258
|
+
setError(e3 == null ? void 0 : e3.toString());
|
|
198259
|
+
}
|
|
198260
|
+
};
|
|
198261
|
+
iframeMessageHandler.addEventListener(
|
|
198262
|
+
"sb-bootstrap-response",
|
|
198263
|
+
bootstrapResponseListener
|
|
198264
|
+
);
|
|
198265
|
+
const globalSyncListener = (event) => {
|
|
198266
|
+
const { global: global2 } = event.data.payload;
|
|
198267
|
+
updateGlobalScope(global2);
|
|
198268
|
+
};
|
|
198269
|
+
iframeMessageHandler.addEventListener("sb-global-sync", globalSyncListener);
|
|
198270
|
+
const navigateToListener = async (event) => {
|
|
198271
|
+
const { route, routeParams, queryParams } = event.data.payload;
|
|
198272
|
+
const eventSearch = new URLSearchParams(queryParams);
|
|
198273
|
+
const nextSearch = new URLSearchParams(window.location.search);
|
|
198274
|
+
for (const [key2, value] of eventSearch.entries()) {
|
|
198275
|
+
nextSearch.set(key2, value);
|
|
198276
|
+
}
|
|
198277
|
+
await navigate({
|
|
198278
|
+
pathname: generatePath(route, routeParams),
|
|
198279
|
+
search: nextSearch.toString()
|
|
198280
|
+
});
|
|
198281
|
+
};
|
|
198282
|
+
iframeMessageHandler.addEventListener("route-change", navigateToListener);
|
|
198283
|
+
return () => {
|
|
198284
|
+
iframeMessageHandler.removeEventListener(
|
|
198285
|
+
"sb-bootstrap-response",
|
|
198286
|
+
bootstrapResponseListener
|
|
198287
|
+
);
|
|
198288
|
+
iframeMessageHandler.removeEventListener(
|
|
198289
|
+
"sb-global-sync",
|
|
198290
|
+
globalSyncListener
|
|
198291
|
+
);
|
|
198292
|
+
iframeMessageHandler.removeEventListener(
|
|
198293
|
+
"route-change",
|
|
198294
|
+
navigateToListener
|
|
198295
|
+
);
|
|
198296
|
+
};
|
|
198297
|
+
}, [navigate]);
|
|
198298
|
+
useEffect(() => {
|
|
198299
|
+
const messageListener = (event) => {
|
|
198300
|
+
var _a2;
|
|
198301
|
+
if (((_a2 = event.data) == null ? void 0 : _a2.type) === "parent-action-batch" && event.data.payload) {
|
|
198302
|
+
event.data.payload.forEach((action2) => {
|
|
198303
|
+
switch (action2.type) {
|
|
198304
|
+
case "RUN_API": {
|
|
198305
|
+
const { apiName, scopeId, manualRun } = action2.payload;
|
|
198306
|
+
const api2 = rootStore.entityManager.getEntity(
|
|
198307
|
+
scopeId,
|
|
198308
|
+
getName(apiName)
|
|
198309
|
+
);
|
|
198310
|
+
if (!api2 || api2.type !== "SbApi") {
|
|
198311
|
+
throw new Error(`API ${apiName} not found`);
|
|
198312
|
+
}
|
|
198313
|
+
runEventHandlers({
|
|
198314
|
+
flow: EventFlow.runApis([api2]),
|
|
198315
|
+
name: getName(apiName),
|
|
198316
|
+
scopeId,
|
|
198317
|
+
additionalContext: {
|
|
198318
|
+
manualRun
|
|
198319
|
+
}
|
|
198320
|
+
});
|
|
198321
|
+
break;
|
|
198322
|
+
}
|
|
198323
|
+
}
|
|
198324
|
+
});
|
|
198325
|
+
}
|
|
198326
|
+
};
|
|
198327
|
+
window.addEventListener("message", messageListener);
|
|
198328
|
+
return () => window.removeEventListener("message", messageListener);
|
|
198329
|
+
}, []);
|
|
198330
|
+
if (!isLoaded && error) {
|
|
198331
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
|
|
198332
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("h3", { children: "There was an error logging in to Superblocks." }),
|
|
198333
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: error })
|
|
198334
|
+
] });
|
|
198335
|
+
}
|
|
198336
|
+
if (!rootStore.apis.isInitialized() && !isLoaded) {
|
|
198337
|
+
if (!isRetrievingToken.current && window.parent !== window.self) {
|
|
198338
|
+
window.parent.postMessage(
|
|
198339
|
+
{
|
|
198340
|
+
type: "sb-editor-request-bootstrap"
|
|
198341
|
+
},
|
|
198342
|
+
"*"
|
|
198343
|
+
);
|
|
198344
|
+
isRetrievingToken.current = true;
|
|
198345
|
+
}
|
|
198346
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(FullPageSpinner, {});
|
|
198347
|
+
}
|
|
198348
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(WithUserWrapper, { children: props2.children });
|
|
198104
198349
|
};
|
|
198105
198350
|
const ErrorContainer = qe$1.div`
|
|
198106
198351
|
position: absolute;
|
|
@@ -199860,7 +200105,7 @@ console.log = (...args) => {
|
|
|
199860
200105
|
};
|
|
199861
200106
|
const loadApisIntoLibrary = async function loadApisIntoLibrary2() {
|
|
199862
200107
|
var _a2, _b2;
|
|
199863
|
-
{
|
|
200108
|
+
if (!isEditMode()) {
|
|
199864
200109
|
try {
|
|
199865
200110
|
const mod2 = await import("./user-facing/build-manifest.js");
|
|
199866
200111
|
const apis = ((_a2 = mod2.default) == null ? void 0 : _a2.apis) ?? {};
|
|
@@ -199894,6 +200139,8 @@ const useTrackRouteChange = () => {
|
|
|
199894
200139
|
prevLocation.current = location2;
|
|
199895
200140
|
}, [location2, params, routes]);
|
|
199896
200141
|
};
|
|
200142
|
+
const Auth0Wrapper = isEditMode() ? Auth0Wrapper$2 : Auth0Wrapper$1;
|
|
200143
|
+
const EmbedWrapper = isEditMode() ? EmbedWrapper$2 : EmbedWrapper$1;
|
|
199897
200144
|
const SbProvider = function SbProvider2({
|
|
199898
200145
|
name = "codemode",
|
|
199899
200146
|
settings,
|
|
@@ -200435,4 +200682,4 @@ export {
|
|
|
200435
200682
|
setQueryParams as y,
|
|
200436
200683
|
download as z
|
|
200437
200684
|
};
|
|
200438
|
-
//# sourceMappingURL=index-
|
|
200685
|
+
//# sourceMappingURL=index-CCewmzC_.js.map
|