diff --git a/dist/index.js b/dist/index.js index b8351b1..676936c 100644 --- a/dist/index.js +++ b/dist/index.js @@ -24,7 +24,9 @@ exports.BlockstackContext = exports["default"] = void 0; var _react = _interopRequireWildcard(require("react")); -var _blockstack = require("blockstack"); +var _auth = require("@stacks/auth"); + +var _profile = require("@stacks/profile"); var _reactAtom = require("@dbeining/react-atom"); @@ -48,7 +50,7 @@ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArra function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } -function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(n); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } +function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } @@ -118,7 +120,7 @@ function handleAuthenticated(userData) { window.history.replaceState({}, document.title, window.location.pathname); var update = { userData: userData, - person: new _blockstack.Person(userData.profile), + person: new _profile.Person(userData.profile), signIn: null, authenticated: true, signOut: signOut @@ -132,7 +134,7 @@ function initBlockstack(options) { userSession = _deref3.userSession; if (!userSession) { - var _userSession = new _blockstack.UserSession(options); + var _userSession = new _auth.UserSession(options); var update = { userSession: _userSession @@ -161,7 +163,7 @@ function initBlockstack(options) { var _default = initBlockstack; exports["default"] = _default; -var BlockstackContext = (0, _react.createContext)(defaultValue); +var BlockstackContext = /*#__PURE__*/(0, _react.createContext)(defaultValue); exports.BlockstackContext = BlockstackContext; function Blockstack(props) { @@ -698,7 +700,7 @@ function useProfile(username, zoneFileLookupURL) { (0, _react.useEffect)(function () { if (userSession && username) { - (0, _blockstack.lookupProfile)(username, zoneFileLookupURL).then(setValue)["catch"](function (err) { + (0, _auth.lookupProfile)(username, zoneFileLookupURL).then(setValue)["catch"](function (err) { return console.warn("Failed to use profile:", err); }); } diff --git a/package.json b/package.json index 59dc1eb..f8e42e4 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,8 @@ }, "homepage": "https://github.com/njordhov/react-blockstack#readme", "peerDependencies": { - "blockstack": "^21.0.0", + "@stacks/auth": "^1.0.0-beta.10", + "@stacks/profile": "^1.0.0-beta.10", "react": "^16.8.0" }, "dependencies": { diff --git a/src/index.js b/src/index.js index f6361db..8f821f7 100644 --- a/src/index.js +++ b/src/index.js @@ -1,7 +1,25 @@ -import React, { Component, createContext, useState, useEffect, useContext, useCallback, useReducer } from 'react' -import { UserSession, AppConfig, Person, lookupProfile } from 'blockstack' -import { Atom, swap, useAtom, deref} from "@dbeining/react-atom" -import { isNil, isNull, isEqual, isFunction, isUndefined, merge, set, identity } from 'lodash' +import React, { + Component, + createContext, + useState, + useEffect, + useContext, + useCallback, + useReducer, +} from "react"; +import { UserSession, AppConfig, lookupProfile } from "@stacks/auth"; +import { Person } from "@stacks/profile"; +import { Atom, swap, useAtom, deref } from "@dbeining/react-atom"; +import { + isNil, + isNull, + isEqual, + isFunction, + isUndefined, + merge, + set, + identity, +} from "lodash"; const defaultValue = {userData: null, signIn: null, signOut: null, authenticated: false}