@xyo-network/os-react-runtime 4.1.4 → 4.2.0-rc.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.
Files changed (42) hide show
  1. package/dist/browser/helpers/BridgeActivityHelper.d.ts +10 -10
  2. package/dist/browser/helpers/index.d.ts +0 -1
  3. package/dist/browser/helpers/index.d.ts.map +1 -1
  4. package/dist/browser/hooks/intent/useDappIntentListener.d.ts.map +1 -1
  5. package/dist/browser/hooks/os/useDappContextCreator.d.ts +2 -2
  6. package/dist/browser/hooks/os/useDappContextCreator.d.ts.map +1 -1
  7. package/dist/browser/hooks/useAccountArchivist.d.ts +10 -10
  8. package/dist/browser/index.mjs +390 -402
  9. package/dist/browser/index.mjs.map +1 -1
  10. package/dist/browser/modules/Dapp/Button/IconEx.d.ts +4 -2
  11. package/dist/browser/modules/Dapp/Button/IconEx.d.ts.map +1 -1
  12. package/dist/browser/modules/Dapp/Container.d.ts +2 -0
  13. package/dist/browser/modules/Dapp/Container.d.ts.map +1 -1
  14. package/dist/browser/modules/Dapp/Page/Row.d.ts.map +1 -1
  15. package/dist/browser/modules/Dapp/modules/Window/DappWindow.d.ts +8 -2
  16. package/dist/browser/modules/Dapp/modules/Window/DappWindow.d.ts.map +1 -1
  17. package/dist/browser/modules/Dapp/modules/Window/hooks/index.d.ts +1 -1
  18. package/dist/browser/modules/Dapp/modules/Window/hooks/index.d.ts.map +1 -1
  19. package/dist/browser/modules/Dapp/modules/Window/hooks/lib/deriveDappState.d.ts +8 -0
  20. package/dist/browser/modules/Dapp/modules/Window/hooks/lib/deriveDappState.d.ts.map +1 -0
  21. package/dist/browser/modules/Dapp/modules/Window/hooks/lib/index.d.ts +2 -1
  22. package/dist/browser/modules/Dapp/modules/Window/hooks/lib/index.d.ts.map +1 -1
  23. package/package.json +11 -10
  24. package/src/helpers/index.ts +0 -1
  25. package/src/hooks/intent/useDappIntentListener.tsx +3 -1
  26. package/src/hooks/os/useDappContextCreator.tsx +6 -5
  27. package/src/modules/Dapp/Button/IconEx.tsx +16 -13
  28. package/src/modules/Dapp/Container.tsx +31 -5
  29. package/src/modules/Dapp/Page/Row.tsx +12 -1
  30. package/src/modules/Dapp/modules/Window/DappWindow.tsx +16 -13
  31. package/src/modules/Dapp/modules/Window/hooks/index.ts +1 -1
  32. package/src/modules/Dapp/modules/Window/hooks/lib/deriveDappState.ts +20 -0
  33. package/src/modules/Dapp/modules/Window/hooks/lib/index.ts +2 -1
  34. package/dist/browser/helpers/widgets/UpperWidgetTrayLayout.d.ts +0 -6
  35. package/dist/browser/helpers/widgets/UpperWidgetTrayLayout.d.ts.map +0 -1
  36. package/dist/browser/helpers/widgets/index.d.ts +0 -2
  37. package/dist/browser/helpers/widgets/index.d.ts.map +0 -1
  38. package/dist/browser/modules/Dapp/modules/Window/hooks/useDappState.d.ts +0 -8
  39. package/dist/browser/modules/Dapp/modules/Window/hooks/useDappState.d.ts.map +0 -1
  40. package/src/helpers/widgets/UpperWidgetTrayLayout.ts +0 -20
  41. package/src/helpers/widgets/index.ts +0 -1
  42. package/src/modules/Dapp/modules/Window/hooks/useDappState.tsx +0 -14
@@ -167,84 +167,7 @@ import { FlexCol as FlexCol13 } from "@xylabs/react-flexbox";
167
167
  import React33 from "react";
168
168
 
169
169
  // src/modules/Dapp/Container.tsx
170
- import React26 from "react";
171
-
172
- // src/modules/Dapp/Button/hooks/useLaunchPoint.tsx
173
- import { useLayoutEffect, useState as useState2 } from "react";
174
-
175
- // src/utils/DappInstallTypeFilters.ts
176
- import { isInstalledDappSet, isPreInstalledDappSet, isUnInstalledDappSet } from "@xyo-network/os-model";
177
- var DappInstallTypeFilters = {
178
- installed(registeredDappSets) {
179
- return registeredDappSets && registeredDappSets?.length > 0 ? registeredDappSets?.filter(isInstalledDappSet).sort((a2, b) => a2.dapp.config.name.toUpperCase() < b.dapp.config.name.toUpperCase() ? -1 : 1) : void 0;
180
- },
181
- preInstalled(registeredDappSets) {
182
- return registeredDappSets && registeredDappSets?.length > 0 ? registeredDappSets?.filter(isPreInstalledDappSet).sort((a2, b) => a2.dapp.config.name.toUpperCase() < b.dapp.config.name.toUpperCase() ? -1 : 1) : void 0;
183
- },
184
- uninstalled(registeredDappSets) {
185
- return registeredDappSets && registeredDappSets?.length > 0 ? registeredDappSets.filter(isUnInstalledDappSet).sort((a2, b) => a2.dapp.config.name.toUpperCase() < b.dapp.config.name.toUpperCase() ? -1 : 1) : void 0;
186
- }
187
- };
188
-
189
- // src/utils/getApiDomain.ts
190
- var getApiDomain = /* @__PURE__ */ __name((localHost, apiDomain) => {
191
- if (apiDomain !== void 0) {
192
- return apiDomain;
193
- }
194
- if (localHost) {
195
- return "http://localhost:8080";
196
- }
197
- if (location.hostname.startsWith("beta")) {
198
- return "https://beta.archivist.xyo.network";
199
- }
200
- return "https://archivist.xyo.network";
201
- }, "getApiDomain");
202
-
203
- // src/utils/useOnWindowResize.tsx
204
- import { useEffect as useEffect2, useState } from "react";
205
- var useOnWindowResize = /* @__PURE__ */ __name(() => {
206
- const [resized, setResized] = useState();
207
- useEffect2(() => {
208
- const onResize = /* @__PURE__ */ __name((event) => {
209
- setResized(event);
210
- }, "onResize");
211
- globalThis.addEventListener("resize", onResize, false);
212
- return () => {
213
- globalThis.removeEventListener("resize", onResize);
214
- };
215
- }, []);
216
- return resized;
217
- }, "useOnWindowResize");
218
-
219
- // src/modules/Dapp/Button/hooks/useLaunchPoint.tsx
220
- var useLaunchPoint = /* @__PURE__ */ __name((spanRef) => {
221
- const [coordinates, setCoordinates] = useState2({
222
- left: 0,
223
- top: 0
224
- });
225
- const resized = useOnWindowResize();
226
- useLayoutEffect(() => {
227
- const rect = spanRef.current?.getBoundingClientRect() ?? null;
228
- if (rect) {
229
- const { width, height, left, top } = rect;
230
- setCoordinates({
231
- left: left + width / 2,
232
- top: top + height / 2
233
- });
234
- }
235
- }, [
236
- spanRef,
237
- resized
238
- ]);
239
- return coordinates;
240
- }, "useLaunchPoint");
241
-
242
- // src/modules/Dapp/Button/IconEx.tsx
243
- import { Circle } from "@mui/icons-material";
244
- import { FlexCol as FlexCol2 } from "@xylabs/react-flexbox";
245
- import { DappIntentTypes as DappIntentTypes5 } from "@xyo-network/os-model";
246
- import { DappIntentCaller as DappIntentCaller2, XyOsMonitor as XyOsMonitor2 } from "@xyo-network/os-runtime";
247
- import React7, { useRef as useRef3 } from "react";
170
+ import React26, { useMemo as useMemo13 } from "react";
248
171
 
249
172
  // src/hooks/access-requests/useBuildDappAccessRequestResource.ts
250
173
  import { usePromise } from "@xylabs/react-promise";
@@ -289,9 +212,9 @@ var ResourceHooks = class {
289
212
  };
290
213
 
291
214
  // src/hooks/useCleanup.tsx
292
- import { useEffect as useEffect3 } from "react";
215
+ import { useEffect as useEffect2 } from "react";
293
216
  var useCleanUpResource = /* @__PURE__ */ __name((resource) => {
294
- useEffect3(() => {
217
+ useEffect2(() => {
295
218
  return () => {
296
219
  resource?.cleanupListeners();
297
220
  };
@@ -355,7 +278,7 @@ var DappAccessRequestResourceHooks = new ResourceHooks(useBuildDappAccessRequest
355
278
  // src/hooks/bios/useBios.ts
356
279
  import { usePromise as usePromise2 } from "@xylabs/react-promise";
357
280
  import { boot } from "@xyo-network/bios-browser";
358
- import { useEffect as useEffect4 } from "react";
281
+ import { useEffect as useEffect3 } from "react";
359
282
  var biosBoot;
360
283
  var useBios = /* @__PURE__ */ __name(() => {
361
284
  const [biosExternalInterface, biosError] = usePromise2(async () => {
@@ -363,7 +286,7 @@ var useBios = /* @__PURE__ */ __name(() => {
363
286
  biosBoot = boot();
364
287
  return await biosBoot;
365
288
  }, []);
366
- useEffect4(() => {
289
+ useEffect3(() => {
367
290
  if (biosError) throw biosError;
368
291
  }, [
369
292
  biosError
@@ -374,7 +297,7 @@ var useBios = /* @__PURE__ */ __name(() => {
374
297
  // src/hooks/bios/useKernel.ts
375
298
  import { usePromise as usePromise3 } from "@xylabs/react-promise";
376
299
  import { Kernel } from "@xyo-network/kernel";
377
- import { useEffect as useEffect5 } from "react";
300
+ import { useEffect as useEffect4 } from "react";
378
301
  var kernelBoot;
379
302
  var useKernel = /* @__PURE__ */ __name((locator, params) => {
380
303
  const bios = useBios();
@@ -394,7 +317,7 @@ var useKernel = /* @__PURE__ */ __name((locator, params) => {
394
317
  }, [
395
318
  bios
396
319
  ]);
397
- useEffect5(() => {
320
+ useEffect4(() => {
398
321
  if (kernelError) throw kernelError;
399
322
  }, [
400
323
  kernelError
@@ -445,16 +368,18 @@ var useClearIntents = /* @__PURE__ */ __name(() => {
445
368
  // src/hooks/intent/useDappIntentListener.tsx
446
369
  import { DappIntentTypes, DappMode, isDappIntentWithMeta } from "@xyo-network/os-model";
447
370
  import { useWeakArchivistFromNode as useWeakArchivistFromNode2 } from "@xyo-network/react-archivist";
448
- import { useEffect as useEffect6, useState as useState3 } from "react";
371
+ import { useEffect as useEffect5, useState } from "react";
449
372
  var useDappIntentListener = /* @__PURE__ */ __name((dappName, targetMode = DappMode.Window) => {
450
- const [dappIntentType, setDappIntentType] = useState3(DappIntentTypes.Close);
451
- const [intentPayload, setIntentPayload] = useState3();
373
+ const [dappIntentType, setDappIntentType] = useState(DappIntentTypes.Close);
374
+ const [intentPayload, setIntentPayload] = useState();
452
375
  const [intentArchivist] = useWeakArchivistFromNode2("IntentArchivist");
453
- useEffect6(() => {
376
+ useEffect5(() => {
454
377
  const listener = /* @__PURE__ */ __name(({ payloads }) => {
455
378
  const filteredPayloads = payloads.filter(isDappIntentWithMeta);
456
379
  for (const payload of filteredPayloads) {
457
- if (payload.targetDappId === dappName && payload.targetMode === targetMode) {
380
+ const allDapps = dappName === null && payload.targetMode === targetMode;
381
+ const targetDapps = dappName === payload.targetDappId && payload.targetMode === targetMode;
382
+ if (allDapps || targetDapps) {
458
383
  setIntentPayload(payload);
459
384
  switch (payload.intent) {
460
385
  case DappIntentTypes.Close: {
@@ -493,11 +418,11 @@ var useDappIntentListener = /* @__PURE__ */ __name((dappName, targetMode = DappM
493
418
 
494
419
  // src/hooks/intent/useDappIntentListener2.tsx
495
420
  import { DappIntentTypes as DappIntentTypes2, DappMode as DappMode2 } from "@xyo-network/os-model";
496
- import { useEffect as useEffect7, useState as useState4 } from "react";
421
+ import { useEffect as useEffect6, useState as useState2 } from "react";
497
422
  var useDappIntentListener2 = /* @__PURE__ */ __name((dappName, sourceMode = DappMode2.Window) => {
498
423
  const { latestDappIntent } = DappIntentResourceHooks.useResourceViewsFromProvidedNode();
499
- const [dappIntentType, setDappIntentType] = useState4(DappIntentTypes2.Close);
500
- useEffect7(() => {
424
+ const [dappIntentType, setDappIntentType] = useState2(DappIntentTypes2.Close);
425
+ useEffect6(() => {
501
426
  if (sourceMode === DappMode2.Window) {
502
427
  for (const payload of latestDappIntent ?? []) {
503
428
  if (payload.targetDappId === dappName) {
@@ -706,17 +631,16 @@ var NameServiceRegistrationHooks = new ResourceHooks(useBuildNameServiceRegistra
706
631
  import { useAsyncEffect as useAsyncEffect2 } from "@xylabs/react-async-effect";
707
632
  import { DappIntentTypes as DappIntentTypes4 } from "@xyo-network/os-model";
708
633
  import { DappContextCreator, RunningDappCache } from "@xyo-network/os-runtime";
709
- import { useCallback as useCallback3, useEffect as useEffect8, useRef, useState as useState5 } from "react";
710
- var useDappContextCreator = /* @__PURE__ */ __name((xnsNodeUrl, xnsNetwork, dapp, allowedNames, createOnMount = false) => {
634
+ import { useCallback as useCallback3, useEffect as useEffect7, useRef, useState as useState3 } from "react";
635
+ var useDappContextCreator = /* @__PURE__ */ __name((xnsNodeUrl, xnsNetwork, dapp, currentIntent, allowedNames, createOnMount = false) => {
711
636
  const context = useXyOsUiContext();
712
- const [windowDappNodeSet, setWindowDappNodeSet] = useState5({
637
+ const [windowDappNodeSet, setWindowDappNodeSet] = useState3({
713
638
  context: void 0,
714
639
  dappWallet: void 0
715
640
  });
716
- const [dappWindowNodeError, setDappWindowNodeError] = useState5();
717
- const { dappIntentType: intentType } = useDappIntentListener(dapp?.config.name);
641
+ const [dappWindowNodeError, setDappWindowNodeError] = useState3();
718
642
  const windowDappNodeSetRef = useRef(windowDappNodeSet);
719
- useEffect8(() => {
643
+ useEffect7(() => {
720
644
  windowDappNodeSetRef.current = windowDappNodeSet;
721
645
  }, [
722
646
  windowDappNodeSet
@@ -735,7 +659,7 @@ var useDappContextCreator = /* @__PURE__ */ __name((xnsNodeUrl, xnsNetwork, dapp
735
659
  context,
736
660
  allowedNames
737
661
  ]);
738
- useEffect8(() => {
662
+ useEffect7(() => {
739
663
  if (createOnMount) {
740
664
  void (async () => {
741
665
  await createNode();
@@ -746,7 +670,7 @@ var useDappContextCreator = /* @__PURE__ */ __name((xnsNodeUrl, xnsNetwork, dapp
746
670
  createNode
747
671
  ]);
748
672
  useAsyncEffect2(async () => {
749
- switch (intentType) {
673
+ switch (currentIntent?.intent) {
750
674
  case DappIntentTypes4.Launch: {
751
675
  await createNode();
752
676
  break;
@@ -765,7 +689,7 @@ var useDappContextCreator = /* @__PURE__ */ __name((xnsNodeUrl, xnsNetwork, dapp
765
689
  }
766
690
  }, [
767
691
  createNode,
768
- intentType
692
+ currentIntent
769
693
  ]);
770
694
  return {
771
695
  ...windowDappNodeSet,
@@ -775,11 +699,11 @@ var useDappContextCreator = /* @__PURE__ */ __name((xnsNodeUrl, xnsNetwork, dapp
775
699
 
776
700
  // src/hooks/os/useDappRegistrationResults.tsx
777
701
  import { EventBusPubSubConnection } from "@xyo-network/os-runtime";
778
- import { useEffect as useEffect9, useState as useState6 } from "react";
702
+ import { useEffect as useEffect8, useState as useState4 } from "react";
779
703
  var useDappRegistrationResults = /* @__PURE__ */ __name(() => {
780
704
  const context = useXyOsUiContext();
781
- const [registeredDappSetResults, setRegisteredDappSetResults] = useState6();
782
- useEffect9(() => {
705
+ const [registeredDappSetResults, setRegisteredDappSetResults] = useState4();
706
+ useEffect8(() => {
783
707
  const listener = /* @__PURE__ */ __name(() => {
784
708
  setRegisteredDappSetResults(context?.dappRegistrationResults);
785
709
  }, "listener");
@@ -1089,29 +1013,6 @@ var WidgetCaller = class extends OsCallerBase {
1089
1013
  }
1090
1014
  };
1091
1015
 
1092
- // src/helpers/widgets/UpperWidgetTrayLayout.ts
1093
- import { WidgetTrayLayoutSchema } from "@xyo-network/os-model";
1094
- var UpperWidgetTrayLayout = {
1095
- label: "Lower Widget Tray Layout",
1096
- layout: [
1097
- {
1098
- dappId: "TimeClock",
1099
- mode: "FlatClock"
1100
- },
1101
- {
1102
- configHash: "bb0ea5701c20e86d77b1a369f77d17658df62572d54f1f1aafdf15e3c29e3b3b",
1103
- dappId: "Markets",
1104
- mode: "PriceWidget"
1105
- },
1106
- {
1107
- configHash: "ea8afca9d4a9b0843035e3722d9f6400058a1eab71996b8e4e20e2449662e2bf",
1108
- dappId: "Markets",
1109
- mode: "PriceWidget"
1110
- }
1111
- ],
1112
- schema: WidgetTrayLayoutSchema
1113
- };
1114
-
1115
1016
  // src/hooks/os/useWidgetDapps.tsx
1116
1017
  var useWidgetDapps = /* @__PURE__ */ __name((registeredDapps, widgetTrayLayout) => {
1117
1018
  const context = useXyOsUiContext();
@@ -1167,11 +1068,11 @@ var useDappIntentCaller = /* @__PURE__ */ __name((xyOsContext) => {
1167
1068
  }, "useDappIntentCaller");
1168
1069
 
1169
1070
  // src/hooks/useDebugClick.tsx
1170
- import { useCallback as useCallback4, useEffect as useEffect10, useRef as useRef2, useState as useState7 } from "react";
1071
+ import { useCallback as useCallback4, useEffect as useEffect9, useRef as useRef2, useState as useState5 } from "react";
1171
1072
  import { useNavigate as useNavigate2, useSearchParams } from "react-router-dom";
1172
1073
  var useDebugClick = /* @__PURE__ */ __name(() => {
1173
1074
  const [params, setParams] = useSearchParams();
1174
- const [debugOpen, setDebugOpen] = useState7(false);
1075
+ const [debugOpen, setDebugOpen] = useState5(false);
1175
1076
  const openFromClick = useRef2(false);
1176
1077
  const closeFromClick = useRef2(false);
1177
1078
  const initialized = useRef2(false);
@@ -1196,7 +1097,7 @@ var useDebugClick = /* @__PURE__ */ __name(() => {
1196
1097
  }, [
1197
1098
  navigate
1198
1099
  ]);
1199
- useEffect10(() => {
1100
+ useEffect9(() => {
1200
1101
  const initialOpen = openFromClick.current && !closeFromClick.current && params.has("debug");
1201
1102
  const backButtonClicked = openFromClick.current && !closeFromClick.current && !params.has("debug");
1202
1103
  if (initialOpen) {
@@ -1255,13 +1156,13 @@ import { useMemo as useMemo7 } from "react";
1255
1156
  // src/hooks/useStackReady.tsx
1256
1157
  import { assertEx as assertEx5 } from "@xylabs/assert";
1257
1158
  import { EventBusPubSubConnection as EventBusPubSubConnection2 } from "@xyo-network/os-runtime";
1258
- import { useEffect as useEffect11, useState as useState8 } from "react";
1159
+ import { useEffect as useEffect10, useState as useState6 } from "react";
1259
1160
  var useStackReady = /* @__PURE__ */ __name((stackReadyEvent, stackName, context) => {
1260
1161
  const providedContext = useXyOsUiContext();
1261
- const [stackReady, setStackReady] = useState8({
1162
+ const [stackReady, setStackReady] = useState6({
1262
1163
  ready: false
1263
1164
  });
1264
- useEffect11(() => {
1165
+ useEffect10(() => {
1265
1166
  const derivedContext = context ?? providedContext;
1266
1167
  const listener = /* @__PURE__ */ __name(() => {
1267
1168
  if (!derivedContext) throw new Error("no context found");
@@ -1375,6 +1276,83 @@ var useTabs = /* @__PURE__ */ __name(() => {
1375
1276
  ];
1376
1277
  }, "useTabs");
1377
1278
 
1279
+ // src/modules/Dapp/Button/hooks/useLaunchPoint.tsx
1280
+ import { useLayoutEffect, useState as useState8 } from "react";
1281
+
1282
+ // src/utils/DappInstallTypeFilters.ts
1283
+ import { isInstalledDappSet, isPreInstalledDappSet, isUnInstalledDappSet } from "@xyo-network/os-model";
1284
+ var DappInstallTypeFilters = {
1285
+ installed(registeredDappSets) {
1286
+ return registeredDappSets && registeredDappSets?.length > 0 ? registeredDappSets?.filter(isInstalledDappSet).sort((a2, b) => a2.dapp.config.name.toUpperCase() < b.dapp.config.name.toUpperCase() ? -1 : 1) : void 0;
1287
+ },
1288
+ preInstalled(registeredDappSets) {
1289
+ return registeredDappSets && registeredDappSets?.length > 0 ? registeredDappSets?.filter(isPreInstalledDappSet).sort((a2, b) => a2.dapp.config.name.toUpperCase() < b.dapp.config.name.toUpperCase() ? -1 : 1) : void 0;
1290
+ },
1291
+ uninstalled(registeredDappSets) {
1292
+ return registeredDappSets && registeredDappSets?.length > 0 ? registeredDappSets.filter(isUnInstalledDappSet).sort((a2, b) => a2.dapp.config.name.toUpperCase() < b.dapp.config.name.toUpperCase() ? -1 : 1) : void 0;
1293
+ }
1294
+ };
1295
+
1296
+ // src/utils/getApiDomain.ts
1297
+ var getApiDomain = /* @__PURE__ */ __name((localHost, apiDomain) => {
1298
+ if (apiDomain !== void 0) {
1299
+ return apiDomain;
1300
+ }
1301
+ if (localHost) {
1302
+ return "http://localhost:8080";
1303
+ }
1304
+ if (location.hostname.startsWith("beta")) {
1305
+ return "https://beta.archivist.xyo.network";
1306
+ }
1307
+ return "https://archivist.xyo.network";
1308
+ }, "getApiDomain");
1309
+
1310
+ // src/utils/useOnWindowResize.tsx
1311
+ import { useEffect as useEffect11, useState as useState7 } from "react";
1312
+ var useOnWindowResize = /* @__PURE__ */ __name(() => {
1313
+ const [resized, setResized] = useState7();
1314
+ useEffect11(() => {
1315
+ const onResize = /* @__PURE__ */ __name((event) => {
1316
+ setResized(event);
1317
+ }, "onResize");
1318
+ globalThis.addEventListener("resize", onResize, false);
1319
+ return () => {
1320
+ globalThis.removeEventListener("resize", onResize);
1321
+ };
1322
+ }, []);
1323
+ return resized;
1324
+ }, "useOnWindowResize");
1325
+
1326
+ // src/modules/Dapp/Button/hooks/useLaunchPoint.tsx
1327
+ var useLaunchPoint = /* @__PURE__ */ __name((spanRef) => {
1328
+ const [coordinates, setCoordinates] = useState8({
1329
+ left: 0,
1330
+ top: 0
1331
+ });
1332
+ const resized = useOnWindowResize();
1333
+ useLayoutEffect(() => {
1334
+ const rect = spanRef.current?.getBoundingClientRect() ?? null;
1335
+ if (rect) {
1336
+ const { width, height, left, top } = rect;
1337
+ setCoordinates({
1338
+ left: left + width / 2,
1339
+ top: top + height / 2
1340
+ });
1341
+ }
1342
+ }, [
1343
+ spanRef,
1344
+ resized
1345
+ ]);
1346
+ return coordinates;
1347
+ }, "useLaunchPoint");
1348
+
1349
+ // src/modules/Dapp/Button/IconEx.tsx
1350
+ import { Circle } from "@mui/icons-material";
1351
+ import { FlexCol as FlexCol2 } from "@xylabs/react-flexbox";
1352
+ import { DappIntentTypes as DappIntentTypes5 } from "@xyo-network/os-model";
1353
+ import { DappIntentCaller as DappIntentCaller2, XyOsMonitor as XyOsMonitor2 } from "@xyo-network/os-runtime";
1354
+ import React7, { useRef as useRef3 } from "react";
1355
+
1378
1356
  // src/modules/Dapp/lib/DefaultIconSize.ts
1379
1357
  var DEFAULT_ICON_SIZE = 84;
1380
1358
 
@@ -1525,19 +1503,15 @@ var StyledDefaultDappIcon = styled(TypographyEx, {
1525
1503
  }));
1526
1504
 
1527
1505
  // src/modules/Dapp/Button/IconEx.tsx
1528
- var DappIconButton = /* @__PURE__ */ __name(({ children, dappIcon, dappIconSvg, dappName, ...props }) => {
1506
+ var DappIconButton = /* @__PURE__ */ __name(({ children, dappIcon, dappIconSvg, dappName, dappState, ...props }) => {
1529
1507
  const { DappIconSize, color, nonSxProps, sx } = decomposeProps(dappIcon, props);
1530
1508
  const iconSize = DEFAULT_ICON_SIZE;
1509
+ const { active, minimized } = dappState ?? {};
1531
1510
  const sendIntent = useSendDappIntent();
1532
- const { dappIntentType: intentType } = useDappIntentListener(dappName);
1533
1511
  const iconButtonRef = useRef3(null);
1534
1512
  const { left: launchLeft, top: launchTop } = useLaunchPoint(iconButtonRef);
1535
- const minimized = intentType === DappIntentTypes5.Minimize;
1536
1513
  const MiddleEllipsisFunction = /* @__PURE__ */ __name((str) => {
1537
1514
  if (str && str.length > 25) {
1538
- console.log(str);
1539
- console.log(str.slice(0, 15));
1540
- console.log(str.slice(-10, str.length - 10 + str.length));
1541
1515
  return str.slice(0, 15) + "..." + str.slice(-7, str.length - 7 + str.length);
1542
1516
  }
1543
1517
  return str;
@@ -1553,7 +1527,7 @@ var DappIconButton = /* @__PURE__ */ __name(({ children, dappIcon, dappIconSvg,
1553
1527
  justifyContent: "stretch"
1554
1528
  }, /* @__PURE__ */ React7.createElement(DappLaunchFrame, {
1555
1529
  id: "dapp-launch-frame",
1556
- open: intentType === DappIntentTypes5.Launch,
1530
+ open: !!active,
1557
1531
  launchLeft,
1558
1532
  launchTop
1559
1533
  }, children), /* @__PURE__ */ React7.createElement("span", {
@@ -1589,45 +1563,182 @@ var DappIconButton = /* @__PURE__ */ __name(({ children, dappIcon, dappIconSvg,
1589
1563
  }))));
1590
1564
  }, "DappIconButton");
1591
1565
 
1566
+ // src/modules/Dapp/modules/access-interface/components/Dialog.tsx
1567
+ import { ArrowForward } from "@mui/icons-material";
1568
+ import { Alert, Button, Dialog, DialogActions, DialogContent, DialogTitle, Typography as Typography2 } from "@mui/material";
1569
+ import { ErrorRender } from "@xylabs/react-error";
1570
+ import { FlexCol as FlexCol3, FlexRow as FlexRow2 } from "@xylabs/react-flexbox";
1571
+ import { RegisteredNames } from "@xyo-network/os-model";
1572
+ import { AccessNodeQueries } from "@xyo-network/os-runtime";
1573
+ import React8, { useState as useState9 } from "react";
1574
+ var DappAccessDialog = /* @__PURE__ */ __name(({ accessRequest, children, dappNode, registeredDappAccess, ...props }) => {
1575
+ const [error, setError] = useState9();
1576
+ const [noPayloadsInserted, setNoPayloadsInserted] = useState9(false);
1577
+ const onClose = /* @__PURE__ */ __name(() => {
1578
+ setNoPayloadsInserted(false);
1579
+ props.onClose?.({}, "escapeKeyDown");
1580
+ }, "onClose");
1581
+ const handleAllow = /* @__PURE__ */ __name(() => {
1582
+ if (accessRequest && registeredDappAccess && dappNode) {
1583
+ try {
1584
+ switch (registeredDappAccess.name) {
1585
+ case RegisteredNames: {
1586
+ const accessNodeQueries = new AccessNodeQueries(dappNode, accessRequest, registeredDappAccess);
1587
+ accessNodeQueries.run().then((payloads) => {
1588
+ if (payloads.length === 0) {
1589
+ setNoPayloadsInserted(true);
1590
+ } else {
1591
+ onClose();
1592
+ }
1593
+ return;
1594
+ }).catch((e) => {
1595
+ setError(e);
1596
+ });
1597
+ }
1598
+ default: {
1599
+ const message = `no helper for interface ${registeredDappAccess.name} found`;
1600
+ console.error(message);
1601
+ setError(new Error(message));
1602
+ }
1603
+ }
1604
+ } catch (e) {
1605
+ console.error(e);
1606
+ setError(e);
1607
+ }
1608
+ } else {
1609
+ setError(new Error("No registered dapp access or dappNode found"));
1610
+ }
1611
+ }, "handleAllow");
1612
+ return /* @__PURE__ */ React8.createElement(Dialog, props, /* @__PURE__ */ React8.createElement(DialogTitle, null, "Message from XYO OS"), /* @__PURE__ */ React8.createElement(DialogContent, {
1613
+ dividers: true,
1614
+ sx: {
1615
+ display: "flex",
1616
+ flexDirection: "column",
1617
+ gap: 3
1618
+ }
1619
+ }, /* @__PURE__ */ React8.createElement(ErrorRender, {
1620
+ error,
1621
+ scope: "DappAccessDialog"
1622
+ }), /* @__PURE__ */ React8.createElement(FlexCol3, {
1623
+ gap: 1
1624
+ }, /* @__PURE__ */ React8.createElement(Typography2, {
1625
+ variant: "subtitle2"
1626
+ }, "dApp to dApp Access Request"), /* @__PURE__ */ React8.createElement(FlexRow2, {
1627
+ gap: 1
1628
+ }, /* @__PURE__ */ React8.createElement(Typography2, {
1629
+ fontSize: 16
1630
+ }, /* @__PURE__ */ React8.createElement("strong", null, accessRequest?.requestingDappId), "\xA0"), /* @__PURE__ */ React8.createElement(ArrowForward, null), /* @__PURE__ */ React8.createElement(Typography2, {
1631
+ fontSize: 16
1632
+ }, /* @__PURE__ */ React8.createElement("strong", null, registeredDappAccess?.registeringDappId))))), /* @__PURE__ */ React8.createElement(DialogContent, {
1633
+ dividers: true,
1634
+ sx: {
1635
+ display: "flex",
1636
+ flexDirection: "column",
1637
+ gap: 3
1638
+ }
1639
+ }, /* @__PURE__ */ React8.createElement(FlexCol3, {
1640
+ gap: 1
1641
+ }, /* @__PURE__ */ React8.createElement(Typography2, null, /* @__PURE__ */ React8.createElement("strong", null, accessRequest?.requestingDappId), " ", "dApp would like to access your", /* @__PURE__ */ React8.createElement("strong", null, registeredDappAccess?.name), " ", "from", " ", /* @__PURE__ */ React8.createElement("strong", null, registeredDappAccess?.registeringDappId), " ", "dApp")), noPayloadsInserted ? /* @__PURE__ */ React8.createElement(Alert, {
1642
+ severity: "warning"
1643
+ }, registeredDappAccess?.name, " ", "Access Request did not find payloads to insert") : null), children ? /* @__PURE__ */ React8.createElement(DialogContent, {
1644
+ dividers: true
1645
+ }, children) : null, /* @__PURE__ */ React8.createElement(DialogActions, null, /* @__PURE__ */ React8.createElement(Button, {
1646
+ variant: "outlined",
1647
+ onClick: onClose
1648
+ }, "Cancel"), /* @__PURE__ */ React8.createElement(Button, {
1649
+ variant: "contained",
1650
+ onClick: handleAllow
1651
+ }, "Allow")));
1652
+ }, "DappAccessDialog");
1653
+
1654
+ // src/modules/Dapp/modules/access-interface/components/Flexbox.tsx
1655
+ import { ErrorRender as ErrorRender2 } from "@xylabs/react-error";
1656
+ import React9 from "react";
1657
+
1658
+ // src/modules/Dapp/modules/access-interface/hooks/useDialogState.tsx
1659
+ import { usePromise as usePromise10 } from "@xylabs/react-promise";
1660
+ import { isRegisteredDappAccess, RegisteredNames as RegisteredNames2 } from "@xyo-network/os-model";
1661
+ import { useState as useState10 } from "react";
1662
+ var useDialogState = /* @__PURE__ */ __name((context) => {
1663
+ const dappCaller = useDappCaller();
1664
+ const { accessRequests } = DappAccessRequestResourceHooks.resourceViewsFromContext(context);
1665
+ const [openAccessDialog, setOpenAccessDialog] = useState10(false);
1666
+ const [registeredInterface, setRegisteredInterface] = useState10();
1667
+ const [, allowAccessDialogError] = usePromise10(async () => {
1668
+ const accessRequest = accessRequests?.[0];
1669
+ if (accessRequest && context && dappCaller) {
1670
+ setOpenAccessDialog(true);
1671
+ const payload = await dappCaller.getRegisteredDappAccessByName(RegisteredNames2);
1672
+ setRegisteredInterface(isRegisteredDappAccess(payload) ? payload : void 0);
1673
+ }
1674
+ }, [
1675
+ accessRequests,
1676
+ dappCaller,
1677
+ context
1678
+ ]);
1679
+ return {
1680
+ accessRequests,
1681
+ allowAccessDialogError,
1682
+ openAccessDialog,
1683
+ registeredInterface,
1684
+ setOpenAccessDialog
1685
+ };
1686
+ }, "useDialogState");
1687
+
1688
+ // src/modules/Dapp/modules/access-interface/components/Flexbox.tsx
1689
+ var DappAccessFlexbox = /* @__PURE__ */ __name(({ context }) => {
1690
+ const { accessRequests, allowAccessDialogError, openAccessDialog, registeredInterface, setOpenAccessDialog } = useDialogState(context);
1691
+ return /* @__PURE__ */ React9.createElement(DappAccessDialog, {
1692
+ accessRequest: accessRequests?.[0],
1693
+ dappNode: context,
1694
+ open: openAccessDialog,
1695
+ onClose: /* @__PURE__ */ __name(() => setOpenAccessDialog(false), "onClose"),
1696
+ registeredDappAccess: registeredInterface
1697
+ }, allowAccessDialogError ? /* @__PURE__ */ React9.createElement(ErrorRender2, {
1698
+ error: allowAccessDialogError,
1699
+ scope: "DappAccessFlexbox"
1700
+ }) : null);
1701
+ }, "DappAccessFlexbox");
1702
+
1592
1703
  // src/modules/Dapp/modules/Window/AppBar.tsx
1593
1704
  import { BugReport, CloseRounded, RemoveRounded } from "@mui/icons-material";
1594
- import { AppBar, Box as Box2, Divider, IconButton as IconButton2, Toolbar, Tooltip as Tooltip2, Typography as Typography2 } from "@mui/material";
1705
+ import { AppBar, Box as Box2, Divider, IconButton as IconButton2, Toolbar, Tooltip as Tooltip2, Typography as Typography3 } from "@mui/material";
1595
1706
  import { FlexGrowRow as FlexGrowRow2 } from "@xylabs/react-flexbox";
1596
1707
  import { DarkModeIconButtonForColorScheme } from "@xylabs/react-invertible-theme";
1597
1708
  import { DappIntentTypes as DappIntentTypes6 } from "@xyo-network/os-model";
1598
1709
  import { DappIntentCaller as DappIntentCaller3 } from "@xyo-network/os-runtime";
1599
- import React9 from "react";
1710
+ import React11 from "react";
1600
1711
 
1601
1712
  // src/modules/Dapp/Debug/Dialog.tsx
1602
- import { Dialog, DialogActions, DialogContent } from "@mui/material";
1713
+ import { Dialog as Dialog2, DialogActions as DialogActions2, DialogContent as DialogContent2 } from "@mui/material";
1603
1714
  import { ButtonEx as ButtonEx4 } from "@xylabs/react-button";
1604
- import { FlexCol as FlexCol3 } from "@xylabs/react-flexbox";
1715
+ import { FlexCol as FlexCol4 } from "@xylabs/react-flexbox";
1605
1716
  import { NodeProvider } from "@xyo-network/react-node";
1606
- import React8, { lazy, Suspense } from "react";
1717
+ import React10, { lazy, Suspense } from "react";
1607
1718
  var Debug = /* @__PURE__ */ lazy(() => import(
1608
1719
  /* webpackChunkName: "Debug" */
1609
1720
  "@xyo-network/os-react-debug"
1610
1721
  ));
1611
- var LazyDebug = /* @__PURE__ */ __name(() => /* @__PURE__ */ React8.createElement(Suspense, {
1612
- fallback: /* @__PURE__ */ React8.createElement(FlexCol3, null)
1613
- }, /* @__PURE__ */ React8.createElement(FlexCol3, null), /* @__PURE__ */ React8.createElement(Debug, {
1722
+ var LazyDebug = /* @__PURE__ */ __name(() => /* @__PURE__ */ React10.createElement(Suspense, {
1723
+ fallback: /* @__PURE__ */ React10.createElement(FlexCol4, null)
1724
+ }, /* @__PURE__ */ React10.createElement(FlexCol4, null), /* @__PURE__ */ React10.createElement(Debug, {
1614
1725
  height: "100%"
1615
1726
  })), "LazyDebug");
1616
1727
  var DebugDialog = /* @__PURE__ */ __name(({ closeDebug, debugOpen, ...props }) => {
1617
- return /* @__PURE__ */ React8.createElement(Dialog, {
1728
+ return /* @__PURE__ */ React10.createElement(Dialog2, {
1618
1729
  open: debugOpen,
1619
1730
  onClose: closeDebug,
1620
1731
  fullScreen: true,
1621
1732
  ...props
1622
- }, /* @__PURE__ */ React8.createElement(DialogContent, null, /* @__PURE__ */ React8.createElement(LazyDebug, null)), /* @__PURE__ */ React8.createElement(DialogActions, null, /* @__PURE__ */ React8.createElement(ButtonEx4, {
1733
+ }, /* @__PURE__ */ React10.createElement(DialogContent2, null, /* @__PURE__ */ React10.createElement(LazyDebug, null)), /* @__PURE__ */ React10.createElement(DialogActions2, null, /* @__PURE__ */ React10.createElement(ButtonEx4, {
1623
1734
  variant: "outlined",
1624
1735
  onClick: closeDebug
1625
1736
  }, "Close")));
1626
1737
  }, "DebugDialog");
1627
1738
  var DebugDialogWithNode = /* @__PURE__ */ __name(({ closeDebug, debugOpen, context, ...props }) => {
1628
- return /* @__PURE__ */ React8.createElement(NodeProvider, {
1739
+ return /* @__PURE__ */ React10.createElement(NodeProvider, {
1629
1740
  node: context?.root
1630
- }, /* @__PURE__ */ React8.createElement(DebugDialog, {
1741
+ }, /* @__PURE__ */ React10.createElement(DebugDialog, {
1631
1742
  closeDebug,
1632
1743
  debugOpen,
1633
1744
  ...props
@@ -1636,7 +1747,7 @@ var DebugDialogWithNode = /* @__PURE__ */ __name(({ closeDebug, debugOpen, conte
1636
1747
 
1637
1748
  // src/modules/Dapp/modules/Window/AppBar.tsx
1638
1749
  var EmptyDappBarForPadding = /* @__PURE__ */ __name((props) => {
1639
- return /* @__PURE__ */ React9.createElement(AppBar, {
1750
+ return /* @__PURE__ */ React11.createElement(AppBar, {
1640
1751
  color: "primary",
1641
1752
  sx: {
1642
1753
  flexDirection: "row"
@@ -1649,7 +1760,7 @@ var EmptyDappBarForPadding = /* @__PURE__ */ __name((props) => {
1649
1760
  var DappBar = /* @__PURE__ */ __name(({ title, context, name, ...props }) => {
1650
1761
  const sendIntent = useSendDappIntent();
1651
1762
  const { closeDebug, debugOpen, openDebug } = useDebugClick();
1652
- return /* @__PURE__ */ React9.createElement(AppBar, {
1763
+ return /* @__PURE__ */ React11.createElement(AppBar, {
1653
1764
  elevation: 0,
1654
1765
  color: "transparent",
1655
1766
  sx: {
@@ -1659,21 +1770,21 @@ var DappBar = /* @__PURE__ */ __name(({ title, context, name, ...props }) => {
1659
1770
  component: "div",
1660
1771
  position: "sticky",
1661
1772
  ...props
1662
- }, /* @__PURE__ */ React9.createElement(Toolbar, {
1773
+ }, /* @__PURE__ */ React11.createElement(Toolbar, {
1663
1774
  disableGutters: true,
1664
1775
  sx: {
1665
1776
  paddingX: 2
1666
1777
  }
1667
- }, /* @__PURE__ */ React9.createElement(Typography2, {
1778
+ }, /* @__PURE__ */ React11.createElement(Typography3, {
1668
1779
  noWrap: true,
1669
1780
  variant: "h6",
1670
1781
  letterSpacing: "-1px"
1671
- }, title)), /* @__PURE__ */ React9.createElement(FlexGrowRow2, null), /* @__PURE__ */ React9.createElement(Toolbar, {
1782
+ }, title)), /* @__PURE__ */ React11.createElement(FlexGrowRow2, null), /* @__PURE__ */ React11.createElement(Toolbar, {
1672
1783
  disableGutters: true,
1673
1784
  sx: {
1674
1785
  paddingX: 2
1675
1786
  }
1676
- }, /* @__PURE__ */ React9.createElement(IconButton2, {
1787
+ }, /* @__PURE__ */ React11.createElement(IconButton2, {
1677
1788
  onClick: openDebug,
1678
1789
  sx: {
1679
1790
  display: {
@@ -1681,7 +1792,7 @@ var DappBar = /* @__PURE__ */ __name(({ title, context, name, ...props }) => {
1681
1792
  xs: "flex"
1682
1793
  }
1683
1794
  }
1684
- }, /* @__PURE__ */ React9.createElement(BugReport, null)), /* @__PURE__ */ React9.createElement(Tooltip2, {
1795
+ }, /* @__PURE__ */ React11.createElement(BugReport, null)), /* @__PURE__ */ React11.createElement(Tooltip2, {
1685
1796
  title: "Toggle Light/Dark Mode",
1686
1797
  sx: {
1687
1798
  display: {
@@ -1689,9 +1800,9 @@ var DappBar = /* @__PURE__ */ __name(({ title, context, name, ...props }) => {
1689
1800
  xs: "flex"
1690
1801
  }
1691
1802
  }
1692
- }, /* @__PURE__ */ React9.createElement(Box2, null, /* @__PURE__ */ React9.createElement(DarkModeIconButtonForColorScheme, {
1803
+ }, /* @__PURE__ */ React11.createElement(Box2, null, /* @__PURE__ */ React11.createElement(DarkModeIconButtonForColorScheme, {
1693
1804
  defaultLightModeColor: "warning"
1694
- }))), /* @__PURE__ */ React9.createElement(Divider, {
1805
+ }))), /* @__PURE__ */ React11.createElement(Divider, {
1695
1806
  orientation: "vertical",
1696
1807
  flexItem: true,
1697
1808
  sx: {
@@ -1701,19 +1812,19 @@ var DappBar = /* @__PURE__ */ __name(({ title, context, name, ...props }) => {
1701
1812
  },
1702
1813
  m: 1
1703
1814
  }
1704
- }), /* @__PURE__ */ React9.createElement(Tooltip2, {
1815
+ }), /* @__PURE__ */ React11.createElement(Tooltip2, {
1705
1816
  title: "Minimize"
1706
- }, /* @__PURE__ */ React9.createElement(IconButton2, {
1817
+ }, /* @__PURE__ */ React11.createElement(IconButton2, {
1707
1818
  onClick: /* @__PURE__ */ __name(async () => await sendIntent?.(DappIntentCaller3.buildIntent(DappIntentCaller3.OsDappName, DappIntentTypes6.Minimize, name)), "onClick")
1708
- }, /* @__PURE__ */ React9.createElement(RemoveRounded, {
1819
+ }, /* @__PURE__ */ React11.createElement(RemoveRounded, {
1709
1820
  htmlColor: "inherit"
1710
- }))), /* @__PURE__ */ React9.createElement(Tooltip2, {
1821
+ }))), /* @__PURE__ */ React11.createElement(Tooltip2, {
1711
1822
  title: "Close"
1712
- }, /* @__PURE__ */ React9.createElement(IconButton2, {
1823
+ }, /* @__PURE__ */ React11.createElement(IconButton2, {
1713
1824
  onClick: /* @__PURE__ */ __name(async () => await sendIntent?.(DappIntentCaller3.buildIntent(DappIntentCaller3.OsDappName, DappIntentTypes6.Close, name)), "onClick")
1714
- }, /* @__PURE__ */ React9.createElement(CloseRounded, {
1825
+ }, /* @__PURE__ */ React11.createElement(CloseRounded, {
1715
1826
  htmlColor: "inherit"
1716
- })))), /* @__PURE__ */ React9.createElement(DebugDialogWithNode, {
1827
+ })))), /* @__PURE__ */ React11.createElement(DebugDialogWithNode, {
1717
1828
  closeDebug,
1718
1829
  debugOpen,
1719
1830
  context
@@ -1722,21 +1833,21 @@ var DappBar = /* @__PURE__ */ __name(({ title, context, name, ...props }) => {
1722
1833
 
1723
1834
  // src/modules/Dapp/modules/Window/Chrome.tsx
1724
1835
  import { useMediaQuery } from "@mui/material";
1725
- import { FlexCol as FlexCol4, FlexGrowCol, FlexRow as FlexRow2 } from "@xylabs/react-flexbox";
1726
- import React10 from "react";
1836
+ import { FlexCol as FlexCol5, FlexGrowCol, FlexRow as FlexRow3 } from "@xylabs/react-flexbox";
1837
+ import React12 from "react";
1727
1838
  var DappChromeSmall = /* @__PURE__ */ __name(({ appBar, children, screenMenu, splashScreen, ...props }) => {
1728
- return /* @__PURE__ */ React10.createElement(FlexCol4, {
1839
+ return /* @__PURE__ */ React12.createElement(FlexCol5, {
1729
1840
  alignItems: "stretch",
1730
1841
  id: "dapp-chrome-container-small",
1731
1842
  ...props
1732
- }, splashScreen, /* @__PURE__ */ React10.createElement(FlexGrowCol, {
1843
+ }, splashScreen, /* @__PURE__ */ React12.createElement(FlexGrowCol, {
1733
1844
  alignItems: "stretch",
1734
1845
  id: "dapp-chrome-small",
1735
1846
  justifyContent: "start",
1736
1847
  sx: {
1737
1848
  background: /* @__PURE__ */ __name((theme) => theme.palette.background.default, "background")
1738
1849
  }
1739
- }, appBar, /* @__PURE__ */ React10.createElement(FlexGrowCol, {
1850
+ }, appBar, /* @__PURE__ */ React12.createElement(FlexGrowCol, {
1740
1851
  sx: {
1741
1852
  overflowY: "auto"
1742
1853
  },
@@ -1744,18 +1855,18 @@ var DappChromeSmall = /* @__PURE__ */ __name(({ appBar, children, screenMenu, sp
1744
1855
  }, children), screenMenu));
1745
1856
  }, "DappChromeSmall");
1746
1857
  var DappChromeLarge = /* @__PURE__ */ __name(({ appBar, children, screenMenu, splashScreen, ...props }) => {
1747
- return /* @__PURE__ */ React10.createElement(FlexRow2, {
1858
+ return /* @__PURE__ */ React12.createElement(FlexRow3, {
1748
1859
  alignItems: "stretch",
1749
1860
  id: "dapp-chrome-container-large",
1750
1861
  ...props
1751
- }, splashScreen, screenMenu, /* @__PURE__ */ React10.createElement(FlexGrowCol, {
1862
+ }, splashScreen, screenMenu, /* @__PURE__ */ React12.createElement(FlexGrowCol, {
1752
1863
  alignItems: "stretch",
1753
1864
  id: "dapp-chrome-large",
1754
1865
  justifyContent: "start",
1755
1866
  sx: {
1756
1867
  background: /* @__PURE__ */ __name((theme) => theme.palette.background.default, "background")
1757
1868
  }
1758
- }, appBar, /* @__PURE__ */ React10.createElement(FlexGrowCol, {
1869
+ }, appBar, /* @__PURE__ */ React12.createElement(FlexGrowCol, {
1759
1870
  sx: {
1760
1871
  overflowY: "auto"
1761
1872
  },
@@ -1765,26 +1876,26 @@ var DappChromeLarge = /* @__PURE__ */ __name(({ appBar, children, screenMenu, sp
1765
1876
  }, "DappChromeLarge");
1766
1877
  var DappChrome = /* @__PURE__ */ __name(({ largeScreenMenu, smallScreenMenu, ...props }) => {
1767
1878
  const isMedium = useMediaQuery((theme) => theme.breakpoints.up("md"));
1768
- return isMedium ? /* @__PURE__ */ React10.createElement(DappChromeLarge, {
1879
+ return isMedium ? /* @__PURE__ */ React12.createElement(DappChromeLarge, {
1769
1880
  screenMenu: largeScreenMenu,
1770
1881
  ...props
1771
- }) : /* @__PURE__ */ React10.createElement(DappChromeSmall, {
1882
+ }) : /* @__PURE__ */ React12.createElement(DappChromeSmall, {
1772
1883
  screenMenu: smallScreenMenu,
1773
1884
  ...props
1774
1885
  });
1775
1886
  }, "DappChrome");
1776
1887
 
1777
1888
  // src/modules/Dapp/modules/Window/components/DefaultComingSoon/DefaultComingSoon.tsx
1778
- import { alpha as alpha3, Card as Card2, CardContent as CardContent3, Chip, Container, Divider as Divider2, Typography as Typography4, useTheme as useTheme5 } from "@mui/material";
1779
- import { FlexGrowCol as FlexGrowCol3, FlexRow as FlexRow5 } from "@xylabs/react-flexbox";
1780
- import React14 from "react";
1889
+ import { alpha as alpha3, Card as Card2, CardContent as CardContent3, Chip, Container, Divider as Divider2, Typography as Typography5, useTheme as useTheme5 } from "@mui/material";
1890
+ import { FlexGrowCol as FlexGrowCol3, FlexRow as FlexRow6 } from "@xylabs/react-flexbox";
1891
+ import React16 from "react";
1781
1892
 
1782
1893
  // src/modules/Dapp/modules/Window/components/DefaultComingSoon/InstallButtonSection.tsx
1783
1894
  import { ButtonEx as ButtonEx5 } from "@xylabs/react-button";
1784
- import { FlexRow as FlexRow3 } from "@xylabs/react-flexbox";
1785
- import React11 from "react";
1895
+ import { FlexRow as FlexRow4 } from "@xylabs/react-flexbox";
1896
+ import React13 from "react";
1786
1897
  var InstallButtonSection = /* @__PURE__ */ __name(({ installLink = "", notificationLink = "https://xyo.network/newsletter", ...props }) => {
1787
- return /* @__PURE__ */ React11.createElement(FlexRow3, {
1898
+ return /* @__PURE__ */ React13.createElement(FlexRow4, {
1788
1899
  width: "100%",
1789
1900
  gap: 1,
1790
1901
  sx: {
@@ -1795,12 +1906,12 @@ var InstallButtonSection = /* @__PURE__ */ __name(({ installLink = "", notificat
1795
1906
  }
1796
1907
  },
1797
1908
  ...props
1798
- }, /* @__PURE__ */ React11.createElement(ButtonEx5, {
1909
+ }, /* @__PURE__ */ React13.createElement(ButtonEx5, {
1799
1910
  fullWidth: true,
1800
1911
  variant: "contained",
1801
1912
  disabled: true,
1802
1913
  href: installLink
1803
- }, "Install"), /* @__PURE__ */ React11.createElement(ButtonEx5, {
1914
+ }, "Install"), /* @__PURE__ */ React13.createElement(ButtonEx5, {
1804
1915
  fullWidth: true,
1805
1916
  variant: "outlined",
1806
1917
  href: notificationLink,
@@ -1810,18 +1921,18 @@ var InstallButtonSection = /* @__PURE__ */ __name(({ installLink = "", notificat
1810
1921
 
1811
1922
  // src/modules/Dapp/modules/Window/components/DefaultComingSoon/SummarySection.tsx
1812
1923
  import { VerifiedRounded } from "@mui/icons-material";
1813
- import { Card, CardContent as CardContent2, Typography as Typography3, useTheme as useTheme4 } from "@mui/material";
1814
- import { FlexGrowCol as FlexGrowCol2, FlexGrowRow as FlexGrowRow4, FlexRow as FlexRow4 } from "@xylabs/react-flexbox";
1815
- import React13 from "react";
1924
+ import { Card, CardContent as CardContent2, Typography as Typography4, useTheme as useTheme4 } from "@mui/material";
1925
+ import { FlexGrowCol as FlexGrowCol2, FlexGrowRow as FlexGrowRow4, FlexRow as FlexRow5 } from "@xylabs/react-flexbox";
1926
+ import React15 from "react";
1816
1927
 
1817
1928
  // src/modules/Dapp/modules/Window/components/DefaultComingSoon/DeveloperLinkSection.tsx
1818
1929
  import { useTheme as useTheme3 } from "@mui/material";
1819
1930
  import { FlexGrowRow as FlexGrowRow3 } from "@xylabs/react-flexbox";
1820
1931
  import { LinkEx } from "@xylabs/react-link";
1821
- import React12 from "react";
1932
+ import React14 from "react";
1822
1933
  var DeveloperLinkSection = /* @__PURE__ */ __name(({ developerLink = "https://xylabs.com", ...props }) => {
1823
1934
  const theme = useTheme3();
1824
- return /* @__PURE__ */ React12.createElement(FlexGrowRow3, {
1935
+ return /* @__PURE__ */ React14.createElement(FlexGrowRow3, {
1825
1936
  gap: 1,
1826
1937
  sx: {
1827
1938
  alignItems: "flex-start",
@@ -1831,7 +1942,7 @@ var DeveloperLinkSection = /* @__PURE__ */ __name(({ developerLink = "https://xy
1831
1942
  }
1832
1943
  },
1833
1944
  ...props
1834
- }, /* @__PURE__ */ React12.createElement(LinkEx, {
1945
+ }, /* @__PURE__ */ React14.createElement(LinkEx, {
1835
1946
  color: theme.palette.info.main,
1836
1947
  href: developerLink,
1837
1948
  target: "_blank"
@@ -1841,18 +1952,18 @@ var DeveloperLinkSection = /* @__PURE__ */ __name(({ developerLink = "https://xy
1841
1952
  // src/modules/Dapp/modules/Window/components/DefaultComingSoon/SummarySection.tsx
1842
1953
  var SummarySection = /* @__PURE__ */ __name(({ name, dappIconSvg, version = "1.0", developerLink = "https://xylabs.com" }) => {
1843
1954
  const theme = useTheme4();
1844
- return /* @__PURE__ */ React13.createElement(Card, {
1955
+ return /* @__PURE__ */ React15.createElement(Card, {
1845
1956
  sx: {
1846
1957
  width: "100%"
1847
1958
  }
1848
- }, /* @__PURE__ */ React13.createElement(CardContent2, null, /* @__PURE__ */ React13.createElement(FlexRow4, {
1959
+ }, /* @__PURE__ */ React15.createElement(CardContent2, null, /* @__PURE__ */ React15.createElement(FlexRow5, {
1849
1960
  gap: 3,
1850
1961
  alignItems: "flex-start",
1851
1962
  sx: {
1852
1963
  flexDirection: "column",
1853
1964
  width: "100%"
1854
1965
  }
1855
- }, /* @__PURE__ */ React13.createElement(FlexGrowRow4, {
1966
+ }, /* @__PURE__ */ React15.createElement(FlexGrowRow4, {
1856
1967
  sx: {
1857
1968
  gap: {
1858
1969
  md: 2,
@@ -1860,16 +1971,16 @@ var SummarySection = /* @__PURE__ */ __name(({ name, dappIconSvg, version = "1.0
1860
1971
  }
1861
1972
  },
1862
1973
  alignItems: "flex-start"
1863
- }, /* @__PURE__ */ React13.createElement(Card, {
1974
+ }, /* @__PURE__ */ React15.createElement(Card, {
1864
1975
  elevation: 0,
1865
1976
  variant: "outlined"
1866
- }, /* @__PURE__ */ React13.createElement(CardContent2, null, dappIconSvg ? /* @__PURE__ */ React13.createElement(RenderHtml, {
1977
+ }, /* @__PURE__ */ React15.createElement(CardContent2, null, dappIconSvg ? /* @__PURE__ */ React15.createElement(RenderHtml, {
1867
1978
  htmlString: dappIconSvg
1868
- }) : null)), /* @__PURE__ */ React13.createElement(FlexGrowCol2, {
1979
+ }) : null)), /* @__PURE__ */ React15.createElement(FlexGrowCol2, {
1869
1980
  alignItems: "flex-start"
1870
- }, /* @__PURE__ */ React13.createElement(FlexGrowCol2, {
1981
+ }, /* @__PURE__ */ React15.createElement(FlexGrowCol2, {
1871
1982
  alignItems: "flex-start"
1872
- }, /* @__PURE__ */ React13.createElement(Typography3, {
1983
+ }, /* @__PURE__ */ React15.createElement(Typography4, {
1873
1984
  sx: {
1874
1985
  fontSize: {
1875
1986
  md: theme.typography.h1.fontSize,
@@ -1877,20 +1988,20 @@ var SummarySection = /* @__PURE__ */ __name(({ name, dappIconSvg, version = "1.0
1877
1988
  }
1878
1989
  },
1879
1990
  fontWeight: theme.typography.fontWeightBold
1880
- }, name), /* @__PURE__ */ React13.createElement(Typography3, {
1991
+ }, name), /* @__PURE__ */ React15.createElement(Typography4, {
1881
1992
  gutterBottom: true,
1882
1993
  variant: "subtitle2"
1883
- }, "Version:", " ", version)), /* @__PURE__ */ React13.createElement(FlexGrowRow4, {
1994
+ }, "Version:", " ", version)), /* @__PURE__ */ React15.createElement(FlexGrowRow4, {
1884
1995
  gap: 0.5,
1885
1996
  alignItems: "center",
1886
1997
  justifyContent: "center"
1887
- }, /* @__PURE__ */ React13.createElement(VerifiedRounded, {
1998
+ }, /* @__PURE__ */ React15.createElement(VerifiedRounded, {
1888
1999
  color: "success",
1889
2000
  fontSize: "small"
1890
- }), /* @__PURE__ */ React13.createElement(Typography3, {
2001
+ }), /* @__PURE__ */ React15.createElement(Typography4, {
1891
2002
  variant: "body1",
1892
2003
  color: theme.palette.success.main
1893
- }, "XY Labs")), developerLink ? /* @__PURE__ */ React13.createElement(DeveloperLinkSection, {
2004
+ }, "XY Labs")), developerLink ? /* @__PURE__ */ React15.createElement(DeveloperLinkSection, {
1894
2005
  developerLink
1895
2006
  }) : null)))));
1896
2007
  }, "SummarySection");
@@ -1901,7 +2012,7 @@ var defaultDescription = [
1901
2012
  ];
1902
2013
  var DefaultComingSoon = /* @__PURE__ */ __name(({ children, desc = defaultDescription, developerLink = "https://xylabs.com", name, dappIconSvg, version }) => {
1903
2014
  const theme = useTheme5();
1904
- return /* @__PURE__ */ React14.createElement(Container, {
2015
+ return /* @__PURE__ */ React16.createElement(Container, {
1905
2016
  maxWidth: "md",
1906
2017
  sx: {
1907
2018
  minHeight: "100%",
@@ -1909,40 +2020,40 @@ var DefaultComingSoon = /* @__PURE__ */ __name(({ children, desc = defaultDescri
1909
2020
  paddingTop: 2,
1910
2021
  width: "100%"
1911
2022
  }
1912
- }, version ? null : /* @__PURE__ */ React14.createElement(FlexRow5, {
2023
+ }, version ? null : /* @__PURE__ */ React16.createElement(FlexRow6, {
1913
2024
  width: "100%",
1914
2025
  paddingBottom: 2
1915
- }, /* @__PURE__ */ React14.createElement(Chip, {
2026
+ }, /* @__PURE__ */ React16.createElement(Chip, {
1916
2027
  label: "This app is not yet publicly available on xyOS",
1917
2028
  sx: {
1918
2029
  backgroundColor: alpha3(theme.palette.info.main, 0.2),
1919
2030
  color: theme.palette.info.main,
1920
2031
  width: "100%"
1921
2032
  }
1922
- })), /* @__PURE__ */ React14.createElement(FlexGrowCol3, {
2033
+ })), /* @__PURE__ */ React16.createElement(FlexGrowCol3, {
1923
2034
  width: "100%",
1924
2035
  alignItems: "flex-start",
1925
2036
  minHeight: "100%"
1926
- }, /* @__PURE__ */ React14.createElement(FlexGrowCol3, {
2037
+ }, /* @__PURE__ */ React16.createElement(FlexGrowCol3, {
1927
2038
  width: "100%",
1928
2039
  alignItems: "stretch",
1929
2040
  justifyContent: "flex-start",
1930
2041
  gap: 2
1931
- }, /* @__PURE__ */ React14.createElement(SummarySection, {
2042
+ }, /* @__PURE__ */ React16.createElement(SummarySection, {
1932
2043
  dappIconSvg,
1933
2044
  name,
1934
2045
  version,
1935
2046
  developerLink
1936
- }), /* @__PURE__ */ React14.createElement(InstallButtonSection, null), /* @__PURE__ */ React14.createElement(Divider2, {
2047
+ }), /* @__PURE__ */ React16.createElement(InstallButtonSection, null), /* @__PURE__ */ React16.createElement(Divider2, {
1937
2048
  flexItem: true
1938
- }), /* @__PURE__ */ React14.createElement(Card2, null, /* @__PURE__ */ React14.createElement(CardContent3, null, /* @__PURE__ */ React14.createElement(FlexGrowCol3, {
2049
+ }), /* @__PURE__ */ React16.createElement(Card2, null, /* @__PURE__ */ React16.createElement(CardContent3, null, /* @__PURE__ */ React16.createElement(FlexGrowCol3, {
1939
2050
  justifyContent: "flex-start",
1940
2051
  alignItems: "flex-start"
1941
- }, /* @__PURE__ */ React14.createElement(Typography4, {
2052
+ }, /* @__PURE__ */ React16.createElement(Typography5, {
1942
2053
  variant: "h6",
1943
2054
  gutterBottom: true
1944
2055
  }, "Learn more about", " ", name), desc?.map((paragraph, index) => {
1945
- return /* @__PURE__ */ React14.createElement(Typography4, {
2056
+ return /* @__PURE__ */ React16.createElement(Typography5, {
1946
2057
  gutterBottom: true,
1947
2058
  paddingBottom: 1,
1948
2059
  key: index,
@@ -2011,147 +2122,6 @@ var XyOsUi = class extends XyOs {
2011
2122
  }
2012
2123
  };
2013
2124
 
2014
- // src/modules/Dapp/modules/access-interface/components/Dialog.tsx
2015
- import { ArrowForward } from "@mui/icons-material";
2016
- import { Alert, Button, Dialog as Dialog2, DialogActions as DialogActions2, DialogContent as DialogContent2, DialogTitle, Typography as Typography5 } from "@mui/material";
2017
- import { ErrorRender } from "@xylabs/react-error";
2018
- import { FlexCol as FlexCol5, FlexRow as FlexRow6 } from "@xylabs/react-flexbox";
2019
- import { RegisteredNames } from "@xyo-network/os-model";
2020
- import { AccessNodeQueries } from "@xyo-network/os-runtime";
2021
- import React15, { useState as useState9 } from "react";
2022
- var DappAccessDialog = /* @__PURE__ */ __name(({ accessRequest, children, dappNode, registeredDappAccess, ...props }) => {
2023
- const [error, setError] = useState9();
2024
- const [noPayloadsInserted, setNoPayloadsInserted] = useState9(false);
2025
- const onClose = /* @__PURE__ */ __name(() => {
2026
- setNoPayloadsInserted(false);
2027
- props.onClose?.({}, "escapeKeyDown");
2028
- }, "onClose");
2029
- const handleAllow = /* @__PURE__ */ __name(() => {
2030
- if (accessRequest && registeredDappAccess && dappNode) {
2031
- try {
2032
- switch (registeredDappAccess.name) {
2033
- case RegisteredNames: {
2034
- const accessNodeQueries = new AccessNodeQueries(dappNode, accessRequest, registeredDappAccess);
2035
- accessNodeQueries.run().then((payloads) => {
2036
- if (payloads.length === 0) {
2037
- setNoPayloadsInserted(true);
2038
- } else {
2039
- onClose();
2040
- }
2041
- return;
2042
- }).catch((e) => {
2043
- setError(e);
2044
- });
2045
- }
2046
- default: {
2047
- const message = `no helper for interface ${registeredDappAccess.name} found`;
2048
- console.error(message);
2049
- setError(new Error(message));
2050
- }
2051
- }
2052
- } catch (e) {
2053
- console.error(e);
2054
- setError(e);
2055
- }
2056
- } else {
2057
- setError(new Error("No registered dapp access or dappNode found"));
2058
- }
2059
- }, "handleAllow");
2060
- return /* @__PURE__ */ React15.createElement(Dialog2, props, /* @__PURE__ */ React15.createElement(DialogTitle, null, "Message from XYO OS"), /* @__PURE__ */ React15.createElement(DialogContent2, {
2061
- dividers: true,
2062
- sx: {
2063
- display: "flex",
2064
- flexDirection: "column",
2065
- gap: 3
2066
- }
2067
- }, /* @__PURE__ */ React15.createElement(ErrorRender, {
2068
- error,
2069
- scope: "DappAccessDialog"
2070
- }), /* @__PURE__ */ React15.createElement(FlexCol5, {
2071
- gap: 1
2072
- }, /* @__PURE__ */ React15.createElement(Typography5, {
2073
- variant: "subtitle2"
2074
- }, "dApp to dApp Access Request"), /* @__PURE__ */ React15.createElement(FlexRow6, {
2075
- gap: 1
2076
- }, /* @__PURE__ */ React15.createElement(Typography5, {
2077
- fontSize: 16
2078
- }, /* @__PURE__ */ React15.createElement("strong", null, accessRequest?.requestingDappId), "\xA0"), /* @__PURE__ */ React15.createElement(ArrowForward, null), /* @__PURE__ */ React15.createElement(Typography5, {
2079
- fontSize: 16
2080
- }, /* @__PURE__ */ React15.createElement("strong", null, registeredDappAccess?.registeringDappId))))), /* @__PURE__ */ React15.createElement(DialogContent2, {
2081
- dividers: true,
2082
- sx: {
2083
- display: "flex",
2084
- flexDirection: "column",
2085
- gap: 3
2086
- }
2087
- }, /* @__PURE__ */ React15.createElement(FlexCol5, {
2088
- gap: 1
2089
- }, /* @__PURE__ */ React15.createElement(Typography5, null, /* @__PURE__ */ React15.createElement("strong", null, accessRequest?.requestingDappId), " ", "dApp would like to access your", /* @__PURE__ */ React15.createElement("strong", null, registeredDappAccess?.name), " ", "from", " ", /* @__PURE__ */ React15.createElement("strong", null, registeredDappAccess?.registeringDappId), " ", "dApp")), noPayloadsInserted ? /* @__PURE__ */ React15.createElement(Alert, {
2090
- severity: "warning"
2091
- }, registeredDappAccess?.name, " ", "Access Request did not find payloads to insert") : null), children ? /* @__PURE__ */ React15.createElement(DialogContent2, {
2092
- dividers: true
2093
- }, children) : null, /* @__PURE__ */ React15.createElement(DialogActions2, null, /* @__PURE__ */ React15.createElement(Button, {
2094
- variant: "outlined",
2095
- onClick: onClose
2096
- }, "Cancel"), /* @__PURE__ */ React15.createElement(Button, {
2097
- variant: "contained",
2098
- onClick: handleAllow
2099
- }, "Allow")));
2100
- }, "DappAccessDialog");
2101
-
2102
- // src/modules/Dapp/modules/access-interface/components/Flexbox.tsx
2103
- import { ErrorRender as ErrorRender2 } from "@xylabs/react-error";
2104
- import React16 from "react";
2105
-
2106
- // src/modules/Dapp/modules/access-interface/hooks/useDialogState.tsx
2107
- import { usePromise as usePromise10 } from "@xylabs/react-promise";
2108
- import { isRegisteredDappAccess, RegisteredNames as RegisteredNames2 } from "@xyo-network/os-model";
2109
- import { useState as useState10 } from "react";
2110
- var useDialogState = /* @__PURE__ */ __name((context) => {
2111
- const dappCaller = useDappCaller();
2112
- const { accessRequests } = DappAccessRequestResourceHooks.resourceViewsFromContext(context);
2113
- const [openAccessDialog, setOpenAccessDialog] = useState10(false);
2114
- const [registeredInterface, setRegisteredInterface] = useState10();
2115
- const [, allowAccessDialogError] = usePromise10(async () => {
2116
- const accessRequest = accessRequests?.[0];
2117
- if (accessRequest && context && dappCaller) {
2118
- setOpenAccessDialog(true);
2119
- const payload = await dappCaller.getRegisteredDappAccessByName(RegisteredNames2);
2120
- setRegisteredInterface(isRegisteredDappAccess(payload) ? payload : void 0);
2121
- }
2122
- }, [
2123
- accessRequests,
2124
- dappCaller,
2125
- context
2126
- ]);
2127
- return {
2128
- accessRequests,
2129
- allowAccessDialogError,
2130
- openAccessDialog,
2131
- registeredInterface,
2132
- setOpenAccessDialog
2133
- };
2134
- }, "useDialogState");
2135
-
2136
- // src/modules/Dapp/modules/access-interface/components/Flexbox.tsx
2137
- var DappAccessFlexbox = /* @__PURE__ */ __name(({ context }) => {
2138
- const { accessRequests, allowAccessDialogError, openAccessDialog, registeredInterface, setOpenAccessDialog } = useDialogState(context);
2139
- return /* @__PURE__ */ React16.createElement(DappAccessDialog, {
2140
- accessRequest: accessRequests?.[0],
2141
- dappNode: context,
2142
- open: openAccessDialog,
2143
- onClose: /* @__PURE__ */ __name(() => setOpenAccessDialog(false), "onClose"),
2144
- registeredDappAccess: registeredInterface
2145
- }, allowAccessDialogError ? /* @__PURE__ */ React16.createElement(ErrorRender2, {
2146
- error: allowAccessDialogError,
2147
- scope: "DappAccessFlexbox"
2148
- }) : null);
2149
- }, "DappAccessFlexbox");
2150
-
2151
- // src/modules/Dapp/modules/Window/hooks/menu/useDappMenu.tsx
2152
- import { useEffect as useEffect12, useRef as useRef4, useState as useState11 } from "react";
2153
- import { useNavigate as useNavigate4, useParams as useParams2 } from "react-router-dom";
2154
-
2155
2125
  // src/modules/Dapp/modules/Window/hooks/lib/DappPathHelpers.ts
2156
2126
  import { NameTransforms as NameTransforms2 } from "@xyo-network/os-runtime";
2157
2127
  var DappPathHelpers = {
@@ -2180,6 +2150,23 @@ var DappPathHelpers = {
2180
2150
  }
2181
2151
  };
2182
2152
 
2153
+ // src/modules/Dapp/modules/Window/hooks/lib/deriveDappState.ts
2154
+ import { DappIntentTypes as DappIntentTypes7 } from "@xyo-network/os-model";
2155
+ var deriveDappState = /* @__PURE__ */ __name((intent, context) => {
2156
+ const minimized = intent?.intent === DappIntentTypes7.Minimize;
2157
+ const open = intent?.intent === DappIntentTypes7.Launch;
2158
+ const active = !!(context && open);
2159
+ return {
2160
+ active,
2161
+ minimized,
2162
+ open
2163
+ };
2164
+ }, "deriveDappState");
2165
+
2166
+ // src/modules/Dapp/modules/Window/hooks/menu/useDappMenu.tsx
2167
+ import { useEffect as useEffect12, useRef as useRef4, useState as useState11 } from "react";
2168
+ import { useNavigate as useNavigate4, useParams as useParams2 } from "react-router-dom";
2169
+
2183
2170
  // src/modules/Dapp/modules/Window/hooks/useDappMenuResourceValues.tsx
2184
2171
  import { useMemo as useMemo10 } from "react";
2185
2172
  var useDappMenuDependencies = /* @__PURE__ */ __name((context) => {
@@ -2302,7 +2289,7 @@ var useManageDappInjectableParamsFromRoute = /* @__PURE__ */ __name((context) =>
2302
2289
 
2303
2290
  // src/modules/Dapp/modules/Window/hooks/route/helpers/useManageDappIntentRequest.tsx
2304
2291
  import { useAtomicPromise, usePromise as usePromise12 } from "@xylabs/react-promise";
2305
- import { DappIntentTypes as DappIntentTypes7, isDappIntent } from "@xyo-network/os-model";
2292
+ import { DappIntentTypes as DappIntentTypes8, isDappIntent } from "@xyo-network/os-model";
2306
2293
  import { DappIntentCaller as DappIntentCaller4 } from "@xyo-network/os-runtime";
2307
2294
  import { useEffect as useEffect13, useState as useState12 } from "react";
2308
2295
  var useManageDappIntentRequest = /* @__PURE__ */ __name((context, dappId) => {
@@ -2323,7 +2310,7 @@ var useManageDappIntentRequest = /* @__PURE__ */ __name((context, dappId) => {
2323
2310
  useAtomicPromise("manageDappIntent", async () => {
2324
2311
  if (context && intentPayload?.targetDappId && dappId && sendIntent) {
2325
2312
  try {
2326
- const minimizeIntent = DappIntentCaller4.buildIntent(DappIntentCaller4.OsDappName, DappIntentTypes7.Minimize, dappId);
2313
+ const minimizeIntent = DappIntentCaller4.buildIntent(DappIntentCaller4.OsDappName, DappIntentTypes8.Minimize, dappId);
2327
2314
  await sendIntent(minimizeIntent);
2328
2315
  await sendIntent(intentPayload);
2329
2316
  } catch (e) {
@@ -2416,7 +2403,7 @@ var useManageDappPathFromRoute = /* @__PURE__ */ __name((context, dappName) => {
2416
2403
 
2417
2404
  // src/modules/Dapp/modules/Window/hooks/route/helpers/useManageDappStateFromRoute.tsx
2418
2405
  import { usePromise as usePromise14 } from "@xylabs/react-promise";
2419
- import { DappIntentTypes as DappIntentTypes8 } from "@xyo-network/os-model";
2406
+ import { DappIntentTypes as DappIntentTypes9 } from "@xyo-network/os-model";
2420
2407
  import { DappIntentCaller as DappIntentCaller5, NameTransforms as NameTransforms3 } from "@xyo-network/os-runtime";
2421
2408
  import { useNavigationType, useParams as useParams5 } from "react-router-dom";
2422
2409
  var useManageDappStateFromRoute = /* @__PURE__ */ __name((intentPayload, dappName) => {
@@ -2426,9 +2413,9 @@ var useManageDappStateFromRoute = /* @__PURE__ */ __name((intentPayload, dappNam
2426
2413
  const navigationType = useNavigationType();
2427
2414
  const intentCaller = useDappIntentCaller();
2428
2415
  usePromise14(async () => {
2429
- const launched = intentPayload?.intent === DappIntentTypes8.Launch;
2416
+ const launched = intentPayload?.intent === DappIntentTypes9.Launch;
2430
2417
  if (launched && dappNameParam === void 0 && sendIntent && navigationType === "POP") {
2431
- const closeIntent = DappIntentCaller5.buildIntent(DappIntentCaller5.OsDappName, DappIntentTypes8.Close, dappName);
2418
+ const closeIntent = DappIntentCaller5.buildIntent(DappIntentCaller5.OsDappName, DappIntentTypes9.Close, dappName);
2432
2419
  await sendIntent(closeIntent);
2433
2420
  }
2434
2421
  }, [
@@ -2441,13 +2428,13 @@ var useManageDappStateFromRoute = /* @__PURE__ */ __name((intentPayload, dappNam
2441
2428
  usePromise14(async () => {
2442
2429
  if (dappNameParam && dappName && sendIntent && intentCaller) {
2443
2430
  const dappNameParamDeSlugged = new NameTransforms3(dappNameParam).deSlug();
2444
- const notLaunched = intentPayload?.intent !== DappIntentTypes8.Launch;
2431
+ const notLaunched = intentPayload?.intent !== DappIntentTypes9.Launch;
2445
2432
  const paramMatchesDappName = dappNameParamDeSlugged === dappName;
2446
2433
  if (notLaunched && paramMatchesDappName) {
2447
2434
  const latestIntent = await intentCaller.latestIntent();
2448
2435
  const existing = latestIntent && latestIntent.targetDappId === dappNameParamDeSlugged;
2449
2436
  if (!existing) {
2450
- const launchIntent = DappIntentCaller5.buildIntent(DappIntentCaller5.OsDappName, DappIntentTypes8.Launch, dappNameParamDeSlugged);
2437
+ const launchIntent = DappIntentCaller5.buildIntent(DappIntentCaller5.OsDappName, DappIntentTypes9.Launch, dappNameParamDeSlugged);
2451
2438
  await sendIntent(launchIntent);
2452
2439
  return;
2453
2440
  }
@@ -2474,19 +2461,6 @@ var useManageDappBasedOffRoute = /* @__PURE__ */ __name((intentPayload, dappName
2474
2461
  ];
2475
2462
  }, "useManageDappBasedOffRoute");
2476
2463
 
2477
- // src/modules/Dapp/modules/Window/hooks/useDappState.tsx
2478
- import { DappIntentTypes as DappIntentTypes9 } from "@xyo-network/os-model";
2479
- var dappState = /* @__PURE__ */ __name((intentType, context) => {
2480
- const minimized = intentType === DappIntentTypes9.Minimize;
2481
- const open = intentType === DappIntentTypes9.Launch;
2482
- const active = context && open;
2483
- return {
2484
- active,
2485
- minimized,
2486
- open
2487
- };
2488
- }, "dappState");
2489
-
2490
2464
  // src/modules/Dapp/modules/Window/NodeManifest.tsx
2491
2465
  import { usePromise as usePromise15 } from "@xylabs/react-promise";
2492
2466
  import { useProvidedNode } from "@xyo-network/react-node";
@@ -3165,13 +3139,11 @@ var DappMenuDrawer = /* @__PURE__ */ __name(({ activePath, context, iconSvg, nam
3165
3139
  }, "DappMenuDrawer");
3166
3140
 
3167
3141
  // src/modules/Dapp/modules/Window/DappWindow.tsx
3168
- var DappWindow = /* @__PURE__ */ __name(({ dappSet, xnsNodeUrl, xnsNetwork }) => {
3169
- const { DappComponent, dapp, name, scrollable = true, version } = decomposeDappSet(dappSet);
3170
- const { dappWallet, context, nodeCreateError } = useDappContextCreator(xnsNodeUrl, xnsNetwork, dapp);
3171
- const { dappIntentType: intentType, intentPayload } = useDappIntentListener(name);
3172
- const { active, minimized, open } = dappState(intentType, context);
3142
+ var DappWindow = /* @__PURE__ */ __name(({ context, dappSet, dappState, dappWallet, intent, nodeCreateError }) => {
3143
+ const { DappComponent, name, scrollable = true, version } = decomposeDappSet(dappSet);
3144
+ const { active, minimized, open } = dappState ?? {};
3173
3145
  const TypedDappComponent = useMemo12(() => DappComponent, []);
3174
- const errors = useManageDappBasedOffRoute(intentPayload, name, context);
3146
+ const errors = useManageDappBasedOffRoute(intent, name, context);
3175
3147
  useSyncOsRegisteredAccessInterfaces(context);
3176
3148
  const { activePath, error: menuError, menuConfig, menuItemsVisible, onPathChange } = useDappMenu(context, name);
3177
3149
  const resolvedError = nodeCreateError || menuError;
@@ -3204,9 +3176,9 @@ var DappWindow = /* @__PURE__ */ __name(({ dappSet, xnsNodeUrl, xnsNetwork }) =>
3204
3176
  }),
3205
3177
  /* Ensure that loading goes away when error occurs */
3206
3178
  splashScreen: resolvedError ? null : /* @__PURE__ */ React25.createElement(DappLoadingFlexbox, {
3207
- minimize: minimized,
3179
+ minimize: !!minimized,
3208
3180
  name,
3209
- open
3181
+ open: !!open
3210
3182
  })
3211
3183
  }, resolvedError || errors?.length > 0 ? /* @__PURE__ */ React25.createElement(FlexCol10, {
3212
3184
  padding: 2
@@ -3242,16 +3214,30 @@ var DappWindow = /* @__PURE__ */ __name(({ dappSet, xnsNodeUrl, xnsNetwork }) =>
3242
3214
  }, "DappWindow");
3243
3215
 
3244
3216
  // src/modules/Dapp/Container.tsx
3245
- var DappContainer = /* @__PURE__ */ __name(({ dappSet, xnsNodeUrl, xnsNetwork }) => {
3217
+ var DappContainer = /* @__PURE__ */ __name(({ currentIntent, dappSet, xnsNodeUrl, xnsNetwork }) => {
3246
3218
  const { dapp, dappIcon } = dappSet;
3219
+ const { dappWallet, context, nodeCreateError } = useDappContextCreator(xnsNodeUrl, xnsNetwork, dapp, currentIntent);
3220
+ const dappState = useMemo13(() => {
3221
+ if (currentIntent?.targetDappId === dapp.config.name) {
3222
+ return deriveDappState(currentIntent, context);
3223
+ }
3224
+ }, [
3225
+ currentIntent,
3226
+ context,
3227
+ dapp
3228
+ ]);
3247
3229
  return /* @__PURE__ */ React26.createElement(DappIconButton, {
3248
3230
  dappIcon,
3249
3231
  dappIconSvg: dapp.params.iconSvg,
3250
- dappName: dapp?.config.name
3232
+ dappName: dapp?.config.name,
3233
+ dappState
3251
3234
  }, /* @__PURE__ */ React26.createElement(DappWindow, {
3235
+ context,
3252
3236
  dappSet,
3253
- xnsNodeUrl,
3254
- xnsNetwork
3237
+ dappState,
3238
+ dappWallet,
3239
+ intent: currentIntent,
3240
+ nodeCreateError
3255
3241
  }));
3256
3242
  }, "DappContainer");
3257
3243
 
@@ -3274,7 +3260,7 @@ var ContainerFlexbox = /* @__PURE__ */ __name(({ children, containerProps, scrol
3274
3260
 
3275
3261
  // src/modules/Dapp/Page/Row.tsx
3276
3262
  import { Divider as Divider4, Fade as Fade2, styled as styled5 } from "@mui/material";
3277
- import React29, { useMemo as useMemo13 } from "react";
3263
+ import React29, { useMemo as useMemo14 } from "react";
3278
3264
 
3279
3265
  // src/modules/Dapp/Page/DividerChip.tsx
3280
3266
  import { Chip as Chip2, CircularProgress } from "@mui/material";
@@ -3298,10 +3284,11 @@ var DividerChip = /* @__PURE__ */ __name(({ registeredDapps, ...props }) => {
3298
3284
 
3299
3285
  // src/modules/Dapp/Page/Row.tsx
3300
3286
  var DappsRow = /* @__PURE__ */ __name(({ chipLabel, installType, registeredDappsSet, xnsNetwork, xnsNodeUrl }) => {
3301
- const filteredRegisteredDappSets = useMemo13(() => DappInstallTypeFilters[installType](registeredDappsSet), [
3287
+ const filteredRegisteredDappSets = useMemo14(() => DappInstallTypeFilters[installType](registeredDappsSet), [
3302
3288
  installType,
3303
3289
  registeredDappsSet
3304
3290
  ]);
3291
+ const { intentPayload } = useDappIntentListener(null);
3305
3292
  return /* @__PURE__ */ React29.createElement(React29.Fragment, null, /* @__PURE__ */ React29.createElement(Divider4, {
3306
3293
  variant: "middle",
3307
3294
  sx: {
@@ -3315,6 +3302,7 @@ var DappsRow = /* @__PURE__ */ __name(({ chipLabel, installType, registeredDapps
3315
3302
  in: !!filteredRegisteredDappSets?.length,
3316
3303
  timeout: 1e3
3317
3304
  }, /* @__PURE__ */ React29.createElement(StyledGridContainer, null, filteredRegisteredDappSets?.map((dappSet, index) => /* @__PURE__ */ React29.createElement(DappContainer, {
3305
+ currentIntent: intentPayload,
3318
3306
  key: index,
3319
3307
  dappSet,
3320
3308
  xnsNodeUrl,
@@ -3337,11 +3325,11 @@ var StyledGridContainer = styled5("div", {
3337
3325
  import { SignalCellularAltOutlined } from "@mui/icons-material";
3338
3326
  import { Tooltip as Tooltip5, useTheme as useTheme8 } from "@mui/material";
3339
3327
  import { useColorSchemeEx as useColorSchemeEx3 } from "@xylabs/react-invertible-theme";
3340
- import React30, { useMemo as useMemo16 } from "react";
3328
+ import React30, { useMemo as useMemo17 } from "react";
3341
3329
 
3342
3330
  // src/modules/network/hooks/useOsNetwork.tsx
3343
3331
  import { OsPubSubNetworkReadyEvent } from "@xyo-network/os-runtime";
3344
- import { useMemo as useMemo14 } from "react";
3332
+ import { useMemo as useMemo15 } from "react";
3345
3333
 
3346
3334
  // src/modules/network/hooks/lib/createNetworkState.ts
3347
3335
  import { assertEx as assertEx8 } from "@xylabs/assert";
@@ -3369,7 +3357,7 @@ var createNetworkState = /* @__PURE__ */ __name((stackReady) => {
3369
3357
  var useOsNetwork = /* @__PURE__ */ __name(() => {
3370
3358
  const context = useXyOsUiContext();
3371
3359
  const stackReady = useStackReady(OsPubSubNetworkReadyEvent, "osPubSubNetworkStack", context);
3372
- const networkState = useMemo14(() => {
3360
+ const networkState = useMemo15(() => {
3373
3361
  return createNetworkState(stackReady);
3374
3362
  }, [
3375
3363
  context,
@@ -3380,11 +3368,11 @@ var useOsNetwork = /* @__PURE__ */ __name(() => {
3380
3368
 
3381
3369
  // src/modules/network/hooks/useXyoPublicNetwork.tsx
3382
3370
  import { OsXyoPublicNetworkReadyEvent } from "@xyo-network/os-runtime";
3383
- import { useMemo as useMemo15 } from "react";
3371
+ import { useMemo as useMemo16 } from "react";
3384
3372
  var useXyoPublicNetwork = /* @__PURE__ */ __name(() => {
3385
3373
  const context = useXyOsUiContext();
3386
3374
  const stackReady = useStackReady(OsXyoPublicNetworkReadyEvent, "xyoPublicNetworkStack", context);
3387
- const networkState = useMemo15(() => {
3375
+ const networkState = useMemo16(() => {
3388
3376
  return createNetworkState(stackReady);
3389
3377
  }, [
3390
3378
  context,
@@ -3464,7 +3452,7 @@ var NetworkLoadingIndicator = /* @__PURE__ */ __name(({ highContrast }) => {
3464
3452
  const successColor = highContrast ? highContrastSuccessColor : theme.palette.success.main;
3465
3453
  const highContrastErrorColor = darkMode ? theme.palette.success.dark : theme.palette.error.main;
3466
3454
  const errorColor = highContrast ? highContrastErrorColor : theme.palette.error.main;
3467
- const NetworkComponent = useMemo16(() => {
3455
+ const NetworkComponent = useMemo17(() => {
3468
3456
  if (networkReady) {
3469
3457
  const connectionReady = true;
3470
3458
  return connectionReady ? () => /* @__PURE__ */ React30.createElement(Tooltip5, {
@@ -4436,10 +4424,10 @@ import React52 from "react";
4436
4424
 
4437
4425
  // src/dapps/shared/table/head/hooks/useVisibleColumns.tsx
4438
4426
  import { useMediaQuery as useMediaQuery2 } from "@mui/material";
4439
- import { useMemo as useMemo17 } from "react";
4427
+ import { useMemo as useMemo18 } from "react";
4440
4428
  var useVisibleColumns = /* @__PURE__ */ __name((tableHeadCells) => {
4441
4429
  const isMedium = useMediaQuery2((theme) => theme.breakpoints.down("lg"));
4442
- const VisibleTableCells = useMemo17(() => {
4430
+ const VisibleTableCells = useMemo18(() => {
4443
4431
  return isMedium ? tableHeadCells.filter((cell) => cell.showOnMobile) : tableHeadCells;
4444
4432
  }, [
4445
4433
  isMedium,
@@ -4518,7 +4506,7 @@ var NextIteratorFlexbox = /* @__PURE__ */ __name(({ next: changePage, loading, .
4518
4506
 
4519
4507
  // src/settings/Theme/ThemeProvider.tsx
4520
4508
  import { InvertibleMuiThemeProvider } from "@xylabs/react-invertible-theme";
4521
- import React54, { useMemo as useMemo18 } from "react";
4509
+ import React54, { useMemo as useMemo19 } from "react";
4522
4510
 
4523
4511
  // src/settings/Theme/ThemeCssVars.ts
4524
4512
  import { alpha as alpha9, createTheme, darken as darken2, lighten } from "@mui/material";
@@ -4813,7 +4801,7 @@ var ThemeCssVars = createTheme({
4813
4801
 
4814
4802
  // src/settings/Theme/ThemeProvider.tsx
4815
4803
  var AppOsThemeProvider = /* @__PURE__ */ __name(({ children }) => {
4816
- const initialValue = useMemo18(() => {
4804
+ const initialValue = useMemo19(() => {
4817
4805
  const validValues = [
4818
4806
  "light",
4819
4807
  "dark"
@@ -4861,6 +4849,7 @@ export {
4861
4849
  DappMenuDrawer,
4862
4850
  DappMenuResourceHooks,
4863
4851
  DappPage,
4852
+ DappPathHelpers,
4864
4853
  DappPathSwitcher,
4865
4854
  DappTitle,
4866
4855
  DappWindow,
@@ -4894,7 +4883,6 @@ export {
4894
4883
  TableHeadEx,
4895
4884
  TwoToneBulletPoint,
4896
4885
  TwoToneBulletPointList,
4897
- UpperWidgetTrayLayout,
4898
4886
  WidgetCaller,
4899
4887
  WidgetCard,
4900
4888
  WidgetCardExamples,
@@ -4903,8 +4891,8 @@ export {
4903
4891
  XyOsUi,
4904
4892
  XyOsUiContext,
4905
4893
  XyOsUiContextProvider,
4906
- dappState,
4907
4894
  decomposeDappSet,
4895
+ deriveDappState,
4908
4896
  detectCustomer,
4909
4897
  getApiDomain,
4910
4898
  getNodePaletteByNameCode,