@ic-reactor/react 0.5.2 → 0.5.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.
@@ -58,7 +58,7 @@ const useActor = () => {
58
58
  };
59
59
  exports.useActor = useActor;
60
60
  const ActorProvider = (_a) => {
61
- var { children, canisterId, agentContext, loadingComponent = react_1.default.createElement("div", null, "Loading..."), withServiceField = false } = _a, config = __rest(_a, ["children", "canisterId", "agentContext", "loadingComponent", "withServiceField"]);
61
+ var { children, canisterId, agentContext, loadingComponent = react_1.default.createElement("div", null, "Loading..."), withServiceFields = false } = _a, config = __rest(_a, ["children", "canisterId", "agentContext", "loadingComponent", "withServiceFields"]);
62
62
  const agentManager = (0, agent_1.useAgentManager)(agentContext);
63
63
  const [didJs, setDidJS] = (0, react_1.useState)();
64
64
  const [fetching, setFetching] = (0, react_1.useState)(false);
@@ -112,7 +112,7 @@ const ActorProvider = (_a) => {
112
112
  agentManager,
113
113
  canisterId,
114
114
  withDevtools: config.withDevtools,
115
- withServiceField: withServiceField,
115
+ withServiceFields: withServiceFields,
116
116
  });
117
117
  }
118
118
  catch (err) {
@@ -1,3 +1,3 @@
1
1
  import type { ActorManager } from "@ic-reactor/store";
2
2
  import type { ActorHooks } from "../types";
3
- export declare const getActorHooks: <A extends unknown>({ initialize, serviceFields, withServiceField, canisterId, actorStore, callMethod, }: ActorManager<A>) => ActorHooks<A, boolean>;
3
+ export declare const getActorHooks: <A extends unknown>({ initialize, serviceFields, withServiceFields, canisterId, actorStore, callMethod, }: ActorManager<A>) => ActorHooks<A, boolean>;
@@ -23,14 +23,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
23
23
  exports.getActorHooks = void 0;
24
24
  const react_1 = require("react");
25
25
  const zustand_1 = require("zustand");
26
- const getActorHooks = ({ initialize, serviceFields, withServiceField, canisterId, actorStore, callMethod, }) => {
26
+ const getActorHooks = ({ initialize, serviceFields, withServiceFields, canisterId, actorStore, callMethod, }) => {
27
27
  const useActorStore = () => {
28
28
  const actorState = (0, zustand_1.useStore)(actorStore, (state) => state);
29
29
  return Object.assign(Object.assign({}, actorState), { canisterId });
30
30
  };
31
31
  const useServiceFields = () => {
32
- if (!withServiceField || !serviceFields) {
33
- throw new Error("Service fields not initialized. Pass `withServiceField` to initialize service fields.");
32
+ if (!withServiceFields || !serviceFields) {
33
+ throw new Error("Service fields not initialized. Pass `withServiceFields` to initialize service fields.");
34
34
  }
35
35
  return serviceFields;
36
36
  };
package/dist/index.js CHANGED
@@ -33,14 +33,14 @@ __exportStar(require("@ic-reactor/store"), exports);
33
33
  __exportStar(require("./context/agent"), exports);
34
34
  __exportStar(require("./context/actor"), exports);
35
35
  const createReActor = (_a) => {
36
- var { isLocalEnv, withServiceField } = _a, options = __rest(_a, ["isLocalEnv", "withServiceField"]);
36
+ var { isLocalEnv, withServiceFields } = _a, options = __rest(_a, ["isLocalEnv", "withServiceFields"]);
37
37
  isLocalEnv =
38
38
  isLocalEnv ||
39
39
  (typeof process !== "undefined" &&
40
40
  (process.env.DFX_NETWORK === "local" ||
41
41
  process.env.NODE_ENV === "development"));
42
42
  const actorManager = (0, store_1.createReActorStore)(Object.assign({ isLocalEnv,
43
- withServiceField }, options));
43
+ withServiceFields }, options));
44
44
  return Object.assign(Object.assign({}, (0, actor_1.getActorHooks)(actorManager)), (0, auth_1.getAuthHooks)(actorManager.agentManager));
45
45
  };
46
46
  exports.createReActor = createReActor;
package/dist/types.d.ts CHANGED
@@ -69,9 +69,9 @@ export interface ActorDefaultHooks<A, W extends boolean = false> {
69
69
  }
70
70
  export type CreateReActor = {
71
71
  <A extends ActorSubclass<any>>(options: CreateReActorOptions & {
72
- withServiceField: true;
72
+ withServiceFields: true;
73
73
  }): ActorHooksWithField<A> & AuthHooks;
74
74
  <A extends ActorSubclass<any>>(options: CreateReActorOptions & {
75
- withServiceField?: false | undefined;
75
+ withServiceFields?: false | undefined;
76
76
  }): ActorHooksWithoutField<A> & AuthHooks;
77
77
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ic-reactor/react",
3
- "version": "0.5.2",
3
+ "version": "0.5.3",
4
4
  "description": "A React library for interacting with Dfinity actors",
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/store": "^0.5.1",
38
+ "@ic-reactor/store": "^0.5.2",
39
39
  "zustand-utils": "^1.3"
40
40
  },
41
41
  "peerDependencies": {
@@ -48,5 +48,5 @@
48
48
  "react": ">=16.8",
49
49
  "zustand": "4.4"
50
50
  },
51
- "gitHead": "2d329807181eabc24dd5d9dfc677eac0a0b12a6d"
51
+ "gitHead": "581df4947caeb34fcdf2b773e5f8543fdb5ceaaa"
52
52
  }