@campnetwork/origin 0.0.4 → 0.0.6

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
@@ -4,26 +4,26 @@
4
4
  <br/>
5
5
 
6
6
  <p align="center">
7
- <a href="https://www.npmjs.com/package/@campnetwork/sdk"><img src="https://img.shields.io/npm/v/@campnetwork/sdk?style=for-the-badge" alt="npm version"/></a>
7
+ <a href="https://www.npmjs.com/package/@campnetwork/origin"><img src="https://img.shields.io/npm/v/@campnetwork/origin?style=for-the-badge" alt="npm version"/></a>
8
8
  <img alt="GitHub License" src="https://img.shields.io/github/license/campaign-layer/camp-sdk?style=for-the-badge">
9
- <img src="https://img.shields.io/npm/last-update/%40campnetwork%2Fsdk?style=for-the-badge" alt="npm last update"/>
10
- <img alt="NPM Downloads" src="https://img.shields.io/npm/d18m/%40campnetwork%2Fsdk?style=for-the-badge">
9
+ <img src="https://img.shields.io/npm/last-update/%40campnetwork%2Forigin?style=for-the-badge" alt="npm last update"/>
10
+ <img alt="NPM Downloads" src="https://img.shields.io/npm/d18m/%40campnetwork%2Forigin?style=for-the-badge">
11
11
  </p>
12
12
 
13
13
  # Origin SDK
14
14
 
15
15
  The Origin SDK currently exposes the following modules:
16
16
 
17
- - `"@campnetwork/sdk"` - The main entry point for the SDK, exposes the following classes:
17
+ - `"@campnetwork/origin"` - The main entry point for the SDK, exposes the following classes:
18
18
  - `TwitterAPI` - For fetching user Twitter data from the Auth Hub
19
19
  - `SpotifyAPI` - For fetching user Spotify data from the Auth Hub
20
20
  - `Auth` - For authenticating users with the Origin SDK
21
- - `"@campnetwork/sdk/react"` - Exposes the CampProvider and CampContext, as well as React components and hooks for authentication and fetching user data via the Camp Auth Hub
21
+ - `"@campnetwork/origin/react"` - Exposes the CampProvider and CampContext, as well as React components and hooks for authentication and fetching user data via the Camp Auth Hub
22
22
 
23
23
  # Installation
24
24
 
25
25
  ```bash
26
- npm install @campnetwork/sdk
26
+ npm install @campnetwork/origin
27
27
  ```
28
28
 
29
29
  # Core
@@ -33,13 +33,13 @@ The core modules can be imported either as a CommonJS module or as an ES6 module
33
33
  ### CommonJS
34
34
 
35
35
  ```js
36
- const { TwitterAPI, SpotifyAPI, Auth } = require("@campnetwork/sdk");
36
+ const { TwitterAPI, SpotifyAPI, Auth } = require("@campnetwork/origin");
37
37
  ```
38
38
 
39
39
  ### ES6
40
40
 
41
41
  ```js
42
- import { TwitterAPI, SpotifyAPI, Auth } from "@campnetwork/sdk";
42
+ import { TwitterAPI, SpotifyAPI, Auth } from "@campnetwork/origin";
43
43
  ```
44
44
 
45
45
  ## Socials
@@ -278,7 +278,7 @@ You may use the `redirectUri` object to redirect the user to different pages bas
278
278
  You may only define the URIs for the socials you are using, the rest will default to `window.location.href`.
279
279
 
280
280
  ```js
281
- import { Auth } from "@campnetwork/sdk";
281
+ import { Auth } from "@campnetwork/origin";
282
282
 
283
283
  const auth = new Auth({
284
284
  clientId: string,
@@ -541,7 +541,7 @@ The React components and hooks can be imported as ES6 modules. The example below
541
541
  // main.jsx
542
542
  import { StrictMode } from "react";
543
543
  import { createRoot } from "react-dom/client";
544
- import { CampProvider } from "@campnetwork/sdk/react";
544
+ import { CampProvider } from "@campnetwork/origin/react";
545
545
  import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
546
546
  import App from "./App.jsx";
547
547
 
@@ -566,7 +566,7 @@ It can also take the following optional props:
566
566
  - `redirectUri` - `string | object` - Either a string that will be used as the redirect URI for all socials, or an object with the following optional properties: `twitter`, `discord`, `spotify`. This is used to redirect the user to different pages after they have completed the OAuth flow for a social.
567
567
 
568
568
  ```jsx
569
- import { CampProvider } from "@campnetwork/sdk/react";
569
+ import { CampProvider } from "@campnetwork/origin/react";
570
570
  // ...
571
571
  function App() {
572
572
  return (
@@ -583,7 +583,7 @@ function App() {
583
583
  Or, with an object for the `redirectUri`:
584
584
 
585
585
  ```jsx
586
- import { CampProvider } from "@campnetwork/sdk/react";
586
+ import { CampProvider } from "@campnetwork/origin/react";
587
587
  // ...
588
588
  function App() {
589
589
  return (
@@ -605,7 +605,7 @@ The `CampProvider` component sets up the context for the Origin SDK and provides
605
605
 
606
606
  ## CampModal
607
607
 
608
- ![@campnetwork/sdk](https://imgur.com/n9o0rJ3.png)
608
+ ![@campnetwork/origin](https://imgur.com/n9o0rJ3.png)
609
609
 
610
610
  The **CampModal** is a one-line\* solution for authenticating users with the Origin SDK. It can be used to connect users to the Auth Hub and link and unlink social accounts.
611
611
 
@@ -628,7 +628,7 @@ The **CampModal** can take the following props:
628
628
  Basic usage of the **CampModal** component:
629
629
 
630
630
  ```jsx
631
- import { CampModal } from "@campnetwork/sdk/react";
631
+ import { CampModal } from "@campnetwork/origin/react";
632
632
 
633
633
  function App() {
634
634
  return (
@@ -642,7 +642,7 @@ function App() {
642
642
  With custom props:
643
643
 
644
644
  ```jsx
645
- import { CampModal } from "@campnetwork/sdk/react";
645
+ import { CampModal } from "@campnetwork/origin/react";
646
646
 
647
647
  function App() {
648
648
  return (
@@ -665,7 +665,7 @@ You can find more [examples here](./examples/client-side/react/providers-configu
665
665
  Only show the provider that the user is currently authenticated with (if using wagmi):
666
666
 
667
667
  ```jsx
668
- import { CampModal } from "@campnetwork/sdk/react";
668
+ import { CampModal } from "@campnetwork/origin/react";
669
669
 
670
670
  function App() {
671
671
  return (
@@ -707,7 +707,7 @@ The **LinkButton** can take the following props:
707
707
  Basic usage of the **LinkButton** component:
708
708
 
709
709
  ```jsx
710
- import { LinkButton, CampModal } from "@campnetwork/sdk/react";
710
+ import { LinkButton, CampModal } from "@campnetwork/origin/react";
711
711
 
712
712
  function App() {
713
713
  return (
@@ -731,7 +731,7 @@ The `useAuth` hook returns the instance of the Auth class that is provided by th
731
731
  It can be used as outlined in the Core section in order to build custom authentication flows, listen for events, and fetch user data.
732
732
 
733
733
  ```jsx
734
- import { useAuth } from "@campnetwork/sdk/react";
734
+ import { useAuth } from "@campnetwork/origin/react";
735
735
 
736
736
  function App() {
737
737
  const auth = useAuth();
@@ -749,7 +749,7 @@ function App() {
749
749
  The `useAuthState` hook returns the current authentication state of the user.
750
750
 
751
751
  ```jsx
752
- import { useAuthState } from "@campnetwork/sdk/react";
752
+ import { useAuthState } from "@campnetwork/origin/react";
753
753
 
754
754
  function App() {
755
755
  const { authenticated, loading } = useAuthState();
@@ -768,7 +768,7 @@ function App() {
768
768
  The `useProvider` hook returns the provider that has been set via the `setProvider` method, as well as a `setProvider` function that can be used to update the provider.
769
769
 
770
770
  ```jsx
771
- import { useProvider } from "@campnetwork/sdk/react";
771
+ import { useProvider } from "@campnetwork/origin/react";
772
772
 
773
773
  function App() {
774
774
  const { provider, setProvider } = useProvider();
@@ -793,7 +793,7 @@ function App() {
793
793
  The `useProviders` hook returns the list of providers that have been injected via EIP6963 and that the user or app can select from.
794
794
 
795
795
  ```jsx
796
- import { useProviders, useProvider } from "@campnetwork/sdk/react";
796
+ import { useProviders, useProvider } from "@campnetwork/origin/react";
797
797
 
798
798
  function App() {
799
799
  const providers = useProviders();
@@ -816,7 +816,7 @@ function App() {
816
816
  The `useConnect` hook returns functions that can be used to connect and disconnect the user.
817
817
 
818
818
  ```jsx
819
- import { useConnect, useAuthState } from "@campnetwork/sdk/react";
819
+ import { useConnect, useAuthState } from "@campnetwork/origin/react";
820
820
 
821
821
  function App() {
822
822
  const { connect, disconnect } = useConnect();
@@ -839,7 +839,7 @@ function App() {
839
839
  The `useSocials` hook returns the state of the user's linked social accounts.
840
840
 
841
841
  ```jsx
842
- import { useSocials } from "@campnetwork/sdk/react";
842
+ import { useSocials } from "@campnetwork/origin/react";
843
843
 
844
844
  function App() {
845
845
  const { data, error, isLoading } = useSocials();
@@ -862,7 +862,7 @@ function App() {
862
862
  The `useLinkSocials` hook returns functions that can be used to link and unlink social accounts.
863
863
 
864
864
  ```jsx
865
- import { useLinkSocials } from "@campnetwork/sdk/react";
865
+ import { useLinkSocials } from "@campnetwork/origin/react";
866
866
 
867
867
  function App() {
868
868
  const {
@@ -908,7 +908,7 @@ The `useModal` hook returns the state of the Auth and My Camp modals, as well as
908
908
  **Note: The `<CampModal/>` component must be rendered in the component tree for the modals to be displayed.**
909
909
 
910
910
  ```jsx
911
- import { useModal, CampModal } from "@campnetwork/sdk/react";
911
+ import { useModal, CampModal } from "@campnetwork/origin/react";
912
912
 
913
913
  function App() {
914
914
  const { isOpen, openModal, closeModal } = useModal();
@@ -932,7 +932,7 @@ The `useLinkModal` hook returns the state of the Link Socials modal, as well as
932
932
  **Note: The `<CampModal/>` component must be rendered in the component tree for the modal to be displayed.**
933
933
 
934
934
  ```jsx
935
- import { useLinkModal, CampModal } from "@campnetwork/sdk/react";
935
+ import { useLinkModal, CampModal } from "@campnetwork/origin/react";
936
936
 
937
937
  function App() {
938
938
  const { isLinkingOpen, openTwitterModal } = useLinkModal();
@@ -1001,7 +1001,7 @@ npm link
1001
1001
  Then, in the project you want to use the sdk in, run:
1002
1002
 
1003
1003
  ```bash
1004
- npm link @campnetwork/sdk
1004
+ npm link @campnetwork/origin
1005
1005
  ```
1006
1006
 
1007
1007
  This will link the local sdk to the project.