@xyo-network/os-react-runtime 4.2.0-rc.1 → 4.2.0-rc.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/hooks/os/useDappContextCreator.d.ts.map +1 -1
- package/dist/browser/index.mjs +32 -27
- package/dist/browser/index.mjs.map +1 -1
- package/dist/browser/modules/Dapp/Container.d.ts +1 -0
- package/dist/browser/modules/Dapp/Container.d.ts.map +1 -1
- package/dist/browser/modules/Dapp/Page/Row.d.ts.map +1 -1
- package/dist/browser/modules/Dapp/modules/Window/DappWindow.d.ts.map +1 -1
- package/dist/browser/modules/Dapp/modules/Window/hooks/lib/deriveDappState.d.ts +3 -3
- package/dist/browser/modules/Dapp/modules/Window/hooks/lib/deriveDappState.d.ts.map +1 -1
- package/package.json +9 -9
- package/src/hooks/os/useDappContextCreator.tsx +20 -15
- package/src/modules/Dapp/Container.tsx +5 -3
- package/src/modules/Dapp/Page/Row.tsx +4 -5
- package/src/modules/Dapp/modules/Window/DappWindow.tsx +2 -4
- package/src/modules/Dapp/modules/Window/hooks/lib/deriveDappState.ts +6 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDappContextCreator.d.ts","sourceRoot":"","sources":["../../../../src/hooks/os/useDappContextCreator.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,UAAU,EAAE,cAAc,EAAE,iBAAiB,EAC9C,MAAM,uBAAuB,CAAA;AAS9B;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,eACpB,MAAM,GAAG,SAAS,cAClB,MAAM,GAAG,SAAS,SACvB,cAAc,kBACL,UAAU,iBACX,MAAM,EAAE,8BAEtB,iBAAiB,GAAG;IACrB,eAAe,CAAC,EAAE,KAAK,CAAA;
|
|
1
|
+
{"version":3,"file":"useDappContextCreator.d.ts","sourceRoot":"","sources":["../../../../src/hooks/os/useDappContextCreator.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,UAAU,EAAE,cAAc,EAAE,iBAAiB,EAC9C,MAAM,uBAAuB,CAAA;AAS9B;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,eACpB,MAAM,GAAG,SAAS,cAClB,MAAM,GAAG,SAAS,SACvB,cAAc,kBACL,UAAU,iBACX,MAAM,EAAE,8BAEtB,iBAAiB,GAAG;IACrB,eAAe,CAAC,EAAE,KAAK,CAAA;CAgExB,CAAA"}
|
package/dist/browser/index.mjs
CHANGED
|
@@ -167,7 +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, { useMemo as useMemo13 } from "react";
|
|
170
|
+
import React26, { memo, useMemo as useMemo13 } from "react";
|
|
171
171
|
|
|
172
172
|
// src/hooks/access-requests/useBuildDappAccessRequestResource.ts
|
|
173
173
|
import { usePromise } from "@xylabs/react-promise";
|
|
@@ -639,6 +639,7 @@ var useDappContextCreator = /* @__PURE__ */ __name((xnsNodeUrl, xnsNetwork, dapp
|
|
|
639
639
|
dappWallet: void 0
|
|
640
640
|
});
|
|
641
641
|
const [dappWindowNodeError, setDappWindowNodeError] = useState3();
|
|
642
|
+
const targetedDapp = !!(dapp && context && currentIntent?.targetDappId === dapp?.config.name);
|
|
642
643
|
const windowDappNodeSetRef = useRef(windowDappNodeSet);
|
|
643
644
|
useEffect7(() => {
|
|
644
645
|
windowDappNodeSetRef.current = windowDappNodeSet;
|
|
@@ -646,7 +647,7 @@ var useDappContextCreator = /* @__PURE__ */ __name((xnsNodeUrl, xnsNetwork, dapp
|
|
|
646
647
|
windowDappNodeSet
|
|
647
648
|
]);
|
|
648
649
|
const createNode = useCallback3(async () => {
|
|
649
|
-
if (
|
|
650
|
+
if (targetedDapp) {
|
|
650
651
|
try {
|
|
651
652
|
const windowDappNodeSet2 = await RunningDappCache.findOrCreate(dapp, context, allowedNames ?? [], xnsNodeUrl, xnsNetwork);
|
|
652
653
|
setWindowDappNodeSet(windowDappNodeSet2);
|
|
@@ -656,6 +657,7 @@ var useDappContextCreator = /* @__PURE__ */ __name((xnsNodeUrl, xnsNetwork, dapp
|
|
|
656
657
|
}
|
|
657
658
|
}, [
|
|
658
659
|
dapp,
|
|
660
|
+
currentIntent,
|
|
659
661
|
context,
|
|
660
662
|
allowedNames
|
|
661
663
|
]);
|
|
@@ -670,22 +672,24 @@ var useDappContextCreator = /* @__PURE__ */ __name((xnsNodeUrl, xnsNetwork, dapp
|
|
|
670
672
|
createNode
|
|
671
673
|
]);
|
|
672
674
|
useAsyncEffect2(async () => {
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
675
|
+
if (targetedDapp) {
|
|
676
|
+
switch (currentIntent?.intent) {
|
|
677
|
+
case DappIntentTypes4.Launch: {
|
|
678
|
+
await createNode();
|
|
679
|
+
break;
|
|
680
|
+
}
|
|
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;
|
|
685
690
|
}
|
|
686
|
-
|
|
691
|
+
case DappIntentTypes4.Minimize:
|
|
687
692
|
}
|
|
688
|
-
case DappIntentTypes4.Minimize:
|
|
689
693
|
}
|
|
690
694
|
}, [
|
|
691
695
|
createNode,
|
|
@@ -2152,14 +2156,14 @@ var DappPathHelpers = {
|
|
|
2152
2156
|
|
|
2153
2157
|
// src/modules/Dapp/modules/Window/hooks/lib/deriveDappState.ts
|
|
2154
2158
|
import { DappIntentTypes as DappIntentTypes7 } from "@xyo-network/os-model";
|
|
2155
|
-
var deriveDappState = /* @__PURE__ */ __name((intent
|
|
2159
|
+
var deriveDappState = /* @__PURE__ */ __name((intent) => {
|
|
2156
2160
|
const minimized = intent?.intent === DappIntentTypes7.Minimize;
|
|
2157
|
-
const
|
|
2158
|
-
const
|
|
2161
|
+
const active = intent?.intent === DappIntentTypes7.Launch;
|
|
2162
|
+
const closed = intent?.intent === DappIntentTypes7.Close;
|
|
2159
2163
|
return {
|
|
2160
2164
|
active,
|
|
2161
|
-
|
|
2162
|
-
|
|
2165
|
+
closed,
|
|
2166
|
+
minimized
|
|
2163
2167
|
};
|
|
2164
2168
|
}, "deriveDappState");
|
|
2165
2169
|
|
|
@@ -3141,7 +3145,7 @@ var DappMenuDrawer = /* @__PURE__ */ __name(({ activePath, context, iconSvg, nam
|
|
|
3141
3145
|
// src/modules/Dapp/modules/Window/DappWindow.tsx
|
|
3142
3146
|
var DappWindow = /* @__PURE__ */ __name(({ context, dappSet, dappState, dappWallet, intent, nodeCreateError }) => {
|
|
3143
3147
|
const { DappComponent, name, scrollable = true, version } = decomposeDappSet(dappSet);
|
|
3144
|
-
const { active, minimized
|
|
3148
|
+
const { active, minimized } = dappState ?? {};
|
|
3145
3149
|
const TypedDappComponent = useMemo12(() => DappComponent, []);
|
|
3146
3150
|
const errors = useManageDappBasedOffRoute(intent, name, context);
|
|
3147
3151
|
useSyncOsRegisteredAccessInterfaces(context);
|
|
@@ -3178,7 +3182,7 @@ var DappWindow = /* @__PURE__ */ __name(({ context, dappSet, dappState, dappWall
|
|
|
3178
3182
|
splashScreen: resolvedError ? null : /* @__PURE__ */ React25.createElement(DappLoadingFlexbox, {
|
|
3179
3183
|
minimize: !!minimized,
|
|
3180
3184
|
name,
|
|
3181
|
-
open: !!
|
|
3185
|
+
open: !!active
|
|
3182
3186
|
})
|
|
3183
3187
|
}, resolvedError || errors?.length > 0 ? /* @__PURE__ */ React25.createElement(FlexCol10, {
|
|
3184
3188
|
padding: 2
|
|
@@ -3219,11 +3223,10 @@ var DappContainer = /* @__PURE__ */ __name(({ currentIntent, dappSet, xnsNodeUrl
|
|
|
3219
3223
|
const { dappWallet, context, nodeCreateError } = useDappContextCreator(xnsNodeUrl, xnsNetwork, dapp, currentIntent);
|
|
3220
3224
|
const dappState = useMemo13(() => {
|
|
3221
3225
|
if (currentIntent?.targetDappId === dapp.config.name) {
|
|
3222
|
-
return deriveDappState(currentIntent
|
|
3226
|
+
return deriveDappState(currentIntent);
|
|
3223
3227
|
}
|
|
3224
3228
|
}, [
|
|
3225
3229
|
currentIntent,
|
|
3226
|
-
context,
|
|
3227
3230
|
dapp
|
|
3228
3231
|
]);
|
|
3229
3232
|
return /* @__PURE__ */ React26.createElement(DappIconButton, {
|
|
@@ -3240,6 +3243,7 @@ var DappContainer = /* @__PURE__ */ __name(({ currentIntent, dappSet, xnsNodeUrl
|
|
|
3240
3243
|
nodeCreateError
|
|
3241
3244
|
}));
|
|
3242
3245
|
}, "DappContainer");
|
|
3246
|
+
var DappContainerMemo = /* @__PURE__ */ memo(DappContainer);
|
|
3243
3247
|
|
|
3244
3248
|
// src/modules/Dapp/ContainerFlexbox.tsx
|
|
3245
3249
|
import { Container as Container2 } from "@mui/material";
|
|
@@ -3301,9 +3305,9 @@ var DappsRow = /* @__PURE__ */ __name(({ chipLabel, installType, registeredDapps
|
|
|
3301
3305
|
})), filteredRegisteredDappSets?.length ? /* @__PURE__ */ React29.createElement(Fade2, {
|
|
3302
3306
|
in: !!filteredRegisteredDappSets?.length,
|
|
3303
3307
|
timeout: 1e3
|
|
3304
|
-
}, /* @__PURE__ */ React29.createElement(StyledGridContainer, null, filteredRegisteredDappSets?.map((dappSet
|
|
3308
|
+
}, /* @__PURE__ */ React29.createElement(StyledGridContainer, null, filteredRegisteredDappSets?.map((dappSet) => /* @__PURE__ */ React29.createElement(DappContainerMemo, {
|
|
3305
3309
|
currentIntent: intentPayload,
|
|
3306
|
-
key:
|
|
3310
|
+
key: dappSet.dapp.config.name,
|
|
3307
3311
|
dappSet,
|
|
3308
3312
|
xnsNodeUrl,
|
|
3309
3313
|
xnsNetwork
|
|
@@ -4844,6 +4848,7 @@ export {
|
|
|
4844
4848
|
DappChrome,
|
|
4845
4849
|
DappChromeLarge,
|
|
4846
4850
|
DappContainer,
|
|
4851
|
+
DappContainerMemo,
|
|
4847
4852
|
DappInstallTypeFilters,
|
|
4848
4853
|
DappIntentResourceHooks,
|
|
4849
4854
|
DappMenuDrawer,
|