@ic-reactor/react 1.4.1 → 1.4.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/context/agent.js
CHANGED
|
@@ -97,12 +97,10 @@ const createAgentContext = (config = {}) => {
|
|
|
97
97
|
const { disableAuthenticateOnMount: defaultDisable } = config, contextOptions = __rest(config, ["disableAuthenticateOnMount"]);
|
|
98
98
|
const AgentContext = react_1.default.createContext(null);
|
|
99
99
|
const AgentProvider = (_a) => {
|
|
100
|
-
var { children, agentManager: mybeAgentManager, disableAuthenticateOnMount = defaultDisable !== null && defaultDisable !== void 0 ? defaultDisable : false } = _a, options = __rest(_a, ["children", "agentManager", "disableAuthenticateOnMount"]);
|
|
100
|
+
var { children, agentManager: mybeAgentManager, withProcessEnv = config.withProcessEnv, disableAuthenticateOnMount = defaultDisable !== null && defaultDisable !== void 0 ? defaultDisable : false } = _a, options = __rest(_a, ["children", "agentManager", "withProcessEnv", "disableAuthenticateOnMount"]);
|
|
101
101
|
const hooks = react_1.default.useMemo(() => {
|
|
102
|
-
const withLocalEnv =
|
|
103
|
-
|
|
104
|
-
: undefined;
|
|
105
|
-
const agentManager = mybeAgentManager !== null && mybeAgentManager !== void 0 ? mybeAgentManager : (0, core_1.createAgentManager)(Object.assign(Object.assign(Object.assign({}, options), contextOptions), { withLocalEnv }));
|
|
102
|
+
const withLocalEnv = withProcessEnv ? (0, utils_1.isInLocalOrDevelopment)() : undefined;
|
|
103
|
+
const agentManager = mybeAgentManager !== null && mybeAgentManager !== void 0 ? mybeAgentManager : (0, core_1.createAgentManager)(Object.assign(Object.assign({ withLocalEnv }, options), contextOptions));
|
|
106
104
|
if (!disableAuthenticateOnMount) {
|
|
107
105
|
agentManager.authenticate();
|
|
108
106
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Hook for making update calls to actors, handling loading states, and managing errors. It supports custom event handlers for loading, success, and error events.
|
|
2
|
+
* 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.
|
|
3
3
|
*
|
|
4
4
|
* @param options Configuration object for the actor method call, including the method name, arguments, and event handlers.
|
|
5
5
|
* @returns An object containing the method call function, a reset function to reset the call state to its default, and the current call state (data, error, loading, call, reset).
|
|
6
6
|
* @example
|
|
7
7
|
* ```tsx
|
|
8
|
-
* function
|
|
9
|
-
* const { call, data, loading } =
|
|
8
|
+
* function MethodCallComponent() {
|
|
9
|
+
* const { call, data, loading } = useMethod({
|
|
10
10
|
* functionName: 'updateUserProfile',
|
|
11
11
|
* args: ['123', { name: 'John Doe' }],
|
|
12
12
|
* onLoading: (loading) => console.log('Loading:', loading),
|
|
@@ -3,14 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.useMethod = void 0;
|
|
4
4
|
const hooks_1 = require("./hooks");
|
|
5
5
|
/**
|
|
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.
|
|
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.
|
|
7
7
|
*
|
|
8
8
|
* @param options Configuration object for the actor method call, including the method name, arguments, and event handlers.
|
|
9
9
|
* @returns An object containing the method call function, a reset function to reset the call state to its default, and the current call state (data, error, loading, call, reset).
|
|
10
10
|
* @example
|
|
11
11
|
* ```tsx
|
|
12
|
-
* function
|
|
13
|
-
* const { call, data, loading } =
|
|
12
|
+
* function MethodCallComponent() {
|
|
13
|
+
* const { call, data, loading } = useMethod({
|
|
14
14
|
* functionName: 'updateUserProfile',
|
|
15
15
|
* args: ['123', { name: 'John Doe' }],
|
|
16
16
|
* onLoading: (loading) => console.log('Loading:', loading),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ic-reactor/react",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.3",
|
|
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,7 +35,7 @@
|
|
|
35
35
|
"node": ">=10"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@ic-reactor/core": "^1.4.
|
|
38
|
+
"@ic-reactor/core": "^1.4.1",
|
|
39
39
|
"zustand-utils": "^1.3"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
@@ -47,5 +47,5 @@
|
|
|
47
47
|
"react": ">=16.8",
|
|
48
48
|
"zustand": "4.5"
|
|
49
49
|
},
|
|
50
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "86cb46dd7015edaed6b82601ff83e07ed8f43c99"
|
|
51
51
|
}
|