@xyo-network/os-react-runtime 4.1.4 → 4.2.0-rc.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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 +411 -417
  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 +3 -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 +25 -19
  27. package/src/modules/Dapp/Button/IconEx.tsx +16 -13
  28. package/src/modules/Dapp/Container.tsx +33 -5
  29. package/src/modules/Dapp/Page/Row.tsx +13 -2
  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, { memo, 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,23 +631,23 @@ 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();
642
+ const targetedDapp = !!(dapp && context && currentIntent?.targetDappId === dapp?.config.name);
718
643
  const windowDappNodeSetRef = useRef(windowDappNodeSet);
719
- useEffect8(() => {
644
+ useEffect7(() => {
720
645
  windowDappNodeSetRef.current = windowDappNodeSet;
721
646
  }, [
722
647
  windowDappNodeSet
723
648
  ]);
724
649
  const createNode = useCallback3(async () => {
725
- if (dapp && context) {
650
+ if (targetedDapp) {
726
651
  try {
727
652
  const windowDappNodeSet2 = await RunningDappCache.findOrCreate(dapp, context, allowedNames ?? [], xnsNodeUrl, xnsNetwork);
728
653
  setWindowDappNodeSet(windowDappNodeSet2);
@@ -732,10 +657,11 @@ var useDappContextCreator = /* @__PURE__ */ __name((xnsNodeUrl, xnsNetwork, dapp
732
657
  }
733
658
  }, [
734
659
  dapp,
660
+ currentIntent,
735
661
  context,
736
662
  allowedNames
737
663
  ]);
738
- useEffect8(() => {
664
+ useEffect7(() => {
739
665
  if (createOnMount) {
740
666
  void (async () => {
741
667
  await createNode();
@@ -746,26 +672,28 @@ var useDappContextCreator = /* @__PURE__ */ __name((xnsNodeUrl, xnsNetwork, dapp
746
672
  createNode
747
673
  ]);
748
674
  useAsyncEffect2(async () => {
749
- switch (intentType) {
750
- case DappIntentTypes4.Launch: {
751
- await createNode();
752
- break;
753
- }
754
- case DappIntentTypes4.Close: {
755
- if (windowDappNodeSetRef.current.context) {
756
- await DappContextCreator.resetDappArchivist(windowDappNodeSetRef.current.context);
757
- setWindowDappNodeSet({
758
- context: null,
759
- dappWallet: void 0
760
- });
675
+ if (targetedDapp) {
676
+ switch (currentIntent?.intent) {
677
+ case DappIntentTypes4.Launch: {
678
+ await createNode();
679
+ break;
761
680
  }
762
- break;
681
+ case DappIntentTypes4.Close: {
682
+ if (windowDappNodeSetRef.current.context) {
683
+ await DappContextCreator.resetDappArchivist(windowDappNodeSetRef.current.context);
684
+ setWindowDappNodeSet({
685
+ context: null,
686
+ dappWallet: void 0
687
+ });
688
+ }
689
+ break;
690
+ }
691
+ case DappIntentTypes4.Minimize:
763
692
  }
764
- case DappIntentTypes4.Minimize:
765
693
  }
766
694
  }, [
767
695
  createNode,
768
- intentType
696
+ currentIntent
769
697
  ]);
770
698
  return {
771
699
  ...windowDappNodeSet,
@@ -775,11 +703,11 @@ var useDappContextCreator = /* @__PURE__ */ __name((xnsNodeUrl, xnsNetwork, dapp
775
703
 
776
704
  // src/hooks/os/useDappRegistrationResults.tsx
777
705
  import { EventBusPubSubConnection } from "@xyo-network/os-runtime";
778
- import { useEffect as useEffect9, useState as useState6 } from "react";
706
+ import { useEffect as useEffect8, useState as useState4 } from "react";
779
707
  var useDappRegistrationResults = /* @__PURE__ */ __name(() => {
780
708
  const context = useXyOsUiContext();
781
- const [registeredDappSetResults, setRegisteredDappSetResults] = useState6();
782
- useEffect9(() => {
709
+ const [registeredDappSetResults, setRegisteredDappSetResults] = useState4();
710
+ useEffect8(() => {
783
711
  const listener = /* @__PURE__ */ __name(() => {
784
712
  setRegisteredDappSetResults(context?.dappRegistrationResults);
785
713
  }, "listener");
@@ -1089,29 +1017,6 @@ var WidgetCaller = class extends OsCallerBase {
1089
1017
  }
1090
1018
  };
1091
1019
 
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
1020
  // src/hooks/os/useWidgetDapps.tsx
1116
1021
  var useWidgetDapps = /* @__PURE__ */ __name((registeredDapps, widgetTrayLayout) => {
1117
1022
  const context = useXyOsUiContext();
@@ -1167,11 +1072,11 @@ var useDappIntentCaller = /* @__PURE__ */ __name((xyOsContext) => {
1167
1072
  }, "useDappIntentCaller");
1168
1073
 
1169
1074
  // src/hooks/useDebugClick.tsx
1170
- import { useCallback as useCallback4, useEffect as useEffect10, useRef as useRef2, useState as useState7 } from "react";
1075
+ import { useCallback as useCallback4, useEffect as useEffect9, useRef as useRef2, useState as useState5 } from "react";
1171
1076
  import { useNavigate as useNavigate2, useSearchParams } from "react-router-dom";
1172
1077
  var useDebugClick = /* @__PURE__ */ __name(() => {
1173
1078
  const [params, setParams] = useSearchParams();
1174
- const [debugOpen, setDebugOpen] = useState7(false);
1079
+ const [debugOpen, setDebugOpen] = useState5(false);
1175
1080
  const openFromClick = useRef2(false);
1176
1081
  const closeFromClick = useRef2(false);
1177
1082
  const initialized = useRef2(false);
@@ -1196,7 +1101,7 @@ var useDebugClick = /* @__PURE__ */ __name(() => {
1196
1101
  }, [
1197
1102
  navigate
1198
1103
  ]);
1199
- useEffect10(() => {
1104
+ useEffect9(() => {
1200
1105
  const initialOpen = openFromClick.current && !closeFromClick.current && params.has("debug");
1201
1106
  const backButtonClicked = openFromClick.current && !closeFromClick.current && !params.has("debug");
1202
1107
  if (initialOpen) {
@@ -1255,13 +1160,13 @@ import { useMemo as useMemo7 } from "react";
1255
1160
  // src/hooks/useStackReady.tsx
1256
1161
  import { assertEx as assertEx5 } from "@xylabs/assert";
1257
1162
  import { EventBusPubSubConnection as EventBusPubSubConnection2 } from "@xyo-network/os-runtime";
1258
- import { useEffect as useEffect11, useState as useState8 } from "react";
1163
+ import { useEffect as useEffect10, useState as useState6 } from "react";
1259
1164
  var useStackReady = /* @__PURE__ */ __name((stackReadyEvent, stackName, context) => {
1260
1165
  const providedContext = useXyOsUiContext();
1261
- const [stackReady, setStackReady] = useState8({
1166
+ const [stackReady, setStackReady] = useState6({
1262
1167
  ready: false
1263
1168
  });
1264
- useEffect11(() => {
1169
+ useEffect10(() => {
1265
1170
  const derivedContext = context ?? providedContext;
1266
1171
  const listener = /* @__PURE__ */ __name(() => {
1267
1172
  if (!derivedContext) throw new Error("no context found");
@@ -1375,6 +1280,83 @@ var useTabs = /* @__PURE__ */ __name(() => {
1375
1280
  ];
1376
1281
  }, "useTabs");
1377
1282
 
1283
+ // src/modules/Dapp/Button/hooks/useLaunchPoint.tsx
1284
+ import { useLayoutEffect, useState as useState8 } from "react";
1285
+
1286
+ // src/utils/DappInstallTypeFilters.ts
1287
+ import { isInstalledDappSet, isPreInstalledDappSet, isUnInstalledDappSet } from "@xyo-network/os-model";
1288
+ var DappInstallTypeFilters = {
1289
+ installed(registeredDappSets) {
1290
+ 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;
1291
+ },
1292
+ preInstalled(registeredDappSets) {
1293
+ 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;
1294
+ },
1295
+ uninstalled(registeredDappSets) {
1296
+ 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;
1297
+ }
1298
+ };
1299
+
1300
+ // src/utils/getApiDomain.ts
1301
+ var getApiDomain = /* @__PURE__ */ __name((localHost, apiDomain) => {
1302
+ if (apiDomain !== void 0) {
1303
+ return apiDomain;
1304
+ }
1305
+ if (localHost) {
1306
+ return "http://localhost:8080";
1307
+ }
1308
+ if (location.hostname.startsWith("beta")) {
1309
+ return "https://beta.archivist.xyo.network";
1310
+ }
1311
+ return "https://archivist.xyo.network";
1312
+ }, "getApiDomain");
1313
+
1314
+ // src/utils/useOnWindowResize.tsx
1315
+ import { useEffect as useEffect11, useState as useState7 } from "react";
1316
+ var useOnWindowResize = /* @__PURE__ */ __name(() => {
1317
+ const [resized, setResized] = useState7();
1318
+ useEffect11(() => {
1319
+ const onResize = /* @__PURE__ */ __name((event) => {
1320
+ setResized(event);
1321
+ }, "onResize");
1322
+ globalThis.addEventListener("resize", onResize, false);
1323
+ return () => {
1324
+ globalThis.removeEventListener("resize", onResize);
1325
+ };
1326
+ }, []);
1327
+ return resized;
1328
+ }, "useOnWindowResize");
1329
+
1330
+ // src/modules/Dapp/Button/hooks/useLaunchPoint.tsx
1331
+ var useLaunchPoint = /* @__PURE__ */ __name((spanRef) => {
1332
+ const [coordinates, setCoordinates] = useState8({
1333
+ left: 0,
1334
+ top: 0
1335
+ });
1336
+ const resized = useOnWindowResize();
1337
+ useLayoutEffect(() => {
1338
+ const rect = spanRef.current?.getBoundingClientRect() ?? null;
1339
+ if (rect) {
1340
+ const { width, height, left, top } = rect;
1341
+ setCoordinates({
1342
+ left: left + width / 2,
1343
+ top: top + height / 2
1344
+ });
1345
+ }
1346
+ }, [
1347
+ spanRef,
1348
+ resized
1349
+ ]);
1350
+ return coordinates;
1351
+ }, "useLaunchPoint");
1352
+
1353
+ // src/modules/Dapp/Button/IconEx.tsx
1354
+ import { Circle } from "@mui/icons-material";
1355
+ import { FlexCol as FlexCol2 } from "@xylabs/react-flexbox";
1356
+ import { DappIntentTypes as DappIntentTypes5 } from "@xyo-network/os-model";
1357
+ import { DappIntentCaller as DappIntentCaller2, XyOsMonitor as XyOsMonitor2 } from "@xyo-network/os-runtime";
1358
+ import React7, { useRef as useRef3 } from "react";
1359
+
1378
1360
  // src/modules/Dapp/lib/DefaultIconSize.ts
1379
1361
  var DEFAULT_ICON_SIZE = 84;
1380
1362
 
@@ -1525,19 +1507,15 @@ var StyledDefaultDappIcon = styled(TypographyEx, {
1525
1507
  }));
1526
1508
 
1527
1509
  // src/modules/Dapp/Button/IconEx.tsx
1528
- var DappIconButton = /* @__PURE__ */ __name(({ children, dappIcon, dappIconSvg, dappName, ...props }) => {
1510
+ var DappIconButton = /* @__PURE__ */ __name(({ children, dappIcon, dappIconSvg, dappName, dappState, ...props }) => {
1529
1511
  const { DappIconSize, color, nonSxProps, sx } = decomposeProps(dappIcon, props);
1530
1512
  const iconSize = DEFAULT_ICON_SIZE;
1513
+ const { active, minimized } = dappState ?? {};
1531
1514
  const sendIntent = useSendDappIntent();
1532
- const { dappIntentType: intentType } = useDappIntentListener(dappName);
1533
1515
  const iconButtonRef = useRef3(null);
1534
1516
  const { left: launchLeft, top: launchTop } = useLaunchPoint(iconButtonRef);
1535
- const minimized = intentType === DappIntentTypes5.Minimize;
1536
1517
  const MiddleEllipsisFunction = /* @__PURE__ */ __name((str) => {
1537
1518
  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
1519
  return str.slice(0, 15) + "..." + str.slice(-7, str.length - 7 + str.length);
1542
1520
  }
1543
1521
  return str;
@@ -1553,7 +1531,7 @@ var DappIconButton = /* @__PURE__ */ __name(({ children, dappIcon, dappIconSvg,
1553
1531
  justifyContent: "stretch"
1554
1532
  }, /* @__PURE__ */ React7.createElement(DappLaunchFrame, {
1555
1533
  id: "dapp-launch-frame",
1556
- open: intentType === DappIntentTypes5.Launch,
1534
+ open: !!active,
1557
1535
  launchLeft,
1558
1536
  launchTop
1559
1537
  }, children), /* @__PURE__ */ React7.createElement("span", {
@@ -1589,45 +1567,182 @@ var DappIconButton = /* @__PURE__ */ __name(({ children, dappIcon, dappIconSvg,
1589
1567
  }))));
1590
1568
  }, "DappIconButton");
1591
1569
 
1570
+ // src/modules/Dapp/modules/access-interface/components/Dialog.tsx
1571
+ import { ArrowForward } from "@mui/icons-material";
1572
+ import { Alert, Button, Dialog, DialogActions, DialogContent, DialogTitle, Typography as Typography2 } from "@mui/material";
1573
+ import { ErrorRender } from "@xylabs/react-error";
1574
+ import { FlexCol as FlexCol3, FlexRow as FlexRow2 } from "@xylabs/react-flexbox";
1575
+ import { RegisteredNames } from "@xyo-network/os-model";
1576
+ import { AccessNodeQueries } from "@xyo-network/os-runtime";
1577
+ import React8, { useState as useState9 } from "react";
1578
+ var DappAccessDialog = /* @__PURE__ */ __name(({ accessRequest, children, dappNode, registeredDappAccess, ...props }) => {
1579
+ const [error, setError] = useState9();
1580
+ const [noPayloadsInserted, setNoPayloadsInserted] = useState9(false);
1581
+ const onClose = /* @__PURE__ */ __name(() => {
1582
+ setNoPayloadsInserted(false);
1583
+ props.onClose?.({}, "escapeKeyDown");
1584
+ }, "onClose");
1585
+ const handleAllow = /* @__PURE__ */ __name(() => {
1586
+ if (accessRequest && registeredDappAccess && dappNode) {
1587
+ try {
1588
+ switch (registeredDappAccess.name) {
1589
+ case RegisteredNames: {
1590
+ const accessNodeQueries = new AccessNodeQueries(dappNode, accessRequest, registeredDappAccess);
1591
+ accessNodeQueries.run().then((payloads) => {
1592
+ if (payloads.length === 0) {
1593
+ setNoPayloadsInserted(true);
1594
+ } else {
1595
+ onClose();
1596
+ }
1597
+ return;
1598
+ }).catch((e) => {
1599
+ setError(e);
1600
+ });
1601
+ }
1602
+ default: {
1603
+ const message = `no helper for interface ${registeredDappAccess.name} found`;
1604
+ console.error(message);
1605
+ setError(new Error(message));
1606
+ }
1607
+ }
1608
+ } catch (e) {
1609
+ console.error(e);
1610
+ setError(e);
1611
+ }
1612
+ } else {
1613
+ setError(new Error("No registered dapp access or dappNode found"));
1614
+ }
1615
+ }, "handleAllow");
1616
+ return /* @__PURE__ */ React8.createElement(Dialog, props, /* @__PURE__ */ React8.createElement(DialogTitle, null, "Message from XYO OS"), /* @__PURE__ */ React8.createElement(DialogContent, {
1617
+ dividers: true,
1618
+ sx: {
1619
+ display: "flex",
1620
+ flexDirection: "column",
1621
+ gap: 3
1622
+ }
1623
+ }, /* @__PURE__ */ React8.createElement(ErrorRender, {
1624
+ error,
1625
+ scope: "DappAccessDialog"
1626
+ }), /* @__PURE__ */ React8.createElement(FlexCol3, {
1627
+ gap: 1
1628
+ }, /* @__PURE__ */ React8.createElement(Typography2, {
1629
+ variant: "subtitle2"
1630
+ }, "dApp to dApp Access Request"), /* @__PURE__ */ React8.createElement(FlexRow2, {
1631
+ gap: 1
1632
+ }, /* @__PURE__ */ React8.createElement(Typography2, {
1633
+ fontSize: 16
1634
+ }, /* @__PURE__ */ React8.createElement("strong", null, accessRequest?.requestingDappId), "\xA0"), /* @__PURE__ */ React8.createElement(ArrowForward, null), /* @__PURE__ */ React8.createElement(Typography2, {
1635
+ fontSize: 16
1636
+ }, /* @__PURE__ */ React8.createElement("strong", null, registeredDappAccess?.registeringDappId))))), /* @__PURE__ */ React8.createElement(DialogContent, {
1637
+ dividers: true,
1638
+ sx: {
1639
+ display: "flex",
1640
+ flexDirection: "column",
1641
+ gap: 3
1642
+ }
1643
+ }, /* @__PURE__ */ React8.createElement(FlexCol3, {
1644
+ gap: 1
1645
+ }, /* @__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, {
1646
+ severity: "warning"
1647
+ }, registeredDappAccess?.name, " ", "Access Request did not find payloads to insert") : null), children ? /* @__PURE__ */ React8.createElement(DialogContent, {
1648
+ dividers: true
1649
+ }, children) : null, /* @__PURE__ */ React8.createElement(DialogActions, null, /* @__PURE__ */ React8.createElement(Button, {
1650
+ variant: "outlined",
1651
+ onClick: onClose
1652
+ }, "Cancel"), /* @__PURE__ */ React8.createElement(Button, {
1653
+ variant: "contained",
1654
+ onClick: handleAllow
1655
+ }, "Allow")));
1656
+ }, "DappAccessDialog");
1657
+
1658
+ // src/modules/Dapp/modules/access-interface/components/Flexbox.tsx
1659
+ import { ErrorRender as ErrorRender2 } from "@xylabs/react-error";
1660
+ import React9 from "react";
1661
+
1662
+ // src/modules/Dapp/modules/access-interface/hooks/useDialogState.tsx
1663
+ import { usePromise as usePromise10 } from "@xylabs/react-promise";
1664
+ import { isRegisteredDappAccess, RegisteredNames as RegisteredNames2 } from "@xyo-network/os-model";
1665
+ import { useState as useState10 } from "react";
1666
+ var useDialogState = /* @__PURE__ */ __name((context) => {
1667
+ const dappCaller = useDappCaller();
1668
+ const { accessRequests } = DappAccessRequestResourceHooks.resourceViewsFromContext(context);
1669
+ const [openAccessDialog, setOpenAccessDialog] = useState10(false);
1670
+ const [registeredInterface, setRegisteredInterface] = useState10();
1671
+ const [, allowAccessDialogError] = usePromise10(async () => {
1672
+ const accessRequest = accessRequests?.[0];
1673
+ if (accessRequest && context && dappCaller) {
1674
+ setOpenAccessDialog(true);
1675
+ const payload = await dappCaller.getRegisteredDappAccessByName(RegisteredNames2);
1676
+ setRegisteredInterface(isRegisteredDappAccess(payload) ? payload : void 0);
1677
+ }
1678
+ }, [
1679
+ accessRequests,
1680
+ dappCaller,
1681
+ context
1682
+ ]);
1683
+ return {
1684
+ accessRequests,
1685
+ allowAccessDialogError,
1686
+ openAccessDialog,
1687
+ registeredInterface,
1688
+ setOpenAccessDialog
1689
+ };
1690
+ }, "useDialogState");
1691
+
1692
+ // src/modules/Dapp/modules/access-interface/components/Flexbox.tsx
1693
+ var DappAccessFlexbox = /* @__PURE__ */ __name(({ context }) => {
1694
+ const { accessRequests, allowAccessDialogError, openAccessDialog, registeredInterface, setOpenAccessDialog } = useDialogState(context);
1695
+ return /* @__PURE__ */ React9.createElement(DappAccessDialog, {
1696
+ accessRequest: accessRequests?.[0],
1697
+ dappNode: context,
1698
+ open: openAccessDialog,
1699
+ onClose: /* @__PURE__ */ __name(() => setOpenAccessDialog(false), "onClose"),
1700
+ registeredDappAccess: registeredInterface
1701
+ }, allowAccessDialogError ? /* @__PURE__ */ React9.createElement(ErrorRender2, {
1702
+ error: allowAccessDialogError,
1703
+ scope: "DappAccessFlexbox"
1704
+ }) : null);
1705
+ }, "DappAccessFlexbox");
1706
+
1592
1707
  // src/modules/Dapp/modules/Window/AppBar.tsx
1593
1708
  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";
1709
+ import { AppBar, Box as Box2, Divider, IconButton as IconButton2, Toolbar, Tooltip as Tooltip2, Typography as Typography3 } from "@mui/material";
1595
1710
  import { FlexGrowRow as FlexGrowRow2 } from "@xylabs/react-flexbox";
1596
1711
  import { DarkModeIconButtonForColorScheme } from "@xylabs/react-invertible-theme";
1597
1712
  import { DappIntentTypes as DappIntentTypes6 } from "@xyo-network/os-model";
1598
1713
  import { DappIntentCaller as DappIntentCaller3 } from "@xyo-network/os-runtime";
1599
- import React9 from "react";
1714
+ import React11 from "react";
1600
1715
 
1601
1716
  // src/modules/Dapp/Debug/Dialog.tsx
1602
- import { Dialog, DialogActions, DialogContent } from "@mui/material";
1717
+ import { Dialog as Dialog2, DialogActions as DialogActions2, DialogContent as DialogContent2 } from "@mui/material";
1603
1718
  import { ButtonEx as ButtonEx4 } from "@xylabs/react-button";
1604
- import { FlexCol as FlexCol3 } from "@xylabs/react-flexbox";
1719
+ import { FlexCol as FlexCol4 } from "@xylabs/react-flexbox";
1605
1720
  import { NodeProvider } from "@xyo-network/react-node";
1606
- import React8, { lazy, Suspense } from "react";
1721
+ import React10, { lazy, Suspense } from "react";
1607
1722
  var Debug = /* @__PURE__ */ lazy(() => import(
1608
1723
  /* webpackChunkName: "Debug" */
1609
1724
  "@xyo-network/os-react-debug"
1610
1725
  ));
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, {
1726
+ var LazyDebug = /* @__PURE__ */ __name(() => /* @__PURE__ */ React10.createElement(Suspense, {
1727
+ fallback: /* @__PURE__ */ React10.createElement(FlexCol4, null)
1728
+ }, /* @__PURE__ */ React10.createElement(FlexCol4, null), /* @__PURE__ */ React10.createElement(Debug, {
1614
1729
  height: "100%"
1615
1730
  })), "LazyDebug");
1616
1731
  var DebugDialog = /* @__PURE__ */ __name(({ closeDebug, debugOpen, ...props }) => {
1617
- return /* @__PURE__ */ React8.createElement(Dialog, {
1732
+ return /* @__PURE__ */ React10.createElement(Dialog2, {
1618
1733
  open: debugOpen,
1619
1734
  onClose: closeDebug,
1620
1735
  fullScreen: true,
1621
1736
  ...props
1622
- }, /* @__PURE__ */ React8.createElement(DialogContent, null, /* @__PURE__ */ React8.createElement(LazyDebug, null)), /* @__PURE__ */ React8.createElement(DialogActions, null, /* @__PURE__ */ React8.createElement(ButtonEx4, {
1737
+ }, /* @__PURE__ */ React10.createElement(DialogContent2, null, /* @__PURE__ */ React10.createElement(LazyDebug, null)), /* @__PURE__ */ React10.createElement(DialogActions2, null, /* @__PURE__ */ React10.createElement(ButtonEx4, {
1623
1738
  variant: "outlined",
1624
1739
  onClick: closeDebug
1625
1740
  }, "Close")));
1626
1741
  }, "DebugDialog");
1627
1742
  var DebugDialogWithNode = /* @__PURE__ */ __name(({ closeDebug, debugOpen, context, ...props }) => {
1628
- return /* @__PURE__ */ React8.createElement(NodeProvider, {
1743
+ return /* @__PURE__ */ React10.createElement(NodeProvider, {
1629
1744
  node: context?.root
1630
- }, /* @__PURE__ */ React8.createElement(DebugDialog, {
1745
+ }, /* @__PURE__ */ React10.createElement(DebugDialog, {
1631
1746
  closeDebug,
1632
1747
  debugOpen,
1633
1748
  ...props
@@ -1636,7 +1751,7 @@ var DebugDialogWithNode = /* @__PURE__ */ __name(({ closeDebug, debugOpen, conte
1636
1751
 
1637
1752
  // src/modules/Dapp/modules/Window/AppBar.tsx
1638
1753
  var EmptyDappBarForPadding = /* @__PURE__ */ __name((props) => {
1639
- return /* @__PURE__ */ React9.createElement(AppBar, {
1754
+ return /* @__PURE__ */ React11.createElement(AppBar, {
1640
1755
  color: "primary",
1641
1756
  sx: {
1642
1757
  flexDirection: "row"
@@ -1649,7 +1764,7 @@ var EmptyDappBarForPadding = /* @__PURE__ */ __name((props) => {
1649
1764
  var DappBar = /* @__PURE__ */ __name(({ title, context, name, ...props }) => {
1650
1765
  const sendIntent = useSendDappIntent();
1651
1766
  const { closeDebug, debugOpen, openDebug } = useDebugClick();
1652
- return /* @__PURE__ */ React9.createElement(AppBar, {
1767
+ return /* @__PURE__ */ React11.createElement(AppBar, {
1653
1768
  elevation: 0,
1654
1769
  color: "transparent",
1655
1770
  sx: {
@@ -1659,21 +1774,21 @@ var DappBar = /* @__PURE__ */ __name(({ title, context, name, ...props }) => {
1659
1774
  component: "div",
1660
1775
  position: "sticky",
1661
1776
  ...props
1662
- }, /* @__PURE__ */ React9.createElement(Toolbar, {
1777
+ }, /* @__PURE__ */ React11.createElement(Toolbar, {
1663
1778
  disableGutters: true,
1664
1779
  sx: {
1665
1780
  paddingX: 2
1666
1781
  }
1667
- }, /* @__PURE__ */ React9.createElement(Typography2, {
1782
+ }, /* @__PURE__ */ React11.createElement(Typography3, {
1668
1783
  noWrap: true,
1669
1784
  variant: "h6",
1670
1785
  letterSpacing: "-1px"
1671
- }, title)), /* @__PURE__ */ React9.createElement(FlexGrowRow2, null), /* @__PURE__ */ React9.createElement(Toolbar, {
1786
+ }, title)), /* @__PURE__ */ React11.createElement(FlexGrowRow2, null), /* @__PURE__ */ React11.createElement(Toolbar, {
1672
1787
  disableGutters: true,
1673
1788
  sx: {
1674
1789
  paddingX: 2
1675
1790
  }
1676
- }, /* @__PURE__ */ React9.createElement(IconButton2, {
1791
+ }, /* @__PURE__ */ React11.createElement(IconButton2, {
1677
1792
  onClick: openDebug,
1678
1793
  sx: {
1679
1794
  display: {
@@ -1681,7 +1796,7 @@ var DappBar = /* @__PURE__ */ __name(({ title, context, name, ...props }) => {
1681
1796
  xs: "flex"
1682
1797
  }
1683
1798
  }
1684
- }, /* @__PURE__ */ React9.createElement(BugReport, null)), /* @__PURE__ */ React9.createElement(Tooltip2, {
1799
+ }, /* @__PURE__ */ React11.createElement(BugReport, null)), /* @__PURE__ */ React11.createElement(Tooltip2, {
1685
1800
  title: "Toggle Light/Dark Mode",
1686
1801
  sx: {
1687
1802
  display: {
@@ -1689,9 +1804,9 @@ var DappBar = /* @__PURE__ */ __name(({ title, context, name, ...props }) => {
1689
1804
  xs: "flex"
1690
1805
  }
1691
1806
  }
1692
- }, /* @__PURE__ */ React9.createElement(Box2, null, /* @__PURE__ */ React9.createElement(DarkModeIconButtonForColorScheme, {
1807
+ }, /* @__PURE__ */ React11.createElement(Box2, null, /* @__PURE__ */ React11.createElement(DarkModeIconButtonForColorScheme, {
1693
1808
  defaultLightModeColor: "warning"
1694
- }))), /* @__PURE__ */ React9.createElement(Divider, {
1809
+ }))), /* @__PURE__ */ React11.createElement(Divider, {
1695
1810
  orientation: "vertical",
1696
1811
  flexItem: true,
1697
1812
  sx: {
@@ -1701,19 +1816,19 @@ var DappBar = /* @__PURE__ */ __name(({ title, context, name, ...props }) => {
1701
1816
  },
1702
1817
  m: 1
1703
1818
  }
1704
- }), /* @__PURE__ */ React9.createElement(Tooltip2, {
1819
+ }), /* @__PURE__ */ React11.createElement(Tooltip2, {
1705
1820
  title: "Minimize"
1706
- }, /* @__PURE__ */ React9.createElement(IconButton2, {
1821
+ }, /* @__PURE__ */ React11.createElement(IconButton2, {
1707
1822
  onClick: /* @__PURE__ */ __name(async () => await sendIntent?.(DappIntentCaller3.buildIntent(DappIntentCaller3.OsDappName, DappIntentTypes6.Minimize, name)), "onClick")
1708
- }, /* @__PURE__ */ React9.createElement(RemoveRounded, {
1823
+ }, /* @__PURE__ */ React11.createElement(RemoveRounded, {
1709
1824
  htmlColor: "inherit"
1710
- }))), /* @__PURE__ */ React9.createElement(Tooltip2, {
1825
+ }))), /* @__PURE__ */ React11.createElement(Tooltip2, {
1711
1826
  title: "Close"
1712
- }, /* @__PURE__ */ React9.createElement(IconButton2, {
1827
+ }, /* @__PURE__ */ React11.createElement(IconButton2, {
1713
1828
  onClick: /* @__PURE__ */ __name(async () => await sendIntent?.(DappIntentCaller3.buildIntent(DappIntentCaller3.OsDappName, DappIntentTypes6.Close, name)), "onClick")
1714
- }, /* @__PURE__ */ React9.createElement(CloseRounded, {
1829
+ }, /* @__PURE__ */ React11.createElement(CloseRounded, {
1715
1830
  htmlColor: "inherit"
1716
- })))), /* @__PURE__ */ React9.createElement(DebugDialogWithNode, {
1831
+ })))), /* @__PURE__ */ React11.createElement(DebugDialogWithNode, {
1717
1832
  closeDebug,
1718
1833
  debugOpen,
1719
1834
  context
@@ -1722,21 +1837,21 @@ var DappBar = /* @__PURE__ */ __name(({ title, context, name, ...props }) => {
1722
1837
 
1723
1838
  // src/modules/Dapp/modules/Window/Chrome.tsx
1724
1839
  import { useMediaQuery } from "@mui/material";
1725
- import { FlexCol as FlexCol4, FlexGrowCol, FlexRow as FlexRow2 } from "@xylabs/react-flexbox";
1726
- import React10 from "react";
1840
+ import { FlexCol as FlexCol5, FlexGrowCol, FlexRow as FlexRow3 } from "@xylabs/react-flexbox";
1841
+ import React12 from "react";
1727
1842
  var DappChromeSmall = /* @__PURE__ */ __name(({ appBar, children, screenMenu, splashScreen, ...props }) => {
1728
- return /* @__PURE__ */ React10.createElement(FlexCol4, {
1843
+ return /* @__PURE__ */ React12.createElement(FlexCol5, {
1729
1844
  alignItems: "stretch",
1730
1845
  id: "dapp-chrome-container-small",
1731
1846
  ...props
1732
- }, splashScreen, /* @__PURE__ */ React10.createElement(FlexGrowCol, {
1847
+ }, splashScreen, /* @__PURE__ */ React12.createElement(FlexGrowCol, {
1733
1848
  alignItems: "stretch",
1734
1849
  id: "dapp-chrome-small",
1735
1850
  justifyContent: "start",
1736
1851
  sx: {
1737
1852
  background: /* @__PURE__ */ __name((theme) => theme.palette.background.default, "background")
1738
1853
  }
1739
- }, appBar, /* @__PURE__ */ React10.createElement(FlexGrowCol, {
1854
+ }, appBar, /* @__PURE__ */ React12.createElement(FlexGrowCol, {
1740
1855
  sx: {
1741
1856
  overflowY: "auto"
1742
1857
  },
@@ -1744,18 +1859,18 @@ var DappChromeSmall = /* @__PURE__ */ __name(({ appBar, children, screenMenu, sp
1744
1859
  }, children), screenMenu));
1745
1860
  }, "DappChromeSmall");
1746
1861
  var DappChromeLarge = /* @__PURE__ */ __name(({ appBar, children, screenMenu, splashScreen, ...props }) => {
1747
- return /* @__PURE__ */ React10.createElement(FlexRow2, {
1862
+ return /* @__PURE__ */ React12.createElement(FlexRow3, {
1748
1863
  alignItems: "stretch",
1749
1864
  id: "dapp-chrome-container-large",
1750
1865
  ...props
1751
- }, splashScreen, screenMenu, /* @__PURE__ */ React10.createElement(FlexGrowCol, {
1866
+ }, splashScreen, screenMenu, /* @__PURE__ */ React12.createElement(FlexGrowCol, {
1752
1867
  alignItems: "stretch",
1753
1868
  id: "dapp-chrome-large",
1754
1869
  justifyContent: "start",
1755
1870
  sx: {
1756
1871
  background: /* @__PURE__ */ __name((theme) => theme.palette.background.default, "background")
1757
1872
  }
1758
- }, appBar, /* @__PURE__ */ React10.createElement(FlexGrowCol, {
1873
+ }, appBar, /* @__PURE__ */ React12.createElement(FlexGrowCol, {
1759
1874
  sx: {
1760
1875
  overflowY: "auto"
1761
1876
  },
@@ -1765,26 +1880,26 @@ var DappChromeLarge = /* @__PURE__ */ __name(({ appBar, children, screenMenu, sp
1765
1880
  }, "DappChromeLarge");
1766
1881
  var DappChrome = /* @__PURE__ */ __name(({ largeScreenMenu, smallScreenMenu, ...props }) => {
1767
1882
  const isMedium = useMediaQuery((theme) => theme.breakpoints.up("md"));
1768
- return isMedium ? /* @__PURE__ */ React10.createElement(DappChromeLarge, {
1883
+ return isMedium ? /* @__PURE__ */ React12.createElement(DappChromeLarge, {
1769
1884
  screenMenu: largeScreenMenu,
1770
1885
  ...props
1771
- }) : /* @__PURE__ */ React10.createElement(DappChromeSmall, {
1886
+ }) : /* @__PURE__ */ React12.createElement(DappChromeSmall, {
1772
1887
  screenMenu: smallScreenMenu,
1773
1888
  ...props
1774
1889
  });
1775
1890
  }, "DappChrome");
1776
1891
 
1777
1892
  // 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";
1893
+ import { alpha as alpha3, Card as Card2, CardContent as CardContent3, Chip, Container, Divider as Divider2, Typography as Typography5, useTheme as useTheme5 } from "@mui/material";
1894
+ import { FlexGrowCol as FlexGrowCol3, FlexRow as FlexRow6 } from "@xylabs/react-flexbox";
1895
+ import React16 from "react";
1781
1896
 
1782
1897
  // src/modules/Dapp/modules/Window/components/DefaultComingSoon/InstallButtonSection.tsx
1783
1898
  import { ButtonEx as ButtonEx5 } from "@xylabs/react-button";
1784
- import { FlexRow as FlexRow3 } from "@xylabs/react-flexbox";
1785
- import React11 from "react";
1899
+ import { FlexRow as FlexRow4 } from "@xylabs/react-flexbox";
1900
+ import React13 from "react";
1786
1901
  var InstallButtonSection = /* @__PURE__ */ __name(({ installLink = "", notificationLink = "https://xyo.network/newsletter", ...props }) => {
1787
- return /* @__PURE__ */ React11.createElement(FlexRow3, {
1902
+ return /* @__PURE__ */ React13.createElement(FlexRow4, {
1788
1903
  width: "100%",
1789
1904
  gap: 1,
1790
1905
  sx: {
@@ -1795,12 +1910,12 @@ var InstallButtonSection = /* @__PURE__ */ __name(({ installLink = "", notificat
1795
1910
  }
1796
1911
  },
1797
1912
  ...props
1798
- }, /* @__PURE__ */ React11.createElement(ButtonEx5, {
1913
+ }, /* @__PURE__ */ React13.createElement(ButtonEx5, {
1799
1914
  fullWidth: true,
1800
1915
  variant: "contained",
1801
1916
  disabled: true,
1802
1917
  href: installLink
1803
- }, "Install"), /* @__PURE__ */ React11.createElement(ButtonEx5, {
1918
+ }, "Install"), /* @__PURE__ */ React13.createElement(ButtonEx5, {
1804
1919
  fullWidth: true,
1805
1920
  variant: "outlined",
1806
1921
  href: notificationLink,
@@ -1810,18 +1925,18 @@ var InstallButtonSection = /* @__PURE__ */ __name(({ installLink = "", notificat
1810
1925
 
1811
1926
  // src/modules/Dapp/modules/Window/components/DefaultComingSoon/SummarySection.tsx
1812
1927
  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";
1928
+ import { Card, CardContent as CardContent2, Typography as Typography4, useTheme as useTheme4 } from "@mui/material";
1929
+ import { FlexGrowCol as FlexGrowCol2, FlexGrowRow as FlexGrowRow4, FlexRow as FlexRow5 } from "@xylabs/react-flexbox";
1930
+ import React15 from "react";
1816
1931
 
1817
1932
  // src/modules/Dapp/modules/Window/components/DefaultComingSoon/DeveloperLinkSection.tsx
1818
1933
  import { useTheme as useTheme3 } from "@mui/material";
1819
1934
  import { FlexGrowRow as FlexGrowRow3 } from "@xylabs/react-flexbox";
1820
1935
  import { LinkEx } from "@xylabs/react-link";
1821
- import React12 from "react";
1936
+ import React14 from "react";
1822
1937
  var DeveloperLinkSection = /* @__PURE__ */ __name(({ developerLink = "https://xylabs.com", ...props }) => {
1823
1938
  const theme = useTheme3();
1824
- return /* @__PURE__ */ React12.createElement(FlexGrowRow3, {
1939
+ return /* @__PURE__ */ React14.createElement(FlexGrowRow3, {
1825
1940
  gap: 1,
1826
1941
  sx: {
1827
1942
  alignItems: "flex-start",
@@ -1831,7 +1946,7 @@ var DeveloperLinkSection = /* @__PURE__ */ __name(({ developerLink = "https://xy
1831
1946
  }
1832
1947
  },
1833
1948
  ...props
1834
- }, /* @__PURE__ */ React12.createElement(LinkEx, {
1949
+ }, /* @__PURE__ */ React14.createElement(LinkEx, {
1835
1950
  color: theme.palette.info.main,
1836
1951
  href: developerLink,
1837
1952
  target: "_blank"
@@ -1841,18 +1956,18 @@ var DeveloperLinkSection = /* @__PURE__ */ __name(({ developerLink = "https://xy
1841
1956
  // src/modules/Dapp/modules/Window/components/DefaultComingSoon/SummarySection.tsx
1842
1957
  var SummarySection = /* @__PURE__ */ __name(({ name, dappIconSvg, version = "1.0", developerLink = "https://xylabs.com" }) => {
1843
1958
  const theme = useTheme4();
1844
- return /* @__PURE__ */ React13.createElement(Card, {
1959
+ return /* @__PURE__ */ React15.createElement(Card, {
1845
1960
  sx: {
1846
1961
  width: "100%"
1847
1962
  }
1848
- }, /* @__PURE__ */ React13.createElement(CardContent2, null, /* @__PURE__ */ React13.createElement(FlexRow4, {
1963
+ }, /* @__PURE__ */ React15.createElement(CardContent2, null, /* @__PURE__ */ React15.createElement(FlexRow5, {
1849
1964
  gap: 3,
1850
1965
  alignItems: "flex-start",
1851
1966
  sx: {
1852
1967
  flexDirection: "column",
1853
1968
  width: "100%"
1854
1969
  }
1855
- }, /* @__PURE__ */ React13.createElement(FlexGrowRow4, {
1970
+ }, /* @__PURE__ */ React15.createElement(FlexGrowRow4, {
1856
1971
  sx: {
1857
1972
  gap: {
1858
1973
  md: 2,
@@ -1860,16 +1975,16 @@ var SummarySection = /* @__PURE__ */ __name(({ name, dappIconSvg, version = "1.0
1860
1975
  }
1861
1976
  },
1862
1977
  alignItems: "flex-start"
1863
- }, /* @__PURE__ */ React13.createElement(Card, {
1978
+ }, /* @__PURE__ */ React15.createElement(Card, {
1864
1979
  elevation: 0,
1865
1980
  variant: "outlined"
1866
- }, /* @__PURE__ */ React13.createElement(CardContent2, null, dappIconSvg ? /* @__PURE__ */ React13.createElement(RenderHtml, {
1981
+ }, /* @__PURE__ */ React15.createElement(CardContent2, null, dappIconSvg ? /* @__PURE__ */ React15.createElement(RenderHtml, {
1867
1982
  htmlString: dappIconSvg
1868
- }) : null)), /* @__PURE__ */ React13.createElement(FlexGrowCol2, {
1983
+ }) : null)), /* @__PURE__ */ React15.createElement(FlexGrowCol2, {
1869
1984
  alignItems: "flex-start"
1870
- }, /* @__PURE__ */ React13.createElement(FlexGrowCol2, {
1985
+ }, /* @__PURE__ */ React15.createElement(FlexGrowCol2, {
1871
1986
  alignItems: "flex-start"
1872
- }, /* @__PURE__ */ React13.createElement(Typography3, {
1987
+ }, /* @__PURE__ */ React15.createElement(Typography4, {
1873
1988
  sx: {
1874
1989
  fontSize: {
1875
1990
  md: theme.typography.h1.fontSize,
@@ -1877,20 +1992,20 @@ var SummarySection = /* @__PURE__ */ __name(({ name, dappIconSvg, version = "1.0
1877
1992
  }
1878
1993
  },
1879
1994
  fontWeight: theme.typography.fontWeightBold
1880
- }, name), /* @__PURE__ */ React13.createElement(Typography3, {
1995
+ }, name), /* @__PURE__ */ React15.createElement(Typography4, {
1881
1996
  gutterBottom: true,
1882
1997
  variant: "subtitle2"
1883
- }, "Version:", " ", version)), /* @__PURE__ */ React13.createElement(FlexGrowRow4, {
1998
+ }, "Version:", " ", version)), /* @__PURE__ */ React15.createElement(FlexGrowRow4, {
1884
1999
  gap: 0.5,
1885
2000
  alignItems: "center",
1886
2001
  justifyContent: "center"
1887
- }, /* @__PURE__ */ React13.createElement(VerifiedRounded, {
2002
+ }, /* @__PURE__ */ React15.createElement(VerifiedRounded, {
1888
2003
  color: "success",
1889
2004
  fontSize: "small"
1890
- }), /* @__PURE__ */ React13.createElement(Typography3, {
2005
+ }), /* @__PURE__ */ React15.createElement(Typography4, {
1891
2006
  variant: "body1",
1892
2007
  color: theme.palette.success.main
1893
- }, "XY Labs")), developerLink ? /* @__PURE__ */ React13.createElement(DeveloperLinkSection, {
2008
+ }, "XY Labs")), developerLink ? /* @__PURE__ */ React15.createElement(DeveloperLinkSection, {
1894
2009
  developerLink
1895
2010
  }) : null)))));
1896
2011
  }, "SummarySection");
@@ -1901,7 +2016,7 @@ var defaultDescription = [
1901
2016
  ];
1902
2017
  var DefaultComingSoon = /* @__PURE__ */ __name(({ children, desc = defaultDescription, developerLink = "https://xylabs.com", name, dappIconSvg, version }) => {
1903
2018
  const theme = useTheme5();
1904
- return /* @__PURE__ */ React14.createElement(Container, {
2019
+ return /* @__PURE__ */ React16.createElement(Container, {
1905
2020
  maxWidth: "md",
1906
2021
  sx: {
1907
2022
  minHeight: "100%",
@@ -1909,40 +2024,40 @@ var DefaultComingSoon = /* @__PURE__ */ __name(({ children, desc = defaultDescri
1909
2024
  paddingTop: 2,
1910
2025
  width: "100%"
1911
2026
  }
1912
- }, version ? null : /* @__PURE__ */ React14.createElement(FlexRow5, {
2027
+ }, version ? null : /* @__PURE__ */ React16.createElement(FlexRow6, {
1913
2028
  width: "100%",
1914
2029
  paddingBottom: 2
1915
- }, /* @__PURE__ */ React14.createElement(Chip, {
2030
+ }, /* @__PURE__ */ React16.createElement(Chip, {
1916
2031
  label: "This app is not yet publicly available on xyOS",
1917
2032
  sx: {
1918
2033
  backgroundColor: alpha3(theme.palette.info.main, 0.2),
1919
2034
  color: theme.palette.info.main,
1920
2035
  width: "100%"
1921
2036
  }
1922
- })), /* @__PURE__ */ React14.createElement(FlexGrowCol3, {
2037
+ })), /* @__PURE__ */ React16.createElement(FlexGrowCol3, {
1923
2038
  width: "100%",
1924
2039
  alignItems: "flex-start",
1925
2040
  minHeight: "100%"
1926
- }, /* @__PURE__ */ React14.createElement(FlexGrowCol3, {
2041
+ }, /* @__PURE__ */ React16.createElement(FlexGrowCol3, {
1927
2042
  width: "100%",
1928
2043
  alignItems: "stretch",
1929
2044
  justifyContent: "flex-start",
1930
2045
  gap: 2
1931
- }, /* @__PURE__ */ React14.createElement(SummarySection, {
2046
+ }, /* @__PURE__ */ React16.createElement(SummarySection, {
1932
2047
  dappIconSvg,
1933
2048
  name,
1934
2049
  version,
1935
2050
  developerLink
1936
- }), /* @__PURE__ */ React14.createElement(InstallButtonSection, null), /* @__PURE__ */ React14.createElement(Divider2, {
2051
+ }), /* @__PURE__ */ React16.createElement(InstallButtonSection, null), /* @__PURE__ */ React16.createElement(Divider2, {
1937
2052
  flexItem: true
1938
- }), /* @__PURE__ */ React14.createElement(Card2, null, /* @__PURE__ */ React14.createElement(CardContent3, null, /* @__PURE__ */ React14.createElement(FlexGrowCol3, {
2053
+ }), /* @__PURE__ */ React16.createElement(Card2, null, /* @__PURE__ */ React16.createElement(CardContent3, null, /* @__PURE__ */ React16.createElement(FlexGrowCol3, {
1939
2054
  justifyContent: "flex-start",
1940
2055
  alignItems: "flex-start"
1941
- }, /* @__PURE__ */ React14.createElement(Typography4, {
2056
+ }, /* @__PURE__ */ React16.createElement(Typography5, {
1942
2057
  variant: "h6",
1943
2058
  gutterBottom: true
1944
2059
  }, "Learn more about", " ", name), desc?.map((paragraph, index) => {
1945
- return /* @__PURE__ */ React14.createElement(Typography4, {
2060
+ return /* @__PURE__ */ React16.createElement(Typography5, {
1946
2061
  gutterBottom: true,
1947
2062
  paddingBottom: 1,
1948
2063
  key: index,
@@ -2011,147 +2126,6 @@ var XyOsUi = class extends XyOs {
2011
2126
  }
2012
2127
  };
2013
2128
 
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
2129
  // src/modules/Dapp/modules/Window/hooks/lib/DappPathHelpers.ts
2156
2130
  import { NameTransforms as NameTransforms2 } from "@xyo-network/os-runtime";
2157
2131
  var DappPathHelpers = {
@@ -2180,6 +2154,23 @@ var DappPathHelpers = {
2180
2154
  }
2181
2155
  };
2182
2156
 
2157
+ // src/modules/Dapp/modules/Window/hooks/lib/deriveDappState.ts
2158
+ import { DappIntentTypes as DappIntentTypes7 } from "@xyo-network/os-model";
2159
+ var deriveDappState = /* @__PURE__ */ __name((intent, context) => {
2160
+ const minimized = intent?.intent === DappIntentTypes7.Minimize;
2161
+ const open = intent?.intent === DappIntentTypes7.Launch;
2162
+ const active = !!(context && open);
2163
+ return {
2164
+ active,
2165
+ minimized,
2166
+ open
2167
+ };
2168
+ }, "deriveDappState");
2169
+
2170
+ // src/modules/Dapp/modules/Window/hooks/menu/useDappMenu.tsx
2171
+ import { useEffect as useEffect12, useRef as useRef4, useState as useState11 } from "react";
2172
+ import { useNavigate as useNavigate4, useParams as useParams2 } from "react-router-dom";
2173
+
2183
2174
  // src/modules/Dapp/modules/Window/hooks/useDappMenuResourceValues.tsx
2184
2175
  import { useMemo as useMemo10 } from "react";
2185
2176
  var useDappMenuDependencies = /* @__PURE__ */ __name((context) => {
@@ -2302,7 +2293,7 @@ var useManageDappInjectableParamsFromRoute = /* @__PURE__ */ __name((context) =>
2302
2293
 
2303
2294
  // src/modules/Dapp/modules/Window/hooks/route/helpers/useManageDappIntentRequest.tsx
2304
2295
  import { useAtomicPromise, usePromise as usePromise12 } from "@xylabs/react-promise";
2305
- import { DappIntentTypes as DappIntentTypes7, isDappIntent } from "@xyo-network/os-model";
2296
+ import { DappIntentTypes as DappIntentTypes8, isDappIntent } from "@xyo-network/os-model";
2306
2297
  import { DappIntentCaller as DappIntentCaller4 } from "@xyo-network/os-runtime";
2307
2298
  import { useEffect as useEffect13, useState as useState12 } from "react";
2308
2299
  var useManageDappIntentRequest = /* @__PURE__ */ __name((context, dappId) => {
@@ -2323,7 +2314,7 @@ var useManageDappIntentRequest = /* @__PURE__ */ __name((context, dappId) => {
2323
2314
  useAtomicPromise("manageDappIntent", async () => {
2324
2315
  if (context && intentPayload?.targetDappId && dappId && sendIntent) {
2325
2316
  try {
2326
- const minimizeIntent = DappIntentCaller4.buildIntent(DappIntentCaller4.OsDappName, DappIntentTypes7.Minimize, dappId);
2317
+ const minimizeIntent = DappIntentCaller4.buildIntent(DappIntentCaller4.OsDappName, DappIntentTypes8.Minimize, dappId);
2327
2318
  await sendIntent(minimizeIntent);
2328
2319
  await sendIntent(intentPayload);
2329
2320
  } catch (e) {
@@ -2416,7 +2407,7 @@ var useManageDappPathFromRoute = /* @__PURE__ */ __name((context, dappName) => {
2416
2407
 
2417
2408
  // src/modules/Dapp/modules/Window/hooks/route/helpers/useManageDappStateFromRoute.tsx
2418
2409
  import { usePromise as usePromise14 } from "@xylabs/react-promise";
2419
- import { DappIntentTypes as DappIntentTypes8 } from "@xyo-network/os-model";
2410
+ import { DappIntentTypes as DappIntentTypes9 } from "@xyo-network/os-model";
2420
2411
  import { DappIntentCaller as DappIntentCaller5, NameTransforms as NameTransforms3 } from "@xyo-network/os-runtime";
2421
2412
  import { useNavigationType, useParams as useParams5 } from "react-router-dom";
2422
2413
  var useManageDappStateFromRoute = /* @__PURE__ */ __name((intentPayload, dappName) => {
@@ -2426,9 +2417,9 @@ var useManageDappStateFromRoute = /* @__PURE__ */ __name((intentPayload, dappNam
2426
2417
  const navigationType = useNavigationType();
2427
2418
  const intentCaller = useDappIntentCaller();
2428
2419
  usePromise14(async () => {
2429
- const launched = intentPayload?.intent === DappIntentTypes8.Launch;
2420
+ const launched = intentPayload?.intent === DappIntentTypes9.Launch;
2430
2421
  if (launched && dappNameParam === void 0 && sendIntent && navigationType === "POP") {
2431
- const closeIntent = DappIntentCaller5.buildIntent(DappIntentCaller5.OsDappName, DappIntentTypes8.Close, dappName);
2422
+ const closeIntent = DappIntentCaller5.buildIntent(DappIntentCaller5.OsDappName, DappIntentTypes9.Close, dappName);
2432
2423
  await sendIntent(closeIntent);
2433
2424
  }
2434
2425
  }, [
@@ -2441,13 +2432,13 @@ var useManageDappStateFromRoute = /* @__PURE__ */ __name((intentPayload, dappNam
2441
2432
  usePromise14(async () => {
2442
2433
  if (dappNameParam && dappName && sendIntent && intentCaller) {
2443
2434
  const dappNameParamDeSlugged = new NameTransforms3(dappNameParam).deSlug();
2444
- const notLaunched = intentPayload?.intent !== DappIntentTypes8.Launch;
2435
+ const notLaunched = intentPayload?.intent !== DappIntentTypes9.Launch;
2445
2436
  const paramMatchesDappName = dappNameParamDeSlugged === dappName;
2446
2437
  if (notLaunched && paramMatchesDappName) {
2447
2438
  const latestIntent = await intentCaller.latestIntent();
2448
2439
  const existing = latestIntent && latestIntent.targetDappId === dappNameParamDeSlugged;
2449
2440
  if (!existing) {
2450
- const launchIntent = DappIntentCaller5.buildIntent(DappIntentCaller5.OsDappName, DappIntentTypes8.Launch, dappNameParamDeSlugged);
2441
+ const launchIntent = DappIntentCaller5.buildIntent(DappIntentCaller5.OsDappName, DappIntentTypes9.Launch, dappNameParamDeSlugged);
2451
2442
  await sendIntent(launchIntent);
2452
2443
  return;
2453
2444
  }
@@ -2474,19 +2465,6 @@ var useManageDappBasedOffRoute = /* @__PURE__ */ __name((intentPayload, dappName
2474
2465
  ];
2475
2466
  }, "useManageDappBasedOffRoute");
2476
2467
 
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
2468
  // src/modules/Dapp/modules/Window/NodeManifest.tsx
2491
2469
  import { usePromise as usePromise15 } from "@xylabs/react-promise";
2492
2470
  import { useProvidedNode } from "@xyo-network/react-node";
@@ -3165,13 +3143,11 @@ var DappMenuDrawer = /* @__PURE__ */ __name(({ activePath, context, iconSvg, nam
3165
3143
  }, "DappMenuDrawer");
3166
3144
 
3167
3145
  // 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);
3146
+ var DappWindow = /* @__PURE__ */ __name(({ context, dappSet, dappState, dappWallet, intent, nodeCreateError }) => {
3147
+ const { DappComponent, name, scrollable = true, version } = decomposeDappSet(dappSet);
3148
+ const { active, minimized, open } = dappState ?? {};
3173
3149
  const TypedDappComponent = useMemo12(() => DappComponent, []);
3174
- const errors = useManageDappBasedOffRoute(intentPayload, name, context);
3150
+ const errors = useManageDappBasedOffRoute(intent, name, context);
3175
3151
  useSyncOsRegisteredAccessInterfaces(context);
3176
3152
  const { activePath, error: menuError, menuConfig, menuItemsVisible, onPathChange } = useDappMenu(context, name);
3177
3153
  const resolvedError = nodeCreateError || menuError;
@@ -3204,9 +3180,9 @@ var DappWindow = /* @__PURE__ */ __name(({ dappSet, xnsNodeUrl, xnsNetwork }) =>
3204
3180
  }),
3205
3181
  /* Ensure that loading goes away when error occurs */
3206
3182
  splashScreen: resolvedError ? null : /* @__PURE__ */ React25.createElement(DappLoadingFlexbox, {
3207
- minimize: minimized,
3183
+ minimize: !!minimized,
3208
3184
  name,
3209
- open
3185
+ open: !!open
3210
3186
  })
3211
3187
  }, resolvedError || errors?.length > 0 ? /* @__PURE__ */ React25.createElement(FlexCol10, {
3212
3188
  padding: 2
@@ -3242,18 +3218,33 @@ var DappWindow = /* @__PURE__ */ __name(({ dappSet, xnsNodeUrl, xnsNetwork }) =>
3242
3218
  }, "DappWindow");
3243
3219
 
3244
3220
  // src/modules/Dapp/Container.tsx
3245
- var DappContainer = /* @__PURE__ */ __name(({ dappSet, xnsNodeUrl, xnsNetwork }) => {
3221
+ var DappContainer = /* @__PURE__ */ __name(({ currentIntent, dappSet, xnsNodeUrl, xnsNetwork }) => {
3246
3222
  const { dapp, dappIcon } = dappSet;
3223
+ const { dappWallet, context, nodeCreateError } = useDappContextCreator(xnsNodeUrl, xnsNetwork, dapp, currentIntent);
3224
+ const dappState = useMemo13(() => {
3225
+ if (currentIntent?.targetDappId === dapp.config.name) {
3226
+ return deriveDappState(currentIntent, context);
3227
+ }
3228
+ }, [
3229
+ currentIntent,
3230
+ context,
3231
+ dapp
3232
+ ]);
3247
3233
  return /* @__PURE__ */ React26.createElement(DappIconButton, {
3248
3234
  dappIcon,
3249
3235
  dappIconSvg: dapp.params.iconSvg,
3250
- dappName: dapp?.config.name
3236
+ dappName: dapp?.config.name,
3237
+ dappState
3251
3238
  }, /* @__PURE__ */ React26.createElement(DappWindow, {
3239
+ context,
3252
3240
  dappSet,
3253
- xnsNodeUrl,
3254
- xnsNetwork
3241
+ dappState,
3242
+ dappWallet,
3243
+ intent: currentIntent,
3244
+ nodeCreateError
3255
3245
  }));
3256
3246
  }, "DappContainer");
3247
+ var DappContainerMemo = /* @__PURE__ */ memo(DappContainer);
3257
3248
 
3258
3249
  // src/modules/Dapp/ContainerFlexbox.tsx
3259
3250
  import { Container as Container2 } from "@mui/material";
@@ -3274,7 +3265,7 @@ var ContainerFlexbox = /* @__PURE__ */ __name(({ children, containerProps, scrol
3274
3265
 
3275
3266
  // src/modules/Dapp/Page/Row.tsx
3276
3267
  import { Divider as Divider4, Fade as Fade2, styled as styled5 } from "@mui/material";
3277
- import React29, { useMemo as useMemo13 } from "react";
3268
+ import React29, { useMemo as useMemo14 } from "react";
3278
3269
 
3279
3270
  // src/modules/Dapp/Page/DividerChip.tsx
3280
3271
  import { Chip as Chip2, CircularProgress } from "@mui/material";
@@ -3298,10 +3289,11 @@ var DividerChip = /* @__PURE__ */ __name(({ registeredDapps, ...props }) => {
3298
3289
 
3299
3290
  // src/modules/Dapp/Page/Row.tsx
3300
3291
  var DappsRow = /* @__PURE__ */ __name(({ chipLabel, installType, registeredDappsSet, xnsNetwork, xnsNodeUrl }) => {
3301
- const filteredRegisteredDappSets = useMemo13(() => DappInstallTypeFilters[installType](registeredDappsSet), [
3292
+ const filteredRegisteredDappSets = useMemo14(() => DappInstallTypeFilters[installType](registeredDappsSet), [
3302
3293
  installType,
3303
3294
  registeredDappsSet
3304
3295
  ]);
3296
+ const { intentPayload } = useDappIntentListener(null);
3305
3297
  return /* @__PURE__ */ React29.createElement(React29.Fragment, null, /* @__PURE__ */ React29.createElement(Divider4, {
3306
3298
  variant: "middle",
3307
3299
  sx: {
@@ -3314,7 +3306,8 @@ var DappsRow = /* @__PURE__ */ __name(({ chipLabel, installType, registeredDapps
3314
3306
  })), filteredRegisteredDappSets?.length ? /* @__PURE__ */ React29.createElement(Fade2, {
3315
3307
  in: !!filteredRegisteredDappSets?.length,
3316
3308
  timeout: 1e3
3317
- }, /* @__PURE__ */ React29.createElement(StyledGridContainer, null, filteredRegisteredDappSets?.map((dappSet, index) => /* @__PURE__ */ React29.createElement(DappContainer, {
3309
+ }, /* @__PURE__ */ React29.createElement(StyledGridContainer, null, filteredRegisteredDappSets?.map((dappSet, index) => /* @__PURE__ */ React29.createElement(DappContainerMemo, {
3310
+ currentIntent: intentPayload,
3318
3311
  key: index,
3319
3312
  dappSet,
3320
3313
  xnsNodeUrl,
@@ -3337,11 +3330,11 @@ var StyledGridContainer = styled5("div", {
3337
3330
  import { SignalCellularAltOutlined } from "@mui/icons-material";
3338
3331
  import { Tooltip as Tooltip5, useTheme as useTheme8 } from "@mui/material";
3339
3332
  import { useColorSchemeEx as useColorSchemeEx3 } from "@xylabs/react-invertible-theme";
3340
- import React30, { useMemo as useMemo16 } from "react";
3333
+ import React30, { useMemo as useMemo17 } from "react";
3341
3334
 
3342
3335
  // src/modules/network/hooks/useOsNetwork.tsx
3343
3336
  import { OsPubSubNetworkReadyEvent } from "@xyo-network/os-runtime";
3344
- import { useMemo as useMemo14 } from "react";
3337
+ import { useMemo as useMemo15 } from "react";
3345
3338
 
3346
3339
  // src/modules/network/hooks/lib/createNetworkState.ts
3347
3340
  import { assertEx as assertEx8 } from "@xylabs/assert";
@@ -3369,7 +3362,7 @@ var createNetworkState = /* @__PURE__ */ __name((stackReady) => {
3369
3362
  var useOsNetwork = /* @__PURE__ */ __name(() => {
3370
3363
  const context = useXyOsUiContext();
3371
3364
  const stackReady = useStackReady(OsPubSubNetworkReadyEvent, "osPubSubNetworkStack", context);
3372
- const networkState = useMemo14(() => {
3365
+ const networkState = useMemo15(() => {
3373
3366
  return createNetworkState(stackReady);
3374
3367
  }, [
3375
3368
  context,
@@ -3380,11 +3373,11 @@ var useOsNetwork = /* @__PURE__ */ __name(() => {
3380
3373
 
3381
3374
  // src/modules/network/hooks/useXyoPublicNetwork.tsx
3382
3375
  import { OsXyoPublicNetworkReadyEvent } from "@xyo-network/os-runtime";
3383
- import { useMemo as useMemo15 } from "react";
3376
+ import { useMemo as useMemo16 } from "react";
3384
3377
  var useXyoPublicNetwork = /* @__PURE__ */ __name(() => {
3385
3378
  const context = useXyOsUiContext();
3386
3379
  const stackReady = useStackReady(OsXyoPublicNetworkReadyEvent, "xyoPublicNetworkStack", context);
3387
- const networkState = useMemo15(() => {
3380
+ const networkState = useMemo16(() => {
3388
3381
  return createNetworkState(stackReady);
3389
3382
  }, [
3390
3383
  context,
@@ -3464,7 +3457,7 @@ var NetworkLoadingIndicator = /* @__PURE__ */ __name(({ highContrast }) => {
3464
3457
  const successColor = highContrast ? highContrastSuccessColor : theme.palette.success.main;
3465
3458
  const highContrastErrorColor = darkMode ? theme.palette.success.dark : theme.palette.error.main;
3466
3459
  const errorColor = highContrast ? highContrastErrorColor : theme.palette.error.main;
3467
- const NetworkComponent = useMemo16(() => {
3460
+ const NetworkComponent = useMemo17(() => {
3468
3461
  if (networkReady) {
3469
3462
  const connectionReady = true;
3470
3463
  return connectionReady ? () => /* @__PURE__ */ React30.createElement(Tooltip5, {
@@ -4436,10 +4429,10 @@ import React52 from "react";
4436
4429
 
4437
4430
  // src/dapps/shared/table/head/hooks/useVisibleColumns.tsx
4438
4431
  import { useMediaQuery as useMediaQuery2 } from "@mui/material";
4439
- import { useMemo as useMemo17 } from "react";
4432
+ import { useMemo as useMemo18 } from "react";
4440
4433
  var useVisibleColumns = /* @__PURE__ */ __name((tableHeadCells) => {
4441
4434
  const isMedium = useMediaQuery2((theme) => theme.breakpoints.down("lg"));
4442
- const VisibleTableCells = useMemo17(() => {
4435
+ const VisibleTableCells = useMemo18(() => {
4443
4436
  return isMedium ? tableHeadCells.filter((cell) => cell.showOnMobile) : tableHeadCells;
4444
4437
  }, [
4445
4438
  isMedium,
@@ -4518,7 +4511,7 @@ var NextIteratorFlexbox = /* @__PURE__ */ __name(({ next: changePage, loading, .
4518
4511
 
4519
4512
  // src/settings/Theme/ThemeProvider.tsx
4520
4513
  import { InvertibleMuiThemeProvider } from "@xylabs/react-invertible-theme";
4521
- import React54, { useMemo as useMemo18 } from "react";
4514
+ import React54, { useMemo as useMemo19 } from "react";
4522
4515
 
4523
4516
  // src/settings/Theme/ThemeCssVars.ts
4524
4517
  import { alpha as alpha9, createTheme, darken as darken2, lighten } from "@mui/material";
@@ -4813,7 +4806,7 @@ var ThemeCssVars = createTheme({
4813
4806
 
4814
4807
  // src/settings/Theme/ThemeProvider.tsx
4815
4808
  var AppOsThemeProvider = /* @__PURE__ */ __name(({ children }) => {
4816
- const initialValue = useMemo18(() => {
4809
+ const initialValue = useMemo19(() => {
4817
4810
  const validValues = [
4818
4811
  "light",
4819
4812
  "dark"
@@ -4856,11 +4849,13 @@ export {
4856
4849
  DappChrome,
4857
4850
  DappChromeLarge,
4858
4851
  DappContainer,
4852
+ DappContainerMemo,
4859
4853
  DappInstallTypeFilters,
4860
4854
  DappIntentResourceHooks,
4861
4855
  DappMenuDrawer,
4862
4856
  DappMenuResourceHooks,
4863
4857
  DappPage,
4858
+ DappPathHelpers,
4864
4859
  DappPathSwitcher,
4865
4860
  DappTitle,
4866
4861
  DappWindow,
@@ -4894,7 +4889,6 @@ export {
4894
4889
  TableHeadEx,
4895
4890
  TwoToneBulletPoint,
4896
4891
  TwoToneBulletPointList,
4897
- UpperWidgetTrayLayout,
4898
4892
  WidgetCaller,
4899
4893
  WidgetCard,
4900
4894
  WidgetCardExamples,
@@ -4903,8 +4897,8 @@ export {
4903
4897
  XyOsUi,
4904
4898
  XyOsUiContext,
4905
4899
  XyOsUiContextProvider,
4906
- dappState,
4907
4900
  decomposeDappSet,
4901
+ deriveDappState,
4908
4902
  detectCustomer,
4909
4903
  getApiDomain,
4910
4904
  getNodePaletteByNameCode,