@ic-reactor/react 1.13.0 → 1.14.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.
- package/dist/context/actor/create.js +1 -2
- package/dist/context/actor/hooks/useActorInterface.js +1 -2
- package/dist/context/actor/hooks/useMethod.js +1 -2
- package/dist/context/actor/hooks/useQueryCall.js +1 -2
- package/dist/context/actor/hooks/useUpdateCall.js +1 -2
- package/dist/context/actor/hooks/useVisitMethod.js +1 -2
- package/dist/context/actor/hooks/useVisitService.js +1 -2
- package/dist/context/actor/provider.d.ts +0 -1
- package/dist/context/actor/types.d.ts +0 -1
- package/dist/context/adapter/create.js +1 -2
- package/dist/context/adapter/index.d.ts +0 -1
- package/dist/context/adapter/provider.d.ts +0 -1
- package/dist/context/agent/create.js +1 -2
- package/dist/context/agent/hooks/useAuth.d.ts +1 -1
- package/dist/context/agent/index.d.ts +0 -1
- package/dist/context/agent/provider.d.ts +0 -1
- package/dist/helpers/authHooks.js +0 -7
- package/dist/helpers/extractActorContext.js +1 -2
- package/dist/helpers/types.d.ts +0 -1
- package/package.json +16 -8
|
@@ -14,7 +14,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
14
14
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.createActorContext =
|
|
17
|
+
exports.createActorContext = createActorContext;
|
|
18
18
|
const react_1 = __importDefault(require("react"));
|
|
19
19
|
const useActor_1 = require("../../hooks/useActor");
|
|
20
20
|
const extractActorContext_1 = require("../../helpers/extractActorContext");
|
|
@@ -112,4 +112,3 @@ function createActorContext(contextConfig = {}) {
|
|
|
112
112
|
return Object.assign({ ActorProvider,
|
|
113
113
|
ActorHookProvider }, (0, extractActorContext_1.extractActorContext)(ActorContext));
|
|
114
114
|
}
|
|
115
|
-
exports.createActorContext = createActorContext;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useActorInterface =
|
|
3
|
+
exports.useActorInterface = useActorInterface;
|
|
4
4
|
const __1 = require("..");
|
|
5
5
|
/**
|
|
6
6
|
*
|
|
@@ -8,4 +8,3 @@ const __1 = require("..");
|
|
|
8
8
|
function useActorInterface() {
|
|
9
9
|
return __1.ActorHooks.useActorInterface();
|
|
10
10
|
}
|
|
11
|
-
exports.useActorInterface = useActorInterface;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useMethod =
|
|
3
|
+
exports.useMethod = useMethod;
|
|
4
4
|
const __1 = require("..");
|
|
5
5
|
/**
|
|
6
6
|
* Hook for making dynamically update or query calls to actors, handling loading states, and managing errors. It supports custom event handlers for loading, success, and error events.
|
|
@@ -32,4 +32,3 @@ const __1 = require("..");
|
|
|
32
32
|
function useMethod(args) {
|
|
33
33
|
return __1.ActorHooks.useMethod(args);
|
|
34
34
|
}
|
|
35
|
-
exports.useMethod = useMethod;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useQueryCall =
|
|
3
|
+
exports.useQueryCall = useQueryCall;
|
|
4
4
|
const __1 = require("..");
|
|
5
5
|
/**
|
|
6
6
|
* Hook for making query calls to actors. It supports automatic refetching on component mount and at specified intervals.
|
|
@@ -31,4 +31,3 @@ const __1 = require("..");
|
|
|
31
31
|
function useQueryCall(args) {
|
|
32
32
|
return __1.ActorHooks.useQueryCall(args);
|
|
33
33
|
}
|
|
34
|
-
exports.useQueryCall = useQueryCall;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useUpdateCall =
|
|
3
|
+
exports.useUpdateCall = useUpdateCall;
|
|
4
4
|
const __1 = require("..");
|
|
5
5
|
/**
|
|
6
6
|
* Hook for making update calls to actors, handling loading states, and managing errors. It supports custom event handlers for loading, success, and error events.
|
|
@@ -32,4 +32,3 @@ const __1 = require("..");
|
|
|
32
32
|
function useUpdateCall(args) {
|
|
33
33
|
return __1.ActorHooks.useUpdateCall(args);
|
|
34
34
|
}
|
|
35
|
-
exports.useUpdateCall = useUpdateCall;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useVisitMethod =
|
|
3
|
+
exports.useVisitMethod = useVisitMethod;
|
|
4
4
|
const __1 = require("..");
|
|
5
5
|
/**
|
|
6
6
|
* Memoizes and returns a visit service function for a specific actor method.
|
|
@@ -11,4 +11,3 @@ const __1 = require("..");
|
|
|
11
11
|
function useVisitMethod(functionName) {
|
|
12
12
|
return __1.ActorHooks.useVisitMethod(functionName);
|
|
13
13
|
}
|
|
14
|
-
exports.useVisitMethod = useVisitMethod;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useVisitService =
|
|
3
|
+
exports.useVisitService = useVisitService;
|
|
4
4
|
const __1 = require("..");
|
|
5
5
|
/**
|
|
6
6
|
* Memoizes and returns a visit service function for a specific actor method.
|
|
@@ -11,4 +11,3 @@ const __1 = require("..");
|
|
|
11
11
|
function useVisitService() {
|
|
12
12
|
return __1.ActorHooks.useVisitService();
|
|
13
13
|
}
|
|
14
|
-
exports.useVisitService = useVisitService;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
/**
|
|
3
2
|
* `ActorProvider` is a React functional component that serves as a context provider for IC actor interactions within a React application.
|
|
4
3
|
* It wraps child components, providing them access to actor-specific hooks and functionalities based on the provided canister ID and configuration.
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import type { IDL, ActorHooksReturnType, BaseActor, ActorManagerParameters, CanisterId, InitializeActor } from "../../types";
|
|
3
2
|
export interface CreateActorContextType<A = BaseActor> extends ActorHooksReturnType<A> {
|
|
4
3
|
useInitializeActor?: () => InitializeActor;
|
|
@@ -23,7 +23,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
23
23
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.createAdapterContext =
|
|
26
|
+
exports.createAdapterContext = createAdapterContext;
|
|
27
27
|
const react_1 = __importDefault(require("react"));
|
|
28
28
|
const agent_1 = require("../agent");
|
|
29
29
|
const core_1 = require("@ic-reactor/core");
|
|
@@ -107,4 +107,3 @@ function createAdapterContext(config = {}) {
|
|
|
107
107
|
useCandidAdapter,
|
|
108
108
|
};
|
|
109
109
|
}
|
|
110
|
-
exports.createAdapterContext = createAdapterContext;
|
|
@@ -14,7 +14,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
14
14
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.createAgentContext =
|
|
17
|
+
exports.createAgentContext = createAgentContext;
|
|
18
18
|
const react_1 = __importDefault(require("react"));
|
|
19
19
|
const core_1 = require("@ic-reactor/core");
|
|
20
20
|
const agentHooks_1 = require("../../helpers/agentHooks");
|
|
@@ -109,4 +109,3 @@ function createAgentContext(config = {}) {
|
|
|
109
109
|
AgentProvider.displayName = "AgentProvider";
|
|
110
110
|
return Object.assign({ AgentContext, AgentProvider }, (0, extractAgentContext_1.extractAgentContext)(AgentContext));
|
|
111
111
|
}
|
|
112
|
-
exports.createAgentContext = createAgentContext;
|
|
@@ -54,4 +54,4 @@
|
|
|
54
54
|
*
|
|
55
55
|
* This hook simplifies integrating authentication flows into your IC application, providing hooks for various stages of the authentication process.
|
|
56
56
|
*/
|
|
57
|
-
export declare const useAuth: (options?: import("../../../types").UseAuthParameters
|
|
57
|
+
export declare const useAuth: (options?: import("../../../types").UseAuthParameters) => import("../../../types").UseAuthReturnType;
|
|
@@ -21,7 +21,6 @@ const authHooks = (agentManager) => {
|
|
|
21
21
|
const useAuthState = () => (0, zustand_1.useStore)(authStore);
|
|
22
22
|
const useUserPrincipal = () => { var _a, _b; return (_b = (_a = useAuthState()) === null || _a === void 0 ? void 0 : _a.identity) === null || _b === void 0 ? void 0 : _b.getPrincipal(); };
|
|
23
23
|
const useAuth = ({ onAuthentication, onAuthenticationSuccess, onAuthenticationFailure, onLogin, onLoginSuccess, onLoginError, onLoggedOut, } = {}) => {
|
|
24
|
-
const network = react_1.default.useRef("ic");
|
|
25
24
|
const [loginState, setLoginState] = react_1.default.useState({
|
|
26
25
|
loading: false,
|
|
27
26
|
error: undefined,
|
|
@@ -98,12 +97,6 @@ const authHooks = (agentManager) => {
|
|
|
98
97
|
yield authenticate();
|
|
99
98
|
onLoggedOut === null || onLoggedOut === void 0 ? void 0 : onLoggedOut();
|
|
100
99
|
}), [onLoggedOut]);
|
|
101
|
-
react_1.default.useEffect(() => agentManager.subscribeAgentState((state) => {
|
|
102
|
-
if (network.current !== state.network) {
|
|
103
|
-
network.current = state.network;
|
|
104
|
-
authenticate();
|
|
105
|
-
}
|
|
106
|
-
}), []);
|
|
107
100
|
return {
|
|
108
101
|
authenticated,
|
|
109
102
|
authenticating,
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.extractActorContext =
|
|
6
|
+
exports.extractActorContext = extractActorContext;
|
|
7
7
|
const react_1 = __importDefault(require("react"));
|
|
8
8
|
function extractActorContext(actorContext) {
|
|
9
9
|
const useActorContext = () => {
|
|
@@ -42,4 +42,3 @@ function extractActorContext(actorContext) {
|
|
|
42
42
|
initialize,
|
|
43
43
|
};
|
|
44
44
|
}
|
|
45
|
-
exports.extractActorContext = extractActorContext;
|
package/dist/helpers/types.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { CallConfig } from "@dfinity/agent";
|
|
3
2
|
import type { IDL, ActorState, AuthClientLoginOptions, ActorMethodParameters, ActorMethodReturnType, Identity, Principal, FunctionName, VisitService, AuthState, HttpAgent, AgentState, BaseActor, MethodAttributes, CompiledResult } from "../types";
|
|
4
3
|
export interface AgentHooksReturnType {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ic-reactor/react",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.14.2",
|
|
4
4
|
"description": "A React library for interacting with Internet Computer canisters",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -35,17 +35,25 @@
|
|
|
35
35
|
"node": ">=10"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@ic-reactor/core": "^1.
|
|
38
|
+
"@ic-reactor/core": "^1.14.1",
|
|
39
|
+
"zustand": "4.5",
|
|
39
40
|
"zustand-utils": "^1.3"
|
|
40
41
|
},
|
|
41
42
|
"peerDependencies": {
|
|
42
|
-
"@dfinity/agent": ">=2.
|
|
43
|
-
"@dfinity/auth-client": ">=2.
|
|
44
|
-
"@dfinity/candid": ">=2.
|
|
45
|
-
"@dfinity/identity": ">=2.
|
|
46
|
-
"@dfinity/principal": ">=2.
|
|
43
|
+
"@dfinity/agent": ">=2.1",
|
|
44
|
+
"@dfinity/auth-client": ">=2.1",
|
|
45
|
+
"@dfinity/candid": ">=2.1",
|
|
46
|
+
"@dfinity/identity": ">=2.1",
|
|
47
|
+
"@dfinity/principal": ">=2.1",
|
|
47
48
|
"react": ">=16.8",
|
|
48
49
|
"zustand": "4.5"
|
|
49
50
|
},
|
|
50
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "aea7af668dd77ce24373f4103b6910cfc8cc03de",
|
|
52
|
+
"devDependencies": {
|
|
53
|
+
"@dfinity/agent": ">=2.1",
|
|
54
|
+
"@dfinity/auth-client": ">=2.1",
|
|
55
|
+
"@types/node": "^22.9.0",
|
|
56
|
+
"@types/react": "^18",
|
|
57
|
+
"react": "^18"
|
|
58
|
+
}
|
|
51
59
|
}
|