@xyo-network/react-panel 2.35.0-rc.7 → 2.35.0-rc.8
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/cjs/contexts/Context.d.ts +2 -2
- package/dist/cjs/contexts/Context.d.ts.map +1 -1
- package/dist/cjs/contexts/Context.js +2 -2
- package/dist/cjs/contexts/Context.js.map +1 -1
- package/dist/cjs/contexts/Provider.d.ts +2 -2
- package/dist/cjs/contexts/Provider.d.ts.map +1 -1
- package/dist/cjs/contexts/Provider.js +9 -9
- package/dist/cjs/contexts/Provider.js.map +1 -1
- package/dist/cjs/contexts/State.d.ts +11 -11
- package/dist/cjs/contexts/State.d.ts.map +1 -1
- package/dist/cjs/contexts/State.js +9 -9
- package/dist/cjs/contexts/State.js.map +1 -1
- package/dist/cjs/contexts/use.d.ts +18 -4
- package/dist/cjs/contexts/use.d.ts.map +1 -1
- package/dist/cjs/contexts/use.js +4 -4
- package/dist/cjs/contexts/use.js.map +1 -1
- package/dist/docs.json +723 -276
- package/dist/esm/contexts/Context.d.ts +2 -2
- package/dist/esm/contexts/Context.d.ts.map +1 -1
- package/dist/esm/contexts/Context.js +1 -1
- package/dist/esm/contexts/Context.js.map +1 -1
- package/dist/esm/contexts/Provider.d.ts +2 -2
- package/dist/esm/contexts/Provider.d.ts.map +1 -1
- package/dist/esm/contexts/Provider.js +9 -9
- package/dist/esm/contexts/Provider.js.map +1 -1
- package/dist/esm/contexts/State.d.ts +11 -11
- package/dist/esm/contexts/State.d.ts.map +1 -1
- package/dist/esm/contexts/State.js +8 -8
- package/dist/esm/contexts/State.js.map +1 -1
- package/dist/esm/contexts/use.d.ts +18 -4
- package/dist/esm/contexts/use.d.ts.map +1 -1
- package/dist/esm/contexts/use.js +3 -3
- package/dist/esm/contexts/use.js.map +1 -1
- package/package.json +6 -6
- package/src/contexts/Context.ts +2 -2
- package/src/contexts/Provider.tsx +13 -15
- package/src/contexts/State.ts +11 -11
- package/src/contexts/use.ts +3 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import {
|
|
3
|
-
export declare const
|
|
2
|
+
import { PanelContextState } from './State';
|
|
3
|
+
export declare const PanelContext: import("react").Context<PanelContextState & import("@xyo-network/react-shared").ContextExState>;
|
|
4
4
|
//# sourceMappingURL=Context.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Context.d.ts","sourceRoot":"","sources":["../../../src/contexts/Context.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"Context.d.ts","sourceRoot":"","sources":["../../../src/contexts/Context.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAE3C,eAAO,MAAM,YAAY,iGAAuC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Context.js","sourceRoot":"","sources":["../../../src/contexts/Context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAI3D,MAAM,CAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"Context.js","sourceRoot":"","sources":["../../../src/contexts/Context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAI3D,MAAM,CAAC,MAAM,YAAY,GAAG,eAAe,EAAqB,CAAA"}
|
|
@@ -3,11 +3,11 @@ import { WithChildren } from '@xylabs/react-shared';
|
|
|
3
3
|
import { Archivist } from '@xyo-network/archivist';
|
|
4
4
|
import { XyoPayload } from '@xyo-network/payload';
|
|
5
5
|
import { XyoWitness } from '@xyo-network/witness';
|
|
6
|
-
export interface
|
|
6
|
+
export interface PanelProviderProps {
|
|
7
7
|
archivist?: Archivist;
|
|
8
8
|
witnesses?: XyoWitness<XyoPayload>[];
|
|
9
9
|
required?: boolean;
|
|
10
10
|
archive?: string;
|
|
11
11
|
}
|
|
12
|
-
export declare const
|
|
12
|
+
export declare const PanelProvider: React.FC<WithChildren<PanelProviderProps>>;
|
|
13
13
|
//# sourceMappingURL=Provider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Provider.d.ts","sourceRoot":"","sources":["../../../src/contexts/Provider.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAkB,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAEnE,OAAO,EAAE,SAAS,EAAoB,MAAM,wBAAwB,CAAA;AAGpE,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AAIjD,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AAMjD,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"Provider.d.ts","sourceRoot":"","sources":["../../../src/contexts/Provider.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAkB,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAEnE,OAAO,EAAE,SAAS,EAAoB,MAAM,wBAAwB,CAAA;AAGpE,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AAIjD,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AAMjD,MAAM,WAAW,kBAAkB;IACjC,SAAS,CAAC,EAAE,SAAS,CAAA;IACrB,SAAS,CAAC,EAAE,UAAU,CAAC,UAAU,CAAC,EAAE,CAAA;IACpC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,kBAAkB,CAAC,CAqFpE,CAAA"}
|
|
@@ -6,15 +6,15 @@ import { useArchive } from '@xyo-network/react-archive';
|
|
|
6
6
|
import { useArchivist } from '@xyo-network/react-archivist';
|
|
7
7
|
import { useAccount } from '@xyo-network/react-wallet';
|
|
8
8
|
import { useEffect, useState } from 'react';
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
export const
|
|
9
|
+
import { PanelContext } from './Context';
|
|
10
|
+
import { ReportStatus } from './State';
|
|
11
|
+
export const PanelProvider = ({ archivist: archivistProp, required = false, witnesses = [], children, }) => {
|
|
12
12
|
const { archive } = useArchive();
|
|
13
13
|
const { archivist } = useArchivist();
|
|
14
14
|
const [panel, setPanel] = useState();
|
|
15
15
|
const [history, setHistory] = useState();
|
|
16
16
|
const [progress, setProgress] = useState({});
|
|
17
|
-
const [status, setStatus] = useState(
|
|
17
|
+
const [status, setStatus] = useState(ReportStatus.Idle);
|
|
18
18
|
const [reportingErrors, setReportingErrors] = useState();
|
|
19
19
|
const { account } = useAccount();
|
|
20
20
|
useAsyncEffect(
|
|
@@ -30,20 +30,20 @@ export const XyoPanelProvider = ({ archivist: archivistProp, required = false, w
|
|
|
30
30
|
archivists: progress.archivists,
|
|
31
31
|
witnesses: progress.witnesses,
|
|
32
32
|
});
|
|
33
|
-
setStatus(errors ?
|
|
33
|
+
setStatus(errors ? ReportStatus.Failed : ReportStatus.Succeeded);
|
|
34
34
|
setReportingErrors(errors);
|
|
35
35
|
}
|
|
36
36
|
},
|
|
37
37
|
onReportStart: () => {
|
|
38
38
|
if (mounted()) {
|
|
39
39
|
setProgress({ archivists: {}, witnesses: {} });
|
|
40
|
-
setStatus(
|
|
40
|
+
setStatus(ReportStatus.Started);
|
|
41
41
|
}
|
|
42
42
|
},
|
|
43
43
|
onWitnessReportEnd: (witness, error) => {
|
|
44
44
|
const witnesses = progress.witnesses ?? {};
|
|
45
45
|
witnesses[witness.address] = {
|
|
46
|
-
status: error ?
|
|
46
|
+
status: error ? ReportStatus.Failed : ReportStatus.Succeeded,
|
|
47
47
|
witness,
|
|
48
48
|
};
|
|
49
49
|
if (mounted()) {
|
|
@@ -56,7 +56,7 @@ export const XyoPanelProvider = ({ archivist: archivistProp, required = false, w
|
|
|
56
56
|
onWitnessReportStart: (witness) => {
|
|
57
57
|
const witnesses = progress.witnesses ?? {};
|
|
58
58
|
witnesses[witness.address] = {
|
|
59
|
-
status:
|
|
59
|
+
status: ReportStatus.Started,
|
|
60
60
|
witness,
|
|
61
61
|
};
|
|
62
62
|
if (mounted()) {
|
|
@@ -77,6 +77,6 @@ export const XyoPanelProvider = ({ archivist: archivistProp, required = false, w
|
|
|
77
77
|
useEffect(() => {
|
|
78
78
|
setHistory(panel?.history);
|
|
79
79
|
}, [panel]);
|
|
80
|
-
return (_jsx(
|
|
80
|
+
return !required || panel ? (_jsx(PanelContext.Provider, { value: { history, panel, progress, provided: true, reportingErrors, status }, children: children })) : null;
|
|
81
81
|
};
|
|
82
82
|
//# sourceMappingURL=Provider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Provider.js","sourceRoot":"","sources":["../../../src/contexts/Provider.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,cAAc,EAAgB,MAAM,sBAAsB,CAAA;AACnE,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AAGtC,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAE7C,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAA;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAA;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAA;AAEtD,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAE3C,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"Provider.js","sourceRoot":"","sources":["../../../src/contexts/Provider.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,cAAc,EAAgB,MAAM,sBAAsB,CAAA;AACnE,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AAGtC,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAE7C,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAA;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CA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ACH;gBACH,CAAC;gBACD,SAAS,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC;aACpD,EACD,eAAe,CAChB;YACH,CAAC,CAAC,SAAS,CAAA;QACb,QAAQ,CAAC,KAAK,CAAC,CAAA;QACf,MAAM,KAAK,CAAC,CAAC,CAAC,CAAA;IAChB,CAAC;IACD,uDAAuD;IACvD,CAAC,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,CAAC,CACzC,CAAA;IAED,SAAS,CAAC,GAAG,EAAE;QACb,UAAU,CAAC,KAAK,EAAE,OAAO,CAAC,CAAA;IAC5B,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAA;IAEX,OAAO,CAAC,QAAQ,IAAI,KAAK,CAAC,CAAC,CAAC,CAC1B,KAAC,YAAY,CAAC,QAAQ,IAAC,KAAK,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,eAAe,EAAE,MAAM,EAAE,YAAG,QAAQ,GAAyB,CACxI,CAAC,CAAC,CAAC,IAAI,CAAA;AACV,CAAC,CAAA"}
|
|
@@ -2,30 +2,30 @@ import { XyoArchivistApi } from '@xyo-network/api';
|
|
|
2
2
|
import { XyoBoundWitness } from '@xyo-network/boundwitness';
|
|
3
3
|
import { XyoPanel } from '@xyo-network/panel';
|
|
4
4
|
import { XyoWitness } from '@xyo-network/witness';
|
|
5
|
-
export declare enum
|
|
5
|
+
export declare enum ReportStatus {
|
|
6
6
|
Idle = "idle",
|
|
7
7
|
Queued = "queued",
|
|
8
8
|
Started = "started",
|
|
9
9
|
Succeeded = "succeeded",
|
|
10
10
|
Failed = "failed"
|
|
11
11
|
}
|
|
12
|
-
export interface
|
|
12
|
+
export interface WitnessReportProgress {
|
|
13
13
|
witness: XyoWitness;
|
|
14
|
-
status:
|
|
14
|
+
status: ReportStatus;
|
|
15
15
|
}
|
|
16
|
-
export interface
|
|
16
|
+
export interface ArchivistApiReportProgress {
|
|
17
17
|
archivist: XyoArchivistApi;
|
|
18
|
-
status:
|
|
18
|
+
status: ReportStatus;
|
|
19
19
|
}
|
|
20
|
-
export interface
|
|
21
|
-
witnesses?: Record<string,
|
|
22
|
-
archivists?: Record<string,
|
|
20
|
+
export interface PanelReportProgress {
|
|
21
|
+
witnesses?: Record<string, WitnessReportProgress>;
|
|
22
|
+
archivists?: Record<string, ArchivistApiReportProgress>;
|
|
23
23
|
}
|
|
24
|
-
export interface
|
|
24
|
+
export interface PanelContextState {
|
|
25
25
|
panel?: XyoPanel;
|
|
26
26
|
history?: XyoBoundWitness[];
|
|
27
|
-
progress?:
|
|
28
|
-
status?:
|
|
27
|
+
progress?: PanelReportProgress;
|
|
28
|
+
status?: ReportStatus;
|
|
29
29
|
reportingErrors?: Error[];
|
|
30
30
|
}
|
|
31
31
|
//# sourceMappingURL=State.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"State.d.ts","sourceRoot":"","sources":["../../../src/contexts/State.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AAEjD,oBAAY,
|
|
1
|
+
{"version":3,"file":"State.d.ts","sourceRoot":"","sources":["../../../src/contexts/State.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AAEjD,oBAAY,YAAY;IACtB,IAAI,SAAS;IACb,MAAM,WAAW;IACjB,OAAO,YAAY;IACnB,SAAS,cAAc;IACvB,MAAM,WAAW;CAClB;AAED,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,UAAU,CAAA;IACnB,MAAM,EAAE,YAAY,CAAA;CACrB;AAED,MAAM,WAAW,0BAA0B;IACzC,SAAS,EAAE,eAAe,CAAA;IAC1B,MAAM,EAAE,YAAY,CAAA;CACrB;AAED,MAAM,WAAW,mBAAmB;IAClC,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,qBAAqB,CAAC,CAAA;IACjD,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,0BAA0B,CAAC,CAAA;CACxD;AAED,MAAM,WAAW,iBAAiB;IAChC,KAAK,CAAC,EAAE,QAAQ,CAAA;IAChB,OAAO,CAAC,EAAE,eAAe,EAAE,CAAA;IAC3B,QAAQ,CAAC,EAAE,mBAAmB,CAAA;IAC9B,MAAM,CAAC,EAAE,YAAY,CAAA;IACrB,eAAe,CAAC,EAAE,KAAK,EAAE,CAAA;CAC1B"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export var
|
|
2
|
-
(function (
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
})(
|
|
1
|
+
export var ReportStatus;
|
|
2
|
+
(function (ReportStatus) {
|
|
3
|
+
ReportStatus["Idle"] = "idle";
|
|
4
|
+
ReportStatus["Queued"] = "queued";
|
|
5
|
+
ReportStatus["Started"] = "started";
|
|
6
|
+
ReportStatus["Succeeded"] = "succeeded";
|
|
7
|
+
ReportStatus["Failed"] = "failed";
|
|
8
|
+
})(ReportStatus || (ReportStatus = {}));
|
|
9
9
|
//# sourceMappingURL=State.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"State.js","sourceRoot":"","sources":["../../../src/contexts/State.ts"],"names":[],"mappings":"AAKA,MAAM,CAAN,IAAY,
|
|
1
|
+
{"version":3,"file":"State.js","sourceRoot":"","sources":["../../../src/contexts/State.ts"],"names":[],"mappings":"AAKA,MAAM,CAAN,IAAY,YAMX;AAND,WAAY,YAAY;IACtB,6BAAa,CAAA;IACb,iCAAiB,CAAA;IACjB,mCAAmB,CAAA;IACnB,uCAAuB,CAAA;IACvB,iCAAiB,CAAA;AACnB,CAAC,EANW,YAAY,KAAZ,YAAY,QAMvB"}
|
|
@@ -1,8 +1,22 @@
|
|
|
1
|
-
export declare const
|
|
2
|
-
history:
|
|
1
|
+
export declare const usePanel: () => {
|
|
2
|
+
history: ({
|
|
3
|
+
schema: string;
|
|
4
|
+
} & {
|
|
5
|
+
previousHash?: string | undefined;
|
|
6
|
+
sources?: string[] | undefined;
|
|
7
|
+
timestamp?: number | undefined;
|
|
8
|
+
} & {
|
|
9
|
+
addresses: string[];
|
|
10
|
+
previous_hash?: string | undefined;
|
|
11
|
+
payload_hashes: string[];
|
|
12
|
+
payload_schemas: string[];
|
|
13
|
+
previous_hashes: (string | null)[];
|
|
14
|
+
schema: "network.xyo.boundwitness";
|
|
15
|
+
_signatures: string[];
|
|
16
|
+
})[] | undefined;
|
|
3
17
|
panel: import("@xyo-network/panel").XyoPanel | undefined;
|
|
4
|
-
progress: import("./State").
|
|
18
|
+
progress: import("./State").PanelReportProgress | undefined;
|
|
5
19
|
reportingErrors: Error[] | undefined;
|
|
6
|
-
status: import("./State").
|
|
20
|
+
status: import("./State").ReportStatus | undefined;
|
|
7
21
|
};
|
|
8
22
|
//# sourceMappingURL=use.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use.d.ts","sourceRoot":"","sources":["../../../src/contexts/use.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"use.d.ts","sourceRoot":"","sources":["../../../src/contexts/use.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;CAGpB,CAAA"}
|
package/dist/esm/contexts/use.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useContextEx } from '@xyo-network/react-shared';
|
|
2
|
-
import {
|
|
3
|
-
export const
|
|
4
|
-
const { panel, history, progress, reportingErrors, status } = useContextEx(
|
|
2
|
+
import { PanelContext } from './Context';
|
|
3
|
+
export const usePanel = () => {
|
|
4
|
+
const { panel, history, progress, reportingErrors, status } = useContextEx(PanelContext, 'XyoPanel');
|
|
5
5
|
return { history, panel, progress, reportingErrors, status };
|
|
6
6
|
};
|
|
7
7
|
//# sourceMappingURL=use.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use.js","sourceRoot":"","sources":["../../../src/contexts/use.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAExD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"use.js","sourceRoot":"","sources":["../../../src/contexts/use.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAExD,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAExC,MAAM,CAAC,MAAM,QAAQ,GAAG,GAAG,EAAE;IAC3B,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,EAAE,GAAG,YAAY,CAAC,YAAY,EAAE,UAAU,CAAC,CAAA;IACpG,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,EAAE,CAAA;AAC9D,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -10,11 +10,11 @@
|
|
|
10
10
|
"url": "https://github.com/XYOracleNetwork/sdk-xyo-react-js/issues"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@xylabs/react-shared": "^2.14.
|
|
14
|
-
"@xyo-network/react-archive": "^2.35.0-rc.
|
|
15
|
-
"@xyo-network/react-archivist": "^2.35.0-rc.
|
|
16
|
-
"@xyo-network/react-shared": "^2.35.0-rc.
|
|
17
|
-
"@xyo-network/react-wallet": "^2.35.0-rc.
|
|
13
|
+
"@xylabs/react-shared": "^2.14.20",
|
|
14
|
+
"@xyo-network/react-archive": "^2.35.0-rc.8",
|
|
15
|
+
"@xyo-network/react-archivist": "^2.35.0-rc.8",
|
|
16
|
+
"@xyo-network/react-shared": "^2.35.0-rc.8",
|
|
17
|
+
"@xyo-network/react-wallet": "^2.35.0-rc.8",
|
|
18
18
|
"tslib": "^2.4.0"
|
|
19
19
|
},
|
|
20
20
|
"peerDependencies": {
|
|
@@ -75,6 +75,6 @@
|
|
|
75
75
|
},
|
|
76
76
|
"sideEffects": false,
|
|
77
77
|
"types": "dist/esm/index.d.ts",
|
|
78
|
-
"version": "2.35.0-rc.
|
|
78
|
+
"version": "2.35.0-rc.8",
|
|
79
79
|
"stableVersion": "2.34.2"
|
|
80
80
|
}
|
package/src/contexts/Context.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createContextEx } from '@xyo-network/react-shared'
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { PanelContextState } from './State'
|
|
4
4
|
|
|
5
|
-
export const
|
|
5
|
+
export const PanelContext = createContextEx<PanelContextState>()
|
|
@@ -10,17 +10,17 @@ import { useAccount } from '@xyo-network/react-wallet'
|
|
|
10
10
|
import { XyoWitness } from '@xyo-network/witness'
|
|
11
11
|
import { useEffect, useState } from 'react'
|
|
12
12
|
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
13
|
+
import { PanelContext } from './Context'
|
|
14
|
+
import { PanelReportProgress, ReportStatus } from './State'
|
|
15
15
|
|
|
16
|
-
export interface
|
|
16
|
+
export interface PanelProviderProps {
|
|
17
17
|
archivist?: Archivist
|
|
18
18
|
witnesses?: XyoWitness<XyoPayload>[]
|
|
19
19
|
required?: boolean
|
|
20
20
|
archive?: string
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
export const
|
|
23
|
+
export const PanelProvider: React.FC<WithChildren<PanelProviderProps>> = ({
|
|
24
24
|
archivist: archivistProp,
|
|
25
25
|
required = false,
|
|
26
26
|
witnesses = [],
|
|
@@ -30,8 +30,8 @@ export const XyoPanelProvider: React.FC<WithChildren<XyoPanelProviderProps>> = (
|
|
|
30
30
|
const { archivist } = useArchivist()
|
|
31
31
|
const [panel, setPanel] = useState<XyoPanel>()
|
|
32
32
|
const [history, setHistory] = useState<XyoBoundWitness[]>()
|
|
33
|
-
const [progress, setProgress] = useState<
|
|
34
|
-
const [status, setStatus] = useState(
|
|
33
|
+
const [progress, setProgress] = useState<PanelReportProgress>({})
|
|
34
|
+
const [status, setStatus] = useState(ReportStatus.Idle)
|
|
35
35
|
const [reportingErrors, setReportingErrors] = useState<Error[]>()
|
|
36
36
|
|
|
37
37
|
const { account } = useAccount()
|
|
@@ -50,20 +50,20 @@ export const XyoPanelProvider: React.FC<WithChildren<XyoPanelProviderProps>> = (
|
|
|
50
50
|
archivists: progress.archivists,
|
|
51
51
|
witnesses: progress.witnesses,
|
|
52
52
|
})
|
|
53
|
-
setStatus(errors ?
|
|
53
|
+
setStatus(errors ? ReportStatus.Failed : ReportStatus.Succeeded)
|
|
54
54
|
setReportingErrors(errors)
|
|
55
55
|
}
|
|
56
56
|
},
|
|
57
57
|
onReportStart: () => {
|
|
58
58
|
if (mounted()) {
|
|
59
59
|
setProgress({ archivists: {}, witnesses: {} })
|
|
60
|
-
setStatus(
|
|
60
|
+
setStatus(ReportStatus.Started)
|
|
61
61
|
}
|
|
62
62
|
},
|
|
63
63
|
onWitnessReportEnd: (witness: XyoWitness, error?: Error) => {
|
|
64
64
|
const witnesses = progress.witnesses ?? {}
|
|
65
65
|
witnesses[witness.address] = {
|
|
66
|
-
status: error ?
|
|
66
|
+
status: error ? ReportStatus.Failed : ReportStatus.Succeeded,
|
|
67
67
|
witness,
|
|
68
68
|
}
|
|
69
69
|
if (mounted()) {
|
|
@@ -76,7 +76,7 @@ export const XyoPanelProvider: React.FC<WithChildren<XyoPanelProviderProps>> = (
|
|
|
76
76
|
onWitnessReportStart: (witness: XyoWitness) => {
|
|
77
77
|
const witnesses = progress.witnesses ?? {}
|
|
78
78
|
witnesses[witness.address] = {
|
|
79
|
-
status:
|
|
79
|
+
status: ReportStatus.Started,
|
|
80
80
|
witness,
|
|
81
81
|
}
|
|
82
82
|
if (mounted()) {
|
|
@@ -102,9 +102,7 @@ export const XyoPanelProvider: React.FC<WithChildren<XyoPanelProviderProps>> = (
|
|
|
102
102
|
setHistory(panel?.history)
|
|
103
103
|
}, [panel])
|
|
104
104
|
|
|
105
|
-
return (
|
|
106
|
-
<
|
|
107
|
-
|
|
108
|
-
</XyoPanelContext.Provider>
|
|
109
|
-
)
|
|
105
|
+
return !required || panel ? (
|
|
106
|
+
<PanelContext.Provider value={{ history, panel, progress, provided: true, reportingErrors, status }}>{children}</PanelContext.Provider>
|
|
107
|
+
) : null
|
|
110
108
|
}
|
package/src/contexts/State.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { XyoBoundWitness } from '@xyo-network/boundwitness'
|
|
|
3
3
|
import { XyoPanel } from '@xyo-network/panel'
|
|
4
4
|
import { XyoWitness } from '@xyo-network/witness'
|
|
5
5
|
|
|
6
|
-
export enum
|
|
6
|
+
export enum ReportStatus {
|
|
7
7
|
Idle = 'idle',
|
|
8
8
|
Queued = 'queued',
|
|
9
9
|
Started = 'started',
|
|
@@ -11,25 +11,25 @@ export enum XyoReportStatus {
|
|
|
11
11
|
Failed = 'failed',
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
export interface
|
|
14
|
+
export interface WitnessReportProgress {
|
|
15
15
|
witness: XyoWitness
|
|
16
|
-
status:
|
|
16
|
+
status: ReportStatus
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
export interface
|
|
19
|
+
export interface ArchivistApiReportProgress {
|
|
20
20
|
archivist: XyoArchivistApi
|
|
21
|
-
status:
|
|
21
|
+
status: ReportStatus
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
export interface
|
|
25
|
-
witnesses?: Record<string,
|
|
26
|
-
archivists?: Record<string,
|
|
24
|
+
export interface PanelReportProgress {
|
|
25
|
+
witnesses?: Record<string, WitnessReportProgress>
|
|
26
|
+
archivists?: Record<string, ArchivistApiReportProgress>
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
export interface
|
|
29
|
+
export interface PanelContextState {
|
|
30
30
|
panel?: XyoPanel
|
|
31
31
|
history?: XyoBoundWitness[]
|
|
32
|
-
progress?:
|
|
33
|
-
status?:
|
|
32
|
+
progress?: PanelReportProgress
|
|
33
|
+
status?: ReportStatus
|
|
34
34
|
reportingErrors?: Error[]
|
|
35
35
|
}
|
package/src/contexts/use.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { useContextEx } from '@xyo-network/react-shared'
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { PanelContext } from './Context'
|
|
4
4
|
|
|
5
|
-
export const
|
|
6
|
-
const { panel, history, progress, reportingErrors, status } = useContextEx(
|
|
5
|
+
export const usePanel = () => {
|
|
6
|
+
const { panel, history, progress, reportingErrors, status } = useContextEx(PanelContext, 'XyoPanel')
|
|
7
7
|
return { history, panel, progress, reportingErrors, status }
|
|
8
8
|
}
|