@ic-reactor/react 1.2.2 → 1.2.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.
@@ -17,7 +17,7 @@ const react_1 = __importDefault(require("react"));
17
17
  const zustand_1 = require("zustand");
18
18
  const utils_1 = require("@ic-reactor/core/dist/utils");
19
19
  const authHooks = (agentManager) => {
20
- const { authenticate: authenticator, getAuth, authStore, isLocalEnv, } = agentManager;
20
+ const { authenticate: authenticator, getIsLocal, getAuth, authStore, } = 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, } = {}) => {
@@ -54,7 +54,7 @@ const authHooks = (agentManager) => {
54
54
  if (!authClient) {
55
55
  throw new Error("Auth client not initialized");
56
56
  }
57
- authClient.login(Object.assign(Object.assign({ identityProvider: isLocalEnv
57
+ authClient.login(Object.assign(Object.assign({ identityProvider: getIsLocal()
58
58
  ? utils_1.LOCAL_INTERNET_IDENTITY_PROVIDER
59
59
  : utils_1.IC_INTERNET_IDENTITY_PROVIDER }, options), { onSuccess: () => {
60
60
  authenticate()
@@ -87,7 +87,7 @@ const authHooks = (agentManager) => {
87
87
  }
88
88
  });
89
89
  onLogin === null || onLogin === void 0 ? void 0 : onLogin(() => loginPromise);
90
- }), [onLogin, onLoginSuccess, onLoginError, isLocalEnv, authenticate]);
90
+ }), [onLogin, onLoginSuccess, onLoginError, authenticate]);
91
91
  const logout = react_1.default.useCallback((options) => __awaiter(void 0, void 0, void 0, function* () {
92
92
  const authClient = getAuth();
93
93
  if (!authClient) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ic-reactor/react",
3
- "version": "1.2.2",
3
+ "version": "1.2.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.2.2",
38
+ "@ic-reactor/core": "^1.2.3",
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": "9d79b40cd3306d2f363ac7ab3a6b9815300648d6"
50
+ "gitHead": "ae71ae0c7eee0ebe8a97751d4222054668a6b994"
51
51
  }