@ic-reactor/core 1.4.0 → 1.4.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/README.md CHANGED
@@ -19,7 +19,7 @@ yarn add @ic-reactor/core
19
19
  or you can use the UMD version:
20
20
 
21
21
  ```html
22
- <script src="https://github.com/B3Pay/ic-reactor/releases/download/v1.3.1/ic-reactor-core.min.js"></script>
22
+ <script src="https://github.com/B3Pay/ic-reactor/releases/download/v1.4.1/ic-reactor-core.min.js"></script>
23
23
  ```
24
24
 
25
25
  ### Using `createReactorCore`
@@ -21,6 +21,7 @@ var __rest = (this && this.__rest) || function (s, e) {
21
21
  };
22
22
  Object.defineProperty(exports, "__esModule", { value: true });
23
23
  exports.AgentManager = void 0;
24
+ /* eslint-disable no-console */
24
25
  const agent_1 = require("@dfinity/agent");
25
26
  const helper_1 = require("../../utils/helper");
26
27
  const auth_client_1 = require("@dfinity/auth-client");
@@ -89,6 +90,7 @@ class AgentManager {
89
90
  yield this.notifySubscribers();
90
91
  });
91
92
  this.authenticate = () => __awaiter(this, void 0, void 0, function* () {
93
+ console.log(`Authenticating on ${this.getIsLocal() ? "local" : "ic"} network`);
92
94
  this.updateAuthState({ authenticating: true }, "authenticating");
93
95
  try {
94
96
  this._auth = yield auth_client_1.AuthClient.create();
@@ -116,10 +118,13 @@ class AgentManager {
116
118
  if (!this._auth) {
117
119
  throw new Error("Auth client not initialized");
118
120
  }
119
- yield this._auth.login(Object.assign({ identityProvider: this.getIsLocal()
121
+ yield this._auth.login(Object.assign(Object.assign({ identityProvider: this.getIsLocal()
120
122
  ? constants_1.LOCAL_INTERNET_IDENTITY_PROVIDER
121
- : constants_1.IC_INTERNET_IDENTITY_PROVIDER }, options));
122
- yield this.authenticate();
123
+ : constants_1.IC_INTERNET_IDENTITY_PROVIDER }, options), { onSuccess: (msg) => __awaiter(this, void 0, void 0, function* () {
124
+ var _b;
125
+ yield this.authenticate();
126
+ (_b = options === null || options === void 0 ? void 0 : options.onSuccess) === null || _b === void 0 ? void 0 : _b.call(options, msg);
127
+ }) }));
123
128
  });
124
129
  this.logout = (options) => __awaiter(this, void 0, void 0, function* () {
125
130
  if (!this._auth) {
@@ -16,9 +16,7 @@ function createStoreWithOptionalDevtools(initialState, config) {
16
16
  }
17
17
  exports.createStoreWithOptionalDevtools = createStoreWithOptionalDevtools;
18
18
  const isInLocalOrDevelopment = () => {
19
- return (typeof process !== "undefined" &&
20
- (process.env.DFX_NETWORK === "local" ||
21
- process.env.NODE_ENV === "development"));
19
+ return typeof process !== "undefined" && process.env.DFX_NETWORK === "local";
22
20
  };
23
21
  exports.isInLocalOrDevelopment = isInLocalOrDevelopment;
24
22
  function isQuery(func) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ic-reactor/core",
3
- "version": "1.4.0",
3
+ "version": "1.4.2",
4
4
  "description": "A library for intracting with the Internet Computer canisters",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -52,5 +52,5 @@
52
52
  "engines": {
53
53
  "node": ">=10"
54
54
  },
55
- "gitHead": "a302e73db60f96faf9f0119ecdd02ee8dfcaa1df"
55
+ "gitHead": "89bab92f75cbbe39c9bdd6a0ac60344c6844ce5d"
56
56
  }