From 744802120afb24e4ade6c4b82327326d90e8311e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Friedger=20M=C3=BCffke?= Date: Fri, 30 Oct 2020 09:13:32 +0100 Subject: [PATCH 1/3] Use @stacks/auth --- dist/index.js | 12 ++++++------ package.json | 2 +- src/index.js | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/dist/index.js b/dist/index.js index b8351b1..7690bed 100644 --- a/dist/index.js +++ b/dist/index.js @@ -24,7 +24,7 @@ exports.BlockstackContext = exports["default"] = void 0; var _react = _interopRequireWildcard(require("react")); -var _blockstack = require("blockstack"); +var _auth = require("@stacks/auth"); var _reactAtom = require("@dbeining/react-atom"); @@ -48,7 +48,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 +118,7 @@ function handleAuthenticated(userData) { window.history.replaceState({}, document.title, window.location.pathname); var update = { userData: userData, - person: new _blockstack.Person(userData.profile), + person: new _auth.Person(userData.profile), signIn: null, authenticated: true, signOut: signOut @@ -132,7 +132,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 +161,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 +698,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..619f684 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,7 @@ }, "homepage": "https://github.com/njordhov/react-blockstack#readme", "peerDependencies": { - "blockstack": "^21.0.0", + "@stacks/auth": "^1.0.0-beta.7", "react": "^16.8.0" }, "dependencies": { diff --git a/src/index.js b/src/index.js index f6361db..6e1d123 100644 --- a/src/index.js +++ b/src/index.js @@ -1,5 +1,5 @@ import React, { Component, createContext, useState, useEffect, useContext, useCallback, useReducer } from 'react' -import { UserSession, AppConfig, Person, lookupProfile } from 'blockstack' +import { UserSession, AppConfig, lookupProfile, Person } from '@stacks/auth' import { Atom, swap, useAtom, deref} from "@dbeining/react-atom" import { isNil, isNull, isEqual, isFunction, isUndefined, merge, set, identity } from 'lodash' From 1118d39b64d0e4e73a3db7e5cd110812cc784a44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Friedger=20M=C3=BCffke?= Date: Wed, 18 Nov 2020 11:20:48 +0100 Subject: [PATCH 2/3] use Profile from @stacks/profile --- package.json | 3 ++- src/index.js | 26 ++++++++++++++++++++++---- 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 619f684..f8e42e4 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,8 @@ }, "homepage": "https://github.com/njordhov/react-blockstack#readme", "peerDependencies": { - "@stacks/auth": "^1.0.0-beta.7", + "@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 6e1d123..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, lookupProfile, Person } from '@stacks/auth' -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} From 06f0c6e305c5a15858411452135666cc56472ef8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Friedger=20M=C3=BCffke?= Date: Wed, 18 Nov 2020 12:10:30 +0100 Subject: [PATCH 3/3] use Person from @stacks/profile --- dist/index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dist/index.js b/dist/index.js index 7690bed..676936c 100644 --- a/dist/index.js +++ b/dist/index.js @@ -26,6 +26,8 @@ var _react = _interopRequireWildcard(require("react")); var _auth = require("@stacks/auth"); +var _profile = require("@stacks/profile"); + var _reactAtom = require("@dbeining/react-atom"); var _lodash = require("lodash"); @@ -118,7 +120,7 @@ function handleAuthenticated(userData) { window.history.replaceState({}, document.title, window.location.pathname); var update = { userData: userData, - person: new _auth.Person(userData.profile), + person: new _profile.Person(userData.profile), signIn: null, authenticated: true, signOut: signOut